15#include <FairEventHeader.h>
16#include <FairMonitor.h>
20#include <TGeoManager.h>
21#include <TStopwatch.h>
35 Run::Run() : TNamed(
"Run",
"CBM AnalysisTree Converter Run") {}
40 Run::~Run() { LOG(debug) <<
"Destructing " << fName; }
48 return (stat(fileName, &
buffer) == 0);
57 LOG(info) << GetName() <<
": Output file is " <<
fOutput;
59 for (
auto trafile :
fTra) {
60 LOG(info) << GetName() <<
": Transport input source is " << trafile;
61 if (!
CheckFile(trafile.Data()))
throw std::runtime_error(
"Transport file does not exist");
63 LOG(info) << GetName() <<
": Parameter file is " <<
fPar;
64 if (!
CheckFile(
fPar.Data()))
throw std::runtime_error(
"Parameter file does not exist");
65 LOG(info) << GetName() <<
": Geometry setup is " <<
fSetupTag;
79 for (
auto trafile :
fTra) {
81 LOG(info) << GetName() <<
": Embeding input " << trafile <<
" (Rate will be ignored)";
86 throw std::runtime_error(
"Event mixing is not possible in event-by-event mode!");
88 LOG(info) << GetName() <<
": Adding input " << trafile;
107 LOG(info) << GetName() <<
": Loading setup " <<
fSetupTag;
119 double timeInit = timer.RealTime();
123 std::cout << std::endl << std::endl;
124 LOG(info) << GetName() <<
": Starting run" << std::endl;
129 double timeExec = timer.RealTime();
130 FairMonitor::GetMonitor()->Print();
131 std::cout << std::endl << std::endl;
132 LOG(info) << GetName() <<
": Execution successful";
133 for (
auto trafile :
fTra)
134 LOG(info) << GetName() <<
": Transport file was " << trafile;
135 LOG(info) << GetName() <<
": Parameter file was " <<
fPar;
136 LOG(info) << GetName() <<
": Output file is " <<
fOutput;
137 LOG(info) << GetName() <<
": Execution time: Init " << timeInit <<
" s, Exec " << timeExec <<
"s";
145 std::string temp(file.Data());
146 size_t index = temp.find_last_of(
".");
147 temp = temp.substr(0, index);
148 std::transform(temp.begin(), temp.end(), temp.begin(), [](
unsigned char c) { return c; });
157 TString file(fileName);
159 file = std::getenv(
"VMCWORKDIR");
160 file +=
"/sim/response/config/DigiConfig_event.yaml";
162 LOG(info) << GetName() <<
": Loading configuration from " << file;
171 for (
auto file : files) {
172 fTra.push_back(file.c_str());
ClassImp(CbmConverterManager)
void EmbedInput(UInt_t inputId, TString fileName, UInt_t targetInputId, ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Embed an input file into another one.
void SetParameterRootFile(TString fileName)
Set the parameter file name.
void SetStartTime(Double_t time)
Set the start time of the run.
void DeactivateAllBut(ECbmModuleId system)
Deactivate all systems except the specified one.
void SetMonitorFile(const char *fileName)
Set the monitor file name.
void Run()
Process all events from input.
void SetOutputFile(TString fileName, Bool_t overwrite=kFALSE)
Set the output file name.
void SetTimeSliceLength(Double_t length)
Set length of the time-slices.
void StoreAllTimeSlices(Bool_t choice=kTRUE)
Store all time-slices.
void SetProduceNoise(Bool_t choice=kTRUE)
Set production of inter-event noise.
void Deactivate(ECbmModuleId system)
Deactivate a system for digitisation.
void SetMode(cbm::sim::Mode mode)
Set event-by-event mode.
void AddInput(UInt_t inputId, TString fileName, cbm::sim::TimeDist dist=cbm::sim::TimeDist::Poisson, Double_t eventRate=0., ECbmTreeAccess mode=ECbmTreeAccess::kRegular)
Add an input file.
static CbmSetup * Instance()
void LoadSetup(const char *setupName)
std::string ToString()
String output (YAML format)
std::vector< int > f_src_id
std::vector< ECbmModuleId > f_det_deactivate
std::vector< float > f_src_rate
std::vector< int > f_src_embedToId
cbm::sim::TimeDist f_ts_timeDist
ECbmModuleId f_det_deactivateAllBut
void LoadYaml(const std::string &filename)
Load from YAML file.
std::string f_glb_logLevel
cbm::sim::Mode f_glb_mode
std::string f_glb_logColor
std::string f_glb_logVerbose
std::vector< ECbmTreeAccess > f_src_treeAccessMode
std::string GetFileName(const TString file)
Get file name without ending.
void SetTraFiles(const std::vector< std::string > files)
Set transport file name.
bool CheckFile(const char *fileName)
Check existence of a file.
void Exec()
Run digitization.
void LoadConfig(const char *fileName)
Set configuration file name.
std::vector< TString > fTra