LDMX Software
EventSummaryDQM.cxx
1#include "DQM/EventSummaryDQM.h"
2
4
5namespace dqm {
6
8 summary_name_ = ps.get<std::string>("summary_name");
9 summary_pass_ = ps.get<std::string>("summary_pass");
10}
11
14 histograms_.create("n_systems", "Subsystems in the event", 8, 0, 8);
15 histograms_.create("system_id", "Subsystem ID", 16, 0, 16);
16 histograms_.create("error_bit", "Error flag bit (-1 = none)", 8, -1, 7);
17 histograms_.create("payload_kb", "Event payload [kB]", 100, 0, 500);
18 histograms_.create("dt_ms", "Time since previous event [ms]", 100, 0, 100);
19}
20
22 // the builder adds nothing once its input is exhausted
23 if (!event.exists(summary_name_, summary_pass_)) return;
24 auto summary{
26
27 histograms_.fill("n_systems", summary.getNSystems());
28 for (auto id : summary.getSystemIds()) histograms_.fill("system_id", id);
29
30 const uint32_t flags = summary.getErrorFlags();
31 if (flags == 0) histograms_.fill("error_bit", -1);
32 for (int bit{0}; bit < 7; bit++) {
33 if (flags & (1u << bit)) histograms_.fill("error_bit", bit);
34 }
35
36 histograms_.fill("payload_kb", summary.getPayloadSize() / 1024.);
37
38 const uint64_t ts = summary.getTimestampNs();
39 if (last_timestamp_ > 0 and ts > last_timestamp_) {
40 histograms_.fill("dt_ms", (ts - last_timestamp_) / 1e6);
41 }
42 last_timestamp_ = ts;
43}
44
45} // namespace dqm
46
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Class that provides a summary of event assembly with metadata and error flags.
Histograms of the EventBuilder's EventSummary.
uint64_t last_timestamp_
timestamp [ns] of the previous built event, 0 before the first
std::string summary_name_
EventSummary collection name.
void analyze(const framework::Event &event) override
Process the event and make histograms or summaries.
void configure(framework::config::Parameters &ps) override
Callback for the EventProcessor to configure itself from the given set of parameters.
std::string summary_pass_
EventSummary pass name.
void onProcessStart() override
Callback for the EventProcessor to take any necessary action when the processing of events starts,...
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
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Definition Event.cxx:107
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
Provides summary information about an assembled event, including error flags for data quality assessm...