15#include <FairEventHeader.h>
16#include <FairFileSource.h>
17#include <FairMonitor.h>
18#include <FairParRootFileIo.h>
19#include <FairRootFileSink.h>
20#include <FairRunAna.h>
21#include <FairRuntimeDb.h>
26#include <TGeoManager.h>
27#include <TStopwatch.h>
41 Run::Run() : TNamed(
"Run",
"CBM Reconstruction Run") {}
46 Run::~Run() { LOG(debug) <<
"Destructing " << fName; }
54 LOG(info) << GetName() <<
": Added task " << task->GetName();
62 TString branchName =
ToString(detector);
64 if (tree->GetBranchStatus(branchName.Data())) {
65 LOG(info) << GetName() <<
": Found branch " << branchName;
76 return (stat(fileName, &
buffer) == 0);
85 TFile* inFile = source->GetInFile();
86 if (!inFile)
throw std::runtime_error(
"No input file");
87 auto* inTree = inFile->Get<TTree>(
"cbmsim");
88 if (!inTree)
throw std::runtime_error(
"No input tree");
136 throw std::out_of_range(
"Reconstruction mode not defined");
146 LOG(info) << GetName() <<
": Output file is " <<
fOutput;
147 LOG(info) << GetName() <<
": Digitization file is " <<
fRaw;
148 LOG(info) << GetName() <<
": Parameter file is " <<
fPar;
149 LOG(info) << GetName() <<
": Geometry setup is " <<
fSetupTag;
157 fRun.SetGenerateRunInfo(
true);
165 if (!
CheckFile(
fRaw.Data()))
throw std::runtime_error(
"Digitization (raw) file does not exist");
166 if (!
CheckFile(
fPar.Data()))
throw std::runtime_error(
"Parameter file does not exist");
170 FairFileSource* source =
new FairFileSource(
fRaw);
171 fRun.SetSource(source);
175 LOG(info) << GetName() <<
": Checking digi input...";
179 LOG(info) << GetName() <<
": Loading setup " <<
fSetupTag;
185 LOG(info) << GetName() <<
": Creating topology...";
189 LOG(info) << GetName() <<
": Set runtime DB...";
190 FairRuntimeDb* rtdb =
fRun.GetRuntimeDb();
191 FairParRootFileIo* parIo1 =
new FairParRootFileIo();
192 parIo1->open(
fPar.Data(),
"UPDATE");
193 rtdb->setFirstInput(parIo1);
196 LOG(info) << GetName() <<
": Initialise FairRun..." << std::endl;
198 rtdb->setOutput(parIo1);
202 double timeInit = timer.RealTime();
208 std::cout << std::endl << std::endl;
209 LOG(info) << GetName() <<
": Starting run" << std::endl;
214 double timeExec = timer.RealTime();
215 FairMonitor::GetMonitor()->Print();
216 std::cout << std::endl << std::endl;
217 LOG(info) << GetName() <<
": Execution successful";
218 LOG(info) << GetName() <<
": Digitization file was " <<
fRaw;
219 LOG(info) << GetName() <<
": Parameter file was " <<
fPar;
220 LOG(info) << GetName() <<
": Output file is " <<
fOutput;
221 LOG(info) << GetName() <<
": Execution time: Init " << timeInit <<
" s, Exec " << timeExec <<
"s";
230 TString file(fileName);
232 file = std::getenv(
"VMCWORKDIR");
233 file +=
"/reco/offline/config/RecoConfig_event_ideal.yaml";
235 LOG(info) << GetName() <<
": Loading configuration from " << file;
ClassImp(CbmConverterManager)
std::string ToString(ECbmModuleId modId)
@ kMvd
Micro-Vertex Detector.
@ kNofSystems
For loops over active systems.
static CbmSetup * Instance()
void LoadSetup(const char *setupName)
std::string ToString()
String output (YAML format)
std::string f_glb_logColor
void LoadYaml(const std::string &filename)
Load from YAML file.
std::string f_glb_logVerbose
std::string f_glb_logLevel
void LoadConfig(const char *fileName)
Set configuration file name.
bool CheckFile(const char *fileName)
Check existence of a file.
void AddTask(FairTask *task)
Add a task to the run.
std::set< ECbmModuleId > fDataPresent
void CheckDigiBranch(TTree *tree, ECbmModuleId detector)
Check and mark presence of a digi branch.
void CheckInputBranches(FairFileSource *source)
Check the presence of digi input branches.
void Exec()
Run reconstruction.
void CreateTopology()
Create the reconstruction task topology (chain)
Factory class for the instantiation of CBM reconstruction tasks.
void RegisterCaTracking()
void RegisterTrackEventBuilder()
Local reconstruction for FSD.
void RegisterTrdReco()
Event building from tracks.
void RegisterFsdReco()
Local reconstruction for PSD.
void RegisterMvdReco()
Local reconstruction for MUCH.
void RegisterMuchReco()
Global track finding.
void RegisterPvFinder()
Local reconstruction for MVD.
void RegisterTofReco()
Local reconstruction for STS.
void RegisterBmonReco()
PID with TRD.
void RegisterStsReco()
Local reconstruction for RICH.
void RegisterGlobalTracking()
Event building from digis.
void RegisterTrdPid()
Local reconstruction for TRD.
void RegisterPsdReco()
Local reconstruction for TOF.
void RegisterRichReco()
Hit finding in RICH.
void RegisterRichHitFinder()
Primary vertex finding.
void RegisterDigiEventBuilder()
CA track finding.