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