LDMX Software
TrigScintDigiVerifier.cxx
1#include "DQM/TrigScintDigiVerifier.h"
2
3namespace dqm {
4
6 ts_simhit_coll_ = ps.get<std::string>("ts_simhit_coll");
7 ts_simhit_pass_ = ps.get<std::string>("ts_simhit_pass");
8 ts_digi_coll_ = ps.get<std::string>("ts_digi_coll");
9 ts_digi_pass_ = ps.get<std::string>("ts_digi_pass");
10
11 return;
12}
13
15 // get truth information sorted into an ID based map
16 auto ts_simhits = event.getCollection<ldmx::SimCalorimeterHit>(
18
19 // sort sim hits by ID
20 std::sort(ts_simhits.begin(), ts_simhits.end(),
21 [](const ldmx::SimCalorimeterHit &lhs,
22 const ldmx::SimCalorimeterHit &rhs) {
23 return lhs.getID() < rhs.getID();
24 });
25
26 auto ts_digis{
27 event.getCollection<ldmx::TrigScintHit>(ts_digi_coll_, ts_digi_pass_)};
28
29 // sort digi hits by ID
30 std::sort(ts_digis.begin(), ts_digis.end(),
31 [](const ldmx::TrigScintHit &lhs, const ldmx::TrigScintHit &rhs) {
32 return lhs.getID() < rhs.getID();
33 });
34
35 // Loop on the ts rechits
36 ldmx_log(info) << "There are " << ts_digis.size()
37 << " ts digis in this event";
38 for (const auto &ts_digi : ts_digis) {
39 // skip anything that digi flagged as noise
40 if (ts_digi.isNoise()) {
41 ldmx_log(debug) << "Digi with raw ID " << ts_digi.getID()
42 << " and bar ID " << ts_digi.getBarID()
43 << " is flagged as noise, skipping";
44 continue;
45 }
46 int raw_id = ts_digi.getID();
47 ldmx_log(debug) << "Digi with raw ID " << raw_id << " and bar ID "
48 << ts_digi.getBarID() << " has energy "
49 << ts_digi.getEnergy() << " and amplitude "
50 << ts_digi.getAmplitude();
51
52 // get information for this hit
53
54 double total_sim_energy_dep = 0.;
55 for (const auto &ts_simhit : ts_simhits) {
56 if (raw_id == ts_simhit.getID()) {
57 total_sim_energy_dep += ts_simhit.getEdep();
58 } else if (raw_id < ts_simhit.getID()) {
59 // later sim hits - all done
60 break;
61 }
62 }
63
64 ldmx_log(info) << " There are " << ts_simhits.size()
65 << " sim hits in this event, adding up to a total energy of "
66 << total_sim_energy_dep;
67
68 histograms_.fill("sim_edep:rec_amplitude", total_sim_energy_dep,
69 ts_digi.getAmplitude());
70 histograms_.fill("sim_edep:rec_energy", total_sim_energy_dep,
71 ts_digi.getEnergy());
72 } // end of loop on ts digis
73
74 return;
75}
76
77} // namespace dqm
78
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Generate histograms to check digi pipeline performance.
std::string ts_simhit_pass_
Pass Name for SimHits.
virtual void analyze(const framework::Event &event)
Fills histograms.
virtual void configure(framework::config::Parameters &ps)
Input python configuration parameters.
std::string ts_simhit_coll_
Collection Name for SimHits.
std::string ts_digi_coll_
Collection Name for digis.
std::string ts_digi_pass_
Pass Name for digis.
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 simulated calorimeter hit information.