17#include <boost/program_options.hpp>
18#include <fmt/format.h>
20#include <rapidjson/document.h>
21#include <rapidjson/ostreamwrapper.h>
22#include <rapidjson/stringbuffer.h>
23#include <rapidjson/writer.h>
32 auto optElecId = digit2elec(digit);
33 if (!optElecId.has_value()) {
36 auto dsElecId = optElecId.value().first;
37 auto dschid = optElecId.value().second;
38 return fmt::format(
"{}-CH{}",
asString(dsElecId), dschid);
42 std::function<std::optional<DsElecId>(
DsDetId)> det2elec,
43 rapidjson::Writer<rapidjson::OStreamWrapper>& writer)
52 if (sid ==
"UNKNOWN") {
57 writer.String(sid.c_str());
59 writer.Int(
d.getADC());
65int main(
int argc,
char* argv[])
67 po::options_description
generic(
"options");
68 bool dummyElecMap{
false};
74 (
"help,h",
"produce help message")
75 (
"dummyElecMap,d",po::bool_switch(&dummyElecMap),
"use a dummy electronic mapping (for testing only)")
76 (
"infile,i",po::value<std::string>(&input)->required(),
"input file name");
79 po::options_description cmdline;
82 po::store(po::command_line_parser(argc, argv).options(cmdline).run(), vm);
84 if (vm.count(
"help")) {
85 std::cout <<
generic <<
"\n";
91 }
catch (boost::program_options::error&
e) {
92 std::cout <<
"Error: " <<
e.what() <<
"\n";
100 rapidjson::OStreamWrapper osw(std::cout);
101 rapidjson::Writer<rapidjson::OStreamWrapper> writer(osw);
103 TFile fin(input.c_str());
107 TTree*
tree =
static_cast<TTree*
>(fin.Get(
"o2sim"));
112 std::vector<o2::mch::Digit>
digits;
116 writer.StartObject();
121 writer.Key(
"digits");
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
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 Directory with events to Events directory is and not inside events d
MCH digit implementation.
const BCData & getBCData() const
get the interaction record
bool nextDigits(o2::mch::ROFRecord &rof, std::vector< o2::mch::Digit > &digits)
A DsDetId is just a pair (detection element id, dual sampa id)
void outputToJson(const std::vector< o2::mch::Digit > &digits, std::function< std::optional< DsElecId >(DsDetId)> det2elec, rapidjson::Writer< rapidjson::OStreamWrapper > &writer)
std::string digitIdAsString(const o2::mch::Digit &digit, const Digit2ElecMapper &digit2elec)
std::function< std::optional< DsElecId >(DsDetId)> createDet2ElecMapper< ElectronicMapperDummy >()
std::function< std::optional< std::pair< DsElecId, int > >(const o2::mch::Digit &digit)> Digit2ElecMapper
std::function< std::optional< DsElecId >(DsDetId)> createDet2ElecMapper< ElectronicMapperGenerated >()
Digit2ElecMapper createDigit2ElecMapper(Det2ElecMapper det2elec)
std::string asString(const SampaCluster &sc)
uint16_t bc
bunch crossing ID of interaction
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))
std::vector< Digit > digits