LDMX Software
dqm::HCalDQM Class Reference

Public Member Functions

 HCalDQM (const std::string &name, framework::Process &process)
 Constructor.
 
 ~HCalDQM ()
 Destructor.
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user specified parameters.
 
void analyze (const framework::Event &event) override
 Process the event and make histograms ro summaries.
 
bool skipHit (const ldmx::HcalID &id)
 
void analyzeRecHits (const std::vector< ldmx::HcalHit > &hits)
 
void analyzeSimHits (const std::vector< ldmx::SimCalorimeterHit > &hits)
 
bool hitPassesVeto (const ldmx::HcalHit &hit, int section)
 
- 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 sim_coll_name_
 Hcal Sim Hits collection name.
 
std::string sim_pass_name_
 Hcal Sim Hits pass name.
 
std::string rec_coll_name_
 Hcal Rec Hits collection name.
 
std::string rec_pass_name_
 Hcal Rec Hits pass name.
 
std::string veto_name_
 Hcal Veto name.
 
std::string veto_pass_
 Hcal Veto pass name.
 
float pe_veto_threshold_
 
int section_
 
double max_hit_time_
 

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

Definition at line 30 of file HCalDQM.h.

Constructor & Destructor Documentation

◆ HCalDQM()

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

Constructor.

Definition at line 5 of file HCalDQM.cxx.

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.

◆ ~HCalDQM()

dqm::HCalDQM::~HCalDQM ( )
inline

Destructor.

Definition at line 36 of file HCalDQM.h.

36{}

Member Function Documentation

◆ analyze()

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

Process the event and make histograms ro summaries.

Parameters
eventThe event to analyze.

Implements framework::Analyzer.

Definition at line 18 of file HCalDQM.cxx.

18 {
19 // Get the collection of HCalDQM digitized hits if the exists
20 const auto &hcal_hits{
21 event.getCollection<ldmx::HcalHit>(rec_coll_name_, rec_pass_name_)};
22
23 const auto &hcal_sim_hits{event.getCollection<ldmx::SimCalorimeterHit>(
25 analyzeSimHits(hcal_sim_hits);
26 analyzeRecHits(hcal_hits);
27}
std::string sim_pass_name_
Hcal Sim Hits pass name.
Definition HCalDQM.h:74
std::string rec_pass_name_
Hcal Rec Hits pass name.
Definition HCalDQM.h:79
std::string rec_coll_name_
Hcal Rec Hits collection name.
Definition HCalDQM.h:76
std::string sim_coll_name_
Hcal Sim Hits collection name.
Definition HCalDQM.h:71
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:24
Stores simulated calorimeter hit information.

References rec_coll_name_, rec_pass_name_, sim_coll_name_, and sim_pass_name_.

◆ analyzeRecHits()

void dqm::HCalDQM::analyzeRecHits ( const std::vector< ldmx::HcalHit > & hits)

Definition at line 82 of file HCalDQM.cxx.

82 {
83 const auto &geometry = getCondition<ldmx::HcalGeometry>(
85
86 float total_pe{0};
87 float max_pe{-1};
88 float max_pe_time{-1};
89 float max_pe_adc{-1};
90 float max_pe_adc_time{-1};
91 float total_e{0};
92 int vetoable_hit_multiplicity{0};
93 int hit_multiplicity{0};
94
95 for (const ldmx::HcalHit &hit : hits) {
96 ldmx::HcalID id(hit.getID());
97 const auto orientation{geometry.getScintillatorOrientation(id)};
98 const auto section{id.section()};
99 const auto layer{id.layer()};
100 const auto strip{id.strip()};
101 if (skipHit(id)) {
102 continue;
103 }
104
105 if (hit.isNoise()) {
106 histograms_.fill("noise", 1);
107 } else {
108 histograms_.fill("noise", 0);
109 }
110 if (hitPassesVeto(hit, section)) {
111 hit_multiplicity++;
112 } else {
113 hit_multiplicity++;
114 vetoable_hit_multiplicity++;
115 }
116 const auto pe{hit.getPE()};
117 const auto t{hit.getTime()};
118 const auto e{hit.getEnergy()};
119 const auto x{hit.getXPos()};
120 const auto y{hit.getYPos()};
121 const auto z{hit.getZPos()};
122 switch (orientation) {
123 case ldmx::HcalGeometry::ScintillatorOrientation::horizontal:
124 histograms_.fill("along_x", x);
125 break;
126 case ldmx::HcalGeometry::ScintillatorOrientation::vertical:
127 histograms_.fill("along_y", y);
128 break;
129 case ldmx::HcalGeometry::ScintillatorOrientation::depth:
130 histograms_.fill("along_z", z);
131 break;
132 }
133 total_e += e;
134 total_pe += pe;
135
136 if (pe > max_pe) {
137 max_pe = pe;
138 max_pe_time = t;
139 }
140
141 // Track max PE for ADC mode only
142 if (hit.getIsADC()) {
143 if (pe > max_pe_adc) {
144 max_pe_adc = pe;
145 max_pe_adc_time = t;
146 }
147 }
148
149 histograms_.fill("layer:strip", layer, strip);
150 histograms_.fill("pe", pe);
151 histograms_.fill("hit_time", t);
152 histograms_.fill("layer", layer);
153 histograms_.fill("noise", hit.isNoise());
154 histograms_.fill("energy", e);
155 histograms_.fill("hit_z", z);
156 }
157 histograms_.fill("total_energy", total_e);
158 histograms_.fill("total_pe", total_pe);
159 histograms_.fill("max_pe", max_pe);
160 histograms_.fill("max_pe_time", max_pe_time);
161 histograms_.fill("max_pe_adc", max_pe_adc);
162 histograms_.fill("max_pe_adc_time", max_pe_adc_time);
163 histograms_.fill("hit_multiplicity", hit_multiplicity);
164 histograms_.fill("vetoable_hit_multiplicity", vetoable_hit_multiplicity);
165}
const T & getCondition(const std::string &condition_name)
Access a conditions object for the current event.
HistogramPool histograms_
helper object for making and filling histograms
void fill(const std::string &name, const T &val)
Fill a 1D histogram.
static constexpr const char * CONDITIONS_OBJECT_NAME
Conditions object: The name of the python configuration calling this class (Hcal/python/HcalGeometry....
Implements detector ids for HCal subdetector.
Definition HcalID.h:19

◆ analyzeSimHits()

void dqm::HCalDQM::analyzeSimHits ( const std::vector< ldmx::SimCalorimeterHit > & hits)

Definition at line 28 of file HCalDQM.cxx.

28 {
29 const auto &geometry = getCondition<ldmx::HcalGeometry>(
31
32 std::map<ldmx::HcalID, double> sim_energy_per_bar;
33 int hit_multiplicity{0};
34
35 for (const auto &hit : hits) {
36 ldmx::HcalID id(hit.getID());
37 if (skipHit(id)) {
38 continue;
39 }
40 const auto energy{hit.getEdep()};
41 if (sim_energy_per_bar.count(id) == 0) {
42 sim_energy_per_bar[id] = energy;
43 } else {
44 sim_energy_per_bar[id] += energy;
45 }
46 const auto orientation{geometry.getScintillatorOrientation(id)};
47 const auto layer{id.layer()};
48 const auto strip{id.strip()};
49 const auto pos{hit.getPosition()};
50 const auto x{pos[0]};
51 const auto y{pos[1]};
52 const auto z{pos[2]};
53 const auto t{hit.getTime()};
54 hit_multiplicity++;
55 histograms_.fill("sim_hit_time", t);
56 histograms_.fill("sim_layer", layer);
57 histograms_.fill("sim_layer:strip", layer, strip);
58 histograms_.fill("sim_energy", energy);
59 switch (orientation) {
60 case ldmx::HcalGeometry::ScintillatorOrientation::horizontal:
61 histograms_.fill("sim_along_x", x);
62 break;
63 case ldmx::HcalGeometry::ScintillatorOrientation::vertical:
64 histograms_.fill("sim_along_y", y);
65 break;
66 case ldmx::HcalGeometry::ScintillatorOrientation::depth:
67 histograms_.fill("sim_along_z", z);
68 break;
69 }
70 }
71
72 histograms_.fill("sim_hit_multiplicity", hit_multiplicity);
73 histograms_.fill("sim_num_bars_hit", sim_energy_per_bar.size());
74
75 double total_energy{0};
76 for (const auto [id, energy] : sim_energy_per_bar) {
77 histograms_.fill("sim_energy_per_bar", energy);
78 total_energy += energy;
79 }
80 histograms_.fill("sim_total_energy", total_energy);
81}

◆ configure()

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

Configure the processor using the given user specified parameters.

Parameters
parametersSet of parameters used to configure this processor.

Reimplemented from framework::EventProcessor.

Definition at line 8 of file HCalDQM.cxx.

8 {
9 rec_coll_name_ = ps.get<std::string>("rec_coll_name");
10 rec_pass_name_ = ps.get<std::string>("rec_pass_name");
11 sim_coll_name_ = ps.get<std::string>("sim_coll_name");
12 sim_pass_name_ = ps.get<std::string>("sim_pass_name");
13 pe_veto_threshold_ = ps.get<double>("pe_veto_threshold");
14 section_ = ps.get<int>("section");
15 max_hit_time_ = ps.get<double>("max_hit_time");
16}

References framework::config::Parameters::get(), rec_coll_name_, rec_pass_name_, sim_coll_name_, and sim_pass_name_.

◆ hitPassesVeto()

bool dqm::HCalDQM::hitPassesVeto ( const ldmx::HcalHit & hit,
int section )
inline

Definition at line 59 of file HCalDQM.h.

59 {
60 if (hit.getPE() < pe_veto_threshold_ || hit.getTime() > max_hit_time_) {
61 return true;
62 }
63 if (section == ldmx::HcalID::HcalSection::BACK && hit.getMinPE() < 1) {
64 return true;
65 }
66 return false;
67 }
float getTime() const
Get the time of the hit [ns].
float getMinPE() const
Get the minimum number of photoelectrons estimated for this hit if two sided readout.
Definition HcalHit.h:59
float getPE() const
Get the number of photoelectrons estimated for this hit.
Definition HcalHit.h:51

◆ skipHit()

bool dqm::HCalDQM::skipHit ( const ldmx::HcalID & id)
inline

Definition at line 52 of file HCalDQM.h.

52 {
53 const auto section{id.section()};
54 return (section != section_ && section_ != -1);
55 }

Member Data Documentation

◆ max_hit_time_

double dqm::HCalDQM::max_hit_time_
private

Definition at line 90 of file HCalDQM.h.

◆ pe_veto_threshold_

float dqm::HCalDQM::pe_veto_threshold_
private

Definition at line 88 of file HCalDQM.h.

◆ rec_coll_name_

std::string dqm::HCalDQM::rec_coll_name_
private

Hcal Rec Hits collection name.

Definition at line 76 of file HCalDQM.h.

Referenced by analyze(), and configure().

◆ rec_pass_name_

std::string dqm::HCalDQM::rec_pass_name_
private

Hcal Rec Hits pass name.

Definition at line 79 of file HCalDQM.h.

Referenced by analyze(), and configure().

◆ section_

int dqm::HCalDQM::section_
private

Definition at line 89 of file HCalDQM.h.

◆ sim_coll_name_

std::string dqm::HCalDQM::sim_coll_name_
private

Hcal Sim Hits collection name.

Definition at line 71 of file HCalDQM.h.

Referenced by analyze(), and configure().

◆ sim_pass_name_

std::string dqm::HCalDQM::sim_pass_name_
private

Hcal Sim Hits pass name.

Definition at line 74 of file HCalDQM.h.

Referenced by analyze(), and configure().

◆ veto_name_

std::string dqm::HCalDQM::veto_name_
private

Hcal Veto name.

Definition at line 82 of file HCalDQM.h.

◆ veto_pass_

std::string dqm::HCalDQM::veto_pass_
private

Hcal Veto pass name.

Definition at line 85 of file HCalDQM.h.


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