Belle II Software development
TRGTOPDQMModule.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 : TRGTOPDQMModule.cc
12// Section : TRG TOP
13// Owner :
14// Email :
15//---------------------------------------------------------------
16// Description : DQM module for TRGTOP
17//---------------------------------------------------------------
18// 1.00 : 2020/09/20 : First version
19//
20// Modeled after / heavily borrowing from GDL, GRL and ECL DQM modules
21//---------------------------------------------------------------
22#include <trg/top/modules/trgtopDQM/TRGTOPDQMModule.h>
23#include <mdst/dataobjects/SoftwareTriggerResult.h>
24
25#include <framework/datastore/StoreObjPtr.h>
26#include <framework/datastore/StoreArray.h>
27
28#include "trg/top/dataobjects/TRGTOPUnpackerStore.h"
29
30#include <TDirectory.h>
31#include <TPostScript.h>
32#include <TCanvas.h>
33#include <TStyle.h>
34#include <fstream>
35#include <framework/logging/Logger.h>
36#include <boost/algorithm/string.hpp>
37
38#include <iostream>
39
40using namespace std;
41using namespace Belle2;
42
43REG_MODULE(TRGTOPDQM);
44
46{
47
48 setDescription("DQM for TOP Trigger subsystem");
50
51 addParam("doECLCorrelations", m_doECLCorrelations,
52 "Do ECL-TOP correlations (true)",
53 true);
54
55 addParam("requireECLBarrel", m_requireEclBarrel,
56 "Require the most energetic ECL TC in the barrel if doing correlations with ECL (false)",
57 true);
58
59 addParam("requireECLBarrelB2B", m_requireEclBarrelB2B,
60 "Require ECL barrel back-to-back if doing correlations with ECL (false)",
61 false);
62
63 addParam("doGDLCorrelations", m_doGDLCorrelations,
64 "Do GDL-TOP correlations (true)",
65 true);
66
67 addParam("doGRLCorrelations", m_doGRLCorrelations,
68 "Do GRL-TOP correlations (true)",
69 true);
70
71 addParam("requireCDC2DTrack", m_requireCDC2DTrack,
72 "Require at least one CDC 2D track at TRG level",
73 false);
74
75 addParam("generatePostscriptFile", m_generatePostscriptFile,
76 "Generate postscript file (false)",
77 false);
78
79 addParam("postScriptFileName", m_postScriptFileName,
80 "postscript file name",
81 string("topl1dqm.ps"));
82
83 addParam("skim", m_skim,
84 "use skim information (-1)",
85 int(-1));
86
87 addParam("nHistClasses", m_nHistClassesActual,
88 "The number of histogram classes: 1, 2, 3 (1); use 2 and 3 for detailed studies only",
89 int(1));
90
91 addParam("m_histLevel", m_histLevel,
92 "Histogramming level: 1, 2, 3 (1); 3 most detailed",
93 int(1));
94
95}
96
98{
99 oldDir = gDirectory;
100 dirDQM = gDirectory;
101 oldDir->mkdir("TRGTOP");
102 dirDQM->cd("TRGTOP");
103
104 if (m_nHistClassesActual > nHistClasses) m_nHistClassesActual = nHistClasses;
105 if (m_nHistClassesActual < 1) m_nHistClassesActual = 1;
106
107 //-------------------------------------------------------------------------------------------------------------------------------------------
108
109 for (int iskim = start_skim_topdqm; iskim < end_skim_topdqm; iskim++) {
110
111 //
112 // combined decisions information
113 //
114
115 h_topCombinedTimingTopAll[iskim] = new TH1I(Form("h_t0_comb_%s", skim_smap[iskim].c_str()), "ALL TOP combined t0 decisions", 100,
116 0,
117 100000);
118 h_topCombinedTimingTopAll[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decision time (us)");
119
120 h_topNSlotsCombinedTimingTopAll[iskim] = new TH1I(Form("h_n_slots_comb_%s", skim_smap[iskim].c_str()),
121 "ALL TOP combined t0 decisions: N slots", 17, 0, 17);
122 h_topNSlotsCombinedTimingTopAll[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N slots");
123
124 h_topNHitSumAll[iskim] = new TH1I(Form("h_nhit_per_slot_comb_%s", skim_smap[iskim].c_str()),
125 "ALL TOP combined t0 decisions: N hits per slot", 200, 0, 200);
126 h_topNHitSumAll[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N hits per slot");
127
128 h_topLogLSumAll[iskim] = new TH1I(Form("h_logl_per_slot_comb_%s", skim_smap[iskim].c_str()),
129 "ALL TOP combined t0 decisions: log L per slot", 100, 0, 60000);
130 h_topLogLSumAll[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: log L per slot");
131
132 h_topNSlotsCombinedTimingVsNHitsTopAll[iskim] = new TH2I(Form("h_n_slots_vs_nhit_total_comb_%s", skim_smap[iskim].c_str()),
133 "ALL TOP combined t0 decisions: N slots vs N hits (total)", 300, 0, 300, 17, 0, 17);
134 h_topNSlotsCombinedTimingVsNHitsTopAll[iskim]->GetXaxis()->SetTitle("N hits (total)");
135 h_topNSlotsCombinedTimingVsNHitsTopAll[iskim]->GetYaxis()->SetTitle("N slots");
136
137 h_topTrigType[iskim] = new TH1I(Form("h_trig_type_%s", skim_smap[iskim].c_str()),
138 "ALL TOP combined decisions: trig type", 10, 0, 10);
139 h_topTrigType[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: trig type");
140
141 h_topTimingResiduals[iskim] = new TH1I(Form("h_timing_residuals_%s", skim_smap[iskim].c_str()),
142 "ALL TOP combined decisions: timing residual", 100, 0, 100);
143 h_topTimingResiduals[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: timing residuals");
144
145 h_topTimingVariance[iskim] = new TH1I(Form("h_timing_variance_%s", skim_smap[iskim].c_str()),
146 "ALL TOP combined decisions: timing variance", 100, 0, 100);
147 h_topTimingVariance[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: timing variance");
148
149 //-------------------------------------------------------------------------------------------------------------------------------------------
150 //
151 // slot-level information for combined decisions
152 //
153
154 h_topSlotAll[iskim] = new TH1I(Form("h_slot_number_%s", skim_smap[iskim].c_str()), "slot", 16, 1, 17);
155 h_topSlotAll[iskim]->GetXaxis()->SetTitle("slot number in combined decisions (over 1us)");
156
157 h_topSegmentAll[iskim] = new TH1I(Form("h_segment_slot_%s", skim_smap[iskim].c_str()), "segment", 10, 1, 11);
158 h_topSegmentAll[iskim]->GetXaxis()->SetTitle("segment for each slot in combined decisions (over 1us)");
159
160 h_topNHitsAll[iskim] = new TH1I(Form("h_nhit_slot_%s", skim_smap[iskim].c_str()), "nhit", 200, 0, 200);
161 h_topNHitsAll[iskim]->GetXaxis()->SetTitle("N hits (for slots in combined decisions (over 1us))");
162
163 h_topLogLAll[iskim] = new TH1I(Form("h_logl_slot_%s", skim_smap[iskim].c_str()), "log L", 100, 0, 60000);
164 h_topLogLAll[iskim]->GetXaxis()->SetTitle("log L (for slots in combined decisions (over 1us))");
165
166 h_topT0All[iskim] = new TH1I(Form("h_t0_slot_%s", skim_smap[iskim].c_str()), "t0", 100, 0, 100000);
167 h_topT0All[iskim]->GetXaxis()->SetTitle("t0 for slots in combined decisions (over 1us)");
168
169 //-------------------------------------------------------------------------------------------------------------------------------------------
170 //
171 // correlations in slot-level information for combined decisions
172 //
173
174 h_topSlotVsSegment[iskim] = new TH2I(Form("h_slot_vs_segment_%s", skim_smap[iskim].c_str()), "slot # vs slot segment", 10, 1, 11,
175 16, 1, 17);
176 h_topSlotVsSegment[iskim]->GetXaxis()->SetTitle("segment");
177 h_topSlotVsSegment[iskim]->GetYaxis()->SetTitle("slot");
178
179 h_topSlotVsNHits[iskim] = new TH2I(Form("h_slot_vs_nhit_%s", skim_smap[iskim].c_str()), "slot # vs slot nhit", 200, 0, 200, 16, 1,
180 17);
181 h_topSlotVsNHits[iskim]->GetXaxis()->SetTitle("N hits");
182 h_topSlotVsNHits[iskim]->GetYaxis()->SetTitle("slot");
183
184 h_topSlotVsLogL[iskim] = new TH2I(Form("h_slot_vs_logl_%s", skim_smap[iskim].c_str()), "slot # vs slot log L", 100, 0, 60000, 16,
185 1, 17);
186 h_topSlotVsLogL[iskim]->GetXaxis()->SetTitle("logL");
187 h_topSlotVsLogL[iskim]->GetYaxis()->SetTitle("slot");
188
189 h_topSlotVsT0[iskim] = new TH2I(Form("h_slot_vs_t0_%s", skim_smap[iskim].c_str()), "slot # vs slot t0", 100, 0, 100000, 16, 1, 17);
190 h_topSlotVsT0[iskim]->GetXaxis()->SetTitle("t0");
191 h_topSlotVsT0[iskim]->GetYaxis()->SetTitle("slot");
192
193 h_topSegmentVsNHits[iskim] = new TH2I(Form("h_segment_vs_nhit_%s", skim_smap[iskim].c_str()), "slot segment vs slot nhit", 200, 0,
194 200, 10, 1, 11);
195 h_topSegmentVsNHits[iskim]->GetXaxis()->SetTitle("N hits");
196 h_topSegmentVsNHits[iskim]->GetYaxis()->SetTitle("segment");
197
198 h_topSegmentVsLogL[iskim] = new TH2I(Form("h_segment_vs_logl_%s", skim_smap[iskim].c_str()), "slot segment vs slot log L", 100, 0,
199 60000, 10, 1, 11);
200 h_topSegmentVsLogL[iskim]->GetXaxis()->SetTitle("logL");
201 h_topSegmentVsLogL[iskim]->GetYaxis()->SetTitle("segment");
202
203 h_topSegmentVsT0[iskim] = new TH2I(Form("h_segment_vs_t0_%s", skim_smap[iskim].c_str()), "slot segment vs slot t0", 100, 0, 100000,
204 10, 1, 11);
205 h_topSegmentVsT0[iskim]->GetXaxis()->SetTitle("t0");
206 h_topSegmentVsT0[iskim]->GetYaxis()->SetTitle("segment");
207
208 h_topNHitsVsLogL[iskim] = new TH2I(Form("h_nhit_vs_logl_%s", skim_smap[iskim].c_str()), "slot nhit vs slot log L", 100, 0, 100000,
209 200, 0, 200);
210 h_topNHitsVsLogL[iskim]->GetXaxis()->SetTitle("logL");
211 h_topNHitsVsLogL[iskim]->GetYaxis()->SetTitle("N hits");
212
213 h_topNHitsVsT0[iskim] = new TH2I(Form("h_nhit_vs_t0_%s", skim_smap[iskim].c_str()), "slot nhit vs slot t0", 100, 0, 100000, 200, 0,
214 200);
215 h_topNHitsVsT0[iskim]->GetXaxis()->SetTitle("t0");
216 h_topNHitsVsT0[iskim]->GetYaxis()->SetTitle("N hits");
217
218 h_topLogLVsT0[iskim] = new TH2I(Form("h_logl_vs_t0_%s", skim_smap[iskim].c_str()), "slot log L vs slot t0", 100, 0, 100000, 100, 0,
219 60000);
220 h_topLogLVsT0[iskim]->GetXaxis()->SetTitle("t0");
221 h_topLogLVsT0[iskim]->GetYaxis()->SetTitle("logL");
222
223 //-------------------------------------------------------------------------------------------------------------------------------------------
224 //
225 // more slot-level information (per slot) for combined decisions
226 //
227
228 for (int slot = 0; slot <= 15; slot++) {
229
230 h_topSlotSegment[iskim][slot] = new TH1I(Form("h_segment_slot_%s_%s", (to_string(slot + 1)).c_str(), skim_smap[iskim].c_str()),
231 "segment", 10, 1, 11);
232 h_topSlotSegment[iskim][slot]->GetXaxis()->SetTitle("segment");
233
234 h_topSlotNHits[iskim][slot] = new TH1I(Form("h_nhit_slot_%s_%s", (to_string(slot + 1)).c_str(), skim_smap[iskim].c_str()), "nhit",
235 200, 0, 200);
236 h_topSlotNHits[iskim][slot]->GetXaxis()->SetTitle("N hits");
237
238 h_topSlotLogL[iskim][slot] = new TH1I(Form("h_logl_slot_%s_%s", (to_string(slot + 1)).c_str(), skim_smap[iskim].c_str()), "log L",
239 100, 0, 60000);
240 h_topSlotLogL[iskim][slot]->GetXaxis()->SetTitle("log L");
241
242 h_topSlotT0[iskim][slot] = new TH1I(Form("h_t0_slot_%s_%s", (to_string(slot + 1)).c_str(), skim_smap[iskim].c_str()), "t0", 100, 0,
243 100000);
244 h_topSlotT0[iskim][slot]->GetXaxis()->SetTitle("t0");
245
246 }
247
248 //-------------------------------------------------------------------------------------------------------------------------------------------
249 //
250 // GDL-TOP comparisons for slots in combined decisions
251 //
252
253 h_gdl_ecltop_timing_diff_vs_slot[iskim] = new TH2I(Form("h_gdl_slot_vs_ecltop_timing_diff_%s", skim_smap[iskim].c_str()),
254 "slot vs GDL ECL-TOP slot t0 difference", 400, 1400,
255 2200, 16, 1, 17);
256 h_gdl_ecltop_timing_diff_vs_slot[iskim]->GetXaxis()->SetTitle("GDL ECL - TOP slot t0 time difference (2ns)");
257 h_gdl_ecltop_timing_diff_vs_slot[iskim]->GetYaxis()->SetTitle("slot");
258
259 h_gdl_ecltop_timing_diff_vs_segment[iskim] = new TH2I(Form("h_gdl_segment_vs_ecltop_timing_diff_%s", skim_smap[iskim].c_str()),
260 "segment vs GDL ECL-TOP slot t0 difference",
261 400, 1400, 2200, 10, 1, 11);
262 h_gdl_ecltop_timing_diff_vs_segment[iskim]->GetXaxis()->SetTitle("GDL ECL - TOP slot t0 time difference (2ns)");
263 h_gdl_ecltop_timing_diff_vs_segment[iskim]->GetYaxis()->SetTitle("segment");
264
265 h_gdl_ecltop_timing_diff_vs_nhits[iskim] = new TH2I(Form("h_gdl_nhits_vs_ecltop_timing_diff_%s", skim_smap[iskim].c_str()),
266 "N hits (for slots) vs GDL ECL-TOP slot t0 difference", 400, 1400, 2200, 200, 0, 200);
267 h_gdl_ecltop_timing_diff_vs_nhits[iskim]->GetXaxis()->SetTitle("GDL ECL - TOP slot t0 time difference (2ns)");
268 h_gdl_ecltop_timing_diff_vs_nhits[iskim]->GetYaxis()->SetTitle("N hits");
269
270 h_gdl_ecltop_timing_diff_vs_logl[iskim] = new TH2I(Form("h_gdl_logl_vs_ecltop_timing_diff_%s", skim_smap[iskim].c_str()),
271 "log L (for slots) vs GDL ECL-TOP slot t0 difference", 400, 1400, 2200, 100, 0, 60000);
272 h_gdl_ecltop_timing_diff_vs_logl[iskim]->GetXaxis()->SetTitle("GDL ECL - TOP slot t0 time difference (2ns)");
273 h_gdl_ecltop_timing_diff_vs_logl[iskim]->GetYaxis()->SetTitle("log L");
274
275 //-------------------------------------------------------------------------------------------------------------------------------------------
276
277 h_ecl_gdl_top_timing_diff_both[iskim] = new TH1I(Form("h_ecl_gdl_top_timing_diff_both_%s", skim_smap[iskim].c_str()), "", 400,
278 1400, 2200);
279 h_ecl_gdl_top_timing_diff_both[iskim]->GetXaxis()->SetTitle("Both ECL - GDL_TOP timing difference (2ns)");
280
281 h_ecl_top_top_timing_diff_both[iskim] = new TH1I(Form("h_ecl_top_top_timing_diff_both_%s", skim_smap[iskim].c_str()), "", 400,
282 1400, 2200);
283 h_ecl_top_top_timing_diff_both[iskim]->GetXaxis()->SetTitle("Both ECL - TOP_TOP timing difference (2ns)");
284
285 //-------------------------------------------------------------------------------------------------------------------------------------------
286
287 if (m_histLevel > 2) {
288
289 //
290 // various rvc-related distributions for GDL/TOP
291 //
292
293 h_gdl_top_rvc_vs_top_timing[iskim] = new TH2I(Form("h_gdl_top_rvc_vs_top_timing_%s", skim_smap[iskim].c_str()),
294 "ALL GDL TOP rvc vs GDL TOP timing (7.8ns)",
295 128, 0, 1280, 128, 0, 1280);
296 h_gdl_top_rvc_vs_top_timing[iskim]->GetXaxis()->SetTitle("TOP timing according to GDL (7.8ns)");
297 h_gdl_top_rvc_vs_top_timing[iskim]->GetYaxis()->SetTitle("GDL rvc((TOP decision (received))");
298
299 h_gdl_ecltop_rvc_diff[iskim] = new TH1I(Form("h_gdl_ecltop_rvc_diff_%s", skim_smap[iskim].c_str()),
300 "ALL GDL ECL-TOP rvc difference",
301 10, 0, 10);
302 h_gdl_ecltop_rvc_diff[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP rvc difference (clks)");
303
304 h_gdl_cdctop_rvc_diff[iskim] = new TH1I(Form("h_gdl_cdctop_rvc_diff_%s", skim_smap[iskim].c_str()),
305 "ALL GDL CDC-TOP rvc difference",
306 10, 0, 10);
307 h_gdl_cdctop_rvc_diff[iskim]->GetXaxis()->SetTitle("TOPTRG GDL CDC-TOP rvc difference (clks)");
308
309 //-------------------------------------------------------------------------------------------------------------------------------------------
310
311 h_gdl_gdltop_rvc_diff_all[iskim] = new TH1I(Form("h_gdl_gdltop_rvc_diff_%s", skim_smap[iskim].c_str()),
312 "ALL GDL GDL-TOP rvc difference",
313 10, 1270, 1280);
314 h_gdl_gdltop_rvc_diff_all[iskim]->GetXaxis()->SetTitle("TOPTRG GDL GDL-TOP rvc difference (clks)");
315
316 h_gdl_comtop_rvc_diff_all[iskim] = new TH1I(Form("h_gdl_comtop_rvc_diff_%s", skim_smap[iskim].c_str()),
317 "ALL GDL COM-TOP rvc difference",
318 30, 20, 50);
319 h_gdl_comtop_rvc_diff_all[iskim]->GetXaxis()->SetTitle("TOPTRG GDL COM-TOP rvc difference (clks)");
320
321 //-------------------------------------------------------------------------------------------------------------------------------------------
322
323 h_topRvcDiff1All[iskim] = new TH1I(Form("h_top_rvc_diff_1_%s", skim_smap[iskim].c_str()), "ALL rvc(posted to GDL)-rvc(TOP(this))",
324 250, -100, 150);
325 h_topRvcDiff1All[iskim]->GetXaxis()->SetTitle("rvc(posted to GDL)-rvc(TOP(this))");
326
327 h_topRvcDiff2All[iskim] = new TH1I(Form("h_top_rvc_diff_2_%s", skim_smap[iskim].c_str()), "ALL rvc(TOP(this))-rvc(TOP(prev))",
328 128, 0, 1280);
329 h_topRvcDiff2All[iskim]->GetXaxis()->SetTitle("rvc(TOP(this))-rvc(TOP(prev))");
330
331 h_topRvcDiff3All[iskim] = new TH1I(Form("h_top_rvc_diff_3_%s", skim_smap[iskim].c_str()), "ALL rvc(CB(window))-rvc(TOP(this))",
332 150, 0, 150);
333 h_topRvcDiff3All[iskim]->GetXaxis()->SetTitle("rvc(CB(window))-rvc(TOP(this))");
334
335 h_topRvcDiff4All[iskim] = new TH1I(Form("h_top_rvc_diff_4_%s", skim_smap[iskim].c_str()),
336 "ALL rvc(received L1 from GDL)-rvc(TOP(this))",
337 250, 0, 250);
338 h_topRvcDiff4All[iskim]->GetXaxis()->SetTitle("rvc(L1)-rvc(TOP(this))");
339
340 //-------------------------------------------------------------------------------------------------------------------------------------------
341
342 h_topGdlRvcDiff1All[iskim] = new TH1I(Form("h_gdl_top_l1_rvc_diff_%s", skim_smap[iskim].c_str()),
343 "ALL rvc(L1(GDL))-rvc(L1(as reported to TOP))",
344 10, 1235, 1245);
345 h_topGdlRvcDiff1All[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(L1(as reported to TOP))");
346
347 h_topGdlRvcDiff2All[iskim] = new TH1I(Form("h_gdl_l1_top_t0_this_rvc_diff_%s", skim_smap[iskim].c_str()),
348 "ALL rvc(TOP(received by GDL))-rvc(TOP(this))",
349 50, 0, 200);
350 h_topGdlRvcDiff2All[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(TOP(this))");
351
352 h_topGdlRvcDiff3All[iskim] = new TH1I(Form("h_gdl_l1_top_t0_prev_rvc_diff_%s", skim_smap[iskim].c_str()),
353 "ALL rvc(TOP(received by GDL))-rvc(TOP(prev))",
354 128, 0, 1280);
355 h_topGdlRvcDiff3All[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(TOP(prev))");
356
357 //-------------------------------------------------------------------------------------------------------------------------------------------
358
359 h_decisionNumberVsNumberDecisionsGood[iskim] = new TH2I(Form("h_decision_vs_n_decisions_good_%s", skim_smap[iskim].c_str()),
360 "Good decision number vs N of decisions", 5, 0,
361 5, 5, 0, 5);
362 h_decisionNumberVsNumberDecisionsGood[iskim]->GetXaxis()->SetTitle("N decisions");
363 h_decisionNumberVsNumberDecisionsGood[iskim]->GetYaxis()->SetTitle("Decision number");
364
365 //------------------
366
367 h_ecl_gdl_top_timing_diff_good[iskim] = new TH1I(Form("h_ecl_gdl_top_timing_diff_good_%s", skim_smap[iskim].c_str()), "", 400,
368 1400, 2200);
369 h_ecl_gdl_top_timing_diff_good[iskim]->GetXaxis()->SetTitle("Good ECL - GDL_TOP timing difference (2ns)");
370
371 h_ecl_top_top_timing_diff_good[iskim] = new TH1I(Form("h_ecl_top_top_timing_diff_good_%s", skim_smap[iskim].c_str()), "", 400,
372 1400, 2200);
373 h_ecl_top_top_timing_diff_good[iskim]->GetXaxis()->SetTitle("Good ECL - TOP_TOP timing difference (2ns)");
374
375 //------------------
376
377 h_gdl_ecltop_timing_diff_vs_toptop_good[iskim] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_toptop_good_%s",
378 skim_smap[iskim].c_str()),
379 "GOOD TOP-TOP vs (GDL ECL)-(GDL TOP) (combined) t0 differences", 110, -760, 10240, 110, -760, 10240);
380 h_gdl_ecltop_timing_diff_vs_toptop_good[iskim]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(GDL TOP) t0 difference (ns, 100ns bins)");
381 h_gdl_ecltop_timing_diff_vs_toptop_good[iskim]->GetYaxis()->SetTitle("TOP timing (TOP) - TOP timing (GDL) (ns, 100ns bins)");
382
383 h_top_ecltop_timing_diff_vs_toptop_good[iskim] = new TH2I(Form("h_top_ecltop_timing_diff_vs_toptop_good_%s",
384 skim_smap[iskim].c_str()),
385 "GOOD TOP-TOP vs (GDL ECL)-(TOP TOP) (combined) t0 differences", 110, -760, 10240, 110, -760, 10240);
386 h_top_ecltop_timing_diff_vs_toptop_good[iskim]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (ns, 100ns bins)");
387 h_top_ecltop_timing_diff_vs_toptop_good[iskim]->GetYaxis()->SetTitle("TOP timing (TOP) - TOP timing (GDL) (ns, 100ns bins)");
388
389 h_gdl_ecltop_timing_diff_vs_ecltop_good[iskim] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_ecltop_good_%s",
390 skim_smap[iskim].c_str()),
391 "GOOD (GDL ECL)-(TOP TOP) vs (GDL ECL)-(GDL TOP) (combined) t0 differences", 110, -760, 10240, 110, -760, 10240);
392 h_gdl_ecltop_timing_diff_vs_ecltop_good[iskim]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(GDL TOP) t0 difference (ns, 100ns bins)");
393 h_gdl_ecltop_timing_diff_vs_ecltop_good[iskim]->GetYaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (ns, 100ns bins)");
394
395 //-------------------------------------------------------------------------------------------------------------------------------------------
396
397 h_gdl_gdltop_rvc_diff_good[iskim] = new TH1I(Form("h_gdl_gdltop_rvc_diff_good_%s", skim_smap[iskim].c_str()),
398 "GOOD GDL GDL-TOP rvc difference",
399 10, 1270, 1280);
400 h_gdl_gdltop_rvc_diff_good[iskim]->GetXaxis()->SetTitle("TOPTRG GDL GDL-TOP rvc difference (clks)");
401
402 h_gdl_comtop_rvc_diff_good[iskim] = new TH1I(Form("h_gdl_comtop_rvc_diff_good_%s", skim_smap[iskim].c_str()),
403 "GOOD GDL COM-TOP rvc difference",
404 30, 20, 50);
405 h_gdl_comtop_rvc_diff_good[iskim]->GetXaxis()->SetTitle("TOPTRG GDL COM-TOP rvc difference (clks)");
406
407 //-------------
408
409 h_topCombinedTimingTopGood[iskim] = new TH1I(Form("h_t0_good_%s", skim_smap[iskim].c_str()), "GOOD TOP combined t0 decision", 100,
410 0,
411 100000);
412 h_topCombinedTimingTopGood[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions");
413
414 h_topNSlotsCombinedTimingTopGood[iskim] = new TH1I(Form("h_n_slots_good_%s", skim_smap[iskim].c_str()),
415 "GOOD TOP combined t0 decision: N slots", 17, 0, 17);
416 h_topNSlotsCombinedTimingTopGood[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N slots");
417
418 h_topNHitSumGood[iskim] = new TH1I(Form("h_n_hit_per_slot_good_%s", skim_smap[iskim].c_str()),
419 "GOOD TOP combined t0 decision: N hit per slot", 200, 0, 200);
420 h_topNHitSumGood[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N hits per slot");
421
422 h_topLogLSumGood[iskim] = new TH1I(Form("h_logl_per_slot_good_%s", skim_smap[iskim].c_str()),
423 "GOOD TOP combined t0 decision: log L per slot", 100, 0, 60000);
424 h_topLogLSumGood[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: log L per slot");
425
426 //-------------
427
428 h_topRvcDiff1Good[iskim] = new TH1I(Form("h_rvc_diff_1_good_%s", skim_smap[iskim].c_str()),
429 "GOOD rvc(posted to GDL)-rvc(TOP(this))",
430 250, -100, 150);
431 h_topRvcDiff1Good[iskim]->GetXaxis()->SetTitle("rvc(posted to GDL)-rvc(TOP(this))");
432
433 h_topRvcDiff2Good[iskim] = new TH1I(Form("h_rvc_diff_2_good_%s", skim_smap[iskim].c_str()), "GOOD rvc(TOP(this))-rvc(TOP(prev))",
434 128, 0, 1280);
435 h_topRvcDiff2Good[iskim]->GetXaxis()->SetTitle("rvc(TOP(this))-rvc(TOP(prev))");
436
437 h_topRvcDiff3Good[iskim] = new TH1I(Form("h_rvc_diff_3_good_%s", skim_smap[iskim].c_str()), "GOOD rvc(CB(window))-rvc(TOP(this))",
438 150, 0, 150);
439 h_topRvcDiff3Good[iskim]->GetXaxis()->SetTitle("rvc(CB(window))-rvc(TOP(this))");
440
441 h_topRvcDiff4Good[iskim] = new TH1I(Form("h_rvc_diff_4_good_%s", skim_smap[iskim].c_str()),
442 "GOOD rvc(received L1 from GDL)-rvc(TOP(this))",
443 250, 0, 250);
444 h_topRvcDiff4Good[iskim]->GetXaxis()->SetTitle("rvc(L1)-rvc(TOP(this))");
445
446 //-------------------------------------------------------------------------------------------------------------------------------------------
447
448 h_topGdlRvcDiff1Good[iskim] = new TH1I(Form("h_gdl_top_l1_rvc_diff_good_%s", skim_smap[iskim].c_str()),
449 "GOOD rvc(L1(GDL))-rvc(L1(as reported to TOP))",
450 10, 1235, 1245);
451 h_topGdlRvcDiff1Good[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(L1(as reported to TOP))");
452
453 h_topGdlRvcDiff2Good[iskim] = new TH1I(Form("h_gdl_l1_top_t0_this_rvc_diff_good_%s", skim_smap[iskim].c_str()),
454 "GOOD rvc(TOP(received by GDL))-rvc(TOP(this))",
455 100, 0, 200);
456 h_topGdlRvcDiff2Good[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(TOP(this))");
457
458 h_topGdlRvcDiff3Good[iskim] = new TH1I(Form("h_gdl_l1_top_t0_prev_rvc_diff_good_%s", skim_smap[iskim].c_str()),
459 "GOOD rvc(TOP(received by GDL))-rvc(TOP(prev))",
460 128, 0, 1280);
461 h_topGdlRvcDiff3Good[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(TOP(prev))");
462
463 //-------------------------------------------------------------------------------------------------------------------------------------------
464
465 h_decisionNumberVsNumberDecisionsBad[iskim] = new TH2I(Form("h_decision_vs_n_decisions_bad_%s", skim_smap[iskim].c_str()),
466 "Bad decision number vs N of decisions", 5, 0, 5,
467 5, 0, 5);
468 h_decisionNumberVsNumberDecisionsBad[iskim]->GetXaxis()->SetTitle("N decisions");
469 h_decisionNumberVsNumberDecisionsBad[iskim]->GetYaxis()->SetTitle("Decision number");
470
471 //------------------
472
473 h_ecl_gdl_top_timing_diff_bad[iskim] = new TH1I(Form("h_ecl_gdl_top_timing_diff_bad_%s", skim_smap[iskim].c_str()), "", 400, 1400,
474 2200);
475 h_ecl_gdl_top_timing_diff_bad[iskim]->GetXaxis()->SetTitle("Bad ECL - GDL_TOP timing difference (2ns)");
476
477 h_ecl_top_top_timing_diff_bad[iskim] = new TH1I(Form("h_ecl_top_top_timing_diff_bad_%s", skim_smap[iskim].c_str()), "", 400, 1400,
478 2200);
479 h_ecl_top_top_timing_diff_bad[iskim]->GetXaxis()->SetTitle("Bad ECL - TOP_TOP timing difference (2ns)");
480
481 //------------------
482
483 h_gdl_ecltop_timing_diff_vs_toptop_bad[iskim] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_toptop_bad_%s",
484 skim_smap[iskim].c_str()),
485 "BAD TOP-TOP vs (GDL ECL)-(GDL TOP) t0 differences", 110, -760, 10240, 110, -760, 10240);
486 h_gdl_ecltop_timing_diff_vs_toptop_bad[iskim]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(GDL TOP) (combined) t0 difference (ns, 100ns bins)");
487 h_gdl_ecltop_timing_diff_vs_toptop_bad[iskim]->GetYaxis()->SetTitle("TOP timing (TOP) - TOP timing (GDL) (ns, 100ns bins)");
488
489 h_top_ecltop_timing_diff_vs_toptop_bad[iskim] = new TH2I(Form("h_top_ecltop_timing_diff_vs_toptop_bad_%s",
490 skim_smap[iskim].c_str()),
491 "BAD TOP-TOP vs (GDL ECL)-(TOP TOP) (combined) t0 differences", 110, -760, 10240, 110, -760, 10240);
492 h_top_ecltop_timing_diff_vs_toptop_bad[iskim]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (ns, 100ns bins)");
493 h_top_ecltop_timing_diff_vs_toptop_bad[iskim]->GetYaxis()->SetTitle("TOP timing (TOP) - TOP timing (GDL) (ns, 100ns bins)");
494
495 h_gdl_ecltop_timing_diff_vs_ecltop_bad[iskim] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_ecltop_bad_%s",
496 skim_smap[iskim].c_str()),
497 "BAD (GDL ECL)-(TOP TOP) vs (GDL ECL)-(GDL TOP) (combined) t0 differences", 110, -760, 10240, 110, -760, 10240);
498 h_gdl_ecltop_timing_diff_vs_ecltop_bad[iskim]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(GDL TOP) t0 difference (ns, 100ns bins)");
499 h_gdl_ecltop_timing_diff_vs_ecltop_bad[iskim]->GetYaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (ns, 100ns bins)");
500
501 //-------------------------------------------------------------------------------------------------------------------------------------------
502
503 h_gdl_gdltop_rvc_diff_bad[iskim] = new TH1I(Form("h_gdl_gdltop_rvc_diff_bad_%s", skim_smap[iskim].c_str()),
504 "BAD GDL GDL-TOP rvc difference",
505 10, 1270, 1280);
506 h_gdl_gdltop_rvc_diff_bad[iskim]->GetXaxis()->SetTitle("TOPTRG GDL GDL-TOP rvc difference (clks)");
507
508 h_gdl_comtop_rvc_diff_bad[iskim] = new TH1I(Form("h_gdl_comtop_rvc_diff_bad_%s", skim_smap[iskim].c_str()),
509 "BAD GDL COM-TOP rvc difference",
510 30, 20, 50);
511 h_gdl_comtop_rvc_diff_bad[iskim]->GetXaxis()->SetTitle("TOPTRG GDL COM-TOP rvc difference (clks)");
512
513 //-------------
514
515 h_topCombinedTimingTopBad[iskim] = new TH1I(Form("h_t0_bad_%s", skim_smap[iskim].c_str()), "BAD TOP combined t0 decision", 100, 0,
516 100000);
517 h_topCombinedTimingTopBad[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions");
518
519 h_topNSlotsCombinedTimingTopBad[iskim] = new TH1I(Form("h_N_slots_bad_%s", skim_smap[iskim].c_str()),
520 "BAD TOP combined t0 decision: N slots", 17, 0, 17);
521 h_topNSlotsCombinedTimingTopBad[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N slots");
522
523 h_topNHitSumBad[iskim] = new TH1I(Form("h_n_hit_per_slot_bad_%s", skim_smap[iskim].c_str()),
524 "BAD TOP combined t0 decision: N hit per slot", 200, 0, 200);
525 h_topNHitSumBad[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N hits per slot");
526
527 h_topLogLSumBad[iskim] = new TH1I(Form("h_logl_per_slot_bad_%s", skim_smap[iskim].c_str()),
528 "BAD TOP combined t0 decision: log L per slot", 100, 0, 60000);
529 h_topLogLSumBad[iskim]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: log L per slot");
530
531 //-------------
532
533 h_topRvcDiff1Bad[iskim] = new TH1I(Form("h_rvc_diff_1_bad_%s", skim_smap[iskim].c_str()), "BAD rvc(posted to GDL)-rvc(TOP(this))",
534 250, -100, 150);
535
536 h_topRvcDiff1Bad[iskim]->GetXaxis()->SetTitle("rvc(posted to GDL)-rvc(TOP(this))");
537
538 h_topRvcDiff2Bad[iskim] = new TH1I(Form("h_rvc_diff_2_bad_%s", skim_smap[iskim].c_str()), "BAD rvc(TOP(this))-rvc(TOP(prev))",
539 128, 0, 1280);
540 h_topRvcDiff2Bad[iskim]->GetXaxis()->SetTitle("rvc(TOP(this))-rvc(TOP(prev))");
541
542 h_topRvcDiff3Bad[iskim] = new TH1I(Form("h_rvc_diff_3_bad_%s", skim_smap[iskim].c_str()), "BAD rvc(CB(window))-rvc(TOP(this))",
543 150, 0, 150);
544 h_topRvcDiff3Bad[iskim]->GetXaxis()->SetTitle("rvc(CB(window))-rvc(TOP(this))");
545
546 h_topRvcDiff4Bad[iskim] = new TH1I(Form("h_rvc_diff_4_bad_%s", skim_smap[iskim].c_str()),
547 "BAD rvc(received L1 from GDL)-rvc(TOP(this))",
548 250, 0, 250);
549 h_topRvcDiff4Bad[iskim]->GetXaxis()->SetTitle("rvc(L1)-rvc(TOP(this))");
550
551 //-------------------------------------------------------------------------------------------------------------------------------------------
552
553 h_topGdlRvcDiff1Bad[iskim] = new TH1I(Form("h_gdl_top_l1_rvc_diff_bad_%s", skim_smap[iskim].c_str()),
554 "BAD rvc(L1(GDL))-rvc(L1(as reported to TOP))",
555 10, 1235, 1245);
556 h_topGdlRvcDiff1Bad[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(L1(as reported to TOP))");
557
558 h_topGdlRvcDiff2Bad[iskim] = new TH1I(Form("h_gdl_l1_top_t0_this_rvc_diff_bad_%s", skim_smap[iskim].c_str()),
559 "BAD rvc(TOP(received by GDL))-rvc(TOP(this))",
560 100, 0, 200);
561 h_topGdlRvcDiff2Bad[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(TOP(this))");
562
563 h_topGdlRvcDiff3Bad[iskim] = new TH1I(Form("h_gdl_l1_top_t0_prev_rvc_diff_bad_%s", skim_smap[iskim].c_str()),
564 "BAD rvc(TOP(received by GDL))-rvc(TOP(prev))",
565 128, 0, 1280);
566 h_topGdlRvcDiff3Bad[iskim]->GetXaxis()->SetTitle("rvc(L1(GDL))-rvc(TOP(prev))");
567
568 }
569 //-------------------------------------------------------------------------------------------------------------------------------------------
570
571 h_top_nt0decisions_vs_hist_class[iskim] = new TH2I(Form("h_top_nt0decisions_vs_hist_class_%s", skim_smap[iskim].c_str()),
572 "N t0 decisions vs event class according to TOP info matching between GDL and TOP",
573 3, 0, 3, 5, 1, 6);
574 h_top_nt0decisions_vs_hist_class[iskim]->GetXaxis()->SetTitle("TOP info match (GDL vs TOP): 0/1/2 : first decision match/no match/match in some other decision");
575 h_top_nt0decisions_vs_hist_class[iskim]->GetYaxis()->SetTitle("Number of t0 decisions");
576
577 h_top_gdl_match_decision_number[iskim] = new TH1I(Form("h_top_gdl_match_decision_number_%s", skim_smap[iskim].c_str()),
578 "Decision number where TOP info is the same at TOP and GDL",
579 6, 0, 6);
580 h_top_gdl_match_decision_number[iskim]->GetXaxis()->SetTitle("TOPTRG combined decision # where TOP info is the same at TOP and GDL");
581
582 h_gdl_ecltop_timing_diff_5ns[iskim] = new TH1I(Form("h_gdl_ecltop_timing_diff_5ns_%s", skim_smap[iskim].c_str()),
583 "GDL ECL-TOP t0 difference", 248, 0, 10240);
584 h_gdl_ecltop_timing_diff_5ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP t0 difference (5ns)");
585
586 h_gdl_cdctop_timing_diff_5ns[iskim] = new TH1I(Form("h_gdl_cdctop_timing_diff_5ns_%s", skim_smap[iskim].c_str()),
587 "GDL CDC-TOP t0 difference", 248, 0, 10240);
588 h_gdl_cdctop_timing_diff_5ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL CDC-TOP t0 difference (5ns)");
589
590 //--- resolution plots ---
591
592 h_gdl_ecltop_timing_diff_2ns[iskim] = new TH1I(Form("h_gdl_ecltop_timing_diff_2ns_%s", skim_smap[iskim].c_str()),
593 "GDL ECL-TOP t0 difference", 400, 1400, 2200);
594 h_gdl_ecltop_timing_diff_2ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP t0 difference (2ns)");
595
596 h_gdl_ecltop_timing_diff_grl_matched_2ns[iskim] = new TH1I(Form("h_gdl_ecltop_timing_diff_grl_matched_2ns_%s",
597 skim_smap[iskim].c_str()),
598 "GDL ECL-TOP t0 difference", 400, 1400, 2200);
599 h_gdl_ecltop_timing_diff_grl_matched_2ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP t0 difference when TOP and GRL match (2ns)");
600
601 h_gdl_ecltop_timing_diff_no_grl_matched_2ns[iskim] = new TH1I(Form("h_gdl_ecltop_timing_diff_no_grl_matched_2ns_%s",
602 skim_smap[iskim].c_str()),
603 "GDL ECL-TOP t0 difference", 400, 1400, 2200);
604 h_gdl_ecltop_timing_diff_no_grl_matched_2ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP t0 difference when TOP and GRL do not match (2ns)");
605
606 h_gdl_ecltop_timing_diff_no_grl_at_all_2ns[iskim] = new TH1I(Form("h_gdl_ecltop_timing_diff_no_grl_at_all_2ns_%s",
607 skim_smap[iskim].c_str()),
608 "GDL ECL-TOP t0 difference", 400, 1400, 2200);
609 h_gdl_ecltop_timing_diff_no_grl_at_all_2ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP t0 difference when GRL has no 2D tracks (2ns)");
610
611 h_gdl_ecltop_timing_diff_vs_nslots_2ns[iskim] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_nslots_2ns_%s",
612 skim_smap[iskim].c_str()),
613 "GDL N slots vs ECL-TOP t0 difference", 400, 1400, 2200, 16, 1, 17);
614 h_gdl_ecltop_timing_diff_vs_nslots_2ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP t0 difference (2ns)");
615 h_gdl_ecltop_timing_diff_vs_nslots_2ns[iskim]->GetYaxis()->SetTitle("N slots in combined decision");
616
617 h_top_ecltop_timing_diff_combined_2ns[iskim] = new TH1I(Form("h_gdl_ecltop_timing_diff_combined_2ns_%s", skim_smap[iskim].c_str()),
618 "GDL ECL-TOP TOP t0 difference", 400, 1400, 2200);
619 h_top_ecltop_timing_diff_combined_2ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP t0 difference (2ns)");
620
621 h_top_ecltop_timing_diff_best_slot_2ns[iskim] = new TH1I(Form("h_gdl_ecltop_timing_diff_best_slot_2ns_%s",
622 skim_smap[iskim].c_str()),
623 "GDL ECL-TOP TOP t0 difference using slot with max N hits", 400, 1400, 2200);
624 h_top_ecltop_timing_diff_best_slot_2ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL ECL-TOP t0 difference (2ns)");
625
626 h_gdl_cdctop_timing_diff_2ns[iskim] = new TH1I(Form("h_gdl_cdctop_timing_diff_2ns_%s", skim_smap[iskim].c_str()),
627 "GDL CDC-TOP t0 difference", 250, 0, 500);
628 h_gdl_cdctop_timing_diff_2ns[iskim]->GetXaxis()->SetTitle("TOPTRG GDL CDC-TOP t0 difference (2ns)");
629
630 //------------------------
631
632 for (int histClass = 0; histClass < m_nHistClassesActual; histClass++) {
633
634 // max N of combined t0 decisions (over past ~us) = N windows in circular buffer
635 h_N_decision[iskim][histClass] = new TH1I(Form("h_N_decisions_%d_%s", histClass, skim_smap[iskim].c_str()),
636 "N t0 decisions in 1 us before GDL L1", 5, 1,
637 6);
638 h_N_decision[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG N combined t0 decisions");
639
640 //-------------
641
642 h_topNHitVsNhit[iskim][histClass] = new TH2I(Form("h_nhit_vs_nhit_first_decision_%d_%s", histClass, skim_smap[iskim].c_str()),
643 "First decision: N hits vs N hits", 20, 0, 100, 20, 0, 100);
644 h_topNHitVsNhit[iskim][histClass]->GetXaxis()->SetTitle("N hits for slot with largest N hits");
645 h_topNHitVsNhit[iskim][histClass]->GetYaxis()->SetTitle("N hits for slot with next to the largest N hits");
646
647 h_topSlotVsSlot[iskim][histClass] = new TH2I(Form("h_slot_vs_slot_first_decision_%d_%s", histClass, skim_smap[iskim].c_str()),
648 "First decision: slot # vs slot #", 16, 1, 17, 16, 1, 17);
649 h_topSlotVsSlot[iskim][histClass]->GetXaxis()->SetTitle("Slot # for slot with largest N hits");
650 h_topSlotVsSlot[iskim][histClass]->GetYaxis()->SetTitle("Slot # for slot with next to the largest N hits");
651
652 h_topT0VsT0[iskim][histClass] = new TH2I(Form("h_t0_vs_t0_first_decision_%d_%s", histClass, skim_smap[iskim].c_str()),
653 "First decision: T0 vs T0", 100, 0, 100000, 100, 0, 100000);
654 h_topT0VsT0[iskim][histClass]->GetXaxis()->SetTitle("T0 for slot with largest N hits");
655 h_topT0VsT0[iskim][histClass]->GetYaxis()->SetTitle("T0 for slot with next to the largest N hits");
656
657 h_topSegmentVsSegment[iskim][histClass] = new TH2I(Form("h_segment_vs_segment_first_decision_%d_%s", histClass,
658 skim_smap[iskim].c_str()),
659 "First decision: segment # vs segment #", 10, 1, 11, 10, 1, 11);
660 h_topSegmentVsSegment[iskim][histClass]->GetXaxis()->SetTitle("Segment # for slot with largest N hits");
661 h_topSegmentVsSegment[iskim][histClass]->GetYaxis()->SetTitle("Segment # for slot with next to the largest N hits");
662
663 h_topLogLVsLogL[iskim][histClass] = new TH2I(Form("h_logl_vs_logl_first_decision_%d_%s", histClass, skim_smap[iskim].c_str()),
664 "First decision: log L vs log L", 100, 0, 60000, 100, 0, 60000);
665 h_topLogLVsLogL[iskim][histClass]->GetXaxis()->SetTitle("log L for slot with largest N hits");
666 h_topLogLVsLogL[iskim][histClass]->GetYaxis()->SetTitle("log L for slot with next to the largest N hits");
667
668 }
669
670 //------------------------
671
672 if (m_histLevel > 1) {
673
674 // these two for loops are nested in this particular way to simplify browsing through the histograms
675
676 for (int histClass = 0; histClass < m_nHistClassesActual; histClass++) {
677
678 h_topCombinedTimingTop[iskim][histClass] = new TH1I(Form("h_t0_%d_%s", histClass, skim_smap[iskim].c_str()),
679 "TOP combined t0 decision", 100, 0,
680 100000);
681 h_topCombinedTimingTop[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions");
682
683 h_topNSlotsCombinedTimingTop[iskim][histClass] = new TH1I(Form("h_n_slots_%d_%s", histClass, skim_smap[iskim].c_str()),
684 "TOP combined t0 decision: N slots", 17, 0, 17);
685 h_topNSlotsCombinedTimingTop[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N slots");
686
687 h_topNHitSum[iskim][histClass] = new TH1I(Form("h_n_hit_per_slot_%d_%s", histClass, skim_smap[iskim].c_str()),
688 "TOP combined t0 decision: N hits per slot", 200, 0, 200);
689 h_topNHitSum[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N hits per slot");
690
691 h_topNHitBestSlot[iskim][histClass] = new TH1I(Form("h_n_hit_best_slot_%d_%s", histClass, skim_smap[iskim].c_str()),
692 "TOP combined t0 decision: N hits best slot", 200, 0, 200);
693 h_topNHitBestSlot[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: N hits best slot");
694
695 // h_topT0DecisionNumberBestSlot[iskim][histClass] = new TH1I(Form("h_t0_decision_number_best_slot_%d_%s", histClass,
696 // skim_smap[iskim].c_str()),
697 // "TOP combined t0 decision: combined t0 decision number best slot", 5, 1, 6);
698 // h_topT0DecisionNumberBestSlot[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: combined t0 decision number best slot");
699
700 h_topLogLSum[iskim][histClass] = new TH1I(Form("h_logl_per_slot_%d_%s", histClass, skim_smap[iskim].c_str()),
701 "TOP combined t0 decision: log L per slot", 100, 0, 60000);
702 h_topLogLSum[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG combined t0 decisions: log L per slot");
703
704 //-------------------------------------------------------------------------------------------------------------------------------------------
705
706 h_gdl_ecltop_timing_diff_vs_slot_2ns[iskim][histClass] = new TH2I(Form("h_gdl_slot_vs_ecltop_timing_diff_%d_%s", histClass,
707 skim_smap[iskim].c_str()), "slot vs GDL ECL-TOP slot t0 difference", 400, 1400, 2200, 16, 1, 17);
708 h_gdl_ecltop_timing_diff_vs_slot_2ns[iskim][histClass]->GetXaxis()->SetTitle("GDL ECL - TOP slot t0 time difference (2ns)");
709 h_gdl_ecltop_timing_diff_vs_slot_2ns[iskim][histClass]->GetYaxis()->SetTitle("slot");
710
711 h_gdl_ecltop_timing_diff_vs_segment_2ns[iskim][histClass] = new TH2I(Form("h_gdl_segment_vs_ecltop_timing_diff_%d_%s", histClass,
712 skim_smap[iskim].c_str()), "segment vs GDL ECL-TOP slot t0 difference", 400, 1400, 2200, 10, 1, 11);
713 h_gdl_ecltop_timing_diff_vs_segment_2ns[iskim][histClass]->GetXaxis()->SetTitle("GDL ECL - TOP slot t0 time difference (2ns)");
714 h_gdl_ecltop_timing_diff_vs_segment_2ns[iskim][histClass]->GetYaxis()->SetTitle("segment");
715
716 h_gdl_ecltop_timing_diff_vs_nhits_2ns[iskim][histClass] = new TH2I(Form("h_gdl_nhits_vs_ecltop_timing_diff_%d_%s", histClass,
717 skim_smap[iskim].c_str()), "N hits (for slots) vs GDL ECL-TOP slot t0 difference", 400, 1400, 2200, 200, 0, 200);
718 h_gdl_ecltop_timing_diff_vs_nhits_2ns[iskim][histClass]->GetXaxis()->SetTitle("GDL ECL - TOP slot t0 time difference (2ns)");
719 h_gdl_ecltop_timing_diff_vs_nhits_2ns[iskim][histClass]->GetYaxis()->SetTitle("N hits");
720
721 h_gdl_ecltop_timing_diff_vs_logl_2ns[iskim][histClass] = new TH2I(Form("h_gdl_logl_vs_ecltop_timing_diff_%d_%s", histClass,
722 skim_smap[iskim].c_str()), "log L (for slots) vs GDL ECL-TOP slot t0 difference", 400, 1400, 2200, 100, 0, 60000);
723 h_gdl_ecltop_timing_diff_vs_logl_2ns[iskim][histClass]->GetXaxis()->SetTitle("GDL ECL - TOP slot t0 time difference (2ns)");
724 h_gdl_ecltop_timing_diff_vs_logl_2ns[iskim][histClass]->GetYaxis()->SetTitle("log L");
725
726 //-------------
727
728 h_top_ecltop_timing_combined_diff_2ns[iskim][histClass] = new TH1I(Form("h_top_ecltop_timing_combined_diff_2ns_%d_%s", histClass,
729 skim_smap[iskim].c_str()),
730 "(GDL ECL)-(TOP TOP) t0 difference (combined decision)", 400, 1400, 2200);
731 h_top_ecltop_timing_combined_diff_2ns[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (2ns)");
732
733 h_top_ecltop_timing_best_slot_diff_2ns[iskim][histClass] = new TH1I(Form("h_top_ecltop_timing_best_slot_diff_2ns_%d_%s", histClass,
734 skim_smap[iskim].c_str()),
735 "(GDL ECL)-(TOP TOP) t0 difference (best slot decision)", 400, 1400, 2200);
736 h_top_ecltop_timing_best_slot_diff_2ns[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (2ns)");
737
738 h_gdl_ecltop_timing_diff_vs_toptop[iskim][histClass] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_toptop_%d_%s", histClass,
739 skim_smap[iskim].c_str()),
740 "TOP-TOP vs (GDL ECL)-(GDL TOP) t0 differences", 110, -760, 10240, 110, -760, 10240);
741 h_gdl_ecltop_timing_diff_vs_toptop[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(GDL TOP) (combined) t0 difference (ns, 100ns bins)");
742 h_gdl_ecltop_timing_diff_vs_toptop[iskim][histClass]->GetYaxis()->SetTitle("TOP timing (TOP) - TOP timing (GDL) (ns, 100ns bins)");
743
744 h_top_ecltop_timing_diff_vs_toptop[iskim][histClass] = new TH2I(Form("h_top_ecltop_timing_diff_vs_toptop_%d_%s", histClass,
745 skim_smap[iskim].c_str()),
746 "TOP-TOP vs (GDL ECL)-(TOP TOP) (combined) t0 differences", 110, -760, 10240, 110, -760, 10240);
747 h_top_ecltop_timing_diff_vs_toptop[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (ns, 100ns bins)");
748 h_top_ecltop_timing_diff_vs_toptop[iskim][histClass]->GetYaxis()->SetTitle("TOP timing (TOP) - TOP timing (GDL) (ns, 100ns bins)");
749
750 h_gdl_ecltop_timing_diff_vs_ecltop[iskim][histClass] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_ecltop_%d_%s", histClass,
751 skim_smap[iskim].c_str()),
752 "(GDL ECL)-(TOP TOP) vs (GDL ECL)-(GDL TOP) (combined) t0 differences", 110, -760, 10240, 110, -760, 10240);
753 h_gdl_ecltop_timing_diff_vs_ecltop[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(GDL TOP) t0 difference (ns, 100ns bins)");
754 h_gdl_ecltop_timing_diff_vs_ecltop[iskim][histClass]->GetYaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (ns, 100ns bins)");
755
756 h_gdl_ecltop_timing_diff_vs_ecltop_best_slot[iskim][histClass] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_ecltop_best_slot_%d_%s",
757 histClass, skim_smap[iskim].c_str()),
758 "(GDL ECL)-(TOP TOP) vs (GDL ECL)-(GDL TOP) (best slot) t0 differences", 110, -760, 10240, 110, -760, 10240);
759 h_gdl_ecltop_timing_diff_vs_ecltop_best_slot[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(GDL TOP() best slot) t0 difference (ns, 100ns bins)");
760 h_gdl_ecltop_timing_diff_vs_ecltop_best_slot[iskim][histClass]->GetYaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (ns, 100ns bins)");
761
762 h_top_ecltop_timing_diff_2ns[iskim][histClass] = new TH1I(Form("h_top_ecltop_timing_diff_2ns_%d_%s", histClass,
763 skim_smap[iskim].c_str()),
764 "(GDL ECL)-(TOP TOP) t0 difference (all decisions)", 400, 1400, 2200);
765 h_top_ecltop_timing_diff_2ns[iskim][histClass]->GetXaxis()->SetTitle("TOPTRG (GDL ECL)-(TOP TOP) t0 difference (2ns)");
766
767 }
768 }
769
770 //-----
771
772 h_topTC2IdVsTC1IdAll[iskim] = new TH2I(Form("h_top_tc2id_vs_tc1id_%s", skim_smap[iskim].c_str()),
773 "Sorted (by energy) TC2 Id vs TC1 Id", 100, 0, 600, 100, 0, 600);
774 h_topTC2IdVsTC1IdAll[iskim]->GetXaxis()->SetTitle("Most energetic TC id");
775 h_topTC2IdVsTC1IdAll[iskim]->GetYaxis()->SetTitle("Next to most energetic TC id");
776
777 h_topTC2EnergyVsTC1EnergyAll[iskim] = new TH2I(Form("h_top_tc2en_vs_tc1en_%s", skim_smap[iskim].c_str()),
778 "Sorted TC2 energy vs TC1 energy", 100, 0, 1000, 100, 0, 1000);
779 h_topTC2EnergyVsTC1EnergyAll[iskim]->GetXaxis()->SetTitle("Most energetic TC energy");
780 h_topTC2EnergyVsTC1EnergyAll[iskim]->GetYaxis()->SetTitle("Next to most energetic TC energy");
781
782 h_topTC2ThetaIdVsTC1ThetaIdAll[iskim] = new TH2I(Form("h_top_tc2thetaid_vs_tc1thetaid_%s", skim_smap[iskim].c_str()),
783 "Sorted by energy TC2 vs TC1 theta ids", 20, 0, 20,
784 20, 0, 20);
785 h_topTC2ThetaIdVsTC1ThetaIdAll[iskim]->GetXaxis()->SetTitle("Most energetic TC theta id");
786 h_topTC2ThetaIdVsTC1ThetaIdAll[iskim]->GetYaxis()->SetTitle("Next to most energetic TC theta id");
787
788 h_topTC2PhiIdVsTC1PhiIdAll[iskim] = new TH2I(Form("h_top_tc2phiid_vs_tc1phiid_%s", skim_smap[iskim].c_str()),
789 "Sorted by energy TC2 vs TC1 phi ids", 36, 1, 37, 36, 1,
790 37);
791 h_topTC2PhiIdVsTC1PhiIdAll[iskim]->GetXaxis()->SetTitle("Most energetic TC phi id");
792 h_topTC2PhiIdVsTC1PhiIdAll[iskim]->GetYaxis()->SetTitle("Next to most energetic TC phi id");
793
794 h_topTCPhiIdVsTCThetaIdAll[iskim] = new TH3I(Form("h_top_tcphiid_vs_tcthetaid_%s", skim_smap[iskim].c_str()),
795 "Sorted by energy TC2 vs TC1 theta vs phi ids", 20, 0, 20,
796 36, 1, 37, 2, 0, 2);
797 h_topTCPhiIdVsTCThetaIdAll[iskim]->GetXaxis()->SetTitle("Most and next to most energetic TCs theta ids");
798 h_topTCPhiIdVsTCThetaIdAll[iskim]->GetYaxis()->SetTitle("Most and next to most energetic TCs phi ids");
799 h_topTCPhiIdVsTCThetaIdAll[iskim]->GetZaxis()->SetTitle("Most and next to most energetic TCs");
800
801 //-----
802
803 h_topTC2IdVsTC1IdGRLAll[iskim] = new TH2I(Form("h_top_tc2id_vs_tc1id_grl_%s", skim_smap[iskim].c_str()),
804 "Sorted (by energy) TC2 Id vs TC1 Id", 100, 0, 600, 100, 0, 600);
805 h_topTC2IdVsTC1IdGRLAll[iskim]->GetXaxis()->SetTitle("Most energetic TC id");
806 h_topTC2IdVsTC1IdGRLAll[iskim]->GetYaxis()->SetTitle("Next to most energetic TC id");
807
808 h_topTC2EnergyVsTC1EnergyGRLAll[iskim] = new TH2I(Form("h_top_tc2en_vs_tc1en_grl_%s", skim_smap[iskim].c_str()),
809 "Sorted TC2 energy vs TC1 energy", 100, 0, 1000, 100, 0,
810 1000);
811 h_topTC2EnergyVsTC1EnergyGRLAll[iskim]->GetXaxis()->SetTitle("Most energetic TC energy");
812 h_topTC2EnergyVsTC1EnergyGRLAll[iskim]->GetYaxis()->SetTitle("Next to most energetic TC energy");
813
814 h_topTC2ThetaIdVsTC1ThetaIdGRLAll[iskim] = new TH2I(Form("h_top_tc2thetaid_vs_tc1thetaid_grl_%s", skim_smap[iskim].c_str()),
815 "Sorted by energy TC2 vs TC1 theta ids", 20,
816 0, 20, 20, 0, 20);
817 h_topTC2ThetaIdVsTC1ThetaIdGRLAll[iskim]->GetXaxis()->SetTitle("Most energetic TC theta id");
818 h_topTC2ThetaIdVsTC1ThetaIdGRLAll[iskim]->GetYaxis()->SetTitle("Next to most energetic TC theta id");
819
820 h_topTC2PhiIdVsTC1PhiIdGRLAll[iskim] = new TH2I(Form("h_top_tc2phiid_vs_tc1phiid_grl_%s", skim_smap[iskim].c_str()),
821 "Sorted by energy TC2 vs TC1 phi ids", 36, 1, 37, 36,
822 1, 37);
823 h_topTC2PhiIdVsTC1PhiIdGRLAll[iskim]->GetXaxis()->SetTitle("Most energetic TC phi id");
824 h_topTC2PhiIdVsTC1PhiIdGRLAll[iskim]->GetYaxis()->SetTitle("Next to most energetic TC phi id");
825
826 h_topTCPhiIdVsTCThetaIdGRLAll[iskim] = new TH3I(Form("h_top_tcphiid_vs_tcthetaid_grl_%s", skim_smap[iskim].c_str()),
827 "Sorted by energy TC2 vs TC1 theta vs phi ids", 20,
828 0, 20, 36, 1, 37, 2, 0, 2);
829 h_topTCPhiIdVsTCThetaIdGRLAll[iskim]->GetXaxis()->SetTitle("Most and next to most energetic TCs theta ids");
830 h_topTCPhiIdVsTCThetaIdGRLAll[iskim]->GetYaxis()->SetTitle("Most and next to most energetic TCs phi ids");
831 h_topTCPhiIdVsTCThetaIdGRLAll[iskim]->GetZaxis()->SetTitle("Most and next to most energetic TCs");
832
833 //-----
834
835 h_topTC2IdVsTC1Id[iskim] = new TH2I(Form("h_top_tc2id_vs_tc1id_b2b_%s", skim_smap[iskim].c_str()),
836 "Sorted (by energy) TC2 Id vs TC1 Id", 100, 0, 600, 100, 0, 600);
837 h_topTC2IdVsTC1Id[iskim]->GetXaxis()->SetTitle("Most energetic TC id");
838 h_topTC2IdVsTC1Id[iskim]->GetYaxis()->SetTitle("Next to most energetic TC id");
839
840 h_topTC2EnergyVsTC1Energy[iskim] = new TH2I(Form("h_top_tc2en_vs_tc1en_b2b_%s", skim_smap[iskim].c_str()),
841 "Sorted TC2 energy vs TC1 energy", 100, 0, 1000, 100, 0, 1000);
842 h_topTC2EnergyVsTC1Energy[iskim]->GetXaxis()->SetTitle("Most energetic TC energy");
843 h_topTC2EnergyVsTC1Energy[iskim]->GetYaxis()->SetTitle("Next to most energetic TC energy");
844
845 h_topTC2ThetaIdVsTC1ThetaId[iskim] = new TH2I(Form("h_top_tc2thetaid_vs_tc1thetaid_b2b_%s", skim_smap[iskim].c_str()),
846 "Sorted by energy TC2 vs TC1 theta ids", 20, 0, 20, 20, 0,
847 20);
848 h_topTC2ThetaIdVsTC1ThetaId[iskim]->GetXaxis()->SetTitle("Most energetic TC theta id");
849 h_topTC2ThetaIdVsTC1ThetaId[iskim]->GetYaxis()->SetTitle("Next to most energetic TC theta id");
850
851 h_topTC2PhiIdVsTC1PhiId[iskim] = new TH2I(Form("h_top_tc2phiid_vs_tc1phiid_b2b_%s", skim_smap[iskim].c_str()),
852 "Sorted by energy TC2 vs TC1 phi ids", 36, 1, 37, 36, 1, 37);
853 h_topTC2PhiIdVsTC1PhiId[iskim]->GetXaxis()->SetTitle("Most energetic TC phi id");
854 h_topTC2PhiIdVsTC1PhiId[iskim]->GetYaxis()->SetTitle("Next to most energetic TC phi id");
855
856 h_topTCPhiIdVsTCThetaId[iskim] = new TH3I(Form("h_top_tcphiid_vs_tcthetaid_b2b_%s", skim_smap[iskim].c_str()),
857 "Sorted by energy TC2 vs TC1 theta vs phi ids", 20, 0, 20, 36, 1,
858 37, 2, 0, 2);
859 h_topTCPhiIdVsTCThetaId[iskim]->GetXaxis()->SetTitle("Most and next to most energetic TCs theta ids");
860 h_topTCPhiIdVsTCThetaId[iskim]->GetYaxis()->SetTitle("Most and next to most energetic TCs phi ids");
861 h_topTCPhiIdVsTCThetaId[iskim]->GetZaxis()->SetTitle("Most and next to most energetic TCs");
862
863 //-----
864
865 h_topTC2IdVsTC1IdGRL[iskim] = new TH2I(Form("h_top_tc2id_vs_tc1id_grl_b2b_%s", skim_smap[iskim].c_str()),
866 "Sorted (by energy) TC2 Id vs TC1 Id", 100, 0, 600, 100, 0, 600);
867 h_topTC2IdVsTC1IdGRL[iskim]->GetXaxis()->SetTitle("Most energetic TC id");
868 h_topTC2IdVsTC1IdGRL[iskim]->GetYaxis()->SetTitle("Next to most energetic TC id");
869
870 h_topTC2EnergyVsTC1EnergyGRL[iskim] = new TH2I(Form("h_top_tc2en_vs_tc1en_grl_b2b_%s", skim_smap[iskim].c_str()),
871 "Sorted TC2 energy vs TC1 energy", 100, 0, 1000, 100, 0, 1000);
872 h_topTC2EnergyVsTC1EnergyGRL[iskim]->GetXaxis()->SetTitle("Most energetic TC energy");
873 h_topTC2EnergyVsTC1EnergyGRL[iskim]->GetYaxis()->SetTitle("Next to most energetic TC energy");
874
875 h_topTC2ThetaIdVsTC1ThetaIdGRL[iskim] = new TH2I(Form("h_top_tc2thetaid_vs_tc1thetaid_grl_b2b_%s", skim_smap[iskim].c_str()),
876 "Sorted by energy TC2 vs TC1 theta ids", 20, 0, 20,
877 20, 0, 20);
878 h_topTC2ThetaIdVsTC1ThetaIdGRL[iskim]->GetXaxis()->SetTitle("Most energetic TC theta id");
879 h_topTC2ThetaIdVsTC1ThetaIdGRL[iskim]->GetYaxis()->SetTitle("Next to most energetic TC theta id");
880
881 h_topTC2PhiIdVsTC1PhiIdGRL[iskim] = new TH2I(Form("h_top_tc2phiid_vs_tc1phiid_grl_b2b_%s", skim_smap[iskim].c_str()),
882 "Sorted by energy TC2 vs TC1 phi ids", 36, 1, 37, 36, 1,
883 37);
884 h_topTC2PhiIdVsTC1PhiIdGRL[iskim]->GetXaxis()->SetTitle("Most energetic TC phi id");
885 h_topTC2PhiIdVsTC1PhiIdGRL[iskim]->GetYaxis()->SetTitle("Next to most energetic TC phi id");
886
887 h_topTCPhiIdVsTCThetaIdGRL[iskim] = new TH3I(Form("h_top_tcphiid_vs_tcthetaid_grl_b2b_%s", skim_smap[iskim].c_str()),
888 "Sorted by energy TC2 vs TC1 theta vs phi ids", 20, 0, 20,
889 36, 1, 37, 2, 0, 2);
890 h_topTCPhiIdVsTCThetaIdGRL[iskim]->GetXaxis()->SetTitle("Most and next to most energetic TCs theta ids");
891 h_topTCPhiIdVsTCThetaIdGRL[iskim]->GetYaxis()->SetTitle("Most and next to most energetic TCs phi ids");
892 h_topTCPhiIdVsTCThetaIdGRL[iskim]->GetZaxis()->SetTitle("Most and next to most energetic TCs");
893
894 //-------------------------------------------------------------------------------------------------------------------------------------------
895
896 h_gdl_ecltop_timing_diff_vs_grl_top_l1[iskim] = new TH2I(Form("h_gdl_ecltop_timing_diff_vs_grl_top_l1_%s",
897 skim_smap[iskim].c_str()),
898 "(GDL ECL)-(GDL TOP) vs GRL TOP rvc (relative to GDL L1)", 100, -2000, 0, 110, -760, 10240);
899 h_gdl_ecltop_timing_diff_vs_grl_top_l1[iskim]->GetXaxis()->SetTitle("GRL TOP rvc relative to GDL L1 (rvc)");
900 h_gdl_ecltop_timing_diff_vs_grl_top_l1[iskim]->GetYaxis()->SetTitle("(GDL ECL)-(GDL TOP) t0 difference (ns, 100ns bins)");
901
902 h_gdl_top_l1_vs_grl_top_l1[iskim] = new TH2I(Form("h_gdl_top_l1_vs_grl_top_l1_%s", skim_smap[iskim].c_str()),
903 "GDL TOP rvc vs GRL TOP rvc (relative to GDL L1)", 100, -2000,
904 0, 128, 0, 1280);
905 h_gdl_top_l1_vs_grl_top_l1[iskim]->GetXaxis()->SetTitle("GRL TOP rvc relative to GDL L1 (rvc)");
906 h_gdl_top_l1_vs_grl_top_l1[iskim]->GetYaxis()->SetTitle("GDL TOP rvc relative to GDL L1 (rvc)");
907
908 h_grl_ntopslots_vs_ncdcslots[iskim] = new TH2I(Form("h_grl_ntopslots_vs_ncdcslots_%s", skim_smap[iskim].c_str()),
909 "GRL TOP slots vs CDC slots", 10, 0, 10, 10, 0, 10);
910 h_grl_ntopslots_vs_ncdcslots[iskim]->GetXaxis()->SetTitle("GRL CDC slots");
911 h_grl_ntopslots_vs_ncdcslots[iskim]->GetYaxis()->SetTitle("GRL TOP slots");
912
913 h_grl_ncdctopslots_matched[iskim] = new TH1I(Form("h_grl_ncdctopslots_matched_%s", skim_smap[iskim].c_str()),
914 "GRL Number of matched TOP and CDC slots", 17, 0, 17);
915 h_grl_ncdctopslots_matched[iskim]->GetXaxis()->SetTitle("Number of matched TOP and CDC slots");
916
917 h_grl_topslots_vs_cdcslots_match[iskim] = new TH2I(Form("h_grl_topslots_vs_cdcslots_match_%s", skim_smap[iskim].c_str()),
918 "GRL TOP slots vs CDC slots matches", 17, 0, 17, 17,
919 0, 17);
920 h_grl_topslots_vs_cdcslots_match[iskim]->GetXaxis()->SetTitle("GRL CDC slot");
921 h_grl_topslots_vs_cdcslots_match[iskim]->GetYaxis()->SetTitle("GRL TOP slot");
922
923 }
924 //-------------------------------------------------------------------------------------------------------------------------------------------
925
926 oldDir->cd();
927
928}
929
931{
932
933 dirDQM->cd();
934
935 for (int iskim = start_skim_topdqm; iskim < end_skim_topdqm; iskim++) {
936
937 h_topSlotAll[iskim]->Reset();
938 h_topSegmentAll[iskim]->Reset();
939 h_topNHitsAll[iskim]->Reset();
940 h_topLogLAll[iskim]->Reset();
941 h_topT0All[iskim]->Reset();
942
943 for (int slot = 0; slot <= 15; slot++) {
944 h_topSlotSegment[iskim][slot]->Reset();
945 h_topSlotNHits[iskim][slot]->Reset();
946 h_topSlotLogL[iskim][slot]->Reset();
947 h_topSlotT0[iskim][slot]->Reset();
948 }
949
950 h_topSlotVsSegment[iskim]->Reset();
951
952 h_topSlotVsNHits[iskim]->Reset();
953 h_topSlotVsLogL[iskim]->Reset();
954 h_topSlotVsT0[iskim]->Reset();
955
956 h_topSegmentVsNHits[iskim]->Reset();
957 h_topSegmentVsLogL[iskim]->Reset();
958 h_topSegmentVsT0[iskim]->Reset();
959
960 h_topNHitsVsLogL[iskim]->Reset();
961 h_topNHitsVsT0[iskim]->Reset();
962 h_topLogLVsT0[iskim]->Reset();
963
964 h_ecl_gdl_top_timing_diff_both[iskim]->Reset();
965 h_ecl_top_top_timing_diff_both[iskim]->Reset();
966
967 if (m_histLevel > 2) {
968
969 h_gdl_top_rvc_vs_top_timing[iskim]->Reset();
970
971 h_gdl_ecltop_rvc_diff[iskim]->Reset();
972 h_gdl_cdctop_rvc_diff[iskim]->Reset();
973
974 h_gdl_gdltop_rvc_diff_all[iskim]->Reset();
975 h_gdl_comtop_rvc_diff_all[iskim]->Reset();
976
977 h_topRvcDiff1All[iskim]->Reset();
978 h_topRvcDiff2All[iskim]->Reset();
979 h_topRvcDiff3All[iskim]->Reset();
980 h_topRvcDiff4All[iskim]->Reset();
981
982 h_topGdlRvcDiff1All[iskim]->Reset();
983 h_topGdlRvcDiff2All[iskim]->Reset();
984 h_topGdlRvcDiff3All[iskim]->Reset();
985
986 h_decisionNumberVsNumberDecisionsGood[iskim]->Reset();
987
988 h_ecl_gdl_top_timing_diff_good[iskim]->Reset();
989 h_ecl_top_top_timing_diff_good[iskim]->Reset();
990
991 h_gdl_ecltop_timing_diff_vs_toptop_good[iskim]->Reset();
992 h_top_ecltop_timing_diff_vs_toptop_good[iskim]->Reset();
993 h_gdl_ecltop_timing_diff_vs_ecltop_good[iskim]->Reset();
994
995 h_gdl_gdltop_rvc_diff_good[iskim]->Reset();
996 h_gdl_comtop_rvc_diff_good[iskim]->Reset();
997
998 h_topCombinedTimingTopGood[iskim]->Reset();
999 h_topNSlotsCombinedTimingTopGood[iskim]->Reset();
1000 h_topNHitSumGood[iskim]->Reset();
1001 h_topLogLSumGood[iskim]->Reset();
1002
1003 h_topRvcDiff1Good[iskim]->Reset();
1004 h_topRvcDiff2Good[iskim]->Reset();
1005 h_topRvcDiff3Good[iskim]->Reset();
1006 h_topRvcDiff4Good[iskim]->Reset();
1007
1008 h_topGdlRvcDiff1Good[iskim]->Reset();
1009 h_topGdlRvcDiff2Good[iskim]->Reset();
1010 h_topGdlRvcDiff3Good[iskim]->Reset();
1011
1012 h_decisionNumberVsNumberDecisionsBad[iskim]->Reset();
1013
1014 h_ecl_gdl_top_timing_diff_bad[iskim]->Reset();
1015 h_ecl_top_top_timing_diff_bad[iskim]->Reset();
1016
1017 h_gdl_ecltop_timing_diff_vs_toptop_bad[iskim]->Reset();
1018 h_top_ecltop_timing_diff_vs_toptop_bad[iskim]->Reset();
1019 h_gdl_ecltop_timing_diff_vs_ecltop_bad[iskim]->Reset();
1020
1021 h_gdl_gdltop_rvc_diff_bad[iskim]->Reset();
1022 h_gdl_comtop_rvc_diff_bad[iskim]->Reset();
1023
1024 h_topCombinedTimingTopBad[iskim]->Reset();
1025 h_topNSlotsCombinedTimingTopBad[iskim]->Reset();
1026 h_topNHitSumBad[iskim]->Reset();
1027 h_topLogLSumBad[iskim]->Reset();
1028
1029 h_topRvcDiff1Bad[iskim]->Reset();
1030 h_topRvcDiff2Bad[iskim]->Reset();
1031 h_topRvcDiff3Bad[iskim]->Reset();
1032 h_topRvcDiff4Bad[iskim]->Reset();
1033
1034 h_topGdlRvcDiff1Bad[iskim]->Reset();
1035 h_topGdlRvcDiff2Bad[iskim]->Reset();
1036 h_topGdlRvcDiff3Bad[iskim]->Reset();
1037
1038 }
1039
1040 h_topCombinedTimingTopAll[iskim]->Reset();
1041 h_topNSlotsCombinedTimingTopAll[iskim]->Reset();
1042 h_topNHitSumAll[iskim]->Reset();
1043 h_topLogLSumAll[iskim]->Reset();
1044
1045 h_topNSlotsCombinedTimingVsNHitsTopAll[iskim]->Reset();
1046
1047 h_topTrigType[iskim]->Reset();
1048 h_topTimingResiduals[iskim]->Reset();
1049 h_topTimingVariance[iskim]->Reset();
1050
1051 h_top_nt0decisions_vs_hist_class[iskim]->Reset();
1052
1053 h_top_gdl_match_decision_number[iskim]->Reset();
1054
1055 h_gdl_ecltop_timing_diff_5ns[iskim]->Reset();
1056 h_gdl_cdctop_timing_diff_5ns[iskim]->Reset();
1057
1058 h_gdl_ecltop_timing_diff_2ns[iskim]->Reset();
1059 h_gdl_ecltop_timing_diff_grl_matched_2ns[iskim]->Reset();
1060 h_gdl_ecltop_timing_diff_no_grl_matched_2ns[iskim]->Reset();
1061 h_gdl_ecltop_timing_diff_no_grl_at_all_2ns[iskim]->Reset();
1062 h_gdl_ecltop_timing_diff_vs_nslots_2ns[iskim]->Reset();
1063 h_top_ecltop_timing_diff_combined_2ns[iskim]->Reset();
1064 h_top_ecltop_timing_diff_best_slot_2ns[iskim]->Reset();
1065 h_gdl_cdctop_timing_diff_2ns[iskim]->Reset();
1066
1067 for (int histClass = 0; histClass < m_nHistClassesActual; histClass++) {
1068 h_N_decision[iskim][histClass]->Reset();
1069
1070 h_topNHitVsNhit[iskim][histClass]->Reset();
1071 h_topSlotVsSlot[iskim][histClass]->Reset();
1072 h_topT0VsT0[iskim][histClass]->Reset();
1073 h_topSegmentVsSegment[iskim][histClass]->Reset();
1074 h_topLogLVsLogL[iskim][histClass]->Reset();
1075 }
1076
1077 if (m_histLevel > 1) {
1078 for (int histClass = 0; histClass < m_nHistClassesActual; histClass++) {
1079 h_topCombinedTimingTop[iskim][histClass]->Reset();
1080 h_topNSlotsCombinedTimingTop[iskim][histClass]->Reset();
1081 h_topNHitSum[iskim][histClass]->Reset();
1082 h_topNHitBestSlot[iskim][histClass]->Reset();
1083 // h_topT0DecisionNumberBestSlot[iskim][histClass]->Reset();
1084 h_topLogLSum[iskim][histClass]->Reset();
1085
1086 h_gdl_ecltop_timing_diff_vs_slot_2ns[iskim][histClass]->Reset();
1087 h_gdl_ecltop_timing_diff_vs_segment_2ns[iskim][histClass]->Reset();
1088 h_gdl_ecltop_timing_diff_vs_nhits_2ns[iskim][histClass]->Reset();
1089 h_gdl_ecltop_timing_diff_vs_logl_2ns[iskim][histClass]->Reset();
1090
1091 h_top_ecltop_timing_diff_2ns[iskim][histClass]->Reset();
1092 h_top_ecltop_timing_combined_diff_2ns[iskim][histClass]->Reset();
1093 h_top_ecltop_timing_best_slot_diff_2ns[iskim][histClass]->Reset();
1094
1095 h_gdl_ecltop_timing_diff_vs_toptop[iskim][histClass]->Reset();
1096 h_top_ecltop_timing_diff_vs_toptop[iskim][histClass]->Reset();
1097
1098 h_gdl_ecltop_timing_diff_vs_ecltop[iskim][histClass]->Reset();
1099 h_gdl_ecltop_timing_diff_vs_ecltop_best_slot[iskim][histClass]->Reset();
1100 }
1101 }
1102
1103 h_gdl_ecltop_timing_diff_vs_slot[iskim]->Reset();
1104 h_gdl_ecltop_timing_diff_vs_segment[iskim]->Reset();
1105 h_gdl_ecltop_timing_diff_vs_nhits[iskim]->Reset();
1106 h_gdl_ecltop_timing_diff_vs_logl[iskim]->Reset();
1107
1108 h_topTC2IdVsTC1IdAll[iskim]->Reset();
1109 h_topTC2EnergyVsTC1EnergyAll[iskim]->Reset();
1110 h_topTC2ThetaIdVsTC1ThetaIdAll[iskim]->Reset();
1111 h_topTC2PhiIdVsTC1PhiIdAll[iskim]->Reset();
1112 h_topTCPhiIdVsTCThetaIdAll[iskim]->Reset();
1113
1114 h_topTC2IdVsTC1IdGRLAll[iskim]->Reset();
1115 h_topTC2EnergyVsTC1EnergyGRLAll[iskim]->Reset();
1116 h_topTC2ThetaIdVsTC1ThetaIdGRLAll[iskim]->Reset();
1117 h_topTC2PhiIdVsTC1PhiIdGRLAll[iskim]->Reset();
1118 h_topTCPhiIdVsTCThetaIdGRLAll[iskim]->Reset();
1119
1120 h_topTC2IdVsTC1Id[iskim]->Reset();
1121 h_topTC2EnergyVsTC1Energy[iskim]->Reset();
1122 h_topTC2ThetaIdVsTC1ThetaId[iskim]->Reset();
1123 h_topTC2PhiIdVsTC1PhiId[iskim]->Reset();
1124 h_topTCPhiIdVsTCThetaId[iskim]->Reset();
1125
1126 h_topTC2IdVsTC1IdGRL[iskim]->Reset();
1127 h_topTC2EnergyVsTC1EnergyGRL[iskim]->Reset();
1128 h_topTC2ThetaIdVsTC1ThetaIdGRL[iskim]->Reset();
1129 h_topTC2PhiIdVsTC1PhiIdGRL[iskim]->Reset();
1130 h_topTCPhiIdVsTCThetaIdGRL[iskim]->Reset();
1131
1132 h_gdl_ecltop_timing_diff_vs_grl_top_l1[iskim]->Reset();
1133 h_gdl_top_l1_vs_grl_top_l1[iskim]->Reset();
1134
1135 h_grl_ntopslots_vs_ncdcslots[iskim]->Reset();
1136 h_grl_ncdctopslots_matched[iskim]->Reset();
1137 h_grl_topslots_vs_cdcslots_match[iskim]->Reset();
1138
1139 }
1140
1141 oldDir->cd();
1142}
1143
1145{
1146
1147 if (m_skim == 0) { //no skims
1148 start_skim_topdqm = 0;
1149 end_skim_topdqm = 1;
1150 } else if (m_skim == 1) { //skims
1151 start_skim_topdqm = 1;
1152 end_skim_topdqm = nskim_topdqm;
1153 } else { //no skims + skims
1154 start_skim_topdqm = 0;
1155 end_skim_topdqm = nskim_topdqm;
1156 }
1157
1159
1160 m_exp = -1;
1161 m_run = -1;
1162
1163 if (bevt) {
1164 m_exp = bevt->getExperiment();
1165 m_run = bevt->getRun();
1166 }
1167
1168 // cout << "TOP L1 DQM: begin run / exp = " << m_exp << endl;
1169 // cout << "TOP L1 DQM: begin run / run = " << m_run << endl;
1170
1171 // m_ECLCalDigitData.registerInDataStore();
1172 // m_ECLDigitData.registerInDataStore();
1173 // trgeclmap = new TrgEclMapping();
1174
1175 // calls back the defineHisto() function, but the HistoManager module has to be in the path
1176 REG_HISTOGRAM
1177
1178 if (m_doGDLCorrelations) {
1179
1180 for (int i = 0; i < 320; i++) {
1181 gdlLeafBitMap[i] = m_gdlUnpacker->getLeafMap(i);
1182 }
1183 for (int i = 0; i < 320; i++) {
1184 strcpy(gdlLeafNames[i], m_gdlUnpacker->getLeafnames(i));
1185 }
1186
1187 gdl_e_timtype = 0;
1188 gdl_e_gdll1rvc = 0;
1189 gdl_e_coml1rvc = 0;
1190 gdl_e_toptiming = 0;
1191 gdl_e_ecltiming = 0;
1192 gdl_e_cdctiming = 0;
1193 gdl_e_toprvc = 0;
1194 gdl_e_eclrvc = 0;
1195 gdl_e_cdcrvc = 0;
1196
1197 for (int i = 0; i < 320; i++) {
1198 if (strcmp(gdlLeafNames[i], "timtype") == 0) gdl_e_timtype = gdlLeafBitMap[i];
1199 if (strcmp(gdlLeafNames[i], "gdll1rvc") == 0) gdl_e_gdll1rvc = gdlLeafBitMap[i];
1200 if (strcmp(gdlLeafNames[i], "coml1rvc") == 0) gdl_e_coml1rvc = gdlLeafBitMap[i];
1201 if (strcmp(gdlLeafNames[i], "toptiming") == 0) gdl_e_toptiming = gdlLeafBitMap[i];
1202 if (strcmp(gdlLeafNames[i], "ecltiming") == 0) gdl_e_ecltiming = gdlLeafBitMap[i];
1203 if (strcmp(gdlLeafNames[i], "cdctiming") == 0) gdl_e_cdctiming = gdlLeafBitMap[i];
1204 if (strcmp(gdlLeafNames[i], "toprvc") == 0) gdl_e_toprvc = gdlLeafBitMap[i];
1205 if (strcmp(gdlLeafNames[i], "eclrvc") == 0) gdl_e_eclrvc = gdlLeafBitMap[i];
1206 if (strcmp(gdlLeafNames[i], "cdcrvc") == 0) gdl_e_cdcrvc = gdlLeafBitMap[i];
1207 }
1208 }
1209
1210 // trgeclHitArray.registerInDataStore();
1211
1212}
1213
1215{
1216 // implement saving a postscript file (for some histograms) here
1217 // use ROOT scripts as a template
1218}
1219
1221{
1222
1223 StoreArray<TRGTOPUnpackerStore> trgtopCombinedTimingArray("TRGTOPUnpackerStores");
1224
1225 if (!trgtopCombinedTimingArray) return;
1226 if (!trgtopCombinedTimingArray.getEntries()) return;
1227
1228 // prepare histograms according to HLT decisions
1229 skim.clear();
1230
1231 //Get skim type from SoftwareTriggerResult
1232 for (int iskim = start_skim_topdqm; iskim < end_skim_topdqm; iskim++) {
1233 if (iskim == 0) skim.push_back(iskim);
1234 }
1235
1237 if (result_soft.isValid()) {
1238 const std::map<std::string, int>& skim_map = result_soft->getResults();
1239 for (int iskim = start_skim_topdqm; iskim < end_skim_topdqm; iskim++) {
1240 if (iskim == 0);
1241 else if (skim_map.find(skim_menu[iskim]) != skim_map.end()) {
1242 const bool accepted = (result_soft->getResult(skim_menu[iskim]) == SoftwareTriggerCutResult::c_accept);
1243 if (accepted) skim.push_back(iskim);
1244 }
1245 }
1246 }
1247
1248 bool gdlInfoAvailable = false;
1249 bool grlInfoAvailable = false;
1250
1251 // investigate GRL-TOP correlations if asked to do so
1252
1253 int grlTOPL1 = -1;
1254
1255 bool grlCDCSlots[16];
1256 bool grlTOPSlots[16];
1257
1258 bool grlCDCTOPSlotsMatch[16];
1259
1260 if (m_doGRLCorrelations) {
1261
1262 StoreObjPtr<TRGGRLUnpackerStore> grlEventInfo("TRGGRLUnpackerStore");
1263
1264 // make sure first that GDL information could be retrieved
1265 if (grlEventInfo) {
1266
1267 grlInfoAvailable = true;
1268
1269 int grlTimeL1 = grlEventInfo->get_coml1() - grlEventInfo->get_revoclk();
1270
1271 grlTOPL1 = (grlEventInfo->get_TOPL1_count() + grlTimeL1 - 0.5) * (-clk127To1ns);
1272
1273 // Slot number -> phi (11.25 + i * 22.5)
1274 // 16 slots @ 22.5 deg = 360 deg
1275 for (int i = 0; i < 16; i++) {
1276 grlCDCSlots[i] = false;
1277 if (grlEventInfo->get_slot_CDC(i)) {
1278 grlCDCSlots[i] = true;
1279 }
1280 grlTOPSlots[i] = false;
1281 if (grlEventInfo->get_slot_TOP(i)) {
1282 grlTOPSlots[i] = true;
1283 }
1284 }
1285 }
1286 }
1287
1288 // investigate GRL-TOP
1289 int nCDCSlotsGRL = 0;
1290 int nTOPSlotsGRL = 0;
1291 int nCDCTOPSlotsMatchedGRL = 0;
1292
1293 if (grlInfoAvailable) {
1294 for (int i = 0; i < 16; i++) {
1295 if (grlCDCSlots[i]) nCDCSlotsGRL++;
1296 if (grlTOPSlots[i]) nTOPSlotsGRL++;
1297 grlCDCTOPSlotsMatch[i] = false;
1298 if (grlCDCSlots[i] && grlTOPSlots[i]) {
1299 nCDCTOPSlotsMatchedGRL++;
1300 grlCDCTOPSlotsMatch[i] = true;
1301 }
1302 }
1303 }
1304
1305 // StoreArray<TRGECLUnpackerStore> trgeclHitArray;
1306
1307 if (trgeclHitArray) {
1308
1309 if (m_doECLCorrelations) {
1310
1311 bool barrelEcl = false;
1312 bool barrelEclB2B = false;
1313
1314 tcEclList.clear();
1315
1316 // TrgEclMapping* trgEclMap = new TrgEclMapping();
1317 TrgEclMapping trgEclMap;
1318
1319 for (int ii = 0; ii < trgeclHitArray.getEntries(); ii++) {
1320
1321 TRGECLUnpackerStore* aTRGECLUnpackerStore = trgeclHitArray[ii];
1322 int TCID = (aTRGECLUnpackerStore->getTCId());
1323
1324 int hit_win = aTRGECLUnpackerStore -> getHitWin();
1325 double HitEnergy = aTRGECLUnpackerStore -> getTCEnergy();
1326 double HitTiming = aTRGECLUnpackerStore ->getTCTime();
1327
1328 if (TCID < 1 || TCID > 576 || HitEnergy == 0) {continue;}
1329 if (!(hit_win == 3 || hit_win == 4)) {continue;}
1330
1331 tcEcl tcEclThis;
1332 tcEclThis.tcId = TCID;
1333 tcEclThis.tcEnergy = HitEnergy;
1334 tcEclThis.tcTiming = HitTiming;
1335 tcEclThis.tcThetaId = trgEclMap.getTCThetaIdFromTCId(TCID);
1336 tcEclThis.tcPhiId = trgEclMap.getTCPhiIdFromTCId(TCID);
1337 tcEclList.push_back(tcEclThis);
1338 }
1339
1340 // sort TCs according to their energies
1341 sort(tcEclList.begin(), tcEclList.end(), largestEnergy());
1342
1343 // Barrel TCID map:
1344 // https://xwiki.desy.de/xwiki/bin/download/BI/Belle%20II%20Internal/Detector%20WebHome/Trigger%20WebHome/Sub-Trigger%20Systems/ECL%20Trigger/ECL%20Trigger%20Meeting/TRGECL%20Meeting/WebHome/170630yjkim.pdf?rev=1.1
1345 if (tcEclList.size() >= 2) {
1346 vector<tcEcl>::const_iterator it = tcEclList.begin();
1347 const tcEcl& tc1 = *it;
1348 ++it;
1349 const tcEcl& tc2 = *it;
1350 int tcId1 = tc1.tcId;
1351 int tcId2 = tc2.tcId;
1352
1353 int tcThetaId1 = tc1.tcThetaId;
1354 int tcPhiId1 = tc1.tcPhiId;
1355
1356 int tcThetaId2 = tc2.tcThetaId;
1357 int tcPhiId2 = tc2.tcPhiId;
1358
1359 // poor physicist's barrel b2b
1360 // if (tcId1 >= 81 && tcId1 <= 512) {
1361 // if (tcId2 >= 81 && tcId2 <= 512) {
1362 // if (abs(tcId2-tcId1-220) <= 50) {
1363
1364 if (tcThetaId1 >= 4 && tcThetaId1 <= 15) {
1365 barrelEcl = true;
1366 if (tcThetaId2 >= 4 && tcThetaId2 <= 15) {
1367 if (abs(tcPhiId1 - tcPhiId2) >= 12 && abs(tcPhiId1 - tcPhiId2) <= 24) {
1368 barrelEclB2B = true;
1369 }
1370 }
1371 }
1372
1373 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1374
1375 h_topTC2IdVsTC1IdAll[skim[ifill]]->Fill(tcId1, tcId2);
1376 h_topTC2EnergyVsTC1EnergyAll[skim[ifill]]->Fill(tc1.tcEnergy, tc2.tcEnergy);
1377 h_topTC2ThetaIdVsTC1ThetaIdAll[skim[ifill]]->Fill(tcThetaId1, tcThetaId2);
1378 h_topTC2PhiIdVsTC1PhiIdAll[skim[ifill]]->Fill(tcPhiId1, tcPhiId2);
1379 h_topTCPhiIdVsTCThetaIdAll[skim[ifill]]->Fill(tcThetaId1, tcPhiId1, 0);
1380 h_topTCPhiIdVsTCThetaIdAll[skim[ifill]]->Fill(tcThetaId2, tcPhiId2, 1);
1381
1382 if (nCDCSlotsGRL > 0) {
1383 h_topTC2IdVsTC1IdGRLAll[skim[ifill]]->Fill(tcId1, tcId2);
1384 h_topTC2EnergyVsTC1EnergyGRLAll[skim[ifill]]->Fill(tc1.tcEnergy, tc2.tcEnergy);
1385 h_topTC2ThetaIdVsTC1ThetaIdGRLAll[skim[ifill]]->Fill(tcThetaId1, tcThetaId2);
1386 h_topTC2PhiIdVsTC1PhiIdGRLAll[skim[ifill]]->Fill(tcPhiId1, tcPhiId2);
1387 h_topTCPhiIdVsTCThetaIdGRLAll[skim[ifill]]->Fill(tcThetaId1, tcPhiId1, 0);
1388 h_topTCPhiIdVsTCThetaIdGRLAll[skim[ifill]]->Fill(tcThetaId2, tcPhiId2, 1);
1389 }
1390
1391 if (barrelEclB2B) {
1392
1393 h_topTC2IdVsTC1Id[skim[ifill]]->Fill(tcId1, tcId2);
1394 h_topTC2EnergyVsTC1Energy[skim[ifill]]->Fill(tc1.tcEnergy, tc2.tcEnergy);
1395 h_topTC2ThetaIdVsTC1ThetaId[skim[ifill]]->Fill(tcThetaId1, tcThetaId2);
1396 h_topTC2PhiIdVsTC1PhiId[skim[ifill]]->Fill(tcPhiId1, tcPhiId2);
1397 h_topTCPhiIdVsTCThetaId[skim[ifill]]->Fill(tcThetaId1, tcPhiId1, 0);
1398 h_topTCPhiIdVsTCThetaId[skim[ifill]]->Fill(tcThetaId2, tcPhiId2, 1);
1399 if (nCDCSlotsGRL > 0) {
1400 h_topTC2IdVsTC1IdGRL[skim[ifill]]->Fill(tcId1, tcId2);
1401 h_topTC2EnergyVsTC1EnergyGRL[skim[ifill]]->Fill(tc1.tcEnergy, tc2.tcEnergy);
1402 h_topTC2ThetaIdVsTC1ThetaIdGRL[skim[ifill]]->Fill(tcThetaId1, tcThetaId2);
1403 h_topTC2PhiIdVsTC1PhiIdGRL[skim[ifill]]->Fill(tcPhiId1, tcPhiId2);
1404 h_topTCPhiIdVsTCThetaIdGRL[skim[ifill]]->Fill(tcThetaId1, tcPhiId1, 0);
1405 h_topTCPhiIdVsTCThetaIdGRL[skim[ifill]]->Fill(tcThetaId2, tcPhiId2, 1);
1406 }
1407 }
1408 }
1409 }
1410
1411 if (m_requireEclBarrel) {
1412 if (!barrelEcl) return;
1413 }
1414 if (m_requireEclBarrelB2B) {
1415 if (!barrelEclB2B) return;
1416 }
1417 }
1418
1419 }
1420
1421 if (m_doGRLCorrelations && grlInfoAvailable) {
1422 if (m_requireCDC2DTrack) {
1423 if (nCDCSlotsGRL <= 0) return;
1424 }
1425 }
1426
1427 if (grlInfoAvailable) {
1428
1429 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1430
1431 h_grl_ntopslots_vs_ncdcslots[skim[ifill]]->Fill(nCDCSlotsGRL, nTOPSlotsGRL);
1432
1433 h_grl_ncdctopslots_matched[skim[ifill]]->Fill(nCDCTOPSlotsMatchedGRL);
1434
1435 for (int i = 0; i < 16; i++) {
1436 if (grlCDCTOPSlotsMatch[i]) {
1437 h_grl_topslots_vs_cdcslots_match[skim[ifill]]->Fill(i + 1, i + 1);
1438 } else if (grlCDCSlots[i]) {
1439 h_grl_topslots_vs_cdcslots_match[skim[ifill]]->Fill(i + 1, 0.);
1440 } else if (grlTOPSlots[i]) {
1441 h_grl_topslots_vs_cdcslots_match[skim[ifill]]->Fill(0., i + 1);
1442 }
1443 }
1444 }
1445 }
1446
1447 // normally this should not be happening
1448 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1449 if (nCDCSlotsGRL == 0 && nTOPSlotsGRL == 0) h_grl_topslots_vs_cdcslots_match[skim[ifill]]->Fill(0., 0.);
1450 }
1451
1452 /*
1453 cout << "DEBUG---------------------------------------------------------------------------------------------------------------------" << endl;
1454 int j=0;
1455 for ( vector<tcEcl>::const_iterator it = tcEclList.begin(); it != tcEclList.end(); ++it) {
1456 j++;
1457 const tcEcl& tc = *it;
1458 cout << "DEBUG index, tcId, tcEnergy, tcTiming = " << j << ", " << tc.tcId << ", " << tc.tcEnergy << ", " << tc.tcTiming << endl;
1459 }
1460 cout << "DEBUG---------------------------------------------------------------------------------------------------------------------" << endl;
1461 */
1462
1463 // investigate GDL-TOP correlations if asked to do so
1464
1465 // There are 5 values of revolution counter which could be obtained from GDL L1 data packet
1466 // Most important (from TOP L1 perspective) are gdll1rvc and toprvc
1467 int gdl_gdll1rvc = -1;
1468 int gdl_coml1rvc = -1;
1469 int gdl_toprvc = -1;
1470 int gdl_eclrvc = -1;
1471 int gdl_cdcrvc = -1;
1472
1473 int gdl_top_timing = -1;
1474 int gdl_ecl_timing = -1;
1475 int gdl_cdc_timing = -1;
1476
1477 // obtain various important information about GDL decision from the database
1478 if (m_doGDLCorrelations) {
1479
1480 // make sure first that GDL information could be retrieved
1481 if (m_gdlUnpacker) {
1482
1483 /*
1484 int N_track = evtinfo->getEventIdL1();
1485 int bin = h_N_track->GetBinContent(N_track + 1);
1486 h_N_track->SetBinContent(N_track + 1, bin + 1);
1487 */
1488
1489 int n_leafs = m_gdlUnpacker->getnLeafs();
1490 int n_leafsExtra = m_gdlUnpacker->getnLeafsExtra();
1491 int n_clocks = m_gdlUnpacker->getnClks();
1492 // int nconf = m_gdlUnpacker->getconf();
1493
1494 // int nword_input = m_gdlUnpacker->get_nword_input();
1495 // int nword_output = m_gdlUnpacker->get_nword_output();
1496
1498 if (entAry && entAry.getEntries()) {
1499
1500 m_evtno = 0;
1501
1502 //prepare entAry address
1503 int clk_map = 0;
1504 for (int i = 0; i < 320; i++) {
1505 if (strcmp(entAry[0]->m_unpackername[i], "evt") == 0) m_evtno = entAry[0]->m_unpacker[i];
1506 if (strcmp(entAry[0]->m_unpackername[i], "clk") == 0) clk_map = i;
1507 }
1508
1509 // cout << "TOP L1 DQM GDL event number = " << m_evtno << endl;
1510
1511 std::vector<std::vector<int> > _data(n_leafs + n_leafsExtra);
1512 for (int leaf = 0; leaf < n_leafs + n_leafsExtra; leaf++) {
1513 std::vector<int> _v(n_clocks);
1514 _data[leaf] = _v;
1515 }
1516
1517 // fill "bit vs clk" for the event
1518 for (int ii = 0; ii < entAry.getEntries(); ii++) {
1519 std::vector<int*> Bits(n_leafs + n_leafsExtra);
1520 //set pointer
1521 for (int i = 0; i < 320; i++) {
1522 if (gdlLeafBitMap[i] != -1) {
1523 Bits[gdlLeafBitMap[i]] = &(entAry[ii]->m_unpacker[i]);
1524 }
1525 }
1526 for (int leaf = 0; leaf < n_leafs + n_leafsExtra; leaf++) {
1527 _data[leaf][entAry[ii]->m_unpacker[clk_map]] = *Bits[leaf];
1528 }
1529
1530 }
1531
1532 gdl_gdll1rvc = _data[gdl_e_gdll1rvc][n_clocks - 1];
1533 gdl_coml1rvc = _data[gdl_e_coml1rvc][n_clocks - 1];
1534 gdl_toprvc = _data[gdl_e_toprvc][n_clocks - 1];
1535 gdl_eclrvc = _data[gdl_e_eclrvc][n_clocks - 1];
1536 gdl_cdcrvc = _data[gdl_e_cdcrvc][n_clocks - 1];
1537 gdl_top_timing = _data[gdl_e_toptiming][n_clocks - 1];
1538 gdl_ecl_timing = _data[gdl_e_ecltiming][n_clocks - 1];
1539 gdl_cdc_timing = _data[gdl_e_cdctiming][n_clocks - 1];
1540
1541 gdlInfoAvailable = true;
1542
1543 /*
1544 if (begin_run) {
1545 B2DEBUG(20, "nconf(" << nconf
1546 << "), n_clocks(" << n_clocks
1547 << "), n_leafs(" << n_leafs
1548 << "), n_leafsExtra(" << n_leafsExtra
1549 << ")");
1550 begin_run = false;
1551 }
1552 */
1553
1554 /*
1555 cout << " " << endl;
1556 cout << "TOP L1 DQM gdl L1 rvc = " << gdl_gdll1rvc << endl;
1557 cout << "TOP L1 DQM com L1 rvc = " << gdl_coml1rvc << endl;
1558 cout << "TOP L1 DQM top L1 rvc = " << gdl_toprvc << endl;
1559 cout << "TOP L1 DQM ecl L1 rvc = " << gdl_eclrvc << endl;
1560 cout << "TOP L1 DQM cdc L1 rvc = " << gdl_cdcrvc << endl;
1561 */
1562
1563 }
1564 }
1565 }
1566
1567 //
1568 //--------------------------------------------- actual histogramming starts here ----------------------------------------------------
1569 //
1570 // Very generally, many (but not all) TOP L1 DQM histograms could be separated into three mutually exclusive classes according to
1571 // the agreement between TOP information in GDL data packet and TOP information in TOP L1 data packet (i.e. circular buffer (CB)):
1572 //
1573 // 1) class 0: TOP information at GDL and at TOP (in the FIRST decision stored in TOP L1 CB) is the same
1574 // 2) class 1: There are NO TOP combined decision in TOP L1 CB that agree with TOP information at GDL
1575 // 3) class 2: TOP information at GDL and at TOP is different for all but one combined decision (but not first),
1576 // there could be more than one such combined t0 decision in TOP L1 CB
1577 //
1578 // When GDL information is unavailable (is NEVER supposed to happen!), all events are labeled as class 1 (just to be safe)
1579 //
1580 // Histograms for different types of events (according to software trigger) are prepared for each of the three classes.
1581 // In addition to these histograms there are also a number of other histograms which are prepared for all combined decisions in TOP L1 CB
1582 // or/and for GDL TOP information (and for TOP-ECL, TOP-GRL and TOP-GDL correlations).
1583 //
1584
1585 // info from GDL
1586
1587 int ecl_top_timing_diff = -1;
1588 int cdc_top_timing_diff = -1;
1589
1590 int gdl_top_rvc_diff = -1;
1591 int com_top_rvc_diff = -1;
1592 int ecl_top_rvc_diff = -1;
1593 int cdc_top_rvc_diff = -1;
1594
1595 if (gdlInfoAvailable) {
1596
1597 ecl_top_timing_diff = gdl_ecl_timing >= gdl_top_timing ? gdl_ecl_timing - gdl_top_timing : gdl_ecl_timing - gdl_top_timing +
1598 10240;
1599 cdc_top_timing_diff = gdl_cdc_timing >= gdl_top_timing ? gdl_cdc_timing - gdl_top_timing : gdl_cdc_timing - gdl_top_timing +
1600 10240;
1601
1602 gdl_top_rvc_diff = gdl_gdll1rvc >= gdl_toprvc ? gdl_gdll1rvc - gdl_toprvc : gdl_gdll1rvc - gdl_toprvc + 1280;
1603 com_top_rvc_diff = gdl_coml1rvc >= gdl_toprvc ? gdl_coml1rvc - gdl_toprvc : gdl_coml1rvc - gdl_toprvc + 1280;
1604 ecl_top_rvc_diff = gdl_eclrvc >= gdl_toprvc ? gdl_eclrvc - gdl_toprvc : gdl_eclrvc - gdl_toprvc + 1280;
1605 cdc_top_rvc_diff = gdl_cdcrvc >= gdl_toprvc ? gdl_cdcrvc - gdl_toprvc : gdl_cdcrvc - gdl_toprvc + 1280;
1606
1607 }
1608
1609 int histClass = 1;
1610
1611 // retrieve TOP L1 information
1612
1613 int nT0Decisions = trgtopCombinedTimingArray.getEntries();
1614
1615 int t0DecisionNumber = 0;
1616
1617 if (gdlInfoAvailable) {
1618
1619 int nInTime = 0;
1620
1621 for (const auto& t0Decision : trgtopCombinedTimingArray) {
1622 int topCombinedTimingTop = t0Decision.getCombinedTimingTop();
1623 int top_top_timing = (topCombinedTimingTop % 10240);
1624
1625 if (gdl_top_timing == top_top_timing) {
1626 nInTime++;
1627 if (t0DecisionNumber == 0) {
1628 histClass = 0;
1629 } else if (histClass != 0) {
1630 histClass = 2;
1631 }
1632 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1633 h_top_gdl_match_decision_number[skim[ifill]]->Fill(t0DecisionNumber + 1);
1634 }
1635 }
1636 t0DecisionNumber++;
1637 }
1638
1639 // classification of events according to the three classes described previously
1640 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1641 h_top_nt0decisions_vs_hist_class[skim[ifill]]->Fill(histClass, nT0Decisions);
1642 }
1643
1644 // ALL TOP t0 decisions made within the last us before GDL L1 decision are out of time with GDL L1!
1645 if (nInTime == 0) {
1646 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1647 h_top_gdl_match_decision_number[skim[ifill]]->Fill(0);
1648 }
1649 }
1650 }
1651
1652 // in such case we do NOT distinguish among the three classes
1653 if (m_nHistClassesActual == 1) histClass = 0;
1654
1655 // when histClass==2 is not requested, combined it with histClass==1
1656 if (m_nHistClassesActual == 2 && histClass == 2) histClass = 1;
1657
1658 // prepare histograms for TOP alone
1659 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1660 h_N_decision[skim[ifill]][histClass]->Fill(nT0Decisions);
1661 }
1662
1663 // info from GDL
1664
1665 if (gdlInfoAvailable) {
1666
1667 // const double clkTo1ns = 0.5 / .508877;
1668 // Feb. 23, 2020 ecltopdiff = (int) ( (double) ecltopdiff * clkTo1ns);
1669
1670 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1671
1672 if (m_histLevel > 2) {
1673
1674 int gdl_top_timing_1280 = gdl_top_timing >> 3;
1675 h_gdl_top_rvc_vs_top_timing[skim[ifill]]->Fill(gdl_top_timing_1280, gdl_toprvc);
1676
1677 h_gdl_ecltop_rvc_diff[skim[ifill]]->Fill(ecl_top_rvc_diff);
1678 h_gdl_cdctop_rvc_diff[skim[ifill]]->Fill(cdc_top_rvc_diff);
1679
1680 h_gdl_gdltop_rvc_diff_all[skim[ifill]]->Fill(gdl_top_rvc_diff);
1681 h_gdl_comtop_rvc_diff_all[skim[ifill]]->Fill(com_top_rvc_diff);
1682 }
1683
1684 if (grlInfoAvailable) {
1685 h_gdl_ecltop_timing_diff_vs_grl_top_l1[skim[ifill]]->Fill(grlTOPL1, ecl_top_timing_diff);
1686 }
1687
1688 h_gdl_ecltop_timing_diff_5ns[skim[ifill]]->Fill(ecl_top_timing_diff);
1689 h_gdl_cdctop_timing_diff_5ns[skim[ifill]]->Fill(cdc_top_timing_diff);
1690
1691 h_gdl_ecltop_timing_diff_2ns[skim[ifill]]->Fill(ecl_top_timing_diff);
1692
1693 if (nCDCTOPSlotsMatchedGRL > 0) {
1694 h_gdl_ecltop_timing_diff_grl_matched_2ns[skim[ifill]]->Fill(ecl_top_timing_diff);
1695 } else if (nCDCSlotsGRL > 0) {
1696 h_gdl_ecltop_timing_diff_no_grl_matched_2ns[skim[ifill]]->Fill(ecl_top_timing_diff);
1697 } else {
1698 h_gdl_ecltop_timing_diff_no_grl_at_all_2ns[skim[ifill]]->Fill(ecl_top_timing_diff);
1699 }
1700 h_gdl_cdctop_timing_diff_2ns[skim[ifill]]->Fill(cdc_top_timing_diff);
1701
1702 }
1703 }
1704
1705 // note that now we are going to inspect all decisions in 1us TOP CB, however, most of the time we will be interested in the first decision only
1706
1707 t0DecisionNumber = 0;
1708
1709 for (const auto& t0Decision : trgtopCombinedTimingArray) {
1710
1711 bool top_timing_same = false;
1712 if (gdlInfoAvailable) {
1713 int topCombinedTimingTop = t0Decision.getCombinedTimingTop();
1714 int top_top_timing = (topCombinedTimingTop % 10240);
1715 if (top_top_timing == gdl_top_timing) {
1716 top_timing_same = true;
1717 }
1718 }
1719
1720 // not possible const vector<Belle2::TRGTOPSlotTiming> t0DecisionSlots = t0Decision.getSlotTimingDecisions();
1721 const vector<Belle2::TRGTOPSlotTiming> t0DecisionSlots = trgtopCombinedTimingArray[t0DecisionNumber]->getSlotTimingDecisions();
1722
1723 slotDecisionList.clear();
1724
1725 if (t0DecisionNumber == 0) {
1726
1727 for (const auto& t0DecisionSlot : t0DecisionSlots) {
1728
1729 int slot = t0DecisionSlot.getSlotId();
1730 int segment = t0DecisionSlot.getSlotSegment();
1731 int nHits = t0DecisionSlot.getSlotNHits();
1732 int logL = t0DecisionSlot.getSlotLogL();
1733 int t0 = t0DecisionSlot.getSlotTiming();
1734
1735 // Note that slotDecisionList is prepared for all TOP combined t0 decisions
1736 slotDecision slotDecisionThis;
1737 slotDecisionThis.slot = slot;
1738 slotDecisionThis.segment = segment;
1739 slotDecisionThis.nHits = nHits;
1740 slotDecisionThis.logL = logL;
1741 slotDecisionThis.t0 = t0;
1742 slotDecisionList.push_back(slotDecisionThis);
1743
1744 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1745
1746 h_topSlotAll[skim[ifill]]->Fill(slot);
1747 h_topSegmentAll[skim[ifill]]->Fill(segment);
1748 h_topNHitsAll[skim[ifill]]->Fill(nHits);
1749 h_topLogLAll[skim[ifill]]->Fill(logL);
1750 h_topT0All[skim[ifill]]->Fill(t0);
1751
1752 // note that the histograms in this section are for ALL combined decisions from 1us circular buffer
1753 if (gdlInfoAvailable) {
1754 int top_top_timing_slot = (t0 % 10240);
1755 int top_gdl_timing_diff_slot = gdl_ecl_timing >= top_top_timing_slot ? gdl_ecl_timing - top_top_timing_slot : gdl_ecl_timing -
1756 top_top_timing_slot + 10240;
1757
1758 h_gdl_ecltop_timing_diff_vs_slot[skim[ifill]]->Fill(top_gdl_timing_diff_slot, slot);
1759 h_gdl_ecltop_timing_diff_vs_segment[skim[ifill]]->Fill(top_gdl_timing_diff_slot, segment);
1760 h_gdl_ecltop_timing_diff_vs_nhits[skim[ifill]]->Fill(top_gdl_timing_diff_slot, nHits);
1761 h_gdl_ecltop_timing_diff_vs_logl[skim[ifill]]->Fill(top_gdl_timing_diff_slot, logL);
1762
1763 if (m_histLevel > 1) {
1764 h_gdl_ecltop_timing_diff_vs_slot_2ns[skim[ifill]][histClass]->Fill(top_gdl_timing_diff_slot, slot);
1765 h_gdl_ecltop_timing_diff_vs_segment_2ns[skim[ifill]][histClass]->Fill(top_gdl_timing_diff_slot, segment);
1766 h_gdl_ecltop_timing_diff_vs_nhits_2ns[skim[ifill]][histClass]->Fill(top_gdl_timing_diff_slot, nHits);
1767 h_gdl_ecltop_timing_diff_vs_logl_2ns[skim[ifill]][histClass]->Fill(top_gdl_timing_diff_slot, logL);
1768 }
1769 }
1770
1771 if (slot >= 1 && slot <= 16) {
1772 if (segment >= 1 && segment <= 10) {
1773 h_topSlotSegment[skim[ifill]][slot - 1]->Fill(segment);
1774 h_topSlotNHits[skim[ifill]][slot - 1]->Fill(nHits);
1775 h_topSlotLogL[skim[ifill]][slot - 1]->Fill(logL);
1776 h_topSlotT0[skim[ifill]][slot - 1]->Fill(t0);
1777
1778 h_topSlotVsSegment[skim[ifill]]->Fill(segment, slot);
1779
1780 h_topSlotVsNHits[skim[ifill]]->Fill(nHits, slot);
1781 h_topSlotVsLogL[skim[ifill]]->Fill(logL, slot);
1782 h_topSlotVsT0[skim[ifill]]->Fill(t0, slot);
1783
1784 h_topSegmentVsNHits[skim[ifill]]->Fill(nHits, segment);
1785 h_topSegmentVsLogL[skim[ifill]]->Fill(logL, segment);
1786 h_topSegmentVsT0[skim[ifill]]->Fill(t0, segment);
1787
1788 h_topNHitsVsLogL[skim[ifill]]->Fill(logL, nHits);
1789 h_topNHitsVsT0[skim[ifill]]->Fill(t0, nHits);
1790 h_topLogLVsT0[skim[ifill]]->Fill(t0, logL);
1791
1792 }
1793 }
1794 }
1795 }
1796 }
1797
1798 //
1799 // This is the complete information from the slot with the largest N hits
1800 // associated with the TOP combined t0 decision within 1us before GDL L1
1801 // where TOP timing in TOP data packet is the same as TOP timing in GDL data packet
1802 //
1803
1804 int nHitsSlotBest = 0;
1805 int t0SlotBest = -1;
1806
1807 // slotDecisionList should always be available
1808 if (slotDecisionList.size() > 0) {
1809
1810 int slotSlotBest = 0;
1811 int segmentSlotBest = 0;
1812 int logLSlotBest = 0;
1813
1814 // sort slots according to their nHits
1815 sort(slotDecisionList.begin(), slotDecisionList.end(), largestNHits());
1816
1817 vector<slotDecision>::const_iterator it = slotDecisionList.begin();
1818 const slotDecision& slotDecisionBest = *it;
1819
1820 slotSlotBest = slotDecisionBest.slot;
1821 segmentSlotBest = slotDecisionBest.segment;
1822 logLSlotBest = slotDecisionBest.logL;
1823 nHitsSlotBest = slotDecisionBest.nHits;
1824 t0SlotBest = slotDecisionBest.t0;
1825
1826 if (slotDecisionList.size() > 1) {
1827 ++it;
1828 const slotDecision& slotDecisionBest2 = *it;
1829
1830 int slotSlotBest2 = slotDecisionBest2.slot;
1831 int segmentSlotBest2 = slotDecisionBest2.segment;
1832 int logLSlotBest2 = slotDecisionBest2.logL;
1833 int nHitsSlotBest2 = slotDecisionBest2.nHits;
1834 int t0SlotBest2 = slotDecisionBest2.t0;
1835
1836 if (t0DecisionNumber == 0) {
1837 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1838 h_topNHitVsNhit[skim[ifill]][histClass]->Fill(nHitsSlotBest, nHitsSlotBest2);
1839 h_topSlotVsSlot[skim[ifill]][histClass]->Fill(slotSlotBest, slotSlotBest2);
1840 h_topT0VsT0[skim[ifill]][histClass]->Fill(t0SlotBest, t0SlotBest2);
1841 h_topSegmentVsSegment[skim[ifill]][histClass]->Fill(segmentSlotBest, segmentSlotBest2);
1842 h_topLogLVsLogL[skim[ifill]][histClass]->Fill(logLSlotBest, logLSlotBest2);
1843 }
1844 }
1845 }
1846 }
1847
1848
1849 // if (slotDecisionList.size() > 1) {
1850 //
1851 // cout << "DEBUG: more than one slot: " << slotDecisionList.size() <<endl;
1852 // cout << "DEBUG: nHitsSlotBest: " << nHitsSlotBest << endl;
1853 //
1854 // for ( vector<slotDecision>::const_iterator it = slotDecisionList.begin(); it != slotDecisionList.end(); ++it) {
1855 // const slotDecision& slotDecisionThis = *it;
1856 // cout << "DEBUG slotDecisionThis nHits = " << slotDecisionThis.nHits << endl;
1857 // }
1858 //
1859 // }
1860
1861 // int topEventIdL1 = t0Decision.getEventIdL1();
1862 // int topEventIdTOP = t0Decision.getEventIdTOP();
1863 // int topWindowIdTOP = t0Decision.getWindowIdTOP();
1864
1865 // There are 5 values of revolution counter available for each TOP L1 combined t0 decision
1866 // timestamp when received L1 from GDL
1867 int topRvcL1 = t0Decision.getRvcB2L();
1868 // timestamp of the circular buffer window containing given combined t0 decision (this is the "NOW" time)
1869 int topRvcWindow = t0Decision.getRvcWindow();
1870 // timestamp of PREVIOUS combined t0 decision
1871 int topRvcTopTimingDecisionPrev = t0Decision.getRvcTopTimingDecisionPrev();
1872 // timestamp of the current combined t0 decision (i.e. decision in the current window)
1873 int topRvcTopTimingDecisionNow = t0Decision.getRvcTopTimingDecisionNow();
1874 // timestamp of when the current combined t0 decision was posted to GDL
1875 int topRvcTopTimingDecisionNowGdl = t0Decision.getRvcTopTimingDecisionNowGdl();
1876
1877 // int trigType = t0Decision.getTrigType();
1878 // cout << "DEBUG trigType = " << trigType << endl;
1879
1880 int topCombinedTimingTop = t0Decision.getCombinedTimingTop();
1881
1882 int topNSlotsCombinedTimingTop = t0Decision.getNSlotsCombinedTimingTop();
1883 int topCombinedTimingTopResidual = t0Decision.getCombinedTimingTopResidual();
1884 // int topNErrorsMinor = t0Decision.getNErrorsMinor();
1885 // int topNErrorsMajor = t0Decision.getNErrorsMajor();
1886 int topTrigType = t0Decision.getTrigType();
1887 int topNHitSum = t0Decision.getNHitSum();
1888 int topLogLSum = t0Decision.getLogLSum();
1889 // int topLogLVar = t0Decision.getLogLVar();
1890 int topTimingVar = t0Decision.getTimingVar();
1891
1892 float hitsPerSlot = topNHitSum / max(1, topNSlotsCombinedTimingTop);
1893 float logLPerSlot = topLogLSum / max(1, topNSlotsCombinedTimingTop);
1894
1895 int topRvcDiff1 = topRvcTopTimingDecisionNowGdl - topRvcTopTimingDecisionNow;
1896 int topRvcDiff2 = topRvcTopTimingDecisionNow >= topRvcTopTimingDecisionPrev ? topRvcTopTimingDecisionNow -
1897 topRvcTopTimingDecisionPrev : topRvcTopTimingDecisionNow - topRvcTopTimingDecisionPrev + 1280;
1898 int topRvcDiff3 = topRvcWindow >= topRvcTopTimingDecisionNow ? topRvcWindow - topRvcTopTimingDecisionNow : topRvcWindow -
1899 topRvcTopTimingDecisionNow + 1280;
1900 int topRvcDiff4 = topRvcL1 >= topRvcTopTimingDecisionNow ? topRvcL1 - topRvcTopTimingDecisionNow : topRvcL1 -
1901 topRvcTopTimingDecisionNow + 1280;
1902
1903 if (t0DecisionNumber == 0) {
1904
1905 if (grlInfoAvailable) {
1906 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1907 h_gdl_top_l1_vs_grl_top_l1[skim[ifill]]->Fill(grlTOPL1, topRvcDiff4);
1908 }
1909 }
1910
1911 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1912
1913 h_topCombinedTimingTopAll[skim[ifill]]->Fill(topCombinedTimingTop);
1914 h_topNSlotsCombinedTimingTopAll[skim[ifill]]->Fill(topNSlotsCombinedTimingTop);
1915 h_topNHitSumAll[skim[ifill]]->Fill((int) hitsPerSlot);
1916 h_topLogLSumAll[skim[ifill]]->Fill((int) logLPerSlot);
1917
1918 h_topNSlotsCombinedTimingVsNHitsTopAll[skim[ifill]]->Fill(topNHitSum, topNSlotsCombinedTimingTop);
1919
1920 h_topTrigType[skim[ifill]]->Fill(topTrigType);
1921 h_topTimingResiduals[skim[ifill]]->Fill(topCombinedTimingTopResidual);
1922 h_topTimingVariance[skim[ifill]]->Fill(topTimingVar);
1923
1924 if (m_histLevel > 2) {
1925 h_topRvcDiff1All[skim[ifill]]->Fill(topRvcDiff1);
1926 h_topRvcDiff2All[skim[ifill]]->Fill(topRvcDiff2);
1927 h_topRvcDiff3All[skim[ifill]]->Fill(topRvcDiff3);
1928 h_topRvcDiff4All[skim[ifill]]->Fill(topRvcDiff4);
1929 }
1930 }
1931 }
1932
1933 int topGdlRvcDiff1 = gdl_gdll1rvc >= topRvcL1 ? gdl_gdll1rvc - topRvcL1 : gdl_gdll1rvc - topRvcL1 + 1280;
1934 int topGdlRvcDiff2 = gdl_toprvc >= topRvcTopTimingDecisionNow ? gdl_toprvc - topRvcTopTimingDecisionNow : gdl_toprvc -
1935 topRvcTopTimingDecisionNow + 1280;
1936 int topGdlRvcDiff3 = gdl_toprvc >= topRvcTopTimingDecisionPrev ? gdl_toprvc - topRvcTopTimingDecisionPrev : gdl_toprvc -
1937 topRvcTopTimingDecisionPrev + 1280;
1938
1939 int ecl_gdl_top_timing_combined_diff = -1;
1940
1941 int top_top_timing_combined_diff = -1;
1942
1943 int ecl_top_top_timing_combined_diff = -1;
1944 int ecl_top_top_timing_best_slot_diff = -1;
1945
1946 if (gdlInfoAvailable) {
1947
1948 int top_top_timing_combined = -1;
1949 int top_top_timing_best_slot = -1;
1950
1951 ecl_gdl_top_timing_combined_diff = gdl_ecl_timing >= gdl_top_timing ? gdl_ecl_timing - gdl_top_timing : gdl_ecl_timing -
1952 gdl_top_timing + 10240;
1953
1954 top_top_timing_combined = (topCombinedTimingTop % 10240);
1955 top_top_timing_best_slot = (t0SlotBest % 10240);
1956
1957 top_top_timing_combined_diff = top_top_timing_combined >= gdl_top_timing ? top_top_timing_combined - gdl_top_timing :
1958 top_top_timing_combined - gdl_top_timing + 10240;
1959
1960 ecl_top_top_timing_combined_diff = gdl_ecl_timing >= top_top_timing_combined ? gdl_ecl_timing - top_top_timing_combined :
1961 gdl_ecl_timing - top_top_timing_combined + 10240;
1962 ecl_top_top_timing_best_slot_diff = gdl_ecl_timing >= top_top_timing_best_slot ? gdl_ecl_timing - top_top_timing_best_slot :
1963 gdl_ecl_timing - top_top_timing_best_slot + 10240;
1964
1965 if (t0DecisionNumber == 0) {
1966 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1967 if (m_histLevel > 2) {
1968 h_topGdlRvcDiff1All[skim[ifill]]->Fill(topGdlRvcDiff1);
1969 h_topGdlRvcDiff2All[skim[ifill]]->Fill(topGdlRvcDiff2);
1970 h_topGdlRvcDiff3All[skim[ifill]]->Fill(topGdlRvcDiff3);
1971 }
1972
1973 h_ecl_gdl_top_timing_diff_both[skim[ifill]]->Fill(ecl_gdl_top_timing_combined_diff);
1974 h_ecl_top_top_timing_diff_both[skim[ifill]]->Fill(ecl_top_top_timing_combined_diff);
1975 }
1976 }
1977
1978 if (m_histLevel > 2) {
1979
1980 // something odd is going on...
1981 if (top_top_timing_combined_diff == 0) {
1982
1983 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
1984
1985 h_decisionNumberVsNumberDecisionsGood[skim[ifill]]->Fill(nT0Decisions, t0DecisionNumber + 1);
1986
1987 if (t0DecisionNumber == 0) {
1988
1989 h_ecl_gdl_top_timing_diff_good[skim[ifill]]->Fill(ecl_gdl_top_timing_combined_diff);
1990 h_ecl_top_top_timing_diff_good[skim[ifill]]->Fill(ecl_top_top_timing_combined_diff);
1991
1992 h_gdl_ecltop_timing_diff_vs_toptop_good[skim[ifill]]->Fill(ecl_gdl_top_timing_combined_diff, top_top_timing_combined_diff);
1993 h_top_ecltop_timing_diff_vs_toptop_good[skim[ifill]]->Fill(ecl_top_top_timing_combined_diff, top_top_timing_combined_diff);
1994 h_gdl_ecltop_timing_diff_vs_ecltop_good[skim[ifill]]->Fill(ecl_gdl_top_timing_combined_diff, ecl_top_top_timing_combined_diff);
1995
1996 h_topCombinedTimingTopGood[skim[ifill]]->Fill(topCombinedTimingTop);
1997 h_topNSlotsCombinedTimingTopGood[skim[ifill]]->Fill(topNSlotsCombinedTimingTop);
1998 h_topNHitSumGood[skim[ifill]]->Fill((int) hitsPerSlot);
1999 h_topLogLSumGood[skim[ifill]]->Fill((int) logLPerSlot);
2000
2001 h_topRvcDiff1Good[skim[ifill]]->Fill(topRvcDiff1);
2002 h_topRvcDiff2Good[skim[ifill]]->Fill(topRvcDiff2);
2003 h_topRvcDiff3Good[skim[ifill]]->Fill(topRvcDiff3);
2004 h_topRvcDiff4Good[skim[ifill]]->Fill(topRvcDiff4);
2005
2006 h_topGdlRvcDiff1Good[skim[ifill]]->Fill(topGdlRvcDiff1);
2007 h_topGdlRvcDiff2Good[skim[ifill]]->Fill(topGdlRvcDiff2);
2008 h_topGdlRvcDiff3Good[skim[ifill]]->Fill(topGdlRvcDiff3);
2009
2010 h_gdl_gdltop_rvc_diff_good[skim[ifill]]->Fill(gdl_top_rvc_diff);
2011 h_gdl_comtop_rvc_diff_good[skim[ifill]]->Fill(com_top_rvc_diff);
2012 }
2013 }
2014 } else {
2015
2016 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
2017
2018 h_decisionNumberVsNumberDecisionsBad[skim[ifill]]->Fill(nT0Decisions, t0DecisionNumber + 1);
2019
2020 if (t0DecisionNumber == 0) {
2021 h_ecl_gdl_top_timing_diff_bad[skim[ifill]]->Fill(ecl_gdl_top_timing_combined_diff);
2022 h_ecl_top_top_timing_diff_bad[skim[ifill]]->Fill(ecl_top_top_timing_combined_diff);
2023
2024 h_gdl_ecltop_timing_diff_vs_toptop_bad[skim[ifill]]->Fill(ecl_gdl_top_timing_combined_diff, top_top_timing_combined_diff);
2025 h_top_ecltop_timing_diff_vs_toptop_bad[skim[ifill]]->Fill(ecl_top_top_timing_combined_diff, top_top_timing_combined_diff);
2026 h_gdl_ecltop_timing_diff_vs_ecltop_bad[skim[ifill]]->Fill(ecl_gdl_top_timing_combined_diff, ecl_top_top_timing_combined_diff);
2027
2028 h_topCombinedTimingTopBad[skim[ifill]]->Fill(topCombinedTimingTop);
2029 h_topNSlotsCombinedTimingTopBad[skim[ifill]]->Fill(topNSlotsCombinedTimingTop);
2030 h_topNHitSumBad[skim[ifill]]->Fill((int) hitsPerSlot);
2031 h_topLogLSumBad[skim[ifill]]->Fill((int) logLPerSlot);
2032
2033 h_topRvcDiff1Bad[skim[ifill]]->Fill(topRvcDiff1);
2034 h_topRvcDiff2Bad[skim[ifill]]->Fill(topRvcDiff2);
2035 h_topRvcDiff3Bad[skim[ifill]]->Fill(topRvcDiff3);
2036 h_topRvcDiff4Bad[skim[ifill]]->Fill(topRvcDiff4);
2037
2038 h_topGdlRvcDiff1Bad[skim[ifill]]->Fill(topGdlRvcDiff1);
2039 h_topGdlRvcDiff2Bad[skim[ifill]]->Fill(topGdlRvcDiff2);
2040 h_topGdlRvcDiff3Bad[skim[ifill]]->Fill(topGdlRvcDiff3);
2041
2042 h_gdl_gdltop_rvc_diff_bad[skim[ifill]]->Fill(gdl_top_rvc_diff);
2043 h_gdl_comtop_rvc_diff_bad[skim[ifill]]->Fill(com_top_rvc_diff);
2044 }
2045 }
2046 }
2047 }
2048 }
2049
2050 if (t0DecisionNumber == 0) {
2051 for (unsigned ifill = 0; ifill < skim.size(); ifill++) {
2052
2053 if (m_histLevel > 1) {
2054 if (gdlInfoAvailable) {
2055 h_gdl_ecltop_timing_diff_vs_toptop[skim[ifill]][histClass]->Fill(ecl_gdl_top_timing_combined_diff, top_top_timing_combined_diff);
2056 h_top_ecltop_timing_diff_vs_toptop[skim[ifill]][histClass]->Fill(ecl_top_top_timing_combined_diff, top_top_timing_combined_diff);
2057 h_gdl_ecltop_timing_diff_vs_ecltop[skim[ifill]][histClass]->Fill(ecl_gdl_top_timing_combined_diff,
2058 ecl_top_top_timing_combined_diff);
2059 h_gdl_ecltop_timing_diff_vs_ecltop_best_slot[skim[ifill]][histClass]->Fill(ecl_gdl_top_timing_combined_diff,
2060 ecl_top_top_timing_best_slot_diff);
2061
2062 h_top_ecltop_timing_diff_2ns[skim[ifill]][histClass]->Fill(ecl_top_top_timing_combined_diff);
2063
2064 // these histograms are (presumably) for just ONE decision from circular buffer (past 1us) unless there are more than one TOP t0 decision with exactly same timing
2065 if (top_timing_same) {
2066 h_top_ecltop_timing_combined_diff_2ns[skim[ifill]][histClass]->Fill(ecl_top_top_timing_combined_diff);
2067 h_top_ecltop_timing_best_slot_diff_2ns[skim[ifill]][histClass]->Fill(ecl_top_top_timing_best_slot_diff);
2068 h_topNHitBestSlot[skim[ifill]][histClass]->Fill(nHitsSlotBest);
2069 // h_topT0DecisionNumberBestSlot[skim[ifill]][histClass]->Fill(t0DecisionNumber + 1);
2070 }
2071 }
2072
2073 h_topCombinedTimingTop[skim[ifill]][histClass]->Fill(topCombinedTimingTop);
2074 h_topNSlotsCombinedTimingTop[skim[ifill]][histClass]->Fill(topNSlotsCombinedTimingTop);
2075 h_topNHitSum[skim[ifill]][histClass]->Fill((int) hitsPerSlot);
2076 h_topLogLSum[skim[ifill]][histClass]->Fill((int) logLPerSlot);
2077 }
2078
2079 h_gdl_ecltop_timing_diff_vs_nslots_2ns[skim[ifill]]->Fill(ecl_top_timing_diff, topNSlotsCombinedTimingTop);
2080 h_top_ecltop_timing_diff_combined_2ns[skim[ifill]]->Fill(ecl_top_top_timing_combined_diff);
2081 h_top_ecltop_timing_diff_best_slot_2ns[skim[ifill]]->Fill(ecl_top_top_timing_best_slot_diff);
2082
2083 }
2084 }
2085
2086 t0DecisionNumber++;
2087 }
2088
2089}
2090
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
bool isValid() const
Check whether the object was created.
Definition: StoreObjPtr.h:111
int getTCId() const
The method to get cell id.
int getTCTime() const
The method to get hit average time.
virtual void initialize() override
initialize
StoreArray< TRGECLUnpackerStore > trgeclHitArray
Trg ECL Unpacker TC output.
TDirectory * oldDir
TDirectory.
virtual void event() override
Event.
virtual void endRun() override
End Run.
TH1I * h_topSlotSegment[nskim_topdqm][16]
Combined t0 decisions: all, the earliest and second best.
TH1I * h_N_decision[nskim_topdqm][nHistClasses]
Number of TOP L1 decisions.
virtual void beginRun() override
begin Run
TDirectory * dirDQM
TDirectory.
virtual void defineHisto() override
Define Histogram.
A class of TC Mapping.
Definition: TrgEclMapping.h:26
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
int getTCPhiIdFromTCId(int)
get [TC Phi ID] from [TC ID]
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
@ c_accept
Accept this event.
Abstract base class for different kinds of events.
STL namespace.