49auto main(
int argc,
char** argv) ->
int
51 auto timer = TStopwatch{};
55 auto help = programOptions.create_option<
bool>(
"help,h",
"help message",
false);
57 programOptions.create_option<std::string>(
"paddle", R
"(set the paddle name. e.g. "neuland")", "neuland");
59 programOptions.create_option<std::string>(
"channel", R
"(set the channel name. e.g. "tamex")", "tamex");
61 programOptions.create_option<std::string>(
"simuFile",
"set the filename of simulation input",
"simu.root");
63 programOptions.create_option<std::string>(
"paraFile",
"set the filename of parameter sink",
"para.root");
65 programOptions.create_option<std::string>(
"paraFile2",
"set the filename of the second parameter sink",
"");
67 programOptions.create_option<std::string>(
"digiFile",
"set the filename of digitization output",
"digi.root");
68 auto logLevel = programOptions.create_option<std::string>(
"logLevel,v",
"set log level of fairlog",
"error");
69 auto eventNum = programOptions.create_option<
int>(
"eventNum,n",
"set total event number", 0);
71 programOptions.create_option<std::string>(
"hitLevelPar",
"set the name of hit level parameter if needed.",
"");
74 auto errorcal = programOptions.create_option<
bool>(
"errorCal",
"usage of errors in calculations",
false);
77 auto calData = programOptions.create_option<
bool>(
"calData",
"Doing CalData calculations",
true);
79 if (!programOptions.verify(argc, argv))
86 std::cout << programOptions.get_desc_ref() << std::endl;
94 tamexParameter.fPMTThresh = 1.;
95 tamexParameter.fTimeMin = 1.;
124 FairLogger::GetLogger()->SetLogScreenLevel(logLevel().c_str());
126 auto run = std::make_unique<FairRunAna>();
127 auto filesource = std::make_unique<R3BFileSource2>(simuFileName().c_str());
128 auto filesink = std::make_unique<FairRootFileSink>(digiFileName().c_str());
129 run->SetSource(filesource.release());
130 run->SetSink(filesink.release());
132 auto fileio = std::make_unique<FairParRootFileIo>();
133 fileio->open(paraFileName().c_str());
134 run->GetRuntimeDb()->setFirstInput(fileio.release());
136 if (
const auto& filename = paraFileName2(); not filename.empty())
138 auto fileio2 = std::make_unique<FairParRootFileIo>();
139 fileio2->open(paraFileName2().c_str());
140 run->GetRuntimeDb()->setSecondInput(fileio2.release());
143 auto hit_par = std::make_unique<R3B::Neuland::Cal2HitPar>();
145 auto* hit_par_ptr = hit_par.get();
147 run->GetRuntimeDb()->addContainer(hit_par.release());
149 const auto neulandEngines = std::map<std::pair<const std::string, const std::string>,
150 std::function<std::unique_ptr<Digitizing::DigitizingEngineInterface>()>>{
151 { {
"neuland",
"tamex" },
152 [&pileup_strategy, &tamexParameter, hit_par_ptr]()
171 auto digiNeuland = std::make_unique<R3BNeulandDigitizer>();
172 digiNeuland->EnableCalDataOutput(calData.value());
173 auto neulandEngine = neulandEngines.at({ paddleName(), channelName() });
175 digiNeuland->SetEngine((neulandEngine)());
176 run->AddTask(digiNeuland.release());
179 run->Run(0, eventNum());
182 auto* sink = run->GetSink();
184 std::cout <<
"Macro finished successfully." << std::endl;
185 std::cout <<
"Real time: " << timer.RealTime() <<
"s, CPU time: " << timer.CpuTime() <<
"s" << std::endl;