LDMX Software
TrigScintDQM.cxx
1
2#include "DQM/TrigScintDQM.h"
3
4#include "DetDescr/TrigScintID.h"
6
7namespace dqm {
8
9TrigScintDQM::TrigScintDQM(const std::string& name, framework::Process& process)
10 : framework::Analyzer(name, process) {}
11
13 ldmx_log(debug) << "Process starts!";
14
16
17 histograms_.create("id", "Channel ID of sim hit", 100, 0, 100);
18 histograms_.create("total_energy",
19 "Total energy deposition in the pad/event [MeV]", 1000, 0,
20 3000);
21 histograms_.create("n_hits", "Hit multiplicity in the pad/event [MeV]", 100,
22 0, 100);
23 histograms_.create("x", "Hit x position [mm]", 1000, -100, 100);
24 histograms_.create("y", "Hit y position [mm]", 1000, -100, 100);
25 histograms_.create("z", "Hit z position", 1000, -900, 100);
26
27 histograms_.create("energy", "Energy deposition in a bar", 250, 0, 1500);
28 histograms_.create("hit_time", "Hit time [ns]", 1600, -100, 1500);
29
30 histograms_.create("max_pe:time", "Max Photoelectrons in a bar", 1500, 0,
31 1500, "Max PE hit time [ns]", 1500, 0, 1500);
32
33 histograms_.create("min_time_hit_above_thresh:pe", "Photoelectrons in a bar",
34 1500, 0, 1500, "Earliest time of hit above threshold [ns]",
35 1600, -100, 1500);
36}
37
39 hit_collection_name_ = ps.get<std::string>("hit_collection");
40 pad_name_ = ps.get<std::string>("pad");
41 hit_passname_ = ps.get<std::string>("hit_passname");
42
43 ldmx_log(debug) << " Collection name = " << hit_collection_name_
44 << " pad name = " << pad_name_;
45}
46
48 const std::vector<ldmx::SimCalorimeterHit> trig_scint_hits =
50 hit_passname_);
51
52 // Get the total hit count
53 int hit_count = trig_scint_hits.size();
54 histograms_.fill("n_hits", hit_count);
55
56 double total_energy{0};
57 for (const ldmx::SimCalorimeterHit& hit : trig_scint_hits) {
58 ldmx::TrigScintID det_id(hit.getID());
59
60 int bar = det_id.bar();
61
62 histograms_.fill("energy", hit.getEdep());
63 histograms_.fill("hit_time", hit.getTime());
64 histograms_.fill("id", bar);
65
66 std::vector<float> posvec = hit.getPosition();
67 histograms_.fill("x", posvec.at(0));
68 histograms_.fill("y", posvec.at(1));
69 histograms_.fill("z", posvec.at(2));
70
71 total_energy += hit.getEdep();
72 }
73
74 histograms_.fill("total_energy", total_energy);
75}
76
77} // namespace dqm
78
#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: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
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.