21#include "boost/program_options.hpp"
23#include <fmt/format.h>
32#include <rapidjson/document.h>
33#include <rapidjson/stringbuffer.h>
34#include <rapidjson/writer.h>
46 int v = feeId * maxLinkId * maxElinkId +
47 (linkId % maxLinkId) * maxElinkId + elinkId + 1;
67using namespace std::literals;
71 std::vector<std::string> remove = {
".vMon",
".iMon",
"di.SenseVoltage",
"an.SenseVoltage"};
73 for (
auto r : remove) {
74 if (alias.find(
r) != std::string::npos) {
75 alias.replace(alias.find(
r),
r.size(),
"");
83 rapidjson::StringBuffer
buffer;
84 rapidjson::Writer<rapidjson::StringBuffer> writer(
buffer);
92 std::map<std::string, std::set<o2::mch::DsIndex>> dsIndicesPerAliasBase;
94 for (
auto alias : aliases) {
97 dsIndicesPerAliasBase.emplace(
s,
indices);
101 for (
auto p : dsIndicesPerAliasBase) {
102 writer.StartObject();
105 writer.String(
s.c_str());
108 for (
auto i : p.second) {
110 if (dsi.dsBin ==
i) {
111 writer.Int(dsi.dsBinX);
120 std::cout <<
buffer.GetString() <<
"\n";
131 auto elec = det2elec(det);
132 if (!elec.has_value()) {
133 throw std::runtime_error(
"mapping is wrong somewhere...");
135 auto eLinkId = elec->elinkId();
136 auto solarId = elec->solarId();
137 auto s2f = solar2FeeLink(solarId);
138 if (!s2f.has_value()) {
139 throw std::runtime_error(
"mapping is wrong somewhere...");
141 auto feeId = s2f->feeId();
142 auto linkId = s2f->linkId();
150 auto dsId = det.dsId();
151 auto deId = det.deId();
156 eLinkId, solarId, nch,
157 firstDsChannelId.
value()});
164 rapidjson::StringBuffer
buffer;
165 rapidjson::Writer<rapidjson::StringBuffer> writer(
buffer);
170 auto outputSolars = [&](
uint16_t solarId) {
172 auto deId = dualSampas.begin()->deId();
174 writer.StartObject();
175 writer.Key(
"solarId");
177 auto feelink = solar2FeeLink(solarId);
178 uint16_t feeId{std::numeric_limits<uint16_t>::max()};
179 uint8_t linkId{std::numeric_limits<uint8_t>::max()};
180 if (feelink.has_value()) {
181 feeId = feelink->feeId();
182 linkId = feelink->linkId();
185 writer.Key(
"LinkId");
193 if (dsi.feeId == feeId &&
194 dsi.linkId == linkId) {
195 writer.StartObject();
197 writer.Int(dsi.dsId);
199 writer.Key(
"elinkId");
201 writer.Key(
"eLinkId");
203 writer.Int(dsi.eLinkId);
210 writer.Int(dsi.dsBinX);
211 writer.Key(
"dsIndex");
212 writer.Int(dsi.dsBin);
215 writer.Int(dsi.dsBinX);
217 writer.Int(dsi.dsBin);
219 writer.Int(dsi.firstDsChannelId);
230 for (
auto s : solarIds) {
235 std::cout <<
buffer.GetString() <<
"\n";
238int main(
int argc,
char* argv[])
240 po::variables_map vm;
241 po::options_description
generic(
"Generic options");
244 generic.add_options()
245 (
"help,h",
"produce help message")
246 (
"solar,s",
"output solar based file")
247 (
"mchview,m",
"output format suitable for mchview")
248 (
"dcs,d",
"output dcs aliases -> dual sampa indices file")
252 po::options_description cmdline;
253 cmdline.add(generic);
255 po::store(po::command_line_parser(argc, argv).options(cmdline).run(), vm);
257 if (vm.count(
"help")) {
258 std::cout <<
generic <<
"\n";
264 }
catch (boost::program_options::error&
e) {
265 std::cout <<
"Error: " <<
e.what() <<
"\n";
269 if (vm.count(
"solar")) {
273 if (vm.count(
"dcs")) {
unsigned short int uint16_t
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 s
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 Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
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
void solar2json(bool mchview)
std::vector< DualSampaInfo > dualSampaInfos
std::string stripAlias(std::string alias)
std::vector< DualSampaInfo > computeDualSampaInfos()
uint16_t computeDsBinX(int feeId, int linkId, int elinkId)
A DsDetId is just a pair (detection element id, dual sampa id)
GLsizei GLenum const void * indices
std::set< DsIndex > aliasToDsIndices(std::string_view alias)
std::vector< std::string > aliases(std::vector< MeasurementType > types={ MeasurementType::HV_V, MeasurementType::HV_I, MeasurementType::LV_V_FEE_ANALOG, MeasurementType::LV_V_FEE_DIGITAL, MeasurementType::LV_V_SOLAR})
std::function< std::optional< DsDetId >(DsElecId)> createElec2DetMapper< ElectronicMapperGenerated >(uint64_t)
std::function< std::optional< DsElecId >(DsDetId)> createDet2ElecMapper< ElectronicMapperGenerated >()
std::set< uint16_t > getSolarUIDs< ElectronicMapperGenerated >()
std::set< DsDetId > getDualSampas< ElectronicMapperGenerated >(uint16_t solarId)
std::function< std::optional< FeeLinkId >(uint16_t)> createSolar2FeeLinkMapper< ElectronicMapperGenerated >()
uint8_t numberOfDualSampaChannels(DsIndex dsIndex)
constexpr uint16_t NumberOfDualSampas
o2::mch::raw::DsDetId getDsDetId(DsIndex dsIndex)
uint32_t firstDsChannelId