void runRecoFOPI_batch_standalone_mball(TString filename, TString outpath, unsigned int smoothing = 0, unsigned int nEvents = 0) { // ======================================================================== // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 1; TStopwatch timer; timer.Start(); // Load basic libraries in rootlogon gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C"); rootlogon(); TString basedir = gSystem->Getenv("VMCWORKDIR"); FairRunAna* fRun = new FairRunAna(); //FairRunSim* fSim = new FairRunSim(); // Create alignment manager TpcAlignmentManager::init(TString(basedir+"/macro/tpc/FOPI/june11_alignment.txt")); TString jobdir = outpath; std::string jobname(filename.Data()); int last = jobname.rfind("/"); if(last>0) jobname = jobname.substr(last+1,jobname.size()+1); TString outName(jobname); if(outName.Contains("repaired.")) outName.ReplaceAll(".lmd_decoded_repaired.root",".reco.root"); if(outName.Contains("decoded.")) outName.ReplaceAll(".lmd_decoded.root",".reco.root"); if(smoothing) outName.ReplaceAll("reco.root", "smoothed_reco.root"); TString outFile = outpath+"/"; outFile += outName; TString PROutFile = outFile; PROutFile.ReplaceAll(".reco.root",".patternReco.root"); TFile test(PROutFile, "recreate"); if(!test.IsZombie()) { //delete file gSystem->Setenv("PROUTFILENAME", PROutFile.Data()); gROOT->ProcessLine(".! rm $PROUTFILENAME"); gSystem->Unsetenv("PROUTFILENAME"); } fRun->SetOutputFile(outFile); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParAsciiFileIo* parInput1 = new FairParAsciiFileIo(); TString tpcDigiFile = basedir; //tpcDigiFile += "/tpc/TestBench/tpc.TBtestChamber.par"; tpcDigiFile += "/tpc/TestBench/tpc.TBtestChamber.June11.par"; //tpcDigiFile += "/tpc/FOPI/par/tpc.TBtestChamber.par"; parInput1->open(tpcDigiFile.Data(),"in"); cout<<"################################################################################"<setFirstInput(parInput1); rtdb->print(); TString geoFile = basedir; geoFile+="/tpc/parfiles/FOPIGeo.root"; fRun->SetGeomFile(geoFile); PndConstField *fMagField=new PndConstField(); fMagField->SetField(0., 0. , 6. ); // values are in kG // values are in cm fMagField->SetFieldRegion(-50, 50,-50, 50, -2000, 2000); fRun->SetField(fMagField); //extract number of entries in external data tree TFile testFile(filename); unsigned int numEvents = ((TTree*)testFile.Get("tpcEvent"))->GetEntries(); std::cout<<"Found "<numEvents) nEvents=numEvents; //--------------------SET UP TASKS ------------------------------ //FairGeane *Geane = new FairGeane(); //fRun->AddTask(Geane); TpcDataReaderTask* read = new TpcDataReaderTask(); read->SetPersistence(); read->SetDatafile(filename); read->SetSampleBranchName("TpcSample"); //read->SetCutSmallPad(); //read->SetMinSamples(1000); fRun->AddTask(read); // FopiDataReaderTask* readFopi = new FopiDataReaderTask(); // readFopi->SetPersistence(); // //not (re)implemented yet, but it is only a double-check // //readFopi->SetRunNr(runNr); // readFopi->SetInputFile(fopiFilename); // //readFopi->SetNevent(nFopiEvents); // fRun->AddTask(readFopi); TpcPSATask* tpsa = new TpcPSATask(); tpsa->SetPersistence(); tpsa->SetSampleBranchName("TpcSample"); // Input of PSA fRun->AddTask(tpsa); TpcClusterFinderTask* tpcCF = new TpcClusterFinderTask(); tpcCF->SetDigiPersistence(); // keep Digis copys in clusters tpcCF->SetPersistence(); // keep Clusters tpcCF->timeslice(6); //in samples tpcCF->SetSingleDigiClusterAmpCut(20); tpcCF->SetClusterAmpCut(9.1); // cut on mean digi amplitude tpcCF->SetErrorPars(600,400); tpcCF->SetSimpleClustering(); // use TpcClusterFinderSimple fRun->AddTask(tpcCF); TpcClusterAlignmentTask *tpcAlign = new TpcClusterAlignmentTask(); tpcAlign->SetPersistence(); tpcAlign->SetClusterInBranchName("TpcClusterRaw"); tpcAlign->SetClusterOutBranchName("TpcClusterAligned"); fRun->AddTask(tpcAlign); //find TpcRiemannTracks in the TPC alone TpcRiemannTrackingTask* tpcSPR = new TpcRiemannTrackingTask(); tpcSPR->SetPersistence(); tpcSPR->SetClusterBranchName("TpcClusterRaw"); tpcSPR->SetVerbose(1); fRun->AddTask(tpcSPR); //build GFTracks from TpcRiemannTracks TpcTrackInitTask* trackInit=new TpcTrackInitTask(); trackInit->SetPersistence(); //trackInit->SetClusterBranchName("TpcClusterRaw"); trackInit->SetRiemannBranchName("RiemannTrack"); trackInit->SetOutBranchName("TpcPreFit"); //trackInit->SetVerbose(1); //trackInit->SetMCPid(); // use ideal particle identification trackInit->SetClusterBranchName("TpcClusterRaw"); trackInit->SetPDG(211); //trackInit->useGeane(); // uses RKTrackrep and GeaneTrackrep trackInit->SetSmoothing(true); fRun->AddTask(trackInit); // TpcSLPatternRecoTask* tpcSLPR = new TpcSLPatternRecoTask(); // tpcSLPR->SetPersistence(true); // tpcSLPR->SetStoreHistograms(PROutFile); // tpcSLPR->SetClusterAmpCut(20.); // tpcSLPR->SetCutTracksParallelZ(5); // //tpcSLPR->SetXSorting(true); // double parMins[4] = {-TMath::Pi(),0.,-TMath::Pi(),0.}; // double parMaxs[4] = {TMath::Pi(),10.,TMath::Pi(),20.}; // tpcSLPR->SetParameterSpace(parMins, parMaxs); // tpcSLPR->SetDepth(8); // tpcSLPR->SetThresh(15); // tpcSLPR->SetMinCandHits(15); // tpcSLPR->SetClusterBranchName("TpcCluster"); // tpcSLPR->SetTrackBranchName("TpcTrackPreFit"); // tpcSLPR->SetAbsMomentum(1000); // fRun->AddTask(tpcSLPR); KalmanTask* kalman =new KalmanTask(); kalman->SetPersistence(); //kalman->SetClusterBranchName("TpcCluster_cut"); kalman->SetTpcClusterBranchName("TpcClusterRaw"); kalman->SetTrackBranchName("TpcPreFit"); kalman->SetOutBranchName("TpcPostFit"); kalman->SetNumIterations(3); // number of fitting iterations (back and forth) fRun->AddTask(kalman); /* TpcCdcMatchingTask* tpcCdcMatch = new TpcCdcMatchingTask(); tpcCdcMatch->SetPersistence(); tpcCdcMatch->SetTpcClusterBranchName("TpcClusterAligned"); tpcCdcMatch->SetTpcTrackBranchName("TpcPostFit"); tpcCdcMatch->SetOutBranchName("TpcPostFit"); tpcCdcMatch->SetMaxMatDistance(.5); tpcCdcMatch->SetMaxMatPhi(acos(0.)); tpcCdcMatch->SetMinHitsperLength(0.0); tpcCdcMatch->SetMinClus(30); fRun->AddTask(tpcCdcMatch); */ // TpcResidualTask* Res = new TpcResidualTask(); // Res->SetPersistence(); // Res->SetNumberOfTrackReps(2); // set to 2 if you use GeaneTrackrep (tpcSPR->useGeane();) //SLres->SetClusterBranchName("TpcCluster_cut"); // fRun->AddTask(Res); // TpcSLResidualTask* SLres = new TpcSLResidualTask(); // SLres->SetPersistence(); //SLres->SetClusterBranchName("TpcCluster_cut"); // SLres->SetSecondarySuppression(true); //fRun->AddTask(SLres); TpcdEdxTask* dEdx = new TpcdEdxTask(); dEdx->SetPersistence(); //dEdx->SetIdealdEdx(); dEdx->SetTrackBranchName("TpcPostFit"); dEdx->SetClusterBranchName("TpcClusterAligned"); dEdx->SetDXgrid(0.6); fRun->AddTask(dEdx); // ----- Intialise and run -------------------------------------------- fRun->Init(); //Initialize te Digimapper: TpcDigiPar* tpcpar = FairRun::Instance()->GetRuntimeDb()->getContainer("TpcDigiPar"); TpcDigiMapper::getInstance()->init(tpcpar); //TpcDigiMapper::getInstance()->forceManualDriftVel(forceDriftVel); rtdb->print(); fRun->Run(0,nEvents); timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); printf("RealTime=%f seconds, CpuTime=%f seconds\n",rtime,ctime); std::cout<<"OutputFile: "<