Skip to content

Commit 9cc3b68

Browse files
committed
Add occupancy plots for LGAD vs eta in ETL DigiHits Validation
1 parent a08da3e commit 9cc3b68

File tree

1 file changed

+63
-4
lines changed

1 file changed

+63
-4
lines changed

Validation/MtdValidation/plugins/EtlDigiHitsValidation.cc

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class EtlDigiHitsValidation : public DQMEDAnalyzer {
6161
MonitorElement* meNLgadWithHits_[4];
6262
MonitorElement* meNhitsPerLGADoverQ_[4];
6363
MonitorElement* meNLgadWithHitsoverQ_[4];
64+
MonitorElement* meNhitsPerLGADoverEta_[4];
65+
MonitorElement* meNLgadWithHitsoverEta_[4];
6466

6567
MonitorElement* meHitCharge_[4];
6668
MonitorElement* meHitTime_[4];
@@ -87,12 +89,17 @@ class EtlDigiHitsValidation : public DQMEDAnalyzer {
8789

8890
std::array<std::unordered_map<uint32_t, uint32_t>, 4> ndigiPerLGAD_;
8991

90-
// Constants to define the threshold bins for Q in occupancy studies
92+
// Constants to define the bins for Q and Eta in occupancy studies
9193
static constexpr int n_bin_Q = 32;
9294
static constexpr double Q_Min = 0.;
9395
static constexpr double Q_Max = 256.;
9496

97+
static constexpr int n_bin_Eta = 3;
98+
static constexpr double eta_bins_edges_neg[n_bin_Eta + 1] = {-3.0, -2.5, -2.1, -1.5};
99+
static constexpr double eta_bins_edges_pos[n_bin_Eta + 1] = {1.5, 2.1, 2.5, 3.0};
100+
95101
std::array<std::unordered_map<uint32_t, std::array<uint32_t, n_bin_Q>>, 4> ndigiPerLGADoverQ_;
102+
std::array<std::unordered_map<uint32_t, std::array<uint32_t, n_bin_Eta>>, 4> ndigiPerLGADoverEta_;
96103
};
97104

98105
// ------------ constructor and destructor --------------
@@ -121,6 +128,7 @@ void EtlDigiHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSe
121128
for (size_t i = 0; i < 4; i++) {
122129
ndigiPerLGAD_[i].clear();
123130
ndigiPerLGADoverQ_[i].clear();
131+
ndigiPerLGADoverEta_[i].clear();
124132
}
125133

126134
size_t index(0);
@@ -204,8 +212,8 @@ void EtlDigiHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSe
204212
double bin_w_Q = (Q_Max - Q_Min) / n_bin_Q;
205213
// Initialize the Map Entry (if first hit for this LGAD)
206214
// The array must be initialized to all zeros.
207-
std::array<uint32_t, n_bin_Q> zero_counts{}; // Array of N_bin_q zeros
208-
ndigiPerLGADoverQ_[idet].emplace(detId.rawId(), zero_counts);
215+
std::array<uint32_t, n_bin_Q> zero_counts_Q{}; // Array of N_bin_q zeros
216+
ndigiPerLGADoverQ_[idet].emplace(detId.rawId(), zero_counts_Q);
209217
// Increment the Appropriate Counters
210218
auto& threshold_counters = ndigiPerLGADoverQ_[idet].at(detId.rawId());
211219
for (int i = 0; i < n_bin_Q; i++) {
@@ -216,6 +224,17 @@ void EtlDigiHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSe
216224
threshold_counters[i]++;
217225
}
218226
}
227+
// --- Occupancy study for different Eta bins
228+
std::array<uint32_t, n_bin_Eta> zero_counts_Eta{};
229+
ndigiPerLGADoverEta_[idet].emplace(detId.rawId(), zero_counts_Eta);
230+
auto& Eta_counters = ndigiPerLGADoverEta_[idet].at(detId.rawId());
231+
for (int i = 0; i < n_bin_Eta; i++) {
232+
double lower_edge = ((idet == 0) || (idet == 1)) ? eta_bins_edges_neg[i] : eta_bins_edges_pos[i];
233+
double upper_edge = ((idet == 0) || (idet == 1)) ? eta_bins_edges_neg[i + 1] : eta_bins_edges_pos[i + 1];
234+
if (global_point.eta() >= lower_edge && global_point.eta() < upper_edge) {
235+
Eta_counters[i]++;
236+
}
237+
}
219238

220239
} // dataFrame loop
221240

