LDMX Software
TrigScintHitDQM.cxx
1#include "DQM/TrigScintHitDQM.h"
2
3namespace dqm {
4
5TrigScintHitDQM::TrigScintHitDQM(const std::string &name,
6 framework::Process &process)
7 : framework::Analyzer(name, process) {}
8
10 ldmx_log(debug) << "Process starts!";
11
13
14 histograms_.create("id", "Channel ID of sim hit", 100, 0, 100);
15 histograms_.create("total_pe", "Total pe deposition in the pad/event", 500, 0,
16 2000);
17 histograms_.create("n_hits", "TrigScint hit multiplicity in the pad/event",
18 100, 0, 100);
19 histograms_.create("x", "Hit x position", 1000, -100, 100);
20 histograms_.create("y", "Hit y position", 1000, -100, 100);
21 histograms_.create("z", "Hit z position", 1000, -900, 100);
22
23 histograms_.create("pe", "Pe deposition in a TrigScint bar", 250, 0, 1000);
24 histograms_.create("hit_time", "TrigScint hit time (ns)", 600, -150, 150);
25
26 histograms_.create("id_noise", "Channel ID of noise hit", 101, -1, 100);
27 histograms_.create("pe_noise", "Pe deposition in a TrigScint bar noise hit",
28 100, 0, 100);
29 histograms_.create("n_hits_noise",
30 "TrigScint noise hit multiplicity in the pad/event", 100,
31 0, 100);
32
33 histograms_.create("max_pe:time", "Max Photoelectrons in a TrigScint bar",
34 1500, 0, 1500, "TrigScint max PE hit time (ns)", 1500, 0,
35 1500);
36
37 histograms_.create("min_time_hit_above_thresh:pe",
38 "Photoelectrons in a TrigScint bar", 1500, 0, 1500,
39 "Earliest time of TrigScint hit above threshold (ns)",
40 1600, -100, 1500);
41
42 // TODO: implement getting a list of the constructed histograms, to iterate
43 // through and set overflow boolean.
44}
45
47 hit_collection_name_ = ps.get<std::string>("hit_collection");
48 pad_name_ = ps.get<std::string>("pad").c_str();
49
50 pass_name_ = ps.get<std::string>("pass_name");
51
52 ldmx_log(debug) << "In TrigScintHitDQM::configure, got parameters "
53 << hit_collection_name_ << " and " << pad_name_;
54}
55
57 // Get the collection of TrigScintHit digitized hits if the exists
58 const std::vector<ldmx::TrigScintHit> trig_scint_hits =
59 event.getCollection<ldmx::TrigScintHit>(hit_collection_name_, pass_name_);
60
61 // Get the total hit count
62 int hit_count = trig_scint_hits.size();
63 histograms_.fill("n_hits", hit_count);
64
65 double total_pe{0};
66 int noise_hit_count = 0;
67
68 ldmx_log(debug) << "Looping over hits in " << hit_collection_name_;
69
70 // Loop through all TrigScint hits in the event
71
72 for (const ldmx::TrigScintHit &hit : trig_scint_hits) {
73 histograms_.fill("pe", hit.getPE());
74 histograms_.fill("hit_time", hit.getTime());
75 histograms_.fill("id", hit.getBarID());
76
77 total_pe += hit.getPE();
78 if (hit.isNoise() > 0) {
79 noise_hit_count++;
80 histograms_.fill("pe_noise", hit.getPE());
81 histograms_.fill("id_noise", hit.getBarID());
82 } else { // x, y, z not set for noise hits
83 histograms_.fill("x", hit.getXPos());
84 histograms_.fill("y", hit.getYPos());
85 histograms_.fill("z", hit.getZPos());
86 }
87 }
88
89 histograms_.fill("total_pe", total_pe);
90 histograms_.fill("n_hits_noise", noise_hit_count);
91}
92
93} // namespace dqm
94
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
TrigScintHitDQM(const std::string &name, framework::Process &process)
Constructor.
void onProcessStart()
Method executed before processing of events begins.
void analyze(const framework::Event &event)
Process the event and make histograms ro summaries.
std::string hit_collection_name_
Name of trigger pad hit collection.
void configure(framework::config::Parameters &pSet)
Configure the processor using the given user specified parameters.
HistogramPool histograms_
helper object for making and filling histograms
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...
Implements an event buffer system for storing event data.
Definition Event.h:42
void create(const config::Parameters &p)
Create a histogram from the input configuration parameters.
void fill(const std::string &name, const T &val)
Fill a 1D histogram.
Class which represents the process under execution.
Definition Process.h:37
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
All classes in the ldmx-sw project use this namespace.