void runLaserReco(TString inFile, bool doErrors, //spline fit with errors? TString laserGrid="tpc/parfiles/LaserGridJun2012.dat", TString parFile="tpc/parfiles/tpc.par", unsigned int nEvents = 0) { TString basedir = gSystem->Getenv("VMCWORKDIR"); TString outFile = inFile; outFile.ReplaceAll(".digi.root", ".reco.root"); TString paramIn = inFile; paramIn.ReplaceAll(".digi.root",".param.digi.root"); TString paramOut = outFile; paramOut.ReplaceAll(".reco.root",".param.reco.root"); std::cout<<"Input: "<SetInputFile(inFile); fRun->SetOutputFile(outFile); // ------------------------------------------------------------------------ // ----- Parameter database -------------------------------------------- FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE); parInput1->open(paramIn.Data()); FairParAsciiFileIo* parInput2 = new FairParAsciiFileIo(); parInput2->open(parFile.Data(),"in"); rtdb->setFirstInput(parInput2); rtdb->setSecondInput(parInput1); TpcDigiPar* par = (TpcDigiPar*) rtdb->getContainer("TpcDigiPar"); par->setInputVersion(fRun->GetRunId(),1); par->setChanged(kTRUE); FairParRootFileIo* parOutput1 = new FairParRootFileIo(kTRUE); parOutput1->open(paramOut.Data()); rtdb->setOutput(parOutput1); rtdb->saveOutput(); PndGeoHandling* geoH = PndGeoHandling::Instance(); //fRun->LoadGeometry(); // ------------------------------------------------------------------------ // ----- Digi Sequence -------------------------------------------- //TpcClusterizerTask* tpcClusterizer = new TpcClusterizerTask(); //tpcClusterizer->SetPersistence(); //ONLY USE THIS WHEN USING ALICE SETTINGS WITH GEANT3 //tpcClusterizer->SetMereChargeConversion(); //fRun->AddTask(tpcClusterizer); /** Nots for the use of Alice Style MC make one hit per collision with atom use other straggling WARNING: 1. geant3 has to be used! 2. LOSS = 5 has to be set! 3. DCUTE und DCUTM should be set to 10 keV. 4. For Digitaization: TpcClusterizerTask tpcClusterizer->SetMereChargeConversion() has to be set! 5. if you do not use this option make sure 2., 4. are not set! :-( 6. SetMaxNStep should be set to a high value */ // TpcLaserTask* laser = new TpcLaserTask(); // laser->SetPersistence(true); // fRun->AddTask(laser); // TpcDriftTask* tpcDrifter = new TpcDriftTask(); // tpcDrifter->SetPersistence(); // tpcDrifter->SetDistort(true, 1.); // TString devFile("tpc/parfiles/DevMap_20MeV_plateau_mode1_mom3.672_thMin0.010.dat"); // tpcDrifter->SetDeviationFile(devFile.Data()); // fRun->AddTask(tpcDrifter); // TpcGemTask* tpcGem = new TpcGemTask(); // //tpcGem->SetPersistence(); // fRun->AddTask(tpcGem); // TpcPadResponseTask* tpcPadResponse = new TpcPadResponseTask(); // //tpcPadResponse->SetPersistence(); // fRun->AddTask(tpcPadResponse); // TpcElectronicsTask* tpcElec = new TpcElectronicsTask(); // tpcElec->SetPersistence(); // //tpcElec->SetPSATimeCalib(2.8); // //tpcElec->SetSamplePersistence(); // fRun->AddTask(tpcElec); // TpcClusterFinderTask* tpcCF = new TpcClusterFinderTask(); // tpcCF->SetPersistence(true); // tpcCF->timeslice(5); // in sample times // tpcCF->SetClusterTimeCut(4); // tpcCF->SetErrorPars(600,300); // tpcCF->SetSimpleClustering(); // //tpcCF->SetSingleDigiClusterAmpCut(15); // tpcCF->SetClusterBranchName("TpcCluster"); // fRun->AddTask(tpcCF); TpcLaserMatchingTask* lmat = new TpcLaserMatchingTask(); lmat->SetPersistence(true); lmat->SetClusterBranchName("TpcCluster"); lmat->SetVerboseResiduals(true,false); lmat->SetDistCut(1.7); fRun->AddTask(lmat); //the actual calculator: TpcGFTrackResCalc* GFres = new TpcGFTrackResCalc(); GFres->addBranchName("TpcGFLaserTrack"); //the task: TpcRefTrackResidualTask* res = new TpcRefTrackResidualTask(); res->SetResCalculator(GFres); res->SetOutBranch("TpcTrackResiduals"); res->SetPersistence(); fRun->AddTask(res); TpcLaserFitTask* lf = new TpcLaserFitTask(); lf->SetSplineMeshKnots(5,3); lf->SetPlotSplineFits(true); lf->SetPersistence(true); lf->SetFitWithErrors(doErrors); fRun->AddTask(lf); // ----- Intialise and run -------------------------------------------- fRun->Init(); //Initialize the Digimapper: TpcDigiPar* tpcpar = FairRun::Instance()->GetRuntimeDb()->getContainer("TpcDigiPar"); TpcLaserGrid::Instance()->Init(tpcpar); TpcLaserGrid::Instance()->ReadFile(laserGrid); TpcDigiMapper::getInstance()->init(tpcpar); //TpcDigiMapper::getInstance()->forceManualDriftVel(forceDriftVel); //TpcAlignmentManager::init(tpcpar->getAlignmentFile()); GFFieldManager::getInstance()->init(new PndFieldAdaptor(fRun->GetField())); rtdb->print(); fRun->Run(0,nEvents); // process all events from input file // ------------------------------------------------------------------------ // ----- Finish ------------------------------------------------------- rtdb->saveOutput(); rtdb->print(); TpcLaserGrid::Instance()->Destruct(); TpcDigiMapper::getInstance()->destruct(); 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; // ------------------------------------------------------------------------ }