// #include "TString.h" // #include "TStopwatch.h" // #include "TROOT.h" // #include "FairRunAna.h" // #include "FairRuntimeDb.h" // #include "FairParAsciiFileIo.h" // #include "PndConstField.h" // #include "TPython.h" // #include "TpcEventIdCopyTask.h" // #include "TpcCdcFit2DResCalc.h" // #include "TpcRefTrackResidualTask.h" // #include void runDistMappingGENFIT(TString fileList, TString outFile, unsigned int nEvents) { // ======================================================================== // 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(); fRun->SetOutputFile(outFile); FairRuntimeDb* rtdb = fRun->GetRuntimeDb(); FairParAsciiFileIo* parInput1 = new FairParAsciiFileIo(); TString digiFile = basedir; digiFile+="/tpc/TestBench/tpc.TBtestChamber.par"; parInput1->open(digiFile.Data(),"in"); rtdb->setFirstInput(parInput1); rtdb->Print(); TString geoFile = basedir; geoFile+="/tpc/TestBench/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); GFFieldManager::getInstance()->init(new PndFieldAdaptor(fRun->GetField())); //use python do parse filelist TPython::LoadMacro("macro/tpc/FOPI/parseFiles.py"); PyFileParser fp; fp.setFiles(fileList.Data()); int nFiles = (int)fp.getNum(); for(int i=0; iSetInputFile((char*)fp.getFile(i)); else fRun->AddFile((char*)fp.getFile(i)); } //--------------------SET UP TASKS ------------------------------ //FairGeane *Geane = new FairGeane(); //fRun->AddTask(Geane); TpcEventIdCopyTask* copy = new TpcEventIdCopyTask(); copy->SetPersistence(); copy->SetEvtIdInBranch("TpcEventIdentifier"); copy->SetEvtIdOutBranch("TpcEventIdentifierOut"); fRun->AddTask(copy); FopiTrackInitTask* muh = new FopiTrackInitTask(); muh->SetPersistence(); muh->SetOutBranchNames("CdcTrackPreFitNew"); fRun->AddTask(muh); KalmanTask* fitter = new KalmanTask(); fitter->SetFopiCDCBranchName("FopiCdcHit"); fitter->SetTpcClusterBranchName("TpcClusterRaw"); fitter->SetTrackBranchName("CdcTrackPreFitNew"); fitter->SetOutBranchName("CdcTrackPostFitNew"); fRun->AddTask(fitter); //the actual calculator: TpcRefGFTrkResCalc* cdcGF = new TpcRefGFTrkResCalc(); cdcGF->addBranchName("CdcTrackPostFitNew"); cdcGF->addBranchName("TpcClusterRaw"); //just a test cdcGF->setXYWindow(10.); //the task: TpcRefTrackResidualTask* res = new TpcRefTrackResidualTask(); res->SetResCalculator(cdcGF); res->SetOutBranch("TpcRefTrackResidualRaw"); res->SetPersistence(); //fRun->AddTask(res); TpcRefGFTrkResCalc* cdcGF2 = new TpcRefGFTrkResCalc(); cdcGF2->addBranchName("CdcTrackPostFitNew"); cdcGF2->addBranchName("TpcClusterAligned"); //just a test cdcGF2->setXYWindow(10.); //the task: TpcRefTrackResidualTask* res2 = new TpcRefTrackResidualTask(); res2->SetResCalculator(cdcGF2); res2->SetOutBranch("TpcRefTrackResidualAligned"); res2->SetPersistence(); fRun->AddTask(res2); // ----- Intialise and run -------------------------------------------- fRun->Init(); 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: "<