15 return {
"logScreenLevel",
28 "input.treeAccessMode",
29 "input.parameterSource",
34 "geometry.deactivate",
35 "geometry.deactivateAllBut"};
45 bool eventMode = moduleTree.get<
bool>(
"eventMode",
false);
46 auto inputs = moduleTree.get_child(
"input");
47 uint inputCounter = 0;
49 bool parametersSet =
false;
50 string parametersPath =
"";
52 string timeDistString = moduleTree.get<
string>(
"timeDist");
54 if (stringToCbmSimTimeDist.find(timeDistString) != stringToCbmSimTimeDist.end()) {
55 timeDist = stringToCbmSimTimeDist.at(timeDistString);
58 LOG(error) <<
"CbmDigitizationConfig: undefined event time distribution " << timeDistString
59 <<
" - use: poisson or uniform";
63 for (
auto& input : inputs) {
64 pt::ptree pt_input = input.second;
65 int id = pt_input.get<
int>(
"id", inputCounter);
67 auto configRate = pt_input.get_optional<
float>(
"rate");
68 string treeAccessModeString = pt_input.get<
string>(
"treeAccessMode",
"regular");
69 bool parameterSource = pt_input.get<
bool>(
"parameterSource",
false);
70 auto configEmbedToId = pt_input.get_optional<
int>(
"embedToId");
74 LOG(error) <<
"CbmDigitizationConfig: no path specified for input #" << id;
77 paths.push_back(path);
78 string traFileName = path +
".tra.root";
79 if (stringToECbmTreeAccess.find(treeAccessModeString) != stringToECbmTreeAccess.end())
80 treeAccessMode = stringToECbmTreeAccess.at(treeAccessModeString);
82 LOG(error) <<
"CbmDigitizationConfig: invalid tree access mode: " << treeAccessModeString;
83 cout <<
"Available access modes:\n";
84 for (
auto& p : stringToECbmTreeAccess)
85 cout << p.first << endl;
89 if (configEmbedToId) {
91 LOG(error) <<
"CbmDigitizationConfig: input.embedToId and input.rate should not be used simultaneously!";
95 int embedToId = configEmbedToId.get();
96 LOG(info) <<
"CbmDigitizationConfig: Embedding input: " << traFileName;
101 if (eventMode && inputCounter > 0) {
102 LOG(error) <<
"CbmDigitizationConfig: event mixing is not possible in event-by-event mode!";
105 float rate = pt_input.get<
float>(
"rate", -1.);
106 LOG(info) <<
"CbmDigitizationConfig: Adding input: " << traFileName <<
" (time distribution: " << timeDistString
108 obj.
AddInput(
id, path +
".tra.root", timeDist, rate, treeAccessMode);
110 if (parameterSource) {
111 if (!parametersSet) {
112 parametersPath = path;
113 parametersSet =
true;
116 LOG(error) <<
"CbmDigitizationConfig: only one parameter source is allowed!";
123 string outputPath =
GetStringValue(moduleTree,
"output.path", paths.at(0));
124 bool overwrite = moduleTree.get<
bool>(
"output.overwrite",
false);
126 if (!parametersSet) parametersPath = outputPath;
127 LOG(info) <<
"CbmDigitizationConfig: Parameter source:\n" << parametersPath;
129 LOG(info) <<
"CbmDigitizationConfig: Output path:\n" << outputPath;
130 if (overwrite) LOG(info) <<
"CbmDigitizationConfig: Overwrite output!";
140 auto produceNoise = moduleTree.get_optional<
bool>(
"produceNoise");
141 bool eventMode = moduleTree.get<
bool>(
"eventMode",
false);
142 auto storeAllTimeSlices = moduleTree.get_optional<
bool>(
"storeAllTimeSlices");
143 auto timeSliceLength = moduleTree.get_optional<
float>(
"timeSliceLength");
144 auto startTime = moduleTree.get_optional<
float>(
"startTime");
147 if (storeAllTimeSlices || timeSliceLength) {
148 LOG(error) <<
"CbmDigitizationConfig: time slice settings should not be used in event mode!";
162 auto modulesToDeactivate = moduleTree.get_child_optional(
"geometry.deactivate");
163 auto deactivateAllBut = moduleTree.get_optional<
string>(
"geometry.deactivateAllBut");
165 if (modulesToDeactivate && deactivateAllBut) {
167 <<
"CbmDigitizationConfig: geometry.deactivate and geometry.deactivateAllBut should not be used simultaneously!";
171 if (deactivateAllBut && deactivateAllBut.get() !=
"")
174 if (modulesToDeactivate)
175 for (
auto& module : modulesToDeactivate.get())
ClassImp(CbmConverterManager)
static std::string GetStringValue(boost::optional< std::string > opt)
static ECbmModuleId stringToECbmModuleId(std::string s)
static std::string GetModuleTag()
static bool LoadImpl(CbmDigitization &obj, const pt::ptree &moduleTree)
static bool SetGeometry(CbmDigitization &obj, const pt::ptree &moduleTree)
CbmConfigBase< CbmDigitizationConfig, CbmDigitization >::TagSet_t TagSet_t
static TagSet_t GetValidationTags()
static bool SetDigitizationParameters(CbmDigitization &obj, const pt::ptree &moduleTree)
static bool SetIO(CbmDigitization &obj, const pt::ptree &moduleTree)
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 SetOutputFile(TString fileName, Bool_t overwrite=kFALSE)
Set the output file name.
void SetTimeSliceLength(Double_t length)
Set length of the 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.