LDMX Software
HcalInefficiencyDQM.cxx
1
2#include "DQM/HcalInefficiencyDQM.h"
3
4namespace dqm {
5
7
9 hcal_sim_hits_collection_ = parameters.get<std::string>("sim_coll_name");
10 hcal_rec_hits_collection_ = parameters.get<std::string>("rec_coll_name");
11 hcal_sim_hits_pass_name_ = parameters.get<std::string>("sim_pass_name");
12 hcal_rec_hits_pass_name_ = parameters.get<std::string>("rec_pass_name");
13 pe_veto_threshold_ = parameters.get<double>("pe_veto_threshold");
14 max_hit_time_ = parameters.get<double>("max_hit_time");
15}
16
18 const auto hcal_sim_hits = event.getCollection<ldmx::SimCalorimeterHit>(
19 hcal_sim_hits_collection_, hcal_sim_hits_pass_name_);
20 const auto hcal_rec_hits = event.getCollection<ldmx::HcalHit>(
21 hcal_rec_hits_collection_, hcal_rec_hits_pass_name_);
22
23 const int failed_veto{999};
24 // Check veto for each section, combined side hcal veto
25 std::vector<int> first_layers_hit{failed_veto, failed_veto, failed_veto,
26 failed_veto, failed_veto};
27
28 const std::vector<std::string> section_names{"back", "top", "bottom", "right",
29 "left"};
30 for (const auto &hit : hcal_rec_hits) {
31 const ldmx::HcalID id{static_cast<ldmx::DetectorID::RawValue>(hit.getID())};
32 const auto section{id.section()};
33 const auto layer{id.layer()};
34 if (hitPassesVeto(hit, section)) {
35 if (layer < first_layers_hit[section]) {
36 first_layers_hit[section] = layer;
37 }
38 }
39 }
40
41 bool vetoed_by_back{first_layers_hit[ldmx::HcalID::HcalSection::BACK] !=
42 failed_veto};
43 bool vetoed_by_top{first_layers_hit[ldmx::HcalID::HcalSection::TOP] !=
44 failed_veto};
45 bool vetoed_by_bottom{first_layers_hit[ldmx::HcalID::HcalSection::BOTTOM] !=
46 failed_veto};
47 bool vetoed_by_right{first_layers_hit[ldmx::HcalID::HcalSection::RIGHT] !=
48 failed_veto};
49 bool vetoed_by_left{first_layers_hit[ldmx::HcalID::HcalSection::LEFT] !=
50 failed_veto};
51 bool vetoed_by_side{vetoed_by_top || vetoed_by_bottom || vetoed_by_right ||
52 vetoed_by_left};
53
54 for (int section{0}; section < first_layers_hit.size(); ++section) {
55 const auto layer{first_layers_hit[section]};
56 const auto section_name{section_names[section]};
57 if (layer != failed_veto) {
58 histograms_.fill("inefficiency_" + section_name, layer);
59 histograms_.fill("efficiency", section);
60 }
61 }
62 if (vetoed_by_back || vetoed_by_side) {
63 histograms_.fill("efficiency", vetoCategories::any);
64 if (vetoed_by_back && vetoed_by_side) {
65 histograms_.fill("efficiency", vetoCategories::both);
66 } else if (vetoed_by_back && !vetoed_by_side) {
67 histograms_.fill("efficiency", vetoCategories::back_only);
68 } else if (vetoed_by_side && !vetoed_by_back) {
69 histograms_.fill("efficiency", vetoCategories::side_only);
70 }
71 } else {
72 histograms_.fill("efficiency", vetoCategories::neither);
73 }
74}
75
76} // namespace dqm
77
#define DECLARE_ANALYZER(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.
HistogramPool histograms_
helper object for making and filling histograms
Implements an event buffer system for storing event data.
Definition Event.h:42
void fill(const std::string &name, const T &val)
Fill a 1D histogram.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:24
Implements detector ids for HCal subdetector.
Definition HcalID.h:19
Stores simulated calorimeter hit information.