LDMX Software
Public Member Functions | Private Attributes | List of all members
dqm::EcalDigiVerifier Class Reference

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

#include <EcalDigiVerifier.h>

Public Member Functions

 EcalDigiVerifier (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.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 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 ecalSimHitColl_
 Collection Name for SimHits.
 
std::string ecalSimHitPass_
 Pass Name for SimHits.
 
std::string ecalRecHitColl_
 Collection Name for RecHits.
 
std::string ecalRecHitPass_
 Pass Name for RecHits.
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Analyzer
static const int CLASSTYPE {2}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 The logger for this EventProcessor.
 

Detailed Description

Generate histograms to check digi pipeline performance.

Definition at line 14 of file EcalDigiVerifier.h.

Constructor & Destructor Documentation

◆ EcalDigiVerifier()

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

Constructor.

Blank Analyzer constructor

Definition at line 21 of file EcalDigiVerifier.h.

22 : framework::Analyzer(name, process) {}
Base class for a module which does not produce a data product.

Member Function Documentation

◆ analyze()

void dqm::EcalDigiVerifier::analyze ( const framework::Event event)
virtual

Fills histograms.

Implements framework::Analyzer.

Definition at line 18 of file EcalDigiVerifier.cxx.

18 {
19 // get truth information sorted into an ID based map
20 std::vector<ldmx::SimCalorimeterHit> ecalSimHits =
21 event.getCollection<ldmx::SimCalorimeterHit>(ecalSimHitColl_,
23
24 // sort sim hits by ID
25 std::sort(ecalSimHits.begin(), ecalSimHits.end(),
26 [](const ldmx::SimCalorimeterHit &lhs,
27 const ldmx::SimCalorimeterHit &rhs) {
28 return lhs.getID() < rhs.getID();
29 });
30
31 std::vector<ldmx::EcalHit> ecalRecHits =
32 event.getCollection<ldmx::EcalHit>(ecalRecHitColl_, ecalRecHitPass_);
33
34 // sort rec hits by ID
35 std::sort(ecalRecHits.begin(), ecalRecHits.end(),
36 [](const ldmx::EcalHit &lhs, const ldmx::EcalHit &rhs) {
37 return lhs.getID() < rhs.getID();
38 });
39
40 int numRecHits{0};
41 int numNoiseHits{0};
42 double totalRecEnergy{0.};
43 for (const ldmx::EcalHit &recHit : ecalRecHits) {
44 numRecHits++;
45 // skip anything that digi flagged as noise
46 if (recHit.isNoise()) {
47 numNoiseHits++;
48 continue;
49 }
50
51 int rawID = recHit.getID();
52
53 // get information for this hit
54 int numSimHits = 0;
55 double totalSimEDep = 0.;
56 for (const ldmx::SimCalorimeterHit &simHit : ecalSimHits) {
57 if (rawID == simHit.getID()) {
58 numSimHits += simHit.getNumberOfContribs();
59 totalSimEDep += simHit.getEdep();
60 } else if (rawID < simHit.getID()) {
61 // later sim hits - all done
62 break;
63 }
64 }
65
66 histograms_.fill("num_sim_hits_per_cell", numSimHits);
67 histograms_.fill("sim_edep__rec_amplitude", totalSimEDep,
68 recHit.getAmplitude());
69
70 totalRecEnergy += recHit.getEnergy();
71 }
72 histograms_.fill("num_rec_hits", numRecHits);
73 histograms_.fill("num_noise_hits", numNoiseHits);
74 histograms_.fill("total_rec_energy", totalRecEnergy);
75
76 if (totalRecEnergy > 6000.) {
78 } else {
80 }
81
82 return;
83}
std::string ecalSimHitPass_
Pass Name for SimHits.
std::string ecalRecHitColl_
Collection Name for RecHits.
std::string ecalSimHitColl_
Collection Name for SimHits.
std::string ecalRecHitPass_
Pass Name for RecHits.
HistogramHelper histograms_
Interface class for making and filling histograms.
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module.
void fill(const std::string &name, const double &val)
Fill a 1D histogram.
Definition Histograms.h:166
Stores reconstructed hit information from the ECAL.
Definition EcalHit.h:19
Stores simulated calorimeter hit information.
constexpr StorageControl::Hint hint_shouldKeep
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint hint_shouldDrop
storage control hint alias for backwards compatibility

References ecalRecHitColl_, ecalRecHitPass_, ecalSimHitColl_, ecalSimHitPass_, framework::HistogramHelper::fill(), framework::hint_shouldDrop, framework::hint_shouldKeep, framework::EventProcessor::histograms_, and framework::EventProcessor::setStorageHint().

◆ configure()

void dqm::EcalDigiVerifier::configure ( framework::config::Parameters ps)
virtual

Input python configuration parameters.

Reimplemented from framework::EventProcessor.

Definition at line 9 of file EcalDigiVerifier.cxx.

9 {
10 ecalSimHitColl_ = ps.getParameter<std::string>("ecalSimHitColl");
11 ecalSimHitPass_ = ps.getParameter<std::string>("ecalSimHitPass");
12 ecalRecHitColl_ = ps.getParameter<std::string>("ecalRecHitColl");
13 ecalRecHitPass_ = ps.getParameter<std::string>("ecalRecHitPass");
14
15 return;
16}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89

References ecalRecHitColl_, ecalRecHitPass_, ecalSimHitColl_, ecalSimHitPass_, and framework::config::Parameters::getParameter().

Member Data Documentation

◆ ecalRecHitColl_

std::string dqm::EcalDigiVerifier::ecalRecHitColl_
private

Collection Name for RecHits.

Definition at line 42 of file EcalDigiVerifier.h.

Referenced by analyze(), and configure().

◆ ecalRecHitPass_

std::string dqm::EcalDigiVerifier::ecalRecHitPass_
private

Pass Name for RecHits.

Definition at line 45 of file EcalDigiVerifier.h.

Referenced by analyze(), and configure().

◆ ecalSimHitColl_

std::string dqm::EcalDigiVerifier::ecalSimHitColl_
private

Collection Name for SimHits.

Definition at line 36 of file EcalDigiVerifier.h.

Referenced by analyze(), and configure().

◆ ecalSimHitPass_

std::string dqm::EcalDigiVerifier::ecalSimHitPass_
private

Pass Name for SimHits.

Definition at line 39 of file EcalDigiVerifier.h.

Referenced by analyze(), and configure().


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