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("PVPrefix", m_pvPrefix, "PV Prefix", std::string("DQM:INJ:"));
35 B2DEBUG(1, "DQMHistInjection: Constructor done.");
36}
37
39{
40
41 gROOT->cd(); // this seems to be important, or strange things happen
42
43 m_cInjectionLERPXD = new TCanvas("PXDINJ/c_InjectionLERPXD");
44 m_cInjectionLERPXDOcc = new TCanvas("PXDINJ/c_InjectionLERPXDOcc");
45 m_cInjectionLERSVD = new TCanvas("SVDInjection/c_InjectionLERSVD");
46 m_cInjectionLERSVDOcc = new TCanvas("SVDInjection/c_InjectionLERSVDOcc");
47 m_cInjectionLERECL = new TCanvas("ECLINJ/c_InjectionLERECL");
48 m_cBurstLERECL = new TCanvas("ECLINJ/c_BurstInjectionLERECL");
49 m_cInjectionLERTOP = new TCanvas("TOP/c_InjectionLERTOP");
50 m_cInjectionLERARICH = new TCanvas("ARICH/c_InjectionLERARICH");
51 m_cInjectionLERKLM = new TCanvas("KLM/c_InjectionLERKLM");
52
53 m_cInjectionHERPXD = new TCanvas("PXDINJ/c_InjectionHERPXD");
54 m_cInjectionHERPXDOcc = new TCanvas("PXDINJ/c_InjectionHERPXDOcc");
55 m_cInjectionHERSVD = new TCanvas("SVDInjection/c_InjectionHERSVD");
56 m_cInjectionHERSVDOcc = new TCanvas("SVDInjection/c_InjectionHERSVDOcc");
57 m_cInjectionHERECL = new TCanvas("ECLINJ/c_InjectionHERECL");
58 m_cBurstHERECL = new TCanvas("ECLINJ/c_BurstInjectionHERECL");
59 m_cInjectionHERTOP = new TCanvas("TOP/c_InjectionHERTOP");
60 m_cInjectionHERARICH = new TCanvas("ARICH/c_InjectionHERARICH");
61 m_cInjectionHERKLM = new TCanvas("KLM/c_InjectionHERKLM");
62
63 m_hInjectionLERPXD = new TH1F("HitInjectionLERPXD", "PXD Hits after LER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
64 m_hInjectionLERPXDOcc = new TH1F("HitInjectionPXDLEROcc", "PXD Occ after LER Injection;Time in #mus;Mean Occ in % per module", 4000,
65 0, 20000);
66 m_hInjectionLERSVD = new TH1F("HitInjectionLERSVD", "SVD Hits after LER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
67 m_hInjectionLERSVDOcc = new TH1F("HitInjectionSVDLEROcc", "SVD Occ after LER Injection;Time in #mus;Mean Occ in % per module", 4000,
68 0, 20000);
69 m_hInjectionLERECL = new TH1F("HitInjectionLERECL", "ECL Hits after LER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
70 m_hBurstLERECL = new TH1F("BurstInjectionLERECL", "ECL Bursts after LER Injection;Time in #mus;Suppressions/event (1 #mus bins)",
71 20000, 0, 20000);
72 m_hInjectionLERTOP = new TH1F("HitInjectionLERTOP", "TOP Occ after LER Injection;Time in #mus;Mean Occ in % /event", 4000, 0,
73 20000);
74 m_hInjectionLERARICH = new TH1F("HitInjectionLERARICH", "ARICH Occ after LER Injection;Time in #mus;Mean Hits/event", 4000, 0,
75 20000);
76 m_hInjectionLERKLM = new TH1F("HitInjectionLERKLM",
77 "KLM occupancy after LER Injection;Time [#mus];Digits occupancy in % / (5 #mus)", 4000, 0,
78 20000);
79
80 m_hInjectionHERPXD = new TH1F("HitInjectionHERPXD", "PXD Hits after HER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
81 m_hInjectionHERPXDOcc = new TH1F("HitInjectionPXDHEROcc", "PXD Occ after HER Injection;Time in #mus;Mean Occ in % per module", 4000,
82 0, 20000);
83 m_hInjectionHERSVD = new TH1F("HitInjectionHERSVD", "SVD Hits after HER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
84 m_hInjectionHERSVDOcc = new TH1F("HitInjectionSVDHEROcc", "SVD Occ after HER Injection;Time in #mus;Mean Occ in % per module", 4000,
85 0, 20000);
86 m_hInjectionHERECL = new TH1F("HitInjectionHERECL", "ECL Hits after HER Injection;Time in #mus;Mean Hits/event", 4000, 0, 20000);
87 m_hBurstHERECL = new TH1F("BurstInjectionHERECL", "ECL Bursts after HER Injection;Time in #mus;Suppressions/event (1 #mus bins)",
88 20000, 0, 20000);
89 m_hInjectionHERTOP = new TH1F("HitInjectionHERTOP", "TOP Occ after HER Injection;Time in #mus;Mean Occ in % /event", 4000, 0,
90 20000);
91 m_hInjectionHERARICH = new TH1F("HitInjectionHERARICH", "ARICH Occ after HER Injection;Time in #mus;Mean Hits/event", 4000, 0,
92 20000);
93 m_hInjectionHERKLM = new TH1F("HitInjectionHERKLM",
94 "KLM occupancy after HER Injection;Time [#mus];Digits occupancy in % / (5 #mus)", 4000, 0,
95 20000);
96
97 B2DEBUG(1, "DQMHistInjection: initialized.");
98}
99
100
102{
103 B2DEBUG(1, "DQMHistInjection: beginRun called.");
104
105// m_cInjectionLERPXD->Clear(); // FIXME, unclear if this lets to crashes on new run?
106// m_cInjectionLERPXDOcc->Clear();
107// m_cInjectionLERECL->Clear();
108// m_cInjectionHERPXD->Clear();
109// m_cInjectionHERPXDOcc->Clear();
110// m_cInjectionHERECL->Clear();
111
112}
113
114
116{
117
118 // PXD
119 {
120 // LER
121 auto Hits = findHist("PXDOccInjLER");
122 auto Triggers = findHist("PXDINJ", "PXDEOccInjLER");
123 if (Hits && Triggers) {
124 m_hInjectionLERPXD->Divide(Hits, Triggers);
125 m_hInjectionLERPXDOcc->Divide(Hits, Triggers, 100, 768 * 250); // to percent
126 }
127 m_cInjectionLERPXD->Clear();
128 m_cInjectionLERPXD->cd(0);
129 m_hInjectionLERPXD->Draw("hist");
130 m_cInjectionLERPXDOcc->Clear();
132 m_hInjectionLERPXDOcc->Draw("hist");
133 }
134 {
135 // HER
136 auto Hits = findHist("PXDINJ", "PXDOccInjHER");
137 auto Triggers = findHist("PXDINJ", "PXDEOccInjHER");
138 //Finding only one of them should only happen in very strange situations...
139 if (Hits && Triggers) {
140 m_hInjectionHERPXD->Divide(Hits, Triggers);
141 m_hInjectionHERPXDOcc->Divide(Hits, Triggers, 100, 768 * 250); // to percent
142 }
143 m_cInjectionHERPXD->Clear();
144 m_cInjectionHERPXD->cd(0);
145 m_hInjectionHERPXD->Draw("hist");
146 m_cInjectionHERPXDOcc->Clear();
148 m_hInjectionHERPXDOcc->Draw("hist");
149 }
150
151 // SVD
152 {
153 // LER
154 auto Hits = findHist("SVDInjection", "SVDOccInjLER");
155 auto Triggers = findHist("SVDInjection", "SVDTrgOccInjLER");
156 if (Hits && Triggers) {
157 m_hInjectionLERSVD->Divide(Hits, Triggers);
158 m_hInjectionLERSVDOcc->Divide(Hits, Triggers, 100, 768 * 7 * 2); // to percent (L3V has 768 strips * 2 * 7 sides)
159 }
160 m_cInjectionLERSVD->Clear();
161 m_cInjectionLERSVD->cd(0);
162 m_hInjectionLERSVD->Draw("hist");
163 m_cInjectionLERSVDOcc->Clear();
165 m_hInjectionLERSVDOcc->Draw("hist");
166 }
167 {
168 // HER
169 auto Hits = findHist("SVDInjection", "SVDOccInjHER");
170 auto Triggers = findHist("SVDInjection", "SVDTrgOccInjHER");
171 if (Hits && Triggers) {
172 m_hInjectionHERSVD->Divide(Hits, Triggers);
173 m_hInjectionHERSVDOcc->Divide(Hits, Triggers, 100, 768 * 2 * 7); // to percent (L3V has 768 strips * 2 * 7 sides)
174 }
175 m_cInjectionHERSVD->Clear();
176 m_cInjectionHERSVD->cd(0);
177 m_hInjectionHERSVD->Draw("hist");
178 m_cInjectionHERSVDOcc->Clear();
180 m_hInjectionHERSVDOcc->Draw("hist");
181 }
182
183 // ECL
184 {
185 // LER
186 auto Hits = findHist("ECLINJ", "ECLHitsInjLER");
187 auto Triggers = findHist("ECLINJ", "ECLEHitsInjLER");
188 if (Hits && Triggers) {
189 m_hInjectionLERECL->Divide(Hits, Triggers);
190 }
191 m_cInjectionLERECL->Clear();
192 m_cInjectionLERECL->cd(0);
193 m_hInjectionLERECL->Draw("hist");
194 }
195 {
196 // HER
197 auto Hits = findHist("ECLINJ", "ECLHitsInjHER");
198 auto Triggers = findHist("ECLINJ", "ECLEHitsInjHER");
199 if (Hits && Triggers) {
200 m_hInjectionHERECL->Divide(Hits, Triggers);
201 }
202 m_cInjectionHERECL->Clear();
203 m_cInjectionHERECL->cd(0);
204 m_hInjectionHERECL->Draw("hist");
205 }
206 {
207 // Burst LER
208 auto Hits = findHist("ECLINJ", "ECLBurstsInjLER");
209 auto Triggers = findHist("ECLINJ", "ECLEBurstsInjLER");
210 if (Hits && Triggers) {
211 m_hBurstLERECL->Divide(Hits, Triggers);
212 }
213 m_cBurstLERECL->Clear();
214 m_cBurstLERECL->cd(0);
215 m_hBurstLERECL->Draw("hist");
216 }
217 {
218 // Burst HER
219 auto Hits = findHist("ECLINJ", "ECLBurstsInjHER");
220 auto Triggers = findHist("ECLINJ", "ECLEBurstsInjHER");
221 if (Hits && Triggers) {
222 m_hBurstHERECL->Divide(Hits, Triggers);
223 }
224 m_cBurstHERECL->Clear();
225 m_cBurstHERECL->cd(0);
226 m_hBurstHERECL->Draw("hist");
227 }
228
229 // TOP
230 {
231 // LER
232 auto Hits = findHist("TOP", "TOPOccInjLER");
233 auto Triggers = findHist("TOP", "TOPEOccInjLER");
234 if (Hits && Triggers) {
235 m_hInjectionLERTOP->Divide(Hits, Triggers, 100, 8192);
236 }
237 m_cInjectionLERTOP->Clear();
238 m_cInjectionLERTOP->cd(0);
239 m_hInjectionLERTOP->Draw("hist");
240 }
241 {
242 // HER
243 auto Hits = findHist("TOP", "TOPOccInjHER");
244 auto Triggers = findHist("TOP", "TOPEOccInjHER");
245 if (Hits && Triggers) {
246 m_hInjectionHERTOP->Divide(Hits, Triggers, 100, 8192);
247 }
248 m_cInjectionHERTOP->Clear();
249 m_cInjectionHERTOP->cd(0);
250 m_hInjectionHERTOP->Draw("hist");
251 }
252
253 // ARICH
254 {
255 // LER
256 auto Hits = findHist("ARICH", "ARICHOccInjLER");
257 auto Triggers = findHist("ARICH", "ARICHEOccInjLER");
258 if (Hits && Triggers) {
259 m_hInjectionLERARICH->Divide(Hits, Triggers);
260 }
261 m_cInjectionLERARICH->Clear();
263 m_hInjectionLERARICH->Draw("hist");
264 }
265 {
266 // HER
267 auto Hits = findHist("ARICH", "ARICHOccInjHER");
268 auto Triggers = findHist("ARICH", "ARICHEOccInjHER");
269 if (Hits && Triggers) {
270 m_hInjectionHERARICH->Divide(Hits, Triggers);
271 }
272 m_cInjectionHERARICH->Clear();
274 m_hInjectionHERARICH->Draw("hist");
275 }
276
277 // KLM
278 {
279 // LER
280 auto Hits = findHist("KLM", "KLMOccInjLER");
281 auto Triggers = findHist("KLM", "KLMTrigInjLER");
282 if (Hits && Triggers) {
283 m_hInjectionLERKLM->Divide(Hits, Triggers, 100, KLMElementNumbers::getTotalChannelNumber());
284 }
285 m_cInjectionLERKLM->Clear();
286 m_cInjectionLERKLM->cd(0);
287 m_hInjectionLERKLM->Draw("hist");
288 }
289 {
290 // HER
291 auto Hits = findHist("KLM", "KLMOccInjHER");
292 auto Triggers = findHist("KLM", "KLMTrigInjHER");
293 if (Hits && Triggers) {
294 m_hInjectionHERKLM->Divide(Hits, Triggers, 100, KLMElementNumbers::getTotalChannelNumber());
295 }
296 m_cInjectionHERKLM->Clear();
297 m_cInjectionHERKLM->cd(0);
298 m_hInjectionHERKLM->Draw("hist");
299 }
300}
301
DQMHistAnalysisModule()
Constructor / Destructor.
static TH1 * findHist(const std::string &dirname, const std::string &histname="", bool onlyIfUpdated=false)
Find histogram.
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.
TCanvas * m_cInjectionHERKLM
Canvas for KLM occupancy after HER injection.
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:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.
STL namespace.