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