78int main(
int argc,
char** argv)
80 std::string outputFileName;
82 po::options_description options(
"options");
83 std::string defaultName = fmt::format(
"mch-mapping{}-tree.root",
run2 ?
"-run2" :
"");
86 (
"help,h",
"produce help message")
87 (
"outfile,o",po::value<std::string>(&outputFileName)->default_value(defaultName),
"path to output file")
91 po::options_description cmdline;
94 po::store(po::command_line_parser(argc, argv).options(cmdline).run(), vm);
96 if (vm.count(
"help")) {
97 std::cout << fmt::format(
"This program exports the MCH {}mapping to a Root tree\n",
98 run2 ?
"(Run2 version) " :
"");
99 std::cout <<
" --outfile path to the output file containing the Root tree";
100 std::cout << options <<
"\n";
106 }
catch (boost::program_options::error& e) {
107 std::cout <<
"Error: " << e.what() <<
"\n";
111 TFile fout(outputFileName.c_str(),
"RECREATE");
112 if (!fout.IsOpen()) {
113 std::cout <<
"Cannot open output file " << outputFileName <<
"\n";
117 TTree
tree(
"mchpads",
"Muon Chamber Pads");
124 throw std::logic_error(fmt::format(
"Something is wrong : max number of pads should be below {} but got {}", MaxNofPadsPerDE, seg.nofPads()));
128 for (
auto padid = 0; padid < depads.
nDePad; padid++) {