68auto main(
int argc,
char** argv) ->
int
72 auto help = programOptions.create_option<
bool>(
"help,h",
"help message",
false);
73 auto logLevel = programOptions.create_option<std::string>(
"logLevel,v",
"set log level of fairlog",
"info");
74 auto output = programOptions.create_option<std::string>(
"output,o",
"set the output root filename");
75 auto source = programOptions.create_option<std::string>(
"source,s",
"set the JSON file source").make_positional(1);
76 auto runID = programOptions.create_option<
int>(
"runID,r",
"set the event number",
DEFAULT_RUN_ID);
78 if (!programOptions.verify(argc, argv))
86 auto base_par = std::make_unique<R3B::Neuland::CalibrationBasePar>();
87 json_obj.get_to(*base_par);
89 FairLogger::GetLogger()->SetLogScreenLevel(logLevel().c_str());
90 auto rtdb = std::unique_ptr<FairRuntimeDb>(FairRuntimeDb::instance());
91 auto parOut = std::make_unique<FairParRootFileIo>(
false);
92 parOut->open(output().c_str(),
"RECREATE");
94 add_parameter(std::make_unique<FairBaseParSet>().release(), rtdb.get());
95 add_parameter(std::make_unique<FairGeoParSet>().release(), rtdb.get());
96 add_parameter(std::make_unique<R3B::Map2CalPar>(
"LandTCalPar").release(), rtdb.get());
97 add_parameter(std::make_unique<R3B::Map2CalPar>(
"LandTrigTCalPar").release(), rtdb.get());
98 add_parameter(std::make_unique<R3B::Neuland::Cal2HitPar>(
"NeulandHitPar").release(), rtdb.get());
99 rtdb->setOutput(parOut.release());
101 rtdb->addRun(runID());
102 rtdb->writeContainers();
104 catch (
const std::exception& ex)
106 fmt::print(
"An exception has occurred: {}\n", ex.what());
110 fmt::print(
"An unrecgonised exception has occurred!\n");
113 fmt::print(
"Parameters are created successfully in file {:?}!", output());