Belle II Software development
DQMHistInjection.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8//+
9// File : DQMHistInjection.cc
10// Description : DQM module, which gives histograms showing occupancies after injection
11//-
12
13
14#include <dqm/analysis/modules/DQMHistInjection.h>
15#include <klm/dataobjects/KLMElementNumbers.h>
16#include <TROOT.h>
17
18using namespace std;
19using namespace Belle2;
20
21//-----------------------------------------------------------------
22// Register the Module
23//-----------------------------------------------------------------
24REG_MODULE(DQMHistInjection);
25
26//-----------------------------------------------------------------
27// Implementation
28//-----------------------------------------------------------------
29
31{
32 // This module CAN NOT be run in parallel!
33
34// addParam("histogramDirectoryName", m_histogramDirectoryName, "Name of the directory where histograms were placed", std::string("PXDINJ"));
35 addParam("PVPrefix", m_pvPrefix, "PV Prefix", std::string("DQM:INJ:"));
36 B2DEBUG(1, "DQMHistInjection: Constructor done.");
37}
38
40{
41
42 gROOT->cd(); // this seems to be important, or strange things happen
43
44 m_cInjectionLERPXD = new TCanvas("PXDINJ/c_InjectionLERPXD");
45 m_cInjectionLERPXDOcc = new TCanvas("PXDINJ/c_InjectionLERPXDOcc");
46 m_cInjectionLERSVD = new TCanvas("SVDInjection/c_InjectionLERSVD");
47 m_cInjectionLERSVDOcc = new TCanvas("SVDInjection/c_InjectionLERSVDOcc");
48 m_cInjectionLERECL = new TCanvas("ECLINJ/c_InjectionLERECL");
49 m_cBurstLERECL = new TCanvas("ECLINJ/c_BurstInjectionLERECL");
50 m_cInjectionLERTOP = new TCanvas("TOP/c_InjectionLERTOP");
51 m_cInjectionLERARICH = new TCanvas("ARICH/c_InjectionLERARICH");
52 m_cInjectionLERKLM = new TCanvas("KLM/c_InjectionLERKLM");
53
54 m_cInjectionHERPXD = new TCanvas("PXDINJ/c_InjectionHERPXD");
55 m_cInjectionHERPXDOcc = new TCanvas("PXDINJ/c_InjectionHERPXDOcc");
56 m_cInjectionHERSVD = new TCanvas("SVDInjection/c_InjectionHERSVD");
57 m_cInjectionHERSVDOcc = new TCanvas("SVDInjection/c_InjectionHERSVDOcc");
58 m_cInjectionHERECL = new TCanvas("ECLINJ/c_InjectionHERECL");
59 m_cBurstHERECL = new TCanvas("ECLINJ/c_BurstInjectionHERECL");
60 m_cInjectionHERTOP = new TCanvas("TOP/c_InjectionHERTOP");
61 m_cInjectionHERARICH = new TCanvas("ARICH/c_InjectionHERARICH");
62 m_cInjectionHERKLM = new TCanvas("KLM/c_InjectionHERKLM");
63
64 m_hInjectionLERPXD = new TH1F("HitInjectionLERPXD", "PXD Hits after LER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
65 m_hInjectionLERPXDOcc = new TH1F("HitInjectionPXDLEROcc", "PXD Occ after LER Injection;Time in #mus;Mean Occ in % per module", 4000,
66 0, 20000);
67 m_hInjectionLERSVD = new TH1F("HitInjectionLERSVD", "SVD Hits after LER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
68 m_hInjectionLERSVDOcc = new TH1F("HitInjectionSVDLEROcc", "SVD Occ after LER Injection;Time in #mus;Mean Occ in % per module", 4000,
69 0, 20000);
70 m_hInjectionLERECL = new TH1F("HitInjectionLERECL", "ECL Hits after LER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
71 m_hBurstLERECL = new TH1F("BurstInjectionLERECL", "ECL Bursts after LER Injection;Time in #mus;Suppressions/event (1 #mus bins)",
72 20000, 0, 20000);
73 m_hInjectionLERTOP = new TH1F("HitInjectionLERTOP", "TOP Occ after LER Injection;Time in #mus;Mean Occ in % /event", 4000, 0,
74 20000);
75 m_hInjectionLERARICH = new TH1F("HitInjectionLERARICH", "ARICH Occ after LER Injection;Time in #mus;Mean Hits/event", 4000, 0,
76 20000);
77 m_hInjectionLERKLM = new TH1F("HitInjectionLERKLM",
78 "KLM occupancy after LER Injection;Time [#mus];Digits occupancy in % / (5 #mus)", 4000, 0,
79 20000);
80
81 m_hInjectionHERPXD = new TH1F("HitInjectionHERPXD", "PXD Hits after HER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
82 m_hInjectionHERPXDOcc = new TH1F("HitInjectionPXDHEROcc", "PXD Occ after HER Injection;Time in #mus;Mean Occ in % per module", 4000,
83 0, 20000);
84 m_hInjectionHERSVD = new TH1F("HitInjectionHERSVD", "SVD Hits after HER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
85 m_hInjectionHERSVDOcc = new TH1F("HitInjectionSVDHEROcc", "SVD Occ after HER Injection;Time in #mus;Mean Occ in % per module", 4000,
86 0, 20000);
87 m_hInjectionHERECL = new TH1F("HitInjectionHERECL", "ECL Hits after HER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
88 m_hBurstHERECL = new TH1F("BurstInjectionHERECL", "ECL Bursts after HER Injection;Time in #mus;Suppressions/event (1 #mus bins)",
89 20000, 0, 20000);
90 m_hInjectionHERTOP = new TH1F("HitInjectionHERTOP", "TOP Occ after HER Injection;Time in #mus;Mean Occ in % /event", 4000, 0,
91 20000);
92 m_hInjectionHERARICH = new TH1F("HitInjectionHERARICH", "ARICH Occ after HER Injection;Time in #mus;Mean Hits/event", 4000, 0,
93 20000);
94 m_hInjectionHERKLM = new TH1F("HitInjectionHERKLM",
95 "KLM occupancy after HER Injection;Time [#mus];Digits occupancy in % / (5 #mus)", 4000, 0,
96 20000);
97
98 B2DEBUG(1, "DQMHistInjection: initialized.");
99}
100
101
103{
104 B2DEBUG(1, "DQMHistInjection: beginRun called.");
105
106// m_cInjectionLERPXD->Clear(); // FIXME, unclear if this lets to crashes on new run?
107// m_cInjectionLERPXDOcc->Clear();
108// m_cInjectionLERECL->Clear();
109// m_cInjectionHERPXD->Clear();
110// m_cInjectionHERPXDOcc->Clear();
111// m_cInjectionHERECL->Clear();
112
113}
114
115
117{
118 TH1* Hits = nullptr, *Triggers = nullptr;
119 TString locationHits = "";
120 TString locationTriggers = "";
121 //PXD
122 m_histogramDirectoryName = "PXDINJ";
123
124 locationHits = "PXDOccInjLER";
125 locationHits = m_histogramDirectoryName + "/" + locationHits;
126 Hits = (TH1*)findHist(locationHits.Data());
127 locationTriggers = "PXDEOccInjLER";
128 if (m_histogramDirectoryName != "") {
129 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
130 }
131 Triggers = (TH1*)findHist(locationTriggers.Data());
132
133 //Finding only one of them should only happen in very strange situations...
134 //m_nodes[0].histo = Triggers;
135 if (Hits && Triggers) {
136 m_hInjectionLERPXD->Divide(Hits, Triggers);
137 m_hInjectionLERPXDOcc->Divide(Hits, Triggers, 100, 768 * 250); // to percent
138 }
139
140 m_cInjectionLERPXD->Clear();
141 m_cInjectionLERPXD->cd(0);
142 m_hInjectionLERPXD->Draw("hist");
143
144 m_cInjectionLERPXDOcc->Clear();
146 m_hInjectionLERPXDOcc->Draw("hist");
147
148 locationHits = "PXDOccInjHER";
149 if (m_histogramDirectoryName != "") {
150 locationHits = m_histogramDirectoryName + "/" + locationHits;
151 }
152 Hits = (TH1*)findHist(locationHits.Data());
153 locationTriggers = "PXDEOccInjHER";
154 if (m_histogramDirectoryName != "") {
155 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
156 }
157 Triggers = (TH1*)findHist(locationTriggers.Data());
158
159 //Finding only one of them should only happen in very strange situations...
160 //m_nodes[3].histo = Triggers;
161 if (Hits && Triggers) {
162 m_hInjectionHERPXD->Divide(Hits, Triggers);
163 m_hInjectionHERPXDOcc->Divide(Hits, Triggers, 100, 768 * 250); // to percent
164 }
165
166 m_cInjectionHERPXD->Clear();
167 m_cInjectionHERPXD->cd(0);
168 m_hInjectionHERPXD->Draw("hist");
169
170 m_cInjectionHERPXDOcc->Clear();
172 m_hInjectionHERPXDOcc->Draw("hist");
173
174 //SVD
175 m_histogramDirectoryName = "SVDInjection";
176
177 locationHits = "SVDOccInjLER";
178 locationHits = m_histogramDirectoryName + "/" + locationHits;
179 Hits = (TH1*)findHist(locationHits.Data());
180 locationTriggers = "SVDTrgOccInjLER";
181 if (m_histogramDirectoryName != "") {
182 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
183 }
184 Triggers = (TH1*)findHist(locationTriggers.Data());
185
186 //Finding only one of them should only happen in very strange situations...
187 //m_nodes[0].histo = Triggers;
188 if (Hits && Triggers) {
189 m_hInjectionLERSVD->Divide(Hits, Triggers);
190 m_hInjectionLERSVDOcc->Divide(Hits, Triggers, 100, 768 * 7 * 2); // to percent (L3V has 768 strips * 2 * 7 sides)
191 }
192
193 m_cInjectionLERSVD->Clear();
194 m_cInjectionLERSVD->cd(0);
195 m_hInjectionLERSVD->Draw("hist");
196
197 m_cInjectionLERSVDOcc->Clear();
199 m_hInjectionLERSVDOcc->Draw("hist");
200
201 locationHits = "SVDOccInjHER";
202 if (m_histogramDirectoryName != "") {
203 locationHits = m_histogramDirectoryName + "/" + locationHits;
204 }
205 Hits = (TH1*)findHist(locationHits.Data());
206 locationTriggers = "SVDTrgOccInjHER";
207 if (m_histogramDirectoryName != "") {
208 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
209 }
210 Triggers = (TH1*)findHist(locationTriggers.Data());
211
212 //Finding only one of them should only happen in very strange situations...
213 //m_nodes[3].histo = Triggers;
214 if (Hits && Triggers) {
215 m_hInjectionHERSVD->Divide(Hits, Triggers);
216 m_hInjectionHERSVDOcc->Divide(Hits, Triggers, 100, 768 * 2 * 7); // to percent (L3V has 768 strips * 2 * 7 sides)
217 }
218
219 m_cInjectionHERSVD->Clear();
220 m_cInjectionHERSVD->cd(0);
221 m_hInjectionHERSVD->Draw("hist");
222
223 m_cInjectionHERSVDOcc->Clear();
225 m_hInjectionHERSVDOcc->Draw("hist");
226
227
228 //ECL
229 m_histogramDirectoryName = "ECLINJ";
230
231 locationHits = "ECLHitsInjLER";
232 locationHits = m_histogramDirectoryName + "/" + locationHits;
233 Hits = (TH1*)findHist(locationHits.Data());
234 locationTriggers = "ECLEHitsInjLER";
235 if (m_histogramDirectoryName != "") {
236 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
237 }
238 Triggers = (TH1*)findHist(locationTriggers.Data());
239
240 //Finding only one of them should only happen in very strange situations...
241 if (Hits && Triggers) {
242 m_hInjectionLERECL->Divide(Hits, Triggers);
243 }
244
245 m_cInjectionLERECL->Clear();
246 m_cInjectionLERECL->cd(0);
247 m_hInjectionLERECL->Draw("hist");
248
249 locationHits = "ECLHitsInjHER";
250 if (m_histogramDirectoryName != "") {
251 locationHits = m_histogramDirectoryName + "/" + locationHits;
252 }
253 Hits = (TH1*)findHist(locationHits.Data());
254 locationTriggers = "ECLEHitsInjHER";
255 if (m_histogramDirectoryName != "") {
256 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
257 }
258 Triggers = (TH1*)findHist(locationTriggers.Data());
259
260 //Finding only one of them should only happen in very strange situations...
261 if (Hits && Triggers) {
262 m_hInjectionHERECL->Divide(Hits, Triggers);
263 }
264
265 m_cInjectionHERECL->Clear();
266 m_cInjectionHERECL->cd(0);
267 m_hInjectionHERECL->Draw("hist");
268// =====
269 locationHits = "ECLBurstsInjLER";
270 if (m_histogramDirectoryName != "") {
271 locationHits = m_histogramDirectoryName + "/" + locationHits;
272 }
273 Hits = (TH1*)findHist(locationHits.Data());
274 locationTriggers = "ECLEBurstsInjLER";
275 if (m_histogramDirectoryName != "") {
276 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
277 }
278 Triggers = (TH1*)findHist(locationTriggers.Data());
279
280 if (Hits && Triggers) {
281 m_hBurstLERECL->Divide(Hits, Triggers);
282 }
283
284 m_cBurstLERECL->Clear();
285 m_cBurstLERECL->cd(0);
286 m_hBurstLERECL->Draw("hist");
287// =====
288
289 locationHits = "ECLBurstsInjHER";
290 if (m_histogramDirectoryName != "") {
291 locationHits = m_histogramDirectoryName + "/" + locationHits;
292 }
293 Hits = (TH1*)findHist(locationHits.Data());
294 locationTriggers = "ECLEBurstsInjHER";
295 if (m_histogramDirectoryName != "") {
296 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
297 }
298 Triggers = (TH1*)findHist(locationTriggers.Data());
299
300 if (Hits && Triggers) {
301 m_hBurstHERECL->Divide(Hits, Triggers);
302 }
303
304 m_cBurstHERECL->Clear();
305 m_cBurstHERECL->cd(0);
306 m_hBurstHERECL->Draw("hist");
307// =====
308
309
310 //TOP
312
313 locationHits = "TOPOccInjLER";
314 locationHits = m_histogramDirectoryName + "/" + locationHits;
315 Hits = (TH1*)findHist(locationHits.Data());
316 locationTriggers = "TOPEOccInjLER";
317 if (m_histogramDirectoryName != "") {
318 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
319 }
320 Triggers = (TH1*)findHist(locationTriggers.Data());
321
322 if (Hits && Triggers) {
323 m_hInjectionLERTOP->Divide(Hits, Triggers, 100, 8192);
324 }
325
326 m_cInjectionLERTOP->Clear();
327 m_cInjectionLERTOP->cd(0);
328 m_hInjectionLERTOP->Draw("hist");
329
330 locationHits = "TOPOccInjHER";
331 if (m_histogramDirectoryName != "") {
332 locationHits = m_histogramDirectoryName + "/" + locationHits;
333 }
334 Hits = (TH1*)findHist(locationHits.Data());
335 locationTriggers = "TOPEOccInjHER";
336 if (m_histogramDirectoryName != "") {
337 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
338 }
339 Triggers = (TH1*)findHist(locationTriggers.Data());
340
341 if (Hits && Triggers) {
342 m_hInjectionHERTOP->Divide(Hits, Triggers, 100, 8192);
343 }
344
345 m_cInjectionHERTOP->Clear();
346 m_cInjectionHERTOP->cd(0);
347 m_hInjectionHERTOP->Draw("hist");
348
349
350
351 //ARICH
352 m_histogramDirectoryName = "ARICH";
353
354 locationHits = "ARICHOccInjLER";
355 locationHits = m_histogramDirectoryName + "/" + locationHits;
356 Hits = (TH1*)findHist(locationHits.Data());
357 locationTriggers = "ARICHEOccInjLER";
358 if (m_histogramDirectoryName != "") {
359 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
360 }
361 Triggers = (TH1*)findHist(locationTriggers.Data());
362
363 if (Hits && Triggers) {
364 m_hInjectionLERARICH->Divide(Hits, Triggers);
365 }
366
367 m_cInjectionLERARICH->Clear();
369 m_hInjectionLERARICH->Draw("hist");
370
371 locationHits = "ARICHOccInjHER";
372 if (m_histogramDirectoryName != "") {
373 locationHits = m_histogramDirectoryName + "/" + locationHits;
374 }
375 Hits = (TH1*)findHist(locationHits.Data());
376 locationTriggers = "ARICHEOccInjHER";
377 if (m_histogramDirectoryName != "") {
378 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
379 }
380 Triggers = (TH1*)findHist(locationTriggers.Data());
381
382 if (Hits && Triggers) {
383 m_hInjectionHERARICH->Divide(Hits, Triggers);
384 }
385
386 m_cInjectionHERARICH->Clear();
388 m_hInjectionHERARICH->Draw("hist");
389
390 // KLM
392
393 locationHits = "KLMOccInjLER";
394 locationHits = m_histogramDirectoryName + "/" + locationHits;
395 Hits = (TH1*)findHist(locationHits.Data());
396 locationTriggers = "KLMTrigInjLER";
397 if (m_histogramDirectoryName != "") {
398 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
399 }
400 Triggers = (TH1*)findHist(locationTriggers.Data());
401
402 if (Hits && Triggers) {
403 m_hInjectionLERKLM->Divide(Hits, Triggers, 100, KLMElementNumbers::getTotalChannelNumber());
404 }
405
406 m_cInjectionLERKLM->Clear();
407 m_cInjectionLERKLM->cd(0);
408 m_hInjectionLERKLM->Draw("hist");
409
410 locationHits = "KLMOccInjHER";
411 if (m_histogramDirectoryName != "") {
412 locationHits = m_histogramDirectoryName + "/" + locationHits;
413 }
414 Hits = (TH1*)findHist(locationHits.Data());
415 locationTriggers = "KLMTrigInjHER";
416 if (m_histogramDirectoryName != "") {
417 locationTriggers = m_histogramDirectoryName + "/" + locationTriggers;
418 }
419 Triggers = (TH1*)findHist(locationTriggers.Data());
420
421 if (Hits && Triggers) {
422 m_hInjectionHERKLM->Divide(Hits, Triggers, 100, KLMElementNumbers::getTotalChannelNumber());
423 }
424
425 m_cInjectionHERKLM->Clear();
426 m_cInjectionHERKLM->cd(0);
427 m_hInjectionHERKLM->Draw("hist");
428
429}
430
The base class for the histogram analysis module.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
TH1F * m_hInjectionLERKLM
KLM occupancy after LER injection.
TCanvas * m_cInjectionLERSVD
Final Canvas.
TCanvas * m_cInjectionLERECL
Final Canvas.
TCanvas * m_cInjectionHERPXDOcc
Final Canvas.
TCanvas * m_cBurstLERECL
Final Canvas.
TCanvas * m_cInjectionHERSVDOcc
Final Canvas.
TCanvas * m_cInjectionLERKLM
Canvas for KLM occupancy after LER injection.
TCanvas * m_cInjectionLERPXDOcc
Final Canvas.
void initialize(void) override final
Initializer.
TCanvas * m_cInjectionLERPXD
Final Canvas.
std::string m_pvPrefix
prefix for EPICS PVs
TCanvas * m_cBurstHERECL
Final Canvas.
TCanvas * m_cInjectionHERECL
Final Canvas.
TCanvas * m_cInjectionLERTOP
Final Canvas.
TCanvas * m_cInjectionHERTOP
Final Canvas.
TH1F * m_hInjectionLERARICH
ARICH Occ.
TCanvas * m_cInjectionHERKLM
Canvas for KLM occupancy after HER injection.
std::string m_histogramDirectoryName
name of histogram directory
TH1F * m_hInjectionHERKLM
KLM occupancy after HER injection.
TCanvas * m_cInjectionHERARICH
Final Canvas.
TH1F * m_hInjectionHERSVDOcc
SVD Occ norm.
TCanvas * m_cInjectionLERARICH
Final Canvas.
TH1F * m_hInjectionHERPXDOcc
PXD Occ norm.
TCanvas * m_cInjectionLERSVDOcc
Final Canvas.
TH1F * m_hInjectionLERSVDOcc
SVD Occ norm.
TCanvas * m_cInjectionHERSVD
Final Canvas.
TH1F * m_hInjectionLERPXDOcc
PXD Occ norm.
TCanvas * m_cInjectionHERPXD
Final Canvas.
void beginRun(void) override final
Called when entering a new run.
void event(void) override final
This method is called for each event.
static constexpr int getTotalChannelNumber()
Get total number of channels.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.
STL namespace.