LDMX Software
tracking::dqm::DigiDQM Class Reference

DQM analyzer for silicon-strip digitization and clustering. More...

#include <DigiDQM.h>

Public Member Functions

 DigiDQM (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &parameters) override
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
void analyze (const framework::Event &event) override
 Process the event and make histograms or summaries.
 
- Public Member Functions inherited from framework::Analyzer
 Analyzer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for an Analyzer is calling analyze.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header) final
 Don't allow Analyzers to add parameters to the run header.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

std::string sim_coll_name_ {"TaggerSimHits"}
 
std::string sim_pass_name_ {""}
 
std::string digi_coll_name_ {""}
 
std::string digi_pass_name_ {""}
 
std::string fitted_coll_name_ {"TaggerFittedSiStripHits"}
 
std::string fitted_pass_name_ {""}
 
std::string cluster_coll_name_ {"TaggerClusterMeasurements"}
 
std::string cluster_pass_name_ {""}
 
int n_sensors_ {14}
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

DQM analyzer for silicon-strip digitization and clustering.

Per-sensor histograms are produced for:

Sim hits (from SimTrackerHit collection) sim_n_sN — number of sim hits per event sim_edep_sN — energy deposition [MeV]

Fitted strips (from FittedSiStripHit collection) strip_n_sN — number of fitted strips per event strip_amp_sN — fitted amplitude [ADC counts] strip_t0_sN — fitted hit time [ns] strip_chi2ndf_sN — chi2/ndf of the pulse fit

Clusters (from StripClusterProcessor Measurement collection) cluster_n_sN — number of clusters per event cluster_u_sN — cluster centroid local U [mm] cluster_amp_sN — total cluster amplitude [ADC counts] cluster_nstrips_sN — number of strips per cluster cluster_time_sN — cluster hit time [ns] sim_cluster_du_sN — truth U minus cluster U [mm] (requires digi_coll_name)

Configuration parameters

sim_coll_name SimTrackerHit collection (default "TaggerSimHits") sim_pass_name pass name (default "") digi_coll_name digi Measurement coll. for truth_u lookup (default "" = disabled) digi_pass_name pass name (default "") fitted_coll_name FittedSiStripHit coll. (default "TaggerFittedSiStripHits") fitted_pass_name pass name (default "") cluster_coll_name cluster Measurement coll. (default "TaggerClusterMeasurements") cluster_pass_name pass name (default "") n_sensors number of sensors (default 14)

Definition at line 46 of file DigiDQM.h.

Constructor & Destructor Documentation

◆ DigiDQM()

tracking::dqm::DigiDQM::DigiDQM ( const std::string & name,
framework::Process & process )
inline

Definition at line 48 of file DigiDQM.h.

Base class for a module which does not produce a data product.
virtual void process(Event &event) final
Processing an event for an Analyzer is calling analyze.

Member Function Documentation

◆ analyze()

void tracking::dqm::DigiDQM::analyze ( const framework::Event & event)
overridevirtual

Process the event and make histograms or summaries.

Parameters
eventThe Event to analyze

Implements framework::Analyzer.

Definition at line 35 of file DigiDQM.cxx.

