LDMX Software
HcalInefficiencyDQM.cxx
1
2#include "DQM/HcalInefficiencyDQM.h"
3
4namespace dqm {
6 const auto hcalSimHits = event.getCollection<ldmx::SimCalorimeterHit>(
7 hcalSimHitsCollection_, hcalSimHitsPassName_);
8 const auto hcalRecHits = event.getCollection<ldmx::HcalHit>(
9 hcalRecHitsCollection_, hcalRecHitsPassName_);
10
11 const int failedVeto{999};
12 // Check veto for each section, combined side hcal veto
13 std::vector<int> firstLayersHit{failedVeto, failedVeto, failedVeto,
14 failedVeto, failedVeto};
15
16 const std::vector<std::string> sectionNames{"back", "top", "bottom", "right",
17 "left"};
18 for (const auto &hit : hcalRecHits) {
19 const ldmx::HcalID id{static_cast<ldmx::DetectorID::RawValue>(hit.getID())};
20 const auto section{id.section()};
21 const auto layer{id.layer()};
22 if (hitPassesVeto(hit, section)) {
23 if (layer < firstLayersHit[section]) {
24 firstLayersHit[section] = layer;
25 }
26 }
27 }
28
29 bool vetoedByBack{firstLayersHit[ldmx::HcalID::HcalSection::BACK] !=
30 failedVeto};
31 bool vetoedByTop{firstLayersHit[ldmx::HcalID::HcalSection::TOP] !=
32 failedVeto};
33 bool vetoedByBottom{firstLayersHit[ldmx::HcalID::HcalSection::BOTTOM] !=
34 failedVeto};
35 bool vetoedByRight{firstLayersHit[ldmx::HcalID::HcalSection::RIGHT] !=
36 failedVeto};
37 bool vetoedByLeft{firstLayersHit[ldmx::HcalID::HcalSection::LEFT] !=
38 failedVeto};
39 bool vetoedBySide{vetoedByTop || vetoedByBottom || vetoedByRight ||
40 vetoedByLeft};
41
42 for (int section{0}; section < firstLayersHit.size(); ++section) {
43 const auto layer{firstLayersHit[section]};
44 const auto sectionName{sectionNames[section]};
45 if (layer != failedVeto) {
46 histograms_.fill("inefficiency_" + sectionName, layer);
47 histograms_.fill("efficiency", section);
48 }
49 }
50 if (vetoedByBack || vetoedBySide) {
51 histograms_.fill("efficiency", vetoCategories::any);
52 if (vetoedByBack && vetoedBySide) {
53 histograms_.fill("efficiency", vetoCategories::both);
54 } else if (vetoedByBack && !vetoedBySide) {
55 histograms_.fill("efficiency", vetoCategories::back_only);
56 } else if (vetoedBySide && !vetoedByBack) {
57 histograms_.fill("efficiency", vetoCategories::side_only);
58 }
59 } else {
60 histograms_.fill("efficiency", vetoCategories::neither);
61 }
62}
63
65
67 hcalSimHitsCollection_ =
68 parameters.getParameter<std::string>("sim_coll_name");
69 hcalRecHitsCollection_ =
70 parameters.getParameter<std::string>("rec_coll_name");
71 hcalSimHitsPassName_ = parameters.getParameter<std::string>("sim_pass_name");
72 hcalRecHitsPassName_ = parameters.getParameter<std::string>("rec_pass_name");
73 pe_veto_threshold = parameters.getParameter<double>("pe_veto_threshold");
74 max_hit_time_ = parameters.getParameter<double>("max_hit_time");
75}
76} // namespace dqm
77
78DECLARE_ANALYZER_NS(dqm, HcalInefficiencyAnalyzer);
#define DECLARE_ANALYZER_NS(NS, CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
void analyze(const framework::Event &event) override
Process the event and make histograms or summaries.
void configure(framework::config::Parameters &parameters) override
Callback for the EventProcessor to configure itself from the given set of parameters.
HistogramHelper histograms_
Interface class for making and filling histograms.
Implements an event buffer system for storing event data.
Definition Event.h:41
void fill(const std::string &name, const double &val)
Fill a 1D histogram.
Definition Histograms.h:166
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:23
Implements detector ids for HCal subdetector.
Definition HcalID.h:19
Stores simulated calorimeter hit information.