LDMX Software
dqm::TrigScintDigiVerifier Class Reference

Generate histograms to check digi pipeline performance. More...

#include <TrigScintDigiVerifier.h>

Public Member Functions

 TrigScintDigiVerifier (const std::string &name, framework::Process &process)
 Constructor.
 
virtual void configure (framework::config::Parameters &ps)
 Input python configuration parameters.
 
virtual void analyze (const framework::Event &event)
 Fills histograms.
 
- 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 onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
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 ts_simhit_coll_
 Collection Name for SimHits.
 
std::string ts_simhit_pass_
 Pass Name for SimHits.
 
std::string ts_digi_coll_
 Collection Name for digis.
 
std::string ts_digi_pass_
 Pass Name for digis.
 

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
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Generate histograms to check digi pipeline performance.

Definition at line 19 of file TrigScintDigiVerifier.h.

Constructor & Destructor Documentation

◆ TrigScintDigiVerifier()

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

Constructor.

Blank Analyzer constructor

Definition at line 26 of file TrigScintDigiVerifier.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::TrigScintDigiVerifier::analyze ( const framework::Event & event)
virtual

Fills histograms.

Implements framework::Analyzer.

Definition at line 14 of file TrigScintDigiVerifier.cxx.

14 {
15 // get truth information sorted into an ID based map
16 auto ts_simhits = event.getCollection<ldmx::SimCalorimeterHit>(
18
19 // sort sim hits by ID
20 std::sort(ts_simhits.begin(), ts_simhits.end(),
21 [](const ldmx::SimCalorimeterHit &lhs,
22 const ldmx::SimCalorimeterHit &rhs) {
23 return lhs.getID() < rhs.getID();
24 });
25
26 auto ts_digis{
27 event.getCollection<ldmx::TrigScintHit>(ts_digi_coll_, ts_digi_pass_)};
28
29 // sort digi hits by ID
30 std::sort(ts_digis.begin(), ts_digis.end(),
31 [](const ldmx::TrigScintHit &lhs, const ldmx::TrigScintHit &rhs) {
32 return lhs.getID() < rhs.getID();
33 });
34
35 // Loop on the ts rechits
36 ldmx_log(info) << "There are " << ts_digis.size()
37 << " ts digis in this event";
38 for (const auto &ts_digi : ts_digis) {
39 // skip anything that digi flagged as noise
40 if (ts_digi.isNoise()) {
41 ldmx_log(debug) << "Digi with raw ID " << ts_digi.getID()
42 << " and bar ID " << ts_digi.getBarID()
43 << " is flagged as noise, skipping";
44 continue;
45 }
46 int raw_id = ts_digi.getID();
47 ldmx_log(debug) << "Digi with raw ID " << raw_id << " and bar ID "
48 << ts_digi.getBarID() << " has energy "
49 << ts_digi.getEnergy() << " and amplitude "
50 << ts_digi.getAmplitude();
51
52 // get information for this hit
53
54 double total_sim_energy_dep = 0.;
55 for (const auto &ts_simhit : ts_simhits) {
56 if (raw_id == ts_simhit.getID()) {
57 total_sim_energy_dep += ts_simhit.getEdep();
58 } else if (raw_id < ts_simhit.getID()) {
59 // later sim hits - all done
60 break;
61 }
62 }
63
64 ldmx_log(info) << " There are " << ts_simhits.size()
65 << " sim hits in this event, adding up to a total energy of "
66 << total_sim_energy_dep;
67
68 histograms_.fill("sim_edep:rec_amplitude", total_sim_energy_dep,
69 ts_digi.getAmplitude());
70 histograms_.fill("sim_edep:rec_energy", total_sim_energy_dep,
71 ts_digi.getEnergy());
72 } // end of loop on ts digis
73
74 return;
75}
std::string ts_simhit_pass_
Pass Name for SimHits.
std::string ts_simhit_coll_
Collection Name for SimHits.
std::string ts_digi_coll_
Collection Name for digis.
std::string ts_digi_pass_
Pass Name for digis.
HistogramPool histograms_
helper object for making and filling histograms
void fill(const std::string &name, const T &val)
Fill a 1D histogram.
Stores simulated calorimeter hit information.

References framework::HistogramPool::fill(), framework::EventProcessor::histograms_, ts_digi_coll_, ts_digi_pass_, ts_simhit_coll_, and ts_simhit_pass_.

◆ configure()

void dqm::TrigScintDigiVerifier::configure ( framework::config::Parameters & ps)
virtual

Input python configuration parameters.

Reimplemented from framework::EventProcessor.

Definition at line 5 of file TrigScintDigiVerifier.cxx.

5 {
6 ts_simhit_coll_ = ps.get<std::string>("ts_simhit_coll");
7 ts_simhit_pass_ = ps.get<std::string>("ts_simhit_pass");
8 ts_digi_coll_ = ps.get<std::string>("ts_digi_coll");
9 ts_digi_pass_ = ps.get<std::string>("ts_digi_pass");
10
11 return;
12}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

References framework::config::Parameters::get(), ts_digi_coll_, ts_digi_pass_, ts_simhit_coll_, and ts_simhit_pass_.

Member Data Documentation

◆ ts_digi_coll_

std::string dqm::TrigScintDigiVerifier::ts_digi_coll_
private

Collection Name for digis.

Definition at line 47 of file TrigScintDigiVerifier.h.

Referenced by analyze(), and configure().

◆ ts_digi_pass_

std::string dqm::TrigScintDigiVerifier::ts_digi_pass_
private

Pass Name for digis.

Definition at line 50 of file TrigScintDigiVerifier.h.

Referenced by analyze(), and configure().

◆ ts_simhit_coll_

std::string dqm::TrigScintDigiVerifier::ts_simhit_coll_
private

Collection Name for SimHits.

Definition at line 41 of file TrigScintDigiVerifier.h.

Referenced by analyze(), and configure().

◆ ts_simhit_pass_

std::string dqm::TrigScintDigiVerifier::ts_simhit_pass_
private

Pass Name for SimHits.

Definition at line 44 of file TrigScintDigiVerifier.h.

Referenced by analyze(), and configure().


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