LDMX Software
TrigScintHitDQM.cxx
1#include "DQM/TrigScintHitDQM.h"
2
3#include "TrigScint/Event/TrigScintHit.h"
4
5namespace dqm {
6
7TrigScintHitDQM::TrigScintHitDQM(const std::string& name,
8 framework::Process& process)
9 : framework::Analyzer(name, process) {}
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 hit_collection_name_ = ps.get<std::string>("hit_collection");
50 pad_name_ = ps.get<std::string>("pad").c_str();
51
52 pass_name_ = ps.get<std::string>("pass_name");
53
54 ldmx_log(debug) << "In TrigScintHitDQM::configure, got parameters "
55 << hit_collection_name_ << " and " << pad_name_;
56}
57
59 // Get the collection of TrigScintHit digitized hits if the exists
60 const std::vector<ldmx::TrigScintHit> trig_scint_hits =
61 event.getCollection<ldmx::TrigScintHit>(hit_collection_name_, pass_name_);
62
63 // Get the total hit count
64 int hit_count = trig_scint_hits.size();
65 histograms_.fill("n_hits", hit_count);
66
67 double total_pe{0};
68 int noise_hit_count = 0;
69
70 ldmx_log(debug) << "Looping over hits in " << hit_collection_name_;
71
72 // Loop through all TrigScint hits in the event
73
74 for (const ldmx::TrigScintHit& hit : trig_scint_hits) {
75 histograms_.fill("pe", hit.getPE());
76 histograms_.fill("hit_time", hit.getTime());
77 histograms_.fill("id", hit.getBarID());
78
79 total_pe += hit.getPE();
80 if (hit.isNoise() > 0) {
81 noise_hit_count++;
82 histograms_.fill("pe_noise", hit.getPE());
83 histograms_.fill("id_noise", hit.getBarID());
84 } else { // x, y, z not set for noise hits
85 histograms_.fill("x", hit.getXPos());
86 histograms_.fill("y", hit.getYPos());
87 histograms_.fill("z", hit.getZPos());
88 }
89 }
90
91 histograms_.fill("total_pe", total_pe);
92 histograms_.fill("n_hits_noise", noise_hit_count);
93}
94
95} // namespace dqm
96
#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:40
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:34
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
All classes in the ldmx-sw project use this namespace.