void runRecoFOPI_batch(TString filename, TString outpath) { // ======================================================================== // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 1; // ---- Load libraries ------------------------------------------------- //gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C"); //basiclibs(); gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C"); //gROOT->Macro("tpc/TestChamber/macro/christian_style.C"); rootlogon(); TString basedir = gSystem->Getenv("VMCWORKDIR"); //Set JOBNAME and JOBDIR // ------------------------------------------------------------------- TString jobdir = outpath; //Fuck TString. std::string jobname(filename.Data()); int last = jobname.rfind("/"); if(last>0) jobname = jobname.substr(last+1,jobname.size()+1); TString outName(jobname); outName.ReplaceAll(".lmd_decoded_repaired.root",".reco.root"); TString outFile = outpath+"/"; outFile += outName; TString inFile=jobdir; inFile+="/dummy/dummy.raw.root"; //TString inFile="/nfs/hicran/data/tpc/fopi/2010/reconstructed/dummy/dummy.raw.root"; TString mcFile=inFile; mcFile.ReplaceAll(".raw",".mc"); 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"); } TString paramIn1 = inFile; TString paramIn2 = inFile; paramIn1.ReplaceAll(".raw.root",".mc.param.root"); paramIn2.ReplaceAll(".raw.root",".digi.param.root"); TString paramOut = outFile; paramOut.ReplaceAll(".reco.root",".reco.param.root"); std::cout<<"Input: "<SetInputFile(mcFile); fRun->AddFriend(inFile); fRun->SetOutputFile(outFile); // ------------------------------------------------------------------------ // ----- Parameter database -------------------------------------------- FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE); parInput1->open(paramIn1.Data()); FairParRootFileIo* parInput2 = new FairParRootFileIo(kTRUE); parInput2->open(paramIn2.Data()); FairParAsciiFileIo* parInput3 = new FairParAsciiFileIo(); TString tpcDigiFile = gSystem->Getenv("VMCWORKDIR"); tpcDigiFile += "/tpc/TestBench/tpc.TBtestChamber.par"; parInput3->open(tpcDigiFile.Data(),"in"); rtdb->setFirstInput(parInput1); //root file IO tends to fail, use ASCII first rtdb->setSecondInput(parInput2); rtdb->Print(); //FairGeane *Geane = new FairGeane(); //fRun->AddTask(Geane); //std::cout<<"\nGEANE initialised"<SetPersistence(); read->SetDatafile(filename); read->SetClusterBranchName("TpcSample"); //read->SetCutSmallPad(); //read->SetMinSamples(1000); fRun->AddTask(read); //TpcTCcrossTalkTask* CT = new TpcTCcrossTalkTask(); //CT->SetPersistence(); //fRun->AddTask(CT); TpcPSATask* tpsa = new TpcPSATask(); tpsa->SetPersistence(); tpsa->SetSampleBranchName("TpcSample"); fRun->AddTask(tpsa); TpcClusterFinderTask* tpcCF = new TpcClusterFinderTask(); //tpcCF->SetDataMode(true); //prevents usage of FairLinks tpcCF->SetMode(2); // 0 - global time bins; 1 - individual time bins for each sector; 2 - each pad gets its time window - actually we search for gaps on a pad; tpcCF->SetDataMode(true); tpcCF->SetPersistence(); tpcCF->SetDigiBranchName("TpcDigi"); tpcCF->timeslice(20); //in samples tpcCF->SetDiffFactor(1.); tpcCF->SetClusterTimeCut(5.); tpcCF->SetSingleDigiClusterAmpCut(15); tpcCF->SetErrorPars(600,300); //tpcCF->SetTrivialClustering(); //tpcCF->SetSimpleClustering(); // use TpcClusterFinderSimple fRun->AddTask(tpcCF); //actually MODIFIES existing clusters, does NOT create a new branch TpcClusterCorrectionTask* tpcCC = new TpcClusterCorrectionTask(); double pars[6] = {-0.115634, -1.85970, 11.5997, -24.8201, 24.9152,-9.56801}; tpcCC->SetParameters(pars); // fRun->AddTask(tpcCC); //TpcCTapplyTask* CTapply = new TpcCTapplyTask(); //CTapply->SetPersistence(); //fRun->AddTask(CTapply); //find TpcRiemannTracks in the TPC alone TpcRiemannTrackingTask* tpcSPR = new TpcRiemannTrackingTask(); //tpcSPR->SetPersistence(); //tpcSPR->SetVerbose(1); fRun->AddTask(tpcSPR); //build GFTracks from TpcRiemannTracks TpcTrackInitTask* trackInit=new TpcTrackInitTask(); trackInit->SetPersistence(); //trackInit->SetVerbose(1); //trackInit->SetMCPid(); // use ideal particle identification 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(30.); 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(22); tpcSLPR->SetMinCandHits(22); //tpcSLPR->SetClusterBranchName("TpcCluster_cut"); tpcSLPR->SetAbsMomentum(1000); //fRun->AddTask(tpcSLPR); //TpcTCtrackFit* tf = new TpcTCtrackFit(); //tf->SetPersistence(); //tf->SetDraw(); //fRun->AddTask(tf); KalmanTask* kalman =new KalmanTask(); kalman->SetPersistence(); //kalman->SetClusterBranchName("TpcCluster_cut"); kalman->SetNumIterations(3); // number of fitting iterations (back and forth) //fRun->AddTask(kalman); TrackFitStatTask* fitstat=new TrackFitStatTask(); fitstat->SetPersistence(); // fitstat->SetMCPCut(0); // in sigma dp/p fitstat->SetMCCuts(0.005, // pmin 10., // pmax -TMath::Pi(), // thetamin 5deg TMath::Pi(), // thetamax 5); // nTpcPoints fitstat->SetPdgSelection(11);//321 //fitstat->DoResiduals(); //fRun->AddTask(fitstat); TpcSLResidualTask* SLres = new TpcSLResidualTask(); SLres->SetPersistence(); //SLres->SetClusterBranchName("TpcCluster_cut"); SLres->SetSecondarySuppression(false); //fRun->AddTask(SLres); // ----- Intialise and run -------------------------------------------- fRun->Init(); fRun->Run(0,0); // ------------------------------------------------------------------------ //FairRootManager::Instance()->GetOutFile()->mkdir("QAPlots"); //FairRootManager::Instance()->GetOutFile()->cd("QAPlots"); //qa->Write(); // ----- Finish ------------------------------------------------------- //tpcRMC->WriteHistograms(); // tpcSPR->WriteHistograms("RecoHistos.root"); //kalman->WriteHistograms("RecoHistos.root"); //fitstat->WriteHistograms("RecoHistos.root"); //dEdx->WriteHistograms("RecoHistos.root"); DebugLogger::Instance()->WriteFiles(); //delete tpcSplitter; rtdb->saveOutput(); rtdb->print(); timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished succesfully." << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << paramOut << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; // ------------------------------------------------------------------------ }