// #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 runDistMappingComplete(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); //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); //the actual calculator: TpcCdcFit2DResCalc* cdc2d2 = new TpcCdcFit2DResCalc(); cdc2d2->addBranchName("FopiCdcTrack"); cdc2d2->addBranchName("TpcClusterRaw"); //just a test //cdc2d->addBranchName("MickeyCluster"); //just a test //cdc2d->addBranchName("MickeyTrack"); cdc2d2->setDistanceCut(10.); //the task: TpcRefTrackResidualTask* res2 = new TpcRefTrackResidualTask(); res2->SetResCalculator(cdc2d2); res2->SetPersistence(); fRun->AddTask(res2); //the actual calculator: TpcCdcFit2DResCalc* cdc2d = new TpcCdcFit2DResCalc(); cdc2d->addBranchName("FopiCdcTrack"); cdc2d->addBranchName("TpcClusterAligned"); //just a test //cdc2d->addBranchName("MickeyCluster"); //just a test //cdc2d->addBranchName("MickeyTrack"); cdc2d->setDistanceCut(10.); //the task: TpcRefTrackResidualTask* res = new TpcRefTrackResidualTask(); res->SetResCalculator(cdc2d); res->SetPersistence(); fRun->AddTask(res); // ----- 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: "<