35 {
36 // -------------------------------------------------------------------------
37 // Sim hits — one entry per hit
38 // -------------------------------------------------------------------------
39 if (event.exists(sim_coll_name_, sim_pass_name_)) {
40 const auto sim_hits = event.getCollection<ldmx::SimTrackerHit>(
41 sim_coll_name_, sim_pass_name_);
42
43 // Count per sensor for the multiplicity histograms
44 std::map<int, int> sim_count; // layer → count
45
46 for (const auto& hit : sim_hits) {
47 // getSensorID maps the G4 layer/module IDs to the same compact index
48 // that DigitizationProcessor stores in Measurement::layer_id_.
49 int layer = sensorIndexToLayer(tracking::sim::utils::getSensorID(hit));
50 if (layer < 0 || layer >= n_sensors_) continue;
51
52 const std::string s = std::to_string(layer);
53 histograms_.fill("sim_edep_s" + s, hit.getEdep());
54 sim_count[layer]++;
55 }
56
57 for (int i = 0; i < n_sensors_; ++i) {
58 histograms_.fill("sim_n_s" + std::to_string(i),
59 static_cast<double>(sim_count[i]));
60 }
61 }
62
63 // -------------------------------------------------------------------------
64 // Fitted strips (from StripFitProcessor)
65 // -------------------------------------------------------------------------
66 if (event.exists(fitted_coll_name_, fitted_pass_name_)) {
67 const auto fitted_hits = event.getCollection<ldmx::FittedSiStripHit>(
68 fitted_coll_name_, fitted_pass_name_);
69
70 std::map<int, int> strip_count;
71
72 for (const auto& hit : fitted_hits) {
73 // FittedSiStripHit::getLayerID() stores the same raw sensor index
74 // as Measurement::layer_id_ (set by getSensorID in
75 // DigitizationProcessor).
76 int layer = sensorIndexToLayer(hit.getLayerID());
77 if (layer < 0 || layer >= n_sensors_) continue;
78
79 const std::string s = std::to_string(layer);
80 histograms_.fill("strip_amp_s" + s, hit.getAmplitude());
81 histograms_.fill("strip_t0_s" + s, hit.getT0());
82 if (hit.getNDF() > 0)
83 histograms_.fill("strip_chi2ndf_s" + s, hit.getChi2() / hit.getNDF());
84 strip_count[layer]++;
85 }
86
87 for (int i = 0; i < n_sensors_; ++i) {
88 histograms_.fill("strip_n_s" + std::to_string(i),
89 static_cast<double>(strip_count[i]));
90 }
91 }
92
93 // -------------------------------------------------------------------------
94 // Build truth_u lookup from digi Measurements (optional).
95 // layer → track_id → truth_u
96 // -------------------------------------------------------------------------
97 std::map<int, std::map<int, float>> truth_u_by_layer;
98 if (!digi_coll_name_.empty() &&
99 event.exists(digi_coll_name_, digi_pass_name_)) {
100 const auto digi_meas = event.getCollection<ldmx::Measurement>(
101 digi_coll_name_, digi_pass_name_);
102 for (const auto& m : digi_meas) {
103 int layer = m.getLayer();
104 if (layer < 0 || layer >= n_sensors_) continue;
105 if (std::isnan(m.getTruthU())) continue;
106 int tid =
107 m.getTrackIds().empty() ? -1 : static_cast<int>(m.getTrackIds()[0]);
108 truth_u_by_layer[layer][tid] = m.getTruthU();
109 }
110 }
111
112 // -------------------------------------------------------------------------
113 // Cluster measurements (from StripClusterProcessor)
114 // -------------------------------------------------------------------------
115 if (event.exists(cluster_coll_name_, cluster_pass_name_)) {
116 const auto cluster_meas = event.getCollection<ldmx::Measurement>(
117 cluster_coll_name_, cluster_pass_name_);
118
119 std::map<int, int> cluster_count;
120
121 for (const auto& meas : cluster_meas) {
122 int layer = meas.getLayer();
123 if (layer < 0 || layer >= n_sensors_) continue;
124
125 const std::string s = std::to_string(layer);
126 const float u = meas.getLocalPosition()[0];
127 histograms_.fill("cluster_u_s" + s, u);
128 histograms_.fill("cluster_amp_s" + s, meas.getClusterAmplitude());
129 histograms_.fill("cluster_time_s" + s, meas.getTime());
130 if (meas.getNStrips() > 0)
131 histograms_.fill("cluster_nstrips_s" + s, meas.getNStrips());
132 cluster_count[layer]++;
133
134 // sim_cluster_du: truth U (from digi Measurement) minus cluster U
135 int tid = meas.getTrackIds().empty()
136 ? -1
137 : static_cast<int>(meas.getTrackIds()[0]);
138 auto layer_it = truth_u_by_layer.find(layer);
139 if (layer_it != truth_u_by_layer.end()) {
140 auto tid_it = layer_it->second.find(tid);
141 if (tid_it != layer_it->second.end())
142 histograms_.fill("sim_cluster_du_s" + s, tid_it->second - u);
143 }
144 }
145
146 for (int i = 0; i < n_sensors_; ++i) {
147 histograms_.fill("cluster_n_s" + std::to_string(i),
148 static_cast<double>(cluster_count[i]));
149 }
150 }
151}
HistogramPool histograms_
helper object for making and filling histograms
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:105
void fill(const std::string &name, const T &val)
Fill a 1D histogram.
Result of fitting a pulse shape to the ADC samples of a single readout strip.
Represents a simulated tracker hit in the simulation.

