// ----------------------------------------------------------------------------- // ----- run_reco_tb_digi_hic.C ----- // ----- ----- // ----- created by C. Simon on 2018-02-18 ----- // ----- ----- // ----------------------------------------------------------------------------- void run_reco_tb_digi_hic(Int_t nEvents = 2, const char* setupName = "sps_nov15", UInt_t uSeedIncrement = 0, Double_t dSpillLength = 1., Double_t dSpillBreakLength = 0., Bool_t bAverageSpills = kFALSE, Int_t iNSerialSpills = 1, Bool_t bRunQA = kTRUE, Bool_t bHitCompatibility = kFALSE, Bool_t bAlternativeBranchNames = kFALSE, Int_t iNMCLinkFiles = 10, Bool_t bBuildCbmEvents = kFALSE, Bool_t bBuildHits = kTRUE) { // ========================================================================= // === Settings === // ========================================================================= // --- File names TString outDir = "data/"; TString inFile = outDir + setupName + "_test.raw.root"; // input file TString parFile = outDir + setupName + "_params.root"; // parameter file TString outFile = outDir + setupName + "_test.reco.root"; // output file TString histFile = outDir + setupName + "_hist.reco.root"; // histogram file TString mcFileFormat = outDir + "mc/%05d/data/" + setupName + "_test.mc.root"; // MC link file format delete gRandom; gRandom = new TRandomMixMax(uSeedIncrement + 4357); // Log level TString logLevel = "ERROR"; TString logVerbosity = "LOW"; gErrorIgnoreLevel = kWarning; // ---- Debug option ------------------------------------------------- gDebug = 0; // ======================================================================== // ---- Set the log level FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ // ----- Reconstruction run ------------------------------------------- FairFileSource* source = new FairFileSource(inFile); CbmRunAna *run = new CbmRunAna(); run->SetSource(source); run->SetOutputFile(outFile); // run->SetEventHeaderPersistence(kFALSE); // TODO: requires FairRoot v-17.03 FairRootManager::Instance()->SetUseFairLinks(kFALSE); /* FairMonitor::GetMonitor()->EnableMonitor(kTRUE); */ // ------------------------------------------------------------------------ // ========================================================================= // === Reconstruction chain === // ========================================================================= CbmTofBuildMCEvents* tTofEB = new CbmTofBuildMCEvents(); tTofEB->SetNumberSortEvents(kFALSE); if(bBuildCbmEvents) { run->AddTask(tTofEB); } CbmMCDataManager* mcManager = new CbmMCDataManager("MCManager"); for(Int_t iMCLinkFile = 1; iMCLinkFile <= iNMCLinkFiles; iMCLinkFile++) { mcManager->AddFileToChain(TString::Format(mcFileFormat, iMCLinkFile), (Int_t)uSeedIncrement - 1); } run->AddTask(mcManager); CbmTofClusterMC* tTofClu = new CbmTofClusterMC(); tTofClu->SetTimeSortHits(kTRUE); tTofClu->BuildHitsFromPointClusters(kTRUE); // TODO // tTofClu->BuildHitsFromRefTracks(kTRUE); tTofClu->SetHitCompatibilityMode(bHitCompatibility); tTofClu->SetAlternativeBranchNames(bAlternativeBranchNames); tTofClu->SetFileIndex((Int_t)uSeedIncrement - 1); if(bBuildHits) { run->AddTask(tTofClu); } CbmTofMatchReco* tTofMatch = new CbmTofMatchReco(); tTofMatch->SetAlternativeBranchNames(bAlternativeBranchNames); if(bBuildHits) { run->AddTask(tTofMatch); } CbmTofRecoMCQa* tTofQa = new CbmTofRecoMCQa(); tTofQa->SetAverageSpills(bAverageSpills); tTofQa->SetLocalRadius(0.2); // in [cm] tTofQa->SetSpillLength(dSpillLength); tTofQa->SetSpillBreakLength(dSpillBreakLength); tTofQa->SetDataTimeOffset((dSpillLength + dSpillBreakLength)*iNSerialSpills*(uSeedIncrement - 1)*1e9); tTofQa->SetNSerialSpills(iNSerialSpills); tTofQa->SetTimeAxisBinWidth(0.05); // in [s] tTofQa->SetHistogramFileName(histFile.Data()); tTofQa->SetFillLocalHistos(kFALSE); // FIXME tTofQa->SetHitCompatibilityMode(bHitCompatibility); tTofQa->SetAlternativeBranchNames(bAlternativeBranchNames); tTofQa->SetConsiderPointClusters(kTRUE); // TODO // tTofQa->SetConsiderRefTracks(kTRUE); tTofQa->SetChiSquareLimit(5.); if(bRunQA && bBuildHits) { run->AddTask(tTofQa); } // ----- Parameter database -------------------------------------------- FairRuntimeDb* rtdb = run->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); parIo1->open(parFile.Data(),"UPDATE"); rtdb->setFirstInput(parIo1); // ------------------------------------------------------------------------ // ----- Initialise and run ------------------------------------------- run->Init(); rtdb->setOutput(parIo1); rtdb->closeOutput(); cout << "Starting run " << gGeoManager << endl; run->Run(0, nEvents); // ------------------------------------------------------------------------ // ----- Finish ------------------------------------------------------- timer.Stop(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); cout << endl << endl; cout << "Macro finished successfully." << endl; cout << "Output file is " << outFile << endl; cout << "Parameter file is " << parFile << endl; cout << "Reco Real time " << rtime << " s, CPU time " << ctime << " s" << endl; cout << endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); std::cout << ""; std::cout << maxMemory; std::cout << "" << std::endl; Float_t cpuUsage=ctime/rtime; std::cout << ""; std::cout << cpuUsage; std::cout << "" << std::endl; /* FairMonitor* tempMon = FairMonitor::GetMonitor(); tempMon->Print(); */ cout << " Test passed" << endl; cout << " All ok " << endl; RemoveGeoManager(); // ------------------------------------------------------------------------ }