@@ -247,7 +266,7 @@ void EtlDigiHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSe
247266
}
248267
// Calculate the average number of hits per LGAD
249268
double average_n_hits = 0.;
250-
const size_t n_lgads_hit = ndigiPerLGADoverQ_[i].size();
269+
// const size_t n_lgads_hit = ndigiPerLGADoverQ_[i].size();
251270
// if (n_lgads_hit > 0) {
252271
// average_n_hits = total_n_hits_for_this_threshold / static_cast<double>(n_lgads_hit);
253272
// }
@@ -260,6 +279,28 @@ void EtlDigiHitsValidation::analyze(const edm::Event& iEvent, const edm::EventSe
260279
meNLgadWithHitsoverQ_[i]->Fill(Q_value, n_lgads_with_hits_for_this_threshold);
261280
}
262281
}
282+
// --- Occupancy study for different bins on Eta
283+
for (int i = 0; i < 4; i++) { // Loop over the 4 ETL regions
284+
for (int j = 0; j < n_bin_Eta; j++) {
285+
double eta_low = ((i == 0) || (i == 1)) ? eta_bins_edges_neg[j] : eta_bins_edges_pos[j];
286+
double eta_high = ((i == 0) || (i == 1)) ? eta_bins_edges_neg[j + 1] : eta_bins_edges_pos[j + 1];
287+
double eta_value = (eta_low + eta_high) / 2.; // Center of the Eta bin
288+
double total_n_hits_for_this_eta_bin = 0.;
289+
size_t n_lgads_with_hits_for_this_eta_bin = 0;
290+
for (const auto& entry : ndigiPerLGADoverEta_[i]) {
291+
total_n_hits_for_this_eta_bin += entry.second[j];
292+
if (entry.second[j] > 0) {
293+
n_lgads_with_hits_for_this_eta_bin++;
294+
}
295+
}
296+
double average_n_hits = 0.;
297+
if (n_lgads_with_hits_for_this_eta_bin > 0) {
298+
average_n_hits = total_n_hits_for_this_eta_bin / static_cast<double>(n_lgads_with_hits_for_this_eta_bin);
299+
}
300+
meNhitsPerLGADoverEta_[i]->Fill(eta_value, average_n_hits);
301+
meNLgadWithHitsoverEta_[i]->Fill(eta_value, n_lgads_with_hits_for_this_eta_bin);
302+
}
303+
}
263304
}
264305

265306
// ------------ method for histogram booking ------------
@@ -327,6 +368,24 @@ void EtlDigiHitsValidation::bookHistograms(DQMStore::IBooker& ibook,
327368
meNLgadWithHitsoverQ_[3] =
328369
ibook.bookProfile("EtlNLgadWithHitsvsQThZposD2", "Number of ETL LGADs with at least 1 DIGI hit vs Q Threshold (+Z, D2);Q Threshold [ADC counts];N_{LGAD with hit}", n_bin_Q, Q_Min, Q_Max, 0., 4000.);
329370

371+
meNhitsPerLGADoverEta_[0] =
372+
ibook.bookProfile("EtlNhitsPerLGADvsEtaZnegD1", "ETL DIGI Hits per LGAD vs Eta Bin (-Z, D1);#eta_{DIGI};<N_{DIGI} per LGAD>", n_bin_Eta, eta_bins_edges_neg, 0., 50.);
373+
meNhitsPerLGADoverEta_[1] =
374+
ibook.bookProfile("EtlNhitsPerLGADvsEtaZnegD2", "ETL DIGI Hits per LGAD vs Eta Bin (-Z, D2);#eta_{DIGI};<N_{DIGI} per LGAD>", n_bin_Eta, eta_bins_edges_neg, 0., 50.);
375+
meNhitsPerLGADoverEta_[2] =
376+
ibook.bookProfile("EtlNhitsPerLGADvsEtaZposD1", "ETL DIGI Hits per LGAD vs Eta Bin (+Z, D1);#eta_{DIGI};<N_{DIGI} per LGAD>", n_bin_Eta, eta_bins_edges_pos, 0., 50.);
377+
meNhitsPerLGADoverEta_[3] =
378+
ibook.bookProfile("EtlNhitsPerLGADvsEtaZposD2", "ETL DIGI Hits per LGAD vs Eta Bin (+Z, D2);#eta_{DIGI};<N_{DIGI} per LGAD>", n_bin_Eta, eta_bins_edges_pos, 0., 50.);
379+
380+
meNLgadWithHitsoverEta_[0] =
381+
ibook.bookProfile("EtlNLgadWithHitsvsEtaZnegD1", "Number of ETL LGADs with at least 1 DIGI hit vs Eta Bin (-Z, D1);#eta_{DIGI};N_{LGAD with hit}", n_bin_Eta, eta_bins_edges_neg, 0., 4000.);
382+
meNLgadWithHitsoverEta_[1] =
383+
ibook.bookProfile("EtlNLgadWithHitsvsEtaZnegD2", "Number of ETL LGADs with at least 1 DIGI hit vs Eta Bin (-Z, D2);#eta_{DIGI};N_{LGAD with hit}", n_bin_Eta, eta_bins_edges_neg, 0., 4000.);
384+
meNLgadWithHitsoverEta_[2] =
385+
ibook.bookProfile("EtlNLgadWithHitsvsEtaZposD1", "Number of ETL LGADs with at least 1 DIGI hit vs Eta Bin (+Z, D1);#eta_{DIGI};N_{LGAD with hit}", n_bin_Eta, eta_bins_edges_pos, 0., 4000.);
386+
meNLgadWithHitsoverEta_[3] =
387+
ibook.bookProfile("EtlNLgadWithHitsvsEtaZposD2", "Number of ETL LGADs with at least 1 DIGI hit vs Eta Bin (+Z, D2);#eta_{DIGI};N_{LGAD with hit}", n_bin_Eta, eta_bins_edges_pos, 0., 4000.);
388+
330389
meHitCharge_[0] = ibook.book1D("EtlHitChargeZnegD1",
331390
"ETL DIGI hits charge (-Z, Single(topo1D)/First(topo2D) disk);Q_{DIGI} [ADC counts]",
332391
100,

0 commit comments

Comments
 (0)