LDMX Software
Public Member Functions | Private Attributes | List of all members
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.
 
- 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 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

- 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

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.

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

◆ ~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 &hcalHits{
21 event.getCollection<ldmx::HcalHit>(rec_coll_name_, rec_pass_name_)};
22
23 const auto &hcalSimHits{event.getCollection<ldmx::SimCalorimeterHit>(
25 analyzeSimHits(hcalSimHits);
26 analyzeRecHits(hcalHits);
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:23
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 totalPE{0};
87 float maxPE{-1};
88 float maxPETime{-1};
89 float totalE{0};
90 int vetoableHitMultiplicity{0};
91 int hitMultiplicity{0};
92
93 for (const ldmx::HcalHit &hit : hits) {
94 ldmx::HcalID id(hit.getID());
95 const auto orientation{geometry.getScintillatorOrientation(id)};
96 const auto section{id.section()};
97 const auto layer{id.layer()};
98 const auto strip{id.strip()};
99 if (skipHit(id)) {
100 continue;
101 }
102
103 if (hit.isNoise()) {
104 histograms_.fill("noise", 1);
105 } else {
106 histograms_.fill("noise", 0);
107 }
108 if (hitPassesVeto(hit, section)) {
109 hitMultiplicity++;
110 } else {
111 hitMultiplicity++;
112 vetoableHitMultiplicity++;
113 }
114 const auto pe{hit.getPE()};
115 const auto t{hit.getTime()};
116 const auto e{hit.getEnergy()};
117 const auto x{hit.getXPos()};
118 const auto y{hit.getYPos()};
119 const auto z{hit.getZPos()};
120 switch (orientation) {
121 case ldmx::HcalGeometry::ScintillatorOrientation::horizontal:
122 histograms_.fill("along_x", x);
123 break;
124 case ldmx::HcalGeometry::ScintillatorOrientation::vertical:
125 histograms_.fill("along_y", y);
126 break;
127 case ldmx::HcalGeometry::ScintillatorOrientation::depth:
128 histograms_.fill("along_z", z);
129 break;
130 }
131 totalE += e;
132 totalPE += pe;
133
134 if (pe > maxPE) {
135 maxPE = pe;
136 maxPETime = t;
137 }
138 histograms_.fill("layer:strip", layer, strip);
139 histograms_.fill("pe", pe);
140 histograms_.fill("hit_time", t);
141 histograms_.fill("layer", layer);
142 histograms_.fill("noise", hit.isNoise());
143 histograms_.fill("energy", e);
144 histograms_.fill("hit_z", z);
145 }
146 histograms_.fill("total_energy", totalE);
147 histograms_.fill("total_pe", totalPE);
148 histograms_.fill("max_pe", maxPE);
149 histograms_.fill("max_pe_time", maxPETime);
150 histograms_.fill("hit_multiplicity", hitMultiplicity);
151 histograms_.fill("vetoable_hit_multiplicity", vetoableHitMultiplicity);
152}
HistogramHelper histograms_
Interface class for making and filling histograms.
void fill(const std::string &name, const double &val)
Fill a 1D histogram.
Definition Histograms.h:166
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> simEnergyPerBar;
33 int hitMultiplicity{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 (simEnergyPerBar.count(id) == 0) {
42 simEnergyPerBar[id] = energy;
43 } else {
44 simEnergyPerBar[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 hitMultiplicity++;
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", hitMultiplicity);
73 histograms_.fill("sim_num_bars_hit", simEnergyPerBar.size());
74
75 double total_energy{0};
76 for (const auto [id, energy] : simEnergyPerBar) {
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.getParameter<std::string>("rec_coll_name");
10 rec_pass_name_ = ps.getParameter<std::string>("rec_pass_name");
11 sim_coll_name_ = ps.getParameter<std::string>("sim_coll_name");
12 sim_pass_name_ = ps.getParameter<std::string>("sim_pass_name");
13 pe_veto_threshold = ps.getParameter<double>("pe_veto_threshold");
14 section_ = ps.getParameter<int>("section");
15 max_hit_time_ = ps.getParameter<double>("max_hit_time");
16}

References framework::config::Parameters::getParameter(), 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:58
float getPE() const
Get the number of photoelectrons estimated for this hit.
Definition HcalHit.h:50

◆ 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: