Belle II Software  release-06-02-00
TRGGRLDQMModule.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 #include <trg/grl/modules/TRGGRLDQM/TRGGRLDQMModule.h>
10 
11 #include <framework/datastore/StoreObjPtr.h>
12 
13 #include "trg/grl/dataobjects/TRGGRLUnpackerStore.h"
14 
15 #include <TDirectory.h>
16 #include <iostream>
17 
18 
19 using namespace std;
20 using namespace Belle2;
21 
22 REG_MODULE(TRGGRLDQM);
23 
24 TRGGRLDQMModule::TRGGRLDQMModule() : HistoModule()
25 {
26 
27  setDescription("DQM for GRL Trigger system");
29 
30 }
31 
33 {
34  oldDir = gDirectory;
35  dirDQM = NULL;
36  dirDQM = oldDir->mkdir("TRGGRL");
37  dirDQM->cd();
38 
39  h_N_track = new TH1I("h_N_track", "CDCTRG 2D N_track", 8, 0, 8);
40  h_N_track->GetXaxis()->SetTitle("CDCTRG 2D N_track");
41 
42  h_phi_i = new TH1F("h_phi_i", "phi_i CDCTRG 2D [10 degrees]", 36, 0, 360);
43  h_phi_i->GetXaxis()->SetTitle("#phi_{i} CDCTRG 2D [10 degrees]");
44  h_phi_CDC = new TH1F("h_phi_CDC", "phi_CDC CDCTRG 2D [10 degrees]", 36, 0, 360);
45  h_phi_CDC->GetXaxis()->SetTitle("#phi_{CDC} CDCTRG 2D [10 degrees]");
46  h_sector_CDC = new TH1F("h_sector_CDC", "Sector_CDC CDCTRG 2D [45 degrees]", 8, -22.5, 337.5);
47  h_sector_CDC->GetXaxis()->SetTitle("Sector_{CDC} CDCTRG 2D [45 degrees]");
48  h_sector_KLM = new TH1F("h_sector_KLM", "Sector_KLM [45 degrees]", 8, -22.5, 337.5);
49  h_sector_KLM->GetXaxis()->SetTitle("Sector_{KLM} [45 degrees]");
50  h_slot_CDC = new TH1F("h_slot_CDC", "Slot_CDC CDCTRG 2D [22.5 degrees]", 16, 0, 360);
51  h_slot_CDC->GetXaxis()->SetTitle("Slot_{CDC} CDCTRG 2D [22.5 degrees]");
52  h_slot_TOP = new TH1F("h_slot_TOP", "Slot_TOP [22.5 degrees]", 16, 0, 360);
53  h_slot_TOP->GetXaxis()->SetTitle("Slot_{TOP} [22.5 degrees]");
54 
55  h_E_ECL = new TH1F("h_E_ECL", "ECL cluster energy [5 MeV]", 2048, 0, 10.24);
56  h_E_ECL->GetXaxis()->SetTitle("ECL cluster energy [5 MeV]");
57  h_theta_ECL = new TH1F("h_theta_ECL", "ECL cluster theta [1.4 degrees]", 128, 0, 180);
58  h_theta_ECL->GetXaxis()->SetTitle("ECL cluster #theta [1.4 degrees]");
59  h_phi_ECL = new TH1F("h_phi_ECL", "ECL cluster phi [1.4 degrees]", 256, 0, 360);
60  h_phi_ECL->GetXaxis()->SetTitle("ECL cluster #phi [1.4 degrees]");
61 
62  h_CDCL1 = new TH1F("h_CDCL1", "CDCTRG 2D -> L1 trg [ns]", 320, -320 * 7.8, 0);
63  h_CDCL1->GetXaxis()->SetTitle("CDCTRG 2D -> L1 trg [ns]");
64  h_ECLL1 = new TH1F("h_ECLL1", "ECLTRG -> L1 trg [ns]", 320, -320 * 7.8, 0);
65  h_ECLL1->GetXaxis()->SetTitle("ECLTRG -> L1 trg [ns]");
66  h_TOPL1 = new TH1F("h_TOPL1", "TOPTRG -> L1 trg [ns]", 320, -320 * 7.8, 0);
67  h_TOPL1->GetXaxis()->SetTitle("TOPTRG -> L1 trg [ns]");
68  h_KLML1 = new TH1F("h_KLML1", "KLMTRG -> L1 trg [ns]", 320, -320 * 7.8, 0);
69  h_KLML1->GetXaxis()->SetTitle("KLMTRG -> L1 trg [ns]");
70  h_ECLL1_2nd = new TH1F("h_ECLL1_2nd", "ECLTRG 2nd input-> L1 trg [ns]", 320, -320 * 7.8, 0);
71  h_ECLL1_2nd->GetXaxis()->SetTitle("ECLTRG 2nd input -> L1 trg [ns]");
72  h_CDC3DL1 = new TH1F("h_CDC3DL1", "CDCTRG 3D -> L1 trg [ns]", 320, -320 * 7.8, 0);
73  h_CDC3DL1->GetXaxis()->SetTitle("CDCTRG 3D -> L1 trg [ns]");
74  h_CDCNNL1 = new TH1F("h_CDCNNL1", "CDCTRG NN -> L1 trg [ns]", 320, -320 * 7.8, 0);
75  h_CDCNNL1->GetXaxis()->SetTitle("CDCTRG NN -> L1 trg [ns]");
76  h_TSFL1 = new TH1F("h_TSFL1", "CDCTRG TSF -> L1 trg [ns]", 320, -320 * 7.8, 0);
77  h_TSFL1->GetXaxis()->SetTitle("CDCTRG TSF -> L1 trg [ns]");
78  h_B2LL1 = new TH1F("h_B2LL1", "B2L window -> L1 trg [ns]", 320, -320 * 7.8, 0);
79  h_B2LL1->GetXaxis()->SetTitle("B2L window -> L1 trg [ns]");
80 
81  h_map_ST = new TH1F("h_map_ST", "CDCTRG short track map [5.625 degrees]", 64, 0, 360);
82  h_map_ST->GetXaxis()->SetTitle("CDCTRG short track map [5.625 degrees]");
83  h_map_ST2 = new TH1F("h_map_ST2", "CDCTRG short track map [5.625 degrees]", 64, 0, 360);
84  h_map_ST2->GetXaxis()->SetTitle("CDCTRG short track map [5.625 degrees]");
85  h_map_veto = new TH1F("h_map_veto", "CDCTRG 2D veto map [5.625 degrees]", 64, 0, 360);
86  h_map_veto->GetXaxis()->SetTitle("CDCTRG 2D veto map [5.625 degrees]");
87  h_map_TSF0 = new TH1F("h_map_TSF0", "CDCTRG TSF0 map [5.625 degrees]", 64, 0, 360);
88  h_map_TSF0->GetXaxis()->SetTitle("CDCTRG TSF0 map [5.625 degrees]");
89  h_map_TSF2 = new TH1F("h_map_TSF2", "CDCTRG TSF2 map [5.625 degrees]", 64, 0, 360);
90  h_map_TSF2->GetXaxis()->SetTitle("CDCTRG TSF2 map [5.625 degrees]");
91  h_map_TSF4 = new TH1F("h_map_TSF4", "CDCTRG TSF4 map [5.625 degrees]", 64, 0, 360);
92  h_map_TSF4->GetXaxis()->SetTitle("CDCTRG TSF4 map [5.625 degrees]");
93  h_map_TSF1 = new TH1F("h_map_TSF1", "CDCTRG TSF1 map [5.625 degrees]", 64, 0, 360);
94  h_map_TSF1->GetXaxis()->SetTitle("CDCTRG TSF1 map [5.625 degrees]");
95  h_map_TSF3 = new TH1F("h_map_TSF3", "CDCTRG TSF3 map [5.625 degrees]", 64, 0, 360);
96  h_map_TSF3->GetXaxis()->SetTitle("CDCTRG TSF3 map [5.625 degrees]");
97 
98  oldDir->cd();
99 }
100 
102 {
103 
104  dirDQM->cd();
105 
106  h_N_track->Reset();
107  h_phi_i->Reset();
108  h_phi_CDC->Reset();
109  h_sector_CDC->Reset();
110  h_sector_KLM->Reset();
111  h_slot_CDC->Reset();
112  h_slot_TOP->Reset();
113  h_E_ECL->Reset();
114  h_theta_ECL->Reset();
115  h_phi_ECL->Reset();
116  h_CDCL1->Reset();
117  h_ECLL1->Reset();
118  h_TOPL1->Reset();
119  h_KLML1->Reset();
120  h_CDC3DL1->Reset();
121  h_CDCNNL1->Reset();
122  h_TSFL1->Reset();
123  h_B2LL1->Reset();
124  h_map_ST->Reset();
125  h_map_ST2->Reset();
126  h_map_veto->Reset();
127  h_map_TSF0->Reset();
128  h_map_TSF2->Reset();
129  h_map_TSF4->Reset();
130  h_map_TSF1->Reset();
131  h_map_TSF3->Reset();
132 
133  oldDir->cd();
134 }
135 
137 {
138  // calls back the defineHisto() function, but the HistoManager module has to be in the path
139  REG_HISTOGRAM
140 }
141 
143 {
144 }
145 
147 {
148  StoreObjPtr<TRGGRLUnpackerStore> evtinfo("TRGGRLUnpackerStore");
149  if (!evtinfo) return;
150 
151  int N_track = evtinfo->m_N_track;
152  int bin = h_N_track->GetBinContent(N_track + 1);
153  h_N_track->SetBinContent(N_track + 1, bin + 1);
154 
155  for (int i = 0; i < 36; i++) {
156  if (evtinfo->m_phi_i[i]) {
157  h_phi_i->Fill(5 + i * 10);
158  }
159  if (evtinfo->m_phi_CDC[i]) {
160  h_phi_CDC->Fill(5 + i * 10);
161  }
162  }
163  for (int i = 0; i < 8; i++) {
164  if (evtinfo->m_sector_CDC[i]) {
165  h_sector_CDC->Fill(i * 45);
166  }
167  if (evtinfo->m_sector_KLM[i]) {
168  h_sector_KLM->Fill(i * 45);
169  }
170  }
171  for (int i = 0; i < 16; i++) {
172  if (evtinfo->m_slot_CDC[i]) {
173  h_slot_CDC->Fill(11.25 + i * 22.5);
174  }
175  if (evtinfo->m_slot_TOP[i]) {
176  h_slot_TOP->Fill(11.25 + i * 22.5);
177  }
178  }
179 
180  int N_cluster = evtinfo->m_N_cluster;
181  for (int i = 0; i < N_cluster; i++) {
182  h_E_ECL->Fill(evtinfo->m_E_ECL[i] * 0.005 + 0.0025);
183  h_theta_ECL->Fill(evtinfo->m_theta_ECL[i] * 1.40625 + 1.40625 * 0.5);
184  h_phi_ECL->Fill(evtinfo->m_phi_ECL[i] * 1.40625 + 1.40625 * 0.5);
185  }
186 
187  int timeL1 = evtinfo->m_coml1 - evtinfo->m_revoclk;
188 
189  if (evtinfo->m_CDCL1_count != 0) {
190  h_CDCL1->Fill((evtinfo->m_CDCL1_count + timeL1 - 0.5) * (-7.8));
191  }
192  if (evtinfo->m_ECLL1_count != 0) {
193  h_ECLL1->Fill((evtinfo->m_ECLL1_count + timeL1 - 0.5) * (-7.8));
194  }
195  if (evtinfo->m_ECLL1_count != 0 && evtinfo->m_N_cluster_1 != 0) {
196  h_ECLL1_2nd->Fill((evtinfo->m_ECLL1_count + timeL1 - 0.5) * (-7.8) + 7.8 * 16);
197  }
198  if (evtinfo->m_TOPL1_count != 0) {
199  h_TOPL1->Fill((evtinfo->m_TOPL1_count + timeL1 - 0.5) * (-7.8));
200  }
201  if (evtinfo->m_KLML1_count != 0) {
202  h_KLML1->Fill((evtinfo->m_KLML1_count + timeL1 - 0.5) * (-7.8));
203  }
204  if (evtinfo->m_CDC3DL1_count != 0) {
205  h_CDC3DL1->Fill((evtinfo->m_CDC3DL1_count + timeL1 - 0.5) * (-7.8));
206  }
207  if (evtinfo->m_CDCNNL1_count != 0) {
208  h_CDCNNL1->Fill((evtinfo->m_CDCNNL1_count + timeL1 - 0.5) * (-7.8));
209  }
210  if (evtinfo->m_TSFL1_count != 0) {
211  h_TSFL1->Fill((evtinfo->m_TSFL1_count + timeL1 - 0.5) * (-7.8));
212  }
213  if (timeL1 != 0) {
214  h_B2LL1->Fill((timeL1 - 0.5) * (-7.8));
215  }
216 
217  for (int i = 0; i < 64; i++) {
218  if (evtinfo->m_map_ST[i]) {
219  h_map_ST->Fill(2.8 + i * 360.0 / 64.0);
220  }
221  if (evtinfo->m_map_ST2[i]) {
222  h_map_ST2->Fill(2.8 + i * 360.0 / 64.0);
223  }
224  if (evtinfo->m_map_veto[i]) {
225  h_map_veto->Fill(2.8 + i * 360.0 / 64.0);
226  }
227  if (evtinfo->m_map_TSF0[i]) {
228  h_map_TSF0->Fill(2.8 + i * 360.0 / 64.0);
229  }
230  if (evtinfo->m_map_TSF2[i]) {
231  h_map_TSF2->Fill(2.8 + i * 360.0 / 64.0);
232  }
233  if (evtinfo->m_map_TSF4[i]) {
234  h_map_TSF4->Fill(2.8 + i * 360.0 / 64.0);
235  }
236  if (evtinfo->m_map_TSF1[i]) {
237  h_map_TSF1->Fill(2.8 + i * 360.0 / 64.0);
238  }
239  if (evtinfo->m_map_TSF3[i]) {
240  h_map_TSF3->Fill(2.8 + i * 360.0 / 64.0);
241  }
242  }
243 }
244 
245 
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
TH1F * h_phi_CDC
phi_CDC, extrapolated phi at ECL of CDC 2D tracks
TH1F * h_map_TSF3
TSF3 map.
TH1F * h_map_TSF4
TSF4 map.
virtual void initialize() override
initialize
TH1F * h_map_TSF1
TSF1 map.
TDirectory * oldDir
TDirectory.
virtual void event() override
Event.
TH1F * h_CDC3DL1
Jitter of CDC 3D -> L1.
TH1F * h_KLML1
Jitter of KLM -> L1.
TH1F * h_phi_i
phi_i of CDC 2D tracks
TH1F * h_E_ECL
ECL cluster energy.
virtual void endRun() override
End Run.
TH1F * h_map_TSF0
TSF0 map.
TH1F * h_ECLL1
Jitter of ECL -> L1.
TH1F * h_TOPL1
Jitter of TOP -> L1.
TH1F * h_CDCNNL1
Jitter of CDC NN -> L1.
TH1F * h_B2LL1
Jitter of B2L window -> L1.
TH1F * h_map_ST2
Short track map.
TH1I * h_N_track
Number of tracks.
TH1F * h_map_TSF2
TSF2 map.
TH1F * h_CDCL1
Jitter of CDC 2D -> L1.
TH1F * h_phi_ECL
ECL cluster phi.
virtual void beginRun() override
begin Run
TH1F * h_ECLL1_2nd
Jitter of ECl 2nd input -> L1.
TH1F * h_TSFL1
Jitter of Short track -> L1.
TH1F * h_sector_KLM
sector map of KLM
TH1F * h_theta_ECL
ECL cluster theta.
TH1F * h_slot_CDC
slot_CDC, extrapolated phi at TOP of CDC 2D tracks
TDirectory * dirDQM
TDirectory.
TH1F * h_sector_CDC
sector_CDC, extrapolated phi at KLM of CDC 2D tracks
TH1F * h_map_veto
Full track veto map.
TH1F * h_slot_TOP
slot map of TOP
TH1F * h_map_ST
Short track map.
virtual void defineHisto() override
Define Histogram.
#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.