Belle II Software  release-08-01-10
TRGGDLDQMModule.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 // $Id$
10 //---------------------------------------------------------------
11 // Filename : TRGGDLModule.cc
12 // Section : TRG GDL
13 // Owner :
14 // Email :
15 //---------------------------------------------------------------
16 // Description : A trigger module for TRG GDL
17 //---------------------------------------------------------------
18 #include <trg/gdl/modules/trggdlDQM/TRGGDLDQMModule.h>
19 #include <trg/gdl/modules/trggdlUnpacker/trggdlUnpackerModule.h>
20 
21 #include <framework/datastore/StoreObjPtr.h>
22 #include <framework/datastore/StoreArray.h>
23 
24 #include <TDirectory.h>
25 #include <TPostScript.h>
26 #include <TCanvas.h>
27 #include <TStyle.h>
28 #include <iostream>
29 #include <fstream>
30 #include <framework/logging/Logger.h>
31 #include <boost/algorithm/string.hpp>
32 
33 using namespace std;
34 using namespace Belle2;
35 using namespace GDL;
36 
37 REG_MODULE(TRGGDLDQM);
38 
39 /*
40  Fired data in TrgBit not available because
41  of absence of TRGSummary class.
42  TrgBit class only for bit configuration.
43 */
44 
45 
46 TRGGDLDQMModule::TRGGDLDQMModule() : HistoModule()
47 {
48 
49  setDescription("DQM for GDL Trigger system");
51 
52  addParam("eventByEventTimingHistRecord", m_eventByEventTimingHistRecord,
53  "Recording event by event timing distribution histogram or not",
54  false);
55  addParam("dumpVcdFile", m_dumpVcdFile,
56  "Dumping vcd file or not",
57  false);
58  addParam("bitConditionToDumpVcd", m_bitConditionToDumpVcd,
59  "Condition for vcd. alg format with '!' and '+'.",
60  string(""));
61  addParam("vcdEventStart", m_vcdEventStart,
62  "Start equential event number",
63  unsigned(0));
64  addParam("vcdNumberOfEvents", m_vcdNumberOfEvents,
65  "Number of events to dump vcd file",
66  unsigned(10));
67  addParam("bitNameOnBinLabel", m_bitNameOnBinLabel,
68  "Put bitname on BinLabel",
69  true);
70  addParam("generatePostscript", m_generatePostscript,
71  "Genarete postscript file or not",
72  false);
73  addParam("postScriptName", m_postScriptName,
74  "postscript file name",
75  string("gdldqm.ps"));
76  addParam("skim", m_skim,
77  "use skim information or not",
78  int(-1));
79  B2DEBUG(20, "eventByEventTimingFlag(" << m_eventByEventTimingHistRecord
80  << "), m_dumpVcdFile(" << m_dumpVcdFile
81  << "), m_bitConditionToDumpVcd(" << m_bitConditionToDumpVcd
82  << "), m_vcdEventStart(" << m_vcdEventStart
83  << "), m_vcdNumberOfEvents(" << m_vcdNumberOfEvents);
84 
85 
86 }
87 
89 {
90  oldDir = gDirectory;
91  dirDQM = gDirectory;
92  if (!oldDir->Get("TRGGDL"))oldDir->mkdir("TRGGDL");
93  dirDQM->cd("TRGGDL");
94 
95  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
96  h_c8_gdlL1TocomL1[iskim] = new TH1I(Form("hGDL_gdlL1TocomL1_%s", skim_smap[iskim].c_str()), "comL1 - gdlL1 [clk8ns]", 100, 0,
97  100);
98  h_c8_gdlL1TocomL1[iskim]->GetXaxis()->SetTitle("clk8ns");
99 
100  h_c8_topTogdlL1[iskim] = new TH1I(Form("hGDL_topTogdlL1_%s", skim_smap[iskim].c_str()), "gdlL1 - top_timing [clk8ns]", 700, 0,
101  700);
102  h_c8_topTogdlL1[iskim]->GetXaxis()->SetTitle("clk8ns");
103  h_c8_eclTogdlL1[iskim] = new TH1I(Form("hGDL_eclTogdlL1_%s", skim_smap[iskim].c_str()), "gdlL1 - ecl_timing [clk8ns]", 500, 0,
104  500);
105  h_c8_eclTogdlL1[iskim]->GetXaxis()->SetTitle("clk8ns");
106  h_c8_cdcTogdlL1[iskim] = new TH1I(Form("hGDL_cdcTogdlL1_%s", skim_smap[iskim].c_str()), "gdlL1 - cdc_timing [clk8ns]", 700, 0,
107  700);
108  h_c8_cdcTogdlL1[iskim]->GetXaxis()->SetTitle("clk8ns");
109 
110  h_c8_ecl8mToGDL[iskim] = new TH1I(Form("hGDL_ecl8mToGDL_%s", skim_smap[iskim].c_str()), "gdlIn^{8MHz} - ecl_timing [clk8ns]",
111  500, 0, 500);
112  h_c8_ecl8mToGDL[iskim]->GetXaxis()->SetTitle("clk8ns");
113  h_c8_topToGDL[iskim] = new TH1I(Form("hGDL_topToGDL_%s", skim_smap[iskim].c_str()), "gdlIn - top_timing [clk8ns]", 700, 0,
114  700);
115  h_c8_topToGDL[iskim]->GetXaxis()->SetTitle("clk8ns");
116  h_c8_eclToGDL[iskim] = new TH1I(Form("hGDL_eclToGDL_%s", skim_smap[iskim].c_str()), "gdlIn - ecl_timing [clk8ns]", 500, 0,
117  500);
118  h_c8_eclToGDL[iskim]->GetXaxis()->SetTitle("clk8ns");
119  h_c8_cdcToGDL[iskim] = new TH1I(Form("hGDL_cdcToGDL_%s", skim_smap[iskim].c_str()), "gdlIn - cdc_timing [clk8ns]", 700, 0,
120  700);
121  h_c8_cdcToGDL[iskim]->GetXaxis()->SetTitle("clk8ns");
122 
123  h_c2_cdcTocomL1[iskim] = new TH1I(Form("hGDL_cdcTocomL1_%s", skim_smap[iskim].c_str()), "comL1 - cdc_timing [clk2ns]", 520, 0,
124  5200);
125  h_c2_cdcTocomL1[iskim]->GetXaxis()->SetTitle("clk2ns");
126  h_ns_cdcTocomL1[iskim] = new TH1D(Form("hGDL_ns_cdcTocomL1_%s", skim_smap[iskim].c_str()), "comL1 - cdc_timing [ns]", 2600, 0,
127  10400);
128  h_ns_cdcTocomL1[iskim]->GetXaxis()->SetTitle("ns");
129  h_ns_cdcTocomL1[iskim]->GetYaxis()->SetTitle("evt / 4ns");
130  h_ns_cdcTogdlL1[iskim] = new TH1D(Form("hGDL_ns_cdcTogdlL1_%s", skim_smap[iskim].c_str()), "gdlL1 - cdc_timing [ns]", 2600, 0,
131  10400);
132  h_ns_cdcTogdlL1[iskim]->GetXaxis()->SetTitle("ns");
133  h_ns_cdcTogdlL1[iskim]->GetYaxis()->SetTitle("evt / 4ns");
134 
135  h_ns_topToecl[iskim] = new TH1D(Form("hGDL_ns_topToecl_%s", skim_smap[iskim].c_str()), "ecl_timing - top_timing [ns]", 800, 0,
136  4000);
137  h_ns_topToecl[iskim]->GetXaxis()->SetTitle("ns");
138  h_ns_topToecl[iskim]->GetYaxis()->SetTitle("evt / 5ns");
139  h_ns_topTocdc[iskim] = new TH1D(Form("hGDL_ns_topTocdc_%s", skim_smap[iskim].c_str()), "cdc_timing - top_timing [ns]", 800, 0,
140  4000);
141  h_ns_topTocdc[iskim]->GetXaxis()->SetTitle("ns");
142  h_ns_topTocdc[iskim]->GetYaxis()->SetTitle("evt / 5ns");
143  h_ns_cdcToecl[iskim] = new TH1D(Form("hGDL_ns_cdcToecl_%s", skim_smap[iskim].c_str()), "ecl_timing - cdc_timing [ns]", 2000, 0,
144  4000);
145  h_ns_cdcToecl[iskim]->GetXaxis()->SetTitle("ns");
146  h_ns_cdcToecl[iskim]->GetYaxis()->SetTitle("evt / 2ns");
147 
148  h_c2_cdcToecl[iskim] = new TH1I(Form("hGDL_cdcToecl_%s", skim_smap[iskim].c_str()), "ecl_timing - cdc_timing [clk2ns]", 1000, 0,
149  2000);
150  h_c2_cdcToecl[iskim]->GetXaxis()->SetTitle("clk2ns");
151 
152  h_timtype[iskim] = new TH1I(Form("hGDL_timtype_%s", skim_smap[iskim].c_str()), "timtype", 7, 0, 7);
153 
154  h_itd[iskim] = new TH1I(Form("hGDL_itd_%s", skim_smap[iskim].c_str()), "itd", n_inbit + 1, -1, n_inbit);
155  h_ftd[iskim] = new TH1I(Form("hGDL_ftd_%s", skim_smap[iskim].c_str()), "ftd", n_outbit + 1, -1, n_outbit);
156  h_psn[iskim] = new TH1I(Form("hGDL_psn_%s", skim_smap[iskim].c_str()), "psn", n_outbit + 1, -1, n_outbit);
157  // output extra
158  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);
159  for (int i = 0; i < n_output_extra; i++) {
160  h_psn_extra[iskim]->GetXaxis()->SetBinLabel(i + 1, output_extra[i]);
161  }
162  h_psn_extra[iskim]->GetXaxis()->SetLabelSize(0.02);
163  // output extra
164  h_psn_extra_fast[iskim] = new TH1I(Form("hGDL_psn_extra_fast_%s", skim_smap[iskim].c_str()), "psn extra fast", n_output_extra, 0,
165  n_output_extra);
166  for (int i = 0; i < n_output_extra; i++) {
167  h_psn_extra_fast[iskim]->GetXaxis()->SetBinLabel(i + 1, output_extra[i]);
168  }
169  h_psn_extra_fast[iskim]->GetXaxis()->SetLabelSize(0.02);
170  // output overlap
171  h_psn_effect_to_l1[iskim] = new TH1I(Form("hGDL_psn_effect_to_l1_%s", skim_smap[iskim].c_str()), "psn effect to l1",
172  n_output_overlap, 0,
173  n_output_overlap);
174  for (int i = 0; i < n_output_overlap; i++) {
175  h_psn_effect_to_l1[iskim]->GetXaxis()->SetBinLabel(i + 1, output_overlap[i]);
176  }
177  h_psn_effect_to_l1[iskim]->GetXaxis()->SetLabelSize(0.02);
178  // output no overlap
179  h_psn_raw_rate[iskim] = new TH1I(Form("hGDL_psn_raw_rate_%s", skim_smap[iskim].c_str()), "psn raw rate", n_output_overlap, 0,
180  n_output_overlap);
181  for (int i = 0; i < n_output_overlap; i++) {
182  h_psn_raw_rate[iskim]->GetXaxis()->SetBinLabel(i + 1, output_overlap[i]);
183  }
184  h_psn_raw_rate[iskim]->GetXaxis()->SetLabelSize(0.02);
185  // output pure extra
186  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,
187  0, n_output_pure_extra);
188  for (int i = 0; i < n_output_pure_extra; i++) {
189  h_psn_pure_extra[iskim]->GetXaxis()->SetBinLabel(i + 1, output_pure_extra[i]);
190  }
191 
192  h_itd[iskim]->GetXaxis()->SetBinLabel(h_itd[iskim]->GetXaxis()->FindBin(-1 + 0.5), "all");
193  h_ftd[iskim]->GetXaxis()->SetBinLabel(h_ftd[iskim]->GetXaxis()->FindBin(-1 + 0.5), "all");
194  h_psn[iskim]->GetXaxis()->SetBinLabel(h_psn[iskim]->GetXaxis()->FindBin(-1 + 0.5), "all");
195  h_itd[iskim]->GetXaxis()->SetLabelSize(0.02);
196  h_ftd[iskim]->GetXaxis()->SetLabelSize(0.02);
197  h_psn[iskim]->GetXaxis()->SetLabelSize(0.02);
198  for (unsigned i = 0; i < n_inbit; i++) {
199  if (m_bitNameOnBinLabel) {
200  h_itd[iskim]->GetXaxis()->SetBinLabel(h_itd[iskim]->GetXaxis()->FindBin(i + 0.5), inbitname[i]);
201  }
202  }
203  for (unsigned i = 0; i < n_outbit; i++) {
204  if (m_bitNameOnBinLabel) {
205  h_ftd[iskim]->GetXaxis()->SetBinLabel(h_ftd[iskim]->GetXaxis()->FindBin(i + 0.5), outbitname[i]);
206  h_psn[iskim]->GetXaxis()->SetBinLabel(h_psn[iskim]->GetXaxis()->FindBin(i + 0.5), outbitname[i]);
207  }
208  }
209 
210  //reduce #plot
211  if (iskim != 0)continue;
212 
213  // rise/fall
214  for (unsigned i = 0; i < n_inbit; i++) {
215  h_itd_rise[i][iskim] = new TH1I(Form("hGDL_itd_%s_rise_%s", inbitname[i], skim_smap[iskim].c_str()),
216  Form("itd%d(%s) rising", i, inbitname[i]), 48, 0, 48);
217  h_itd_rise[i][iskim]->SetLineColor(kRed);
218  h_itd_fall[i][iskim] = new TH1I(Form("hGDL_itd_%s_fall_%s", inbitname[i], skim_smap[iskim].c_str()),
219  Form("itd%d(%s) falling", i, inbitname[i]), 48, 0, 48);
220  h_itd_fall[i][iskim]->SetLineColor(kGreen);
221  }
222  for (unsigned i = 0; i < n_outbit; i++) {
223  h_ftd_rise[i][iskim] = new TH1I(Form("hGDL_ftd_%s_rise_%s", outbitname[i], skim_smap[iskim].c_str()),
224  Form("ftd%d(%s) rising", i, outbitname[i]), 48, 0, 48);
225  h_ftd_rise[i][iskim]->SetLineColor(kRed);
226  h_ftd_fall[i][iskim] = new TH1I(Form("hGDL_ftd_%s_fall_%s", outbitname[i], skim_smap[iskim].c_str()),
227  Form("ftd%d(%s) falling", i, outbitname[i]), 48, 0, 48);
228  h_ftd_fall[i][iskim]->SetLineColor(kGreen);
229  h_psn_rise[i][iskim] = new TH1I(Form("hGDL_psn_%s_rise_%s", outbitname[i], skim_smap[iskim].c_str()),
230  Form("psn%d(%s) rising", i, outbitname[i]), 48, 0, 48);
231  h_psn_rise[i][iskim]->SetLineColor(kRed);
232  h_psn_fall[i][iskim] = new TH1I(Form("hGDL_psn_%s_fall_%s", outbitname[i], skim_smap[iskim].c_str()),
233  Form("psn%d(%s) falling", i, outbitname[i]), 48, 0, 48);
234  h_psn_fall[i][iskim]->SetLineColor(kGreen);
235  }
236  }
237 
238  oldDir->cd();
239 }
240 
242 {
243 
244  dirDQM->cd();
245 
246  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
247  h_c8_gdlL1TocomL1[iskim]->Reset();
248  h_c8_topTogdlL1[iskim]->Reset();
249  h_c8_eclTogdlL1[iskim]->Reset();
250  h_c8_cdcTogdlL1[iskim]->Reset();
251  h_c8_ecl8mToGDL[iskim]->Reset();
252  h_c8_topToGDL[iskim]->Reset();
253  h_c8_eclToGDL[iskim]->Reset();
254  h_c8_cdcToGDL[iskim]->Reset();
255  h_c2_cdcTocomL1[iskim]->Reset();
256  h_ns_cdcTocomL1[iskim]->Reset();
257  h_ns_cdcTogdlL1[iskim]->Reset();
258  h_ns_topToecl[iskim]->Reset();
259  h_ns_topTocdc[iskim]->Reset();
260  h_c2_cdcToecl[iskim]->Reset();
261  h_ns_cdcToecl[iskim]->Reset();
262  h_itd[iskim]->Reset();
263  h_ftd[iskim]->Reset();
264  h_psn[iskim]->Reset();
265  h_psn_extra[iskim]->Reset();
266  h_psn_extra_fast[iskim]->Reset();
267  h_psn_pure_extra[iskim]->Reset();
268  h_timtype[iskim]->Reset();
269  h_psn_raw_rate[iskim]->Reset();
270  h_psn_effect_to_l1[iskim]->Reset();
271  }
272 
273  for (int iskim = 0; iskim < nskim_gdldqm; iskim++) {
274  for (int i = 0; i < nsample_fast; i++) {
275  for (int ibin = 0; ibin < n_output_extra; ibin++) {
276  array_psn_extra_fast[iskim][i][ibin] = 0;
277  }
278  }
279  }
280 
281  oldDir->cd();
282 }
283 
285 {
286 
287  if (m_skim == 0) { //no skim
288  start_skim_gdldqm = 0;
289  end_skim_gdldqm = 1;
290  } else if (m_skim == 1) { //skim
291  start_skim_gdldqm = 1;
292  end_skim_gdldqm = nskim_gdldqm;
293  } else { //no skim + skim
294  start_skim_gdldqm = 0;
295  end_skim_gdldqm = nskim_gdldqm;
296  }
297 
298  _exp = bevt->getExperiment();
299  _run = bevt->getRun();
300 
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  n_leafs = m_unpacker->getnLeafs();
377  n_leafsExtra = m_unpacker->getnLeafsExtra();
378  n_clocks = m_unpacker->getnClks();
379  nconf = m_unpacker->getconf();
380  nword_input = m_unpacker->get_nword_input();
381  nword_output = m_unpacker->get_nword_output();
382 
383  for (unsigned i = 0; i < n_clocks; i++) {
384  for (int j = 0; j < n_leafs + n_leafsExtra; j++)h_0_vec.push_back(0);
385  for (unsigned int j = 0; j < n_outbit; j++) h_p_vec.push_back(0);
386  for (unsigned int j = 0; j < n_outbit; j++) h_f_vec.push_back(0);
387  for (unsigned int j = 0; j < n_inbit; j++) h_i_vec.push_back(0);
388  }
389 
390  for (int iskim = 0; iskim < nskim_gdldqm; iskim++) {
391  for (int i = 0; i < nsample_fast; i++) {
392  for (int ibin = 0; ibin < n_output_extra; ibin++) {
393  array_psn_extra_fast[iskim][i][ibin] = 0;
394  }
395  }
396  }
397 
398 }
399 
401 {
402  if (m_generatePostscript) {
403  TPostScript* ps = new TPostScript(m_postScriptName.c_str(), 112);
404  gStyle->SetOptStat(0);
405  TCanvas c1("c1", "", 0, 0, 500, 300);
406  c1.cd();
407 
408  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
409 
410  h_itd[iskim]->GetXaxis()->SetRange(h_itd[iskim]->GetXaxis()->FindBin(0.5),
411  h_itd[iskim]->GetXaxis()->FindBin(n_inbit - 0.5));
412  h_itd[iskim]->Draw();
413  c1.Update();
414  h_ftd[iskim]->GetXaxis()->SetRange(h_ftd[iskim]->GetXaxis()->FindBin(0.5),
415  h_ftd[iskim]->GetXaxis()->FindBin(n_outbit - 0.5));
416  h_ftd[iskim]->Draw();
417  c1.Update();
418  h_psn[iskim]->GetXaxis()->SetRange(h_psn[iskim]->GetXaxis()->FindBin(0.5),
419  h_psn[iskim]->GetXaxis()->FindBin(n_outbit - 0.5));
420  h_psn[iskim]->Draw();
421  c1.Update();
422  h_ftd[iskim]->SetTitle("ftd(green), psnm(red)");
423  h_ftd[iskim]->SetFillColor(kGreen);
424  h_ftd[iskim]->SetBarWidth(0.4);
425  h_ftd[iskim]->Draw("bar");
426  h_psn[iskim]->SetFillColor(kRed);
427  h_psn[iskim]->SetBarWidth(0.4);
428  h_psn[iskim]->SetBarOffset(0.5);
429  h_psn[iskim]->Draw("bar,same");
430 
431  c1.Update();
432  h_timtype[iskim]->Draw();
433  c1.Update();
434  h_c8_gdlL1TocomL1[iskim]->Draw();
435  c1.Update();
436  h_c8_topTogdlL1[iskim]->Draw();
437  c1.Update();
438  h_c8_eclTogdlL1[iskim]->Draw();
439  c1.Update();
440  h_c8_cdcTogdlL1[iskim]->Draw();
441  c1.Update();
442  h_c8_ecl8mToGDL[iskim]->Draw();
443  c1.Update();
444  h_c8_topToGDL[iskim]->Draw();
445  c1.Update();
446  h_c8_eclToGDL[iskim]->Draw();
447  c1.Update();
448  h_c8_cdcToGDL[iskim]->Draw();
449  c1.Update();
450  h_c2_cdcTocomL1[iskim]->Draw();
451  c1.Update();
452  h_ns_cdcTocomL1[iskim]->Draw();
453  c1.Update();
454  h_ns_cdcTogdlL1[iskim]->Draw();
455  c1.Update();
456  h_ns_topToecl[iskim]->Draw();
457  c1.Update();
458  h_ns_topTocdc[iskim]->Draw();
459  c1.Update();
460  h_c2_cdcToecl[iskim]->Draw();
461  c1.Update();
462  h_ns_cdcToecl[iskim]->Draw();
463  c1.Update();
464 
465  //reduce #plot
466  if (iskim != 0)continue;
467  for (unsigned i = 0; i < n_inbit; i++) {
468 
469  h_itd_rise[i][iskim]->SetTitle(Form("itd%d(%s) rising(red), falling(green)",
470  i, inbitname[i]));
471  h_itd_rise[i][iskim]->Draw();
472  h_itd_fall[i][iskim]->Draw("same");
473  c1.Update();
474  }
475 
476  }
477 
478  ps->Close();
479  }
480 }
481 
483 {
484  /* cppcheck-suppress variableScope */
485  static unsigned nvcd = 0;
486  static bool begin_run = true;
487 
488  skim.clear();
489 
490  if (!entAry || !entAry.getEntries()) {
491  return;
492  }
493 
494  //Get skim type from SoftwareTriggerResult
495  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
496  if (iskim == 0) skim.push_back(iskim);
497  }
498  if (result_soft.isValid()) {
499  const std::map<std::string, int>& skim_map = result_soft->getResults();
500  for (int iskim = start_skim_gdldqm; iskim < end_skim_gdldqm; iskim++) {
501  if (iskim == 0);
502  else if (skim_map.find(skim_menu[iskim]) != skim_map.end()) {
503  const bool accepted = (result_soft->getResult(skim_menu[iskim]) == SoftwareTriggerCutResult::c_accept);
504  if (accepted) skim.push_back(iskim);
505  }
506  }
507  }
508 
509 
510  //prepare entAry adress
511  int clk_map = 0;
512  for (int i = 0; i < 320; i++) {
513  if (strcmp(entAry[0]->m_unpackername[i], "evt") == 0) evtno = entAry[0]->m_unpacker[i];
514  if (strcmp(entAry[0]->m_unpackername[i], "clk") == 0) clk_map = i;
515  }
516 
517  const double clkTo2ns = 1. / .508877;
518  const double clkTo1ns = 0.5 / .508877;
519 
520  dirDQM->cd();
521 
522  for (unsigned i = 0; i < n_clocks; i++) {
523  for (int j = 0; j < n_leafs + n_leafsExtra; j++) {
524  h_0_vec[i * (n_leafs + n_leafsExtra) + j] = 0;
525  }
526  for (unsigned j = 0; j < n_outbit; j++) {
527  h_p_vec[i * n_outbit + j] = 0;
528  }
529  for (unsigned j = 0; j < n_outbit; j++) {
530  h_f_vec[i * n_outbit + j] = 0;
531  }
532  for (unsigned j = 0; j < n_inbit; j++) {
533  h_i_vec[i * n_inbit + j] = 0;
534  }
535  }
536 
537  oldDir->cd();
538 
539  // fill "bit vs clk" for the event
540  for (int ii = 0; ii < entAry.getEntries(); ii++) {
541  std::vector<int*> Bits(n_leafs + n_leafsExtra);
542  //set pointer
543  for (int i = 0; i < 320; i++) {
544  if (LeafBitMap[i] != -1) {
545  Bits[LeafBitMap[i]] = &(entAry[ii]->m_unpacker[i]);
546  }
547  }
548  for (int leaf = 0; leaf < n_leafs + n_leafsExtra; leaf++) {
549  h_0_vec[(entAry[ii]->m_unpacker[clk_map]) * (n_leafs + n_leafsExtra) + leaf] = *Bits[leaf];
550  }
551  }
552  int coml1rvc = h_0_vec[0 * (n_leafs + n_leafsExtra) + _e_coml1rvc];
553  int toprvc = h_0_vec[0 * (n_leafs + n_leafsExtra) + _e_toprvc];
554  int eclrvc = h_0_vec[0 * (n_leafs + n_leafsExtra) + _e_eclrvc];
555  int cdcrvc = h_0_vec[0 * (n_leafs + n_leafsExtra) + _e_cdcrvc];
556  int c1_top_timing = h_0_vec[(n_clocks - 1) * (n_leafs + n_leafsExtra) + _e_toptiming];
557  int c1_ecl_timing = h_0_vec[(n_clocks - 1) * (n_leafs + n_leafsExtra) + _e_ecltiming];
558  int c1_cdc_timing = h_0_vec[(n_clocks - 1) * (n_leafs + n_leafsExtra) + _e_cdctiming];
559  int c8_top_timing = c1_top_timing >> 3;
560  int c2_top_timing = c1_top_timing >> 1;
561  int c8_ecl_timing = c1_ecl_timing >> 3;
562  int c2_ecl_timing = c1_ecl_timing >> 1;
563  int c8_cdc_timing = c1_cdc_timing >> 3;
564  int c2_cdc_timing = c1_cdc_timing >> 1;
565 
566  if (begin_run) {
567  B2DEBUG(20, "nconf(" << nconf
568  << "), n_clocks(" << n_clocks
569  << "), n_leafs(" << n_leafs
570  << "), n_leafsExtra(" << n_leafsExtra
571  << ")");
572  begin_run = false;
573  }
574 
575  int psn[10] = {0};
576  int ftd[10] = {0};
577  int itd[10] = {0};
578  int timtype = 0;
579 
580 
581  int gdll1_rvc = h_0_vec[(n_clocks - 1) * (n_leafs + n_leafsExtra) + _e_gdll1rvc];
582 
583  // fill event by event timing histogram and get time integrated bit info
584  for (unsigned clk = 1; clk <= n_clocks; clk++) {
585  int psn_tmp[10] = {0};
586  int ftd_tmp[10] = {0};
587  int itd_tmp[10] = {0};
588  for (unsigned j = 0; j < (unsigned)nword_input; j++) {
589  itd_tmp[j] = h_0_vec[(clk - 1) * (n_leafs + n_leafsExtra) + ee_itd[j]];
590  itd[j] |= itd_tmp[j];
591  for (int i = 0; i < 32; i++) {
592  if (i + j * 32 >= n_inbit)continue;
593  if (itd_tmp[j] & (1 << i)) h_i_vec[(clk - 1)*n_inbit + i + j * 32] = 1;
594  }
595  }
596  if (nconf == 0) {
597  psn_tmp[0] = h_0_vec[(clk - 1) * (n_leafs + n_leafsExtra) + ee_psn[0]];
598  ftd_tmp[0] = h_0_vec[(clk - 1) * (n_leafs + n_leafsExtra) + ee_ftd[0]];
599  psn[0] |= psn_tmp[0];
600  ftd[0] |= ftd_tmp[0];
601  for (unsigned int i = 0; i < 32; i++) {
602  if (i >= n_outbit)continue;
603  if (psn_tmp[0] & (1 << i)) h_p_vec[(clk - 1)*n_outbit + i] = 1;
604  if (ftd_tmp[0] & (1 << i)) h_f_vec[(clk - 1)*n_outbit + i] = 1;
605  }
606  psn_tmp[1] = h_0_vec[(clk - 1) * n_outbit + ee_psn[2]] * (1 << 16) + h_0_vec[(clk - 1) * n_outbit + ee_psn[1]];
607  ftd_tmp[1] = h_0_vec[(clk - 1) * n_outbit + ee_ftd[2]] * (1 << 16) + h_0_vec[(clk - 1) * n_outbit + ee_ftd[1]];
608  psn[1] |= psn_tmp[1];
609  ftd[1] |= ftd_tmp[1];
610  for (unsigned int i = 0; i < 32; i++) {
611  if (i + 32 >= n_outbit)continue;
612  if (psn_tmp[1] & (1 << i)) h_p_vec[(clk - 1)*n_outbit + i + 32] = 1;
613  if (ftd_tmp[1] & (1 << i)) h_f_vec[(clk - 1)*n_outbit + i + 32] = 1;
614  }
615  } else {
616  for (unsigned j = 0; j < (unsigned)nword_output; j++) {
617  psn_tmp[j] = h_0_vec[(clk - 1) * (n_leafs + n_leafsExtra) + ee_psn[j]];
618  ftd_tmp[j] = h_0_vec[(clk - 1) * (n_leafs + n_leafsExtra) + ee_ftd[j]];
619  psn[j] |= psn_tmp[j];
620  ftd[j] |= ftd_tmp[j];
621  for (int i = 0; i < 32; i++) {
622  if (i + j * 32 >= n_outbit)continue;
623  if (psn_tmp[j] & (1 << i)) h_p_vec[(clk - 1)*n_outbit + i + j * 32] = 1;
624  if (ftd_tmp[j] & (1 << i)) h_f_vec[(clk - 1)*n_outbit + i + j * 32] = 1;
625  }
626  }
627  }
628  int timtype_tmp = h_0_vec[(clk - 1) * (n_leafs + n_leafsExtra) + _e_timtype];
629  timtype = (timtype_tmp == 0) ? timtype : timtype_tmp;
630 
631  } // clk
632 
633 
634  // fill rising and falling edges
635  fillRiseFallTimings();
636  // fill Output_extra for efficiency study
637  fillOutputExtra();
638  // fill Output_overlap for trigger rate study
639  fillOutputOverlap();
640 
641  // fill summary histograms
642  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
643  h_timtype[skim[ifill]]->Fill(timtype);
644  h_itd[skim[ifill]]->Fill(-0.5);
645  h_ftd[skim[ifill]]->Fill(-0.5);
646  h_psn[skim[ifill]]->Fill(-0.5);
647  for (int i = 0; i < 32; i++) {
648  for (unsigned j = 0; j < (unsigned)nword_input; j++) {
649  if (itd[j] & (1 << i)) h_itd[skim[ifill]]->Fill(i + 0.5 + 32 * j);
650  }
651  for (unsigned j = 0; j < (unsigned)nword_output; j++) {
652  if (ftd[j] & (1 << i)) h_ftd[skim[ifill]]->Fill(i + 0.5 + 32 * j);
653  if (psn[j] & (1 << i)) h_psn[skim[ifill]]->Fill(i + 0.5 + 32 * j);
654  }
655  }
656 
657  // fill timestamp values stored in header
658  int gdlL1TocomL1 = gdll1_rvc < coml1rvc ? coml1rvc - gdll1_rvc : (coml1rvc + 1280) - gdll1_rvc;
659  h_c8_gdlL1TocomL1[skim[ifill]]->Fill(gdlL1TocomL1);
660 
661  int topTogdlL1 = gdll1_rvc < c8_top_timing ? (gdll1_rvc + 1280) - c8_top_timing : gdll1_rvc - c8_top_timing;
662  h_c8_topTogdlL1[skim[ifill]]->Fill(topTogdlL1);
663 
664  int eclTogdlL1 = gdll1_rvc < c8_ecl_timing ? (gdll1_rvc + 1280) - c8_ecl_timing : gdll1_rvc - c8_ecl_timing;
665  h_c8_eclTogdlL1[skim[ifill]]->Fill(eclTogdlL1);
666 
667  int cdcTogdlL1 = gdll1_rvc < c8_cdc_timing ? (gdll1_rvc + 1280) - c8_cdc_timing : gdll1_rvc - c8_cdc_timing;
668  h_c8_cdcTogdlL1[skim[ifill]]->Fill(cdcTogdlL1);
669 
670  int c127_ecl_timing = c8_ecl_timing & (((1 << 7) - 1) << 4);
671  int fit8mToGDL = c127_ecl_timing < eclrvc ? eclrvc - c127_ecl_timing : (eclrvc + 1280) - c127_ecl_timing;
672  h_c8_ecl8mToGDL[skim[ifill]]->Fill(fit8mToGDL);
673 
674  int topToGDL = c8_top_timing < toprvc ? toprvc - c8_top_timing : (toprvc + 1280) - c8_top_timing;
675  h_c8_topToGDL[skim[ifill]]->Fill(topToGDL);
676  int eclToGDL = c8_ecl_timing < eclrvc ? eclrvc - c8_ecl_timing : (eclrvc + 1280) - c8_ecl_timing;
677  h_c8_eclToGDL[skim[ifill]]->Fill(eclToGDL);
678  int cdcToGDL = c8_cdc_timing < cdcrvc ? cdcrvc - c8_cdc_timing : (cdcrvc + 1280) - c8_cdc_timing;
679  h_c8_cdcToGDL[skim[ifill]]->Fill(cdcToGDL);
680 
681  int c2_comL1 = coml1rvc << 2;
682  int c2_gdlL1 = gdll1_rvc << 2;
683  int c2_diff_cdcTogdlL1 = c2_gdlL1 > c2_cdc_timing ?
684  c2_gdlL1 - c2_cdc_timing :
685  c2_gdlL1 - c2_cdc_timing + (1280 << 2) ;
686  h_ns_cdcTogdlL1[skim[ifill]]->Fill(c2_diff_cdcTogdlL1 * clkTo2ns);
687 
688  int c2_diff_cdcTocomL1 = c2_comL1 > c2_cdc_timing ?
689  c2_comL1 - c2_cdc_timing :
690  c2_comL1 - c2_cdc_timing + (1280 << 2) ;
691  h_c2_cdcTocomL1[skim[ifill]]->Fill(c2_diff_cdcTocomL1);
692  h_ns_cdcTocomL1[skim[ifill]]->Fill(c2_diff_cdcTocomL1 * clkTo2ns);
693 
694  int c2_diff_cdcToecl = c2_ecl_timing > c2_cdc_timing ?
695  c2_ecl_timing - c2_cdc_timing :
696  c2_ecl_timing - c2_cdc_timing + (1280 << 2);
697  h_c2_cdcToecl[skim[ifill]]->Fill(c2_diff_cdcToecl);
698  h_ns_cdcToecl[skim[ifill]]->Fill(c2_diff_cdcToecl * clkTo2ns);
699 
700  int c1_diff_topToecl = c1_ecl_timing > c1_top_timing ?
701  c1_ecl_timing - c1_top_timing :
702  c1_ecl_timing - c1_top_timing + (1280 << 3);
703  h_ns_topToecl[skim[ifill]]->Fill(c1_diff_topToecl * clkTo1ns);
704 
705  int c2_diff_topTocdc = c2_cdc_timing > c2_top_timing ?
706  c2_cdc_timing - c2_top_timing :
707  c2_cdc_timing - c2_top_timing + (1280 << 2);
708  h_ns_topTocdc[skim[ifill]]->Fill(c2_diff_topTocdc * clkTo2ns);
709  }
710 
711 
712  // vcd dump
713  if (m_dumpVcdFile) {
714  if (anaBitCondition()) {
715  nvcd++;
716  B2DEBUG(20, "anaBitCondition fired, evt(" << evtno << ")");
717  if (m_vcdEventStart <= nvcd && nvcd < m_vcdEventStart + m_vcdNumberOfEvents) {
718  genVcd();
719  }
720  }
721  }
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  // cppcheck-suppress knownConditionTrueFalse
770  if (((!not_flag && fired) || (not_flag && !fired)) && result_the_term) {
771  return true;
772  }
773  }
774  }
775  }
776  } else if ('+' == cst[i] || i == m_bitConditionToDumpVcd.length() - 1) {
777  // End of the term.
778  if (reading_word) { // 'xxx+'
779  if (result_the_term) {
780  bool fired = isFired(m_bitConditionToDumpVcd.substr(begin_word, word_length));
781  B2DEBUG(20,
782  m_bitConditionToDumpVcd.substr(begin_word, word_length).c_str()
783  << "(" << fired << ")");
784  if ((!not_flag && fired) || (not_flag && !fired)) {
785  return true;
786  } else {
787  // this term is denied by the latest bit
788  }
789  } else {
790  // already false.
791  }
792  reading_word = false;
793  } else {
794  // prior char is blank, 'xxx +'
795  if (result_the_term) {
796  return true;
797  } else {
798  // already false
799  }
800  }
801  result_the_term = true; // go to next term
802  } else {
803  // can be blank (white space) or any delimiter.
804  if (reading_word) {
805  // end of a word, 'xxxx '
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_vec[(clk - 1)*n_inbit + k - 1]) {
872  prev_i[k - 1] = h_i_vec[(clk - 1) * n_inbit + k - 1];
873  outf << h_i_vec[(clk - 1)*n_inbit + k - 1] << "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_vec[(clk - 1)*n_outbit + k - 1]) {
879  prev_f[k - 1] = h_f_vec[(clk - 1) * n_outbit + k - 1];
880  outf << h_f_vec[(clk - 1)*n_outbit + k - 1] << "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_vec[(clk - 1)*n_outbit + k - 1]) {
886  prev_p[k - 1] = h_p_vec[(clk - 1) * n_outbit + k - 1];
887  outf << h_p_vec[(clk - 1)*n_outbit + k - 1] << "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_quick(const std::string& bitname, const bool& isPsnm = 0)
916 {
917  int bn = getoutbitnum(bitname.c_str());
918  for (unsigned clk = 0; clk < n_clocks; clk++) {
919  if (bn > -1) {
920  if (isPsnm) {
921  if (h_p_vec[clk * n_outbit + bn] > 0)
922  return true;
923  } else {
924  if (h_f_vec[clk * n_outbit + bn] > 0)
925  return true;
926  }
927  }
928  }
929  bn = getinbitnum(bitname.c_str());
930  for (unsigned clk = 0; clk < n_clocks; clk++) {
931  if (bn > -1) {
932  if (h_i_vec[clk * n_inbit + bn] > 0)
933  return true;
934  }
935  }
936  return false;
937 }
938 
939 int
940 TRGGDLDQMModule::getinbitnum(const char* c) const
941 {
942  for (int i = 0; i < 320; i++) {
943  if (strcmp(c, inbitname[i]) == 0)return i;
944  }
945  return -1;
946 }
947 
948 int
949 TRGGDLDQMModule::getoutbitnum(const char* c) const
950 {
951  for (int i = 0; i < 320; i++) {
952  if (strcmp(c, outbitname[i]) == 0)return i;
953  }
954  return -1;
955 }
956 
957 
958 bool
959 TRGGDLDQMModule::isFired(std::string bitname)
960 {
961  bool isPsnm = false;
962  for (unsigned i = 0; i < bitname.length(); i++) {
963  if ('A' <= bitname[i] && bitname[i] <= 'Z') {
964  isPsnm = true;
965  }
966  }
967  boost::algorithm::to_lower(bitname);
968  int bn = m_dbftdl->getoutbitnum(bitname.c_str());
969  for (unsigned clk = 0; clk < n_clocks; clk++) {
970  if (bn > -1) {
971  if (isPsnm) {
972  if (h_p_vec[clk * n_outbit + bn] > 0)
973  return true;
974  } else {
975  if (h_f_vec[clk * n_outbit + bn] > 0)
976  return true;
977  }
978  }
979  }
980  bn = m_dbinput->getinbitnum(bitname.c_str());
981  for (unsigned clk = 0; clk < n_clocks; clk++) {
982  if (bn > -1) {
983  if (h_i_vec[clk * n_inbit + bn] > 0)
984  return true;
985  }
986  }
987  return false;
988 }
989 
990 void
991 TRGGDLDQMModule::fillRiseFallTimings(void)
992 {
993 
994 
995  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
996  //reduce #plot
997  if (skim[ifill] != 0)continue;
998 
999  for (unsigned i = 0; i < n_inbit; i++) {
1000  if (n_clocks == 32) {
1001  h_itd_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
1002  h_itd_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
1003  h_itd_rise[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
1004  h_itd_fall[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
1005  } else {
1006  h_itd_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
1007  h_itd_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
1008  }
1009  bool rising_done = false;
1010  bool falling_done = false;
1011  for (unsigned clk = 0; clk < n_clocks; clk++) {
1012  if (h_i_vec[clk * n_inbit + i] > 0) {
1013  if (! rising_done) {
1014  h_itd_rise[i][skim[ifill]]->Fill(clk + 0.5);
1015  rising_done = true;
1016  // cppcheck-suppress knownConditionTrueFalse
1017  } else if (rising_done && !falling_done && clk == n_clocks - 1) {
1018  h_itd_fall[i][skim[ifill]]->Fill(clk + 0.5);
1019  }
1020  } else if (h_i_vec[clk * n_inbit + i] == 0) {
1021  if (rising_done && ! falling_done) {
1022  h_itd_fall[i][skim[ifill]]->Fill(clk + 0.5);
1023  falling_done = true;
1024  }
1025  }
1026  }
1027  }
1028  for (unsigned i = 0; i < n_outbit; i++) {
1029  if (n_clocks == 32) {
1030  h_ftd_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
1031  h_psn_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
1032  h_ftd_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
1033  h_psn_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk32ns");
1034  h_ftd_rise[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
1035  h_psn_rise[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
1036  h_ftd_fall[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
1037  h_psn_fall[i][skim[ifill]]->GetXaxis()->SetRange(1, 32);
1038  } else {
1039  h_ftd_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
1040  h_psn_rise[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
1041  h_ftd_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
1042  h_psn_fall[i][skim[ifill]]->GetXaxis()->SetTitle("clk8ns");
1043  }
1044  bool rising_done = false;
1045  bool falling_done = false;
1046  for (unsigned clk = 0; clk < n_clocks; clk++) {
1047  if (h_f_vec[clk * n_outbit + i] > 0) {
1048  if (! rising_done) {
1049  h_ftd_rise[i][skim[ifill]]->Fill(clk + 0.5);
1050  rising_done = true;
1051  // cppcheck-suppress knownConditionTrueFalse
1052  } else if (rising_done && !falling_done && clk == n_clocks - 1) {
1053  h_ftd_fall[i][skim[ifill]]->Fill(clk + 0.5);
1054  }
1055  } else if (h_f_vec[clk * n_outbit + i] == 0) {
1056  if (rising_done && ! falling_done) {
1057  h_ftd_fall[i][skim[ifill]]->Fill(clk + 0.5);
1058  falling_done = true;
1059  }
1060  }
1061  }
1062  rising_done = false;
1063  falling_done = false;
1064  for (unsigned clk = 0; clk < n_clocks; clk++) {
1065  if (h_p_vec[clk * n_outbit + i] > 0) {
1066  if (! rising_done) {
1067  h_psn_rise[i][skim[ifill]]->Fill(clk + 0.5);
1068  rising_done = true;
1069  // cppcheck-suppress knownConditionTrueFalse
1070  } else if (rising_done && !falling_done && clk == n_clocks - 1) {
1071  h_psn_fall[i][skim[ifill]]->Fill(clk + 0.5);
1072  }
1073  } else if (h_p_vec[clk * n_outbit + i] == 0) {
1074  if (rising_done && ! falling_done) {
1075  h_psn_fall[i][skim[ifill]]->Fill(clk + 0.5);
1076  falling_done = true;
1077  }
1078  }
1079  }
1080  }
1081  }
1082 }
1083 
1084 
1085 void
1086 TRGGDLDQMModule::fillOutputOverlap(void)
1087 {
1088  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1089  bool ffy_fired = isFired_quick("ffy", true);
1090  bool fyo_fired = isFired_quick("fyo", true) || isFired_quick("fyb", true);
1091  bool c4_fired = isFired_quick("c4", true);
1092  bool hie_fired = isFired_quick("hie", true);
1093  bool klm_fired = isFired_quick("mu_b2b", true) || isFired_quick("mu_eb2b", true) || isFired_quick("eklm2", true)
1094  || isFired_quick("beklm", true);
1095  bool klm_match_fired = isFired_quick("cdcklm1", true) || isFired_quick("cdcklm2", true)
1096  || isFired_quick("seklm1", true) || isFired_quick("seklm2", true)
1097  || isFired_quick("fwd_seklm", true) || isFired_quick("bwd_seklm", true)
1098  || isFired_quick("ieklm1", true) || isFired_quick("ecleklm1", true);
1099  bool stt_fired = isFired_quick("stt", true) || isFired_quick("sttecl", true);
1100  bool short_fired = isFired_quick("syo", true) || isFired_quick("syb", true) || isFired_quick("yioiecl1", true) ;
1101  bool ff30_fired = isFired_quick("fy30", true);
1102  bool inner_fired = isFired_quick("ioiecl2", true);
1103  bool lml_fired = isFired_quick("lml0", true) || isFired_quick("lml2", true) || isFired_quick("lml6", true)
1104  || isFired_quick("lml7", true) || isFired_quick("lml8", true) || isFired_quick("lml9", true)
1105  || isFired_quick("lml10", true)
1106  || isFired_quick("lml12", true) || isFired_quick("lml13", true)
1107  || isFired_quick("lml14", true) || isFired_quick("lml15", true) || isFired_quick("lml16", true);
1108  bool gg_fired = isFired_quick("ggsel", true);
1109  bool bhabha_fired = isFired_quick("bhapur", true);
1110  bool pid_fired = isFired_quick("ssb", true) || isFired_quick("eed", true) || isFired_quick("fed", true)
1111  || isFired_quick("yp", true)
1112  || isFired_quick("fp", true) || isFired_quick("shem", true) || isFired_quick("ohem", true);
1113  bool bhamon_fired = isFired_quick("bffo", true) || isFired_quick("bhie", true) || isFired_quick("lml3", true)
1114  || isFired_quick("lml5", true) || isFired_quick("bha3d", true) || isFired_quick("bhabha", true) || isFired_quick("lume", true);
1115  bool eclmumu_fired = isFired_quick("eclmumu", true);
1116  bool lml1_fired = isFired_quick("lml1", true);
1117  bool lml4_fired = isFired_quick("lml4", true);
1118  bool veto_fired = isFired_quick("hiev", true) || isFired_quick("fffv", true);
1119  bool random_fired = isFired_quick("bg", true) || isFired_quick("poissonv", true) || isFired_quick("revolution", true)
1120  || isFired_quick("random", true);
1121  bool ffz_fired = isFired_quick("ffz", true);
1122  bool fzo_fired = isFired_quick("fzo", true) || isFired_quick("fzb", true);
1123  bool trg_calib_fired = isFired_quick("c2", true) || isFired_quick("c3", true) || isFired_quick("eklmhit", true)
1124  || isFired_quick("f", true) || isFired_quick("s", true);
1125  bool cdcecl_calib_fired = isFired_quick("cdcecl3", true) || isFired_quick("cdcecl4", true);
1126 // bool monitor_fired = isFired_quick("fff", true) || isFired_quick("ffo", true) || isFired_quick("ffb", true)
1127 // || isFired_quick("fffo", true) || isFired_quick("ffs", true) || isFired_quick("fss", true) || isFired_quick("sss", true)
1128 // || isFired_quick("ff", true) || isFired_quick("ss", true) || isFired_quick("fso", true)
1129 // || isFired_quick("sso", true) || isFired_quick("fsb", true) || isFired_quick("ff30", true)
1130 // || isFired_quick("lume", true) || isFired_quick("c2", true) || isFired_quick("c3", true)
1131 // || isFired_quick("bha3d", true) || isFired_quick("bhabha", true)
1132 // || isFired_quick("g_high", true) || isFired_quick("g_c1", true) || isFired_quick("gg", true)
1133 // || isFired_quick("eklmhit", true) || isFired_quick("fioiecl1", true) || isFired_quick("ioiecl1", true)
1134 // || isFired_quick("cdcecl1", true) || isFired_quick("cdcecl2", true) || isFired_quick("cdcecl3", true)
1135 // || isFired_quick("cdcecl4", true) || isFired_quick("c2gev1", true) || isFired_quick("c2gev2", true)
1136 // || isFired_quick("c2hie", true) || isFired_quick("f", true) || isFired_quick("s", true)
1137 // || isFired_quick("revolution", true) || isFired_quick("random", true);
1138  bool monitor_fired = isFired_quick("fff", true) || isFired_quick("ffo", true) || isFired_quick("ffb", true)
1139  || isFired_quick("fffo", true) || isFired_quick("ffs", true) || isFired_quick("fss", true) || isFired_quick("sss", true)
1140  || isFired_quick("ff", true) || isFired_quick("ss", true) || isFired_quick("fso", true)
1141  || isFired_quick("sso", true) || isFired_quick("fsb", true) || isFired_quick("ff30", true)
1142  || isFired_quick("fioiecl1", true) || isFired_quick("ioiecl1", true)
1143  || isFired_quick("cdcecl1", true) || isFired_quick("cdcecl2", true)
1144  || isFired_quick("c2gev1", true) || isFired_quick("c2gev2", true)
1145  || isFired_quick("g_high", true) || isFired_quick("g_c1", true) || isFired_quick("gg", true)
1146  || isFired_quick("c2hie", true) || isFired_quick("stt6", true);
1147 // bool monitor_fired = isFired_quick("c2hie", true);
1148 
1149  bool B_CDC_fired = ffy_fired || fyo_fired;
1150  bool B_ECL_fired = c4_fired || hie_fired;
1151  bool LOW_KLM_fired = klm_fired || klm_match_fired;
1152  bool LOW_CDC_fired = stt_fired || short_fired || ff30_fired || inner_fired;
1153  bool LOW_ECL_fired = lml_fired || cdcecl_calib_fired;
1154  bool CALIB_fired = gg_fired || bhabha_fired || pid_fired || bhamon_fired || eclmumu_fired || lml1_fired || lml4_fired || veto_fired
1155  || random_fired || trg_calib_fired;
1156  bool MONITOR_fired = monitor_fired || ffz_fired || fzo_fired;
1157 
1158  //all event
1159  if (1) {
1160  h_psn_effect_to_l1[skim[ifill]]->Fill(0.5);
1161  }
1162  //main category
1163  if (B_CDC_fired) {
1164  h_psn_effect_to_l1[skim[ifill]]->Fill(1.5);
1165  } else if (B_ECL_fired) {
1166  h_psn_effect_to_l1[skim[ifill]]->Fill(2.5);
1167  } else if (LOW_KLM_fired) {
1168  h_psn_effect_to_l1[skim[ifill]]->Fill(3.5);
1169  } else if (LOW_CDC_fired) {
1170  h_psn_effect_to_l1[skim[ifill]]->Fill(4.5);
1171  } else if (LOW_ECL_fired) {
1172  h_psn_effect_to_l1[skim[ifill]]->Fill(5.5);
1173  } else if (CALIB_fired) {
1174  h_psn_effect_to_l1[skim[ifill]]->Fill(6.5);
1175  } else if (MONITOR_fired) {
1176  h_psn_effect_to_l1[skim[ifill]]->Fill(7.5);
1177  } else {
1178  h_psn_effect_to_l1[skim[ifill]]->Fill(8.5);
1179  }
1180  //detail category
1181  if (ffy_fired) {
1182  h_psn_effect_to_l1[skim[ifill]]->Fill(9.5);
1183  } else if (fyo_fired) {
1184  h_psn_effect_to_l1[skim[ifill]]->Fill(10.5);
1185  } else if (c4_fired) {
1186  h_psn_effect_to_l1[skim[ifill]]->Fill(11.5);
1187  } else if (hie_fired) {
1188  h_psn_effect_to_l1[skim[ifill]]->Fill(12.5);
1189  } else if (klm_fired) {
1190  h_psn_effect_to_l1[skim[ifill]]->Fill(13.5);
1191  } else if (klm_match_fired) {
1192  h_psn_effect_to_l1[skim[ifill]]->Fill(14.5);
1193  } else if (stt_fired) {
1194  h_psn_effect_to_l1[skim[ifill]]->Fill(15.5);
1195  } else if (short_fired) {
1196  h_psn_effect_to_l1[skim[ifill]]->Fill(16.5);
1197  } else if (ff30_fired) {
1198  h_psn_effect_to_l1[skim[ifill]]->Fill(17.5);
1199  } else if (inner_fired) {
1200  h_psn_effect_to_l1[skim[ifill]]->Fill(18.5);
1201  } else if (lml_fired) {
1202  h_psn_effect_to_l1[skim[ifill]]->Fill(19.5);
1203  } else if (gg_fired) {
1204  h_psn_effect_to_l1[skim[ifill]]->Fill(20.5);
1205  } else if (bhabha_fired) {
1206  h_psn_effect_to_l1[skim[ifill]]->Fill(21.5);
1207  } else if (pid_fired) {
1208  h_psn_effect_to_l1[skim[ifill]]->Fill(22.5);
1209  } else if (bhamon_fired) {
1210  h_psn_effect_to_l1[skim[ifill]]->Fill(23.5);
1211  } else if (eclmumu_fired) {
1212  h_psn_effect_to_l1[skim[ifill]]->Fill(24.5);
1213  } else if (lml1_fired) {
1214  h_psn_effect_to_l1[skim[ifill]]->Fill(25.5);
1215  } else if (lml4_fired) {
1216  h_psn_effect_to_l1[skim[ifill]]->Fill(26.5);
1217  } else if (veto_fired) {
1218  h_psn_effect_to_l1[skim[ifill]]->Fill(27.5);
1219  } else if (random_fired) {
1220  h_psn_effect_to_l1[skim[ifill]]->Fill(28.5);
1221  } else if (ffz_fired) {
1222  h_psn_effect_to_l1[skim[ifill]]->Fill(29.5);
1223  } else if (fzo_fired) {
1224  h_psn_effect_to_l1[skim[ifill]]->Fill(30.5);
1225  } else if (monitor_fired) {
1226  h_psn_effect_to_l1[skim[ifill]]->Fill(31.5);
1227  } else {
1228  h_psn_effect_to_l1[skim[ifill]]->Fill(32.5);
1229  }
1230  //full dump without category
1231  if (isFired_quick("ffy", true)) {
1232  h_psn_effect_to_l1[skim[ifill]]->Fill(33.5);
1233  } else if (isFired_quick("fyb", true)) {
1234  h_psn_effect_to_l1[skim[ifill]]->Fill(34.5);
1235  } else if (isFired_quick("fyo", true)) {
1236  h_psn_effect_to_l1[skim[ifill]]->Fill(35.5);
1237  } else if (isFired_quick("c4", true)) {
1238  h_psn_effect_to_l1[skim[ifill]]->Fill(36.5);
1239  } else if (isFired_quick("hie", true)) {
1240  h_psn_effect_to_l1[skim[ifill]]->Fill(37.5);
1241  } else if (isFired_quick("mu_b2b", true)) {
1242  h_psn_effect_to_l1[skim[ifill]]->Fill(38.5);
1243  } else if (isFired_quick("mu_eb2b", true)) {
1244  h_psn_effect_to_l1[skim[ifill]]->Fill(39.5);
1245  } else if (isFired_quick("eklm2", true)) {
1246  h_psn_effect_to_l1[skim[ifill]]->Fill(40.5);
1247  } else if (isFired_quick("beklm", true)) {
1248  h_psn_effect_to_l1[skim[ifill]]->Fill(41.5);
1249  } else if (isFired_quick("cdcklm1", true)) {
1250  h_psn_effect_to_l1[skim[ifill]]->Fill(42.5);
1251  } else if (isFired_quick("cdcklm2", true)) {
1252  h_psn_effect_to_l1[skim[ifill]]->Fill(43.5);
1253  } else if (isFired_quick("seklm1", true)) {
1254  h_psn_effect_to_l1[skim[ifill]]->Fill(44.5);
1255  } else if (isFired_quick("seklm2", true)) {
1256  h_psn_effect_to_l1[skim[ifill]]->Fill(45.5);
1257  } else if (isFired_quick("fwd_seklm", true)) {
1258  h_psn_effect_to_l1[skim[ifill]]->Fill(46.5);
1259  } else if (isFired_quick("bwd_seklm", true)) {
1260  h_psn_effect_to_l1[skim[ifill]]->Fill(47.5);
1261  } else if (isFired_quick("ecleklm1", true)) {
1262  h_psn_effect_to_l1[skim[ifill]]->Fill(48.5);
1263  } else if (isFired_quick("ieklm1", true)) {
1264  h_psn_effect_to_l1[skim[ifill]]->Fill(49.5);
1265  } else if (isFired_quick("sttecl", true)) {
1266  h_psn_effect_to_l1[skim[ifill]]->Fill(50.5);
1267  } else if (isFired_quick("stt", true)) {
1268  h_psn_effect_to_l1[skim[ifill]]->Fill(51.5);
1269  } else if (isFired_quick("syb", true)) {
1270  h_psn_effect_to_l1[skim[ifill]]->Fill(52.5);
1271  } else if (isFired_quick("syo", true)) {
1272  h_psn_effect_to_l1[skim[ifill]]->Fill(53.5);
1273  } else if (isFired_quick("yioiecl1", true)) {
1274  h_psn_effect_to_l1[skim[ifill]]->Fill(54.5);
1275  } else if (isFired_quick("fy30", true)) {
1276  h_psn_effect_to_l1[skim[ifill]]->Fill(55.5);
1277  } else if (isFired_quick("ioiecl2", true)) {
1278  h_psn_effect_to_l1[skim[ifill]]->Fill(56.5);
1279  } else if (isFired_quick("lml0", true)) {
1280  h_psn_effect_to_l1[skim[ifill]]->Fill(57.5);
1281  } else if (isFired_quick("lml2", true)) {
1282  h_psn_effect_to_l1[skim[ifill]]->Fill(58.5);
1283  } else if (isFired_quick("lml6", true)) {
1284  h_psn_effect_to_l1[skim[ifill]]->Fill(59.5);
1285  } else if (isFired_quick("lml7", true)) {
1286  h_psn_effect_to_l1[skim[ifill]]->Fill(60.5);
1287  } else if (isFired_quick("lml8", true)) {
1288  h_psn_effect_to_l1[skim[ifill]]->Fill(61.5);
1289  } else if (isFired_quick("lml9", true)) {
1290  h_psn_effect_to_l1[skim[ifill]]->Fill(62.5);
1291  } else if (isFired_quick("lml10", true)) {
1292  h_psn_effect_to_l1[skim[ifill]]->Fill(63.5);
1293  } else if (isFired_quick("lml12", true)) {
1294  h_psn_effect_to_l1[skim[ifill]]->Fill(64.5);
1295  } else if (isFired_quick("lml13", true)) {
1296  h_psn_effect_to_l1[skim[ifill]]->Fill(65.5);
1297  } else if (isFired_quick("lml14", true)) {
1298  h_psn_effect_to_l1[skim[ifill]]->Fill(66.5);
1299  } else if (isFired_quick("lml15", true)) {
1300  h_psn_effect_to_l1[skim[ifill]]->Fill(67.5);
1301  } else if (isFired_quick("lml16", true)) {
1302  h_psn_effect_to_l1[skim[ifill]]->Fill(68.5);
1303  } else if (isFired_quick("ggsel", true)) {
1304  h_psn_effect_to_l1[skim[ifill]]->Fill(69.5);
1305  } else if (isFired_quick("bhapur", true)) {
1306  h_psn_effect_to_l1[skim[ifill]]->Fill(70.5);
1307  } else if (isFired_quick("lml3", true)) {
1308  h_psn_effect_to_l1[skim[ifill]]->Fill(71.5);
1309  } else if (isFired_quick("lml5", true)) {
1310  h_psn_effect_to_l1[skim[ifill]]->Fill(72.5);
1311  } else if (isFired_quick("bha3d", true)) {
1312  h_psn_effect_to_l1[skim[ifill]]->Fill(73.5);
1313  } else if (isFired_quick("bhabha", true)) {
1314  h_psn_effect_to_l1[skim[ifill]]->Fill(74.5);
1315  } else if (isFired_quick("lume", true)) {
1316  h_psn_effect_to_l1[skim[ifill]]->Fill(75.5);
1317  } else if (isFired_quick("bffo", true)) {
1318  h_psn_effect_to_l1[skim[ifill]]->Fill(76.5);
1319  } else if (isFired_quick("bhie", true)) {
1320  h_psn_effect_to_l1[skim[ifill]]->Fill(77.5);
1321  } else if (isFired_quick("eclmumu", true)) {
1322  h_psn_effect_to_l1[skim[ifill]]->Fill(78.5);
1323  } else if (isFired_quick("lml1", true)) {
1324  h_psn_effect_to_l1[skim[ifill]]->Fill(79.5);
1325  } else if (isFired_quick("lml4", true)) {
1326  h_psn_effect_to_l1[skim[ifill]]->Fill(80.5);
1327  } else if (isFired_quick("ssb", true)) {
1328  h_psn_effect_to_l1[skim[ifill]]->Fill(81.5);
1329  } else if (isFired_quick("eed", true)) {
1330  h_psn_effect_to_l1[skim[ifill]]->Fill(82.5);
1331  } else if (isFired_quick("fed", true)) {
1332  h_psn_effect_to_l1[skim[ifill]]->Fill(83.5);
1333  } else if (isFired_quick("yp", true)) {
1334  h_psn_effect_to_l1[skim[ifill]]->Fill(84.5);
1335  } else if (isFired_quick("fp", true)) {
1336  h_psn_effect_to_l1[skim[ifill]]->Fill(85.5);
1337  } else if (isFired_quick("shem", true)) {
1338  h_psn_effect_to_l1[skim[ifill]]->Fill(86.5);
1339  } else if (isFired_quick("ohem", true)) {
1340  h_psn_effect_to_l1[skim[ifill]]->Fill(87.5);
1341  } else if (isFired_quick("hiev", true)) {
1342  h_psn_effect_to_l1[skim[ifill]]->Fill(88.5);
1343  } else if (isFired_quick("fffv", true)) {
1344  h_psn_effect_to_l1[skim[ifill]]->Fill(89.5);
1345  } else if (isFired_quick("bg", true)) {
1346  h_psn_effect_to_l1[skim[ifill]]->Fill(90.5);
1347  } else if (isFired_quick("poissonv", true)) {
1348  h_psn_effect_to_l1[skim[ifill]]->Fill(91.5);
1349  } else if (isFired_quick("revolution", true)) {
1350  h_psn_effect_to_l1[skim[ifill]]->Fill(92.5);
1351  } else if (isFired_quick("random", true)) {
1352  h_psn_effect_to_l1[skim[ifill]]->Fill(93.5);
1353  } else if (isFired_quick("c2", true)) {
1354  h_psn_effect_to_l1[skim[ifill]]->Fill(94.5);
1355  } else if (isFired_quick("c3", true)) {
1356  h_psn_effect_to_l1[skim[ifill]]->Fill(95.5);
1357  } else if (isFired_quick("eklmhit", true)) {
1358  h_psn_effect_to_l1[skim[ifill]]->Fill(96.5);
1359  } else if (isFired_quick("f", true)) {
1360  h_psn_effect_to_l1[skim[ifill]]->Fill(97.5);
1361  } else if (isFired_quick("s", true)) {
1362  h_psn_effect_to_l1[skim[ifill]]->Fill(98.5);
1363  } else if (isFired_quick("y", true)) {
1364  h_psn_effect_to_l1[skim[ifill]]->Fill(99.5);
1365  } else if (isFired_quick("cdcecl3", true)) {
1366  h_psn_effect_to_l1[skim[ifill]]->Fill(100.5);
1367  } else if (isFired_quick("cdcecl4", true)) {
1368  h_psn_effect_to_l1[skim[ifill]]->Fill(101.5);
1369  } else if (isFired_quick("ffz", true)) {
1370  h_psn_effect_to_l1[skim[ifill]]->Fill(102.5);
1371  } else if (isFired_quick("fzb", true)) {
1372  h_psn_effect_to_l1[skim[ifill]]->Fill(103.5);
1373  } else if (isFired_quick("fzo", true)) {
1374  h_psn_effect_to_l1[skim[ifill]]->Fill(104.5);
1375  } else if (isFired_quick("fff", true)) {
1376  h_psn_effect_to_l1[skim[ifill]]->Fill(105.5);
1377  } else if (isFired_quick("ffb", true)) {
1378  h_psn_effect_to_l1[skim[ifill]]->Fill(106.5);
1379  } else if (isFired_quick("ffo", true)) {
1380  h_psn_effect_to_l1[skim[ifill]]->Fill(107.5);
1381  } else if (isFired_quick("fffo", true)) {
1382  h_psn_effect_to_l1[skim[ifill]]->Fill(108.5);
1383  } else if (isFired_quick("ffs", true)) {
1384  h_psn_effect_to_l1[skim[ifill]]->Fill(109.5);
1385  } else if (isFired_quick("fss", true)) {
1386  h_psn_effect_to_l1[skim[ifill]]->Fill(110.5);
1387  } else if (isFired_quick("sss", true)) {
1388  h_psn_effect_to_l1[skim[ifill]]->Fill(111.5);
1389  } else if (isFired_quick("ff", true)) {
1390  h_psn_effect_to_l1[skim[ifill]]->Fill(112.5);
1391  } else if (isFired_quick("ss", true)) {
1392  h_psn_effect_to_l1[skim[ifill]]->Fill(113.5);
1393  } else if (isFired_quick("fso", true)) {
1394  h_psn_effect_to_l1[skim[ifill]]->Fill(114.5);
1395  } else if (isFired_quick("sso", true)) {
1396  h_psn_effect_to_l1[skim[ifill]]->Fill(115.5);
1397  } else if (isFired_quick("fsb", true)) {
1398  h_psn_effect_to_l1[skim[ifill]]->Fill(116.5);
1399  } else if (isFired_quick("ff30", true)) {
1400  h_psn_effect_to_l1[skim[ifill]]->Fill(117.5);
1401  } else if (isFired_quick("fioiecl1", true)) {
1402  h_psn_effect_to_l1[skim[ifill]]->Fill(118.5);
1403  } else if (isFired_quick("ioiecl1", true)) {
1404  h_psn_effect_to_l1[skim[ifill]]->Fill(119.5);
1405  } else if (isFired_quick("cdcecl1", true)) {
1406  h_psn_effect_to_l1[skim[ifill]]->Fill(120.5);
1407  } else if (isFired_quick("cdcecl2", true)) {
1408  h_psn_effect_to_l1[skim[ifill]]->Fill(121.5);
1409  } else if (isFired_quick("c2gev1", true)) {
1410  h_psn_effect_to_l1[skim[ifill]]->Fill(122.5);
1411  } else if (isFired_quick("c2gev2", true)) {
1412  h_psn_effect_to_l1[skim[ifill]]->Fill(123.5);
1413  } else if (isFired_quick("c2hie", true)) {
1414  h_psn_effect_to_l1[skim[ifill]]->Fill(124.5);
1415  } else if (isFired_quick("g_high", true)) {
1416  h_psn_effect_to_l1[skim[ifill]]->Fill(125.5);
1417  } else if (isFired_quick("g_c1", true)) {
1418  h_psn_effect_to_l1[skim[ifill]]->Fill(126.5);
1419  } else if (isFired_quick("gg", true)) {
1420  h_psn_effect_to_l1[skim[ifill]]->Fill(127.5);
1421  } else if (isFired_quick("stt6", true)) {
1422  h_psn_effect_to_l1[skim[ifill]]->Fill(128.5);
1423  } else {
1424  h_psn_effect_to_l1[skim[ifill]]->Fill(129.5);
1425  }
1426 
1427  //all event
1428  if (1) {
1429  h_psn_raw_rate[skim[ifill]]->Fill(0.5);
1430  }
1431  //main category
1432  if (B_CDC_fired) {
1433  h_psn_raw_rate[skim[ifill]]->Fill(1.5);
1434  } if (B_ECL_fired) {
1435  h_psn_raw_rate[skim[ifill]]->Fill(2.5);
1436  } if (LOW_KLM_fired) {
1437  h_psn_raw_rate[skim[ifill]]->Fill(3.5);
1438  } if (LOW_CDC_fired) {
1439  h_psn_raw_rate[skim[ifill]]->Fill(4.5);
1440  } if (LOW_ECL_fired) {
1441  h_psn_raw_rate[skim[ifill]]->Fill(5.5);
1442  } if (CALIB_fired) {
1443  h_psn_raw_rate[skim[ifill]]->Fill(6.5);
1444  } if (MONITOR_fired) {
1445  h_psn_raw_rate[skim[ifill]]->Fill(7.5);
1446  }
1447  //detail category
1448  if (ffy_fired) {
1449  h_psn_raw_rate[skim[ifill]]->Fill(9.5);
1450  } if (fyo_fired) {
1451  h_psn_raw_rate[skim[ifill]]->Fill(10.5);
1452  } if (c4_fired) {
1453  h_psn_raw_rate[skim[ifill]]->Fill(11.5);
1454  } if (hie_fired) {
1455  h_psn_raw_rate[skim[ifill]]->Fill(12.5);
1456  } if (klm_fired) {
1457  h_psn_raw_rate[skim[ifill]]->Fill(13.5);
1458  } if (klm_match_fired) {
1459  h_psn_raw_rate[skim[ifill]]->Fill(14.5);
1460  } if (stt_fired) {
1461  h_psn_raw_rate[skim[ifill]]->Fill(15.5);
1462  } if (short_fired) {
1463  h_psn_raw_rate[skim[ifill]]->Fill(16.5);
1464  } if (ff30_fired) {
1465  h_psn_raw_rate[skim[ifill]]->Fill(17.5);
1466  } if (inner_fired) {
1467  h_psn_raw_rate[skim[ifill]]->Fill(18.5);
1468  } if (lml_fired) {
1469  h_psn_raw_rate[skim[ifill]]->Fill(19.5);
1470  } if (gg_fired) {
1471  h_psn_raw_rate[skim[ifill]]->Fill(20.5);
1472  } if (bhabha_fired) {
1473  h_psn_raw_rate[skim[ifill]]->Fill(21.5);
1474  } if (pid_fired) {
1475  h_psn_raw_rate[skim[ifill]]->Fill(22.5);
1476  } if (bhamon_fired) {
1477  h_psn_raw_rate[skim[ifill]]->Fill(23.5);
1478  } if (eclmumu_fired) {
1479  h_psn_raw_rate[skim[ifill]]->Fill(24.5);
1480  } if (lml1_fired) {
1481  h_psn_raw_rate[skim[ifill]]->Fill(25.5);
1482  } if (lml4_fired) {
1483  h_psn_raw_rate[skim[ifill]]->Fill(26.5);
1484  } if (veto_fired) {
1485  h_psn_raw_rate[skim[ifill]]->Fill(27.5);
1486  } if (random_fired) {
1487  h_psn_raw_rate[skim[ifill]]->Fill(28.5);
1488  } if (ffz_fired) {
1489  h_psn_raw_rate[skim[ifill]]->Fill(29.5);
1490  } if (fzo_fired) {
1491  h_psn_raw_rate[skim[ifill]]->Fill(30.5);
1492  } if (monitor_fired) {
1493  h_psn_raw_rate[skim[ifill]]->Fill(31.5);
1494  }
1495  //full dump without category
1496  if (isFired_quick("ffy", true)) {
1497  h_psn_raw_rate[skim[ifill]]->Fill(33.5);
1498  } if (isFired_quick("fyb", true)) {
1499  h_psn_raw_rate[skim[ifill]]->Fill(34.5);
1500  } if (isFired_quick("fyo", true)) {
1501  h_psn_raw_rate[skim[ifill]]->Fill(35.5);
1502  } if (isFired_quick("c4", true)) {
1503  h_psn_raw_rate[skim[ifill]]->Fill(36.5);
1504  } if (isFired_quick("hie", true)) {
1505  h_psn_raw_rate[skim[ifill]]->Fill(37.5);
1506  } if (isFired_quick("mu_b2b", true)) {
1507  h_psn_raw_rate[skim[ifill]]->Fill(38.5);
1508  } if (isFired_quick("mu_eb2b", true)) {
1509  h_psn_raw_rate[skim[ifill]]->Fill(39.5);
1510  } if (isFired_quick("eklm2", true)) {
1511  h_psn_raw_rate[skim[ifill]]->Fill(40.5);
1512  } if (isFired_quick("beklm", true)) {
1513  h_psn_raw_rate[skim[ifill]]->Fill(41.5);
1514  } if (isFired_quick("cdcklm1", true)) {
1515  h_psn_raw_rate[skim[ifill]]->Fill(42.5);
1516  } if (isFired_quick("cdcklm2", true)) {
1517  h_psn_raw_rate[skim[ifill]]->Fill(43.5);
1518  } if (isFired_quick("seklm1", true)) {
1519  h_psn_raw_rate[skim[ifill]]->Fill(44.5);
1520  } if (isFired_quick("seklm2", true)) {
1521  h_psn_raw_rate[skim[ifill]]->Fill(45.5);
1522  } if (isFired_quick("fwd_seklm", true)) {
1523  h_psn_raw_rate[skim[ifill]]->Fill(46.5);
1524  } if (isFired_quick("bwd_seklm", true)) {
1525  h_psn_raw_rate[skim[ifill]]->Fill(47.5);
1526  } if (isFired_quick("ecleklm1", true)) {
1527  h_psn_raw_rate[skim[ifill]]->Fill(48.5);
1528  } if (isFired_quick("ieklm1", true)) {
1529  h_psn_raw_rate[skim[ifill]]->Fill(49.5);
1530  } if (isFired_quick("sttecl", true)) {
1531  h_psn_raw_rate[skim[ifill]]->Fill(50.5);
1532  } if (isFired_quick("stt", true)) {
1533  h_psn_raw_rate[skim[ifill]]->Fill(51.5);
1534  } if (isFired_quick("syb", true)) {
1535  h_psn_raw_rate[skim[ifill]]->Fill(52.5);
1536  } if (isFired_quick("syo", true)) {
1537  h_psn_raw_rate[skim[ifill]]->Fill(53.5);
1538  } if (isFired_quick("yioiecl1", true)) {
1539  h_psn_raw_rate[skim[ifill]]->Fill(54.5);
1540  } if (isFired_quick("fy30", true)) {
1541  h_psn_raw_rate[skim[ifill]]->Fill(55.5);
1542  } if (isFired_quick("ioiecl2", true)) {
1543  h_psn_raw_rate[skim[ifill]]->Fill(56.5);
1544  } if (isFired_quick("lml0", true)) {
1545  h_psn_raw_rate[skim[ifill]]->Fill(57.5);
1546  } if (isFired_quick("lml2", true)) {
1547  h_psn_raw_rate[skim[ifill]]->Fill(58.5);
1548  } if (isFired_quick("lml6", true)) {
1549  h_psn_raw_rate[skim[ifill]]->Fill(59.5);
1550  } if (isFired_quick("lml7", true)) {
1551  h_psn_raw_rate[skim[ifill]]->Fill(60.5);
1552  } if (isFired_quick("lml8", true)) {
1553  h_psn_raw_rate[skim[ifill]]->Fill(61.5);
1554  } if (isFired_quick("lml9", true)) {
1555  h_psn_raw_rate[skim[ifill]]->Fill(62.5);
1556  } if (isFired_quick("lml10", true)) {
1557  h_psn_raw_rate[skim[ifill]]->Fill(63.5);
1558  } if (isFired_quick("lml12", true)) {
1559  h_psn_raw_rate[skim[ifill]]->Fill(64.5);
1560  } if (isFired_quick("lml13", true)) {
1561  h_psn_raw_rate[skim[ifill]]->Fill(65.5);
1562  } if (isFired_quick("lml14", true)) {
1563  h_psn_raw_rate[skim[ifill]]->Fill(66.5);
1564  } if (isFired_quick("lml15", true)) {
1565  h_psn_raw_rate[skim[ifill]]->Fill(67.5);
1566  } if (isFired_quick("lml16", true)) {
1567  h_psn_raw_rate[skim[ifill]]->Fill(68.5);
1568  } if (isFired_quick("ggsel", true)) {
1569  h_psn_raw_rate[skim[ifill]]->Fill(69.5);
1570  } if (isFired_quick("bhapur", true)) {
1571  h_psn_raw_rate[skim[ifill]]->Fill(70.5);
1572  } if (isFired_quick("lml3", true)) {
1573  h_psn_raw_rate[skim[ifill]]->Fill(71.5);
1574  } if (isFired_quick("lml5", true)) {
1575  h_psn_raw_rate[skim[ifill]]->Fill(72.5);
1576  } if (isFired_quick("bha3d", true)) {
1577  h_psn_raw_rate[skim[ifill]]->Fill(73.5);
1578  } if (isFired_quick("bhabha", true)) {
1579  h_psn_raw_rate[skim[ifill]]->Fill(74.5);
1580  } if (isFired_quick("lume", true)) {
1581  h_psn_raw_rate[skim[ifill]]->Fill(75.5);
1582  } if (isFired_quick("bffo", true)) {
1583  h_psn_raw_rate[skim[ifill]]->Fill(76.5);
1584  } if (isFired_quick("bhie", true)) {
1585  h_psn_raw_rate[skim[ifill]]->Fill(77.5);
1586  } if (isFired_quick("eclmumu", true)) {
1587  h_psn_raw_rate[skim[ifill]]->Fill(78.5);
1588  } if (isFired_quick("lml1", true)) {
1589  h_psn_raw_rate[skim[ifill]]->Fill(79.5);
1590  } if (isFired_quick("lml4", true)) {
1591  h_psn_raw_rate[skim[ifill]]->Fill(80.5);
1592  } if (isFired_quick("ssb", true)) {
1593  h_psn_raw_rate[skim[ifill]]->Fill(81.5);
1594  } if (isFired_quick("eed", true)) {
1595  h_psn_raw_rate[skim[ifill]]->Fill(82.5);
1596  } if (isFired_quick("fed", true)) {
1597  h_psn_raw_rate[skim[ifill]]->Fill(83.5);
1598  } if (isFired_quick("yp", true)) {
1599  h_psn_raw_rate[skim[ifill]]->Fill(84.5);
1600  } if (isFired_quick("fp", true)) {
1601  h_psn_raw_rate[skim[ifill]]->Fill(85.5);
1602  } if (isFired_quick("shem", true)) {
1603  h_psn_raw_rate[skim[ifill]]->Fill(86.5);
1604  } if (isFired_quick("ohem", true)) {
1605  h_psn_raw_rate[skim[ifill]]->Fill(87.5);
1606  } if (isFired_quick("hiev", true)) {
1607  h_psn_raw_rate[skim[ifill]]->Fill(88.5);
1608  } if (isFired_quick("fffv", true)) {
1609  h_psn_raw_rate[skim[ifill]]->Fill(89.5);
1610  } if (isFired_quick("bg", true)) {
1611  h_psn_raw_rate[skim[ifill]]->Fill(90.5);
1612  } if (isFired_quick("poissonv", true)) {
1613  h_psn_raw_rate[skim[ifill]]->Fill(91.5);
1614  } if (isFired_quick("revolution", true)) {
1615  h_psn_raw_rate[skim[ifill]]->Fill(92.5);
1616  } if (isFired_quick("random", true)) {
1617  h_psn_raw_rate[skim[ifill]]->Fill(93.5);
1618  } if (isFired_quick("c2", true)) {
1619  h_psn_raw_rate[skim[ifill]]->Fill(94.5);
1620  } if (isFired_quick("c3", true)) {
1621  h_psn_raw_rate[skim[ifill]]->Fill(95.5);
1622  } if (isFired_quick("eklmhit", true)) {
1623  h_psn_raw_rate[skim[ifill]]->Fill(96.5);
1624  } if (isFired_quick("f", true)) {
1625  h_psn_raw_rate[skim[ifill]]->Fill(97.5);
1626  } if (isFired_quick("s", true)) {
1627  h_psn_raw_rate[skim[ifill]]->Fill(98.5);
1628  } if (isFired_quick("y", true)) {
1629  h_psn_raw_rate[skim[ifill]]->Fill(99.5);
1630  } if (isFired_quick("cdcecl3", true)) {
1631  h_psn_raw_rate[skim[ifill]]->Fill(100.5);
1632  } if (isFired_quick("cdcecl4", true)) {
1633  h_psn_raw_rate[skim[ifill]]->Fill(101.5);
1634  } if (isFired_quick("ffz", true)) {
1635  h_psn_raw_rate[skim[ifill]]->Fill(102.5);
1636  } if (isFired_quick("fzb", true)) {
1637  h_psn_raw_rate[skim[ifill]]->Fill(103.5);
1638  } if (isFired_quick("fzo", true)) {
1639  h_psn_raw_rate[skim[ifill]]->Fill(104.5);
1640  } if (isFired_quick("fff", true)) {
1641  h_psn_raw_rate[skim[ifill]]->Fill(105.5);
1642  } if (isFired_quick("ffb", true)) {
1643  h_psn_raw_rate[skim[ifill]]->Fill(106.5);
1644  } if (isFired_quick("ffo", true)) {
1645  h_psn_raw_rate[skim[ifill]]->Fill(107.5);
1646  } if (isFired_quick("fffo", true)) {
1647  h_psn_raw_rate[skim[ifill]]->Fill(108.5);
1648  } if (isFired_quick("ffs", true)) {
1649  h_psn_raw_rate[skim[ifill]]->Fill(109.5);
1650  } if (isFired_quick("fss", true)) {
1651  h_psn_raw_rate[skim[ifill]]->Fill(110.5);
1652  } if (isFired_quick("sss", true)) {
1653  h_psn_raw_rate[skim[ifill]]->Fill(111.5);
1654  } if (isFired_quick("ff", true)) {
1655  h_psn_raw_rate[skim[ifill]]->Fill(112.5);
1656  } if (isFired_quick("ss", true)) {
1657  h_psn_raw_rate[skim[ifill]]->Fill(113.5);
1658  } if (isFired_quick("fso", true)) {
1659  h_psn_raw_rate[skim[ifill]]->Fill(114.5);
1660  } if (isFired_quick("sso", true)) {
1661  h_psn_raw_rate[skim[ifill]]->Fill(115.5);
1662  } if (isFired_quick("fsb", true)) {
1663  h_psn_raw_rate[skim[ifill]]->Fill(116.5);
1664  } if (isFired_quick("ff30", true)) {
1665  h_psn_raw_rate[skim[ifill]]->Fill(117.5);
1666  } if (isFired_quick("fioiecl1", true)) {
1667  h_psn_raw_rate[skim[ifill]]->Fill(118.5);
1668  } if (isFired_quick("ioiecl1", true)) {
1669  h_psn_raw_rate[skim[ifill]]->Fill(119.5);
1670  } if (isFired_quick("cdcecl1", true)) {
1671  h_psn_raw_rate[skim[ifill]]->Fill(120.5);
1672  } if (isFired_quick("cdcecl2", true)) {
1673  h_psn_raw_rate[skim[ifill]]->Fill(121.5);
1674  } if (isFired_quick("c2gev1", true)) {
1675  h_psn_raw_rate[skim[ifill]]->Fill(122.5);
1676  } if (isFired_quick("c2gev2", true)) {
1677  h_psn_raw_rate[skim[ifill]]->Fill(123.5);
1678  } if (isFired_quick("c2hie", true)) {
1679  h_psn_raw_rate[skim[ifill]]->Fill(124.5);
1680  } if (isFired_quick("g_high", true)) {
1681  h_psn_raw_rate[skim[ifill]]->Fill(125.5);
1682  } if (isFired_quick("g_c1", true)) {
1683  h_psn_raw_rate[skim[ifill]]->Fill(126.5);
1684  } if (isFired_quick("gg", true)) {
1685  h_psn_raw_rate[skim[ifill]]->Fill(127.5);
1686  } if (isFired_quick("stt6", true)) {
1687  h_psn_raw_rate[skim[ifill]]->Fill(128.5);
1688  }
1689  }
1690 }
1691 
1692 
1693 void
1694 TRGGDLDQMModule::fillOutputExtra(void)
1695 {
1696  bool c4_fired = isFired_quick("c4");
1697  bool hie_fired = isFired_quick("hie");
1698  bool LML_fired = (isFired_quick("lml0", true) || isFired_quick("lml1", true) || isFired_quick("lml2", true)
1699  || isFired_quick("lml3", true) || isFired_quick("lml4", true) || isFired_quick("lml5", true)
1700  || isFired_quick("lml6", true) || isFired_quick("lml7", true) || isFired_quick("lml8", true)
1701  || isFired_quick("lml9", true) || isFired_quick("lml10", true) || isFired_quick("eclmumu", true));
1702  bool CDC_fired = (isFired_quick("fff", true) || isFired_quick("ffo", true) || isFired_quick("ffb", true)
1703  || isFired_quick("ffy", true) || isFired_quick("fyo", true) || isFired_quick("fyb", true));
1704  bool ECL_fired = (isFired_quick("c4", true) || isFired_quick("hie", true));
1705  bool fff_fired = isFired_quick("fff");
1706  bool ff_fired = isFired_quick("ff");
1707  bool f_fired = isFired_quick("f");
1708  bool ffo_fired = isFired_quick("ffo");
1709  bool ffb_fired = isFired_quick("ffb");
1710  bool ffy_fired = isFired_quick("ffy");
1711  bool fyo_fired = isFired_quick("fyo");
1712  bool fyb_fired = isFired_quick("fyb");
1713  bool aaa_fired = isFired_quick("aaa");
1714  bool aay_fired = isFired_quick("aay");
1715  bool bha2D_fired = isFired_quick("bhabha");
1716  bool bha3D_fired = isFired_quick("bha3d");
1717  bool lml0_fired = isFired_quick("lml0");
1718  bool lml1_fired = isFired_quick("lml1");
1719  bool lml2_fired = isFired_quick("lml2");
1720  bool lml3_fired = isFired_quick("lml3");
1721  bool lml4_fired = isFired_quick("lml4");
1722  bool lml5_fired = isFired_quick("lml5");
1723  bool lml6_fired = isFired_quick("lml6");
1724  bool lml7_fired = isFired_quick("lml7");
1725  bool lml8_fired = isFired_quick("lml8");
1726  bool lml9_fired = isFired_quick("lml9");
1727  bool lml10_fired = isFired_quick("lml10");
1728  bool lml12_fired = isFired_quick("lml12");
1729  bool lml13_fired = isFired_quick("lml13");
1730  bool eclmumu_fired = isFired_quick("eclmumu");
1731  bool mu_b2b_fired = isFired_quick("mu_b2b");
1732  bool mu_eb2b_fired = isFired_quick("mu_eb2b");
1733  bool cdcklm1_fired = isFired_quick("cdcklm1");
1734  bool cdcklm2_fired = isFired_quick("cdcklm2");
1735  bool ycdcklm1_fired = isFired_quick("ycdcklm1");
1736  bool ycdcklm2_fired = isFired_quick("ycdcklm2");
1737  bool klm_hit_fired = isFired_quick("klm_hit");
1738  bool eklm_hit_fired = isFired_quick("eklm_hit");
1739  bool cdcecl1_fired = isFired_quick("cdcecl1");
1740  bool cdcecl2_fired = isFired_quick("cdcecl2");
1741  bool cdcecl3_fired = isFired_quick("cdcecl3");
1742  bool cdcecl4_fired = isFired_quick("cdcecl4");
1743  bool fso_fired = isFired_quick("fso");
1744  bool fsb_fired = isFired_quick("fsb");
1745  bool syo_fired = isFired_quick("syo");
1746  bool syb_fired = isFired_quick("syb");
1747  bool syoecl_fired = isFired_quick("syoecl");
1748  bool sybecl_fired = isFired_quick("sybecl");
1749  bool x_fired = isFired_quick("x");
1750  bool fioiecl1_fired = isFired_quick("fioiecl1");
1751  bool ecleklm1_fired = isFired_quick("ecleklm1");
1752  bool seklm1_fired = isFired_quick("seklm1");
1753  bool seklm2_fired = isFired_quick("seklm2");
1754  bool ieklm_fired = isFired_quick("ieklm");
1755  bool iecl_fired = isFired_quick("iecl");
1756  bool yioiecl1_fired = isFired_quick("yioiecl1");
1757  bool stt_fired = isFired_quick("stt");
1758  bool sttecl_fired = isFired_quick("sttecl");
1759  bool ffz_fired = isFired_quick("ffz");
1760  bool fzo_fired = isFired_quick("fzo");
1761  bool fzb_fired = isFired_quick("fzb");
1762 
1763  for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1764 
1765  for (int i = nsample_fast - 1; i > 0; i--) {
1766  for (int ibin = 0; ibin < n_output_extra; ibin++) {
1767  array_psn_extra_fast[skim[ifill]][i][ibin] = array_psn_extra_fast[skim[ifill]][i - 1][ibin];
1768  }
1769  }
1770  for (int ibin = 0; ibin < n_output_extra; ibin++) {
1771  array_psn_extra_fast[skim[ifill]][0][ibin] = 0;
1772  }
1773 
1774  if (1) {
1775  h_psn_extra[skim[ifill]]->Fill(0.5);
1776  array_psn_extra_fast[skim[ifill]][0][0] = 1;
1777  }
1778  if (fff_fired && (ECL_fired)) {
1779  h_psn_extra[skim[ifill]]->Fill(1.5);
1780  array_psn_extra_fast[skim[ifill]][0][1] = 1;
1781  }
1782  if (ffo_fired && (ECL_fired)) {
1783  h_psn_extra[skim[ifill]]->Fill(2.5);
1784  array_psn_extra_fast[skim[ifill]][0][2] = 1;
1785  }
1786  if (ffb_fired && (ECL_fired)) {
1787  h_psn_extra[skim[ifill]]->Fill(3.5);
1788  array_psn_extra_fast[skim[ifill]][0][3] = 1;
1789  }
1790  if (fff_fired) {
1791  h_psn_extra[skim[ifill]]->Fill(4.5);
1792  array_psn_extra_fast[skim[ifill]][0][4] = 1;
1793  }
1794  if (ECL_fired) {
1795  h_psn_extra[skim[ifill]]->Fill(5.5);
1796  array_psn_extra_fast[skim[ifill]][0][5] = 1;
1797  }
1798  if (CDC_fired) {
1799  h_psn_extra[skim[ifill]]->Fill(6.5);
1800  array_psn_extra_fast[skim[ifill]][0][6] = 1;
1801  }
1802  if ((CDC_fired) && (ECL_fired)) {
1803  h_psn_extra[skim[ifill]]->Fill(7.5);
1804  array_psn_extra_fast[skim[ifill]][0][7] = 1;
1805  }
1806  if (bha2D_fired) {
1807  h_psn_extra[skim[ifill]]->Fill(8.5);
1808  array_psn_extra_fast[skim[ifill]][0][8] = 1;
1809  }
1810  if (bha3D_fired) {
1811  h_psn_extra[skim[ifill]]->Fill(9.5);
1812  array_psn_extra_fast[skim[ifill]][0][9] = 1;
1813  }
1814  if (ff_fired) {
1815  h_psn_extra[skim[ifill]]->Fill(10.5);
1816  array_psn_extra_fast[skim[ifill]][0][10] = 1;
1817  }
1818  if (ff_fired && (LML_fired)) {
1819  h_psn_extra[skim[ifill]]->Fill(11.5);
1820  array_psn_extra_fast[skim[ifill]][0][11] = 1;
1821  }
1822  if (f_fired) {
1823  h_psn_extra[skim[ifill]]->Fill(12.5);
1824  array_psn_extra_fast[skim[ifill]][0][12] = 1;
1825  }
1826  if (f_fired && (LML_fired)) {
1827  h_psn_extra[skim[ifill]]->Fill(13.5);
1828  array_psn_extra_fast[skim[ifill]][0][13] = 1;
1829  }
1830  if (LML_fired) {
1831  h_psn_extra[skim[ifill]]->Fill(14.5);
1832  array_psn_extra_fast[skim[ifill]][0][14] = 1;
1833  }
1834  if (fff_fired && (LML_fired)) {
1835  h_psn_extra[skim[ifill]]->Fill(15.5);
1836  array_psn_extra_fast[skim[ifill]][0][15] = 1;
1837  }
1838  if (ffo_fired && (LML_fired)) {
1839  h_psn_extra[skim[ifill]]->Fill(16.5);
1840  array_psn_extra_fast[skim[ifill]][0][16] = 1;
1841  }
1842  if (ffb_fired && (LML_fired)) {
1843  h_psn_extra[skim[ifill]]->Fill(17.5);
1844  array_psn_extra_fast[skim[ifill]][0][17] = 1;
1845  }
1846  if (ffy_fired) {
1847  h_psn_extra[skim[ifill]]->Fill(18.5);
1848  array_psn_extra_fast[skim[ifill]][0][18] = 1;
1849  }
1850  if (ffy_fired && (ECL_fired)) {
1851  h_psn_extra[skim[ifill]]->Fill(19.5);
1852  array_psn_extra_fast[skim[ifill]][0][19] = 1;
1853  }
1854  if (fyo_fired && (ECL_fired)) {
1855  h_psn_extra[skim[ifill]]->Fill(20.5);
1856  array_psn_extra_fast[skim[ifill]][0][20] = 1;
1857  }
1858  if (fyb_fired && (ECL_fired)) {
1859  h_psn_extra[skim[ifill]]->Fill(21.5);
1860  array_psn_extra_fast[skim[ifill]][0][21] = 1;
1861  }
1862  if ((ffy_fired || fyo_fired || fyb_fired) && (ECL_fired)) {
1863  h_psn_extra[skim[ifill]]->Fill(22.5);
1864  array_psn_extra_fast[skim[ifill]][0][22] = 1;
1865  }
1866  if (ffy_fired && (LML_fired)) {
1867  h_psn_extra[skim[ifill]]->Fill(23.5);
1868  array_psn_extra_fast[skim[ifill]][0][23] = 1;
1869  }
1870  if (fyo_fired && (LML_fired)) {
1871  h_psn_extra[skim[ifill]]->Fill(24.5);
1872  array_psn_extra_fast[skim[ifill]][0][24] = 1;
1873  }
1874  if (fyb_fired && (LML_fired)) {
1875  h_psn_extra[skim[ifill]]->Fill(25.5);
1876  array_psn_extra_fast[skim[ifill]][0][25] = 1;
1877  }
1878  if (c4_fired && (CDC_fired)) {
1879  h_psn_extra[skim[ifill]]->Fill(26.5);
1880  array_psn_extra_fast[skim[ifill]][0][26] = 1;
1881  }
1882  if (hie_fired && (CDC_fired)) {
1883  h_psn_extra[skim[ifill]]->Fill(27.5);
1884  array_psn_extra_fast[skim[ifill]][0][27] = 1;
1885  }
1886  if (lml0_fired && (CDC_fired)) {
1887  h_psn_extra[skim[ifill]]->Fill(28.5);
1888  array_psn_extra_fast[skim[ifill]][0][28] = 1;
1889  }
1890  if (lml1_fired && (CDC_fired)) {
1891  h_psn_extra[skim[ifill]]->Fill(29.5);
1892  array_psn_extra_fast[skim[ifill]][0][29] = 1;
1893  }
1894  if (lml2_fired && (CDC_fired)) {
1895  h_psn_extra[skim[ifill]]->Fill(30.5);
1896  array_psn_extra_fast[skim[ifill]][0][30] = 1;
1897  }
1898  if (lml3_fired && (CDC_fired)) {
1899  h_psn_extra[skim[ifill]]->Fill(31.5);
1900  array_psn_extra_fast[skim[ifill]][0][31] = 1;
1901  }
1902  if (lml4_fired && (CDC_fired)) {
1903  h_psn_extra[skim[ifill]]->Fill(32.5);
1904  array_psn_extra_fast[skim[ifill]][0][32] = 1;
1905  }
1906  if (lml5_fired && (CDC_fired)) {
1907  h_psn_extra[skim[ifill]]->Fill(33.5);
1908  array_psn_extra_fast[skim[ifill]][0][33] = 1;
1909  }
1910  if (lml6_fired && (CDC_fired)) {
1911  h_psn_extra[skim[ifill]]->Fill(34.5);
1912  array_psn_extra_fast[skim[ifill]][0][34] = 1;
1913  }
1914  if (lml7_fired && (CDC_fired)) {
1915  h_psn_extra[skim[ifill]]->Fill(35.5);
1916  array_psn_extra_fast[skim[ifill]][0][35] = 1;
1917  }
1918  if (lml8_fired && (CDC_fired)) {
1919  h_psn_extra[skim[ifill]]->Fill(36.5);
1920  array_psn_extra_fast[skim[ifill]][0][36] = 1;
1921  }
1922  if (lml9_fired && (CDC_fired)) {
1923  h_psn_extra[skim[ifill]]->Fill(37.5);
1924  array_psn_extra_fast[skim[ifill]][0][37] = 1;
1925  }
1926  if (lml10_fired && (CDC_fired)) {
1927  h_psn_extra[skim[ifill]]->Fill(38.5);
1928  array_psn_extra_fast[skim[ifill]][0][38] = 1;
1929  }
1930  if (lml12_fired && (CDC_fired)) {
1931  h_psn_extra[skim[ifill]]->Fill(39.5);
1932  array_psn_extra_fast[skim[ifill]][0][39] = 1;
1933  }
1934  if (lml13_fired && (CDC_fired)) {
1935  h_psn_extra[skim[ifill]]->Fill(40.5);
1936  array_psn_extra_fast[skim[ifill]][0][40] = 1;
1937  }
1938  if (eclmumu_fired && (CDC_fired)) {
1939  h_psn_extra[skim[ifill]]->Fill(41.5);
1940  array_psn_extra_fast[skim[ifill]][0][41] = 1;
1941  }
1942  if (mu_b2b_fired && (CDC_fired)) {
1943  h_psn_extra[skim[ifill]]->Fill(42.5);
1944  array_psn_extra_fast[skim[ifill]][0][42] = 1;
1945  }
1946  if (mu_eb2b_fired && (CDC_fired)) {
1947  h_psn_extra[skim[ifill]]->Fill(43.5);
1948  array_psn_extra_fast[skim[ifill]][0][43] = 1;
1949  }
1950  if (cdcklm1_fired && (CDC_fired)) {
1951  h_psn_extra[skim[ifill]]->Fill(44.5);
1952  array_psn_extra_fast[skim[ifill]][0][44] = 1;
1953  }
1954  if (cdcklm2_fired && (CDC_fired)) {
1955  h_psn_extra[skim[ifill]]->Fill(45.5);
1956  array_psn_extra_fast[skim[ifill]][0][45] = 1;
1957  }
1958  if (klm_hit_fired && (CDC_fired)) {
1959  h_psn_extra[skim[ifill]]->Fill(46.5);
1960  array_psn_extra_fast[skim[ifill]][0][46] = 1;
1961  }
1962  if (eklm_hit_fired && (CDC_fired)) {
1963  h_psn_extra[skim[ifill]]->Fill(47.5);
1964  array_psn_extra_fast[skim[ifill]][0][47] = 1;
1965  }
1966  if (mu_b2b_fired && LML_fired) {
1967  h_psn_extra[skim[ifill]]->Fill(48.5);
1968  array_psn_extra_fast[skim[ifill]][0][48] = 1;
1969  }
1970  if (mu_eb2b_fired && LML_fired) {
1971  h_psn_extra[skim[ifill]]->Fill(49.5);
1972  array_psn_extra_fast[skim[ifill]][0][49] = 1;
1973  }
1974  if (cdcklm1_fired && LML_fired) {
1975  h_psn_extra[skim[ifill]]->Fill(50.5);
1976  array_psn_extra_fast[skim[ifill]][0][50] = 1;
1977  }
1978  if (cdcklm2_fired && LML_fired) {
1979  h_psn_extra[skim[ifill]]->Fill(51.5);
1980  array_psn_extra_fast[skim[ifill]][0][51] = 1;
1981  }
1982  if (klm_hit_fired && LML_fired) {
1983  h_psn_extra[skim[ifill]]->Fill(52.5);
1984  array_psn_extra_fast[skim[ifill]][0][52] = 1;
1985  }
1986  if (eklm_hit_fired && LML_fired) {
1987  h_psn_extra[skim[ifill]]->Fill(53.5);
1988  array_psn_extra_fast[skim[ifill]][0][53] = 1;
1989  }
1990  if (cdcecl1_fired && (CDC_fired)) {
1991  h_psn_extra[skim[ifill]]->Fill(54.5);
1992  array_psn_extra_fast[skim[ifill]][0][54] = 1;
1993  }
1994  if (cdcecl2_fired && (CDC_fired)) {
1995  h_psn_extra[skim[ifill]]->Fill(55.5);
1996  array_psn_extra_fast[skim[ifill]][0][55] = 1;
1997  }
1998  if (cdcecl3_fired && (CDC_fired)) {
1999  h_psn_extra[skim[ifill]]->Fill(56.5);
2000  array_psn_extra_fast[skim[ifill]][0][56] = 1;
2001  }
2002  if (cdcecl4_fired && (CDC_fired)) {
2003  h_psn_extra[skim[ifill]]->Fill(57.5);
2004  array_psn_extra_fast[skim[ifill]][0][57] = 1;
2005  }
2006  if (cdcecl1_fired && LML_fired) {
2007  h_psn_extra[skim[ifill]]->Fill(58.5);
2008  array_psn_extra_fast[skim[ifill]][0][58] = 1;
2009  }
2010  if (cdcecl2_fired && LML_fired) {
2011  h_psn_extra[skim[ifill]]->Fill(59.5);
2012  array_psn_extra_fast[skim[ifill]][0][59] = 1;
2013  }
2014  if (cdcecl3_fired && LML_fired) {
2015  h_psn_extra[skim[ifill]]->Fill(60.5);
2016  array_psn_extra_fast[skim[ifill]][0][60] = 1;
2017  }
2018  if (cdcecl4_fired && LML_fired) {
2019  h_psn_extra[skim[ifill]]->Fill(61.5);
2020  array_psn_extra_fast[skim[ifill]][0][61] = 1;
2021  }
2022  if (fso_fired && LML_fired) {
2023  h_psn_extra[skim[ifill]]->Fill(62.5);
2024  array_psn_extra_fast[skim[ifill]][0][62] = 1;
2025  }
2026  if (fsb_fired && LML_fired) {
2027  h_psn_extra[skim[ifill]]->Fill(63.5);
2028  array_psn_extra_fast[skim[ifill]][0][63] = 1;
2029  }
2030  if (syo_fired && LML_fired) {
2031  h_psn_extra[skim[ifill]]->Fill(64.5);
2032  array_psn_extra_fast[skim[ifill]][0][64] = 1;
2033  }
2034  if (syb_fired && LML_fired) {
2035  h_psn_extra[skim[ifill]]->Fill(65.5);
2036  array_psn_extra_fast[skim[ifill]][0][65] = 1;
2037  }
2038  if (x_fired && LML_fired) {
2039  h_psn_extra[skim[ifill]]->Fill(66.5);
2040  array_psn_extra_fast[skim[ifill]][0][66] = 1;
2041  }
2042  if (fioiecl1_fired && LML_fired) {
2043  h_psn_extra[skim[ifill]]->Fill(67.5);
2044  array_psn_extra_fast[skim[ifill]][0][67] = 1;
2045  }
2046  if (ecleklm1_fired && LML_fired) {
2047  h_psn_extra[skim[ifill]]->Fill(68.5);
2048  array_psn_extra_fast[skim[ifill]][0][68] = 1;
2049  }
2050  if (seklm1_fired && LML_fired) {
2051  h_psn_extra[skim[ifill]]->Fill(69.5);
2052  array_psn_extra_fast[skim[ifill]][0][69] = 1;
2053  }
2054  if (seklm2_fired && LML_fired) {
2055  h_psn_extra[skim[ifill]]->Fill(70.5);
2056  array_psn_extra_fast[skim[ifill]][0][70] = 1;
2057  }
2058  if (ieklm_fired && LML_fired) {
2059  h_psn_extra[skim[ifill]]->Fill(71.5);
2060  array_psn_extra_fast[skim[ifill]][0][71] = 1;
2061  }
2062  if (iecl_fired && LML_fired) {
2063  h_psn_extra[skim[ifill]]->Fill(72.5);
2064  array_psn_extra_fast[skim[ifill]][0][72] = 1;
2065  }
2066  if (ecleklm1_fired && CDC_fired) {
2067  h_psn_extra[skim[ifill]]->Fill(73.5);
2068  array_psn_extra_fast[skim[ifill]][0][73] = 1;
2069  }
2070  if (syo_fired && ECL_fired) {
2071  h_psn_extra[skim[ifill]]->Fill(74.5);
2072  array_psn_extra_fast[skim[ifill]][0][74] = 1;
2073  }
2074  if (yioiecl1_fired && ECL_fired) {
2075  h_psn_extra[skim[ifill]]->Fill(75.5);
2076  array_psn_extra_fast[skim[ifill]][0][75] = 1;
2077  }
2078  if (stt_fired && ECL_fired) {
2079  h_psn_extra[skim[ifill]]->Fill(76.5);
2080  array_psn_extra_fast[skim[ifill]][0][76] = 1;
2081  }
2082  if (ffz_fired && (ECL_fired)) {
2083  h_psn_extra[skim[ifill]]->Fill(77.5);
2084  array_psn_extra_fast[skim[ifill]][0][77] = 1;
2085  }
2086  if (fzo_fired && (ECL_fired)) {
2087  h_psn_extra[skim[ifill]]->Fill(78.5);
2088  array_psn_extra_fast[skim[ifill]][0][78] = 1;
2089  }
2090  if (fzb_fired && (ECL_fired)) {
2091  h_psn_extra[skim[ifill]]->Fill(79.5);
2092  array_psn_extra_fast[skim[ifill]][0][79] = 1;
2093  }
2094  if (ffy_fired && ffz_fired && (ECL_fired)) {
2095  h_psn_extra[skim[ifill]]->Fill(80.5);
2096  array_psn_extra_fast[skim[ifill]][0][80] = 1;
2097  }
2098  if (fyo_fired && fzo_fired && (ECL_fired)) {
2099  h_psn_extra[skim[ifill]]->Fill(81.5);
2100  array_psn_extra_fast[skim[ifill]][0][81] = 1;
2101  }
2102  if (fyb_fired && fzb_fired && (ECL_fired)) {
2103  h_psn_extra[skim[ifill]]->Fill(82.5);
2104  array_psn_extra_fast[skim[ifill]][0][82] = 1;
2105  }
2106  if ((ffy_fired || ffz_fired) && (ECL_fired)) {
2107  h_psn_extra[skim[ifill]]->Fill(83.5);
2108  array_psn_extra_fast[skim[ifill]][0][83] = 1;
2109  }
2110  if ((fyo_fired || fzo_fired) && (ECL_fired)) {
2111  h_psn_extra[skim[ifill]]->Fill(84.5);
2112  array_psn_extra_fast[skim[ifill]][0][84] = 1;
2113  }
2114  if ((fyb_fired || fzb_fired) && (ECL_fired)) {
2115  h_psn_extra[skim[ifill]]->Fill(85.5);
2116  array_psn_extra_fast[skim[ifill]][0][85] = 1;
2117  }
2118  if (ffy_fired && ffz_fired) {
2119  h_psn_extra[skim[ifill]]->Fill(86.5);
2120  array_psn_extra_fast[skim[ifill]][0][86] = 1;
2121  }
2122  if (fyo_fired && fzo_fired) {
2123  h_psn_extra[skim[ifill]]->Fill(87.5);
2124  array_psn_extra_fast[skim[ifill]][0][87] = 1;
2125  }
2126  if (fyb_fired && fzb_fired) {
2127  h_psn_extra[skim[ifill]]->Fill(88.5);
2128  array_psn_extra_fast[skim[ifill]][0][88] = 1;
2129  }
2130  if (ffy_fired || ffz_fired) {
2131  h_psn_extra[skim[ifill]]->Fill(89.5);
2132  array_psn_extra_fast[skim[ifill]][0][89] = 1;
2133  }
2134  if (fyo_fired || fzo_fired) {
2135  h_psn_extra[skim[ifill]]->Fill(90.5);
2136  array_psn_extra_fast[skim[ifill]][0][90] = 1;
2137  }
2138  if (fyb_fired || fzb_fired) {
2139  h_psn_extra[skim[ifill]]->Fill(91.5);
2140  array_psn_extra_fast[skim[ifill]][0][91] = 1;
2141  }
2142  if (ffo_fired) {
2143  h_psn_extra[skim[ifill]]->Fill(92.5);
2144  array_psn_extra_fast[skim[ifill]][0][92] = 1;
2145  }
2146  if (ffb_fired) {
2147  h_psn_extra[skim[ifill]]->Fill(93.5);
2148  array_psn_extra_fast[skim[ifill]][0][93] = 1;
2149  }
2150  if (aaa_fired && ECL_fired) {
2151  h_psn_extra[skim[ifill]]->Fill(94.5);
2152  array_psn_extra_fast[skim[ifill]][0][94] = 1;
2153  }
2154  if (aay_fired && ECL_fired) {
2155  h_psn_extra[skim[ifill]]->Fill(95.5);
2156  array_psn_extra_fast[skim[ifill]][0][95] = 1;
2157  }
2158  if (ycdcklm1_fired && (CDC_fired)) {
2159  h_psn_extra[skim[ifill]]->Fill(96.5);
2160  array_psn_extra_fast[skim[ifill]][0][96] = 1;
2161  }
2162  if (ycdcklm2_fired && (CDC_fired)) {
2163  h_psn_extra[skim[ifill]]->Fill(97.5);
2164  array_psn_extra_fast[skim[ifill]][0][97] = 1;
2165  }
2166  if (ycdcklm1_fired && LML_fired) {
2167  h_psn_extra[skim[ifill]]->Fill(98.5);
2168  array_psn_extra_fast[skim[ifill]][0][98] = 1;
2169  }
2170  if (ycdcklm2_fired && LML_fired) {
2171  h_psn_extra[skim[ifill]]->Fill(99.5);
2172  array_psn_extra_fast[skim[ifill]][0][99] = 1;
2173  }
2174  if (sttecl_fired && ECL_fired) {
2175  h_psn_extra[skim[ifill]]->Fill(100.5);
2176  array_psn_extra_fast[skim[ifill]][0][100] = 1;
2177  }
2178  if (syoecl_fired && LML_fired) {
2179  h_psn_extra[skim[ifill]]->Fill(101.5);
2180  array_psn_extra_fast[skim[ifill]][0][101] = 1;
2181  }
2182  if (sybecl_fired && LML_fired) {
2183  h_psn_extra[skim[ifill]]->Fill(102.5);
2184  array_psn_extra_fast[skim[ifill]][0][102] = 1;
2185  }
2186  if (syoecl_fired && ECL_fired) {
2187  h_psn_extra[skim[ifill]]->Fill(103.5);
2188  array_psn_extra_fast[skim[ifill]][0][103] = 1;
2189  }
2190  if (sybecl_fired && ECL_fired) {
2191  h_psn_extra[skim[ifill]]->Fill(104.5);
2192  array_psn_extra_fast[skim[ifill]][0][104] = 1;
2193  }
2194 
2195 
2196  for (int ibin = 0; ibin < n_output_extra; ibin++) {
2197  int sum_psn_extra_fast = 0;
2198  for (int i = 0; i < nsample_fast; i++) {
2199  sum_psn_extra_fast += array_psn_extra_fast[skim[ifill]][i][ibin];
2200  }
2201  h_psn_extra_fast[skim[ifill]]->SetBinContent(ibin + 1, sum_psn_extra_fast);
2202  }
2203  }
2204 
2205 }
2206 
2207 const char* TRGGDLDQMModule::output_extra[n_output_extra] = {
2208  "all", "fff&(c4|hie)", "ffo&(c4|hie)", "ffb&(c4|hie)", "fff", "c4|hie", "fff|ffo|ffb", "(fff|ffo|ffb)&(c4|hie)", "bha2D", "bha3D",
2209  "ff", "ff&(lml|eclmumu)", "f", "f&(lml|eclmumu)", "lml|eclmumu", "fff&(lml|eclmumu)", "ffo&(lml|eclmumu)", "ffb&(lml|eclmumu)", "ffy", "ffy&(c4|hie)",
2210  "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)",
2211  "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)",
2212  "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)",
2213  "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)",
2214  "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)",
2215  "seklm2&(lml|eclmumu)", "ieklm&(lml|eclmumu)", "iecl&(lml|eclmumu)", "ecleklm1&(fff|ffo|ffb)", "syo&(c4|hie)", "yioiecl1&(c4|hie)", "stt&(c4|hie)", "ffz&(c4|hie)", "fzo&(c4|hie)", "fzb&(c4|hie)",
2216  "ffy&ffz&(c4|hie)", "fyo&fzo&(c4|hie)", "fyb&fzb&(c4|hie)", "(ffy|ffz)&(c4|hie)", "(fyo|fzo)&(c4|hie)", "(fyb|fzb)&(c4|hie)", "ffy&ffz", "fyo&fzo", "fyb&fzb", "(ffy|ffz)",
2217  "(fyo|fzo)", "(fyb|fzb)", "ffo", "ffb", "aaa&(c4|hie)", "aay&(c4|hie)", "ycdcklm1&(fff|ffo|ffb)", "ycdcklm2&(fff|ffo|ffb)", "ycdcklm1&(lml|eclmumu)", "ycdcklm2&(lml|eclmumu)",
2218  "sttecl&(c4|hie)", "syoecl&(lml|eclmumu)", "sybecl&(lml|eclmumu)", "syoecl&(c4|hie)", "sybecl&(c4|hie)"
2219 };
2220 
2221 
2222 
2223 
2224 const char* TRGGDLDQMModule::output_overlap[n_output_overlap] = {
2225  "all", "B_CDC", "B_ECL", "L_KLM", "L_CDC", "L_ECL", "CALIB", "MONITOR", "OTHER", "B_ffy",
2226  "B_fyo", "B_c4", "B_hie", "L_klm", "L_klm_match", "L_stt", "L_short", "L_fy30", "L_inner", "L_lml",
2227  "CALIB_gg", "CALIB_bhapur", "CALIB_pid", "CALIB_wo_bhaveto", "CALIB_eclmumu", "CALIB_lml1", "CALIB_lml4", "CALIB_noveto", "CALIB_random", "MON_ffz",
2228  "MON_fzo", "MONITOR_all", "OTHER_all",
2229  "ffy",
2230  "fyb",
2231  "fyo",
2232  "c4",
2233  "hie",
2234  "mu_b2b",
2235  "mu_eb2b",
2236  "eklm2",
2237  "beklm",
2238  "cdcklm1",
2239  "cdcklm2",
2240  "seklm1",
2241  "seklm2",
2242  "fwd_seklm",
2243  "bwd_seklm",
2244  "ecleklm1",
2245  "ieklm1",
2246  "sttecl",
2247  "stt",
2248  "syb",
2249  "syo",
2250  "yioiecl1",
2251  "fy30",
2252  "ioiecl2",
2253  "lml0",
2254  "lml2",
2255  "lml6",
2256  "lml7",
2257  "lml8",
2258  "lml9",
2259  "lml10",
2260  "lml12",
2261  "lml13",
2262  "lml14",
2263  "lml15",
2264  "lml16",
2265  "ggsel",
2266  "bhapur",
2267  "lml3",
2268  "lml5",
2269  "bha3d",
2270  "bhabha",
2271  "lume",
2272  "bffo",
2273  "bhie",
2274  "eclmumu",
2275  "lml1",
2276  "lml4",
2277  "ssb",
2278  "eed",
2279  "fed",
2280  "yp",
2281  "fp",
2282  "shem",
2283  "ohem",
2284  "hiev",
2285  "fffv",
2286  "bg",
2287  "poissonv",
2288  "revolution",
2289  "random",
2290  "c2",
2291  "c3",
2292  "eklmhit",
2293  "f",
2294  "s",
2295  "y",
2296  "cdcecl3",
2297  "cdcecl4",
2298  "ffz",
2299  "fzb",
2300  "fzo",
2301  "fff",
2302  "ffb",
2303  "ffo",
2304  "fffo",
2305  "ffs",
2306  "fss",
2307  "sss",
2308  "ff",
2309  "ss",
2310  "fso",
2311  "sso",
2312  "fsb",
2313  "ff30",
2314  "fioiecl1",
2315  "ioiecl1",
2316  "cdcecl1",
2317  "cdcecl2",
2318  "c2gev1",
2319  "c2gev2",
2320  "c2hie",
2321  "g_high",
2322  "g_c1",
2323  "gg",
2324  "stt6",
2325  "other_dump"
2326 };
2327 
2328 
2329 
2330 void
2331 TRGGDLDQMModule::fillOutputPureExtra(void)
2332 {
2333  //get offline CDC track information
2334  int n_fulltrack = 0;
2335  float max_dphi = 0;
2336  float phi_list[100];
2337  for (int itrack = 0; itrack < Tracks.getEntries(); itrack++) {
2338  const TrackFitResult* tfr = Tracks[itrack]->getTrackFitResult(Const::pion);
2339  if (tfr == nullptr) continue;
2340 
2341  float z0 = tfr->getZ0();
2342  float d0 = tfr->getD0();
2343  float phi = tfr->getPhi();
2344  //float omega = tfr->getOmega();
2345  int flayer = tfr->getHitPatternCDC().getFirstLayer();
2346  int llayer = tfr->getHitPatternCDC().getLastLayer();
2347  float pt = tfr->getTransverseMomentum();
2348  if (z0 > -1 && z0 < 1 && d0 > -1 && d0 < 1 && flayer < 8 && llayer > 50
2349  && pt > 0.3) { //select track from IP, hit SL0 and SL8, pt>0.3GeV
2350  phi_list[n_fulltrack] = phi;
2351  n_fulltrack += 1;
2352  }
2353  }
2354  for (int i = 0; i < n_fulltrack; i++) {
2355  for (int j = 0; j < n_fulltrack; j++) {
2356  float dphi = phi_list[i] - phi_list[j];
2357  if (dphi < 0) dphi = -dphi;
2358  if (dphi > 3.14) dphi = 2 * 3.14 - dphi;
2359  if (dphi > max_dphi) max_dphi = dphi;
2360  }
2361  }
2362 
2363  //get offline ECL cluster information
2364  //double total_energy = 0;
2365  //for (int iclst = 0; iclst < ECLClusters.getEntries(); iclst++) {
2366  // total_energy += ECLClusters[iclst]->getEnergyRaw();
2367  //}
2368  //
2369  //
2370  int ecl_timing_threshold_low = -200; // (ns) xtal timing selection
2371  int ecl_timing_threshold_high = 200; // (ns) xtal timing selection
2372  double ecl_xtcid_energy_sum[576] = {0};
2373  double total_energy = 0;
2374  int ncluster = 0;
2375  for (const auto& eclcalhit : m_ECLCalDigitData) {
2376 
2377  // (ecl) calibation status check and cut
2378  if (!eclcalhit.isCalibrated()) {continue;}
2379  if (eclcalhit.isFailedFit()) {continue;}
2380  if (eclcalhit.isTimeResolutionFailed()) {continue;}
2381 
2382  // (ecl) xtal-id
2383  int ecl_cid = (double) eclcalhit.getCellId();
2384 
2385  // (ecl) fitter quality check and cut
2386  int ecl_quality = -1;
2387  for (const auto& eclhit : m_ECLDigitData) {
2388  if (ecl_cid == eclhit.getCellId()) {
2389  ecl_quality = (int) eclhit.getQuality();
2390  }
2391  }
2392  if (ecl_quality != 0) {continue;}
2393 
2394  // (ecl) xtal energy
2395  double ecl_xtal_energy = eclcalhit.getEnergy(); // ECLCalDigit
2396 
2397 
2398  // (ecl) timing cut
2399  int ecl_timing = eclcalhit.getTime();
2400  if (ecl_timing < ecl_timing_threshold_low ||
2401  ecl_timing > ecl_timing_threshold_high) {continue;}
2402 
2403  // (ecl) tc-id for xtal-id
2404  int ecl_tcid = trgeclmap->getTCIdFromXtalId(ecl_cid);
2405  int ecl_thetaid = trgeclmap->getTCThetaIdFromTCId(ecl_tcid);
2406 
2407  if (ecl_tcid >= 0 && ecl_tcid < 576 && ecl_thetaid >= 2 && ecl_thetaid <= 15) { //pick up only 2=<thetaid=<15
2408  ecl_xtcid_energy_sum[ecl_tcid] = ecl_xtcid_energy_sum[ecl_tcid] + ecl_xtal_energy;
2409  //ecltimingsum[i] = ecl_timing;
2410  }
2411  }
2412 
2413  for (int i = 0; i < 576; i++) {
2414  if (ecl_xtcid_energy_sum[i] > 0.1) {
2415  total_energy += ecl_xtcid_energy_sum[i];
2416  ncluster += 1;
2417  }
2418  }
2419 
2420  //get offline KLM cluster information
2421 
2422 
2423  //fff: require the number of CDC full tracks is more than or equal to 3
2424  if (n_fulltrack > 2) {
2425  bool fff_fired = isFired_quick("fff");
2426  bool ffy_fired = isFired_quick("ffy");
2427  bool c4_fired = isFired_quick("c4");
2428  bool hie_fired = isFired_quick("hie");
2429  if (c4_fired || hie_fired) {
2430  h_psn_pure_extra[0]->Fill(0.5);
2431  }
2432  if (fff_fired && (c4_fired || hie_fired)) {
2433  h_psn_pure_extra[0]->Fill(1.5);
2434  }
2435  if (ffy_fired && (c4_fired || hie_fired)) {
2436  h_psn_pure_extra[0]->Fill(2.5);
2437  }
2438  }
2439  //ffo: require the number of CDC full tracks is more than or equal to 2, opening angle > 90deg
2440  if (n_fulltrack > 1 && max_dphi > 3.14 / 2.) {
2441  bool ffo_fired = isFired_quick("ffo");
2442  bool fyo_fired = isFired_quick("fyo");
2443  bool c4_fired = isFired_quick("c4");
2444  bool hie_fired = isFired_quick("hie");
2445  if (c4_fired || hie_fired) {
2446  h_psn_pure_extra[0]->Fill(3.5);
2447  }
2448  if (ffo_fired && (c4_fired || hie_fired)) {
2449  h_psn_pure_extra[0]->Fill(4.5);
2450  }
2451  if (fyo_fired && (c4_fired || hie_fired)) {
2452  h_psn_pure_extra[0]->Fill(5.5);
2453  }
2454  }
2455  //ffo: require the number of CDC full tracks is more than or equal to 2, opening angle >150deg
2456  if (n_fulltrack > 1 && max_dphi > 3.14 * 5 / 6.) {
2457  bool ffb_fired = isFired_quick("ffb");
2458  bool fyb_fired = isFired_quick("fyb");
2459  bool c4_fired = isFired_quick("c4");
2460  bool hie_fired = isFired_quick("hie");
2461  if (c4_fired || hie_fired) {
2462  h_psn_pure_extra[0]->Fill(6.5);
2463  }
2464  if (ffb_fired && (c4_fired || hie_fired)) {
2465  h_psn_pure_extra[0]->Fill(7.5);
2466  }
2467  if (fyb_fired && (c4_fired || hie_fired)) {
2468  h_psn_pure_extra[0]->Fill(8.5);
2469  }
2470  }
2471 
2472  //hie: require the total energy of ECL cluster is more than 1GeV
2473  if (total_energy > 1) {
2474  bool fff_fired = isFired_quick("fff");
2475  bool ffo_fired = isFired_quick("ffo");
2476  bool ffb_fired = isFired_quick("ffb");
2477  bool hie_fired = isFired_quick("hie");
2478  if (fff_fired || ffo_fired || ffb_fired) {
2479  h_psn_pure_extra[0]->Fill(9.5);
2480  }
2481  if (hie_fired && (fff_fired || ffo_fired || ffb_fired)) {
2482  h_psn_pure_extra[0]->Fill(10.5);
2483  }
2484  }
2485 
2486  //c4: require the total number of cluster is more than 3
2487  if (ncluster > 3) {
2488  bool fff_fired = isFired_quick("fff");
2489  bool ffo_fired = isFired_quick("ffo");
2490  bool ffb_fired = isFired_quick("ffb");
2491  bool c4_fired = isFired_quick("c4");
2492  if (fff_fired || ffo_fired || ffb_fired) {
2493  h_psn_pure_extra[0]->Fill(11.5);
2494  }
2495  if (c4_fired && (fff_fired || ffo_fired || ffb_fired)) {
2496  h_psn_pure_extra[0]->Fill(12.5);
2497  }
2498  }
2499 
2500 }
2501 
2502 const char* TRGGDLDQMModule::output_pure_extra[n_output_pure_extra] = {
2503  "c4|hie offline_fff", "fff&(c4|hie) offline_fff", "ffy&(c4|hie) offline_fff",
2504  "c4|hie offline_ffo", "ffo&(c4|hie) offline_ffo", "fyo&(c4|hie) offline_ffo",
2505  "c4|hie offline_ffb", "ffb&(c4|hie) offline_ffb", "fyb&(c4|hie) offline_ffb",
2506  "fff|ffb|ffo offline_hie", "hie&(fff|ffb|ffo) offline_hie",
2507  "fff|ffb|ffo offline_c4", "c4&(fff|ffb|ffo) offline_c4"
2508 };
2509 
2510 
static const ChargedStable pion
charged pion particle
Definition: Const.h:652
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
short getLastLayer() const
Returns the index of the last layer with a hit.
short getFirstLayer() const
Returns the index of the first layer with a hit.
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
TH1I * h_c8_cdcTogdlL1[nskim_gdldqm]
timestamp diff from t0(cdc) to gdlL1 in LSB8nsec
TH1I * h_c8_eclTogdlL1[nskim_gdldqm]
timestamp diff from t0(ecl) to gdlL1 in LSB8nsec
TH1I * h_c8_topTogdlL1[nskim_gdldqm]
timestamp diff from t0(top) to gdlL1 in LSB8nsec
virtual void initialize() override
initialize
TH1I * h_c8_eclToGDL[nskim_gdldqm]
timestamp diff from t0(ecl) to GDL in LSB8nsec
virtual void event() override
Event.
TH1D * h_ns_topTocdc[nskim_gdldqm]
timestamp diff from top_timing to cdc_timing in nsec
TH1I * h_ftd[nskim_gdldqm]
ftd bits
virtual void endRun() override
End Run.
TH1D * h_ns_cdcToecl[nskim_gdldqm]
timestamp diff from cdc_timing to ecl_timing in nsec
TH1I * h_c8_ecl8mToGDL[nskim_gdldqm]
timestamp diff from fit on fam to GDL in LSB8nsec
TH1I * h_c2_cdcToecl[nskim_gdldqm]
timestamp from cdc_timing to ecl_timing to L1 in LSB2nsec
TH1I * h_c8_gdlL1TocomL1[nskim_gdldqm]
timestamp diff from gdlL1 to comL1 in LSB8nsec
TH1D * h_ns_cdcTocomL1[nskim_gdldqm]
timestamp diff from cdc_timing to comL1 in nsec
virtual void beginRun() override
begin Run
TH1I * h_c2_cdcTocomL1[nskim_gdldqm]
timestamp diff from cdc_timing to comL1 in LSB2nsec
TH1I * h_c8_topToGDL[nskim_gdldqm]
timestamp diff from t0(top) to GDL in LSB8nsec
TH1I * h_psn[nskim_gdldqm]
psn bits
TH1D * h_ns_topToecl[nskim_gdldqm]
timestamp diff from top_timing to ecl_timing in nsec
TH1I * h_itd[nskim_gdldqm]
input bits
TH1D * h_ns_cdcTogdlL1[nskim_gdldqm]
timestamp diff from cdc_timing to gdlL1 in nsec
TH1I * h_timtype[nskim_gdldqm]
timtype
TH1I * h_c8_cdcToGDL[nskim_gdldqm]
timestamp diff from t0(cdc) to GDL in LSB8nsec
virtual void defineHisto() override
Define Histogram.
Values of the result of a track fit with a given particle hypothesis.
double getPhi() const
Getter for phi0 with CDF naming convention.
double getD0() const
Getter for d0.
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
double getZ0() const
Getter for z0.
HitPatternCDC getHitPatternCDC() const
Getter for the hit pattern in the CDC;.
A class of TC Mapping.
Definition: TrgEclMapping.h:26
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
int getTCIdFromXtalId(int)
get [TC ID] from [Xtal ID]
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
@ c_accept
Accept this event.
Abstract base class for different kinds of events.