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