Project
Loading...
Searching...
No Matches
generatePadIndices.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include "rapidjson/document.h"
13#include "rapidjson/writer.h"
14#include "rapidjson/ostreamwrapper.h"
15#include <iostream>
16#include <fmt/format.h>
18#include <boost/program_options.hpp>
19
20namespace po = boost::program_options;
21
22int main(int argc, char** argv)
23{
24 std::string filePattern;
25 int deId;
26 po::variables_map vm;
27 po::options_description generic("Generic options");
28 bool sparse{false};
29
30 // clang-format off
31 generic.add_options()
32 ("help,h", "produce help message")
33 ("de,d",po::value<int>(&deId)->required(),"detection element")
34 ("sparse,s",po::bool_switch(&sparse),"do not generate all indices but only a sample")
35 ;
36 // clang-format on
37
38 po::options_description cmdline;
39 cmdline.add(generic);
40
41 po::store(po::command_line_parser(argc, argv).options(cmdline).run(), vm);
42
43 if (vm.count("help")) {
44 std::cout << generic << "\n";
45 return 2;
46 }
47
48 try {
49 po::notify(vm);
50 } catch (boost::program_options::error& e) {
51 std::cout << "Error: " << e.what() << "\n";
52 exit(1);
53 }
54
55 rapidjson::OStreamWrapper osw(std::cout);
56 rapidjson::Writer<rapidjson::OStreamWrapper> w(osw);
57
59
60 w.StartObject();
61 w.Key("channels");
62 w.StartArray();
63
64 int n{0};
65
66 seg.forEachPad([&](const int& padindex) {
67 n++;
68 if (sparse && (n % 16)) {
69 return;
70 }
71 w.StartObject();
72 w.Key("de");
73 w.Int(deId);
74 w.Key("bending");
75 w.String(seg.isBendingPad(padindex) ? "true" : "false");
76 w.Key("x");
77 w.Double(seg.padPositionX(padindex));
78 w.Key("y");
79 w.Double(seg.padPositionY(padindex));
80 w.Key("padindex");
81 w.Int(padindex);
82 w.Key("dsid");
83 w.Int(seg.padDualSampaId(padindex));
84 w.Key("dsch");
85 w.Int(seg.padDualSampaChannel(padindex));
86 w.EndObject();
87 });
88
89 w.EndArray();
90 w.EndObject();
91 return 0;
92}
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
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.
GLdouble n
Definition glcorearb.h:1982
GLubyte GLubyte GLubyte GLubyte w
Definition glcorearb.h:852
#define main