LDMX Software
TrigScintClusterDQM.cxx
1#include "DQM/TrigScintClusterDQM.h"
2
3#include "TrigScint/Event/TrigScintCluster.h"
4
5namespace dqm {
6
8 framework::Process& process)
9 : framework::Analyzer(name, process) {}
10
13
14 histograms_.create("centroid", "Cluster channel centroid", 500, 0, 100);
15 histograms_.create("total_pe", "Total cluster PEs in the pad/event", 500, 0,
16 2000);
17 histograms_.create("n_clusters", "Clusters in the pad/event", 25, 0, 25);
18 histograms_.create("n_hits", "n_{hits} forming the clusters", 4, 0, 4);
19 histograms_.create("seed", "Cluster seed hit channel ID", 100, 0, 100);
20 histograms_.create("beamEfrac", "Cluster edep fraction from beam electron",
21 101, 0., 1.01);
22 histograms_.create("x", "Cluster x position [mm]", 1000, -100, 100);
23 histograms_.create("y", "Cluster y position [mm]", 1000, -100, 100);
24 histograms_.create("z", "Cluster z position [mm]", 1000, -900, 100);
25
26 histograms_.create("pe", "PE in a cluster", 250, 0, 1000);
27 histograms_.create("energy", "Energy dep in a cluster [MeV]", 500, 0, 1500);
28 histograms_.create("cluster_time", "Cluster time [ns]", 600, -150, 150);
29
30 // TODO: implement getting a list of the constructed histograms, to iterate
31 // through and set overflow boolean.
32}
33
35 cluster_collection_name_ = ps.get<std::string>("cluster_collection");
36 pad_name_ = ps.get<std::string>("pad").c_str();
37 pass_name_ = ps.get<std::string>("pass_name").c_str();
38
39 ldmx_log(debug) << "Collection name = " << cluster_collection_name_
40 << ", pad = " << pad_name_ << ", pass = " << pass_name_;
41}
42
44 if (not event.exists(cluster_collection_name_, pass_name_)) return;
45 // Get the collection of TrigScintCluster digitized clusters if the exists
46 const std::vector<ldmx::TrigScintCluster> trig_scint_clusters =
48 pass_name_);
49
50 double total_pe{0};
51 // Loop through all TrigScint clusters in the event
52 for (const ldmx::TrigScintCluster& cluster : trig_scint_clusters) {
53 histograms_.fill("pe", cluster.getPE());
54 histograms_.fill("energy", cluster.getEnergy());
55 histograms_.fill("cluster_time", cluster.getTime());
56 histograms_.fill("centroid", cluster.getCentroid());
57 histograms_.fill("n_hits", cluster.getNHits());
58 histograms_.fill("seed", cluster.getSeed());
59 histograms_.fill("beamEfrac", cluster.getBeamEfrac());
60
61 histograms_.fill("x", cluster.getCentroidX());
62 histograms_.fill("y", cluster.getCentroidY());
63 histograms_.fill("z", cluster.getCentroidZ());
64
65 total_pe += cluster.getPE();
66 }
67
68 histograms_.fill("n_clusters", trig_scint_clusters.size());
69 histograms_.fill("total_pe", total_pe);
70}
71
72} // namespace dqm
73
#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:40
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:107
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 cluster information from the trigger scintillator pads.
All classes in the ldmx-sw project use this namespace.