LDMX Software
TrigScintClusterDQM.cxx
1#include "DQM/TrigScintClusterDQM.h"
2
3namespace dqm {
4
6 framework::Process &process)
7 : framework::Analyzer(name, process) {}
8
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", 1000, -100, 100);
23 histograms_.create("y", "Cluster y position", 1000, -100, 100);
24 histograms_.create("z", "Cluster z position", 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 clusterCollectionName_ = ps.getParameter<std::string>("cluster_collection");
36 padName_ = ps.getParameter<std::string>("pad").c_str();
37 passName_ = ps.getParameter<std::string>("passName").c_str();
38
39 ldmx_log(info) << "In TrigScintClusterDQM::configure, got parameters "
40 << clusterCollectionName_ << ", pad = " << padName_
41 << ", pass = " << passName_;
42}
43
45 if (not event.exists(clusterCollectionName_, passName_)) return;
46 // Get the collection of TrigScintCluster digitized clusters if the exists
47 const std::vector<ldmx::TrigScintCluster> TrigScintClusters =
49 passName_);
50
51 double totalPE{0};
52 // Loop through all TrigScint clusters in the event
53 for (const ldmx::TrigScintCluster &cluster : TrigScintClusters) {
54 histograms_.fill("pe", cluster.getPE());
55 histograms_.fill("energy", cluster.getEnergy());
56 histograms_.fill("cluster_time", cluster.getTime());
57 histograms_.fill("centroid", cluster.getCentroid());
58 histograms_.fill("n_hits", cluster.getNHits());
59 histograms_.fill("seed", cluster.getSeed());
60 histograms_.fill("beamEfrac", cluster.getBeamEfrac());
61
62 histograms_.fill("x", cluster.getCentroidX());
63 histograms_.fill("y", cluster.getCentroidY());
64 histograms_.fill("z", cluster.getCentroidZ());
65
66 totalPE += cluster.getPE();
67 }
68
69 histograms_.fill("n_clusters", TrigScintClusters.size());
70 histograms_.fill("total_pe", totalPE);
71}
72
73} // namespace dqm
74
75DECLARE_ANALYZER_NS(dqm, TrigScintClusterDQM)
#define DECLARE_ANALYZER_NS(NS, 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 clusterCollectionName_
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.
TDirectory * getHistoDirectory()
Access/create a directory in the histogram file for this event processor to create histograms and ana...
HistogramHelper histograms_
Interface class for making and filling histograms.
Implements an event buffer system for storing event data.
Definition Event.h:41
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 fill(const std::string &name, const double &val)
Fill a 1D histogram.
Definition Histograms.h:166
void create(const std::string &name, const std::string &xLabel, const double &bins, const double &xmin, const double &xmax)
Create a ROOT 1D histogram of type TH1F and pool it for later use.
Class which represents the process under execution.
Definition Process.h:36
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
Stores cluster information from the trigger scintillator pads.
All classes in the ldmx-sw project use this namespace.
Definition PerfDict.cxx:45