Belle II Software  release-05-01-25
TRGGDLDQMModule.cc
1 //---------------------------------------------------------------
2 // $Id$
3 //---------------------------------------------------------------
4 // Filename : TRGGDLModule.cc
5 // Section : TRG GDL
6 // Owner :
7 // Email :
8 //---------------------------------------------------------------
9 // Description : A trigger module for TRG GDL
10 //---------------------------------------------------------------
11 // 1.00 : 2017/05/08 : First version
12 //---------------------------------------------------------------
13 #include <trg/gdl/modules/trggdlDQM/TRGGDLDQMModule.h>
14 #include <trg/gdl/modules/trggdlUnpacker/trggdlUnpackerModule.h>
15 #include <mdst/dataobjects/SoftwareTriggerResult.h>
16 
17 #include <framework/datastore/StoreObjPtr.h>
18 #include <framework/datastore/StoreArray.h>
19 
20 #include <TDirectory.h>
21 #include <TPostScript.h>
22 #include <TCanvas.h>
23 #include <TStyle.h>
24 #include <iostream>
25 #include <fstream>
26 #include <framework/logging/Logger.h>
27 #include <boost/algorithm/string.hpp>
28 
29 #include <mdst/dataobjects/Track.h>
30 #include <mdst/dataobjects/HitPatternCDC.h>
31 #include <mdst/dataobjects/ECLCluster.h>
32 #include <ecl/dataobjects/ECLDigit.h>
33 #include <ecl/dataobjects/ECLCalDigit.h>
34 #include "trg/ecl/dataobjects/TRGECLCluster.h"
35 
36 using namespace std;
37 using namespace Belle2;
38 using namespace GDL;
39 
40 REG_MODULE(TRGGDLDQM);
41 
42 /*
43  Fired data in TrgBit not available because
44  of absence of TRGSummary class.
45  TrgBit class only for bit configuration.
46 */
47 
48 
49 TRGGDLDQMModule::TRGGDLDQMModule() : HistoModule()
50 {
51 
52  setDescription("DQM for GDL Trigger system");
54 
55  addParam("eventByEventTimingHistRecord", m_eventByEventTimingHistRecord,
56  "Recording event by event timing distribution histogram or not",
57  false);
58  addParam("dumpVcdFile", m_dumpVcdFile,
59  "Dumping vcd file or not",
60  false);
61  addParam("bitConditionToDumpVcd", m_bitConditionToDumpVcd,
62  "Condition for vcd. alg format with '!' and '+'.",
63  string(""));
64  addParam("vcdEventStart", m_vcdEventStart,
65  "Start equential event number",
66  unsigned(0));
67  addParam("vcdNumberOfEvents", m_vcdNumberOfEvents,
68  "Number of events to dump vcd file",
69  unsigned(10));
70  addParam("bitNameOnBinLabel", m_bitNameOnBinLabel,
71  "Put bitname on BinLabel",
72  true);
73  addParam("generatePostscript", m_generatePostscript,
74  "Genarete postscript file or not",
75  false);
76  addParam("postScriptName", m_postScriptName,
77  "postscript file name",
78  string("gdldqm.ps"));
79  addParam("skim", m_skim,
80  "use skim information or not",
81  int(-1));
82  B2DEBUG(20, "eventByEventTimingFlag(" << m_eventByEventTimingHistRecord
83  << "), m_dumpVcdFile(" << m_dumpVcdFile
84  << "), m_bitConditionToDumpVcd(" << m_bitConditionToDumpVcd
85  << "), m_vcdEventStart(" << m_vcdEventStart
86  << "), m_vcdNumberOfEvents(" << m_vcdNumberOfEvents);
87 
88 
89 }
90 
92 {
93  oldDir = gDirectory;
94  dirDQM = gDirectory;
95  oldDir->mkdir("TRGGDL");
96  dirDQM->cd("TRGGDL");
97 
98  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
99  h_c8_gdlL1TocomL1[iskim] = new TH1I(Form("hGDL_gdlL1TocomL1_%s", skim_smap[iskim].c_str()), "comL1 - gdlL1 [clk8ns]", 100, 0,
100  100);
101  h_c8_gdlL1TocomL1[iskim]->GetXaxis()->SetTitle("clk8ns");
102 
103  h_c8_topTogdlL1[iskim] = new TH1I(Form("hGDL_topTogdlL1_%s", skim_smap[iskim].c_str()), "gdlL1 - top_timing [clk8ns]", 700, 0,
104  700);
105  h_c8_topTogdlL1[iskim]->GetXaxis()->SetTitle("clk8ns");
106  h_c8_eclTogdlL1[iskim] = new TH1I(Form("hGDL_eclTogdlL1_%s", skim_smap[iskim].c_str()), "gdlL1 - ecl_timing [clk8ns]", 500, 0,
107  500);
108  h_c8_eclTogdlL1[iskim]->GetXaxis()->SetTitle("clk8ns");
109  h_c8_cdcTogdlL1[iskim] = new TH1I(Form("hGDL_cdcTogdlL1_%s", skim_smap[iskim].c_str()), "gdlL1 - cdc_timing [clk8ns]", 700, 0,
110  700);
111  h_c8_cdcTogdlL1[iskim]->GetXaxis()->SetTitle("clk8ns");
112 
113  h_c8_ecl8mToGDL[iskim] = new TH1I(Form("hGDL_ecl8mToGDL_%s", skim_smap[iskim].c_str()), "gdlIn^{8MHz} - ecl_timing [clk8ns]",
114  500, 0, 500);
115  h_c8_ecl8mToGDL[iskim]->GetXaxis()->SetTitle("clk8ns");
116  h_c8_topToGDL[iskim] = new TH1I(Form("hGDL_topToGDL_%s", skim_smap[iskim].c_str()), "gdlIn - top_timing [clk8ns]", 700, 0,
117  700);
118  h_c8_topToGDL[iskim]->GetXaxis()->SetTitle("clk8ns");
119  h_c8_eclToGDL[iskim] = new TH1I(Form("hGDL_eclToGDL_%s", skim_smap[iskim].c_str()), "gdlIn - ecl_timing [clk8ns]", 500, 0,
120  500);
121  h_c8_eclToGDL[iskim]->GetXaxis()->SetTitle("clk8ns");
122  h_c8_cdcToGDL[iskim] = new TH1I(Form("hGDL_cdcToGDL_%s", skim_smap[iskim].c_str()), "gdlIn - cdc_timing [clk8ns]", 700, 0,
123  700);
124  h_c8_cdcToGDL[iskim]->GetXaxis()->SetTitle("clk8ns");
125 
126  h_c2_cdcTocomL1[iskim] = new TH1I(Form("hGDL_cdcTocomL1_%s", skim_smap[iskim].c_str()), "comL1 - cdc_timing [clk2ns]", 520, 0,
127  5200);
128  h_c2_cdcTocomL1[iskim]->GetXaxis()->SetTitle("clk2ns");
129  h_ns_cdcTocomL1[iskim] = new TH1D(Form("hGDL_ns_cdcTocomL1_%s", skim_smap[iskim].c_str()), "comL1 - cdc_timing [ns]", 2600, 0,
130  10400);
131  h_ns_cdcTocomL1[iskim]->GetXaxis()->SetTitle("ns");
132  h_ns_cdcTocomL1[iskim]->GetYaxis()->SetTitle("evt / 4ns");
133  h_ns_cdcTogdlL1[iskim] = new TH1D(Form("hGDL_ns_cdcTogdlL1_%s", skim_smap[iskim].c_str()), "gdlL1 - cdc_timing [ns]", 2600, 0,
134  10400);
135  h_ns_cdcTogdlL1[iskim]->GetXaxis()->SetTitle("ns");
136  h_ns_cdcTogdlL1[iskim]->GetYaxis()->SetTitle("evt / 4ns");
137 
138  h_ns_topToecl[iskim] = new TH1D(Form("hGDL_ns_topToecl_%s", skim_smap[iskim].c_str()), "ecl_timing - top_timing [ns]", 800, 0,
139  4000);
140  h_ns_topToecl[iskim]->GetXaxis()->SetTitle("ns");
141  h_ns_topToecl[iskim]->GetYaxis()->SetTitle("evt / 5ns");
142  h_ns_topTocdc[iskim] = new TH1D(Form("hGDL_ns_topTocdc_%s", skim_smap[iskim].c_str()), "cdc_timing - top_timing [ns]", 800, 0,
143  4000);
144  h_ns_topTocdc[iskim]->GetXaxis()->SetTitle("ns");
145  h_ns_topTocdc[iskim]->GetYaxis()->SetTitle("evt / 5ns");
146  h_ns_cdcToecl[iskim] = new TH1D(Form("hGDL_ns_cdcToecl_%s", skim_smap[iskim].c_str()), "ecl_timing - cdc_timing [ns]", 2000, 0,
147  4000);
148  h_ns_cdcToecl[iskim]->GetXaxis()->SetTitle("ns");
149  h_ns_cdcToecl[iskim]->GetYaxis()->SetTitle("evt / 2ns");
150 
151  h_c2_cdcToecl[iskim] = new TH1I(Form("hGDL_cdcToecl_%s", skim_smap[iskim].c_str()), "ecl_timing - cdc_timing [clk2ns]", 1000, 0,
152  2000);
153  h_c2_cdcToecl[iskim]->GetXaxis()->SetTitle("clk2ns");
154 
155  h_timtype[iskim] = new TH1I(Form("hGDL_timtype_%s", skim_smap[iskim].c_str()), "timtype", 7, 0, 7);
156 
157  h_itd[iskim] = new TH1I(Form("hGDL_itd_%s", skim_smap[iskim].c_str()), "itd", n_inbit + 1, -1, n_inbit);
158  h_ftd[iskim] = new TH1I(Form("hGDL_ftd_%s", skim_smap[iskim].c_str()), "ftd", n_outbit + 1, -1, n_outbit);
159  h_psn[iskim] = new TH1I(Form("hGDL_psn_%s", skim_smap[iskim].c_str()), "psn", n_outbit + 1, -1, n_outbit);
160  // output extra
161  h_psn_extra[iskim] = new TH1I(Form("hGDL_psn_extra_%s", skim_smap[iskim].c_str()), "psn extra", n_output_extra, 0, n_output_extra);
162  for (int i = 0; i < n_output_extra; i++) {
163  h_psn_extra[iskim]->GetXaxis()->SetBinLabel(i + 1, output_extra[i]);
164  }
165  // output overlap
166  h_psn_overlap[iskim] = new TH1I(Form("hGDL_psn_overlap_%s", skim_smap[iskim].c_str()), "psn overlap", n_output_overlap, 0,
167  n_output_overlap);
168  for (int i = 0; i < n_output_overlap; i++) {
169  h_psn_overlap[iskim]->GetXaxis()->SetBinLabel(i + 1, output_overlap[i]);
170  }
171  // output no overlap
172  h_psn_nooverlap[iskim] = new TH1I(Form("hGDL_psn_nooverlap_%s", skim_smap[iskim].c_str()), "psn nooverlap", n_output_overlap, 0,
173  n_output_overlap);
174  for (int i = 0; i < n_output_overlap; i++) {
175  h_psn_nooverlap[iskim]->GetXaxis()->SetBinLabel(i + 1, output_overlap[i]);
176  }
177  // output pure extra
178  h_psn_pure_extra[iskim] = new TH1I(Form("hGDL_psn_pure_extra_%s", skim_smap[iskim].c_str()), "psn pure extra", n_output_pure_extra,
179  0, n_output_pure_extra);
180  for (int i = 0; i < n_output_pure_extra; i++) {
181  h_psn_pure_extra[iskim]->GetXaxis()->SetBinLabel(i + 1, output_pure_extra[i]);
182  }
183  // efficiency
184  h_eff[iskim] = new TH1D(Form("hGDL_eff_%s", skim_smap[iskim].c_str()), "efficiency", n_eff, 0, n_eff);
185  for (int i = 0; i < n_eff; i++) {
186  h_eff[iskim]->GetXaxis()->SetBinLabel(i + 1, c_eff[i]);
187  }
188  h_pure_eff[iskim] = new TH1D(Form("hGDL_pure_eff_%s", skim_smap[iskim].c_str()), "efficiency wrt. offline", n_pure_eff, 0,
189  n_pure_eff);
190  for (int i = 0; i < n_pure_eff; i++) {
191  h_pure_eff[iskim]->GetXaxis()->SetBinLabel(i + 1, c_pure_eff[i]);
192  h_pure_eff[iskim]->GetXaxis()->SetLabelSize(0.05);
193  }
194  for (unsigned i = 0; i < n_inbit; i++) {
195  if (m_bitNameOnBinLabel) {
196  h_itd[iskim]->GetXaxis()->SetBinLabel(h_itd[iskim]->GetXaxis()->FindBin(i + 0.5), inbitname[i]);
197  h_ftd[iskim]->GetXaxis()->SetBinLabel(h_ftd[iskim]->GetXaxis()->FindBin(i + 0.5), outbitname[i]);
198  h_psn[iskim]->GetXaxis()->SetBinLabel(h_psn[iskim]->GetXaxis()->FindBin(i + 0.5), outbitname[i]);
199  }
200  }
201 
202  //reduce #plot
203  if (iskim != 0)continue;
204 
205  // rise/fall
206  for (unsigned i = 0; i < n_inbit; i++) {
207  h_itd_rise[i][iskim] = new TH1I(Form("hGDL_itd_%s_rise_%s", inbitname[i], skim_smap[iskim].c_str()),
208  Form("itd%d(%s) rising", i, inbitname[i]), 48, 0, 48);
209  h_itd_rise[i][iskim]->SetLineColor(kRed);
210  h_itd_fall[i][iskim] = new TH1I(Form("hGDL_itd_%s_fall_%s", inbitname[i], skim_smap[iskim].c_str()),
211  Form("itd%d(%s) falling", i, inbitname[i]), 48, 0, 48);
212  h_itd_fall[i][iskim]->SetLineColor(kGreen);
213  }
214  for (unsigned i = 0; i < n_outbit; i++) {
215  h_ftd[iskim]->GetXaxis()->SetBinLabel(h_ftd[iskim]->GetXaxis()->FindBin(i + 0.5), outbitname[i]);
216  h_ftd_rise[i][iskim] = new TH1I(Form("hGDL_ftd_%s_rise_%s", outbitname[i], skim_smap[iskim].c_str()),
217  Form("ftd%d(%s) rising", i, outbitname[i]), 48, 0, 48);
218  h_ftd_rise[i][iskim]->SetLineColor(kRed);
219  h_ftd_fall[i][iskim] = new TH1I(Form("hGDL_ftd_%s_fall_%s", outbitname[i], skim_smap[iskim].c_str()),
220  Form("ftd%d(%s) falling", i, outbitname[i]), 48, 0, 48);
221  h_ftd_fall[i][iskim]->SetLineColor(kGreen);
222  h_psn[iskim]->GetXaxis()->SetBinLabel(h_psn[iskim]->GetXaxis()->FindBin(i + 0.5), outbitname[i]);
223  h_psn_rise[i][iskim] = new TH1I(Form("hGDL_psn_%s_rise_%s", outbitname[i], skim_smap[iskim].c_str()),
224  Form("psn%d(%s) rising", i, outbitname[i]), 48, 0, 48);
225  h_psn_rise[i][iskim]->SetLineColor(kRed);
226  h_psn_fall[i][iskim] = new TH1I(Form("hGDL_psn_%s_fall_%s", outbitname[i], skim_smap[iskim].c_str()),
227  Form("psn%d(%s) falling", i, outbitname[i]), 48, 0, 48);
228  h_psn_fall[i][iskim]->SetLineColor(kGreen);
229  }
230  }
231 
232  if (m_skim != 0) {
233  h_eff_shifter = new TH1D(Form("hGDL_eff_shifter"), "efficiency", n_eff_shifter, 0, n_eff_shifter);
234  for (int i = 0; i < n_eff_shifter; i++) {
235  h_eff_shifter->GetXaxis()->SetBinLabel(i + 1, c_eff_shifter[i]);
236  }
237  h_eff_shifter->SetMaximum(1.2);
238  h_eff_shifter->SetMinimum(0);
239  h_eff_shifter->GetXaxis()->SetLabelSize(0.05);
240  }
241  oldDir->cd();
242 }
243 
245 {
246 
247  dirDQM->cd();
248 
249  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
250  h_c8_gdlL1TocomL1[iskim]->Reset();
251  h_c8_topTogdlL1[iskim]->Reset();
252  h_c8_eclTogdlL1[iskim]->Reset();
253  h_c8_cdcTogdlL1[iskim]->Reset();
254  h_c8_ecl8mToGDL[iskim]->Reset();
255  h_c8_topToGDL[iskim]->Reset();
256  h_c8_eclToGDL[iskim]->Reset();
257  h_c8_cdcToGDL[iskim]->Reset();
258  h_c2_cdcTocomL1[iskim]->Reset();
259  h_ns_cdcTocomL1[iskim]->Reset();
260  h_ns_cdcTogdlL1[iskim]->Reset();
261  h_ns_topToecl[iskim]->Reset();
262  h_ns_topTocdc[iskim]->Reset();
263  h_c2_cdcToecl[iskim]->Reset();
264  h_ns_cdcToecl[iskim]->Reset();
265  h_itd[iskim]->Reset();
266  h_ftd[iskim]->Reset();
267  h_psn[iskim]->Reset();
268  h_psn_extra[iskim]->Reset();
269  h_psn_pure_extra[iskim]->Reset();
270  h_eff[iskim]->Reset();
271  h_pure_eff[iskim]->Reset();
272  h_timtype[iskim]->Reset();
273  }
274  if (m_skim != 0) {
275  h_eff_shifter->Reset();
276  }
277 
278  oldDir->cd();
279 }
280 
282 {
283 
284  if (m_skim == 0) { //no skim
285  start_skim_gdldqm = 0;
286  end_skim_gdldqm = 1;
287  } else if (m_skim == 1) { //skim
288  start_skim_gdldqm = 1;
289  end_skim_gdldqm = nskim_gdldqm;
290  } else { //no skim + skim
291  start_skim_gdldqm = 0;
292  end_skim_gdldqm = nskim_gdldqm;
293  }
294 
296  _exp = bevt->getExperiment();
297  _run = bevt->getRun();
298 
299  m_ECLCalDigitData.registerInDataStore();
300  m_ECLDigitData.registerInDataStore();
301  trgeclmap = new TrgEclMapping();
302 
303  // calls back the defineHisto() function, but the HistoManager module has to be in the path
304  REG_HISTOGRAM
305 
306  for (int i = 0; i < 320; i++) {
307  LeafBitMap[i] = m_unpacker->getLeafMap(i);
308  }
309  for (int i = 0; i < 320; i++) {
310  strcpy(LeafNames[i], m_unpacker->getLeafnames(i));
311  }
312  _e_timtype = 0;
313  _e_gdll1rvc = 0;
314  _e_coml1rvc = 0;
315  _e_toptiming = 0;
316  _e_ecltiming = 0;
317  _e_cdctiming = 0;
318  _e_toprvc = 0;
319  _e_eclrvc = 0;
320  _e_cdcrvc = 0;
321  for (int i = 0; i < 10; i++) {
322  ee_psn[i] = {0};
323  ee_ftd[i] = {0};
324  ee_itd[i] = {0};
325  }
326  for (int i = 0; i < 320; i++) {
327  if (strcmp(LeafNames[i], "timtype") == 0) _e_timtype = LeafBitMap[i];
328  if (strcmp(LeafNames[i], "gdll1rvc") == 0) _e_gdll1rvc = LeafBitMap[i];
329  if (strcmp(LeafNames[i], "coml1rvc") == 0) _e_coml1rvc = LeafBitMap[i];
330  if (strcmp(LeafNames[i], "toptiming") == 0)_e_toptiming = LeafBitMap[i];
331  if (strcmp(LeafNames[i], "ecltiming") == 0)_e_ecltiming = LeafBitMap[i];
332  if (strcmp(LeafNames[i], "cdctiming") == 0)_e_cdctiming = LeafBitMap[i];
333  if (strcmp(LeafNames[i], "toprvc") == 0) _e_toprvc = LeafBitMap[i];
334  if (strcmp(LeafNames[i], "eclrvc") == 0) _e_eclrvc = LeafBitMap[i];
335  if (strcmp(LeafNames[i], "cdcrvc") == 0) _e_cdcrvc = LeafBitMap[i];
336  if (strcmp(LeafNames[i], "psn0") == 0) ee_psn[0] = LeafBitMap[i];
337  if (strcmp(LeafNames[i], "psn1") == 0) ee_psn[1] = LeafBitMap[i];
338  if (strcmp(LeafNames[i], "psn2") == 0) ee_psn[2] = LeafBitMap[i];
339  if (strcmp(LeafNames[i], "psn3") == 0) ee_psn[3] = LeafBitMap[i];
340  if (strcmp(LeafNames[i], "psn4") == 0) ee_psn[4] = LeafBitMap[i];
341  if (strcmp(LeafNames[i], "psn5") == 0) ee_psn[5] = LeafBitMap[i];
342  if (strcmp(LeafNames[i], "psn6") == 0) ee_psn[6] = LeafBitMap[i];
343  if (strcmp(LeafNames[i], "psn7") == 0) ee_psn[7] = LeafBitMap[i];
344  if (strcmp(LeafNames[i], "psn8") == 0) ee_psn[8] = LeafBitMap[i];
345  if (strcmp(LeafNames[i], "psn9") == 0) ee_psn[9] = LeafBitMap[i];
346  if (strcmp(LeafNames[i], "ftd0") == 0) ee_ftd[0] = LeafBitMap[i];
347  if (strcmp(LeafNames[i], "ftd1") == 0) ee_ftd[1] = LeafBitMap[i];
348  if (strcmp(LeafNames[i], "ftd2") == 0) ee_ftd[2] = LeafBitMap[i];
349  if (strcmp(LeafNames[i], "ftd3") == 0) ee_ftd[3] = LeafBitMap[i];
350  if (strcmp(LeafNames[i], "ftd4") == 0) ee_ftd[4] = LeafBitMap[i];
351  if (strcmp(LeafNames[i], "ftd5") == 0) ee_ftd[5] = LeafBitMap[i];
352  if (strcmp(LeafNames[i], "ftd6") == 0) ee_ftd[6] = LeafBitMap[i];
353  if (strcmp(LeafNames[i], "ftd7") == 0) ee_ftd[7] = LeafBitMap[i];
354  if (strcmp(LeafNames[i], "ftd8") == 0) ee_ftd[8] = LeafBitMap[i];
355  if (strcmp(LeafNames[i], "ftd9") == 0) ee_ftd[9] = LeafBitMap[i];
356  if (strcmp(LeafNames[i], "itd0") == 0) ee_itd[0] = LeafBitMap[i];
357  if (strcmp(LeafNames[i], "itd1") == 0) ee_itd[1] = LeafBitMap[i];
358  if (strcmp(LeafNames[i], "itd2") == 0) ee_itd[2] = LeafBitMap[i];
359  if (strcmp(LeafNames[i], "itd3") == 0) ee_itd[3] = LeafBitMap[i];
360  if (strcmp(LeafNames[i], "itd4") == 0) ee_itd[4] = LeafBitMap[i];
361  if (strcmp(LeafNames[i], "itd5") == 0) ee_itd[5] = LeafBitMap[i];
362  if (strcmp(LeafNames[i], "itd6") == 0) ee_itd[6] = LeafBitMap[i];
363  if (strcmp(LeafNames[i], "itd7") == 0) ee_itd[7] = LeafBitMap[i];
364  if (strcmp(LeafNames[i], "itd8") == 0) ee_itd[8] = LeafBitMap[i];
365  if (strcmp(LeafNames[i], "itd9") == 0) ee_itd[9] = LeafBitMap[i];
366  }
367 
368  n_inbit = m_dbinput->getninbit();
369  n_outbit = m_dbftdl ->getnoutbit();
370  for (int i = 0; i < 320; i++) {
371  strcpy(inbitname[i], m_dbinput->getinbitname(i));
372  }
373  for (int i = 0; i < 320; i++) {
374  strcpy(outbitname[i], m_dbftdl->getoutbitname(i));
375  }
376 
377 }
378 
380 {
381  if (m_generatePostscript) {
382  TPostScript* ps = new TPostScript(m_postScriptName.c_str(), 112);
383  gStyle->SetOptStat(0);
384  TCanvas c1("c1", "", 0, 0, 500, 300);
385  c1.cd();
386 
387  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
388 
389  h_itd[iskim]->GetXaxis()->SetRange(h_itd[iskim]->GetXaxis()->FindBin(0.5),
390  h_itd[iskim]->GetXaxis()->FindBin(n_inbit - 0.5));
391  h_itd[iskim]->Draw();
392  c1.Update();
393  h_ftd[iskim]->GetXaxis()->SetRange(h_ftd[iskim]->GetXaxis()->FindBin(0.5),
394  h_ftd[iskim]->GetXaxis()->FindBin(n_outbit - 0.5));
395  h_ftd[iskim]->Draw();
396  c1.Update();
397  h_psn[iskim]->GetXaxis()->SetRange(h_psn[iskim]->GetXaxis()->FindBin(0.5),
398  h_psn[iskim]->GetXaxis()->FindBin(n_outbit - 0.5));
399  h_psn[iskim]->Draw();
400  c1.Update();
401  h_ftd[iskim]->SetTitle("ftd(green), psnm(red)");
402  h_ftd[iskim]->SetFillColor(kGreen);
403  h_ftd[iskim]->SetBarWidth(0.4);
404  h_ftd[iskim]->Draw("bar");
405  h_psn[iskim]->SetFillColor(kRed);
406  h_psn[iskim]->SetBarWidth(0.4);
407  h_psn[iskim]->SetBarOffset(0.5);
408  h_psn[iskim]->Draw("bar,same");
409 
410  c1.Update();
411  h_timtype[iskim]->Draw();
412  c1.Update();
413  h_c8_gdlL1TocomL1[iskim]->Draw();
414  c1.Update();
415  h_c8_topTogdlL1[iskim]->Draw();
416  c1.Update();
417  h_c8_eclTogdlL1[iskim]->Draw();
418  c1.Update();
419  h_c8_cdcTogdlL1[iskim]->Draw();
420  c1.Update();
421  h_c8_ecl8mToGDL[iskim]->Draw();
422  c1.Update();
423  h_c8_topToGDL[iskim]->Draw();
424  c1.Update();
425  h_c8_eclToGDL[iskim]->Draw();
426  c1.Update();
427  h_c8_cdcToGDL[iskim]->Draw();
428  c1.Update();
429  h_c2_cdcTocomL1[iskim]->Draw();
430  c1.Update();
431  h_ns_cdcTocomL1[iskim]->Draw();
432  c1.Update();
433  h_ns_cdcTogdlL1[iskim]->Draw();
434  c1.Update();
435  h_ns_topToecl[iskim]->Draw();
436  c1.Update();
437  h_ns_topTocdc[iskim]->Draw();
438  c1.Update();
439  h_c2_cdcToecl[iskim]->Draw();
440  c1.Update();
441  h_ns_cdcToecl[iskim]->Draw();
442  c1.Update();
443 
444  //reduce #plot
445  if (iskim != 0)continue;
446  for (unsigned i = 0; i < n_inbit; i++) {
447 
448  h_itd_rise[i][iskim]->SetTitle(Form("itd%d(%s) rising(red), falling(green)",
449  i, inbitname[i]));
450  h_itd_rise[i][iskim]->Draw();
451  h_itd_fall[i][iskim]->Draw("same");
452  c1.Update();
453  }
454 
455  }
456 
457  ps->Close();
458  }
459 }
460 
462 {
463  /* cppcheck-suppress variableScope */
464  static unsigned nvcd = 0;
465  static bool begin_run = true;
466 
467  int n_leafs = 0;
468  n_leafs = m_unpacker->getnLeafs();
469  int n_leafsExtra = 0;
470  n_leafsExtra = m_unpacker->getnLeafsExtra();
471  n_clocks = m_unpacker->getnClks();
472  int nconf = m_unpacker->getconf();
473  int nword_input = m_unpacker->get_nword_input();
474  const int nword_output = m_unpacker->get_nword_output();
475  skim.clear();
476 
478  if (!entAry || !entAry.getEntries()) {
479  return;
480  }
481 
482  //Get skim type from SoftwareTriggerResult
483  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
484  if (iskim == 0) skim.push_back(iskim);
485  }
487  if (result_soft.isValid()) {
488  const std::map<std::string, int>& skim_map = result_soft->getResults();
489  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
490  if (iskim == 0);
491  else if (skim_map.find(skim_menu[iskim]) != skim_map.end()) {
492  const bool accepted = (result_soft->getResult(skim_menu[iskim]) == SoftwareTriggerCutResult::c_accept);
493  if (accepted) skim.push_back(iskim);
494  }
495  }
496  }
497 
498 
499  //prepare entAry adress
500  int clk_map = 0;
501  for (int i = 0; i < 320; i++) {
502  if (strcmp(entAry[0]->m_unpackername[i], "evt") == 0) evtno = entAry[0]->m_unpacker[i];
503  if (strcmp(entAry[0]->m_unpackername[i], "clk") == 0) clk_map = i;
504  }
505 
506  const double clkTo2ns = 1. / .508877;
507  const double clkTo1ns = 0.5 / .508877;
508  TH2I* h_0;
509 
510  dirDQM->cd();
511 
512 
513  h_0 = new TH2I(Form("hgdl%08d", evtno), "", n_clocks, 0, n_clocks, n_leafs + n_leafsExtra, 0,
514  n_leafs + n_leafsExtra);
515  h_p = new TH2I(Form("hpsn%08d", evtno), "", n_clocks, 0, n_clocks, n_outbit, 0, n_outbit);
516  h_f = new TH2I(Form("hftd%08d", evtno), "", n_clocks, 0, n_clocks, n_outbit, 0, n_outbit);
517  h_i = new TH2I(Form("hitd%08d", evtno), "", n_clocks, 0, n_clocks, n_inbit, 0, n_inbit);
518  for (unsigned i = 0; i < n_inbit; i++) {
519  h_i->GetYaxis()->SetBinLabel(i + 1, inbitname[i]);
520  }
521  for (unsigned i = 0; i < n_outbit; i++) {
522  h_f->GetYaxis()->SetBinLabel(i + 1, outbitname[i]);
523  h_p->GetYaxis()->SetBinLabel(i + 1, outbitname[i]);
524  }
525 
526 
527  oldDir->cd();
528 
529  // fill "bit vs clk" for the event
530  for (int ii = 0; ii < entAry.getEntries(); ii++) {
531  std::vector<int*> Bits(n_leafs + n_leafsExtra);
532  //set pointer
533  for (int i = 0; i < 320; i++) {
534  if (LeafBitMap[i] != -1) {
535  Bits[LeafBitMap[i]] = &(entAry[ii]->m_unpacker[i]);
536  }
537  }
538  for (int leaf = 0; leaf < n_leafs + n_leafsExtra; leaf++) {
539  h_0->SetBinContent(entAry[ii]->m_unpacker[clk_map] + 1, leaf + 1, *Bits[leaf]);
540  }
541  }
542  for (int leaf = 0; leaf < 320; leaf++) {
543  if (LeafBitMap[leaf] != -1)h_0->GetYaxis()->SetBinLabel(LeafBitMap[leaf] + 1, LeafNames[LeafBitMap[leaf]]);
544  }
545 
546  int coml1rvc = h_0->GetBinContent(1, 1 + _e_coml1rvc);
547  int toprvc = h_0->GetBinContent(1, 1 + _e_toprvc);
548  int eclrvc = h_0->GetBinContent(1, 1 + _e_eclrvc);
549  int cdcrvc = h_0->GetBinContent(1, 1 + _e_cdcrvc);
550  int c1_top_timing = h_0->GetBinContent(n_clocks, 1 + _e_toptiming);
551  int c1_ecl_timing = h_0->GetBinContent(n_clocks, 1 + _e_ecltiming);
552  int c1_cdc_timing = h_0->GetBinContent(n_clocks, 1 + _e_cdctiming);
553  int c8_top_timing = c1_top_timing >> 3;
554  int c2_top_timing = c1_top_timing >> 1;
555  int c8_ecl_timing = c1_ecl_timing >> 3;
556  int c2_ecl_timing = c1_ecl_timing >> 1;
557  int c8_cdc_timing = c1_cdc_timing >> 3;
558  int c2_cdc_timing = c1_cdc_timing >> 1;
559 
560  if (begin_run) {
561  B2DEBUG(20, "nconf(" << nconf
562  << "), n_clocks(" << n_clocks
563  << "), n_leafs(" << n_leafs
564  << "), n_leafsExtra(" << n_leafsExtra
565  << ")");
566  begin_run = false;
567  }
568 
569  int psn[10] = {0};
570  int ftd[10] = {0};
571  int itd[10] = {0};
572  int timtype = 0;
573 
574 
575  int gdll1_rvc = h_0->GetBinContent(h_0->GetXaxis()->FindBin(n_clocks - 0.5), 1 + _e_gdll1rvc);
576 
577  // fill event by event timing histogram and get time integrated bit info
578  for (unsigned clk = 1; clk <= n_clocks; clk++) {
579  int psn_tmp[10] = {0};
580  int ftd_tmp[10] = {0};
581  int itd_tmp[10] = {0};
582  for (unsigned j = 0; j < (unsigned)nword_input; j++) {
583  itd_tmp[j] = h_0->GetBinContent(clk, 1 + ee_itd[j]);
584  itd[j] |= itd_tmp[j];
585  for (int i = 0; i < 32; i++) {
586  if (itd_tmp[j] & (1 << i)) h_i->SetBinContent(clk, i + 1 + j * 32, 1);
587  }
588  }
589  if (nconf == 0) {
590  psn_tmp[0] = h_0->GetBinContent(clk, 1 + ee_psn[0]);
591  ftd_tmp[0] = h_0->GetBinContent(clk, 1 + ee_ftd[0]);
592  psn[0] |= psn_tmp[0];
593  ftd[0] |= ftd_tmp[0];
594  for (int i = 0; i < 32; i++) {
595  if (psn_tmp[0] & (1 << i)) h_p->SetBinContent(clk, i + 1, 1);
596  if (ftd_tmp[0] & (1 << i)) h_f->SetBinContent(clk, i + 1, 1);
597  }
598  psn_tmp[1] = h_0->GetBinContent(clk, 1 + ee_psn[2]) * (1 << 16) + h_0->GetBinContent(clk, 1 + ee_psn[1]);
599  ftd_tmp[1] = h_0->GetBinContent(clk, 1 + ee_ftd[2]) * (1 << 16) + h_0->GetBinContent(clk, 1 + ee_ftd[1]);
600  psn[1] |= psn_tmp[1];
601  ftd[1] |= ftd_tmp[1];
602  for (int i = 0; i < 32; i++) {
603  if (psn_tmp[1] & (1 << i)) h_p->SetBinContent(clk, i + 1 + 32, 1);
604  if (ftd_tmp[1] & (1 << i)) h_f->SetBinContent(clk, i + 1 + 32, 1);
605  }
606  } else {
607  for (unsigned j = 0; j < (unsigned)nword_output; j++) {
608  psn_tmp[j] = h_0->GetBinContent(clk, 1 + ee_psn[j]);
609  ftd_tmp[j] = h_0->GetBinContent(clk, 1 + ee_ftd[j]);
610  psn[j] |= psn_tmp[j];
611  ftd[j] |= ftd_tmp[j];
612  for (int i = 0; i < 32; i++) {
613  if (psn_tmp[j] & (1 << i)) h_p->SetBinContent(clk, i + 1 + j * 32, 1);
614  if (ftd_tmp[j] & (1 << i)) h_f->SetBinContent(clk, i + 1 + j * 32, 1);
615  }
616  }
617  }
618  int timtype_tmp = h_0->GetBinContent(clk, 1 + _e_timtype);
619  timtype = (timtype_tmp == 0) ? timtype : timtype_tmp;
620 
621  } // clk
622 
623  // fill rising and falling edges
624  fillRiseFallTimings();
625  // fill Output_extra for efficiency study
626  fillOutputExtra();
627  // fill Output_overlap for trigger rate study
628  fillOutputOverlap();
629  // fill Output for high purity efficiency study
630  if (m_skim != 1) {
631  fillOutputPureExtra();
632  }
633 
634  // fill summary histograms
635  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
636  h_timtype[skim[ifill]]->Fill(timtype);
637  h_itd[skim[ifill]]->Fill(-0.5);
638  h_ftd[skim[ifill]]->Fill(-0.5);
639  h_psn[skim[ifill]]->Fill(-0.5);
640  for (int i = 0; i < 32; i++) {
641  for (unsigned j = 0; j < (unsigned)nword_input; j++) {
642  if (itd[j] & (1 << i)) h_itd[skim[ifill]]->Fill(i + 0.5 + 32 * j);
643  }
644  for (unsigned j = 0; j < (unsigned)nword_output; j++) {
645  if (ftd[j] & (1 << i)) h_ftd[skim[ifill]]->Fill(i + 0.5 + 32 * j);
646  if (psn[j] & (1 << i)) h_psn[skim[ifill]]->Fill(i + 0.5 + 32 * j);
647  }
648  }
649 
650  // fill timestamp values stored in header
651  int gdlL1TocomL1 = gdll1_rvc < coml1rvc ? coml1rvc - gdll1_rvc : (coml1rvc + 1280) - gdll1_rvc;
652  h_c8_gdlL1TocomL1[skim[ifill]]->Fill(gdlL1TocomL1);
653 
654  int topTogdlL1 = gdll1_rvc < c8_top_timing ? (gdll1_rvc + 1280) - c8_top_timing : gdll1_rvc - c8_top_timing;
655  h_c8_topTogdlL1[skim[ifill]]->Fill(topTogdlL1);
656 
657  int eclTogdlL1 = gdll1_rvc < c8_ecl_timing ? (gdll1_rvc + 1280) - c8_ecl_timing : gdll1_rvc - c8_ecl_timing;
658  h_c8_eclTogdlL1[skim[ifill]]->Fill(eclTogdlL1);
659 
660  int cdcTogdlL1 = gdll1_rvc < c8_cdc_timing ? (gdll1_rvc + 1280) - c8_cdc_timing : gdll1_rvc - c8_cdc_timing;
661  h_c8_cdcTogdlL1[skim[ifill]]->Fill(cdcTogdlL1);
662 
663  int c127_ecl_timing = c8_ecl_timing & (((1 << 7) - 1) << 4);
664  int fit8mToGDL = c127_ecl_timing < eclrvc ? eclrvc - c127_ecl_timing : (eclrvc + 1280) - c127_ecl_timing;
665  h_c8_ecl8mToGDL[skim[ifill]]->Fill(fit8mToGDL);
666 
667  int topToGDL = c8_top_timing < toprvc ? toprvc - c8_top_timing : (toprvc + 1280) - c8_top_timing;
668  h_c8_topToGDL[skim[ifill]]->Fill(topToGDL);
669  int eclToGDL = c8_ecl_timing < eclrvc ? eclrvc - c8_ecl_timing : (eclrvc + 1280) - c8_ecl_timing;
670  h_c8_eclToGDL[skim[ifill]]->Fill(eclToGDL);
671  int cdcToGDL = c8_cdc_timing < cdcrvc ? cdcrvc - c8_cdc_timing : (cdcrvc + 1280) - c8_cdc_timing;
672  h_c8_cdcToGDL[skim[ifill]]->Fill(cdcToGDL);
673 
674  int c2_comL1 = coml1rvc << 2;
675  int c2_gdlL1 = gdll1_rvc << 2;
676  int c2_diff_cdcTogdlL1 = c2_gdlL1 > c2_cdc_timing ?
677  c2_gdlL1 - c2_cdc_timing :
678  c2_gdlL1 - c2_cdc_timing + (1280 << 2) ;
679  h_ns_cdcTogdlL1[skim[ifill]]->Fill(c2_diff_cdcTogdlL1 * clkTo2ns);
680 
681  int c2_diff_cdcTocomL1 = c2_comL1 > c2_cdc_timing ?
682  c2_comL1 - c2_cdc_timing :
683  c2_comL1 - c2_cdc_timing + (1280 << 2) ;
684  h_c2_cdcTocomL1[skim[ifill]]->Fill(c2_diff_cdcTocomL1);
685  h_ns_cdcTocomL1[skim[ifill]]->Fill(c2_diff_cdcTocomL1 * clkTo2ns);
686 
687  int c2_diff_cdcToecl = c2_ecl_timing > c2_cdc_timing ?
688  c2_ecl_timing - c2_cdc_timing :
689  c2_ecl_timing - c2_cdc_timing + (1280 << 2);
690  h_c2_cdcToecl[skim[ifill]]->Fill(c2_diff_cdcToecl);
691  h_ns_cdcToecl[skim[ifill]]->Fill(c2_diff_cdcToecl * clkTo2ns);
692 
693  int c1_diff_topToecl = c1_ecl_timing > c1_top_timing ?
694  c1_ecl_timing - c1_top_timing :
695  c1_ecl_timing - c1_top_timing + (1280 << 3);
696  h_ns_topToecl[skim[ifill]]->Fill(c1_diff_topToecl * clkTo1ns);
697 
698  int c2_diff_topTocdc = c2_cdc_timing > c2_top_timing ?
699  c2_cdc_timing - c2_top_timing :
700  c2_cdc_timing - c2_top_timing + (1280 << 2);
701  h_ns_topTocdc[skim[ifill]]->Fill(c2_diff_topTocdc * clkTo2ns);
702  }
703 
704 
705  // vcd dump
706  if (m_dumpVcdFile) {
707  if (anaBitCondition()) {
708  nvcd++;
709  B2DEBUG(20, "anaBitCondition fired, evt(" << evtno << ")");
710  if (m_vcdEventStart <= nvcd && nvcd < m_vcdEventStart + m_vcdNumberOfEvents) {
711  genVcd();
712  }
713  }
714  }
715 
716  // discard event by event histograms
717  if (! m_eventByEventTimingHistRecord) {
718  h_0->Delete();
719  h_p->Delete();
720  h_f->Delete();
721  h_i->Delete();
722  }
723 }
724 
725 bool TRGGDLDQMModule::anaBitCondition(void)
726 {
727  if (m_bitConditionToDumpVcd.length() == 0) return true;
728  const char* cst = m_bitConditionToDumpVcd.c_str();
729  bool reading_word = false;
730  bool result_the_term = true; // init value must be true
731  bool not_flag = false;
732  unsigned begin_word = 0;
733  unsigned word_length = 0;
734  // notation steeing side must follow
735  // no blank between '!' and word
736  for (unsigned i = 0; i < m_bitConditionToDumpVcd.length(); i++) {
737  if (('a' <= cst[i] && cst[i] <= 'z') ||
738  ('A' <= cst[i] && cst[i] <= 'Z') ||
739  ('_' == cst[i]) || ('!' == cst[i]) ||
740  ('0' <= cst[i] && cst[i] <= '9')) {
741  if (reading_word) { // must not be '!'
742  word_length++;
743  if (i == m_bitConditionToDumpVcd.length() - 1) {
744  bool fired = isFired(m_bitConditionToDumpVcd.substr(begin_word, word_length));
745  B2DEBUG(20,
746  m_bitConditionToDumpVcd.substr(begin_word, word_length).c_str()
747  << "(" << fired << ")");
748  if (((!not_flag && fired) || (not_flag && !fired)) && result_the_term) {
749  return true;
750  }
751  }
752  } else {
753  // start of new word
754  reading_word = true;
755  if ('!' == cst[i]) {
756  begin_word = i + 1;
757  not_flag = true;
758  word_length = 0;
759  } else {
760  begin_word = i;
761  not_flag = false;
762  word_length = 1;
763  if (i == m_bitConditionToDumpVcd.length() - 1) {
764  // one char bit ('f',...) comes end of conditions, 'xxx+f'
765  bool fired = isFired(m_bitConditionToDumpVcd.substr(begin_word, word_length));
766  B2DEBUG(20,
767  m_bitConditionToDumpVcd.substr(begin_word, word_length).c_str()
768  << "(" << fired << ")");
769  if (((!not_flag && fired) || (not_flag && !fired)) && result_the_term) {
770  return true;
771  }
772  }
773  }
774  }
775  } else if ('+' == cst[i] || i == m_bitConditionToDumpVcd.length() - 1) {
776  // End of the term.
777  if (reading_word) { // 'xxx+'
778  if (result_the_term) {
779  bool fired = isFired(m_bitConditionToDumpVcd.substr(begin_word, word_length));
780  B2DEBUG(20,
781  m_bitConditionToDumpVcd.substr(begin_word, word_length).c_str()
782  << "(" << fired << ")");
783  if ((!not_flag && fired) || (not_flag && !fired)) {
784  return true;
785  } else {
786  // this term is denied by the latest bit
787  }
788  } else {
789  // already false.
790  }
791  reading_word = false;
792  } else {
793  // prior char is blank, 'xxx +'
794  if (result_the_term) {
795  return true;
796  } else {
797  // already false
798  }
799  }
800  result_the_term = true; // go to next term
801  } else {
802  // can be blank (white space) or any delimiter.
803  if (reading_word) {
804  // end of a word, 'xxxx '
805  reading_word = false;
806  if (result_the_term) {
807  // worth to try
808  bool fired = isFired(m_bitConditionToDumpVcd.substr(begin_word, word_length));
809  B2DEBUG(20,
810  m_bitConditionToDumpVcd.substr(begin_word, word_length).c_str()
811  << "(" << fired << ")");
812  if ((!not_flag && fired) || (not_flag && !fired)) {
813  // go to next word
814  } else {
815  result_the_term = false;
816  }
817  } else {
818  // already false
819  }
820  reading_word = false;
821  } else {
822  // 2nd blank 'xx ' or leading blanck '^ '
823  }
824  }
825  }
826  return false;
827 }
828 
829 void TRGGDLDQMModule::genVcd(void)
830 {
831  int prev_i[400] = {0};
832  int prev_f[400] = {0};
833  int prev_p[400] = {0};
834  //int prev_g[400]={0}; // Future Plan
835  ofstream outf(Form("vcd/e%02dr%08de%08d.vcd", _exp, _run, evtno));
836  outf << "$date" << endl;
837  outf << " Aug 20, 2018 17:53:52" << endl;
838  outf << "$end" << endl;
839  outf << "$version" << endl;
840  outf << " ChipScope Pro Analyzer 14.7 P.20131013 (Build 14700.13.286.464)" << endl;
841  outf << "$end" << endl;
842  outf << "$timescale" << endl;
843  if (n_clocks == 32) {
844  outf << " 32ns" << endl;
845  } else if (n_clocks == 48) {
846  outf << " 8ns" << endl;
847  } else {
848  outf << " 1ns" << endl;
849  }
850  outf << "$end" << endl;
851  outf << "" << endl;
852  outf << "$scope module gdl0067d_icn $end" << endl;
853  int seqnum = 0;
854  for (unsigned j = 0; j < n_inbit; j++) {
855  outf << "$var wire 1 n" << seqnum++ << " " << inbitname[j] << " $end" << endl;
856  }
857  for (unsigned j = 0; j < n_outbit; j++) {
858  outf << "$var wire 1 n" << seqnum++ << " ftd." << outbitname[j] << " $end" << endl;
859  }
860  for (unsigned j = 0; j < n_outbit; j++) {
861  outf << "$var wire 1 n" << seqnum++ << " psn." << outbitname[j] << " $end" << endl;
862  }
863 
864  outf << "$upscope $end" << endl;
865  outf << "$enddefinitions $end" << endl << endl;
866 
867  for (unsigned clk = 1; clk <= n_clocks; clk++) {
868  seqnum = 0;
869  outf << "#" << clk - 1 << endl;
870  for (unsigned k = 1; k <= n_inbit; k++) {
871  if (clk == 1 || prev_i[k - 1] != h_i->GetBinContent(clk, k)) {
872  prev_i[k - 1] = h_i->GetBinContent(clk, k);
873  outf << h_i->GetBinContent(clk, k) << "n" << seqnum << endl;
874  }
875  seqnum++;
876  }
877  for (unsigned k = 1; k <= n_outbit; k++) {
878  if (clk == 1 || prev_f[k - 1] != h_f->GetBinContent(clk, k)) {
879  prev_f[k - 1] = h_f->GetBinContent(clk, k);
880  outf << h_f->GetBinContent(clk, k) << "n" << seqnum << endl;
881  }
882  seqnum++;
883  }
884  for (unsigned k = 1; k <= n_outbit; k++) {
885  if (clk == 1 || prev_p[k - 1] != h_p->GetBinContent(clk, k)) {
886  prev_p[k - 1] = h_p->GetBinContent(clk, k);
887  outf << h_p->GetBinContent(clk, k) << "n" << seqnum << endl;
888  }
889  seqnum++;
890  }
891  /* Future Plan
892  for(unsigned k=1; k<=n_gdlbits; k++){
893  if(clk == 1 || prev_g[k-1] != hg->GetBinContent(clk, k)){
894  prev_g[k-1] = hg->GetBinContent(clk, k);
895  if(EBitWidth[k-1] != 1){
896  char ans[33];
897  if(k-1 == e_rvc){
898  dec2binstring(hg->GetBinContent(clk, k), ans, true);
899  }else{
900  dec2binstring(hg->GetBinContent(clk, k), ans);
901  }
902  outf << "b" << ans << " n" << seqnum << endl;
903  }else{
904  outf << hg->GetBinContent(clk, k) << "n" << seqnum << endl;
905  }
906  }
907  seqnum++;
908  }
909  */
910  }
911  outf.close();
912 }
913 
914 bool
915 TRGGDLDQMModule::isFired(std::string bitname)
916 {
917  bool isPsnm = false;
918  for (unsigned i = 0; i < bitname.length(); i++) {
919  if ('A' <= bitname[i] && bitname[i] <= 'Z') {
920  isPsnm = true;
921  }
922  }
923  boost::algorithm::to_lower(bitname);
924  int bn = m_dbftdl->getoutbitnum(bitname.c_str());
925  for (unsigned clk = 0; clk < n_clocks; clk++) {
926  if (bn > -1) {
927  if (isPsnm) {
928  if (h_p->GetBinContent(clk + 1, bn + 1) > 0)
929  return true;
930  } else {
931  if (h_f->GetBinContent(clk + 1, bn + 1) > 0)
932  return true;
933  }
934  }
935  }
936  bn = m_dbinput->getinbitnum(bitname.c_str());
937  for (unsigned clk = 0; clk < n_clocks; clk++) {
938  if (bn > -1) {
939  if (h_i->GetBinContent(clk + 1, bn + 1) > 0)
940  return true;
941  }
942  }
943  return false;
944 }
945 
946 void
947 TRGGDLDQMModule::fillRiseFallTimings(void)
948 {
949 
950  //std::cout << "rise " << skim.size() << std::endl;
951 
952  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
953  //reduce #plot
954  if (skim[ifill] != 0)continue;
955 
956  for (unsigned i = 0; i < n_inbit; i++) {
957  if (n_clocks == 32) {
958  h_itd_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
959  h_itd_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
960  h_itd_rise[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
961  h_itd_fall[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
962  } else {
963  h_itd_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
964  h_itd_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
965  }
966  bool rising_done = false;
967  bool falling_done = false;
968  for (unsigned clk = 0; clk < n_clocks; clk++) {
969  if (h_i->GetBinContent(clk + 1, i + 1) > 0) {
970  if (! rising_done) {
971  h_itd_rise[i][skim[ifill]]->Fill(clk + 0.5);
972  rising_done = true;
973  } else if (rising_done && !falling_done && clk == n_clocks - 1) {
974  h_itd_fall[i][skim[ifill]]->Fill(clk + 0.5);
975  }
976  } else if (h_i->GetBinContent(clk + 1, i + 1) == 0) {
977  if (rising_done && ! falling_done) {
978  h_itd_fall[i][skim[ifill]]->Fill(clk + 0.5);
979  falling_done = true;
980  }
981  }
982  }
983  }
984  for (unsigned i = 0; i < n_outbit; i++) {
985  if (n_clocks == 32) {
986  h_ftd_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
987  h_psn_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
988  h_ftd_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
989  h_psn_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
990  h_ftd_rise[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
991  h_psn_rise[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
992  h_ftd_fall[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
993  h_psn_fall[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
994  } else {
995  h_ftd_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
996  h_psn_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
997  h_ftd_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
998  h_psn_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
999  }
1000  bool rising_done = false;
1001  bool falling_done = false;
1002  for (unsigned clk = 0; clk < n_clocks; clk++) {
1003  if (h_f->GetBinContent(clk + 1, i + 1) > 0) {
1004  if (! rising_done) {
1005  h_ftd_rise[i][skim[ifill]]->Fill(clk + 0.5);
1006  rising_done = true;
1007  } else if (rising_done && !falling_done && clk == n_clocks - 1) {
1008  h_ftd_fall[i][skim[ifill]]->Fill(clk + 0.5);
1009  }
1010  } else if (h_f->GetBinContent(clk + 1, i + 1) == 0) {
1011  if (rising_done && ! falling_done) {
1012  h_ftd_fall[i][skim[ifill]]->Fill(clk + 0.5);
1013  falling_done = true;
1014  }
1015  }
1016  }
1017  rising_done = false;
1018  falling_done = false;
1019  for (unsigned clk = 0; clk < n_clocks; clk++) {
1020  if (h_p->GetBinContent(clk + 1, i + 1) > 0) {
1021  if (! rising_done) {
1022  h_psn_rise[i][skim[ifill]]->Fill(clk + 0.5);
1023  rising_done = true;
1024  } else if (rising_done && !falling_done && clk == n_clocks - 1) {
1025  h_psn_fall[i][skim[ifill]]->Fill(clk + 0.5);
1026  }
1027  } else if (h_p->GetBinContent(clk + 1, i + 1) == 0) {
1028  if (rising_done && ! falling_done) {
1029  h_psn_fall[i][skim[ifill]]->Fill(clk + 0.5);
1030  falling_done = true;
1031  }
1032  }
1033  }
1034  }
1035  }
1036 }
1037 
1038 
1039 void
1040 TRGGDLDQMModule::fillOutputOverlap(void)
1041 {
1042  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1043  bool cdc_fired = isFired("FFF") || isFired("FFO") || isFired("FFB") || isFired("FFY") || isFired("FYO") || isFired("FYB");
1044  bool c4_fired = isFired("C4");
1045  bool hie_fired = isFired("HIE");
1046  bool lml_fired = (isFired("LML0") || isFired("LML1") || isFired("LML2") || isFired("LML3") || isFired("LML4") || isFired("LML5")
1047  || isFired("LML6") || isFired("LML7") || isFired("LML8") || isFired("LML9") || isFired("LML10") || isFired("LML11")
1048  || isFired("LML12") || isFired("LML13") || isFired("ECLMUMU"));
1049  bool klm_fired = isFired("MU_B2B") || isFired("MU_EB2B") || isFired("BEKLM") || isFired("CDCKLM1") || isFired("CDCKLM2");
1050  bool short_fired = isFired("FSO") || isFired("FSB") || isFired("YSO") || isFired("YSB");
1051  bool ff30_fired = isFired("FF30") || isFired("FY30");
1052  bool bha3d_fired = isFired("BHA3D");
1053 
1054  if (1) {
1055  h_psn_overlap[skim[ifill]]->Fill(0.5);
1056  }
1057  if (cdc_fired) {
1058  h_psn_overlap[skim[ifill]]->Fill(1.5);
1059  } else if (c4_fired) {
1060  h_psn_overlap[skim[ifill]]->Fill(2.5);
1061  } else if (hie_fired) {
1062  h_psn_overlap[skim[ifill]]->Fill(3.5);
1063  } else if (klm_fired) {
1064  h_psn_overlap[skim[ifill]]->Fill(4.5);
1065  } else if (short_fired) {
1066  h_psn_overlap[skim[ifill]]->Fill(5.5);
1067  } else if (ff30_fired) {
1068  h_psn_overlap[skim[ifill]]->Fill(6.5);
1069  } else if (lml_fired) {
1070  h_psn_overlap[skim[ifill]]->Fill(7.5);
1071  } else if (bha3d_fired) {
1072  h_psn_overlap[skim[ifill]]->Fill(8.5);
1073  } else {
1074  h_psn_overlap[skim[ifill]]->Fill(9.5);
1075  }
1076 
1077  if (1) {
1078  h_psn_nooverlap[skim[ifill]]->Fill(0.5);
1079  }
1080  if (cdc_fired) {
1081  h_psn_nooverlap[skim[ifill]]->Fill(1.5);
1082  }
1083  if (c4_fired) {
1084  h_psn_nooverlap[skim[ifill]]->Fill(2.5);
1085  }
1086  if (hie_fired) {
1087  h_psn_nooverlap[skim[ifill]]->Fill(3.5);
1088  }
1089  if (klm_fired) {
1090  h_psn_nooverlap[skim[ifill]]->Fill(4.5);
1091  }
1092  if (short_fired) {
1093  h_psn_nooverlap[skim[ifill]]->Fill(5.5);
1094  }
1095  if (ff30_fired) {
1096  h_psn_nooverlap[skim[ifill]]->Fill(6.5);
1097  }
1098  if (lml_fired) {
1099  h_psn_nooverlap[skim[ifill]]->Fill(7.5);
1100  }
1101  if (bha3d_fired) {
1102  h_psn_nooverlap[skim[ifill]]->Fill(8.5);
1103  }
1104  }
1105 }
1106 
1107 
1108 void
1109 TRGGDLDQMModule::fillOutputExtra(void)
1110 {
1111  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1112  bool c4_fired = isFired("C4");
1113  bool hie_fired = isFired("HIE");
1114  bool lml_fired = (isFired("LML0") || isFired("LML1") || isFired("LML2") || isFired("LML3") || isFired("LML4") || isFired("LML5")
1115  || isFired("LML6") || isFired("LML7") || isFired("LML8") || isFired("LML9") || isFired("LML10") || isFired("ECLMUMU"));
1116  bool fff_fired = isFired("FFF");
1117  bool ff_fired = isFired("ff");
1118  bool f_fired = isFired("f");
1119  bool ffo_fired = isFired("FFO");
1120  bool ffb_fired = isFired("FFB");
1121  bool ffy_fired = isFired("ffy");
1122  bool fyo_fired = isFired("fyo");
1123  bool fyb_fired = isFired("fyb");
1124  bool bha2D_fired = isFired("bhabha");
1125  bool bha3D_fired = isFired("bha3d");
1126  bool lml0_fired = isFired("LML0");
1127  bool lml1_fired = isFired("LML1");
1128  bool lml2_fired = isFired("LML2");
1129  bool lml3_fired = isFired("LML3");
1130  bool lml4_fired = isFired("LML4");
1131  bool lml5_fired = isFired("LML5");
1132  bool lml6_fired = isFired("LML6");
1133  bool lml7_fired = isFired("LML7");
1134  bool lml8_fired = isFired("LML8");
1135  bool lml9_fired = isFired("LML9");
1136  bool lml10_fired = isFired("LML10");
1137  bool lml12_fired = isFired("LML12");
1138  bool lml13_fired = isFired("LML13");
1139  bool eclmumu_fired = isFired("ECLMUMU");
1140  bool mu_b2b_fired = isFired("mu_b2b");
1141  bool mu_eb2b_fired = isFired("mu_eb2b");
1142  bool cdcklm1_fired = isFired("cdcklm1");
1143  bool cdcklm2_fired = isFired("cdcklm2");
1144  bool klm_hit_fired = isFired("klm_hit");
1145  bool eklm_hit_fired = isFired("eklm_hit");
1146  bool cdcecl1_fired = isFired("cdcecl1");
1147  bool cdcecl2_fired = isFired("cdcecl2");
1148  bool cdcecl3_fired = isFired("cdcecl3");
1149  bool cdcecl4_fired = isFired("cdcecl4");
1150  bool fso_fired = isFired("fso");
1151  bool fsb_fired = isFired("fsb");
1152  bool syo_fired = isFired("syo");
1153  bool syb_fired = isFired("syb");
1154  bool x_fired = isFired("x");
1155  bool fioiecl1_fired = isFired("fioiecl1");
1156  bool ecleklm1_fired = isFired("ecleklm1");
1157  bool seklm1_fired = isFired("seklm1");
1158  bool seklm2_fired = isFired("seklm2");
1159  bool ieklm_fired = isFired("ieklm");
1160  bool iecl_fired = isFired("iecl");
1161 
1162  if (1) {
1163  h_psn_extra[skim[ifill]]->Fill(0.5);
1164  }
1165  if (fff_fired && (c4_fired || hie_fired)) {
1166  h_psn_extra[skim[ifill]]->Fill(1.5);
1167  }
1168  if (ffo_fired && (c4_fired || hie_fired)) {
1169  h_psn_extra[skim[ifill]]->Fill(2.5);
1170  }
1171  if (ffb_fired && (c4_fired || hie_fired)) {
1172  h_psn_extra[skim[ifill]]->Fill(3.5);
1173  }
1174  if (fff_fired) {
1175  h_psn_extra[skim[ifill]]->Fill(4.5);
1176  }
1177  if (c4_fired || hie_fired) {
1178  h_psn_extra[skim[ifill]]->Fill(5.5);
1179  }
1180  if (fff_fired || ffo_fired || ffb_fired) {
1181  h_psn_extra[skim[ifill]]->Fill(6.5);
1182  }
1183  if ((fff_fired || ffo_fired || ffb_fired) && (c4_fired || hie_fired)) {
1184  h_psn_extra[skim[ifill]]->Fill(7.5);
1185  }
1186  if (bha2D_fired) {
1187  h_psn_extra[skim[ifill]]->Fill(8.5);
1188  }
1189  if (bha3D_fired) {
1190  h_psn_extra[skim[ifill]]->Fill(9.5);
1191  }
1192  if (ff_fired) {
1193  h_psn_extra[skim[ifill]]->Fill(10.5);
1194  }
1195  if (ff_fired && (lml_fired)) {
1196  h_psn_extra[skim[ifill]]->Fill(11.5);
1197  }
1198  if (f_fired) {
1199  h_psn_extra[skim[ifill]]->Fill(12.5);
1200  }
1201  if (f_fired && (lml_fired)) {
1202  h_psn_extra[skim[ifill]]->Fill(13.5);
1203  }
1204  if (lml_fired) {
1205  h_psn_extra[skim[ifill]]->Fill(14.5);
1206  }
1207  if (fff_fired && (lml_fired)) {
1208  h_psn_extra[skim[ifill]]->Fill(15.5);
1209  }
1210  if (ffo_fired && (lml_fired)) {
1211  h_psn_extra[skim[ifill]]->Fill(16.5);
1212  }
1213  if (ffb_fired && (lml_fired)) {
1214  h_psn_extra[skim[ifill]]->Fill(17.5);
1215  }
1216  if (ffy_fired) {
1217  h_psn_extra[skim[ifill]]->Fill(18.5);
1218  }
1219  if (ffy_fired && (c4_fired || hie_fired)) {
1220  h_psn_extra[skim[ifill]]->Fill(19.5);
1221  }
1222  if (fyo_fired && (c4_fired || hie_fired)) {
1223  h_psn_extra[skim[ifill]]->Fill(20.5);
1224  }
1225  if (fyb_fired && (c4_fired || hie_fired)) {
1226  h_psn_extra[skim[ifill]]->Fill(21.5);
1227  }
1228  if ((ffy_fired || fyo_fired || fyb_fired) && (c4_fired || hie_fired)) {
1229  h_psn_extra[skim[ifill]]->Fill(22.5);
1230  }
1231  if (ffy_fired && (lml_fired)) {
1232  h_psn_extra[skim[ifill]]->Fill(23.5);
1233  }
1234  if (fyo_fired && (lml_fired)) {
1235  h_psn_extra[skim[ifill]]->Fill(24.5);
1236  }
1237  if (fyb_fired && (lml_fired)) {
1238  h_psn_extra[skim[ifill]]->Fill(25.5);
1239  }
1240  if (c4_fired && (fff_fired || ffo_fired || ffb_fired)) {
1241  h_psn_extra[skim[ifill]]->Fill(26.5);
1242  }
1243  if (hie_fired && (fff_fired || ffo_fired || ffb_fired)) {
1244  h_psn_extra[skim[ifill]]->Fill(27.5);
1245  }
1246  if (lml0_fired && (fff_fired || ffo_fired || ffb_fired)) {
1247  h_psn_extra[skim[ifill]]->Fill(28.5);
1248  }
1249  if (lml1_fired && (fff_fired || ffo_fired || ffb_fired)) {
1250  h_psn_extra[skim[ifill]]->Fill(29.5);
1251  }
1252  if (lml2_fired && (fff_fired || ffo_fired || ffb_fired)) {
1253  h_psn_extra[skim[ifill]]->Fill(30.5);
1254  }
1255  if (lml3_fired && (fff_fired || ffo_fired || ffb_fired)) {
1256  h_psn_extra[skim[ifill]]->Fill(31.5);
1257  }
1258  if (lml4_fired && (fff_fired || ffo_fired || ffb_fired)) {
1259  h_psn_extra[skim[ifill]]->Fill(32.5);
1260  }
1261  if (lml5_fired && (fff_fired || ffo_fired || ffb_fired)) {
1262  h_psn_extra[skim[ifill]]->Fill(33.5);
1263  }
1264  if (lml6_fired && (fff_fired || ffo_fired || ffb_fired)) {
1265  h_psn_extra[skim[ifill]]->Fill(34.5);
1266  }
1267  if (lml7_fired && (fff_fired || ffo_fired || ffb_fired)) {
1268  h_psn_extra[skim[ifill]]->Fill(35.5);
1269  }
1270  if (lml8_fired && (fff_fired || ffo_fired || ffb_fired)) {
1271  h_psn_extra[skim[ifill]]->Fill(36.5);
1272  }
1273  if (lml9_fired && (fff_fired || ffo_fired || ffb_fired)) {
1274  h_psn_extra[skim[ifill]]->Fill(37.5);
1275  }
1276  if (lml10_fired && (fff_fired || ffo_fired || ffb_fired)) {
1277  h_psn_extra[skim[ifill]]->Fill(38.5);
1278  }
1279  if (lml12_fired && (fff_fired || ffo_fired || ffb_fired)) {
1280  h_psn_extra[skim[ifill]]->Fill(39.5);
1281  }
1282  if (lml13_fired && (fff_fired || ffo_fired || ffb_fired)) {
1283  h_psn_extra[skim[ifill]]->Fill(40.5);
1284  }
1285  if (eclmumu_fired && (fff_fired || ffo_fired || ffb_fired)) {
1286  h_psn_extra[skim[ifill]]->Fill(41.5);
1287  }
1288  if (mu_b2b_fired && (fff_fired || ffo_fired || ffb_fired)) {
1289  h_psn_extra[skim[ifill]]->Fill(42.5);
1290  }
1291  if (mu_eb2b_fired && (fff_fired || ffo_fired || ffb_fired)) {
1292  h_psn_extra[skim[ifill]]->Fill(43.5);
1293  }
1294  if (cdcklm1_fired && (fff_fired || ffo_fired || ffb_fired)) {
1295  h_psn_extra[skim[ifill]]->Fill(44.5);
1296  }
1297  if (cdcklm2_fired && (fff_fired || ffo_fired || ffb_fired)) {
1298  h_psn_extra[skim[ifill]]->Fill(45.5);
1299  }
1300  if (klm_hit_fired && (fff_fired || ffo_fired || ffb_fired)) {
1301  h_psn_extra[skim[ifill]]->Fill(46.5);
1302  }
1303  if (eklm_hit_fired && (fff_fired || ffo_fired || ffb_fired)) {
1304  h_psn_extra[skim[ifill]]->Fill(47.5);
1305  }
1306  if (mu_b2b_fired && lml_fired) {
1307  h_psn_extra[skim[ifill]]->Fill(48.5);
1308  }
1309  if (mu_eb2b_fired && lml_fired) {
1310  h_psn_extra[skim[ifill]]->Fill(49.5);
1311  }
1312  if (cdcklm1_fired && lml_fired) {
1313  h_psn_extra[skim[ifill]]->Fill(50.5);
1314  }
1315  if (cdcklm2_fired && lml_fired) {
1316  h_psn_extra[skim[ifill]]->Fill(51.5);
1317  }
1318  if (klm_hit_fired && lml_fired) {
1319  h_psn_extra[skim[ifill]]->Fill(52.5);
1320  }
1321  if (eklm_hit_fired && lml_fired) {
1322  h_psn_extra[skim[ifill]]->Fill(53.5);
1323  }
1324  if (cdcecl1_fired && (fff_fired || ffo_fired || ffb_fired)) {
1325  h_psn_extra[skim[ifill]]->Fill(54.5);
1326  }
1327  if (cdcecl2_fired && (fff_fired || ffo_fired || ffb_fired)) {
1328  h_psn_extra[skim[ifill]]->Fill(55.5);
1329  }
1330  if (cdcecl3_fired && (fff_fired || ffo_fired || ffb_fired)) {
1331  h_psn_extra[skim[ifill]]->Fill(56.5);
1332  }
1333  if (cdcecl4_fired && (fff_fired || ffo_fired || ffb_fired)) {
1334  h_psn_extra[skim[ifill]]->Fill(57.5);
1335  }
1336  if (cdcecl1_fired && lml_fired) {
1337  h_psn_extra[skim[ifill]]->Fill(58.5);
1338  }
1339  if (cdcecl2_fired && lml_fired) {
1340  h_psn_extra[skim[ifill]]->Fill(59.5);
1341  }
1342  if (cdcecl3_fired && lml_fired) {
1343  h_psn_extra[skim[ifill]]->Fill(60.5);
1344  }
1345  if (cdcecl4_fired && lml_fired) {
1346  h_psn_extra[skim[ifill]]->Fill(61.5);
1347  }
1348  if (fso_fired && lml_fired) {
1349  h_psn_extra[skim[ifill]]->Fill(62.5);
1350  }
1351  if (fsb_fired && lml_fired) {
1352  h_psn_extra[skim[ifill]]->Fill(63.5);
1353  }
1354  if (syo_fired && lml_fired) {
1355  h_psn_extra[skim[ifill]]->Fill(64.5);
1356  }
1357  if (syb_fired && lml_fired) {
1358  h_psn_extra[skim[ifill]]->Fill(65.5);
1359  }
1360  if (x_fired && lml_fired) {
1361  h_psn_extra[skim[ifill]]->Fill(66.5);
1362  }
1363  if (fioiecl1_fired && lml_fired) {
1364  h_psn_extra[skim[ifill]]->Fill(67.5);
1365  }
1366  if (ecleklm1_fired && lml_fired) {
1367  h_psn_extra[skim[ifill]]->Fill(68.5);
1368  }
1369  if (seklm1_fired && lml_fired) {
1370  h_psn_extra[skim[ifill]]->Fill(69.5);
1371  }
1372  if (seklm2_fired && lml_fired) {
1373  h_psn_extra[skim[ifill]]->Fill(70.5);
1374  }
1375  if (ieklm_fired && lml_fired) {
1376  h_psn_extra[skim[ifill]]->Fill(71.5);
1377  }
1378  if (iecl_fired && lml_fired) {
1379  h_psn_extra[skim[ifill]]->Fill(72.5);
1380  }
1381  }
1382 
1383 
1384 
1385  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1386  //fill efficiency values
1387  h_eff[skim[ifill]]->SetBinContent(1, h_psn_extra[skim[ifill]]->GetBinContent(1 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1388  5 + 1)); //fff with c4|hie
1389  h_eff[skim[ifill]]->SetBinContent(2, h_psn_extra[skim[ifill]]->GetBinContent(2 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1390  5 + 1)); //ffo with c4|hie
1391  h_eff[skim[ifill]]->SetBinContent(3, h_psn_extra[skim[ifill]]->GetBinContent(3 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1392  5 + 1)); //ffb with c4|hie
1393  h_eff[skim[ifill]]->SetBinContent(4, h_psn_extra[skim[ifill]]->GetBinContent(19 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1394  5 + 1)); //ffy with c4|hie
1395  h_eff[skim[ifill]]->SetBinContent(5, h_psn_extra[skim[ifill]]->GetBinContent(20 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1396  5 + 1)); //fyo with c4|hie
1397  h_eff[skim[ifill]]->SetBinContent(6, h_psn_extra[skim[ifill]]->GetBinContent(21 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1398  5 + 1)); //fyb with c4|hie
1399  h_eff[skim[ifill]]->SetBinContent(7, h_psn_extra[skim[ifill]]->GetBinContent(27 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1400  6 + 1)); //hie with fff|ffo|ffb
1401  h_eff[skim[ifill]]->SetBinContent(8, h_psn_extra[skim[ifill]]->GetBinContent(26 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1402  6 + 1)); //c4 with fff|ffo|ffb
1403  h_eff[skim[ifill]]->SetBinContent(9, h_psn_extra[skim[ifill]]->GetBinContent(28 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1404  6 + 1)); //lml0 with fff|ffo|ffb
1405  h_eff[skim[ifill]]->SetBinContent(10, h_psn_extra[skim[ifill]]->GetBinContent(29 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1406  6 + 1)); //lml1 with fff|ffo|ffb
1407  h_eff[skim[ifill]]->SetBinContent(11, h_psn_extra[skim[ifill]]->GetBinContent(30 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1408  6 + 1)); //lml2 with fff|ffo|ffb
1409  h_eff[skim[ifill]]->SetBinContent(12, h_psn_extra[skim[ifill]]->GetBinContent(31 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1410  6 + 1)); //lml3 with fff|ffo|ffb
1411  h_eff[skim[ifill]]->SetBinContent(13, h_psn_extra[skim[ifill]]->GetBinContent(32 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1412  6 + 1)); //lml4 with fff|ffo|ffb
1413  h_eff[skim[ifill]]->SetBinContent(14, h_psn_extra[skim[ifill]]->GetBinContent(33 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1414  6 + 1)); //lml5 with fff|ffo|ffb
1415  h_eff[skim[ifill]]->SetBinContent(15, h_psn_extra[skim[ifill]]->GetBinContent(34 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1416  6 + 1)); //lml6 with fff|ffo|ffb
1417  h_eff[skim[ifill]]->SetBinContent(16, h_psn_extra[skim[ifill]]->GetBinContent(35 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1418  6 + 1)); //lml7 with fff|ffo|ffb
1419  h_eff[skim[ifill]]->SetBinContent(17, h_psn_extra[skim[ifill]]->GetBinContent(36 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1420  6 + 1)); //lml8 with fff|ffo|ffb
1421  h_eff[skim[ifill]]->SetBinContent(18, h_psn_extra[skim[ifill]]->GetBinContent(37 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1422  6 + 1)); //lml9 with fff|ffo|ffb
1423  h_eff[skim[ifill]]->SetBinContent(19, h_psn_extra[skim[ifill]]->GetBinContent(38 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1424  6 + 1)); //lml10 with fff|ffo|ffb
1425  h_eff[skim[ifill]]->SetBinContent(20, h_psn_extra[skim[ifill]]->GetBinContent(39 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1426  6 + 1)); //lml12 with fff|ffo|ffb
1427  h_eff[skim[ifill]]->SetBinContent(21, h_psn_extra[skim[ifill]]->GetBinContent(40 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1428  6 + 1)); //lml13 with fff|ffo|ffb
1429  h_eff[skim[ifill]]->SetBinContent(22, h_psn_extra[skim[ifill]]->GetBinContent(9 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1430  0 + 1)); //bha3d with all
1431  h_eff[skim[ifill]]->SetBinContent(23, h_psn_extra[skim[ifill]]->GetBinContent(42 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1432  6 + 1)); //mu_b2b with fff|ffo|ffb
1433  h_eff[skim[ifill]]->SetBinContent(24, h_psn_extra[skim[ifill]]->GetBinContent(48 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1434  14 + 1)); //mu_b2b with lml|eclmumu
1435  h_eff[skim[ifill]]->SetBinContent(25, h_psn_extra[skim[ifill]]->GetBinContent(49 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1436  14 + 1)); //mu_eb2b with lml|eclmumu
1437  h_eff[skim[ifill]]->SetBinContent(26, h_psn_extra[skim[ifill]]->GetBinContent(44 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1438  6 + 1)); //cdcklm1 with fff|ffo|ffb
1439  h_eff[skim[ifill]]->SetBinContent(27, h_psn_extra[skim[ifill]]->GetBinContent(45 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1440  6 + 1)); //cdcklm2 with fff|ffo|ffb
1441  h_eff[skim[ifill]]->SetBinContent(28, h_psn_extra[skim[ifill]]->GetBinContent(15 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1442  14 + 1)); //fff with lml|eclmumu
1443  h_eff[skim[ifill]]->SetBinContent(29, h_psn_extra[skim[ifill]]->GetBinContent(16 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1444  14 + 1)); //ffo with lml|eclmumu
1445  h_eff[skim[ifill]]->SetBinContent(30, h_psn_extra[skim[ifill]]->GetBinContent(17 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1446  14 + 1)); //ffb with lml|eclmumu
1447  h_eff[skim[ifill]]->SetBinContent(31, h_psn_extra[skim[ifill]]->GetBinContent(11 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1448  14 + 1)); //ff with lml|eclmumu
1449  h_eff[skim[ifill]]->SetBinContent(32, h_psn_extra[skim[ifill]]->GetBinContent(13 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1450  14 + 1)); //f with lml|eclmumu
1451  h_eff[skim[ifill]]->SetBinContent(33, h_psn_extra[skim[ifill]]->GetBinContent(23 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1452  14 + 1)); //ffy with lml|eclmumu
1453  h_eff[skim[ifill]]->SetBinContent(34, h_psn_extra[skim[ifill]]->GetBinContent(24 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1454  14 + 1)); //fyo with lml|eclmumu
1455  h_eff[skim[ifill]]->SetBinContent(35, h_psn_extra[skim[ifill]]->GetBinContent(25 + 1) / h_psn_extra[skim[ifill]]->GetBinContent(
1456  14 + 1)); //fyb with lml|eclmumu
1457  }
1458 
1459  if (m_skim != 0) {
1460  h_eff_shifter->SetBinContent(1, h_psn_extra[1]->GetBinContent(1 + 1) / h_psn_extra[1]->GetBinContent(5 + 1)); //fff with c4|hie
1461  h_eff_shifter->SetBinContent(2, h_psn_extra[1]->GetBinContent(2 + 1) / h_psn_extra[1]->GetBinContent(5 + 1)); //ffo with c4|hie
1462  h_eff_shifter->SetBinContent(3, h_psn_extra[1]->GetBinContent(19 + 1) / h_psn_extra[1]->GetBinContent(5 + 1)); //ffy with c4|hie
1463  h_eff_shifter->SetBinContent(4, h_psn_extra[1]->GetBinContent(20 + 1) / h_psn_extra[1]->GetBinContent(5 + 1)); //fyo with c4|hie
1464  h_eff_shifter->SetBinContent(5, h_psn_extra[1]->GetBinContent(27 + 1) / h_psn_extra[1]->GetBinContent(
1465  6 + 1)); //hie with fff|ffo|ffb
1466  h_eff_shifter->SetBinContent(6, h_psn_extra[1]->GetBinContent(26 + 1) / h_psn_extra[1]->GetBinContent(
1467  6 + 1)); //c4 with fff|ffo|ffb
1468  h_eff_shifter->SetBinContent(7, h_psn_extra[4]->GetBinContent(48 + 1) / h_psn_extra[4]->GetBinContent(
1469  14 + 1) * 10); //mu_b2b with lml|eclmumu
1470  h_eff_shifter->SetBinContent(8, h_psn_extra[4]->GetBinContent(49 + 1) / h_psn_extra[4]->GetBinContent(
1471  14 + 1) * 50); //mu_eb2b with lml|eclmumu
1472  }
1473 
1474 }
1475 
1476 const char* TRGGDLDQMModule::output_extra[n_output_extra] = {
1477  "all", "fff&(c4|hie)", "ffo&(c4|hie)", "ffb&(c4|hie)", "fff", "c4|hie", "fff|ffo|ffb", "(fff|ffo|ffb)&(c4|hie)", "bha2D", "bha3D",
1478  "ff", "ff&(lml|eclmumu)", "f", "f&(lml|eclmumu)", "lml|eclmumu", "fff&(lml|eclmumu)", "ffo&(lml|eclmumu)", "ffb&(lml|eclmumu)", "ffy", "ffy&(c4|hie)",
1479  "fyo&(c4|hie)", "fyb&(c4|hie)", "(ffy|ffo|ffb)&(c4|hie)", "ffy&(lml|eclmumu)", "fyo&(lml|eclmumu)", "fyb&(lml|eclmumu)", "c4&(fff|ffo|ffb)", "hie&(fff|ffo|ffb)", "lml0&(fff|ffo|ffb)", "lml1&(fff|ffo|ffb)",
1480  "lml2&(fff|ffo|ffb)", "lml3&(fff|ffo|ffb)", "lml4&(fff|ffo|ffb)", "lml5&(fff|ffo|ffb)", "lml6&(fff|ffo|ffb)", "lml7&(fff|ffo|ffb)", "lml8&(fff|ffo|ffb)", "lml9&(fff|ffo|ffb)", "lml10&(fff|ffo|ffb)", "lml12&(fff|ffo|ffb)",
1481  "lml13&(fff|ffo|ffb)", "eclmumu&(fff|ffo|ffb)", "mu_b2b&(fff|ffo|ffb)", "mu_eb2b&(fff|ffo|ffb)", "cdcklm1&(fff|ffo|ffb)", "cdcklm2&(fff|ffo|ffb)", "klm_hit&(fff|ffo|ffb)", "eklm_hit&(fff|ffo|ffb)", "mu_b2b&(lml|eclmumu)", "mu_eb2b&(lml|eclmumu)",
1482  "cdcklm1&(lml|eclmumu)", "cdcklm2&(lml|eclmumu)", "klm_hit&(lml|eclmumu)", "eklm_hit&(lml|eclmumu)", "cdcecl1&(fff|ffo|ffb)", "cdcecl2&(fff|ffo|ffb)", "cdcecl3&(fff|ffo|ffb)", "cdcecl4&(fff|ffo|ffb)", "cdcecl1&(lml|eclmumu)", "cdcecl2&(lml|eclmumu)",
1483  "cdcecl3&(lml|eclmumu)", "cdcecl4&(lml|eclmumu)", "fso&(lml|eclmumu)", "fsb&(lml|eclmumu)", "syo&(lml|eclmumu)", "syb&(lml|eclmumu)", "x&(lml|eclmumu)", "fioiecl1&(lml|eclmumu)", "ecleklm1&(lml|eclmumu)", "seklm1&(lml|eclmumu)",
1484  "seklm2&(lml|eclmumu)", "ieklm&(lml|eclmumu)", "iecl&(lml|eclmumu)"
1485 };
1486 
1487 const char* TRGGDLDQMModule::output_overlap[n_output_overlap] = {
1488  "all", "cdc", "c4", "hie", "klm", "short", "ff30", "lml", "bha3D", "other"
1489 };
1490 
1491 const char* TRGGDLDQMModule::c_eff_shifter[n_eff_shifter] = {
1492  "CDC fff",
1493  "CDC ffo",
1494  "CDC ffy",
1495  "CDC fyo",
1496  "ECL hie",
1497  "ECL c4",
1498  "KLM b2b,x10",
1499  "EKLM eb2b,x50"
1500 };
1501 
1502 const char* TRGGDLDQMModule::c_eff[n_eff] = {
1503  "fff with c4|hie",
1504  "ffo with c4|hie",
1505  "ffb with c4|hie",
1506  "ffy with c4|hie",
1507  "fyo with c4|hie",
1508  "fyb with c4|hie",
1509  "hie with fff|ffo|ffb",
1510  "c4 with fff|ffo|ffb",
1511  "lml0 with fff|ffo|ffb",
1512  "lml1 with fff|ffo|ffb",
1513  "lml2 with fff|ffo|ffb",
1514  "lml3 with fff|ffo|ffb",
1515  "lml4 with fff|ffo|ffb",
1516  "lml5 with fff|ffo|ffb",
1517  "lml6 with fff|ffo|ffb",
1518  "lml7 with fff|ffo|ffb",
1519  "lml8 with fff|ffo|ffb",
1520  "lml9 with fff|ffo|ffb",
1521  "lml10 with fff|ffo|ffb",
1522  "lml12 with fff|ffo|ffb",
1523  "lml13 with fff|ffo|ffb",
1524  "bha3d with all",
1525  "mu_b2b with fff|ffo|ffb",
1526  "mu_b2b with lml|eclmumu",
1527  "mu_eb2b with lml|eclmumu",
1528  "cdcklm1 with fff|ffo|ffb",
1529  "cdcklm2 with fff|ffo|ffb",
1530  "fff with lml|eclmumu",
1531  "ffo with lml|eclmumu",
1532  "ffb with lml|eclmumu",
1533  "ff with lml|eclmumu",
1534  "f with lml|eclmumu",
1535  "ffy with lml|eclmumu",
1536  "fyo with lml|eclmumu",
1537  "fyb with lml|eclmumu"
1538 };
1539 
1540 
1541 void
1542 TRGGDLDQMModule::fillOutputPureExtra(void)
1543 {
1544  //get offline CDC track information
1545  StoreArray<Track> Tracks;
1546  int n_fulltrack = 0;
1547  float max_dphi = 0;
1548  float phi_list[100];
1549  for (int itrack = 0; itrack < Tracks.getEntries(); itrack++) {
1550  const TrackFitResult* tfr = Tracks[itrack]->getTrackFitResult(Const::pion);
1551  if (tfr == nullptr) continue;
1552 
1553  float z0 = tfr->getZ0();
1554  float d0 = tfr->getD0();
1555  float phi = tfr->getPhi();
1556  //float omega = tfr->getOmega();
1557  int flayer = tfr->getHitPatternCDC().getFirstLayer();
1558  int llayer = tfr->getHitPatternCDC().getLastLayer();
1559  float pt = tfr->getTransverseMomentum();
1560  //std::cout << z0 << " " << d0 << " " << omega << " " << flayer << " " << llayer << " " << pt << std::endl;
1561  if (z0 > -1 && z0 < 1 && d0 > -1 && d0 < 1 && flayer < 8 && llayer > 50
1562  && pt > 0.3) { //select track from IP, hit SL0 and SL8, pt>0.3GeV
1563  phi_list[n_fulltrack] = phi;
1564  n_fulltrack += 1;
1565  }
1566  }
1567  for (int i = 0; i < n_fulltrack; i++) {
1568  for (int j = 0; j < n_fulltrack; j++) {
1569  float dphi = phi_list[i] - phi_list[j];
1570  if (dphi < 0) dphi = -dphi;
1571  if (dphi > 3.14) dphi = 2 * 3.14 - dphi;
1572  if (dphi > max_dphi) max_dphi = dphi;
1573  }
1574  }
1575 
1576  //get offline ECL cluster information
1577  //StoreArray<ECLCluster> ECLClusters;
1578  //double total_energy = 0;
1579  //for (int iclst = 0; iclst < ECLClusters.getEntries(); iclst++) {
1580  // total_energy += ECLClusters[iclst]->getEnergyRaw();
1581  //}
1582  //
1583  //
1584  int ecl_timing_threshold_low = -200; // (ns) xtal timing selection
1585  int ecl_timing_threshold_high = 200; // (ns) xtal timing selection
1586  double ecl_xtcid_energy_sum[576] = {0};
1587  double total_energy = 0;
1588  int ncluster = 0;
1589  for (const auto& eclcalhit : m_ECLCalDigitData) {
1590 
1591  // (ecl) calibation status check and cut
1592  if (!eclcalhit.isCalibrated()) {continue;}
1593  if (eclcalhit.isFailedFit()) {continue;}
1594  if (eclcalhit.isTimeResolutionFailed()) {continue;}
1595 
1596  // (ecl) xtal-id
1597  int ecl_cid = (double) eclcalhit.getCellId();
1598 
1599  // (ecl) fitter quality check and cut
1600  int ecl_quality = -1;
1601  for (const auto& eclhit : m_ECLDigitData) {
1602  if (ecl_cid == eclhit.getCellId()) {
1603  ecl_quality = (int) eclhit.getQuality();
1604  }
1605  }
1606  if (ecl_quality != 0) {continue;}
1607 
1608  // (ecl) xtal energy
1609  double ecl_xtal_energy = eclcalhit.getEnergy(); // ECLCalDigit
1610 
1611 
1612  // (ecl) timing cut
1613  int ecl_timing = eclcalhit.getTime();
1614  if (ecl_timing < ecl_timing_threshold_low ||
1615  ecl_timing > ecl_timing_threshold_high) {continue;}
1616 
1617  // (ecl) tc-id for xtal-id
1618  int ecl_tcid = trgeclmap->getTCIdFromXtalId(ecl_cid);
1619  int ecl_thetaid = trgeclmap->getTCThetaIdFromTCId(ecl_tcid);
1620 
1621  if (ecl_tcid >= 0 && ecl_tcid < 576 && ecl_thetaid >= 2 && ecl_thetaid <= 15) { //pick up only 2=<thetaid=<15
1622  ecl_xtcid_energy_sum[ecl_tcid] = ecl_xtcid_energy_sum[ecl_tcid] + ecl_xtal_energy;
1623  //ecltimingsum[i] = ecl_timing;
1624  }
1625  }
1626 
1627  for (int i = 0; i < 576; i++) {
1628  if (ecl_xtcid_energy_sum[i] > 0.1) {
1629  total_energy += ecl_xtcid_energy_sum[i];
1630  ncluster += 1;
1631  }
1632  }
1633 
1634  //get offline KLM cluster information
1635 
1636 
1637  //fff: require the number of CDC full tracks is more than or equal to 3
1638  if (n_fulltrack > 2) {
1639  //std::cout << "fff" << std::endl;
1640  bool fff_fired = isFired("fff");
1641  bool ffy_fired = isFired("ffy");
1642  bool c4_fired = isFired("C4");
1643  bool hie_fired = isFired("HIE");
1644  if (c4_fired || hie_fired) {
1645  h_psn_pure_extra[0]->Fill(0.5);
1646  }
1647  if (fff_fired && (c4_fired || hie_fired)) {
1648  h_psn_pure_extra[0]->Fill(1.5);
1649  }
1650  if (ffy_fired && (c4_fired || hie_fired)) {
1651  h_psn_pure_extra[0]->Fill(2.5);
1652  }
1653  }
1654  //ffo: require the number of CDC full tracks is more than or equal to 2, opening angle > 90deg
1655  if (n_fulltrack > 1 && max_dphi > 3.14 / 2.) {
1656  //std::cout << "fff" << std::endl;
1657  bool ffo_fired = isFired("ffo");
1658  bool fyo_fired = isFired("fyo");
1659  bool c4_fired = isFired("C4");
1660  bool hie_fired = isFired("HIE");
1661  if (c4_fired || hie_fired) {
1662  h_psn_pure_extra[0]->Fill(3.5);
1663  }
1664  if (ffo_fired && (c4_fired || hie_fired)) {
1665  h_psn_pure_extra[0]->Fill(4.5);
1666  }
1667  if (fyo_fired && (c4_fired || hie_fired)) {
1668  h_psn_pure_extra[0]->Fill(5.5);
1669  }
1670  }
1671  //ffo: require the number of CDC full tracks is more than or equal to 2, opening angle >150deg
1672  if (n_fulltrack > 1 && max_dphi > 3.14 * 5 / 6.) {
1673  //std::cout << "fff" << std::endl;
1674  bool ffb_fired = isFired("ffb");
1675  bool fyb_fired = isFired("fyb");
1676  bool c4_fired = isFired("C4");
1677  bool hie_fired = isFired("HIE");
1678  if (c4_fired || hie_fired) {
1679  h_psn_pure_extra[0]->Fill(6.5);
1680  }
1681  if (ffb_fired && (c4_fired || hie_fired)) {
1682  h_psn_pure_extra[0]->Fill(7.5);
1683  }
1684  if (fyb_fired && (c4_fired || hie_fired)) {
1685  h_psn_pure_extra[0]->Fill(8.5);
1686  }
1687  }
1688 
1689  //hie: require the total energy of ECL cluster is more than 1GeV
1690  if (total_energy > 1) {
1691  //std::cout << "hie" << std::endl;
1692  bool fff_fired = isFired("FFF");
1693  bool ffo_fired = isFired("FFO");
1694  bool ffb_fired = isFired("FFB");
1695  bool hie_fired = isFired("hie");
1696  if (fff_fired || ffo_fired || ffb_fired) {
1697  h_psn_pure_extra[0]->Fill(9.5);
1698  }
1699  if (hie_fired && (fff_fired || ffo_fired || ffb_fired)) {
1700  h_psn_pure_extra[0]->Fill(10.5);
1701  }
1702  }
1703 
1704  //c4: require the total number of cluster is more than 3
1705  if (ncluster > 3) {
1706  //std::cout << "hie" << std::endl;
1707  bool fff_fired = isFired("FFF");
1708  bool ffo_fired = isFired("FFO");
1709  bool ffb_fired = isFired("FFB");
1710  bool c4_fired = isFired("c4");
1711  if (fff_fired || ffo_fired || ffb_fired) {
1712  h_psn_pure_extra[0]->Fill(11.5);
1713  }
1714  if (c4_fired && (fff_fired || ffo_fired || ffb_fired)) {
1715  h_psn_pure_extra[0]->Fill(12.5);
1716  }
1717  }
1718 
1719  h_pure_eff[0]->SetBinContent(1, h_psn_pure_extra[0]->GetBinContent(1 + 1) / h_psn_pure_extra[0]->GetBinContent(
1720  0 + 1)); //fff with c4|hie
1721  h_pure_eff[0]->SetBinContent(2, h_psn_pure_extra[0]->GetBinContent(4 + 1) / h_psn_pure_extra[0]->GetBinContent(
1722  3 + 1)); //ffo with c4|hie
1723  h_pure_eff[0]->SetBinContent(3, h_psn_pure_extra[0]->GetBinContent(7 + 1) / h_psn_pure_extra[0]->GetBinContent(
1724  6 + 1)); //ffb with c4|hie
1725  h_pure_eff[0]->SetBinContent(4, h_psn_pure_extra[0]->GetBinContent(2 + 1) / h_psn_pure_extra[0]->GetBinContent(
1726  0 + 1)); //ffy with c4|hie
1727  h_pure_eff[0]->SetBinContent(5, h_psn_pure_extra[0]->GetBinContent(5 + 1) / h_psn_pure_extra[0]->GetBinContent(
1728  3 + 1)); //fyo with c4|hie
1729  h_pure_eff[0]->SetBinContent(6, h_psn_pure_extra[0]->GetBinContent(8 + 1) / h_psn_pure_extra[0]->GetBinContent(
1730  6 + 1)); //fyb with c4|hie
1731  h_pure_eff[0]->SetBinContent(7, h_psn_pure_extra[0]->GetBinContent(10 + 1) / h_psn_pure_extra[0]->GetBinContent(
1732  9 + 1)); //hie with fff|ffo|ffb
1733  h_pure_eff[0]->SetBinContent(8, h_psn_pure_extra[0]->GetBinContent(12 + 1) / h_psn_pure_extra[0]->GetBinContent(
1734  11 + 1)); //hie with fff|ffo|ffb
1735 
1736 }
1737 
1738 const char* TRGGDLDQMModule::output_pure_extra[n_output_pure_extra] = {
1739  "c4|hie offline_fff", "fff&(c4|hie) offline_fff", "ffy&(c4|hie) offline_fff",
1740  "c4|hie offline_ffo", "ffo&(c4|hie) offline_ffo", "fyo&(c4|hie) offline_ffo",
1741  "c4|hie offline_ffb", "ffb&(c4|hie) offline_ffb", "fyb&(c4|hie) offline_ffb",
1742  "fff|ffb|ffo offline_hie", "hie&(fff|ffb|ffo) offline_hie",
1743  "fff|ffb|ffo offline_c4", "c4&(fff|ffb|ffo) offline_c4"
1744 };
1745 
1746 
1747 const char* TRGGDLDQMModule::c_pure_eff[n_pure_eff] = {
1748  "fff with c4|hie",
1749  "ffo with c4|hie",
1750  "ffb with c4|hie",
1751  "ffy with c4|hie",
1752  "fyo with c4|hie",
1753  "fyb with c4|hie",
1754  "hie with fff|ffo|ffb",
1755  "c4 with fff|ffo|ffb"
1756 };
1757 
1758 
Belle2::HitPatternCDC::getFirstLayer
short getFirstLayer() const
Returns the index of the first layer with a hit.
Definition: HitPatternCDC.cc:98
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
Belle2::TRGGDLDQMModule::h_c8_cdcTogdlL1
TH1I * h_c8_cdcTogdlL1[nskim_gdldqm]
timestamp diff from t0(cdc) to gdlL1 in LSB8nsec
Definition: TRGGDLDQMModule.h:63
Belle2::TRGGDLDQMModule::h_ns_cdcToecl
TH1D * h_ns_cdcToecl[nskim_gdldqm]
timestamp diff from cdc_timing to ecl_timing in nsec
Definition: TRGGDLDQMModule.h:85
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module::c_ParallelProcessingCertified
@ 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:82
Belle2::TRGGDLDQMModule::h_psn
TH1I * h_psn[nskim_gdldqm]
psn bits
Definition: TRGGDLDQMModule.h:100
skim
Definition: __init__.py:1
Belle2::TRGGDLDQMModule::h_c8_eclToGDL
TH1I * h_c8_eclToGDL[nskim_gdldqm]
timestamp diff from t0(ecl) to GDL in LSB8nsec
Definition: TRGGDLDQMModule.h:69
Belle2::TRGGDLDQMModule::h_timtype
TH1I * h_timtype[nskim_gdldqm]
timtype
Definition: TRGGDLDQMModule.h:111
Belle2::TRGGDLDQMModule::defineHisto
virtual void defineHisto() override
Define Histogram.
Definition: TRGGDLDQMModule.cc:91
Belle2::TrgEclMapping
A class of TC Mapping.
Definition: TrgEclMapping.h:31
Belle2::TRGGDLDQMModule::h_c8_topToGDL
TH1I * h_c8_topToGDL[nskim_gdldqm]
timestamp diff from t0(top) to GDL in LSB8nsec
Definition: TRGGDLDQMModule.h:67
Belle2::TrackFitResult
Values of the result of a track fit with a given particle hypothesis.
Definition: TrackFitResult.h:59
Belle2::SoftwareTriggerCutResult::c_accept
@ c_accept
Accept this event.
Belle2::TrackFitResult::getHitPatternCDC
HitPatternCDC getHitPatternCDC() const
Getter for the hit pattern in the CDC;.
Definition: TrackFitResult.cc:120
Belle2::TrackFitResult::getZ0
double getZ0() const
Getter for z0.
Definition: TrackFitResult.h:200
Belle2::Module::setPropertyFlags
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:210
Belle2::TRGGDLDQMModule::h_p
TH2I * h_p
event by event psnm timing distribution
Definition: TRGGDLDQMModule.h:113
Belle2::Const::pion
static const ChargedStable pion
charged pion particle
Definition: Const.h:535
Belle2::TRGGDLDQMModule::beginRun
virtual void beginRun() override
begin Run
Definition: TRGGDLDQMModule.cc:244
Belle2::TRGGDLDQMModule::h_i
TH2I * h_i
event by event input timing distribution
Definition: TRGGDLDQMModule.h:117
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::TRGGDLDQMModule::h_ns_cdcTocomL1
TH1D * h_ns_cdcTocomL1[nskim_gdldqm]
timestamp diff from cdc_timing to comL1 in nsec
Definition: TRGGDLDQMModule.h:75
Belle2::TrackFitResult::getTransverseMomentum
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
Definition: TrackFitResult.h:140
Belle2::TRGGDLDQMModule::h_c8_gdlL1TocomL1
TH1I * h_c8_gdlL1TocomL1[nskim_gdldqm]
timestamp diff from gdlL1 to comL1 in LSB8nsec
Definition: TRGGDLDQMModule.h:57
Belle2::TRGGDLDQMModule::h_c8_ecl8mToGDL
TH1I * h_c8_ecl8mToGDL[nskim_gdldqm]
timestamp diff from fit on fam to GDL in LSB8nsec
Definition: TRGGDLDQMModule.h:65
Belle2::TRGGDLDQMModule::h_ns_topTocdc
TH1D * h_ns_topTocdc[nskim_gdldqm]
timestamp diff from top_timing to cdc_timing in nsec
Definition: TRGGDLDQMModule.h:81
Belle2::TRGGDLDQMModule::h_c8_eclTogdlL1
TH1I * h_c8_eclTogdlL1[nskim_gdldqm]
timestamp diff from t0(ecl) to gdlL1 in LSB8nsec
Definition: TRGGDLDQMModule.h:61
Belle2::TRGGDLDQMModule::h_c2_cdcToecl
TH1I * h_c2_cdcToecl[nskim_gdldqm]
timestamp from cdc_timing to ecl_timing to L1 in LSB2nsec
Definition: TRGGDLDQMModule.h:83
Belle2::TRGGDLDQMModule::initialize
virtual void initialize() override
initialize
Definition: TRGGDLDQMModule.cc:281
Belle2::TRGGDLDQMModule::h_ns_topToecl
TH1D * h_ns_topToecl[nskim_gdldqm]
timestamp diff from top_timing to ecl_timing in nsec
Definition: TRGGDLDQMModule.h:79
Belle2::Module::addParam
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:562
Belle2::TRGGDLDQMModule::h_f
TH2I * h_f
event by event ftdl timing distribution
Definition: TRGGDLDQMModule.h:115
Belle2::TRGGDLDQMModule::endRun
virtual void endRun() override
End Run.
Definition: TRGGDLDQMModule.cc:379
Belle2::TRGGDLDQMModule::h_c8_cdcToGDL
TH1I * h_c8_cdcToGDL[nskim_gdldqm]
timestamp diff from t0(cdc) to GDL in LSB8nsec
Definition: TRGGDLDQMModule.h:71
Belle2::HitPatternCDC::getLastLayer
short getLastLayer() const
Returns the index of the last layer with a hit.
Definition: HitPatternCDC.cc:106
Belle2::TRGGDLDQMModule::h_c8_topTogdlL1
TH1I * h_c8_topTogdlL1[nskim_gdldqm]
timestamp diff from t0(top) to gdlL1 in LSB8nsec
Definition: TRGGDLDQMModule.h:59
Belle2::TrgEclMapping::getTCThetaIdFromTCId
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
Definition: TrgEclMapping.cc:200
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::TRGGDLDQMModule::h_ns_cdcTogdlL1
TH1D * h_ns_cdcTogdlL1[nskim_gdldqm]
timestamp diff from cdc_timing to gdlL1 in nsec
Definition: TRGGDLDQMModule.h:77
Belle2::TRGGDLDQMModule::h_c2_cdcTocomL1
TH1I * h_c2_cdcTocomL1[nskim_gdldqm]
timestamp diff from cdc_timing to comL1 in LSB2nsec
Definition: TRGGDLDQMModule.h:73
Belle2::TRGGDLDQMModule::event
virtual void event() override
Event.
Definition: TRGGDLDQMModule.cc:461
Belle2::TrgEclMapping::getTCIdFromXtalId
int getTCIdFromXtalId(int)
get [TC ID] from [Xtal ID]
Definition: TrgEclMapping.cc:36
Belle2::TRGGDLDQMModule::h_ftd
TH1I * h_ftd[nskim_gdldqm]
ftd bits
Definition: TRGGDLDQMModule.h:96
Belle2::TRGGDLDQMModule::h_itd
TH1I * h_itd[nskim_gdldqm]
input bits
Definition: TRGGDLDQMModule.h:92
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226
Belle2::HistoModule
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
Belle2::TrackFitResult::getPhi
double getPhi() const
Getter for phi0 with CDF naming convention.
Definition: TrackFitResult.h:187
Belle2::TrackFitResult::getD0
double getD0() const
Getter for d0.
Definition: TrackFitResult.h:178
Belle2::StoreObjPtr::isValid
bool isValid() const
Check whether the object was created.
Definition: StoreObjPtr.h:120