References framework::Event::exists(), framework::HistogramPool::fill(), and framework::EventProcessor::histograms_.

◆ configure()

void tracking::dqm::DigiDQM::configure ( framework::config::Parameters & parameters)
overridevirtual

Callback for the EventProcessor to configure itself from the given set of parameters.

The parameters a processor has access to are the member variables of the python class in the sequence that has class_name equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 20 of file DigiDQM.cxx.

20 {
21 sim_coll_name_ =
22 parameters.get<std::string>("sim_coll_name", "TaggerSimHits");
23 sim_pass_name_ = parameters.get<std::string>("sim_pass_name", "");
24 digi_coll_name_ = parameters.get<std::string>("digi_coll_name", "");
25 digi_pass_name_ = parameters.get<std::string>("digi_pass_name", "");
26 fitted_coll_name_ = parameters.get<std::string>("fitted_coll_name",
27 "TaggerFittedSiStripHits");
28 fitted_pass_name_ = parameters.get<std::string>("fitted_pass_name", "");
29 cluster_coll_name_ = parameters.get<std::string>("cluster_coll_name",
30 "TaggerClusterMeasurements");
31 cluster_pass_name_ = parameters.get<std::string>("cluster_pass_name", "");
32 n_sensors_ = parameters.get<int>("n_sensors", 14);
33}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

References framework::config::Parameters::get().

Member Data Documentation

◆ cluster_coll_name_

std::string tracking::dqm::DigiDQM::cluster_coll_name_ {"TaggerClusterMeasurements"}
private

Definition at line 63 of file DigiDQM.h.

63{"TaggerClusterMeasurements"};

◆ cluster_pass_name_

std::string tracking::dqm::DigiDQM::cluster_pass_name_ {""}
private

Definition at line 64 of file DigiDQM.h.

64{""};

◆ digi_coll_name_

std::string tracking::dqm::DigiDQM::digi_coll_name_ {""}
private

Definition at line 59 of file DigiDQM.h.

59{""};

◆ digi_pass_name_

std::string tracking::dqm::DigiDQM::digi_pass_name_ {""}
private

Definition at line 60 of file DigiDQM.h.

60{""};

◆ fitted_coll_name_

std::string tracking::dqm::DigiDQM::fitted_coll_name_ {"TaggerFittedSiStripHits"}
private

Definition at line 61 of file DigiDQM.h.

61{"TaggerFittedSiStripHits"};

◆ fitted_pass_name_

std::string tracking::dqm::DigiDQM::fitted_pass_name_ {""}
private

Definition at line 62 of file DigiDQM.h.

62{""};

◆ n_sensors_

int tracking::dqm::DigiDQM::n_sensors_ {14}
private

Definition at line 65 of file DigiDQM.h.

65{14};

◆ sim_coll_name_

std::string tracking::dqm::DigiDQM::sim_coll_name_ {"TaggerSimHits"}
private

Definition at line 57 of file DigiDQM.h.

57{"TaggerSimHits"};

◆ sim_pass_name_

std::string tracking::dqm::DigiDQM::sim_pass_name_ {""}
private

Definition at line 58 of file DigiDQM.h.

58{""};

The documentation for this class was generated from the following files: