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
12 ldmx_log(debug) << "Process starts!";
13
15
16 histograms_.create("id", "Channel ID of sim hit", 100, 0, 100);
17 histograms_.create("total_pe", "Total pe deposition in the pad/event", 500, 0,
18 2000);
19 histograms_.create("n_hits", "TrigScint hit multiplicity in the pad/event",
20 100, 0, 100);
21 histograms_.create("x", "Hit x position", 1000, -100, 100);
22 histograms_.create("y", "Hit y position", 1000, -100, 100);
23 histograms_.create("z", "Hit z position", 1000, -900, 100);
24
25 histograms_.create("pe", "Pe deposition in a TrigScint bar", 250, 0, 1000);
26 histograms_.create("hit_time", "TrigScint hit time (ns)", 600, -150, 150);
27
28 histograms_.create("id_noise", "Channel ID of noise hit", 101, -1, 100);
29 histograms_.create("pe_noise", "Pe deposition in a TrigScint bar noise hit",
30 100, 0, 100);
31 histograms_.create("n_hits_noise",
32 "TrigScint noise hit multiplicity in the pad/event", 100,
33 0, 100);
34
35 histograms_.create("max_pe:time", "Max Photoelectrons in a TrigScint bar",
36 1500, 0, 1500, "TrigScint max PE hit time (ns)", 1500, 0,
37 1500);
38
39 histograms_.create("min_time_hit_above_thresh:pe",
40 "Photoelectrons in a TrigScint bar", 1500, 0, 1500,
41 "Earliest time of TrigScint hit above threshold (ns)",
42 1600, -100, 1500);
43
44 // TODO: implement getting a list of the constructed histograms, to iterate
45 // through and set overflow boolean.
46}
47
49 hitCollectionName_ = ps.getParameter<std::string>("hit_collection");
50 padName_ = ps.getParameter<std::string>("pad").c_str();
51
52 ldmx_log(debug) << "In TrigScintHitDQM::configure, got parameters "
53 << hitCollectionName_ << " and " << padName_;
54}
55
57 // Get the collection of TrigScintHit digitized hits if the exists
58 const std::vector<ldmx::TrigScintHit> TrigScintHits =
59 event.getCollection<ldmx::TrigScintHit>(hitCollectionName_);
60
61 // Get the total hit count
62 int hitCount = TrigScintHits.size();
63 histograms_.fill("n_hits", hitCount);
64
65 double totalPE{0};
66 int noiseHitCount = 0;
67
68 ldmx_log(debug) << "Looping over hits in " << hitCollectionName_;
69
70 // Loop through all TrigScint hits in the event
71
72 for (const ldmx::TrigScintHit &hit : TrigScintHits) {
73 histograms_.fill("pe", hit.getPE());
74 histograms_.fill("hit_time", hit.getTime());
75 histograms_.fill("id", hit.getBarID());
76
77 totalPE += hit.getPE();
78 if (hit.isNoise() > 0) {
79 noiseHitCount++;
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", totalPE);
90 histograms_.fill("n_hits_noise", noiseHitCount);
91}
92
93} // namespace dqm
94
95DECLARE_ANALYZER_NS(dqm, TrigScintHitDQM)
#define DECLARE_ANALYZER_NS(NS, 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.
void configure(framework::config::Parameters &pSet)
Configure the processor using the given user specified parameters.
~TrigScintHitDQM()
Destructor.
std::string hitCollectionName_
Name of trigger pad hit collection.
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...
HistogramHelper histograms_
Interface class for making and filling histograms.
Implements an event buffer system for storing event data.
Definition Event.h:41
void fill(const std::string &name, const double &val)
Fill a 1D histogram.
Definition Histograms.h:166
void create(const std::string &name, const std::string &xLabel, const double &bins, const double &xmin, const double &xmax)
Create a ROOT 1D histogram of type TH1F and pool it for later use.
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
All classes in the ldmx-sw project use this namespace.
Definition PerfDict.cxx:45