LDMX Software
dqm::EventSummaryDQM Class Reference

Histograms of the EventBuilder's EventSummary. More...

#include <EventSummaryDQM.h>

Public Member Functions

 EventSummaryDQM (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &ps) override
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
void onProcessStart () override
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
void analyze (const framework::Event &event) override
 Process the event and make histograms or summaries.
 
- Public Member Functions inherited from framework::Analyzer
 Analyzer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for an Analyzer is calling analyze.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header) final
 Don't allow Analyzers to add parameters to the run header.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

std::string summary_name_
 EventSummary collection name.
 
std::string summary_pass_
 EventSummary pass name.
 
uint64_t last_timestamp_ {0}
 timestamp [ns] of the previous built event, 0 before the first
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManager & ntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Histograms of the EventBuilder's EventSummary.

Definition at line 13 of file EventSummaryDQM.h.

Constructor & Destructor Documentation

◆ EventSummaryDQM()

dqm::EventSummaryDQM::EventSummaryDQM ( const std::string & name,
framework::Process & process )
inline

Definition at line 15 of file EventSummaryDQM.h.

Base class for a module which does not produce a data product.
virtual void process(Event &event) final
Processing an event for an Analyzer is calling analyze.

Member Function Documentation

◆ analyze()

void dqm::EventSummaryDQM::analyze ( const framework::Event & event)
overridevirtual

Process the event and make histograms or summaries.

Parameters
eventThe Event to analyze

Implements framework::Analyzer.

Definition at line 21 of file EventSummaryDQM.cxx.

21 {
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}
uint64_t last_timestamp_
timestamp [ns] of the previous built event, 0 before the first
std::string summary_name_
EventSummary collection name.
std::string summary_pass_
EventSummary pass name.
HistogramPool histograms_
helper object for making and filling histograms
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 fill(const std::string &name, const T &val)
Fill a 1D histogram.
Provides summary information about an assembled event, including error flags for data quality assessm...

References framework::Event::exists(), framework::HistogramPool::fill(), framework::EventProcessor::histograms_, last_timestamp_, summary_name_, and summary_pass_.

◆ configure()

void dqm::EventSummaryDQM::configure ( framework::config::Parameters & parameters)
overridevirtual

Callback for the EventProcessor to configure itself from the given set of parameters.

The parameters a processor has access to are the member variables of the python class in the sequence that has class_name equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 7 of file EventSummaryDQM.cxx.

7 {
8 summary_name_ = ps.get<std::string>("summary_name");
9 summary_pass_ = ps.get<std::string>("summary_pass");
10}

References framework::config::Parameters::get(), summary_name_, and summary_pass_.

◆ onProcessStart()

void dqm::EventSummaryDQM::onProcessStart ( )
overridevirtual

Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.

Reimplemented from framework::EventProcessor.

Definition at line 12 of file EventSummaryDQM.cxx.

12 {
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}
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...
void create(const config::Parameters &p)
Create a histogram from the input configuration parameters.

References framework::HistogramPool::create(), framework::EventProcessor::getHistoDirectory(), and framework::EventProcessor::histograms_.

Member Data Documentation

◆ last_timestamp_

uint64_t dqm::EventSummaryDQM::last_timestamp_ {0}
private

timestamp [ns] of the previous built event, 0 before the first

Definition at line 32 of file EventSummaryDQM.h.

32{0};

Referenced by analyze().

◆ summary_name_

std::string dqm::EventSummaryDQM::summary_name_
private

EventSummary collection name.

Definition at line 26 of file EventSummaryDQM.h.

Referenced by analyze(), and configure().

◆ summary_pass_

std::string dqm::EventSummaryDQM::summary_pass_
private

EventSummary pass name.

Definition at line 29 of file EventSummaryDQM.h.

Referenced by analyze(), and configure().


The documentation for this class was generated from the following files: