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