// -------------------------------------------------------------------------- // // Macro for reconstruction of mcbm data (2019) // Only STS local reconstruction (cluster + hit finder) for the time being // // // // -------------------------------------------------------------------------- void mcbm2019_reco(Int_t nTimeslices = -1, UInt_t uRunId = 0, TString outDir="data", TString dataSet = "data/mcbm2019", // Data set for file names Bool_t eventMode = kFALSE // Event-by-event mode ) { // --- Logger settings ---------------------------------------------------- TString logLevel = "INFO"; TString logVerbosity = "LOW"; // ------------------------------------------------------------------------ // ----- Environment -------------------------------------------------- TString myName = "mcbm2019_reco"; // this macro's name for screen output TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory // TString srcDir1 = gSystem->Getenv("SLURM_INDEX"); // ------------------------------------------------------------------------ // ----- In- and output file names ------------------------------------ TString runId = TString::Format("%03u", uRunId); TString inFile = outDir + "/unp_mcbm_" + runId + ".root"; if ( eventMode ) inFile = dataSet + ".event.raw.root"; TString parFile = outDir + "/unp_mcbm_params_" + runId + ".root"; TString outFile = dataSet + "_" + runId + ".rec.root"; TString geoFile = dataSet + ".geo.root"; // to be created by a simulation run // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ // ---- Debug option ------------------------------------------------- gDebug = 0; // ------------------------------------------------------------------------ // ----- FairRunAna --------------------------------------------------- FairRunAna *run = new FairRunAna(); CbmStsFindHits *hit = new CbmStsFindHits(); FairFileSource* inputSource = new FairFileSource(inFile); run->SetSource(inputSource); run->SetOutputFile(outFile); run->SetGenerateRunInfo(kTRUE); run->SetGeomFile(geoFile); TString monitorFile{outFile}; monitorFile.ReplaceAll("rec","rec.monitor"); FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monitorFile); // ----------------------------------------------------------------------- // ----- Logger settings ---------------------------------------------- FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); FairLogger::GetLogger()->SetLogVerbosityLevel(logVerbosity.Data()); // ------------------------------------------------------------------------ // ----- Reconstruction tasks ----------------------------------------- // ----- Local reconstruction in STS ---------------------------------- CbmStsReco* stsReco = new CbmStsReco(); run->AddTask(stsReco); std::cout << "-I- : Added task " << stsReco->GetName() << std::endl; // ------------------------------------------------------------------------ // ----- Parameter database -------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Set runtime DB" << std::endl; FairRuntimeDb* rtdb = run->GetRuntimeDb(); FairParRootFileIo* parIo1 = new FairParRootFileIo(); FairParAsciiFileIo* parIo2 = new FairParAsciiFileIo(); parIo1->open(parFile.Data(),"UPDATE"); rtdb->setFirstInput(parIo1); // ------------------------------------------------------------------------ // ----- Run initialisation ------------------------------------------- std::cout << std::endl; std::cout << "-I- " << myName << ": Initialise run" << std::endl; run->Init(); rtdb->setOutput(parIo1); rtdb->saveOutput(); rtdb->print(); // ------------------------------------------------------------------------ // ----- Start run ---------------------------------------------------- std::cout << std::endl << std::endl; std::cout << "-I- " << myName << ": Starting run" << std::endl; run->Run(0, nTimeslices); // ------------------------------------------------------------------------ // ----- Finish ------------------------------------------------------- timer.Stop(); FairMonitor::GetMonitor()->Print(); Double_t rtime = timer.RealTime(); Double_t ctime = timer.CpuTime(); std::cout << std::endl << std::endl; std::cout << "Macro finished successfully." << std::endl; std::cout << "Output file is " << outFile << std::endl; std::cout << "Parameter file is " << parFile << std::endl; std::cout << "Real time " << rtime << " s, CPU time " << ctime << " s" << std::endl; std::cout << std::endl; std::cout << " Test passed" << std::endl; std::cout << " All ok " << std::endl; // ------------------------------------------------------------------------ // ----- Resource monitoring ------------------------------------------ // Extract the maximal used memory an add is as Dart measurement // This line is filtered by CTest and the value send to CDash 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; // ------------------------------------------------------------------------ // ----- Function needed for CTest runtime dependency ----------------- // RemoveGeoManager(); // ------------------------------------------------------------------------ }