LDMX Software
TrigScintClusterDQM.cxx
1#include "DQM/TrigScintClusterDQM.h"
2
3namespace dqm {
4
6 framework::Process &process)
7 : framework::Analyzer(name, process) {}
8
11
12 histograms_.create("centroid", "Cluster channel centroid", 500, 0, 100);
13 histograms_.create("total_pe", "Total cluster PEs in the pad/event", 500, 0,
14 2000);
15 histograms_.create("n_clusters", "Clusters in the pad/event", 25, 0, 25);
16 histograms_.create("n_hits", "n_{hits} forming the clusters", 4, 0, 4);
17 histograms_.create("seed", "Cluster seed hit channel ID", 100, 0, 100);
18 histograms_.create("beamEfrac", "Cluster edep fraction from beam electron",
19 101, 0., 1.01);
20 histograms_.create("x", "Cluster x position [mm]", 1000, -100, 100);
21 histograms_.create("y", "Cluster y position [mm]", 1000, -100, 100);
22 histograms_.create("z", "Cluster z position [mm]", 1000, -900, 100);
23
24 histograms_.create("pe", "PE in a cluster", 250, 0, 1000);
25 histograms_.create("energy", "Energy dep in a cluster [MeV]", 500, 0, 1500);
26 histograms_.create("cluster_time", "Cluster time [ns]", 600, -150, 150);
27
28 // TODO: implement getting a list of the constructed histograms, to iterate
29 // through and set overflow boolean.
30}
31
33 cluster_collection_name_ = ps.get<std::string>("cluster_collection");
34 pad_name_ = ps.get<std::string>("pad").c_str();
35 pass_name_ = ps.get<std::string>("passName").c_str();
36
37 ldmx_log(debug) << "Collection name = " << cluster_collection_name_
38 << ", pad = " << pad_name_ << ", pass = " << pass_name_;
39}
40
42 if (not event.exists(cluster_collection_name_, pass_name_)) return;
43 // Get the collection of TrigScintCluster digitized clusters if the exists
44 const std::vector<ldmx::TrigScintCluster> trig_scint_clusters =
46 pass_name_);
47
48 double total_pe{0};
49 // Loop through all TrigScint clusters in the event
50 for (const ldmx::TrigScintCluster &cluster : trig_scint_clusters) {
51 histograms_.fill("pe", cluster.getPE());
52 histograms_.fill("energy", cluster.getEnergy());
53 histograms_.fill("cluster_time", cluster.getTime());
54 histograms_.fill("centroid", cluster.getCentroid());
55 histograms_.fill("n_hits", cluster.getNHits());
56 histograms_.fill("seed", cluster.getSeed());
57 histograms_.fill("beamEfrac", cluster.getBeamEfrac());
58
59 histograms_.fill("x", cluster.getCentroidX());
60 histograms_.fill("y", cluster.getCentroidY());
61 histograms_.fill("z", cluster.getCentroidZ());
62
63 total_pe += cluster.getPE();
64 }
65
66 histograms_.fill("n_clusters", trig_scint_clusters.size());
67 histograms_.fill("total_pe", total_pe);
68}
69
70} // namespace dqm
71
#define DECLARE_ANALYZER(CLASS)
Macro which allows the framework to construct an analyzer given its name during configuration.
void configure(framework::config::Parameters &pSet)
Configure the processor using the given user specified parameters.
std::string cluster_collection_name_
Name of trigger pad cluster collection.
void analyze(const framework::Event &event)
Process the event and make histograms ro summaries.
TrigScintClusterDQM(const std::string &name, framework::Process &process)
Constructor.
void onProcessStart()
Method executed before processing of events begins.
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
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.
Definition Event.cxx:92
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 cluster information from the trigger scintillator pads.
All classes in the ldmx-sw project use this namespace.