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 trig_scint_passname_ = ps.get<std::string>("trig_scint_passname");
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_,
60 trig_scint_passname_);
61
62 // Get the total hit count
63 int hit_count = trig_scint_hits.size();
64 histograms_.fill("n_hits", hit_count);
65
66 double total_pe{0};
67 int noise_hit_count = 0;
68
69 ldmx_log(debug) << "Looping over hits in " << hit_collection_name_;
70
71 // Loop through all TrigScint hits in the event
72
73 for (const ldmx::TrigScintHit &hit : trig_scint_hits) {
74 histograms_.fill("pe", hit.getPE());
75 histograms_.fill("hit_time", hit.getTime());
76 histograms_.fill("id", hit.getBarID());
77
78 total_pe += hit.getPE();
79 if (hit.isNoise() > 0) {
80 noise_hit_count++;
81 histograms_.fill("pe_noise", hit.getPE());
82 histograms_.fill("id_noise", hit.getBarID());
83 } else { // x, y, z not set for noise hits
84 histograms_.fill("x", hit.getXPos());
85 histograms_.fill("y", hit.getYPos());
86 histograms_.fill("z", hit.getZPos());
87 }
88 }
89
90 histograms_.fill("total_pe", total_pe);
91 histograms_.fill("n_hits_noise", noise_hit_count);
92}
93
94} // namespace dqm
95
#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:36
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.