LDMX Software
ECONDDigiDQM.cxx
1#include "DQM/ECONDDigiDQM.h"
2
5
6namespace dqm {
7
9 digi_name_ = ps.get<std::string>("digi_name");
10 info_name_ = ps.get<std::string>("info_name");
11 input_pass_ = ps.get<std::string>("input_pass");
12}
13
16 histograms_.create("frame_flags", "",
17 {"good", "resync", "lost sync", "no trailer",
18 "trailer count", "ECON ID", "sample index", "truncated",
19 "extra words", "no SOI", "frame size", "no frame"});
20 histograms_.create("packet_flags", "",
21 {"good", "empty", "header marker", "length", "header CRC",
22 "CRC-32", "payload", "truncated"});
23 histograms_.create("n_samples", "Samples per Event", 33, -0.5, 32.5);
24 histograms_.create("i_soi", "Index of Sample of Interest", 33, -0.5, 32.5);
25 histograms_.create("bx", "BX", 128, 0, 4096);
26 histograms_.create("link_bad_stat", "Link Index", 12, -0.5, 11.5);
27 histograms_.create("adc_cm", "Common Mode ADC", 256, 0, 1024);
28 histograms_.create("calib_adc", "Calibration Channel ADC", 256, 0, 1024);
29 histograms_.create("n_digis", "Digis per Event", 100, 0, 500);
30 histograms_.create("flags", "Tc Tp Flags", {"00", "01", "10", "11"});
31 histograms_.create("adc", "ADC", 256, 0, 1024);
32 histograms_.create("adc_tm1", "ADC(t-1)", 256, 0, 1024);
33 histograms_.create("toa", "TOA", 256, 0, 1024);
34 histograms_.create("tot", "TOT (10-bit compressed)", 256, 0, 1024);
35 histograms_.create("soi_adc_by_channel", "Digi Index", 432, -0.5, 431.5,
36 "ADC in Sample of Interest", 128, 0, 1024);
37}
38
40 const auto& info{
42 const auto& digis{
44
45 // bin 0 is good, bit i of the mask is bin i+1
46 int frame_mask = info.getCorruption();
47 if (frame_mask == 0) histograms_.fill("frame_flags", 0);
48 for (int i{0}; i < 11; i++) {
49 if ((frame_mask >> i) & 1) histograms_.fill("frame_flags", i + 1);
50 }
51 if (info.isCorrupt(ldmx::ECONDEventInfo::NO_FRAME)) return;
52
53 histograms_.fill("n_samples", info.getSamples().size());
54 histograms_.fill("i_soi", info.getSOIIndex());
55 for (const auto& sample : info.getSamples()) {
56 int mask = sample.getCorruption();
57 if (mask == 0) {
58 histograms_.fill("packet_flags", sample.getPayloadLength() == 0 ? 1 : 0);
59 histograms_.fill("bx", sample.getBX());
60 }
61 for (int i{0}; i < 6; i++) {
62 if ((mask >> i) & 1) histograms_.fill("packet_flags", i + 2);
63 }
64 const auto& links{sample.getLinks()};
65 for (std::size_t i_link{0}; i_link < links.size(); i_link++) {
66 const auto& link{links[i_link]};
67 if (link.hasBadStat()) histograms_.fill("link_bad_stat", i_link);
68 histograms_.fill("adc_cm", link.getADCCM0());
69 histograms_.fill("adc_cm", link.getADCCM1());
70 histograms_.fill("calib_adc", (link.getCalib() >> 10) & 0x3ff);
71 }
72 }
73
74 histograms_.fill("n_digis", digis.getNumDigis());
75 for (unsigned int i_digi{0}; i_digi < digis.getNumDigis(); i_digi++) {
76 auto digi{digis.getDigi(i_digi)};
77 for (unsigned int i_sample{0}; i_sample < digi.size(); i_sample++) {
78 uint32_t w = digi.at(i_sample).raw();
79 bool tc = (w >> 31) & 1;
80 bool tp = (w >> 30) & 1;
81 histograms_.fill("flags", 2 * tc + tp);
82 histograms_.fill("toa", w & 0x3ff);
83 if (tc) {
84 histograms_.fill("tot", (w >> 10) & 0x3ff);
85 } else {
86 histograms_.fill("adc", (w >> 10) & 0x3ff);
87 histograms_.fill("adc_tm1", (w >> 20) & 0x3ff);
88 }
89 }
90 uint32_t soi = digi.soi().raw();
91 if (((soi >> 31) & 1) == 0) {
92 histograms_.fill("soi_adc_by_channel", i_digi, (soi >> 10) & 0x3ff);
93 }
94 }
95}
96
97} // namespace dqm
98
Classes holding the ECON-D packet data that does not fit into an HgcrocDigiCollection.
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Class that represents a digitized hit in a calorimeter cell readout by an HGCROC.
Histograms of the output of packing::ECONDDecoder.
void analyze(const framework::Event &event) override
fill the histograms
void onProcessStart() override
create the histograms
std::string info_name_
name of the ECONDEventInfo
std::string digi_name_
name of the digi collection
std::string input_pass_
pass of the decoder
void configure(framework::config::Parameters &parameters) override
configure the input names
HistogramPool histograms_
helper object for making and filling histograms
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...
Implements an event buffer system for storing event data.
Definition Event.h:40
void create(const config::Parameters &p)
Create a histogram from the input configuration parameters.
void fill(const std::string &name, const T &val)
Fill a 1D histogram.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:26
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:75
Supporting data for one event decoded from a single ECON-D.
Represents a collection of the digi hits readout by an HGCROC.