Belle II Software development
EventInspector.py
1#!/usr/bin/env python3
2
3
10
11# Purpose:
12# basf module to histogram useful values in RawKLM, KLMDigit, BKLMHit1d, and KLMHit2d
13# data-objects in a DST ROOT file and to create BKLM event displays from these data-objects.
14#
15
16import basf2
17import bklmDB
18import math
19import ROOT
20from ROOT import Belle2
21
22
23class EventInspector(basf2.Module):
24 """Fill BKLM histograms of values from RawKLMs, KLMDigits, BKLMHit1ds, and KLMHit2ds;
25 (optionally) draw event displays from these data-objects."""
26
27
28 BKLM_ID = 0x07000000
29
30 EKLM_ID = 0x08000000
31
32 BKLM_STRIP_BIT = 0
33
34 BKLM_PLANE_BIT = 6
35
36 BKLM_LAYER_BIT = 7
37
38 BKLM_SECTOR_BIT = 11
39
40 BKLM_SECTION_BIT = 14
41
42 BKLM_MAXSTRIP_BIT = 15
43
44 BKLM_STRIP_MASK = 0x3f
45
46 BKLM_PLANE_MASK = (1 << BKLM_PLANE_BIT)
47
48 BKLM_LAYER_MASK = (15 << BKLM_LAYER_BIT)
49
50 BKLM_SECTOR_MASK = (7 << BKLM_SECTOR_BIT)
51
52 BKLM_SECTION_MASK = (1 << BKLM_SECTION_BIT)
53
54 BKLM_MAXSTRIP_MASK = (63 << BKLM_MAXSTRIP_BIT)
55
56 BKLM_MODULEID_MASK = (BKLM_SECTION_MASK | BKLM_SECTOR_MASK | BKLM_LAYER_MASK)
57
58 def __init__(self, exp, run, histName, pdfName, eventPdfName, verbosity,
59 maxDisplays, minRPCHits, legacyTimes, singleEntry, view):
60 """Constructor
61
62 Arguments:
63 exp (str): formatted experiment number
64 run (str): formatter run number
65 histName (str): path name of the output histogram ROOT file
66 pdfName (str): path name of the output histogram PDF file
67 eventPdfName (str): path name of the output event-display PDF file
68 verbosity (int): determines how many histograms are written to the histogram PDF file
69 maxDisplays (int): max # of events displays to write
70 minRPCHits (int): min # of RPC KLMHit2ds in any sector for event display
71 legacyTimes (bool): true to correct BKLMHit{1,2}d times in legacy reconstruction, False otherwise
72 singleEntry (int): select events with any (0) or exactly one (1) or more than one (2) entries/channel
73 view (int): view event displays using one-dimensional (1) or two-dimensional (2) BKLMHits
74 """
75 super().__init__()
76
77 self.exp = exp
78
79 self.run = run
80
81 self.histName = histName
82
83 self.pdfName = pdfName
84
85 self.eventPdfName = eventPdfName
86
87 self.verbosity = verbosity
88
89 self.maxDisplays = maxDisplays
90
91 self.minRPCHits = minRPCHits
92
93 self.legacyTimes = legacyTimes
94
95 self.singleEntry = singleEntry
96
97 self.view = view
98
99 self.eventCounter = 0
100
102
103 self.lastTitle = ''
104
105 def makeGraph(self, x, y):
106 """Create and return a ROOT TGraph
107
108 Arguments:
109 x[] (real): x coordinates
110 y[] (real): y coordinates
111 """
112 graph = ROOT.TGraph()
113 for i in range(0, len(x)):
114 graph.SetPoint(i, x[i], y[i])
115 graph.SetLineColor(2)
116 graph.SetLineWidth(1)
117 return graph
118
119 def makeText(self, x, y, s):
120 """Create and return a ROOT TLatex with the following properties:
121 size = 0.04, color = red, alignment = middle centre, angle = 90 degrees
122
123 Arguments:
124 x (real): x coordinate
125 y (real): y coordinate
126 s (str): character string
127 """
128 text = ROOT.TLatex(x, y, s)
129 text.SetTextSize(0.04)
130 text.SetTextColor(2)
131 text.SetTextAlign(22)
132 text.SetTextAngle(90)
133 return text
134
135 def initialize(self):
136 """Handle job initialization: fill the mapping database, create histograms, open the event-display file"""
137
138 expRun = f'e{int(self.exp):02d}r{int(self.run)}: '
139
140 self.hist_XY = ROOT.TH2F('XY', ' ;x;y', 10, -345.0, 345.0, 10, -345.0, 345.0)
141 self.hist_XY.SetStats(False)
142
143 self.hist_ZY1D = [0, 0]
144 self.hist_ZY1D[0] = ROOT.TH2F('ZY0', ' ;z;y', 10, -200.0, 300.0, 10, -150.0, 350.0)
145 self.hist_ZY1D[1] = ROOT.TH2F('ZY1', ' ;z;y', 10, -200.0, 300.0, 10, -150.0, 350.0)
146 self.hist_ZY1D[0].SetStats(False)
147 self.hist_ZY1D[0].SetStats(False)
148
149 self.hist_ZY = ROOT.TH2F('ZY', ' ;z;y', 10, -345.0, 345.0, 10, -345.0, 345.0)
150 self.hist_ZY.SetStats(False)
151
152 # All histograms/scatterplots in the output file will show '# of events' only
153 ROOT.gStyle.SetOptStat(10)
154
156
157 self.sectorFBToDC = [11, 15, 2, 6, 10, 14, 3, 7, 9, 13, 0, 4, 8, 12, 1, 5]
158
159 self.dcToSectorFB = [10, 14, 2, 6, 11, 15, 3, 7, 12, 8, 4, 0, 13, 9, 5, 1]
160
162 self.t0Cal = 312
163
164 self.t0Cal1d = 325
165
166 self.t0Cal2d = 308
167
168 self.ct0Cal = 455
169
170 self.ct0Cal1d = 533
171
172 self.ct0Cal2d = 520
173
174 self.t0RPC = [[[0, 0, 17, 16, 15, 13, 14, 14, 16, 17, 18, 16, 16, 18, 16],
175 [0, 0, 0, -2, -1, -5, -6, -5, -5, -3, -4, -6, -8, -6, -8],
176 [0, 0, 6, 3, 5, 0, -1, -1, -2, 0, 0, -2, -3, -2, -4],
177 [0, 0, -4, -3, -6, -8, -8, -9, -9, -7, -7, -10, -10, -10, -12],
178 [0, 0, 6, 8, 4, 4, 3, 8, 4, 7, 7, 3, 5, 5, 4],
179 [0, 0, 18, 20, 18, 18, 16, 21, 17, 20, 20, 19, 21, 19, 20],
180 [0, 0, 19, 19, 19, 18, 17, 18, 22, 24, 25, 22, 22, 24, 22],
181 [0, 0, 19, 19, 18, 17, 16, 18, 18, 20, 21, 19, 20, 20, 20],
182 [0, 0, 6, 7, 9, 5, 4, 6, 6, 9, 9, 6, 7, 8, 7],
183 [0, 0, 3, 2, 2, -4, -1, -2, -2, 1, 0, -4, 246, -3, -4],
184 [0, 0, -1, -1, -1, -5, -6, -6, -8, -5, -4, -7, -7, -7, -8],
185 [0, 0, -5, -5, -5, -12, -9, -10, -8, -6, -10, -8, -8, -11, -12],
186 [0, 0, 12, 12, 13, 8, 6, 6, 7, 9, 10, 7, 6, 8, 5],
187 [0, 0, 14, 15, 43, 12, 10, 12, 11, 15, 16, 28, 14, 15, 14],
188 [0, 0, 22, 22, 21, 19, 19, 19, 21, 23, 24, 21, 22, 22, 22],
189 [0, 0, 18, 18, 17, 16, 16, 18, 18, 20, 21, 18, 18, 20, 19]],
190 [[0, 0, 6, 5, 4, 1, 1, 2, 3, 2, 2, -1, 0, 1, -1],
191 [0, 0, -11, -12, -11, -15, -18, -18, -18, -18, -19, -22, -23, -22, -24],
192 [0, 0, -4, -7, -6, -11, -12, -12, -14, -15, -15, -18, -19, -18, -20],
193 [0, 0, -15, -15, -16, -19, -22, -21, -22, -22, -22, -25, -26, -26, -27],
194 [0, 0, -5, -3, -6, -7, -9, -9, -9, -8, -8, -13, -12, -10, -13],
195 [0, 0, 6, 7, 5, 5, 3, 9, 4, 5, 6, 3, 5, 3, 4],
196 [0, 0, 9, 10, 10, 7, 7, 7, 9, 9, 9, 6, 6, 8, 8],
197 [0, 0, 7, 8, 7, 6, 4, 5, 4, 5, 5, 4, 3, 4, 3],
198 [0, 0, -5, -3, -1, -4, -8, -7, -7, -6, -6, -6, -9, -9, -9],
199 [0, 0, -8, -8, -11, -10, -14, -15, -16, -14, -15, -20, -20, -13, -20],
200 [0, 0, -12, -12, -14, -16, -16, -15, -21, -19, -19, -23, -23, -23, -24],
201 [0, 0, -15, -15, -15, -21, -22, -22, -22, -21, -23, -25, -25, -26, -27],
202 [0, 0, 0, 0, 2, -4, -5, -5, -4, -2, -1, -5, -5, -3, -7],
203 [0, 0, 3, 3, 32, 1, 0, -1, -3, 2, 1, 13, -1, 0, -2],
204 [0, 0, 11, 11, 10, 9, 6, 7, 6, 8, 8, 5, 6, 7, 6],
205 [0, 0, 7, 8, 7, 5, 3, 5, 7, 5, 5, 2, 7, 4, 3]]]
206
207
208 self.ct0Scint = [[[5, 7], [-27, -24], [-29, -45], [-27, -32], [3, 6], [34, 35], [48, 44], [33, 38],
209 [4, 7], [-28, -27], [-39, -34], [-36, -33], [2, 5], [25, 30], [46, 49], [41, 31]],
210 [[0, 0], [-32, -32], [-29, -54], [-31, -40], [-1, -1], [29, 27], [41, 41], [28, 28],
211 [-2, -1], [-32, -34], [-38, -45], [-40, -41], [-3, -3], [21, 20], [41, 42], [41, 19]]]
212
213
214 self.histogramFile = ROOT.TFile.Open(self.histName, "RECREATE")
215 # All histograms/scatterplots in the output file will show '# of events' only
216 ROOT.gStyle.SetOptStat(10)
217 ROOT.gStyle.SetOptFit(111)
218
219 # create the rawKLM histograms
220
221
222 self.hist_nDigit = ROOT.TH1F('NDigit', expRun + '# of BKLMDigits', 500, -0.5, 499.5)
223
224 self.hist_nRawKLM = ROOT.TH1F('NRawKLM', expRun + '# of RawKLMs', 10, -0.5, 9.5)
225
226 self.hist_rawKLMnumEvents = ROOT.TH1F('RawKLMnumEvents', expRun + 'RawKLM NumEvents;(should be 1)', 10, -0.5, 9.5)
227
228 self.hist_rawKLMnumNodes = ROOT.TH1F('RawKLMnumNodes', expRun + 'RawKLM NumNodes;(should be 1)', 10, -0.5, 9.5)
229
230 self.hist_rawKLMnodeID = ROOT.TH2F('RawKLMnodeID',
231 expRun + 'RawKLM NodeID;' +
232 'NodeID (bklm: 1..4, eklm:5..8);' +
233 'Copper index',
234 10, -0.5, 9.5, 10, -0.5, 9.5)
235
236 self.hist_rawKLMlaneFlag = ROOT.TH2F('rawKLMlaneFlag',
237 expRun + 'RawKLM lane vs flag;' +
238 'Flag (1=RPC, 2=Scint);' +
239 'Lane (scint: 1..7, RPC: 8..20)',
240 4, -0.5, 3.5, 21, -0.5, 20.5)
241
242 self.hist_rawKLMtdcExtraRPC = ROOT.TH2F('rawKLMtdcExtraRPC',
243 expRun + 'RawKLM RPC tdcExtra bits;' +
244 'Sector # (0-7 = backward, 8-15 = forward);' +
245 'tdcExtra [should be 0]',
246 16, -0.5, 15.5, 32, -0.5, 31.5)
247
248 self.hist_rawKLMadcExtraRPC = ROOT.TH2F('rawKLMadcExtraRPC',
249 expRun + 'RawKLM RPC adcExtra bits;' +
250 'Sector # (0-7 = backward, 8-15 = forward);' +
251 'adcExtra [should be 0]',
252 16, -0.5, 15.5, 16, -0.5, 15.5)
253
254 self.hist_rawKLMtdcExtraScint = ROOT.TH2F('rawKLMtdcExtraScint',
255 expRun + 'RawKLM Scint tdcExtra bits;' +
256 'Sector # (0-7 = backward, 8-15 = forward);' +
257 'tdcExtra',
258 16, -0.5, 15.5, 32, -0.5, 31.5)
259
260 self.hist_rawKLMadcExtraScint = ROOT.TH2F('rawKLMadcExtraScint',
261 expRun + 'RawKLM Scint adcExtra bits;' +
262 'Sector # (0-7 = backward, 8-15 = forward);' +
263 'adcExtra',
264 16, -0.5, 15.5, 16, -0.5, 15.5)
265
266 self.hist_rawKLMsizeMultihit = ROOT.TH1F('rawKLMsizeMultihit', expRun + 'RawKLM word count (N/channel)', 400, -0.5, 799.5)
267
268 self.hist_rawKLMsize = ROOT.TH1F('rawKLMsize', expRun + 'RawKLM word count (1/channel)', 250, -0.5, 499.5)
269
271
273 for sectorFB in range(0, 16):
274 dc = self.sectorFBToDC[sectorFB]
275 copper = dc & 0x03
276 finesse = dc >> 2
277 label = f'rawKLM_S{sectorFB:02d}_sizeMultihit'
278 title = f'{expRun}sector {sectorFB} [COPPER {copper} finesse {finesse}] word count (N/channel)'
279 self.hist_rawKLMsizeByDCMultihit.append(ROOT.TH1F(label, title, 100, -0.5, 199.5))
280 label = f'rawKLM_S{sectorFB:02d}_size'
281 title = f'{expRun}sector {sectorFB} [COPPER {copper} finesse {finesse}] word count (1/channel)'
282 self.hist_rawKLMsizeByDC.append(ROOT.TH1F(label, title, 100, -0.5, 199.5))
283
285
287 for sectorFB in range(0, 16):
288 dc = self.sectorFBToDC[sectorFB]
289 copper = dc & 0x03
290 finesse = dc >> 2
291 label = f'rawKLM_S{sectorFB:02d}_channelMultiplicity'
292 title = f'{expRun}sector {sectorFB} [COPPER {copper} finesse {finesse}] per-channel multiplicity (N/channel > 1);' + \
293 'Per-channel multiplicity;(Lane #) * 2 + (Axis #)'
294 self.hist_rawKLMchannelMultiplicity.append(ROOT.TH2F(label, title, 30, -0.5, 29.5, 42, -0.5, 41.5))
295 label = f'rawKLM_S{sectorFB:02d}_channelMultiplicityFine'
296 title = f'{expRun}sector {sectorFB} [COPPER {copper} finesse {finesse}] per-channel multiplicity (N/channel > 1);' + \
297 'Per-channel multiplicity;(Lane #) * 256 + (Axis #) * 128 + (Channel #)'
298 self.hist_rawKLMchannelMultiplicityFine.append(ROOT.TH2F(label, title, 30, -0.5, 29.5, 8192, -0.5, 8191.5))
299
301 'mappedSectorOccupancyMultihit',
302 expRun + 'Sector occupancy of mapped channels (N/channel);' +
303 'Sector # (0-7 = backward, 8-15 = forward)',
304 16, -0.5, 15.5)
305
307 'unmappedSectorOccupancyMultihit',
308 expRun + 'Sector occupancy of unmapped channels (N/channel);' +
309 'Sector # (0-7 = backward, 8-15 = forward)',
310 16, -0.5, 15.5)
311
313 'mappedSectorOccupancy',
314 expRun + 'Sector occupancy of mapped channels (1/channel);' +
315 'Sector # (0-7 = backward, 8-15 = forward)',
316 16, -0.5, 15.5)
317
319 'unmappedSectorOccupancy',
320 expRun + 'Sector occupancy of unmapped channels (1/channel);' +
321 'Sector # (0-7 = backward, 8-15 = forward)',
322 16, -0.5, 15.5)
323
325 'mappedRPCSectorOccupancy',
326 expRun + 'Sector occupancy of mapped RPC channels (1/channel);' +
327 'Sector # (0-7 = backward, 8-15 = forward)',
328 16, -0.5, 15.5)
329
331 'mappedRPCLaneAxisOccupancy',
332 expRun + 'Lane/axis occupancy of mapped RPC channels (1/channel);' +
333 'Sector # (0-7 = backward, 8-15 = forward);' +
334 '(Lane #) * 2 + (Axis #)',
335 16, -0.5, 15.5, 42, -0.5, 41.5)
336
338 'unmappedRPCSectorOccupancy',
339 expRun + 'Sector occupancy of unmapped RPC channels (1/channel);' +
340 'Sector # (0-7 = backward, 8-15 = forward)',
341 16, -0.5, 15.5)
342
344 'unmappedRPCLaneAxisOccupancy',
345 expRun + 'Lane/axis occupancy of unmapped RPC channels (1/channel);' +
346 'Sector # (0-7 = backward, 8-15 = forward);' +
347 '(Lane #) * 2 + (Axis #)',
348 16, -0.5, 15.5, 42, -0.5, 41.5)
349
351 'mappedScintSectorOccupancy',
352 expRun + 'Sector occupancy of mapped scint channels (1/channel);' +
353 'Sector # (0-7 = backward, 8-15 = forward)',
354 16, -0.5, 15.5)
355
357 'mappedScintLaneAxisOccupancy',
358 expRun + 'Lane/axis occupancy of mapped scint channels (1/channel);' +
359 'Sector # (0-7 = backward, 8-15 = forward);' +
360 '(Lane #) * 2 + (Axis #)',
361 16, -0.5, 15.5, 42, -0.5, 41.5)
362
364 'unmappedScintSectorOccupancy',
365 expRun + 'Sector occupancy of unmapped scint channels (1/channel);' +
366 'Sector # (0-7 = backward, 8-15 = forward)',
367 16, -0.5, 15.5)
368
370 'unmappedScintLaneAxisOccupancy',
371 expRun + 'Lane/axis occupancy of unmapped scint channels (1/channel);' +
372 'Sector # (0-7 = backward, 8-15 = forward);' +
373 '(Lane #) * 2 + (Axis #)',
374 16, -0.5, 15.5, 42, -0.5, 41.5)
375
377 [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
378 [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]
379
381 [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
382 [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]
383
385 [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
386 [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]
387 for sectorFB in range(0, 16):
388 label = f'mappedChannelOccupancy_S{sectorFB:02d}ZPrompt'
389 title = f'{expRun}In-time mapped channel occupancy for sector {sectorFB} z hits;lane;channel'
390 self.hist_mappedChannelOccupancyPrompt[sectorFB][0] = ROOT.TH2F(label, title, 42, -0.25, 20.75, 128, -0.25, 63.75)
391 label = f'mappedChannelOccupancy_S{sectorFB:02d}ZBkgd'
392 title = f'{expRun}Out-of-time mapped channel occupancy for sector {sectorFB} z hits;lane;channel'
393 self.hist_mappedChannelOccupancyBkgd[sectorFB][0] = ROOT.TH2F(label, title, 42, -0.25, 20.75, 128, -0.25, 63.75)
394 label = f'unmappedChannelOccupancy_S{sectorFB:02d}Z'
395 title = f'{expRun}Unmapped channel occupancy for sector {sectorFB} z hits;lane;channel'
396 self.hist_unmappedChannelOccupancy[sectorFB][0] = ROOT.TH2F(label, title, 42, -0.25, 20.75, 128, -0.25, 63.75)
397 label = f'mappedChannelOccupancy_S{sectorFB:02d}PhiPrompt'
398 title = f'{expRun}In-time mapped occupancy for sector {sectorFB} phi hits;lane;channel'
399 self.hist_mappedChannelOccupancyPrompt[sectorFB][1] = ROOT.TH2F(label, title, 42, -0.25, 20.75, 128, -0.25, 63.75)
400 label = f'mappedChannelOccupancy_S{sectorFB:02d}PhiBkgd'
401 title = f'{expRun}Out-of-time mapped occupancy for sector {sectorFB} phi hits;lane;channel'
402 self.hist_mappedChannelOccupancyBkgd[sectorFB][1] = ROOT.TH2F(label, title, 42, -0.25, 20.75, 128, -0.25, 63.75)
403 label = f'unmappedChannelOccupancy_S{sectorFB:02d}Phi'
404 title = f'{expRun}Unmapped channel occupancy for sector {sectorFB} phi hits;lane;channel'
405 self.hist_unmappedChannelOccupancy[sectorFB][1] = ROOT.TH2F(label, title, 42, -0.25, 20.75, 128, -0.25, 63.75)
406
407 self.hist_RPCTimeLowBitsBySector = ROOT.TH2F('RPCTimeLowBitsBySector',
408 expRun + 'RPC TDC lowest-order bits;' +
409 'Sector # (0-7 = backward, 8-15 = forward);' +
410 'TDC % 4 (ns) [should be 0]',
411 16, -0.5, 15.5, 4, -0.5, 3.5)
412
413 self.hist_mappedRPCTime = ROOT.TH1F(
414 'mappedRPCTime', expRun + 'RPC mapped-strip time distribution;t - t(trigger) (ns)', 256, -0.5, 1023.5)
415
416 self.hist_mappedRPCTimeCal = ROOT.TH1F(
417 'mappedRPCTimeCal', expRun + 'RPC mapped-strip time distribution;t - t(trigger) - dt(layer) (ns)', 256, -0.5, 1023.5)
418
420
422 for sectorFB in range(0, 16):
423 self.hist_mappedRPCPhiTimePerLayer.append([])
424 self.hist_mappedRPCZTimePerLayer.append([])
425 for layer in range(0, 15):
426 label = f'mappedRPCPhiTime_S{sectorFB:02d}L{layer:02d}'
427 title = f'{expRun}RPC sector {sectorFB} layer {layer} phi time distribution;t - t(trigger) (ns)'
428 self.hist_mappedRPCPhiTimePerLayer[sectorFB].append(ROOT.TH1F(label, title, 256, -0.5, 1023.5))
429 label = f'mappedRPCZTime_S{sectorFB:02d}L{layer:02d}'
430 title = f'{expRun}RPC sector {sectorFB} layer {layer} z time distribution;t - t(trigger) (ns)'
431 self.hist_mappedRPCZTimePerLayer[sectorFB].append(ROOT.TH1F(label, title, 256, -0.5, 1023.5))
432
433 self.hist_mappedRPCTimeBySector = ROOT.TH2F('mappedRPCTimeBySector',
434 expRun + 'RPC mapped-strip time;' +
435 'Sector # (0-7 = backward, 8-15 = forward);' +
436 't - t(trigger) (ns)',
437 16, -0.5, 15.5, 128, -0.5, 1023.5)
438
439 self.hist_mappedRPCTimeCalBySector = ROOT.TH2F('mappedRPCTimeCalBySector',
440 expRun + 'RPC mapped-strip time;' +
441 'Sector # (0-7 = backward, 8-15 = forward);' +
442 't - t(trigger) - dt(layer) (ns)',
443 16, -0.5, 15.5, 128, -0.5, 1023.5)
444
445 self.hist_mappedRPCCtimeRange = ROOT.TH1F('mappedRPCCtimeRange',
446 expRun + 'RPC Ctime-range in event;' +
447 'CtimeMax - CtimeMin (ns)',
448 128, -0.5, 8191.5)
449
450 self.hist_mappedRPCCtimeRangeBySector = ROOT.TH2F('mappedRPCCtimeRangeBySector',
451 expRun + 'RPC Ctime-range in event;' +
452 'Sector # (0-7 = backward, 8-15 = forward);' +
453 'CtimeMax - CtimeMin (ns)',
454 16, -0.5, 15.5, 128, -0.5, 8191.5)
455
456 self.hist_unmappedRPCTime = ROOT.TH1F('unmappedRPCTime',
457 expRun + 'RPC unmapped-strip time distribution;' +
458 't - t(trigger) (ns)',
459 256, -0.5, 1023.5)
460
461 self.hist_unmappedRPCTimeBySector = ROOT.TH2F('unmappedRPCTimeBySector',
462 expRun + 'RPC unmapped-strip time;' +
463 'Sector # (0-7 = backward, 8-15 = forward);' +
464 't - t(trigger) (ns)',
465 16, -0.5, 15.5, 128, -0.5, 1023.5)
466
467 self.hist_ScintTimeLowBitsBySector = ROOT.TH2F('ScintTimeLowBitsBySector',
468 expRun + 'Scint TDC lowest-order bits;' +
469 'Sector # (0-7 = backward, 8-15 = forward);' +
470 'TDC % 4 (ns)',
471 16, -0.5, 15.5, 4, -0.5, 3.5)
472
473 self.hist_mappedScintCtime = ROOT.TH1F('mappedScintCtime',
474 expRun + 'Scint mapped-strip ctime distribution;' +
475 'ctime - ct(trigger) (ns)',
476 32, -0.5, 1023.5)
477
478 self.hist_mappedScintCtimeBySector = ROOT.TH2F('mappedScintCtimeBySector',
479 expRun + 'Scint mapped-strip ctime;' +
480 'Sector # (0-7 = backward, 8-15 = forward);' +
481 'ctime - ct(trigger) (ns)',
482 16, -0.5, 15.5, 32, -0.5, 1023.5)
483
484 self.hist_mappedScintCtimeCal = ROOT.TH1F('mappedScintCtimeCal',
485 expRun + 'Scint mapped-strip ctime distribution;' +
486 'ctime - ct(trigger) - dt(layer) (ns)',
487 32, -0.5, 1023.5)
488
489 self.hist_mappedScintCtimeCalBySector = ROOT.TH2F('mappedScintCtimeCalBySector',
490 expRun + 'Scint mapped-strip ctime;' +
491 'Sector # (0-7 = backward, 8-15 = forward);' +
492 'ctime - ct(trigger) - dt(layer) (ns)',
493 16, -0.5, 15.5, 32, -0.5, 1023.5)
494
496
498 for sectorFB in range(0, 16):
500 self.hist_mappedScintZCtimePerLayer.append([])
501 for layer in range(0, 2):
502 label = f'mappedScintPhiCtime_S{sectorFB:02d}L{layer:02d}'
503 title = f'{expRun}Scint sector {sectorFB} layer {layer} phi ctime distribution;ctime - ct(trigger) (ns)'
504 self.hist_mappedScintPhiCtimePerLayer[sectorFB].append(ROOT.TH1F(label, title, 32, -0.5, 1023.5))
505 label = f'mappedScintZCtime_S{sectorFB:02d}L{layer:02d}'
506 title = f'{expRun}Scint sector {sectorFB} layer {layer} z ctime distribution;ctime - ct(trigger) (ns)'
507 self.hist_mappedScintZCtimePerLayer[sectorFB].append(ROOT.TH1F(label, title, 32, -0.5, 1023.5))
508
509 self.hist_mappedScintCtimeRange = ROOT.TH1F('mappedScintCtimeRange',
510 expRun + 'Scint ctime-range in event;' +
511 'ctimeMax - ctimeMin (ns)',
512 128, -0.5, 1023.5)
513
514 self.hist_mappedScintCtimeRangeBySector = ROOT.TH2F('mappedScintCtimeRangeBySector',
515 expRun + 'Scint ctime-range in event;' +
516 'Sector # (0-7 = backward, 8-15 = forward);' +
517 'ctimeMax - ctimeMin (ns)',
518 16, -0.5, 15.5, 128, -0.5, 1023.5)
519
520 self.hist_unmappedScintCtime = ROOT.TH1F('unmappedScintCtime',
521 expRun + 'Scint unmapped-strip ctime distribution;' +
522 'ctime - ct(trigger) (ns)',
523 32, -0.5, 1023.5)
524
525 self.hist_unmappedScintCtimeBySector = ROOT.TH2F('unmappedScintCtimeBySector',
526 expRun + 'Scint unmapped-strip ctime;' +
527 'Sector # (0-7 = backward, 8-15 = forward);' +
528 'ctime - ct(trigger) (ns)',
529 16, -0.5, 15.5, 32, -0.5, 1023.5)
530
531 self.hist_mappedScintTDC = ROOT.TH1F('mappedScintTDC',
532 expRun + 'Scint mapped-strip TDC distribution;' +
533 't (ns)',
534 32, -0.5, 31.5)
535
536 self.hist_mappedScintTime = ROOT.TH1F('mappedScintTime',
537 expRun + 'Scint mapped-strip time distribution;' +
538 't - t(trigger) (ns)', 32, -0.5, 31.5)
539
540 self.hist_mappedScintTDCBySector = ROOT.TH2F('mappedScintTDCBySector',
541 expRun + 'Scint mapped-strip TDC;' +
542 'Sector # (0-7 = backward, 8-15 = forward);' +
543 't (ns)',
544 16, -0.5, 15.5, 32, -0.5, 31.5)
545
546 self.hist_mappedScintTimeBySector = ROOT.TH2F('mappedScintTimeBySector',
547 expRun + 'Scint mapped-strip time;' +
548 'Sector # (0-7 = backward, 8-15 = forward);' +
549 't - t(trigger) (ns)',
550 16, -0.5, 15.5, 32, -0.5, 31.5)
551
552 self.hist_unmappedScintTime = ROOT.TH1F('unmappedScintTime',
553 expRun + 'Scint unmapped-strip time distribution;' +
554 't - t(trigger) (ns)',
555 32, -0.5, 31.5)
556
557 self.hist_unmappedScintTimeBySector = ROOT.TH2F('unmappedScintTimeBySector',
558 expRun + 'Scint unmapped-strip time;' +
559 'Sector # (0-7 = backward, 8-15 = forward);' +
560 't - t(trigger) (ns)',
561 16, -0.5, 15.5, 32, -0.5, 31.5)
562
563 # Create the RPC time-calibration/diagnostic histograms
564
565
566 self.hist_trigCtimeVsTrigRevo9time = ROOT.TH1F('trigCtimeVsTrigRevo9time',
567 expRun + 'trigCtime - trigRevo9time (ns)',
568 256, -1024.5, 1023.5)
569
570 self.hist_tdcRangeRPC = ROOT.TH1F('tdcRangeRPC',
571 expRun + 'RPC TDC range;' +
572 'maxTDC - minTDC (ns)',
573 128, -0.5, 1023.5)
574
575 self.hist_ctimeRangeRPC = ROOT.TH1F('ctimeRangeRPC',
576 expRun + 'RPC Ctime range;' +
577 'maxCtime - minCtime (ns)',
578 128, -0.5, 1023.5)
579
580 self.hist_tdcRangeVsCtimeRangeRPC = ROOT.TH2F('tdcRangeVsCtimeRangeRPC',
581 expRun + 'RPC Ctime range vs TDC range;' +
582 'maxTDC - minTDC (ns);' +
583 'maxCtime - minCtime (ns)',
584 128, -0.5, 1023.5, 128, -0.5, 1023.5)
585
586 self.hist_tdcRangeVsTimeRPC = ROOT.TH2F('tdcRangeVsTimeRPC',
587 expRun + 'RPC TDC range vs time;' +
588 't - t(trigger) (ns);' +
589 'maxTDC - minTDC (ns)',
590 128, -0.5, 1023.5, 128, -0.5, 1023.5)
591
592 self.hist_ctimeRangeVsTimeRPC = ROOT.TH2F('ctimeRangeVsTimeRPC',
593 expRun + 'RPC Ctime range vs time;' +
594 't - t(trigger) (ns);' +
595 'maxCtime - minCtime (ns)',
596 128, -0.5, 1023.5, 128, -0.5, 1023.5)
597
598 # Create the BKLMHit1d-related histograms
599
600
601 self.hist_nHit1d = ROOT.TH1F('NHit1d', expRun + '# of BKLMHit1ds', 100, -0.5, 99.5)
602
603 self.hist_nHit1dRPCPrompt = ROOT.TH1F('NHit1dRPCPrompt', expRun + '# of prompt RPC BKLMHit1ds', 100, -0.5, 99.5)
604
605 self.hist_nHit1dRPCBkgd = ROOT.TH1F('NHit1dRPCBkgd', expRun + '# of background RPC BKLMHit1ds', 100, -0.5, 99.5)
606
607 self.hist_nHit1dScint = ROOT.TH1F('NHit1dScint', expRun + '# of scintillator BKLMHit1ds', 100, -0.5, 99.5)
608
609 self.hist_nHit1dPrompt = ROOT.TH1F('NHit1dPrompt', expRun + '# of prompt BKLMHit1ds', 100, -0.5, 99.5)
610
611 self.hist_nHit1dBkgd = ROOT.TH1F('NHit1dBkgd', expRun + '# of bkgd BKLMHit1ds', 100, -0.5, 99.5)
612
613 self.hist_n1dPhiZ = ROOT.TH2F('NHit1dPhiZ',
614 expRun + 'Distribution of BKLMHit1ds;# of phi BKLMHit1ds;# of z BKLMHit1ds',
615 60, -0.5, 59.5, 60, -0.5, 59.5)
616
617 self.hist_multiplicityPhiBySector = ROOT.TH2F('Hit1dMultiplicityPhiBySector',
618 expRun + 'BKLMHit1d phi-strip multiplicity;' +
619 'sector # (0-7 = backward, 8-15 = forward);' +
620 '# of strips',
621 16, -0.5, 15.5, 8, -0.5, 7.5)
622
623 self.hist_multiplicityZBySector = ROOT.TH2F('Hit1dMultiplicityZBySector',
624 expRun + 'BKLMHit1d z-strip multiplicity;' +
625 'sector # (0-7 = backward, 8-15 = forward);' +
626 '# of strips',
627 16, -0.5, 15.5, 8, -0.5, 7.5)
628
629 self.hist_tphiRPCCal1d = ROOT.TH1F('tphiRPCCal1d',
630 expRun + 'RPC BKLMHit1d phi-strip time distribution;' +
631 't(phi1D) - dt(layer) (ns)',
632 256, -0.5, 1023.5)
633
634 self.hist_tzRPCCal1d = ROOT.TH1F('tzRPCCal1d',
635 expRun + 'RPC BKLMHit1d z-strip time distribution;' +
636 't(z1D) - dt(layer) (ns)',
637 256, -0.5, 1023.5)
638
639 self.hist_tRPCCal1d = ROOT.TH1F('tRPCCal1d',
640 expRun + 'RPC BKLMHit1d x 2 calibrated average-time distribution;' +
641 '0.5*[t(phi1D) + t(z1D)] - dt(layer) (ns)',
642 256, -0.5, 1023.5)
643
644 self.hist_dtRPC1d = ROOT.TH1F('dtRPC1d',
645 expRun + 'RPC BKLMHit1d x 2 time-difference distribution;' +
646 't(phi1D) - t(z1D) (ns)',
647 50, -100.0, 100.0)
648
649 self.hist_ctphiScintCal1d = ROOT.TH1F('ctphiScintCal1d',
650 expRun + 'Scintillator BKLMHit1d phi-strip ctime distribution;' +
651 't(phi1D) - dt(layer) (ns)',
652 128, -0.5, 1023.5)
653
654 self.hist_ctzScintCal1d = ROOT.TH1F('ctzScintCal1d',
655 expRun + 'Scintillator BKLMHit1d z-strip ctime distribution;' +
656 't(z1D) - dt(layer) (ns)',
657 128, -0.5, 1023.5)
658
659 self.hist_ctScintCal1d = ROOT.TH1F('ctScintCal1d',
660 expRun + 'Scintillator BKLMHit1d x 2 calibrated average-time distribution;' +
661 '0.5*[t(phi1D) + t(z1D)] - dt(layer) (ns)',
662 128, -0.5, 1023.5)
663
664 self.hist_dtScint1d = ROOT.TH1F('dtScint1d',
665 expRun + 'Scintillator BKLMHit1d x 2 time-difference distribution;' +
666 't(phi1D) - t(z1D) (ns)',
667 50, -100.0, 100.0)
668
669 # Create the KLMHit2d-related histograms
670
671
672 self.hist_nHit2d = ROOT.TH1F('NHit2d', expRun + '# of KLMHit2ds', 50, -0.5, 49.5)
673
674 self.hist_occupancyForwardXYPrompt = ROOT.TH2F('occupancyForwardXYPrompt',
675 expRun + 'Forward xy RPC occupancy for in-time hits;x(cm);y(cm)',
676 230, -345.0, 345.0, 230, -345.0, 345.0)
677
678 self.hist_occupancyBackwardXYPrompt = ROOT.TH2F('occupancyBackwardXYPrompt',
679 expRun + 'Backward xy RPC occupancy for in-time hits;x(cm);y(cm)',
680 230, -345.0, 345.0, 230, -345.0, 345.0)
681
682 self.hist_occupancyForwardXYBkgd = ROOT.TH2F('occupancyForwardXYBkgd',
683 expRun + 'Forward xy RPC occupancy for out-of-time hits;x(cm);y(cm)',
684 230, -345.0, 345.0, 230, -345.0, 345.0)
685
686 self.hist_occupancyBackwardXYBkgd = ROOT.TH2F('occupancyBackwardXYBkgd',
687 expRun + 'Backward xy RPC occupancy for out-of-time hits;x(cm);y(cm)',
688 230, -345.0, 345.0, 230, -345.0, 345.0)
689
690 self.hist_occupancyRZPrompt = ROOT.TH2F('occupancyRZPrompt',
691 expRun + 'layer-z occupancy for in-time hits;z(cm);layer',
692 48, -190.0, 290.0, 16, -0.5, 15.5)
693
694 self.hist_occupancyZPrompt = ROOT.TH1F('occupancyZPrompt',
695 expRun + 'z occupancy for in-time hits;z(cm)',
696 48, -190.0, 290.0)
697
698 self.hist_occupancyRPrompt = ROOT.TH1F('occupancyRPrompt',
699 expRun + 'layer occupancy for in-time hits;layer',
700 16, -0.5, 15.5)
701
702 self.hist_occupancyRZBkgd = ROOT.TH2F('occupancyRZBkgd',
703 expRun + 'layer-z occupancy for out-of-time hits;z(cm);layer',
704 48, -190.0, 290.0, 16, -0.5, 15.5)
705
706 self.hist_occupancyZBkgd = ROOT.TH1F('occupancyZBkgd',
707 expRun + 'z occupancy for out-of-time hits;z(cm)',
708 48, -190.0, 290.0)
709
710 self.hist_occupancyRBkgd = ROOT.TH1F('occupancyRBkgd',
711 expRun + 'layer occupancy for out-of-time hits;layer',
712 16, -0.5, 15.5)
713
714 self.hist_tRPCCal2d = ROOT.TH1F('tRPCCal2d',
715 expRun + 'RPC KLMHit2d time distribution;' +
716 't(2D) - dt(layer) (ns)',
717 256, -0.5, 1023.5)
718
719 self.hist_tRPCCal2dBySector = ROOT.TH2F('tRPCCal2dBySector',
720 expRun + 'RPC KLMHit2d time distribution;' +
721 'sector # (0-7 = backward, 8-15 = forward);' +
722 't(2D) - dt(layer) (ns)',
723 16, -0.5, 15.5, 256, -0.5, 1023.5)
724
725 self.hist_ctScintCal2d = ROOT.TH1F('ctScintCal2d',
726 expRun + 'Scint KLMHit2d ctime distribution;' +
727 't(2D) - dt(layer) (ns)',
728 128, -0.5, 1023.5)
729
730 self.hist_ctScintCal2dBySector = ROOT.TH2F('ctScintCal2dBySector',
731 expRun + 'Scint KLMHit2d ctime distribution;' +
732 'sector # (0-7 = backward, 8-15 = forward);' +
733 't(2D) - dt(layer) (ns)',
734 16, -0.5, 15.5, 128, -0.5, 1023.5)
735
736
737 self.hist_tVsZFwd = ROOT.TProfile("tVsZForward",
738 expRun + 'RPC KLMHit2d time vs z (forward);' +
739 'z (cm);' +
740 't(2D) - dt(layer) (ns)',
741 48, 0.0, 216.96)
742
743 self.hist_tVsZBwd = ROOT.TProfile("tVsZBackward",
744 expRun + 'RPC KLMHit2d time vs z (backward);' +
745 'z (cm);' +
746 't(2D) - dt(layer) (ns)',
747 48, 0.0, 216.96)
748 # Open the output PDF file for event displays
749
750 if self.maxDisplays > 0:
751
752 self.eventCanvas = ROOT.TCanvas("eventCanvas", self.eventPdfName, 3200, 1600)
753 title = f'{self.eventPdfName}['
754 self.eventCanvas.SaveAs(title)
755 self.eventCanvas.Clear()
756 self.eventCanvas.Divide(2, 1)
757
758 # Create the boilerplate for the end- and side-views of the event display
759
760
761 self.bklmXY = []
762 r0 = 201.9 + 0.5 * 4.4 # cm
763 dr = 9.1 # cm
764 tan0 = math.tan(math.pi / 8.0)
765 g = ROOT.TGraph()
766 g.SetPoint(0, -200.0, 0.0)
767 g.SetPoint(1, +200.0, 0.0)
768 g.SetLineColor(19)
769 g.SetLineWidth(1)
770 g.SetLineStyle(3)
771 self.bklmXY.append(g)
772 g = ROOT.TGraph()
773 g.SetPoint(0, 0.0, -200.0)
774 g.SetPoint(1, 0.0, +200.0)
775 g.SetLineColor(19)
776 g.SetLineWidth(1)
777 g.SetLineStyle(3)
778 self.bklmXY.append(g)
779 g = ROOT.TGraph()
780 g.SetPoint(0, -5.0, 0.0)
781 g.SetPoint(1, +5.0, 0.0)
782 g.SetPoint(2, 0.0, 0.0)
783 g.SetPoint(3, 0.0, +5.0)
784 g.SetPoint(4, 0.0, -5.0)
785 g.SetLineColor(1)
786 g.SetLineWidth(1)
787 self.bklmXY.append(g)
788 for layer in range(0, 15):
789 r = r0 + layer * dr
790 x = r * tan0
791 g = ROOT.TGraph()
792 g.SetPoint(0, +r, -x)
793 g.SetPoint(1, +r, +x)
794 g.SetPoint(2, +x, +r)
795 g.SetPoint(3, -x, +r)
796 g.SetPoint(4, -r, +x)
797 g.SetPoint(5, -r, -x)
798 g.SetPoint(6, -x, -r)
799 g.SetPoint(7, +x, -r)
800 g.SetPoint(8, +r, -x)
801 if layer < 2:
802 g.SetLineColor(18)
803 else:
804 g.SetLineColor(17)
805 if (layer % 5) == 0:
806 g.SetLineStyle(3)
807 g.SetLineWidth(1)
808 self.bklmXY.append(g)
809
810 self.bklmZY = []
811 rF = r0 + 14 * dr
812 x0 = r0 * tan0
813 z0 = 47.0 # cm
814 zL = 220.0 # cm
815 g = ROOT.TGraph()
816 g.SetPoint(0, -zL + z0 - 140.0, 0.0)
817 g.SetPoint(1, +zL + z0 + 70.0, 0.0)
818 g.SetLineColor(19)
819 g.SetLineWidth(1)
820 g.SetLineStyle(3)
821 self.bklmZY.append(g)
822 g = ROOT.TGraph()
823 g.SetPoint(0, 0.0, -315.0)
824 g.SetPoint(1, 0.0, +340.0)
825 g.SetLineColor(19)
826 g.SetLineWidth(1)
827 g.SetLineStyle(3)
828 self.bklmZY.append(g)
829 g = ROOT.TGraph()
830 g.SetPoint(0, -5.0, 0.0)
831 g.SetPoint(1, +5.0, 0.0)
832 g.SetPoint(2, 0.0, 0.0)
833 g.SetPoint(3, 0.0, +5.0)
834 g.SetPoint(4, 0.0, -5.0)
835 g.SetLineColor(1)
836 g.SetLineWidth(1)
837 self.bklmZY.append(g)
838 g = ROOT.TGraph()
839 g.SetPoint(0, -zL + z0, +x0)
840 g.SetPoint(1, -zL + z0, +r0)
841 g.SetLineColor(18)
842 g.SetLineWidth(1)
843 g.SetLineStyle(3)
844 self.bklmZY.append(g)
845 g = ROOT.TGraph()
846 g.SetPoint(0, -zL + z0, -x0)
847 g.SetPoint(1, -zL + z0, -r0)
848 g.SetLineColor(18)
849 g.SetLineWidth(1)
850 g.SetLineStyle(3)
851 self.bklmZY.append(g)
852 g = ROOT.TGraph()
853 g.SetPoint(0, +zL + z0, +x0)
854 g.SetPoint(1, +zL + z0, +r0)
855 g.SetLineColor(18)
856 g.SetLineWidth(1)
857 g.SetLineStyle(3)
858 self.bklmZY.append(g)
859 g = ROOT.TGraph()
860 g.SetPoint(0, +zL + z0, -x0)
861 g.SetPoint(1, +zL + z0, -r0)
862 g.SetLineColor(18)
863 g.SetLineWidth(1)
864 g.SetLineStyle(3)
865 self.bklmZY.append(g)
866 g = ROOT.TGraph()
867 g.SetPoint(0, -zL + z0, r0)
868 g.SetPoint(1, +zL + z0, r0)
869 g.SetPoint(2, +zL + z0, rF)
870 g.SetPoint(3, -zL + z0, rF)
871 g.SetPoint(4, -zL + z0, r0)
872 g.SetLineColor(18)
873 g.SetLineWidth(1)
874 self.bklmZY.append(g)
875 g = ROOT.TGraph()
876 g.SetPoint(0, -zL + z0, -r0)
877 g.SetPoint(1, +zL + z0, -r0)
878 g.SetPoint(2, +zL + z0, -rF)
879 g.SetPoint(3, -zL + z0, -rF)
880 g.SetPoint(4, -zL + z0, -r0)
881 g.SetLineColor(18)
882 g.SetLineWidth(1)
883 self.bklmZY.append(g)
884 g = ROOT.TGraph()
885 g.SetPoint(0, -zL + z0, -x0)
886 g.SetPoint(1, +zL + z0, -x0)
887 g.SetPoint(2, +zL + z0, +x0)
888 g.SetPoint(3, -zL + z0, +x0)
889 g.SetPoint(4, -zL + z0, -x0)
890 g.SetLineColor(18)
891 g.SetLineWidth(1)
892 self.bklmZY.append(g)
893
894 def terminate(self):
895 """Handle job termination: draw histograms, close output files"""
896
897 if self.maxDisplays > 0:
898 pdfNameLast = f'{self.eventPdfName}]'
899 self.eventCanvas.Print(pdfNameLast, self.lastTitle)
900
901 for sectorFB in range(0, 16):
902 mappedScintSectorOccupancy = self.hist_mappedScintSectorOccupancy.GetBinContent(sectorFB + 1)
903 if mappedScintSectorOccupancy > 0:
904 for laneAxis in range(0, 42):
905 numerator = self.hist_mappedScintLaneAxisOccupancy.GetBinContent(sectorFB + 1, laneAxis + 1)
906 self.hist_mappedScintLaneAxisOccupancy.SetBinContent(
907 sectorFB + 1, laneAxis + 1, 100.0 * numerator / mappedScintSectorOccupancy)
908 mappedRPCSectorOccupancy = self.hist_mappedRPCSectorOccupancy.GetBinContent(sectorFB + 1)
909 if mappedRPCSectorOccupancy > 0:
910 for laneAxis in range(0, 42):
911 numerator = self.hist_mappedRPCLaneAxisOccupancy.GetBinContent(sectorFB + 1, laneAxis + 1)
912 self.hist_mappedRPCLaneAxisOccupancy.SetBinContent(
913 sectorFB + 1, laneAxis + 1, 100.0 * numerator / mappedRPCSectorOccupancy)
914 unmappedScintSectorOccupancy = self.hist_unmappedScintSectorOccupancy.GetBinContent(sectorFB + 1)
915 if unmappedScintSectorOccupancy > 0:
916 for laneAxis in range(0, 42):
917 numerator = self.hist_unmappedScintLaneAxisOccupancy.GetBinContent(sectorFB + 1, laneAxis + 1)
918 self.hist_unmappedScintLaneAxisOccupancy.SetBinContent(
919 sectorFB + 1, laneAxis + 1, 100.0 * numerator / unmappedScintSectorOccupancy)
920 unmappedRPCSectorOccupancy = self.hist_unmappedRPCSectorOccupancy.GetBinContent(sectorFB + 1)
921 if unmappedRPCSectorOccupancy > 0:
922 for laneAxis in range(0, 42):
923 numerator = self.hist_unmappedRPCLaneAxisOccupancy.GetBinContent(sectorFB + 1, laneAxis + 1)
924 self.hist_unmappedRPCLaneAxisOccupancy.SetBinContent(
925 sectorFB + 1, laneAxis + 1, 100.0 * numerator / unmappedRPCSectorOccupancy)
926 canvas = ROOT.TCanvas("canvas", self.pdfName, 1600, 1600)
927 title = f'{self.pdfName}['
928 canvas.SaveAs(title)
929 canvas.Clear()
930 canvas.GetPad(0).SetGrid(1, 1)
931 canvas.GetPad(0).Update()
932 self.hist_nDigit.Draw()
933 canvas.Print(self.pdfName, f"Title:{self.hist_nDigit.GetName()}")
934 if self.verbosity > 0:
935 self.hist_nRawKLM.Draw()
936 canvas.Print(self.pdfName, f"Title:{self.hist_nRawKLM.GetName()}")
937 self.hist_rawKLMnumEvents.Draw()
938 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMnumEvents.GetName()}")
939 self.hist_rawKLMnumNodes.Draw()
940 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMnumNodes.GetName()}")
941 self.hist_rawKLMnodeID.Draw("box")
942 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMnodeID.GetName()}")
943 self.hist_rawKLMlaneFlag.Draw("box")
944 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMlaneFlag.GetName()}")
945 # self.hist_rawKLMtdcExtraRPC.Draw("box")
946 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_rawKLMtdcExtraRPC.GetName()))
947 # self.hist_rawKLMadcExtraRPC.Draw("box")
948 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_rawKLMadcExtraRPC.GetName()))
949 # self.hist_rawKLMtdcExtraScint.Draw("box")
950 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_rawKLMtdcExtraScint.GetName()))
951 # self.hist_rawKLMadcExtraScint.Draw("box")
952 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_rawKLMadcExtraScint.GetName()))
953 if self.verbosity > 0:
954 self.hist_rawKLMsizeMultihit.Draw()
955 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMsizeMultihit.GetName()}")
956 for dc in range(0, 16):
957 self.hist_rawKLMsizeByDCMultihit[dc].Draw()
958 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMsizeByDCMultihit[dc].GetName()}")
959 self.hist_rawKLMsize.Draw()
960 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMsize.GetName()}")
961 if self.verbosity > 0:
962 for dc in range(0, 16):
963 self.hist_rawKLMsizeByDC[dc].Draw()
964 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMsizeByDC[dc].GetName()}")
965 for dc in range(0, 16):
966 self.hist_rawKLMchannelMultiplicity[dc].Draw("box")
967 canvas.Print(self.pdfName, f"Title:{self.hist_rawKLMchannelMultiplicity[dc].GetName()}")
968 # self.hist_mappedSectorOccupancy.Draw()
969 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_mappedSectorOccupancy.GetName()))
970 # self.hist_unmappedSectorOccupancy.Draw()
971 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_unmappedSectorOccupancy.GetName()))
972 if self.verbosity > 0:
974 canvas.Print(self.pdfName, f"Title:{self.hist_mappedRPCSectorOccupancy.GetName()}")
976 canvas.Print(self.pdfName, f"Title:{self.hist_unmappedRPCSectorOccupancy.GetName()}")
978 canvas.Print(self.pdfName, f"Title:{self.hist_unmappedScintSectorOccupancy.GetName()}")
980 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintSectorOccupancy.GetName()}")
981 canvas.Clear()
982 canvas.Divide(2, 1)
983 canvas.GetPad(0).SetGrid(1, 1)
984 canvas.GetPad(1).SetGrid(1, 1)
985 canvas.GetPad(2).SetGrid(1, 1)
986 # border of mapped z-readout channels for RPCs (axis=0)
987 borderRPC0x = [7.5, 20.5, 20.5, 7.5, 7.5]
988 borderRPC0y = [0.5, 0.5, 48.5, 48.5, 0.5]
989 borderRPC0yChimney = [0.5, 0.5, 34.5, 34.5, 0.5]
990 # border of mapped phi-readout channels for scints (axis=0)
991 borderScint0x = [0.5, 1.5, 1.5, 2.5, 2.5, 1.5, 1.5, 0.5, 0.5]
992 borderScint0y = [4.5, 4.5, 2.5, 2.5, 44.5, 44.5, 41.5, 41.5, 4.5]
993 # border of mapped phi-readout channels for RPCs (axis=1)
994 borderRPC1x = [7.5, 20.5, 20.5, 11.5, 11.5, 7.5, 7.5]
995 borderRPC1y = [0.5, 0.5, 48.5, 48.5, 36.5, 36.5, 0.5]
996 # border of mapped z-readout channels for scints (axis=1)
997 borderScint1x = [0.5, 2.5, 2.5, 0.5, 0.5]
998 borderScint1ay = [0.5, 0.5, 9.5, 9.5, 0.5]
999 borderScint1by = [15.5, 15.5, 60.5, 60.5, 15.5]
1000 borderScint1xChimney = [0.5, 1.5, 1.5, 2.5, 2.5, 1.5, 1.5, 0.5, 0.5]
1001 borderScint1ayChimney = [0.5, 0.5, 0.5, 0.5, 9.5, 9.5, 8.5, 8.5, 0.5]
1002 borderScint1byChimney = [15.5, 15.5, 16.5, 16.5, 45.5, 45.5, 45.5, 45.5, 15.5]
1003 # graphs of z-readout-channel borders for RPCs (axis=0)
1004 graphRPC0 = self.makeGraph(borderRPC0x, borderRPC0y)
1005 graphRPC0Chimney = self.makeGraph(borderRPC0x, borderRPC0yChimney)
1006 # graph of phi-readout-channel border for scints (axis=0)
1007 graphScint0 = self.makeGraph(borderScint0x, borderScint0y)
1008 # graph of phi-readout-channel border for RPCs (axis=1)
1009 graphRPC1 = self.makeGraph(borderRPC1x, borderRPC1y)
1010 # graphs of z-readout-channel borders for scints (axis=1)
1011 graphScint1a = self.makeGraph(borderScint1x, borderScint1ay)
1012 graphScint1b = self.makeGraph(borderScint1x, borderScint1by)
1013 graphScint1aChimney = self.makeGraph(borderScint1xChimney, borderScint1ayChimney)
1014 graphScint1bChimney = self.makeGraph(borderScint1xChimney, borderScint1byChimney)
1015 # labels for the above borders
1016 textRPC0 = self.makeText(6.8, 25.0, "RPC z")
1017 textScint0 = self.makeText(3.2, 25.0, "Scint #phi")
1018 textRPC1 = self.makeText(6.8, 25.0, "RPC #phi")
1019 textScint1 = self.makeText(3.2, 25.0, "Scint z")
1020 for sectorFB in range(0, 16):
1021 zmax = 1
1022 for lane in range(8, 21):
1023 for channel in range(0, 64):
1024 z = self.hist_mappedChannelOccupancyPrompt[sectorFB][0].GetBinContent(lane + 1, channel + 1)
1025 zmax = z if z > zmax else zmax
1026 self.hist_mappedChannelOccupancyPrompt[sectorFB][0].SetMaximum(zmax)
1027 canvas.cd(1)
1028 self.hist_mappedChannelOccupancyPrompt[sectorFB][0].Draw("colz") # z hits
1029 if sectorFB == 2:
1030 graphRPC0Chimney.Draw("L")
1031 graphScint1aChimney.Draw("L")
1032 graphScint1bChimney.Draw("L")
1033 else:
1034 graphRPC0.Draw("L")
1035 graphScint1a.Draw("L")
1036 graphScint1b.Draw("L")
1037 textRPC0.Draw()
1038 textScint1.Draw()
1039 zmax = 1
1040 for lane in range(8, 21):
1041 for channel in range(0, 64):
1042 z = self.hist_mappedChannelOccupancyPrompt[sectorFB][1].GetBinContent(lane + 1, channel + 1)
1043 zmax = z if z > zmax else zmax
1044 self.hist_mappedChannelOccupancyPrompt[sectorFB][1].SetMaximum(zmax)
1045 canvas.cd(2)
1046 self.hist_mappedChannelOccupancyPrompt[sectorFB][1].Draw("colz") # phi hits
1047 graphRPC1.Draw("L")
1048 graphScint0.Draw("L")
1049 textRPC1.Draw()
1050 textScint0.Draw()
1051 canvas.Print(self.pdfName, f"Title:{self.hist_mappedChannelOccupancyPrompt[sectorFB][0].GetName()}")
1052 if self.verbosity > 0:
1053 for sectorFB in range(0, 16):
1054 zmax = 1
1055 for lane in range(8, 21):
1056 for channel in range(0, 64):
1057 z = self.hist_mappedChannelOccupancyBkgd[sectorFB][0].GetBinContent(lane + 1, channel + 1)
1058 zmax = z if z > zmax else zmax
1059 self.hist_mappedChannelOccupancyBkgd[sectorFB][0].SetMaximum(zmax)
1060 canvas.cd(1)
1061 self.hist_mappedChannelOccupancyBkgd[sectorFB][0].Draw("colz") # z hits
1062 if sectorFB == 2:
1063 graphRPC0Chimney.Draw("L")
1064 graphScint1aChimney.Draw("L")
1065 graphScint1bChimney.Draw("L")
1066 else:
1067 graphRPC0.Draw("L")
1068 graphScint1a.Draw("L")
1069 graphScint1b.Draw("L")
1070 textRPC0.Draw()
1071 textScint1.Draw()
1072 zmax = 1
1073 for lane in range(8, 21):
1074 for channel in range(0, 64):
1075 z = self.hist_mappedChannelOccupancyBkgd[sectorFB][1].GetBinContent(lane + 1, channel + 1)
1076 zmax = z if z > zmax else zmax
1077 self.hist_mappedChannelOccupancyBkgd[sectorFB][1].SetMaximum(zmax)
1078 canvas.cd(2)
1079 self.hist_mappedChannelOccupancyBkgd[sectorFB][1].Draw("colz") # phi hits
1080 graphRPC1.Draw("L")
1081 graphScint0.Draw("L")
1082 textRPC1.Draw()
1083 textScint0.Draw()
1084 canvas.Print(self.pdfName, f"Title:{self.hist_mappedChannelOccupancyBkgd[sectorFB][0].GetName()}")
1085 for sectorFB in range(0, 16):
1086 canvas.cd(1)
1087 self.hist_unmappedChannelOccupancy[sectorFB][0].Draw("colz") # z hits
1088 if sectorFB == 2:
1089 graphRPC0Chimney.Draw("L")
1090 graphScint1aChimney.Draw("L")
1091 graphScint1bChimney.Draw("L")
1092 else:
1093 graphRPC0.Draw("L")
1094 graphScint1a.Draw("L")
1095 graphScint1b.Draw("L")
1096 textRPC0.Draw()
1097 textScint1.Draw()
1098 canvas.cd(2)
1099 self.hist_unmappedChannelOccupancy[sectorFB][1].Draw("colz") # phi hits
1100 graphRPC1.Draw("L")
1101 graphScint0.Draw("L")
1102 textRPC1.Draw()
1103 textScint0.Draw()
1104 canvas.Print(self.pdfName, f"Title:{self.hist_unmappedChannelOccupancy[sectorFB][0].GetName()}")
1105 canvas.Clear()
1106 canvas.Divide(1, 1)
1107 # self.hist_RPCTimeLowBitsBySector.Draw("box")
1108 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_RPCTimeLowBitsBySector.GetName()))
1109 timeFit = ROOT.TF1("timeFit", "gausn(0)+pol0(3)", 100.0, 500.0)
1110 timeFit.SetParName(0, "Area")
1111 timeFit.SetParName(1, "Mean")
1112 timeFit.SetParName(2, "Sigma")
1113 timeFit.SetParName(3, "Bkgd")
1114 timeFit.SetParLimits(2, 10.0, 80.0)
1115 n = self.hist_mappedRPCTime.GetEntries()
1116 timeFit.SetParameter(0, n)
1117 timeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1118 timeFit.SetParameter(1, 320.0)
1119 timeFit.SetParameter(2, 20.0)
1120 timeFit.SetParameter(3, 100.0)
1121 self.hist_mappedRPCTime.Fit("timeFit", "QR")
1122 self.hist_mappedRPCTime.Draw()
1123 canvas.Print(self.pdfName, f"Title:{self.hist_mappedRPCTime.GetName()}")
1124 self.hist_mappedRPCTimeBySector.Draw("box")
1125 canvas.Print(self.pdfName, f"Title:{self.hist_mappedRPCTimeBySector.GetName()}")
1126 n = self.hist_mappedRPCTimeCal.GetEntries()
1127 timeFit.SetParameter(0, n)
1128 timeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1129 timeFit.SetParameter(1, 320.0)
1130 timeFit.SetParameter(2, 20.0)
1131 timeFit.SetParameter(3, 100.0)
1132 self.hist_mappedRPCTimeCal.Fit("timeFit", "QR")
1133 self.hist_mappedRPCTimeCal.Draw()
1134 canvas.Print(self.pdfName, f"Title:{self.hist_mappedRPCTimeCal.GetName()}")
1135 self.hist_mappedRPCTimeCalBySector.Draw("box")
1136 canvas.Print(self.pdfName, f"Title:{self.hist_mappedRPCTimeCalBySector.GetName()}")
1137 if self.verbosity > 0:
1138 self.hist_unmappedRPCTime.Draw()
1139 canvas.Print(self.pdfName, f"Title:{self.hist_unmappedRPCTime.GetName()}")
1140 self.hist_unmappedRPCTimeBySector.Draw("box")
1141 canvas.Print(self.pdfName, f"Title:{self.hist_unmappedRPCTimeBySector.GetName()}")
1142 for sectorFB in range(0, 16):
1143 for layer in range(2, 15):
1144 n = self.hist_mappedRPCPhiTimePerLayer[sectorFB][layer].GetEntries()
1145 timeFit.SetParameter(0, n)
1146 timeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1147 timeFit.SetParameter(1, 320.0)
1148 timeFit.SetParameter(2, 20.0)
1149 timeFit.SetParameter(3, 100.0)
1150 self.hist_mappedRPCPhiTimePerLayer[sectorFB][layer].Fit("timeFit", "QR")
1151 self.hist_mappedRPCPhiTimePerLayer[sectorFB][layer].Draw()
1152 canvas.Print(self.pdfName, f"Title:{self.hist_mappedRPCPhiTimePerLayer[sectorFB][layer].GetName()}")
1153 for sectorFB in range(0, 16):
1154 for layer in range(2, 15):
1155 n = self.hist_mappedRPCZTimePerLayer[sectorFB][layer].GetEntries()
1156 timeFit.SetParameter(0, n)
1157 timeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1158 timeFit.SetParameter(1, 320.0)
1159 timeFit.SetParameter(2, 20.0)
1160 timeFit.SetParameter(3, 100.0)
1161 self.hist_mappedRPCZTimePerLayer[sectorFB][layer].Fit("timeFit", "QR")
1162 self.hist_mappedRPCZTimePerLayer[sectorFB][layer].Draw()
1163 canvas.Print(self.pdfName, f"Title:{self.hist_mappedRPCZTimePerLayer[sectorFB][layer].GetName()}")
1164 # self.hist_ScintTimeLowBitsBySector.Draw("box")
1165 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_ScintTimeLowBitsBySector.GetName()))
1166 # self.hist_mappedScintTDC.Draw()
1167 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_mappedScintTDC.GetName()))
1168 # self.hist_mappedScintTDCBySector.Draw("box")
1169 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_mappedScintTDCBySector.GetName()))
1170 # self.hist_mappedScintTime.Draw()
1171 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_mappedScintTime.GetName()))
1172 # self.hist_mappedScintTimeBySector.Draw("box")
1173 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_mappedScintTimeBySector.GetName()))
1174 # self.hist_unmappedScintTime.Draw()
1175 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_unmappedScintTime.GetName()))
1176 # self.hist_unmappedScintTimeBySector.Draw("box")
1177 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_unmappedScintTimeBySector.GetName()))
1178 ctimeFit = ROOT.TF1("ctimeFit", "gausn(0)+pol0(3)", 300.0, 700.0)
1179 ctimeFit.SetParName(0, "Area")
1180 ctimeFit.SetParName(1, "Mean")
1181 ctimeFit.SetParName(2, "Sigma")
1182 ctimeFit.SetParName(3, "Bkgd")
1183 ctimeFit.SetParLimits(2, 10.0, 80.0)
1184 n = 32 * self.hist_mappedScintCtime.GetEntries()
1185 ctimeFit.SetParameter(0, n)
1186 ctimeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1187 ctimeFit.SetParameter(1, 450.0)
1188 ctimeFit.SetParameter(2, 40.0)
1189 ctimeFit.SetParameter(3, 10.0)
1190 self.hist_mappedScintCtime.Fit("ctimeFit", "QR")
1191 self.hist_mappedScintCtime.Draw()
1192 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintCtime.GetName()}")
1193 self.hist_mappedScintCtimeBySector.Draw("box")
1194 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintCtimeBySector.GetName()}")
1195 n = 32 * self.hist_mappedScintCtimeCal.GetEntries()
1196 ctimeFit.SetParameter(0, n)
1197 ctimeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1198 ctimeFit.SetParameter(1, 450.0)
1199 ctimeFit.SetParameter(2, 40.0)
1200 ctimeFit.SetParameter(3, 10.0)
1201 self.hist_mappedScintCtimeCal.Fit("ctimeFit", "QR")
1202 self.hist_mappedScintCtimeCal.Draw()
1203 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintCtimeCal.GetName()}")
1204 self.hist_mappedScintCtimeCalBySector.Draw("box")
1205 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintCtimeCalBySector.GetName()}")
1206 if self.verbosity > 0:
1207 self.hist_unmappedScintCtime.Draw()
1208 canvas.Print(self.pdfName, f"Title:{self.hist_unmappedScintCtime.GetName()}")
1209 self.hist_unmappedScintCtimeBySector.Draw("box")
1210 canvas.Print(self.pdfName, f"Title:{self.hist_unmappedScintCtimeBySector.GetName()}")
1211 for sectorFB in range(0, 16):
1212 for layer in range(0, 2):
1213 n = 32 * self.hist_mappedScintPhiCtimePerLayer[sectorFB][layer].GetEntries()
1214 ctimeFit.SetParameter(0, n)
1215 ctimeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1216 ctimeFit.SetParameter(1, 440.0)
1217 ctimeFit.SetParameter(2, 40.0)
1218 ctimeFit.SetParameter(3, 10.0)
1219 self.hist_mappedScintPhiCtimePerLayer[sectorFB][layer].Fit("ctimeFit", "QR")
1220 self.hist_mappedScintPhiCtimePerLayer[sectorFB][layer].Draw()
1221 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintPhiCtimePerLayer[sectorFB][layer].GetName()}")
1222 for sectorFB in range(0, 16):
1223 for layer in range(0, 2):
1224 n = 32 * self.hist_mappedScintZCtimePerLayer[sectorFB][layer].GetEntries()
1225 ctimeFit.SetParameter(0, n)
1226 ctimeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1227 ctimeFit.SetParameter(1, 440.0)
1228 ctimeFit.SetParameter(2, 40.0)
1229 ctimeFit.SetParameter(3, 10.0)
1230 self.hist_mappedScintZCtimePerLayer[sectorFB][layer].Fit("ctimeFit", "QR")
1231 self.hist_mappedScintZCtimePerLayer[sectorFB][layer].Draw()
1232 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintZCtimePerLayer[sectorFB][layer].GetName()}")
1233 self.hist_mappedRPCCtimeRangeBySector.Draw("box")
1234 canvas.Print(self.pdfName, f"Title:{self.hist_mappedRPCCtimeRangeBySector.GetName()}")
1235 canvas.SetLogy(0)
1236 self.hist_tdcRangeRPC.Draw()
1237 canvas.Print(self.pdfName, f"Title:{self.hist_tdcRangeRPC.GetName()}")
1238 canvas.SetLogy(1)
1239 self.hist_tdcRangeRPC.Draw("")
1240 canvas.Print(self.pdfName, f"Title:{self.hist_tdcRangeRPC.GetName()}")
1241 canvas.SetLogy(0)
1242 self.hist_ctimeRangeRPC.Draw()
1243 canvas.Print(self.pdfName, f"Title:{self.hist_ctimeRangeRPC.GetName()}")
1244 canvas.SetLogy(1)
1245 self.hist_ctimeRangeRPC.Draw()
1246 canvas.Print(self.pdfName, f"Title:{self.hist_ctimeRangeRPC.GetName()}")
1247 canvas.SetLogy(0)
1248 canvas.SetLogz(0)
1249 self.hist_tdcRangeVsCtimeRangeRPC.Draw("BOX")
1250 canvas.Print(self.pdfName, f"Title:{self.hist_tdcRangeVsCtimeRangeRPC.GetName()}")
1251 canvas.SetLogz(1)
1252 self.hist_tdcRangeVsCtimeRangeRPC.Draw("COLZ")
1253 canvas.Print(self.pdfName, f"Title:{self.hist_tdcRangeVsCtimeRangeRPC.GetName()}")
1254 canvas.SetLogz(0)
1255 self.hist_tdcRangeVsTimeRPC.Draw("BOX")
1256 canvas.Print(self.pdfName, f"Title:{self.hist_tdcRangeVsTimeRPC.GetName()}")
1257 canvas.SetLogz(1)
1258 self.hist_tdcRangeVsTimeRPC.Draw("COLZ")
1259 canvas.Print(self.pdfName, f"Title:{self.hist_tdcRangeVsTimeRPC.GetName()}")
1260 canvas.SetLogz(0)
1261 self.hist_ctimeRangeVsTimeRPC.Draw("BOX")
1262 canvas.Print(self.pdfName, f"Title:{self.hist_ctimeRangeVsTimeRPC.GetName()}")
1263 canvas.SetLogz(1)
1264 self.hist_ctimeRangeVsTimeRPC.Draw("COLZ")
1265 canvas.Print(self.pdfName, f"Title:{self.hist_ctimeRangeVsTimeRPC.GetName()}")
1266 canvas.SetLogz(0)
1267 self.hist_mappedScintCtimeRange.Draw()
1268 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintCtimeRange.GetName()}")
1269 self.hist_mappedScintCtimeRangeBySector.Draw("box")
1270 canvas.Print(self.pdfName, f"Title:{self.hist_mappedScintCtimeRangeBySector.GetName()}")
1271
1272 self.hist_nHit1d.Draw()
1273 canvas.Print(self.pdfName, f"Title:{self.hist_nHit1d.GetName()}")
1274 self.hist_n1dPhiZ.Draw("box")
1275 canvas.Print(self.pdfName, f"Title:{self.hist_n1dPhiZ.GetName()}")
1276 # self.hist_nHit1dRPCPrompt.Draw()
1277 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_nHit1dRPCPrompt.GetName()))
1278 # self.hist_nHit1dRPCBkgd.Draw()
1279 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_nHit1dRPCBkgd.GetName()))
1280 # self.hist_nHit1dScint.Draw()
1281 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_nHit1dScint.GetName()))
1282 # self.hist_nHit1dPrompt.Draw()
1283 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_nHit1dPrompt.GetName()))
1284 # self.hist_nHit1dBkgd.Draw()
1285 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_nHit1dBkgd.GetName()))
1286 # self.hist_multiplicityPhiBySector.Draw("box")
1287 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_multiplicityPhiBySector.GetName()))
1288 # self.hist_multiplicityZBySector.Draw("box")
1289 # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_multiplicityZBySector.GetName()))
1290 n = self.hist_tphiRPCCal1d.GetEntries()
1291 timeFit.SetParameter(0, n)
1292 timeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1293 timeFit.SetParameter(1, 330.0)
1294 timeFit.SetParameter(2, 15.0)
1295 timeFit.SetParameter(3, 100.0)
1296 self.hist_tphiRPCCal1d.Fit("timeFit", "QR")
1297 self.hist_tphiRPCCal1d.Draw()
1298 canvas.Print(self.pdfName, f"Title:{self.hist_tphiRPCCal1d.GetName()}")
1299 n = self.hist_tzRPCCal1d.GetEntries()
1300 timeFit.SetParameter(0, n)
1301 timeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1302 timeFit.SetParameter(1, 330.0)
1303 timeFit.SetParameter(2, 15.0)
1304 timeFit.SetParameter(3, 100.0)
1305 self.hist_tzRPCCal1d.Fit("timeFit", "QR")
1306 self.hist_tzRPCCal1d.Draw()
1307 canvas.Print(self.pdfName, f"Title:{self.hist_tzRPCCal1d.GetName()}")
1308 if self.verbosity > 0:
1309 n = self.hist_tRPCCal1d.GetEntries()
1310 timeFit.SetParameter(0, n)
1311 timeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1312 timeFit.SetParameter(1, 330.0)
1313 timeFit.SetParameter(2, 15.0)
1314 timeFit.SetParameter(3, 100.0)
1315 self.hist_tRPCCal1d.Fit("timeFit", "QR")
1316 self.hist_tRPCCal1d.Draw()
1317 canvas.Print(self.pdfName, f"Title:{self.hist_tRPCCal1d.GetName()}")
1318 self.hist_dtRPC1d.Draw()
1319 canvas.Print(self.pdfName, f"Title:{self.hist_dtRPC1d.GetName()}")
1320 n = 32 * self.hist_ctphiScintCal1d.GetEntries()
1321 ctimeFit.SetParameter(0, n)
1322 ctimeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1323 ctimeFit.SetParameter(1, 520.0)
1324 ctimeFit.SetParameter(2, 40.0)
1325 ctimeFit.SetParameter(3, 10.0)
1326 self.hist_ctphiScintCal1d.Fit("ctimeFit", "QR")
1327 self.hist_ctphiScintCal1d.Draw()
1328 canvas.Print(self.pdfName, f"Title:{self.hist_ctphiScintCal1d.GetName()}")
1329 n = 32 * self.hist_ctzScintCal1d.GetEntries()
1330 ctimeFit.SetParameter(0, n)
1331 ctimeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1332 ctimeFit.SetParameter(1, 520.0)
1333 ctimeFit.SetParameter(2, 40.0)
1334 ctimeFit.SetParameter(3, 10.0)
1335 self.hist_ctzScintCal1d.Fit("ctimeFit", "QR")
1336 self.hist_ctzScintCal1d.Draw()
1337 canvas.Print(self.pdfName, f"Title:{self.hist_ctzScintCal1d.GetName()}")
1338 if self.verbosity > 0:
1339 n = 32 * self.hist_ctScintCal1d.GetEntries()
1340 ctimeFit.SetParameter(0, n)
1341 ctimeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1342 ctimeFit.SetParameter(1, 520.0)
1343 ctimeFit.SetParameter(2, 40.0)
1344 ctimeFit.SetParameter(3, 10.0)
1345 self.hist_ctScintCal1d.Fit("ctimeFit", "QR")
1346 self.hist_ctScintCal1d.Draw()
1347 canvas.Print(self.pdfName, f"Title:{self.hist_ctScintCal1d.GetName()}")
1348 self.hist_dtScint1d.Draw()
1349 canvas.Print(self.pdfName, f"Title:{self.hist_dtScint1d.GetName()}")
1350
1351 self.hist_nHit2d.Draw()
1352 canvas.Print(self.pdfName, f"Title:{self.hist_nHit2d.GetName()}")
1353 self.hist_occupancyForwardXYPrompt.Draw("colz")
1354 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyForwardXYPrompt.GetName()}")
1355 self.hist_occupancyBackwardXYPrompt.Draw("colz")
1356 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyBackwardXYPrompt.GetName()}")
1357 if self.verbosity > 0:
1358 self.hist_occupancyForwardXYBkgd.Draw("colz")
1359 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyForwardXYBkgd.GetName()}")
1360 self.hist_occupancyBackwardXYBkgd.Draw("colz")
1361 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyBackwardXYBkgd.GetName()}")
1362 self.hist_occupancyRZPrompt.Draw("colz")
1363 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyRZPrompt.GetName()}")
1364 self.hist_occupancyZPrompt.Draw()
1365 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyZPrompt.GetName()}")
1366 self.hist_occupancyRPrompt.Draw()
1367 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyRPrompt.GetName()}")
1368 self.hist_occupancyRZBkgd.Draw("colz")
1369 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyRZBkgd.GetName()}")
1370 self.hist_occupancyZBkgd.Draw()
1371 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyZBkgd.GetName()}")
1372 self.hist_occupancyRBkgd.Draw()
1373 canvas.Print(self.pdfName, f"Title:{self.hist_occupancyRBkgd.GetName()}")
1374 self.hist_tVsZFwd.Draw()
1375 canvas.Print(self.pdfName, f"Title:{self.hist_tVsZFwd.GetName()}")
1376 self.hist_tVsZBwd.Draw()
1377 canvas.Print(self.pdfName, f"Title:{self.hist_tVsZFwd.GetName()}")
1378 timeFit.SetParameter(0, self.hist_tRPCCal2d.GetEntries())
1379 n = self.hist_tRPCCal2d.GetEntries()
1380 timeFit.SetParameter(0, n)
1381 timeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1382 timeFit.SetParameter(1, 320.0)
1383 timeFit.SetParameter(2, 20.0)
1384 timeFit.SetParameter(3, 100.0)
1385 self.hist_tRPCCal2d.Fit("timeFit", "QR")
1386 self.hist_tRPCCal2d.Draw()
1387 canvas.Print(self.pdfName, f"Title:{self.hist_tRPCCal2d.GetName()}")
1388 self.hist_tRPCCal2dBySector.Draw("box")
1389 canvas.Print(self.pdfName, f"Title:{self.hist_tRPCCal2dBySector.GetName()}")
1390 n = 32 * self.hist_ctScintCal2d.GetEntries()
1391 ctimeFit.SetParameter(0, n)
1392 ctimeFit.SetParLimits(0, 0.2 * n, 5.0 * n)
1393 ctimeFit.SetParameter(1, 500.0)
1394 ctimeFit.SetParameter(2, 40.0)
1395 ctimeFit.SetParameter(3, 10.0)
1396 self.hist_ctScintCal2d.Fit("ctimeFit", "QR")
1397 self.hist_ctScintCal2d.Draw()
1398 canvas.Print(self.pdfName, f"Title:{self.hist_ctScintCal2d.GetName()}")
1399 self.hist_ctScintCal2dBySector.Draw("box")
1400 canvas.Print(self.pdfName, f"Title:{self.hist_ctScintCal2dBySector.GetName()}")
1401 # the last page of the PDF file has to have "]" at the end of the PDF filename
1402 pdfNameLast = f'{self.pdfName}]'
1403 canvas.Print(pdfNameLast, f"Title:{self.hist_ctScintCal2dBySector.GetName()}")
1404 self.histogramFile.Write()
1405 self.histogramFile.Close()
1406 print('Goodbye')
1407
1408 def beginRun(self):
1409 """Handle begin of run: print diagnostic message"""
1410 EventMetaData = Belle2.PyStoreObj('EventMetaData')
1411 print('beginRun', EventMetaData.getRun())
1412
1413 def endRun(self):
1414 """Handle end of run: print diagnostic message"""
1415 EventMetaData = Belle2.PyStoreObj('EventMetaData')
1416 print('endRun', EventMetaData.getRun())
1417
1418 def event(self):
1419 """Process one event: fill histograms, (optionally) draw event display"""
1420
1421 self.eventCounter += 1
1422 EventMetaData = Belle2.PyStoreObj('EventMetaData')
1423 event = EventMetaData.getEvent()
1424 rawklms = Belle2.PyStoreArray('RawKLMs')
1425 digits = Belle2.PyStoreArray('BKLMDigits')
1426 hit1ds = Belle2.PyStoreArray('BKLMHit1ds')
1427 hit2ds = Belle2.PyStoreArray('KLMHit2ds')
1428 self.hist_nRawKLM.Fill(len(rawklms))
1429 self.hist_nDigit.Fill(len(digits))
1430 self.hist_nHit1d.Fill(len(hit1ds))
1431 self.hist_nHit2d.Fill(len(hit2ds))
1432
1433 tCal1d = []
1434 for hit1d in hit1ds:
1435 tCal1d.append(hit1d.getTime())
1436 tCal2d = []
1437 for hit2d in hit2ds:
1438 tCal2d.append(hit2d.getTime())
1439
1440 countAllMultihit = 0
1441 countAll = 0
1442 count = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
1443 rawFb = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
1444 rawSector = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
1445 rawLayer = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
1446 rawPlane = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
1447 rawStrip = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
1448 rawCtime = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
1449 for copper in range(0, len(rawklms)):
1450 rawklm = rawklms[copper]
1451 self.hist_rawKLMnumEvents.Fill(rawklm.GetNumEvents())
1452 self.hist_rawKLMnumNodes.Fill(rawklm.GetNumNodes())
1453 if rawklm.GetNumEntries() != 1:
1454 print('##0 Event', event, 'copper', copper, ' getNumEntries=', rawklm.GetNumEntries())
1455 continue
1456 nodeID = rawklm.GetNodeID(0) - self.BKLM_ID
1457 if nodeID >= self.EKLM_ID - self.BKLM_ID:
1458 nodeID = nodeID - (self.EKLM_ID - self.BKLM_ID) + 4
1459 self.hist_rawKLMnodeID.Fill(nodeID, copper)
1460 if (nodeID < 0) or (nodeID > 4): # skip EKLM nodes
1461 continue
1462 trigCtime = (rawklm.GetTTCtime(0) & 0x7ffffff) << 3 # (ns)
1463 revo9time = trigCtime - 0x3b0
1464 for finesse in range(0, 4):
1465 dc = (finesse << 2) + copper
1466 nWords = rawklm.GetDetectorNwords(0, finesse)
1467 self.hist_rawKLMsizeByDCMultihit[dc].Fill(nWords)
1468 if nWords <= 0:
1469 continue
1470 countAllMultihit = countAllMultihit + nWords
1471 bufSlot = rawklm.GetDetectorBuffer(0, finesse)
1472 lastWord = bufSlot[nWords - 1]
1473 if lastWord & 0xffff != 0:
1474 print("##1 Event", event, 'copper', copper, 'finesse', finesse, 'n=', nWords, 'lastWord=', hex(lastWord))
1475 if (nWords % 2) == 0:
1476 print("##2 Event", event, 'copper', copper, 'finesse', finesse, 'n=', nWords, 'should be odd -- skipping')
1477 continue
1478 if int(self.exp) != 3: # revo9time was not stored in the last word of the data-packet list?
1479 revo9time = ((lastWord >> 16) << 3) & 0xffff
1480 dt = (trigCtime - revo9time) & 0x3ff
1481 if dt >= 0x200:
1482 dt -= 0x400
1483 self.hist_trigCtimeVsTrigRevo9time.Fill(dt)
1484 countAll += 1
1485 count[dc] += 1
1486 sectorFB = self.dcToSectorFB[dc]
1487 n = nWords >> 1 # number of Data-Concentrator data packets
1488 channelMultiplicity = {}
1489 minRPCCtime = 99999
1490 maxRPCCtime = 0
1491 minRPCtdc = 99999
1492 maxRPCtdc = 0
1493 minScintCtime = 99999
1494 maxScintCtime = 0
1495 # first pass over this DC: determine per-channel multiplicities, event time ranges, and
1496 # fill dictionaries for accessing RawKLM hit information from BLKMHit1ds and KLMHit2ds
1497 for j in range(0, n):
1498 word0 = bufSlot[j * 2]
1499 word1 = bufSlot[j * 2 + 1]
1500 ctime = word0 & 0xffff
1501 channel = (word0 >> 16) & 0x7f
1502 axis = (word0 >> 23) & 0x01
1503 lane = (word0 >> 24) & 0x1f # 1..2 for scints, 8..20 for RPCs (=readout-board slot - 7)
1504 flag = (word0 >> 30) & 0x03 # identifies scintillator or RPC hit
1505 adc = word1 & 0x0fff # noqa (F841) kept for completeness
1506 tdc = (word1 >> 16) & 0x07ff
1507 isRPC = (flag == 1)
1508 isScint = (flag == 2)
1509 laneAxisChannel = (word0 >> 16) & 0x1fff
1510 if laneAxisChannel not in channelMultiplicity:
1511 countAll = countAll + 2
1512 count[dc] = count[dc] + 2
1513 channelMultiplicity[laneAxisChannel] = 0
1514 channelMultiplicity[laneAxisChannel] += 1
1515 if isRPC:
1516 if ctime < minRPCCtime:
1517 minRPCCtime = ctime
1518 if ctime > maxRPCCtime:
1519 maxRPCCtime = ctime
1520 if tdc < minRPCtdc:
1521 minRPCtdc = tdc
1522 if tdc > maxRPCtdc:
1523 maxRPCtdc = tdc
1524 elif isScint:
1525 if int(self.exp) <= 3: # fix the ctime for old SCROD firmware
1526 trigCtx = trigCtime >> 3
1527 ctime = trigCtx - ((trigCtx - ctime) << 2)
1528 if ctime < minScintCtime:
1529 minScintCtime = ctime
1530 if ctime > maxScintCtime:
1531 maxScintCtime = ctime
1532 electId = (channel << 12) | (axis << 11) | (lane << 6) | (finesse << 4) | nodeID
1533 if electId in self.electIdToModuleId:
1534 moduleId = self.electIdToModuleId[electId]
1535 fb = (moduleId & self.BKLM_SECTION_MASK) >> self.BKLM_SECTION_BIT
1536 sector = (moduleId & self.BKLM_SECTOR_MASK) >> self.BKLM_SECTOR_BIT
1537 layer = (moduleId & self.BKLM_LAYER_MASK) >> self.BKLM_LAYER_BIT
1538 plane = (moduleId & self.BKLM_PLANE_MASK) >> self.BKLM_PLANE_BIT
1539 strip = (moduleId & self.BKLM_STRIP_MASK) >> self.BKLM_STRIP_BIT
1540 rawFb[dc].append(fb)
1541 rawSector[dc].append(sector)
1542 rawLayer[dc].append(layer)
1543 rawPlane[dc].append(plane)
1544 rawStrip[dc].append(strip)
1545 rawCtime[dc].append(ctime)
1546 else:
1547 rawFb[dc].append(-1)
1548 rawSector[dc].append(-1)
1549 rawLayer[dc].append(-1)
1550 rawPlane[dc].append(-1)
1551 rawStrip[dc].append(-1)
1552 rawCtime[dc].append(-1)
1553 tdcRangeRPC = maxRPCtdc - minRPCtdc # (ns)
1554 ctimeRangeRPC = (maxRPCCtime - minRPCCtime) << 3 # (ns)
1555 ctimeRangeScint = (maxScintCtime - minScintCtime) << 3 # (ns)
1556 if n > 1:
1557 if maxRPCCtime > 0:
1558 self.hist_mappedRPCCtimeRangeBySector.Fill(sectorFB, ctimeRangeRPC)
1559 if maxScintCtime > 0:
1560 self.hist_mappedScintCtimeRange.Fill(ctimeRangeScint)
1561 self.hist_mappedScintCtimeRangeBySector.Fill(sectorFB, ctimeRangeScint)
1562 # second pass over this DC's hits: histogram everything
1563 for j in range(0, n):
1564 word0 = bufSlot[j * 2]
1565 word1 = bufSlot[j * 2 + 1]
1566 ctime = word0 & 0xffff
1567 channel = (word0 >> 16) & 0x7f
1568 axis = (word0 >> 23) & 0x01
1569 lane = (word0 >> 24) & 0x1f # 1..2 for scints, 8..20 for RPCs (=readout-board slot - 7)
1570 flag = (word0 >> 30) & 0x03 # 1 for RPCs, 2 for scints
1571 electId = (channel << 12) | (axis << 11) | (lane << 6) | (finesse << 4) | nodeID
1572 tdc = (word1 >> 16) & 0x07ff
1573 adc = word1 & 0x0fff # noqa (F841) kept for completeness
1574 tdcExtra = (word1 >> 27) & 0x1f
1575 adcExtra = (word1 >> 12) & 0x0f
1576 isRPC = (flag == 1)
1577 isScint = (flag == 2)
1578 laneAxis = axis if ((lane < 1) or (lane > 20)) else ((lane << 1) + axis)
1579 laneAxisChannel = (word0 >> 16) & 0x1fff
1580 multiplicity = channelMultiplicity[laneAxisChannel]
1581 if multiplicity > 1: # histogram only if 2+ entries in the same channel
1582 self.hist_rawKLMchannelMultiplicity[dc].Fill(multiplicity, laneAxis)
1583 self.hist_rawKLMchannelMultiplicityFine[dc].Fill(multiplicity, laneAxisChannel)
1584 if (self.singleEntry == 1 and multiplicity > 1) or (self.singleEntry == 2 and multiplicity == 1):
1585 continue
1586 self.hist_rawKLMlaneFlag.Fill(flag, lane)
1587 if isRPC:
1588 self.hist_rawKLMtdcExtraRPC.Fill(sectorFB, tdcExtra)
1589 self.hist_rawKLMadcExtraRPC.Fill(sectorFB, adcExtra)
1590 elif isScint:
1591 self.hist_rawKLMtdcExtraScint.Fill(sectorFB, tdcExtra)
1592 self.hist_rawKLMadcExtraScint.Fill(sectorFB, adcExtra)
1593 if int(self.exp) <= 3: # fix the ctime for old SCROD firmware
1594 trigCtx = trigCtime >> 3
1595 ctime = trigCtx - ((trigCtx - ctime) << 2)
1596 t = (tdc - trigCtime) & 0x03ff # in ns, range is 0..1023
1597 ct = (ctime << 3) - (trigCtime & 0x7fff8) # in ns, range is only 8 bits in SCROD (??)
1598 ct = ct & 0x3ff
1599 if electId in self.electIdToModuleId: # mapped-channel histograms
1600 self.hist_mappedSectorOccupancyMultihit.Fill(sectorFB)
1601 if channelMultiplicity[laneAxisChannel] == 1:
1602 self.hist_mappedSectorOccupancy.Fill(sectorFB)
1603 if isRPC:
1604 self.hist_RPCTimeLowBitsBySector.Fill(sectorFB, (tdc & 3))
1605 tCal = int(tdc - trigCtime - self.t0RPC[axis][sectorFB][lane - 6]) & 0x03ff # in ns, range 0..1023
1606 if j == 0:
1607 self.hist_tdcRangeRPC.Fill(tdcRangeRPC)
1608 self.hist_ctimeRangeRPC.Fill(ctimeRangeRPC)
1609 self.hist_tdcRangeVsCtimeRangeRPC.Fill(tdcRangeRPC, ctimeRangeRPC)
1610 self.hist_tdcRangeVsTimeRPC.Fill(tCal, tdcRangeRPC)
1611 self.hist_ctimeRangeVsTimeRPC.Fill(tCal, ctimeRangeRPC)
1612 if abs(tCal - self.t0Cal) < 50:
1613 self.hist_mappedChannelOccupancyPrompt[sectorFB][axis].Fill(lane, channel)
1614 else:
1615 self.hist_mappedChannelOccupancyBkgd[sectorFB][axis].Fill(lane, channel)
1616 self.hist_mappedRPCSectorOccupancy.Fill(sectorFB)
1617 self.hist_mappedRPCLaneAxisOccupancy.Fill(sectorFB, laneAxis)
1618 self.hist_mappedRPCTime.Fill(t)
1619 self.hist_mappedRPCTimeCal.Fill(tCal)
1620 self.hist_mappedRPCTimeBySector.Fill(sectorFB, t)
1621 self.hist_mappedRPCTimeCalBySector.Fill(sectorFB, tCal)
1622 if axis == 0:
1623 self.hist_mappedRPCZTimePerLayer[sectorFB][lane - 6].Fill(t)
1624 else:
1625 self.hist_mappedRPCPhiTimePerLayer[sectorFB][lane - 6].Fill(t)
1626 elif isScint:
1627 self.hist_ScintTimeLowBitsBySector.Fill(sectorFB, (tdc & 3))
1628 ctCal = int((ctime << 3) - trigCtime - self.ct0Scint[1 - axis][sectorFB][lane - 1]) & 0x03ff # in ns
1629 if abs(ctCal - self.ct0Cal) < 50:
1630 self.hist_mappedChannelOccupancyPrompt[sectorFB][1 - axis].Fill(lane, channel)
1631 else:
1632 self.hist_mappedChannelOccupancyBkgd[sectorFB][1 - axis].Fill(lane, channel)
1633 self.hist_mappedScintSectorOccupancy.Fill(sectorFB)
1634 self.hist_mappedScintLaneAxisOccupancy.Fill(sectorFB, laneAxis)
1635 self.hist_mappedScintTime.Fill(t & 0x1f)
1636 self.hist_mappedScintTimeBySector.Fill(sectorFB, t & 0x1f)
1637 self.hist_mappedScintTDC.Fill(tdc)
1638 self.hist_mappedScintTDCBySector.Fill(sectorFB, tdc)
1639 self.hist_mappedScintCtime.Fill(ct)
1640 self.hist_mappedScintCtimeBySector.Fill(sectorFB, ct)
1641 self.hist_mappedScintCtimeCal.Fill(ctCal)
1642 self.hist_mappedScintCtimeCalBySector.Fill(sectorFB, ctCal)
1643 if axis == 1:
1644 self.hist_mappedScintZCtimePerLayer[sectorFB][lane - 1].Fill(ct)
1645 else:
1646 self.hist_mappedScintPhiCtimePerLayer[sectorFB][lane - 1].Fill(ct)
1647 else: # unmapped-channel histograms
1648 self.hist_unmappedSectorOccupancyMultihit.Fill(sectorFB)
1649 if channelMultiplicity[laneAxisChannel] == 1:
1650 self.hist_unmappedSectorOccupancy.Fill(sectorFB)
1651 if isRPC:
1652 self.hist_unmappedChannelOccupancy[sectorFB][axis].Fill(lane, channel)
1653 self.hist_RPCTimeLowBitsBySector.Fill(sectorFB, (tdc & 3))
1654 self.hist_unmappedRPCSectorOccupancy.Fill(sectorFB)
1655 self.hist_unmappedRPCLaneAxisOccupancy.Fill(sectorFB, laneAxis)
1656 self.hist_unmappedRPCTime.Fill(t)
1657 self.hist_unmappedRPCTimeBySector.Fill(sectorFB, t)
1658 elif isScint:
1659 self.hist_unmappedChannelOccupancy[sectorFB][1 - axis].Fill(lane, channel)
1660 self.hist_ScintTimeLowBitsBySector.Fill(sectorFB, (tdc & 3))
1661 self.hist_unmappedScintSectorOccupancy.Fill(sectorFB)
1662 self.hist_unmappedScintLaneAxisOccupancy.Fill(sectorFB, laneAxis)
1663 self.hist_unmappedScintTime.Fill(t & 0x1f)
1664 self.hist_unmappedScintTimeBySector.Fill(sectorFB, t & 0x1f)
1665 self.hist_unmappedScintCtime.Fill(ct)
1666 self.hist_unmappedScintCtimeBySector.Fill(sectorFB, ct)
1667 self.hist_rawKLMsizeByDC[dc].Fill(count[dc])
1668 self.hist_rawKLMsizeMultihit.Fill(countAllMultihit)
1669 self.hist_rawKLMsize.Fill(countAll)
1670
1671 # Process the BKLMHit1ds
1672
1673 cosine = [0, 0, 0, 0, 0, 0, 0, 0]
1674 sine = [0, 0, 0, 0, 0, 0, 0, 0]
1675 for sector in range(0, 8):
1676 phi = math.pi * sector / 4
1677 cosine[sector] = math.cos(phi)
1678 sine[sector] = math.sin(phi)
1679 zyList = [[], [], [], [], [], [], [], []]
1680 xyList = [[], [], [], [], [], [], [], []]
1681 r0 = 201.9 + 0.5 * 4.4 # cm
1682 dr = 9.1 # cm
1683 z0 = 47.0 # cm
1684 dzScint = 4.0 # cm
1685 dzRPC = 4.52 # cm
1686 nPhiStrips = [37, 42, 36, 36, 36, 36, 48, 48, 48, 48, 48, 48, 48, 48, 48]
1687 dPhiStrips = [4.0, 4.0, 4.9, 5.11, 5.32, 5.53, 4.3, 4.46, 4.62, 4.77, 4.93, 5.09, 5.25, 5.4, 5.56]
1688 scintFlip = [[[-1, 1], [-1, 1], [1, 1], [1, -1], [1, -1], [1, -1], [-1, -1], [-1, 1]],
1689 [[1, -1], [1, -1], [1, 1], [-1, 1], [-1, 1], [-1, 1], [-1, -1], [1, -1]]]
1690 promptColor = 3
1691 bkgdColor = 2
1692 phiTimes = {}
1693 zTimes = [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]
1694 nphihits = 0
1695 nzhits = 0
1696 nRPCPrompt = 0
1697 nRPCBkgd = 0
1698 nScint = 0
1699 for hit1d in hit1ds:
1700 key = hit1d.getModuleID()
1701 fb = (key & self.BKLM_SECTION_MASK) >> self.BKLM_SECTION_BIT
1702 sector = (key & self.BKLM_SECTOR_MASK) >> self.BKLM_SECTOR_BIT
1703 layer = (key & self.BKLM_LAYER_MASK) >> self.BKLM_LAYER_BIT
1704 plane = (key & self.BKLM_PLANE_MASK) >> self.BKLM_PLANE_BIT
1705 stripMin = (key & self.BKLM_STRIP_MASK) >> self.BKLM_STRIP_BIT
1706 stripMax = (key & self.BKLM_MAXSTRIP_MASK) >> self.BKLM_MAXSTRIP_BIT
1707 sectorFB = sector if fb == 0 else sector + 8
1708 if self.legacyTimes:
1709 dc = self.sectorFBToDC[sectorFB]
1710 copper = dc & 0x03
1711 finesse = dc >> 2
1712 n = rawklms[copper].GetDetectorNwords(0, finesse) >> 1
1713 trigCtime = (rawklms[copper].GetTTCtime(0) & 0x07ffffff) << 3
1714 tCal = -1
1715 ctDiffMax = 99999
1716 for j in range(0, n):
1717 if layer != rawLayer[dc][j]:
1718 continue
1719 if sector != rawSector[dc][j]:
1720 continue
1721 if fb != rawFb[dc][j]:
1722 continue
1723 if plane != rawPlane[dc][j]:
1724 continue
1725 strip = rawStrip[dc][j]
1726 if strip < stripMin:
1727 continue
1728 if strip > stripMax:
1729 continue
1730 if layer < 2: # it's a scint layer
1731 ctime = rawCtime[dc][j] << 3
1732 ct = ctime - trigCtime - self.ct0Scint[plane][sectorFB][layer]
1733 ctTrunc = int(ct) & 0x3ff
1734 if abs(ctTrunc - self.ct0Cal) < ctDiffMax:
1735 ctDiffMax = int(abs(ctTrunc - self.ct0Cal))
1736 tCal = ct
1737 if ctDiffMax == 0:
1738 break
1739 else: # it's an RPC layer
1740 tCal = tCal = hit1d.getTime() - trigCtime - self.t0RPC[plane][sectorFB][layer]
1741 break
1742 else:
1743 if layer < 2:
1744 tCal = hit1d.getTime() - self.ct0Scint[plane][sectorFB][layer]
1745 else:
1746 tCal = hit1d.getTime() - self.t0RPC[plane][sectorFB][layer]
1747 tCalTrunc = int(tCal) & 0x3ff
1748
1749 if self.view == 1:
1750 r = r0 + layer * dr
1751 yA = r
1752 zA = 500
1753 xB = 500
1754 yB = 500
1755 stripAverage = (stripMin + stripMax) * 0.5
1756 isPrompt = False
1757 if layer < 2:
1758 nScint += 1
1759 isPrompt = (abs(tCalTrunc - self.ct0Cal1d) < 50)
1760 if plane == 0:
1761 if fb == 0:
1762 zA = z0 - stripAverage * dzScint
1763 else:
1764 zA = z0 + stripAverage * dzScint
1765 else:
1766 h = ((stripAverage - 0.5 * nPhiStrips[layer]) * dPhiStrips[layer]) * scintFlip[fb][sector][layer]
1767 xB = r * cosine[sector] - h * sine[sector]
1768 yB = r * sine[sector] + h * cosine[sector]
1769 else:
1770 isPrompt = (abs(tCalTrunc - self.t0Cal1d) < 50)
1771 if plane == 0:
1772 if fb == 0:
1773 zA = z0 - stripAverage * dzRPC
1774 else:
1775 zA = z0 + stripAverage * dzRPC
1776 else:
1777 h = ((stripAverage - 0.5 * nPhiStrips[layer]) * dPhiStrips[layer]) # * rpcFlip[fb][sector]
1778 xB = r * cosine[sector] - h * sine[sector]
1779 yB = r * sine[sector] + h * cosine[sector]
1780 if abs(tCalTrunc - self.t0Cal) < 50:
1781 nRPCPrompt += 1
1782 if plane == 1:
1783 self.hist_multiplicityPhiBySector.Fill(sectorFB, stripMax - stripMin + 1)
1784 else:
1785 self.hist_multiplicityZBySector.Fill(sectorFB, stripMax - stripMin + 1)
1786 else:
1787 nRPCBkgd += 1
1788 if plane == 1:
1789 nphihits += 1
1790 phiTimes[key] = tCal
1791 if layer < 2:
1792 self.hist_ctphiScintCal1d.Fill(tCalTrunc)
1793 else:
1794 self.hist_tphiRPCCal1d.Fill(tCalTrunc)
1795 else:
1796 nzhits += 1
1797 zTimes[layer][key] = tCal
1798 if layer < 2:
1799 self.hist_ctzScintCal1d.Fill(tCalTrunc)
1800 else:
1801 self.hist_tzRPCCal1d.Fill(tCalTrunc)
1802 # Add the hit to the event-display TGraph list (perhaps)
1803 if (self.view == 1) and (self.eventDisplays < self.maxDisplays):
1804 if zA != 500:
1805 gZY = ROOT.TGraph()
1806 gZY.SetPoint(0, zA - 1.0, yA - 1.0)
1807 gZY.SetPoint(1, zA - 1.0, yA + 1.0)
1808 gZY.SetPoint(2, zA + 1.0, yA + 1.0)
1809 gZY.SetPoint(3, zA + 1.0, yA - 1.0)
1810 gZY.SetPoint(4, zA - 1.0, yA - 1.0)
1811 gZY.SetLineWidth(1)
1812 if isPrompt:
1813 gZY.SetLineColor(promptColor)
1814 else:
1815 gZY.SetLineColor(bkgdColor)
1816 zyList[sector].append(gZY)
1817 if xB != 500:
1818 gXY = ROOT.TGraph()
1819 gXY.SetPoint(0, xB - 1.0, yB - 1.0)
1820 gXY.SetPoint(1, xB - 1.0, yB + 1.0)
1821 gXY.SetPoint(2, xB + 1.0, yB + 1.0)
1822 gXY.SetPoint(3, xB + 1.0, yB - 1.0)
1823 gXY.SetPoint(4, xB - 1.0, yB - 1.0)
1824 gXY.SetLineWidth(1)
1825 if isPrompt:
1826 gXY.SetLineColor(promptColor)
1827 else:
1828 gXY.SetLineColor(bkgdColor)
1829 xyList[sector].append(gXY)
1830 self.hist_nHit1dRPCPrompt.Fill(nRPCPrompt)
1831 self.hist_nHit1dRPCBkgd.Fill(nRPCBkgd)
1832 self.hist_nHit1dScint.Fill(nScint)
1833 if nRPCPrompt > 2:
1834 self.hist_nHit1dPrompt.Fill(nScint + nRPCBkgd + nRPCPrompt)
1835 else:
1836 self.hist_nHit1dBkgd.Fill(nScint + nRPCBkgd + nRPCPrompt)
1837 self.hist_n1dPhiZ.Fill(nphihits, nzhits)
1838 for phiKey in phiTimes:
1839 mphi = phiKey & self.BKLM_MODULEID_MASK
1840 layer = (mphi & self.BKLM_LAYER_MASK) >> self.BKLM_LAYER_BIT
1841 sector = (mphi & self.BKLM_SECTOR_MASK) >> self.BKLM_SECTOR_BIT
1842 fb = (mphi & self.BKLM_SECTION_MASK) >> self.BKLM_SECTION_BIT
1843 sectorFB = sector if fb == 0 else sector + 8
1844 tphi = phiTimes[phiKey]
1845 tphiTrunc = int(tphi) & 0x3ff
1846 for zKey in zTimes[layer]:
1847 mz = zKey & self.BKLM_MODULEID_MASK
1848 if mphi == mz:
1849 tz = zTimes[layer][zKey]
1850 tzTrunc = int(tz) & 0x3ff
1851 dt = (tphiTrunc - tzTrunc) & 0x3ff
1852 if dt >= 0x200:
1853 dt -= 0x400
1854 t = (tphi + tz) * 0.5
1855 tTrunc = int(t) & 0x3ff
1856 if layer < 2:
1857 self.hist_dtScint1d.Fill(dt)
1858 else:
1859 self.hist_dtRPC1d.Fill(dt)
1860 if abs(dt) < 4000:
1861 if layer < 2:
1862 self.hist_ctScintCal1d.Fill(tTrunc)
1863 else:
1864 self.hist_tRPCCal1d.Fill(tTrunc)
1865
1866 # After processing all of the BKLMHit1ds in the event, draw the event display (perhaps)
1867
1868 if (self.view == 1) and (self.eventDisplays < self.maxDisplays):
1869 drawnSectors = 0
1870 jCanvas = 1
1871 for sector in range(0, 8):
1872 if len(zyList[sector]) > self.minRPCHits:
1873 drawnSectors += 1
1874 self.eventCanvas.cd(jCanvas)
1875 title = f'e{int(self.exp):02d}r{int(self.run)}: event {event} z-readout hits in S{sector}'
1876 self.hist_ZY1D[jCanvas - 1].SetTitle(title)
1877 self.hist_ZY1D[jCanvas - 1].Draw()
1878 for g in self.bklmZY:
1879 g.Draw("L")
1880 for g in zyList[sector]:
1881 g.Draw("L")
1882 jCanvas += 1
1883 if jCanvas > 2:
1884 jCanvas = 1
1885 self.lastTitle = f"Title:E{event} (#{self.eventCounter})"
1886 self.eventCanvas.Print(self.eventPdfName, self.lastTitle)
1887 enoughXYHits = False
1888 for sector in range(0, 8):
1889 if len(xyList[sector]) > self.minRPCHits:
1890 enoughXYHits = True
1891 break
1892 if enoughXYHits:
1893 drawnSectors += 1
1894 self.eventCanvas.cd(jCanvas)
1895 jCanvas += 1
1896 title = f'e{int(self.exp):02d}r{int(self.run)}: event {event} phi-readout hits'
1897 self.hist_XY.SetTitle(title)
1898 self.hist_XY.Draw()
1899 for g in self.bklmXY:
1900 g.Draw("L")
1901 for sector in range(0, 8):
1902 for g in xyList[sector]:
1903 g.Draw("L")
1904 if jCanvas > 2:
1905 jCanvas = 1
1906 self.lastTitle = f"Title:E{event} (#{self.eventCounter})"
1907 self.eventCanvas.Print(self.eventPdfName, self.lastTitle)
1908 if jCanvas == 2:
1909 self.eventCanvas.cd(jCanvas)
1910 ROOT.gPad.Clear()
1911 self.lastTitle = f"Title:E{event} (#{self.eventCounter})"
1912 self.eventCanvas.Print(self.eventPdfName, self.lastTitle)
1913 if drawnSectors > 0:
1914 self.eventDisplays += 1
1915
1916 # Process the KLMHit2ds
1917
1918 xyList = []
1919 zyList = []
1920 rpcHits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
1921 for hit2d in hit2ds:
1922 key = hit2d.getModuleID()
1923 layer = (key & self.BKLM_LAYER_MASK) >> self.BKLM_LAYER_BIT
1924 sector = (key & self.BKLM_SECTOR_MASK) >> self.BKLM_SECTOR_BIT
1925 fb = (key & self.BKLM_SECTION_MASK) >> self.BKLM_SECTION_BIT
1926 phiStripMin = hit2d.getPhiStripMin() - 1
1927 phiStripMax = hit2d.getPhiStripMax() - 1
1928 zStripMin = hit2d.getZStripMin() - 1
1929 zStripMax = hit2d.getZStripMax() - 1
1930 sectorFB = sector if fb == 0 else sector + 8
1931 if layer >= 2:
1932 rpcHits[sectorFB] += 1
1933 if self.legacyTimes:
1934 dc = self.sectorFBToDC[sectorFB]
1935 copper = dc & 0x03
1936 finesse = dc >> 2
1937 n = rawklms[copper].GetDetectorNwords(0, finesse) >> 1
1938 trigCtime = (rawklms[copper].GetTTCtime(0) & 0x07ffffff) << 3
1939 ctDiffMax = 99999
1940 tCal = -1
1941 jZ = -1
1942 jPhi = -1
1943 ctZ = 0
1944 ctPhi = 0
1945 for j in range(0, n):
1946 if layer != rawLayer[dc][j]:
1947 continue
1948 if sector != rawSector[dc][j]:
1949 continue
1950 if fb != rawFb[dc][j]:
1951 continue
1952 strip = rawStrip[dc][j]
1953 plane = rawPlane[dc][j]
1954 if plane == 0: # it's a z strip
1955 if strip < zStripMin:
1956 continue
1957 if strip > zStripMax:
1958 continue
1959 ctZ = rawCtime[dc][j] << 3 # in ns, range is only 8 bits in SCROD (??)
1960 jZ = j
1961 else: # it's a phi strip
1962 if strip < phiStripMin:
1963 continue
1964 if strip > phiStripMax:
1965 continue
1966 ctPhi = rawCtime[dc][j] << 3 # in ns, range is only 8 bits in SCROD (??)
1967 jPhi = j
1968 if (jZ >= 0) and (jPhi >= 0):
1969 if layer < 2: # it's a scint layer
1970 if abs(ctZ - ctPhi) > 40:
1971 continue
1972 ct = int((ctZ + ctPhi) * 0.5 - trigCtime - self.ct0Scint[plane][sectorFB][layer]) & 0x3ff
1973 if abs(ct - self.ct0Cal) < ctDiffMax:
1974 ctDiffMax = int(abs(ct - self.ct0Cal))
1975 tCal = ct
1976 if ctDiffMax == 0:
1977 break
1978 else: # it's an RPC layer
1979 tCal = hit2d.getTime() - trigCtime - self.t0RPC[plane][sectorFB][layer]
1980 break
1981 else:
1982 if layer < 2:
1983 tCal = hit2d.getTime() - self.ct0Scint[plane][sectorFB][layer]
1984 else:
1985 tCal = hit2d.getTime() - self.t0RPC[plane][sectorFB][layer]
1986 tCalTrunc = int(tCal) & 0x3ff
1987 x = hit2d.getGlobalPositionX()
1988 y = hit2d.getGlobalPositionY()
1989 z = hit2d.getGlobalPositionZ()
1990 r = math.sqrt(x * x + y * y)
1991 isPromptHit = False
1992 promptColor = 3
1993 bkgdColor = 2
1994 if layer < 2:
1995 promptColor = 7
1996 bkgdColor = 4
1997 self.hist_ctScintCal2d.Fill(tCalTrunc)
1998 self.hist_ctScintCal2dBySector.Fill(sectorFB, tCalTrunc)
1999 if abs(tCalTrunc - self.ct0Cal2d) < 50:
2000 isPromptHit = True
2001 if fb == 0: # backward
2002 self.hist_occupancyBackwardXYPrompt.Fill(x, y)
2003 else: # forward
2004 self.hist_occupancyForwardXYPrompt.Fill(x, y)
2005 else:
2006 if fb == 0: # backward
2007 self.hist_occupancyBackwardXYBkgd.Fill(x, y)
2008 else: # forward
2009 self.hist_occupancyForwardXYBkgd.Fill(x, y)
2010 else:
2011 self.hist_tRPCCal2d.Fill(tCalTrunc)
2012 self.hist_tRPCCal2dBySector.Fill(sectorFB, tCalTrunc)
2013 if abs(tCalTrunc - self.t0Cal2d) < 50:
2014 isPromptHit = True
2015 self.hist_occupancyRZPrompt.Fill(z, layer)
2016 self.hist_occupancyZPrompt.Fill(z)
2017 self.hist_occupancyRPrompt.Fill(layer)
2018 if fb == 0: # backward
2019 self.hist_occupancyBackwardXYPrompt.Fill(x, y)
2020 self.hist_tVsZBwd.Fill(-(z - 47.0), tCalTrunc)
2021 else: # forward
2022 self.hist_occupancyForwardXYPrompt.Fill(x, y)
2023 self.hist_tVsZFwd.Fill(+(z - 47.0), tCalTrunc)
2024 elif abs(tCalTrunc - self.t0Cal2d) >= 50:
2025 self.hist_occupancyRZBkgd.Fill(z, layer)
2026 self.hist_occupancyZBkgd.Fill(z)
2027 self.hist_occupancyRBkgd.Fill(layer)
2028 if fb == 0: # backward
2029 self.hist_occupancyBackwardXYBkgd.Fill(x, y)
2030 else: # forward
2031 self.hist_occupancyForwardXYBkgd.Fill(x, y)
2032
2033 # Add the hit to the event-display TGraph list (perhaps)
2034 if (self.view == 2) and (self.eventDisplays < self.maxDisplays):
2035 gXY = ROOT.TGraph()
2036 gXY.SetPoint(0, x - 1.0, y - 1.0)
2037 gXY.SetPoint(1, x - 1.0, y + 1.0)
2038 gXY.SetPoint(2, x + 1.0, y + 1.0)
2039 gXY.SetPoint(3, x + 1.0, y - 1.0)
2040 gXY.SetPoint(4, x - 1.0, y - 1.0)
2041 gXY.SetLineWidth(1)
2042 gZY = ROOT.TGraph()
2043 gZY.SetPoint(0, z - 1.0, y - 1.0)
2044 gZY.SetPoint(1, z - 1.0, y + 1.0)
2045 gZY.SetPoint(2, z + 1.0, y + 1.0)
2046 gZY.SetPoint(3, z + 1.0, y - 1.0)
2047 gZY.SetPoint(4, z - 1.0, y - 1.0)
2048 gZY.SetLineWidth(1)
2049 if isPromptHit:
2050 gXY.SetLineColor(promptColor)
2051 gZY.SetLineColor(promptColor)
2052 else:
2053 gXY.SetLineColor(bkgdColor)
2054 gZY.SetLineColor(bkgdColor)
2055 xyList.append(gXY)
2056 zyList.append(gZY)
2057
2058 # After processing all of the hits in the event, draw the event display (perhaps)
2059
2060 if (self.view == 2) and (self.eventDisplays < self.maxDisplays):
2061 hasEnoughRPCHits = False
2062 for count in rpcHits:
2063 if count > self.minRPCHits:
2064 hasEnoughRPCHits = True
2065 break
2066 if hasEnoughRPCHits:
2067 self.eventDisplays += 1
2068 title = f'e{int(self.exp):02d}r{int(self.run)}: event {event} 2D hits'
2069 self.hist_XY.SetTitle(title)
2070 self.hist_ZY.SetTitle(title)
2071 self.eventCanvas.cd(1)
2072 self.hist_XY.Draw()
2073 for g in self.bklmXY:
2074 g.Draw("L")
2075 for g in xyList:
2076 g.Draw("L")
2077 self.eventCanvas.cd(2)
2078 self.hist_ZY.Draw()
2079 for g in self.bklmZY:
2080 g.Draw("L")
2081 for g in zyList:
2082 g.Draw("L")
2083 self.lastTitle = f"Title:E{event} (#{self.eventCounter})"
2084 self.eventCanvas.Print(self.eventPdfName, self.lastTitle)
def fillDB()
Definition: bklmDB.py:16
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67
hist_occupancyZBkgd
histogram of z coordinate for out-of-time KLMHit2ds
hist_mappedScintLaneAxisOccupancy
scatterplot of number of mapped scint hits by lane/axis vs sector, at most one entry per readout chan...
int EKLM_ID
COPPER base identifier for EKLM readout.
hist_unmappedSectorOccupancy
histogram of number of unmapped hits by sector, at most one entry per readout channel
hist_multiplicityPhiBySector
scatterplot of number of Phi BKLMHit1ds vs sector
hist_tzRPCCal1d
histogram of RPC-z BKLMHit1d time relative to event's trigger time, corrected for inter-sector variat...
run
internal copy of run number
hist_dtScint1d
histogram of scint-phi and -z BKLMHit1d time difference
hist_occupancyRZBkgd
scatterplot of side view of forward BKLM for in-time KLMHit2ds
hist_rawKLMtdcExtraRPC
scatterplot of the RawKLM RPC hit's extra bits vs sector in the third (time) word
def __init__(self, exp, run, histName, pdfName, eventPdfName, verbosity, maxDisplays, minRPCHits, legacyTimes, singleEntry, view)
hist_occupancyRBkgd
histogram of layer# for out-of-time KLMHit2ds
hist_mappedRPCPhiTimePerLayer
histograms of RPC mapped-channel phi-strip TDC value relative to event's trigger time,...
hist_mappedRPCTimeCal
histogram of RPC mapped-channel TDC value relative to event's trigger time, corrected for inter-secto...
hist_tVsZFwd
profile histogram of KLMHit2d RPC time vs z (forward)
hist_occupancyRZPrompt
scatterplot of side view of forward BKLM for in-time KLMHit2ds
hist_nHit1dScint
histogram of the number of scint BKLMHit1ds
hist_XY
blank scatterplot to define the bounds of the BKLM end view
hist_rawKLMnodeID
scatterplot of the RawKLM's COPPER index vs NodeID relative to the base BKLM/EKLM values
int BKLM_SECTOR_BIT
bit position for sector-1 [0..7]; 0 is on the +x axis and 2 is on the +y axis
hist_mappedScintTime
histogram of scint mapped-channel TDC value relative to event's trigger Ctime
ct0Scint
per-layer variations in scint-ctime calibration adjustment (ns) for rawKLMs
hist_nRawKLM
histogram of the number of RawKLMs in the event (should be 1)
ct0Cal
scint-ctime calibration adjustment (ns) for rawKLMs
hist_occupancyForwardXYPrompt
scatterplot of end view of forward BKLM for in-time KLMHit2ds
tuple BKLM_MAXSTRIP_MASK
bit mask for maxStrip-1 [0..47]
int BKLM_MAXSTRIP_BIT
bit position for maxStrip-1 [0..47]
hist_rawKLMlaneFlag
scatterplot of the RawKLM hit's lane vs flag (1=RPC, 2=Scint)
tuple BKLM_SECTOR_MASK
bit mask for sector-1 [0..7]; 0 is on the +x axis and 2 is on the +y axis
ct0Cal2d
scint-ctime calibration adjustment (ns) for KLMHit2ds
tuple BKLM_SECTION_MASK
bit mask for section [0..1]; forward is 0
eventCanvas
TCanvas on which event displays will be drawn.
hist_n1dPhiZ
scatterplot of number of Z BKLMHit1ds vs number of Phi BKLMHit1ds
hist_rawKLMchannelMultiplicity
scatterplots of multiplicity of entries in one readout channel vs lane/axis, indexed by sector#
hist_tdcRangeVsCtimeRangeRPC
scatterplot of RPC TDC range vs Ctime range
hist_tdcRangeRPC
histogram of RPC TDC range
hist_tRPCCal2d
histogram of RPC calibrated time in KLMHit2ds
hist_mappedRPCSectorOccupancy
histogram of number of mapped RPC hits by sector, at most one entry per readout channel
ct0Cal1d
scint-ctime calibration adjustment (ns) for BKLMHit1ds
hist_ctzScintCal1d
histogram of scint-z BKLMHit1d time relative to event's trigger Ctime, corrected for inter-sector var...
eventPdfName
internal copy of the pathname of the output event-display PDF file
maxDisplays
internal copy of the maximum number of event displays to write
hist_mappedScintCtimeBySector
scatterplot of scint mapped-channel CTIME value relative to event's trigger Ctime vs sector
hist_unmappedRPCSectorOccupancy
histogram of number of unmapped RPC hits by sector, at most one entry per readout channel
singleEntry
select events with any (0) or exactly one (1) or more than one (2) entries/channel
hist_nHit1dRPCBkgd
histogram of the number of out-of-time RPC BKLMHit1ds
legacyTimes
calculate prompt time for legacy BKLMHit1ds and KLMHit2ds (True) or use stored time (False)
hist_tphiRPCCal1d
histogram of RPC-phi BKLMHit1d time relative to event's trigger time, corrected for inter-sector vari...
t0RPC
per-layer variations in RPC z- and phi-time calibration adjustment (ns) for rawKLMs
hist_nHit1dRPCPrompt
histogram of the number of in-time RPC BKLMHit1ds
int BKLM_PLANE_BIT
bit position for plane-1 [0..1]; 0 is inner-plane
hist_tdcRangeVsTimeRPC
scatterplot of RPC TDC range vs time
eventCounter
event counter (needed for PDF table of contents' ordinal event#)
view
view event displays using one-dimensional (1) or two-dimensional (2) hits
hist_mappedScintCtimeCal
histogram of scint mapped-channel CTIME value relative to event's trigger Ctime, corrected for inter-...
hist_mappedScintCtimeRangeBySector
scatterplot of scint mapped-channel CTIME range in event vs sector
hist_unmappedScintTimeBySector
scatterplot of scint unmapped-channel TDC value relative to event's trigger Ctime vs sector
hist_unmappedScintTime
histogram of scint unmapped-channel TDC value relative to event's trigger Ctime
t0Cal
Time-calibration constants obtained from experiment 7 run 1505 RPC-time calibration adjustment (ns) f...
hist_unmappedRPCTimeBySector
scatterplot of RPC unmapped-channel TDC value relative to event's trigger time, by sector
hist_unmappedRPCTime
histogram of RPC unmapped-channel TDC value relative to event's trigger time
hist_rawKLMsizeMultihit
histogram of number of hits, including multiple entries on one readout channel
dcToSectorFB
map for data concentrator -> sectorFB
hist_tRPCCal1d
histogram of RPC-phi and -z BKLMHit1d avg time relative to event's trigger time, corrected for inter-...
int BKLM_STRIP_BIT
bit position for strip-1 [0..47]
hist_mappedChannelOccupancyBkgd
scatterplots of out-of-time mapped channel occupancy (1 hit per readout channel), indexed by sector#
hist_mappedChannelOccupancyPrompt
scatterplots of in-time mapped channel occupancy (1 hit per readout channel), indexed by sector#
hist_unmappedSectorOccupancyMultihit
histogram of number of unmapped hits by sector, including multiple entries on one readout channel
hist_ctimeRangeRPC
histogram of RPC Ctime range
hist_mappedScintCtime
histogram of scint mapped-channel CTIME value relative to event's trigger Ctime
hist_trigCtimeVsTrigRevo9time
histogram of RawKLM[] header's trigger CTIME relative to its final-data-word trigger REVO9 time
int BKLM_ID
COPPER base identifier for BKLM readout.
hist_ctScintCal1d
histogram of scint-phi and -z BKLMHit1d avg time relative to event's trigger Ctime,...
hist_mappedScintCtimeRange
histogram of scint mapped-channel CTIME range in event
hist_occupancyRPrompt
histogram of layer# for in-time KLMHit2ds
hist_ctphiScintCal1d
histogram of scint-phi BKLMHit1d time relative to event's trigger Ctime, corrected for inter-sector v...
hist_nDigit
histogram of the number of BKLMDigits in the event
hist_ctScintCal2d
histogram of scint calibrated time in KLMHit2ds
hist_mappedRPCTime
histogram of RPC mapped-channel TDC value relative to event's trigger time
hist_nHit2d
histogram of the number of KLMHit2ds
hist_rawKLMsizeByDCMultihit
histograms of number of hits, including multiple entries on one readout channel, indexed by sector#
hist_mappedRPCLaneAxisOccupancy
scatterplot of number of mapped RPC hits by lane/axis vs sector, at most one entry per readout channe...
hist_mappedRPCCtimeRange
histogram of RPC mapped-channel REVO9 range in event
hist_unmappedScintCtimeBySector
scatterplot of scint unmapped-channel CTIME value relative to event's trigger Ctime,...
hist_ZY
blank scatterplot to define the bounds of the BKLM side view for 2D hits
minRPCHits
internal copy of the minimum number of RPC KLMHit2ds in any sector for event display
hist_nHit1dBkgd
histogram of the number of out-of-time scint BKLMHit1ds
exp
internal copy of experiment number
hist_mappedSectorOccupancy
histogram of number of mapped hits by sector, at most one entry per readout channel
verbosity
internal copy of the histogram verbosity in the histogram PDF file
hist_rawKLMsizeByDC
histograms of number of hits, at most one entry per readout channel, indexed by sector#
hist_multiplicityZBySector
scatterplot of number of Z BKLMHit1ds vs sector
hist_ctScintCal2dBySector
scatterplot of scint calibrated time in KLMHit2ds vs sector
tuple BKLM_MODULEID_MASK
bit mask for unique module identifier (end, sector, layer)
t0Cal1d
RPC-time calibration adjustment (ns) for BKLMHit1ds.
hist_unmappedRPCLaneAxisOccupancy
scatterplot of number of unmapped RPC hits by lane/axis vs sector, at most one entry per readout chan...
hist_RPCTimeLowBitsBySector
scatterplot of RPC TDC low-order bits vs sector (should be 0 since granularity is 4 ns)
hist_occupancyZPrompt
histogram of z coordinate for in-time KLMHit2ds
hist_mappedRPCZTimePerLayer
histograms of RPC mapped-channel z-strip TDC value relative to event's trigger time,...
tuple BKLM_LAYER_MASK
bit mask for layer-1 [0..15]; 0 is innermost and 14 is outermost
hist_nHit1dPrompt
histogram of the number of in-time scint BKLMHit1ds
hist_mappedScintZCtimePerLayer
histograms of scint mapped-channel z-strip CTIME value relative to event's trigger Ctime,...
bklmZY
list of line-segment (z,y) points for the BKLM side view
hist_ZY1D
blank scatterplot to define the bounds of the BKLM side view for 1D hits
hist_mappedSectorOccupancyMultihit
histogram of number of mapped hits by sector, including multiple entries on one readout channel
hist_mappedRPCTimeCalBySector
scatterplot of RPC mapped-channel TDC relative to trigger time, corrected for inter-sector variation,...
hist_occupancyForwardXYBkgd
scatterplot of end view of forward BKLM for out-of-time KLMHit2ds
hist_unmappedScintLaneAxisOccupancy
scatterplot of number of unmapped scint hits by lane/axis vs sector, at most one entry per readout ch...
hist_mappedScintSectorOccupancy
scatterplot of number of mapped scint hits by lane/axis vs sector, at most one entry per readout chan...
hist_tVsZBwd
profile histogram of KLMHit2d RPC time vs z (forward)
hist_rawKLMadcExtraScint
scatterplot of the RawKLM scint hit's extra bits vs sector in the fourth (adc) word
hist_mappedScintTimeBySector
scatterplot of scint mapped-channel TDC value relative to event's trigger Ctime vs sector
hist_mappedRPCTimeBySector
scatterplot of RPC mapped-channel TDC value relative to event's trigger time vs sector
eventDisplays
event-display counter
hist_dtRPC1d
histogram of RPC-phi and -z BKLMHit1d time difference
hist_ctimeRangeVsTimeRPC
scatterplot of RPC Ctime range vs time
lastTitle
title of the last-drawn event display (needed for PDF table of contents' last event)
hist_rawKLMtdcExtraScint
scatterplot of the RawKLM scint hit's extra bits vs sector in the third (time) word
tuple BKLM_PLANE_MASK
bit mask for plane-1 [0..1]; 0 is inner-plane
int BKLM_SECTION_BIT
bit position for section [0..1]; forward is 0
pdfName
internal copy of the pathname of the output histogram PDF file
hist_unmappedScintCtime
histogram of scint unmapped-channel CTIME value relative to event's trigger Ctime
histogramFile
Output ROOT TFile that will contain the histograms/scatterplots.
hist_rawKLMnumEvents
histogram of the RawKLM's NumEvents (should be 1)
hist_rawKLMchannelMultiplicityFine
scatterplots of multiplicity of entries in one readout channel vs lane/axis/channel,...
int BKLM_LAYER_BIT
bit position for layer-1 [0..14]; 0 is innermost
hist_unmappedChannelOccupancy
scatterplots of unmapped channel occupancy (1 hit per readout channel), indexed by sector#
hist_ScintTimeLowBitsBySector
scatterplot of scint TDC low-order bits vs sector
hist_mappedScintCtimeCalBySector
scatterplot of scint mapped-channel CTIME relative to trigger Ctime, corrected for inter-sector varia...
histName
internal copy of the pathname of the output histogram ROOT file
bklmXY
list of line-segment (x,y) points for the BKLM end view
hist_unmappedScintSectorOccupancy
histogram of number of unmapped scint hits by sector, at most one entry per readout channel
hist_rawKLMadcExtraRPC
scatterplot of the RawKLM RPC hit's extra bits vs sector in the fourth (adc) word
t0Cal2d
RPC-time calibration adjustment (ns) for KLMHit2ds.
hist_mappedScintTDCBySector
scatterplot of scint mapped-channel TDC value (NOT relative to event's trigger Ctime) vs sector
hist_mappedScintPhiCtimePerLayer
histograms of scint mapped-channel phi-strip CTIME value relative to event's trigger Ctime,...
electIdToModuleId
readout <-> detector map (from the information retrieved from the conditions database)
int BKLM_STRIP_MASK
bit mask for strip-1 [0..47]
hist_rawKLMnumNodes
histogram of the RawKLM's NumNodes (should be 1)
hist_tRPCCal2dBySector
scatterplot of RPC calibrated time in KLMHit2ds vs sector
hist_rawKLMsize
histogram of number of hits, at most one entry per readout channel
hist_occupancyBackwardXYPrompt
scatterplot of end view of backward BKLM for in-time KLMHit2ds
hist_nHit1d
histogram of the number of BKLMHit1ds
hist_mappedScintTDC
histogram of scint mapped-channel TDC value (NOT relative to event's trigger Ctime)
hist_occupancyBackwardXYBkgd
scatterplot of end view of backward BKLM for out-of-time KLMHit2ds
hist_mappedRPCCtimeRangeBySector
scatterplot of RPC mapped-channel REVO9 range in event vs sector
sectorFBToDC
map for sectorFB -> data concentrator