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
 
NtupleManager & ntuple_ {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 29 of file DigiDQM.cxx.

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

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

◆ 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 14 of file DigiDQM.cxx.

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

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: