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

Detailed Description

Definition at line 23 of file HCalDQM.h.

Constructor & Destructor Documentation

◆ HCalDQM()

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

Constructor.

Definition at line 9 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 29 of file HCalDQM.h.

29{}

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 22 of file HCalDQM.cxx.

22 {
23 // Get the collection of HCalDQM digitized hits if the exists
24 const auto& hcal_hits{
25 event.getCollection<ldmx::HcalHit>(rec_coll_name_, rec_pass_name_)};
26
27 const auto& hcal_sim_hits{event.getCollection<ldmx::SimCalorimeterHit>(
29 analyzeSimHits(hcal_sim_hits);
30 analyzeRecHits(hcal_hits);
31}
std::string sim_pass_name_
Hcal Sim Hits pass name.
Definition HCalDQM.h:67
std::string rec_pass_name_
Hcal Rec Hits pass name.
Definition HCalDQM.h:72
std::string rec_coll_name_
Hcal Rec Hits collection name.
Definition HCalDQM.h:69
std::string sim_coll_name_
Hcal Sim Hits collection name.
Definition HCalDQM.h:64
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 86 of file HCalDQM.cxx.

86 {
87 const auto& geometry = getCondition<ldmx::HcalGeometry>(
89
90 float total_pe{0};
91 float max_pe{-1};
92 float max_pe_time{-1};
93 float max_pe_adc{-1};
94 float max_pe_adc_time{-1};
95 float total_e{0};
96 int vetoable_hit_multiplicity{0};
97 int hit_multiplicity{0};
98
99 for (const ldmx::HcalHit& hit : hits) {
100 ldmx::HcalID id(hit.getID());
101 const auto orientation{geometry.getScintillatorOrientation(id)};
102 const auto section{id.section()};
103 const auto layer{id.layer()};
104 const auto strip{id.strip()};
105 if (skipHit(id)) {
106 continue;
107 }
108
109 if (hit.isNoise()) {
110 histograms_.fill("noise", 1);
111 } else {
112 histograms_.fill("noise", 0);
113 }
114 if (hitPassesVeto(hit, section)) {
115 hit_multiplicity++;
116 } else {
117 hit_multiplicity++;
118 vetoable_hit_multiplicity++;
119 }
120 const auto pe{hit.getPE()};
121 const auto t{hit.getTime()};
122 const auto e{hit.getEnergy()};
123 const auto x{hit.getXPos()};
124 const auto y{hit.getYPos()};
125 const auto z{hit.getZPos()};
126 switch (orientation) {
127 case ldmx::HcalGeometry::ScintillatorOrientation::horizontal:
128 histograms_.fill("along_x", x);
129 break;
130 case ldmx::HcalGeometry::ScintillatorOrientation::vertical:
131 histograms_.fill("along_y", y);
132 break;
133 case ldmx::HcalGeometry::ScintillatorOrientation::depth:
134 histograms_.fill("along_z", z);
135 break;
136 }
137 total_e += e;
138 total_pe += pe;
139
140 if (pe > max_pe) {
141 max_pe = pe;
142 max_pe_time = t;
143 }
144
145 // Track max PE for ADC mode only
146 if (hit.getIsADC()) {
147 if (pe > max_pe_adc) {
148 max_pe_adc = pe;
149 max_pe_adc_time = t;
150 }
151 }
152
153 histograms_.fill("layer:strip", layer, strip);
154 histograms_.fill("pe", pe);
155 histograms_.fill("hit_time", t);
156 histograms_.fill("layer", layer);
157 histograms_.fill("noise", hit.isNoise());
158 histograms_.fill("energy", e);
159 histograms_.fill("hit_z", z);
160 }
161 histograms_.fill("total_energy", total_e);
162 histograms_.fill("total_pe", total_pe);
163 histograms_.fill("max_pe", max_pe);
164 histograms_.fill("max_pe_time", max_pe_time);
165 histograms_.fill("max_pe_adc", max_pe_adc);
166 histograms_.fill("max_pe_adc_time", max_pe_adc_time);
167 histograms_.fill("hit_multiplicity", hit_multiplicity);
168 histograms_.fill("vetoable_hit_multiplicity", vetoable_hit_multiplicity);
169}
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 32 of file HCalDQM.cxx.

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

◆ 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 12 of file HCalDQM.cxx.

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

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 52 of file HCalDQM.h.

52 {
53 if (hit.getPE() < pe_veto_threshold_ || hit.getTime() > max_hit_time_) {
54 return true;
55 }
56 if (section == ldmx::HcalID::HcalSection::BACK && hit.getMinPE() < 1) {
57 return true;
58 }
59 return false;
60 }
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 45 of file HCalDQM.h.

45 {
46 const auto section{id.section()};
47 return (section != section_ && section_ != -1);
48 }

Member Data Documentation

◆ max_hit_time_

double dqm::HCalDQM::max_hit_time_
private

Definition at line 83 of file HCalDQM.h.

◆ pe_veto_threshold_

float dqm::HCalDQM::pe_veto_threshold_
private

Definition at line 81 of file HCalDQM.h.

◆ rec_coll_name_

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

Hcal Rec Hits collection name.

Definition at line 69 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 72 of file HCalDQM.h.

Referenced by analyze(), and configure().

◆ section_

int dqm::HCalDQM::section_
private

Definition at line 82 of file HCalDQM.h.

◆ sim_coll_name_

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

Hcal Sim Hits collection name.

Definition at line 64 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 67 of file HCalDQM.h.

Referenced by analyze(), and configure().

◆ veto_name_

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

Hcal Veto name.

Definition at line 75 of file HCalDQM.h.

◆ veto_pass_

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

Hcal Veto pass name.

Definition at line 78 of file HCalDQM.h.


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