void runReco(TString digifile, int field, TString gas, int gain, unsigned int nEvents = 0, unsigned int nEvStart = 0, unsigned int outnum=0, int fADCSens, int fC) { gRandom->SetSeed(4711); // ======================================================================== // Verbosity level (0=quiet, 1=event level, 2=track level, 3=debug) Int_t iVerbose = 0; //gROOT->ProcessLine(".x $VMCWORKDIR/gconfig/rootlogon.C"); // Input file // Input file TString inDigiFile = digifile; TString inSimFile = inDigiFile; inSimFile.ReplaceAll("raw.root", "mc.root"); // Parameter file TString parFile = inDigiFile; parFile.ReplaceAll("raw.root", "param.root"); // Output file TString outFile = inDigiFile; outFile.ReplaceAll(".raw.root", Form("_%i_%i.reco.root", fADCSens, fC)); //if (outnum>0) // outFile.ReplaceAll(".root",Form("_%i.root", outnum)); // Number of events to process // Int_t nEvents = 0; // ---- Load libraries ------------------------------------------------- TString sysFile = gSystem->Getenv("VMCWORKDIR"); // ------------------------------------------------------------------------ // In general, the following parts need not be touched // ======================================================================== // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ TDatabasePDG::Instance()->AddParticle("deuteron","deuteron", 1.875612793, kTRUE, 0, 3,"nucleus", 1000010020, -1, 45); // ----- Digitization run ------------------------------------------- FairRunAna *fRun= new FairRunAna(); fRun->SetInputFile(inDigiFile); cout<<"Set Input File: "<AddFriend(inSimFile); cout<<"Set Friend MC File: "<SetOutputFile(outFile); cout<<"Set Output File: "<Getenv("VMCWORKDIR"); tpcDigiFile += Form("/tpc/FOPI/par/tpc.%i%s%iMC_long.par",field,gas.Data(),gain); // parInput1->open(tpcDigiFile.Data(),"in"); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(); parInput1->open(parFile.Data()); FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo(); parIo1->open(tpcDigiFile.Data(),"in"); rtdb->setFirstInput(parInput1); rtdb->setSecondInput(parIo1); PndGeoHandling* geoH = PndGeoHandling::Instance(); // ------- RECO procedure ------------------------------------------------ //TpcAlignmentManager::init(basedir+"/tpc/parfiles/dummyAlignment.Prototype.txt"); //TpcAlignmentManager * align = TpcAlignmentManager::getInstance(); TpcClusterFinderTask* tpcCF = new TpcClusterFinderTask(); tpcCF->SetDigiPersistence(); // keep reference to digis in clusters tpcCF->SetPersistence(); // keep Clusters tpcCF->timeslice(8); //in samples tpcCF->SetThreshold(0); tpcCF->SetSingleDigiClusterAmpCut(0.); tpcCF->SetClusterAmpCut(0.); // cut on mean digi amplitude tpcCF->SetErrorPars(fADCSens, fC); tpcCF->SetSimpleClustering(); // use TpcClusterFinderSimple tpcCF->SetVerbose(100); fRun->AddTask(tpcCF); //the actual calculator: TpcMCResCalcSample* mc3dSample = new TpcMCResCalcSample(); mc3dSample->addBranchName("TpcPoint"); mc3dSample->addBranchName("TpcSample"); mc3dSample->skipSecondaries(); //the task: TpcRefTrackResidualTask* resSample = new TpcRefTrackResidualTask(); resSample->SetOutBranch("MC_Sample_Residuals"); resSample->SetResCalculator(mc3dSample); resSample->SetPersistence(); fRun->AddTask(resSample); //the actual calculator: TpcMCResCalcDigi* mc3dDigi = new TpcMCResCalcDigi(); mc3dDigi->addBranchName("TpcPoint"); mc3dDigi->addBranchName("TpcDigi"); mc3dDigi->skipSecondaries(); //the task: TpcRefTrackResidualTask* resDigi = new TpcRefTrackResidualTask(); resDigi->SetOutBranch("MC_Digi_Residuals"); resDigi->SetResCalculator(mc3dDigi); resDigi->SetPersistence(); fRun->AddTask(resDigi); //the actual calculator: TpcMCResCalcCluster* mc3dCluster = new TpcMCResCalcCluster(); mc3dCluster->addBranchName("TpcPoint"); mc3dCluster->addBranchName("TpcCluster"); mc3dCluster->skipSecondaries(); //the task: TpcRefTrackResidualTask* resCluster = new TpcRefTrackResidualTask(); resCluster->SetOutBranch("MC_Cluster_Residuals"); resCluster->SetResCalculator(mc3dCluster); resCluster->SetPersistence(); fRun->AddTask(resCluster); /*TpcClusterAlignmentTask *tpcAlign = new TpcClusterAlignmentTask(); tpcAlign->SetPersistence(); tpcAlign->SetClusterInBranchName("TpcClusterRaw"); tpcAlign->SetClusterOutBranchName("TpcCluster"); fRun->AddTask(tpcAlign); */ //find TpcRiemannTracks in the TPC alone /*TpcRiemannTrackingTask* tpcSPR = new TpcRiemannTrackingTask(); tpcSPR->SetClusterBranchName("TpcCluster"); tpcSPR->SetPersistence(); tpcSPR->SetSortingParameters(true,1,0); //tpcSPR->SetVerbose(1); fRun->AddTask(tpcSPR);*/ //build GFTracks from TpcRiemannTracks /*TpcTrackInitTask* trackInit=new TpcTrackInitTask(); trackInit->SetClusterBranchName("TpcCluster"); trackInit->SetOutBranchName("TpcTrackPreFit"); trackInit->SetPersistence(); //trackInit->SetVerbose(1); trackInit->SetMCPid(); // use ideal particle identification //trackInit->SetPDG(211); //trackInit->useGeane(); // uses RKTrackrep and GeaneTrackrep if (smoothing==1) trackInit->SetSmoothing(true); fRun->AddTask(trackInit);*/ /*KalmanTask* kalman =new KalmanTask(); kalman->SetTpcClusterBranchName("TpcCluster"); kalman->SetTrackBranchName("TpcTrackPreFit"); kalman->SetOutBranchName("TrackPostFit"); kalman->SetPersistence(); kalman->SetNumIterations(3); // number of fitting iterations (back and forth) fRun->AddTask(kalman);*/ // ----- Intialise and run -------------------------------------------- fRun->Init(); // std::cout<<"Number of events to process:"<GetRuntimeDb()->getContainer("TpcDigiPar"); TpcDigiMapper::getInstance()->init(tpcpar); std::cout<<"post init"<Run(nEvStart, nEvents); rtdb->saveOutput(); rtdb->print(); // ------------------------------------------------------------------------ // ----- Finish ------------------------------------------------------- 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 " << parFile << endl; cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; // ------------------------------------------------------------------------ }