// ----------------------------------------------------------------------------- // ----- build_point_events.C ----- // ----- ----- // ----- created by C. Simon on 2018-07-05 ----- // ----- ----- // ----------------------------------------------------------------------------- void build_point_events(Int_t iNEvents, const TString& tInputFilePath, const TString& tDigiInputFileName, const TString& tHitInputFileName, Int_t iNInputFiles, const TString& tMCLinkFileName, Int_t iNLinkFiles, const TString& tTofGeoVersion, Double_t dEventWindow, Int_t iTriggerSet, Int_t iMultiplicity, Bool_t bProcessHits, Bool_t bIgnoreCounterSides, Bool_t bHeavyIonCollisions) { // --------------------------------------------------------------------------- TString tLogLevel = "ERROR"; TString tLogVerbosity = "LOW"; gErrorIgnoreLevel = kWarning; gDebug = 0; TTree::SetMaxTreeSize(1000000000000LL); // [B] here: 1 TB // --------------------------------------------------------------------------- TStopwatch tTimer; tTimer.Start(); // --------------------------------------------------------------------------- FairLogger::GetLogger()->SetLogScreenLevel(tLogLevel.Data()); FairLogger::GetLogger()->SetLogVerbosityLevel(tLogVerbosity.Data()); // --------------------------------------------------------------------------- TString tSrcDir = gSystem->Getenv("VMCWORKDIR"); TString tGeoDir = tSrcDir + "/geometry"; // --------------------------------------------------------------------------- TFile::Open(tGeoDir + "/tof/geofile_tof_" + tTofGeoVersion + ".root"); gFile->Get("FAIRGeom"); if(!gGeoManager) { std::cout << "-E- build_point_events: FAIRGeom not found in geometry file!" << std::endl; return; } // --------------------------------------------------------------------------- FairFileSource* tFileSource = new FairFileSource(tInputFilePath + "/001/data/" + tDigiInputFileName); if(bProcessHits) { tFileSource->AddFriend(tInputFilePath + "/001/data/" + tHitInputFileName); } for(Int_t iInputFile = 2; iInputFile <= iNInputFiles; iInputFile++) { tFileSource->AddFile(tInputFilePath + TString::Format("/%03d/data/", iInputFile) + tDigiInputFileName); if(bProcessHits) { tFileSource->AddFriend(tInputFilePath + TString::Format("/%03d/data/", iInputFile) + tHitInputFileName); } } // --------------------------------------------------------------------------- CbmRunAna* tRun = new CbmRunAna(); tRun->SetAsync(kTRUE); tRun->SetContainerStatic(kTRUE); tRun->SetSource(tFileSource); tRun->SetOutputFile("data/unpack.out.root"); /* FairMonitor::GetMonitor()->EnableMonitor(kTRUE); */ // --------------------------------------------------------------------------- CbmMCDataManager* tDataManager = new CbmMCDataManager("MCManager"); if(bHeavyIonCollisions) { for(Int_t iInputFile = 1; iInputFile <= iNInputFiles; iInputFile++) { for(Int_t iLinkFile = 1; iLinkFile <= iNLinkFiles; iLinkFile++) { tDataManager->AddFileToChain(tInputFilePath + TString::Format("/%03d/data", iInputFile) + TString::Format("/mc/%05d/data/", iLinkFile) + tMCLinkFileName, iInputFile - 1); } } } else { for(Int_t iInputFile = 1; iInputFile <= iNInputFiles; iInputFile++) { tDataManager->AddFileToChain(tInputFilePath + TString::Format("/%03d/data/", iInputFile) + tMCLinkFileName, iInputFile - 1); } } // --------------------------------------------------------------------------- CbmTofBuildPointEvents* tEventBuilder = new CbmTofBuildPointEvents(); tEventBuilder->SetProcessHits(bProcessHits); tEventBuilder->SetEventWindow(dEventWindow); switch(iTriggerSet) { case 0: // tEventBuilder->SetTriggerCounter(5, 2, 0); tEventBuilder->SetTriggerCounter(5, 1, 0); break; case 1: // tEventBuilder->SetTriggerCounter(5, 2, 0); tEventBuilder->SetTriggerCounter(5, 1, 0); tEventBuilder->SetTriggerCounter(3, 0, 0); // tEventBuilder->SetTriggerCounter(9, 0, 0); // tEventBuilder->SetTriggerCounter(7, 0, 0); tEventBuilder->SetTriggerCounter(4, 0, 0); break; default: std::cout << "-E- build_point_events: trigger set not implemented!" << std::endl; return; } if(bIgnoreCounterSides) { tEventBuilder->SetIgnoreCounterSide(5, 1, 0, 1); tEventBuilder->SetIgnoreCounterSide(5, 2, 0, 1); } tEventBuilder->SetTriggerMultiplicity(iMultiplicity); // --------------------------------------------------------------------------- tRun->AddTask(tDataManager); tRun->AddTask(tEventBuilder); // --------------------------------------------------------------------------- std::cout << "-I- build_point_events: initializing run..." << std::endl; tRun->Init(); std::cout << "-I- build_point_events: starting run..." << std::endl; tRun->Run(0, iNEvents); // --------------------------------------------------------------------------- tTimer.Stop(); Double_t dRealTime = tTimer.RealTime(); Double_t dCPUTime = tTimer.CpuTime(); std::cout << std::endl << std::endl; std::cout << "Macro finished successfully." << std::endl; std::cout << "Real time " << dRealTime << " s, CPU time " << dCPUTime << " s" << std::endl; std::cout << std::endl; // --------------------------------------------------------------------------- // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash FairSystemInfo tSysInfo; Float_t fMaxMemory = tSysInfo.GetMaxMemory(); std::cout << ""; std::cout << fMaxMemory; std::cout << "" << endl; Float_t fCPUUsage = dCPUTime/dRealTime; std::cout << ""; std::cout << fCPUUsage; std::cout << "" << endl; /* FairMonitor::GetMonitor()->Print(); */ // --------------------------------------------------------------------------- FairRootManager::Instance()->CloseSink(); // --------------------------------------------------------------------------- RemoveGeoManager(); // --------------------------------------------------------------------------- }