14#include <fmt/format.h>
15#include <boost/program_options.hpp>
24constexpr bool run2{
true};
43 tree.Branch(
"nDePad", &depads.
nDePad,
"nDePad/I")
44 ->SetTitle(
"Number of pads in detection element");
45 tree.Branch(
"deid", &depads.
deid,
"deid/I")
46 ->SetTitle(
"Detection element id");
47 tree.Branch(fmt::format(
"DePad_{}",
run2 ?
"manu" :
"dsid").c_str(),
49 fmt::format(
"DePad_{}[nDePad]/I",
run2 ?
"manu" :
"dsid").c_str())
50 ->SetTitle(
"FEE id of n-th pad of this detection element (cm)");
51 tree.Branch(fmt::format(
"DePad_{}",
run2 ?
"ch" :
"dsch").c_str(),
53 fmt::format(
"DePad_{}[nDePad]/I",
run2 ?
"ch" :
"dsch").c_str())
54 ->SetTitle(
"FEE channel of n-th pad of this detection element (cm)");
55 tree.Branch(
"DePad_x", &depads.
x,
"DePad_x[nDePad]/F")
56 ->SetTitle(
"x position of n-th pad of this detection element (cm)");
57 tree.Branch(
"DePad_y", &depads.
y,
"DePad_y[nDePad]/F")
58 ->SetTitle(
"y position of n-th pad of this detection element (cm)");
59 tree.Branch(
"DePad_dx", &depads.
dx,
"DePad_dx[nDePad]/F")
60 ->SetTitle(
"half size in x direction of n-th pad of this detection element (cm)");
61 tree.Branch(
"DePad_dy", &depads.
dy,
"DePad_dy[nDePad]/F")
62 ->SetTitle(
"half size in y direction of n-th pad of this detection element (cm)");
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++) {
o2::mch::mapping::CathodeSegmentation seg
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
double padSizeY(int catPadIndex) const
double padSizeX(int catPadIndex) const
int padDualSampaChannel(int catPadIndex) const
int padDualSampaId(int catPadIndex) const
double padPositionY(int catPadIndex) const
double padPositionX(int catPadIndex) const
A Segmentation lets you find pads of a detection element and then inspect those pads.
void createPadBranches(TTree &tree, DePads &depads)
constexpr int MaxNofPadsPerDE
void forEachDetectionElement(CALLABLE &&func)
float dy[MaxNofPadsPerDE]
int dsch[MaxNofPadsPerDE]
float dx[MaxNofPadsPerDE]
int dsid[MaxNofPadsPerDE]
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))