LDMX Software
TrigScintDQM.cxx
1
2#include "DQM/TrigScintDQM.h"
3
5
6namespace dqm {
7
8TrigScintDQM::TrigScintDQM(const std::string &name, 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_energy",
18 "Total energy deposition in the pad/event [MeV]", 1000, 0,
19 3000);
20 histograms_.create("n_hits", "Hit multiplicity in the pad/event [MeV]", 100,
21 0, 100);
22 histograms_.create("x", "Hit x position [mm]", 1000, -100, 100);
23 histograms_.create("y", "Hit y position [mm]", 1000, -100, 100);
24 histograms_.create("z", "Hit z position", 1000, -900, 100);
25
26 histograms_.create("energy", "Energy deposition in a bar", 250, 0, 1500);
27 histograms_.create("hit_time", "Hit time [ns]", 1600, -100, 1500);
28
29 histograms_.create("max_pe:time", "Max Photoelectrons in a bar", 1500, 0,
30 1500, "Max PE hit time [ns]", 1500, 0, 1500);
31
32 histograms_.create("min_time_hit_above_thresh:pe", "Photoelectrons in a bar",
33 1500, 0, 1500, "Earliest time of hit above threshold [ns]",
34 1600, -100, 1500);
35}
36
38 hit_collection_name_ = ps.get<std::string>("hit_collection");
39 pad_name_ = ps.get<std::string>("pad");
40 hit_passname_ = ps.get<std::string>("hit_passname");
41
42 ldmx_log(debug) << " Collection name = " << hit_collection_name_
43 << " pad name = " << pad_name_;
44}
45
47 const std::vector<ldmx::SimCalorimeterHit> trig_scint_hits =
49 hit_passname_);
50
51 // Get the total hit count
52 int hit_count = trig_scint_hits.size();
53 histograms_.fill("n_hits", hit_count);
54
55 double total_energy{0};
56 for (const ldmx::SimCalorimeterHit &hit : trig_scint_hits) {
57 ldmx::TrigScintID det_id(hit.getID());
58
59 int bar = det_id.bar();
60
61 histograms_.fill("energy", hit.getEdep());
62 histograms_.fill("hit_time", hit.getTime());
63 histograms_.fill("id", bar);
64
65 std::vector<float> posvec = hit.getPosition();
66 histograms_.fill("x", posvec.at(0));
67 histograms_.fill("y", posvec.at(1));
68 histograms_.fill("z", posvec.at(2));
69
70 total_energy += hit.getEdep();
71 }
72
73 histograms_.fill("total_energy", total_energy);
74}
75
76} // namespace dqm
77
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
Class which stores simulated calorimeter hit information.
Analyzer used for TrigScint DQM.
void analyze(const framework::Event &event)
Process the event and make histograms ro summaries.
TrigScintDQM(const std::string &name, framework::Process &process)
Constructor.
void configure(framework::config::Parameters &pSet)
Configure the processor using the given user specified parameters.
void onProcessStart()
Method executed before processing of events begins.
std::string pad_name_
Name of Pad.
std::string hit_collection_name_
Name of trigger pad hit collection.
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
Stores simulated calorimeter hit information.
Class that defines the detector ID of the trigger scintillator.
Definition TrigScintID.h:14
int bar() const
Get the value of the bar field from the ID.
Definition TrigScintID.h:64
All classes in the ldmx-sw project use this namespace.