15 return {
"logScreenLevel",
27 "input.treeAccessMode",
28 "input.parameterSource",
33 "geometry.deactivate",
34 "geometry.deactivateAllBut"};
42 bool eventMode = moduleTree.get<
bool>(
"eventMode",
false);
43 auto inputs = moduleTree.get_child(
"input");
44 uint inputCounter = 0;
46 bool parametersSet =
false;
47 string parametersPath =
"";
49 for (
auto& input : inputs) {
50 pt::ptree pt_input = input.second;
51 int id = pt_input.get<
int>(
"id", inputCounter);
53 auto configRate = pt_input.get_optional<
float>(
"rate");
54 string treeAccessModeString = pt_input.get<
string>(
"treeAccessMode",
"regular");
55 bool parameterSource = pt_input.get<
bool>(
"parameterSource",
false);
56 auto configEmbedToId = pt_input.get_optional<
int>(
"embedToId");
60 LOG(error) <<
"CbmDigitizationConfig: no path specified for input #" << id;
63 paths.push_back(path);
64 string traFileName = path +
".tra.root";
65 if (stringToECbmTreeAccess.find(treeAccessModeString) != stringToECbmTreeAccess.end())
66 treeAccessMode = stringToECbmTreeAccess.at(treeAccessModeString);
68 LOG(error) <<
"CbmDigitizationConfig: invalid tree access mode: " << treeAccessModeString;
69 cout <<
"Available access modes:\n";
70 for (
auto& p : stringToECbmTreeAccess)
71 cout << p.first << endl;
75 if (configEmbedToId) {
77 LOG(error) <<
"CbmDigitizationConfig: input.embedToId and input.rate should not be used simultaneously!";
81 int embedToId = configEmbedToId.get();
82 LOG(info) <<
"CbmDigitizationConfig: Embedding input: " << traFileName;
87 if (eventMode && inputCounter > 0) {
88 LOG(error) <<
"CbmDigitizationConfig: event mixing is not possible in event-by-event mode!";
91 float rate = pt_input.get<
float>(
"rate", -1.);
92 LOG(info) <<
"CbmDigitizationConfig: Adding input: " << traFileName;
95 if (parameterSource) {
97 parametersPath = path;
101 LOG(error) <<
"CbmDigitizationConfig: only one parameter source is allowed!";
108 string outputPath =
GetStringValue(moduleTree,
"output.path", paths.at(0));
109 bool overwrite = moduleTree.get<
bool>(
"output.overwrite",
false);
111 if (!parametersSet) parametersPath = outputPath;
112 LOG(info) <<
"CbmDigitizationConfig: Parameter source:\n" << parametersPath;
114 LOG(info) <<
"CbmDigitizationConfig: Output path:\n" << outputPath;
115 if (overwrite) LOG(info) <<
"CbmDigitizationConfig: Overwrite output!";
125 auto produceNoise = moduleTree.get_optional<
bool>(
"produceNoise");
126 bool eventMode = moduleTree.get<
bool>(
"eventMode",
false);
127 auto storeAllTimeSlices = moduleTree.get_optional<
bool>(
"storeAllTimeSlices");
128 auto timeSliceLength = moduleTree.get_optional<
float>(
"timeSliceLength");
129 auto startTime = moduleTree.get_optional<
float>(
"startTime");
132 if (storeAllTimeSlices || timeSliceLength) {
133 LOG(error) <<
"CbmDigitizationConfig: time slice settings should not be used in event mode!";
147 auto modulesToDeactivate = moduleTree.get_child_optional(
"geometry.deactivate");
148 auto deactivateAllBut = moduleTree.get_optional<
string>(
"geometry.deactivateAllBut");
150 if (modulesToDeactivate && deactivateAllBut) {
152 <<
"CbmDigitizationConfig: geometry.deactivate and geometry.deactivateAllBut should not be used simultaneously!";
156 if (deactivateAllBut && deactivateAllBut.get() !=
"")
159 if (modulesToDeactivate)
160 for (
auto& module : modulesToDeactivate.get())
ClassImp(CbmConverterManager)
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
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.