136 """Handle job initialization: fill the mapping database, create histograms, open the event-display file"""
138 expRun = f
'e{int(self.exp):02d}r{int(self.run)}: '
140 self.
hist_XY = ROOT.TH2F(
'XY',
' ;x;y', 10, -345.0, 345.0, 10, -345.0, 345.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)
149 self.
hist_ZY = ROOT.TH2F(
'ZY',
' ;z;y', 10, -345.0, 345.0, 10, -345.0, 345.0)
153 ROOT.gStyle.SetOptStat(10)
157 self.
sectorFBToDC = [11, 15, 2, 6, 10, 14, 3, 7, 9, 13, 0, 4, 8, 12, 1, 5]
159 self.
dcToSectorFB = [10, 14, 2, 6, 11, 15, 3, 7, 12, 8, 4, 0, 13, 9, 5, 1]
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]]]
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]]]
216 ROOT.gStyle.SetOptStat(10)
217 ROOT.gStyle.SetOptFit(111)
222 self.
hist_nDigit = ROOT.TH1F(
'NDigit', expRun +
'# of BKLMDigits', 500, -0.5, 499.5)
224 self.
hist_nRawKLM = ROOT.TH1F(
'NRawKLM', expRun +
'# of RawKLMs', 10, -0.5, 9.5)
226 self.
hist_rawKLMnumEvents = ROOT.TH1F(
'RawKLMnumEvents', expRun +
'RawKLM NumEvents;(should be 1)', 10, -0.5, 9.5)
228 self.
hist_rawKLMnumNodes = ROOT.TH1F(
'RawKLMnumNodes', expRun +
'RawKLM NumNodes;(should be 1)', 10, -0.5, 9.5)
231 expRun +
'RawKLM NodeID;' +
232 'NodeID (bklm: 1..4, eklm:5..8);' +
234 10, -0.5, 9.5, 10, -0.5, 9.5)
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)
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)
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)
255 expRun +
'RawKLM Scint tdcExtra bits;' +
256 'Sector # (0-7 = backward, 8-15 = forward);' +
258 16, -0.5, 15.5, 32, -0.5, 31.5)
261 expRun +
'RawKLM Scint adcExtra bits;' +
262 'Sector # (0-7 = backward, 8-15 = forward);' +
264 16, -0.5, 15.5, 16, -0.5, 15.5)
268 self.
hist_rawKLMsize = ROOT.TH1F(
'rawKLMsize', expRun +
'RawKLM word count (1/channel)', 250, -0.5, 499.5)
273 for sectorFB
in range(0, 16):
277 label = f
'rawKLM_S{sectorFB:02d}_sizeMultihit'
278 title = f
'{expRun}sector {sectorFB} [COPPER {copper} finesse {finesse}] word count (N/channel)'
280 label = f
'rawKLM_S{sectorFB:02d}_size'
281 title = f
'{expRun}sector {sectorFB} [COPPER {copper} finesse {finesse}] word count (1/channel)'
287 for sectorFB
in range(0, 16):
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 #)'
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 #)'
301 'mappedSectorOccupancyMultihit',
302 expRun +
'Sector occupancy of mapped channels (N/channel);' +
303 'Sector # (0-7 = backward, 8-15 = forward)',
307 'unmappedSectorOccupancyMultihit',
308 expRun +
'Sector occupancy of unmapped channels (N/channel);' +
309 'Sector # (0-7 = backward, 8-15 = forward)',
313 'mappedSectorOccupancy',
314 expRun +
'Sector occupancy of mapped channels (1/channel);' +
315 'Sector # (0-7 = backward, 8-15 = forward)',
319 'unmappedSectorOccupancy',
320 expRun +
'Sector occupancy of unmapped channels (1/channel);' +
321 'Sector # (0-7 = backward, 8-15 = forward)',
325 'mappedRPCSectorOccupancy',
326 expRun +
'Sector occupancy of mapped RPC channels (1/channel);' +
327 'Sector # (0-7 = backward, 8-15 = forward)',
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)
338 'unmappedRPCSectorOccupancy',
339 expRun +
'Sector occupancy of unmapped RPC channels (1/channel);' +
340 'Sector # (0-7 = backward, 8-15 = forward)',
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)
351 'mappedScintSectorOccupancy',
352 expRun +
'Sector occupancy of mapped scint channels (1/channel);' +
353 'Sector # (0-7 = backward, 8-15 = forward)',
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)
364 'unmappedScintSectorOccupancy',
365 expRun +
'Sector occupancy of unmapped scint channels (1/channel);' +
366 'Sector # (0-7 = backward, 8-15 = forward)',
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)
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]]
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]]
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'
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'
394 label = f
'unmappedChannelOccupancy_S{sectorFB:02d}Z'
395 title = f
'{expRun}Unmapped channel occupancy for sector {sectorFB} z hits;lane;channel'
397 label = f
'mappedChannelOccupancy_S{sectorFB:02d}PhiPrompt'
398 title = f
'{expRun}In-time mapped occupancy for sector {sectorFB} phi hits;lane;channel'
400 label = f
'mappedChannelOccupancy_S{sectorFB:02d}PhiBkgd'
401 title = f
'{expRun}Out-of-time mapped occupancy for sector {sectorFB} phi hits;lane;channel'
403 label = f
'unmappedChannelOccupancy_S{sectorFB:02d}Phi'
404 title = f
'{expRun}Unmapped channel occupancy for sector {sectorFB} phi hits;lane;channel'
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)
414 'mappedRPCTime', expRun +
'RPC mapped-strip time distribution;t - t(trigger) (ns)', 256, -0.5, 1023.5)
417 'mappedRPCTimeCal', expRun +
'RPC mapped-strip time distribution;t - t(trigger) - dt(layer) (ns)', 256, -0.5, 1023.5)
422 for sectorFB
in range(0, 16):
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)'
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)'
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)
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)
446 expRun +
'RPC Ctime-range in event;' +
447 'CtimeMax - CtimeMin (ns)',
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)
457 expRun +
'RPC unmapped-strip time distribution;' +
458 't - t(trigger) (ns)',
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)
468 expRun +
'Scint TDC lowest-order bits;' +
469 'Sector # (0-7 = backward, 8-15 = forward);' +
471 16, -0.5, 15.5, 4, -0.5, 3.5)
474 expRun +
'Scint mapped-strip ctime distribution;' +
475 'ctime - ct(trigger) (ns)',
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)
485 expRun +
'Scint mapped-strip ctime distribution;' +
486 'ctime - ct(trigger) - dt(layer) (ns)',
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)
498 for sectorFB
in range(0, 16):
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)'
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)'
510 expRun +
'Scint ctime-range in event;' +
511 'ctimeMax - ctimeMin (ns)',
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)
521 expRun +
'Scint unmapped-strip ctime distribution;' +
522 'ctime - ct(trigger) (ns)',
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)
532 expRun +
'Scint mapped-strip TDC distribution;' +
537 expRun +
'Scint mapped-strip time distribution;' +
538 't - t(trigger) (ns)', 32, -0.5, 31.5)
541 expRun +
'Scint mapped-strip TDC;' +
542 'Sector # (0-7 = backward, 8-15 = forward);' +
544 16, -0.5, 15.5, 32, -0.5, 31.5)
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)
553 expRun +
'Scint unmapped-strip time distribution;' +
554 't - t(trigger) (ns)',
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)
567 expRun +
'trigCtime - trigRevo9time (ns)',
568 256, -1024.5, 1023.5)
571 expRun +
'RPC TDC range;' +
572 'maxTDC - minTDC (ns)',
576 expRun +
'RPC Ctime range;' +
577 'maxCtime - minCtime (ns)',
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)
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)
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)
601 self.
hist_nHit1d = ROOT.TH1F(
'NHit1d', expRun +
'# of BKLMHit1ds', 100, -0.5, 99.5)
603 self.
hist_nHit1dRPCPrompt = ROOT.TH1F(
'NHit1dRPCPrompt', expRun +
'# of prompt RPC BKLMHit1ds', 100, -0.5, 99.5)
605 self.
hist_nHit1dRPCBkgd = ROOT.TH1F(
'NHit1dRPCBkgd', expRun +
'# of background RPC BKLMHit1ds', 100, -0.5, 99.5)
607 self.
hist_nHit1dScint = ROOT.TH1F(
'NHit1dScint', expRun +
'# of scintillator BKLMHit1ds', 100, -0.5, 99.5)
609 self.
hist_nHit1dPrompt = ROOT.TH1F(
'NHit1dPrompt', expRun +
'# of prompt BKLMHit1ds', 100, -0.5, 99.5)
611 self.
hist_nHit1dBkgd = ROOT.TH1F(
'NHit1dBkgd', expRun +
'# of bkgd BKLMHit1ds', 100, -0.5, 99.5)
614 expRun +
'Distribution of BKLMHit1ds;# of phi BKLMHit1ds;# of z BKLMHit1ds',
615 60, -0.5, 59.5, 60, -0.5, 59.5)
618 expRun +
'BKLMHit1d phi-strip multiplicity;' +
619 'sector # (0-7 = backward, 8-15 = forward);' +
621 16, -0.5, 15.5, 8, -0.5, 7.5)
624 expRun +
'BKLMHit1d z-strip multiplicity;' +
625 'sector # (0-7 = backward, 8-15 = forward);' +
627 16, -0.5, 15.5, 8, -0.5, 7.5)
630 expRun +
'RPC BKLMHit1d phi-strip time distribution;' +
631 't(phi1D) - dt(layer) (ns)',
635 expRun +
'RPC BKLMHit1d z-strip time distribution;' +
636 't(z1D) - dt(layer) (ns)',
640 expRun +
'RPC BKLMHit1d x 2 calibrated average-time distribution;' +
641 '0.5*[t(phi1D) + t(z1D)] - dt(layer) (ns)',
645 expRun +
'RPC BKLMHit1d x 2 time-difference distribution;' +
646 't(phi1D) - t(z1D) (ns)',
650 expRun +
'Scintillator BKLMHit1d phi-strip ctime distribution;' +
651 't(phi1D) - dt(layer) (ns)',
655 expRun +
'Scintillator BKLMHit1d z-strip ctime distribution;' +
656 't(z1D) - dt(layer) (ns)',
660 expRun +
'Scintillator BKLMHit1d x 2 calibrated average-time distribution;' +
661 '0.5*[t(phi1D) + t(z1D)] - dt(layer) (ns)',
665 expRun +
'Scintillator BKLMHit1d x 2 time-difference distribution;' +
666 't(phi1D) - t(z1D) (ns)',
672 self.
hist_nHit2d = ROOT.TH1F(
'NHit2d', expRun +
'# of KLMHit2ds', 50, -0.5, 49.5)
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)
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)
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)
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)
691 expRun +
'layer-z occupancy for in-time hits;z(cm);layer',
692 48, -190.0, 290.0, 16, -0.5, 15.5)
695 expRun +
'z occupancy for in-time hits;z(cm)',
699 expRun +
'layer occupancy for in-time hits;layer',
703 expRun +
'layer-z occupancy for out-of-time hits;z(cm);layer',
704 48, -190.0, 290.0, 16, -0.5, 15.5)
707 expRun +
'z occupancy for out-of-time hits;z(cm)',
711 expRun +
'layer occupancy for out-of-time hits;layer',
715 expRun +
'RPC KLMHit2d time distribution;' +
716 't(2D) - dt(layer) (ns)',
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)
726 expRun +
'Scint KLMHit2d ctime distribution;' +
727 't(2D) - dt(layer) (ns)',
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)
738 expRun +
'RPC KLMHit2d time vs z (forward);' +
740 't(2D) - dt(layer) (ns)',
744 expRun +
'RPC KLMHit2d time vs z (backward);' +
746 't(2D) - dt(layer) (ns)',
753 title = f
'{self.eventPdfName}['
762 r0 = 201.9 + 0.5 * 4.4
764 tan0 = math.tan(math.pi / 8.0)
766 g.SetPoint(0, -200.0, 0.0)
767 g.SetPoint(1, +200.0, 0.0)
773 g.SetPoint(0, 0.0, -200.0)
774 g.SetPoint(1, 0.0, +200.0)
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)
788 for layer
in range(0, 15):
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)
816 g.SetPoint(0, -zL + z0 - 140.0, 0.0)
817 g.SetPoint(1, +zL + z0 + 70.0, 0.0)
823 g.SetPoint(0, 0.0, -315.0)
824 g.SetPoint(1, 0.0, +340.0)
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)
839 g.SetPoint(0, -zL + z0, +x0)
840 g.SetPoint(1, -zL + z0, +r0)
846 g.SetPoint(0, -zL + z0, -x0)
847 g.SetPoint(1, -zL + z0, -r0)
853 g.SetPoint(0, +zL + z0, +x0)
854 g.SetPoint(1, +zL + z0, +r0)
860 g.SetPoint(0, +zL + z0, -x0)
861 g.SetPoint(1, +zL + z0, -r0)
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)
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)
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)
895 """Handle job termination: draw histograms, close output files"""
898 pdfNameLast = f
'{self.eventPdfName}]'
901 for sectorFB
in range(0, 16):
903 if mappedScintSectorOccupancy > 0:
904 for laneAxis
in range(0, 42):
907 sectorFB + 1, laneAxis + 1, 100.0 * numerator / mappedScintSectorOccupancy)
909 if mappedRPCSectorOccupancy > 0:
910 for laneAxis
in range(0, 42):
913 sectorFB + 1, laneAxis + 1, 100.0 * numerator / mappedRPCSectorOccupancy)
915 if unmappedScintSectorOccupancy > 0:
916 for laneAxis
in range(0, 42):
919 sectorFB + 1, laneAxis + 1, 100.0 * numerator / unmappedScintSectorOccupancy)
921 if unmappedRPCSectorOccupancy > 0:
922 for laneAxis
in range(0, 42):
925 sectorFB + 1, laneAxis + 1, 100.0 * numerator / unmappedRPCSectorOccupancy)
926 canvas = ROOT.TCanvas(
"canvas", self.
pdfName, 1600, 1600)
927 title = f
'{self.pdfName}['
930 canvas.GetPad(0).SetGrid(1, 1)
931 canvas.GetPad(0).Update()
933 canvas.Print(self.
pdfName, f
"Title:{self.hist_nDigit.GetName()}")
936 canvas.Print(self.
pdfName, f
"Title:{self.hist_nRawKLM.GetName()}")
938 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMnumEvents.GetName()}")
940 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMnumNodes.GetName()}")
942 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMnodeID.GetName()}")
944 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMlaneFlag.GetName()}")
955 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMsizeMultihit.GetName()}")
956 for dc
in range(0, 16):
958 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMsizeByDCMultihit[dc].GetName()}")
960 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMsize.GetName()}")
962 for dc
in range(0, 16):
964 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMsizeByDC[dc].GetName()}")
965 for dc
in range(0, 16):
967 canvas.Print(self.
pdfName, f
"Title:{self.hist_rawKLMchannelMultiplicity[dc].GetName()}")
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()}")
983 canvas.GetPad(0).SetGrid(1, 1)
984 canvas.GetPad(1).SetGrid(1, 1)
985 canvas.GetPad(2).SetGrid(1, 1)
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]
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]
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]
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]
1004 graphRPC0 = self.
makeGraph(borderRPC0x, borderRPC0y)
1005 graphRPC0Chimney = self.
makeGraph(borderRPC0x, borderRPC0yChimney)
1007 graphScint0 = self.
makeGraph(borderScint0x, borderScint0y)
1009 graphRPC1 = self.
makeGraph(borderRPC1x, borderRPC1y)
1011 graphScint1a = self.
makeGraph(borderScint1x, borderScint1ay)
1012 graphScint1b = self.
makeGraph(borderScint1x, borderScint1by)
1013 graphScint1aChimney = self.
makeGraph(borderScint1xChimney, borderScint1ayChimney)
1014 graphScint1bChimney = self.
makeGraph(borderScint1xChimney, borderScint1byChimney)
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):
1022 for lane
in range(8, 21):
1023 for channel
in range(0, 64):
1025 zmax = z
if z > zmax
else zmax
1030 graphRPC0Chimney.Draw(
"L")
1031 graphScint1aChimney.Draw(
"L")
1032 graphScint1bChimney.Draw(
"L")
1035 graphScint1a.Draw(
"L")
1036 graphScint1b.Draw(
"L")
1040 for lane
in range(8, 21):
1041 for channel
in range(0, 64):
1043 zmax = z
if z > zmax
else zmax
1048 graphScint0.Draw(
"L")
1051 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedChannelOccupancyPrompt[sectorFB][0].GetName()}")
1053 for sectorFB
in range(0, 16):
1055 for lane
in range(8, 21):
1056 for channel
in range(0, 64):
1058 zmax = z
if z > zmax
else zmax
1063 graphRPC0Chimney.Draw(
"L")
1064 graphScint1aChimney.Draw(
"L")
1065 graphScint1bChimney.Draw(
"L")
1068 graphScint1a.Draw(
"L")
1069 graphScint1b.Draw(
"L")
1073 for lane
in range(8, 21):
1074 for channel
in range(0, 64):
1076 zmax = z
if z > zmax
else zmax
1081 graphScint0.Draw(
"L")
1084 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedChannelOccupancyBkgd[sectorFB][0].GetName()}")
1085 for sectorFB
in range(0, 16):
1089 graphRPC0Chimney.Draw(
"L")
1090 graphScint1aChimney.Draw(
"L")
1091 graphScint1bChimney.Draw(
"L")
1094 graphScint1a.Draw(
"L")
1095 graphScint1b.Draw(
"L")
1101 graphScint0.Draw(
"L")
1104 canvas.Print(self.
pdfName, f
"Title:{self.hist_unmappedChannelOccupancy[sectorFB][0].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)
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)
1123 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedRPCTime.GetName()}")
1125 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedRPCTimeBySector.GetName()}")
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)
1134 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedRPCTimeCal.GetName()}")
1136 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedRPCTimeCalBySector.GetName()}")
1139 canvas.Print(self.
pdfName, f
"Title:{self.hist_unmappedRPCTime.GetName()}")
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):
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)
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):
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)
1163 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedRPCZTimePerLayer[sectorFB][layer].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)
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)
1192 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedScintCtime.GetName()}")
1194 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedScintCtimeBySector.GetName()}")
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)
1203 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedScintCtimeCal.GetName()}")
1205 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedScintCtimeCalBySector.GetName()}")
1208 canvas.Print(self.
pdfName, f
"Title:{self.hist_unmappedScintCtime.GetName()}")
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):
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)
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):
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)
1232 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedScintZCtimePerLayer[sectorFB][layer].GetName()}")
1234 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedRPCCtimeRangeBySector.GetName()}")
1237 canvas.Print(self.
pdfName, f
"Title:{self.hist_tdcRangeRPC.GetName()}")
1240 canvas.Print(self.
pdfName, f
"Title:{self.hist_tdcRangeRPC.GetName()}")
1243 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctimeRangeRPC.GetName()}")
1246 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctimeRangeRPC.GetName()}")
1250 canvas.Print(self.
pdfName, f
"Title:{self.hist_tdcRangeVsCtimeRangeRPC.GetName()}")
1253 canvas.Print(self.
pdfName, f
"Title:{self.hist_tdcRangeVsCtimeRangeRPC.GetName()}")
1256 canvas.Print(self.
pdfName, f
"Title:{self.hist_tdcRangeVsTimeRPC.GetName()}")
1259 canvas.Print(self.
pdfName, f
"Title:{self.hist_tdcRangeVsTimeRPC.GetName()}")
1262 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctimeRangeVsTimeRPC.GetName()}")
1265 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctimeRangeVsTimeRPC.GetName()}")
1268 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedScintCtimeRange.GetName()}")
1270 canvas.Print(self.
pdfName, f
"Title:{self.hist_mappedScintCtimeRangeBySector.GetName()}")
1273 canvas.Print(self.
pdfName, f
"Title:{self.hist_nHit1d.GetName()}")
1275 canvas.Print(self.
pdfName, f
"Title:{self.hist_n1dPhiZ.GetName()}")
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)
1298 canvas.Print(self.
pdfName, f
"Title:{self.hist_tphiRPCCal1d.GetName()}")
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)
1307 canvas.Print(self.
pdfName, f
"Title:{self.hist_tzRPCCal1d.GetName()}")
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)
1317 canvas.Print(self.
pdfName, f
"Title:{self.hist_tRPCCal1d.GetName()}")
1319 canvas.Print(self.
pdfName, f
"Title:{self.hist_dtRPC1d.GetName()}")
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)
1328 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctphiScintCal1d.GetName()}")
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)
1337 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctzScintCal1d.GetName()}")
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)
1347 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctScintCal1d.GetName()}")
1349 canvas.Print(self.
pdfName, f
"Title:{self.hist_dtScint1d.GetName()}")
1352 canvas.Print(self.
pdfName, f
"Title:{self.hist_nHit2d.GetName()}")
1354 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyForwardXYPrompt.GetName()}")
1356 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyBackwardXYPrompt.GetName()}")
1359 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyForwardXYBkgd.GetName()}")
1361 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyBackwardXYBkgd.GetName()}")
1363 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyRZPrompt.GetName()}")
1365 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyZPrompt.GetName()}")
1367 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyRPrompt.GetName()}")
1369 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyRZBkgd.GetName()}")
1371 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyZBkgd.GetName()}")
1373 canvas.Print(self.
pdfName, f
"Title:{self.hist_occupancyRBkgd.GetName()}")
1375 canvas.Print(self.
pdfName, f
"Title:{self.hist_tVsZFwd.GetName()}")
1377 canvas.Print(self.
pdfName, f
"Title:{self.hist_tVsZFwd.GetName()}")
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)
1387 canvas.Print(self.
pdfName, f
"Title:{self.hist_tRPCCal2d.GetName()}")
1389 canvas.Print(self.
pdfName, f
"Title:{self.hist_tRPCCal2dBySector.GetName()}")
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)
1398 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctScintCal2d.GetName()}")
1400 canvas.Print(self.
pdfName, f
"Title:{self.hist_ctScintCal2dBySector.GetName()}")
1402 pdfNameLast = f
'{self.pdfName}]'
1403 canvas.Print(pdfNameLast, f
"Title:{self.hist_ctScintCal2dBySector.GetName()}")
1419 """Process one event: fill histograms, (optionally) draw event display"""
1423 event = EventMetaData.getEvent()
1434 for hit1d
in hit1ds:
1435 tCal1d.append(hit1d.getTime())
1437 for hit2d
in hit2ds:
1438 tCal2d.append(hit2d.getTime())
1440 countAllMultihit = 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]
1453 if rawklm.GetNumEntries() != 1:
1454 print(
'##0 Event', event,
'copper', copper,
' getNumEntries=', rawklm.GetNumEntries())
1456 nodeID = rawklm.GetNodeID(0) - self.
BKLM_ID
1460 if (nodeID < 0)
or (nodeID > 4):
1462 trigCtime = (rawklm.GetTTCtime(0) & 0x7ffffff) << 3
1463 revo9time = trigCtime - 0x3b0
1464 for finesse
in range(0, 4):
1465 dc = (finesse << 2) + copper
1466 nWords = rawklm.GetDetectorNwords(0, finesse)
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')
1478 if int(self.
exp) != 3:
1479 revo9time = ((lastWord >> 16) << 3) & 0xffff
1480 dt = (trigCtime - revo9time) & 0x3ff
1488 channelMultiplicity = {}
1493 minScintCtime = 99999
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
1504 flag = (word0 >> 30) & 0x03
1505 adc = word1 & 0x0fff
1506 tdc = (word1 >> 16) & 0x07ff
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
1516 if ctime < minRPCCtime:
1518 if ctime > maxRPCCtime:
1525 if int(self.
exp) <= 3:
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
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)
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
1554 ctimeRangeRPC = (maxRPCCtime - minRPCCtime) << 3
1555 ctimeRangeScint = (maxScintCtime - minScintCtime) << 3
1559 if maxScintCtime > 0:
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
1570 flag = (word0 >> 30) & 0x03
1571 electId = (channel << 12) | (axis << 11) | (lane << 6) | (finesse << 4) | nodeID
1572 tdc = (word1 >> 16) & 0x07ff
1573 adc = word1 & 0x0fff
1574 tdcExtra = (word1 >> 27) & 0x1f
1575 adcExtra = (word1 >> 12) & 0x0f
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:
1593 if int(self.
exp) <= 3:
1594 trigCtx = trigCtime >> 3
1595 ctime = trigCtx - ((trigCtx - ctime) << 2)
1596 t = (tdc - trigCtime) & 0x03ff
1597 ct = (ctime << 3) - (trigCtime & 0x7fff8)
1601 if channelMultiplicity[laneAxisChannel] == 1:
1605 tCal = int(tdc - trigCtime - self.
t0RPC[axis][sectorFB][lane - 6]) & 0x03ff
1612 if abs(tCal - self.
t0Cal) < 50:
1628 ctCal = int((ctime << 3) - trigCtime - self.
ct0Scint[1 - axis][sectorFB][lane - 1]) & 0x03ff
1629 if abs(ctCal - self.
ct0Cal) < 50:
1649 if channelMultiplicity[laneAxisChannel] == 1:
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
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]]]
1693 zTimes = [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]
1699 for hit1d
in hit1ds:
1700 key = hit1d.getModuleID()
1707 sectorFB = sector
if fb == 0
else sector + 8
1712 n = rawklms[copper].GetDetectorNwords(0, finesse) >> 1
1713 trigCtime = (rawklms[copper].GetTTCtime(0) & 0x07ffffff) << 3
1716 for j
in range(0, n):
1717 if layer != rawLayer[dc][j]:
1719 if sector != rawSector[dc][j]:
1721 if fb != rawFb[dc][j]:
1723 if plane != rawPlane[dc][j]:
1725 strip = rawStrip[dc][j]
1726 if strip < stripMin:
1728 if strip > stripMax:
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))
1740 tCal = tCal = hit1d.getTime() - trigCtime - self.
t0RPC[plane][sectorFB][layer]
1744 tCal = hit1d.getTime() - self.
ct0Scint[plane][sectorFB][layer]
1746 tCal = hit1d.getTime() - self.
t0RPC[plane][sectorFB][layer]
1747 tCalTrunc = int(tCal) & 0x3ff
1755 stripAverage = (stripMin + stripMax) * 0.5
1759 isPrompt = (abs(tCalTrunc - self.
ct0Cal1d) < 50)
1762 zA = z0 - stripAverage * dzScint
1764 zA = z0 + stripAverage * dzScint
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]
1770 isPrompt = (abs(tCalTrunc - self.
t0Cal1d) < 50)
1773 zA = z0 - stripAverage * dzRPC
1775 zA = z0 + stripAverage * dzRPC
1777 h = ((stripAverage - 0.5 * nPhiStrips[layer]) * dPhiStrips[layer])
1778 xB = r * cosine[sector] - h * sine[sector]
1779 yB = r * sine[sector] + h * cosine[sector]
1780 if abs(tCalTrunc - self.
t0Cal) < 50:
1790 phiTimes[key] = tCal
1797 zTimes[layer][key] = tCal
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)
1813 gZY.SetLineColor(promptColor)
1815 gZY.SetLineColor(bkgdColor)
1816 zyList[sector].append(gZY)
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)
1826 gXY.SetLineColor(promptColor)
1828 gXY.SetLineColor(bkgdColor)
1829 xyList[sector].append(gXY)
1838 for phiKey
in phiTimes:
1843 sectorFB = sector
if fb == 0
else sector + 8
1844 tphi = phiTimes[phiKey]
1845 tphiTrunc = int(tphi) & 0x3ff
1846 for zKey
in zTimes[layer]:
1849 tz = zTimes[layer][zKey]
1850 tzTrunc = int(tz) & 0x3ff
1851 dt = (tphiTrunc - tzTrunc) & 0x3ff
1854 t = (tphi + tz) * 0.5
1855 tTrunc = int(t) & 0x3ff
1871 for sector
in range(0, 8):
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)
1880 for g
in zyList[sector]:
1885 self.
lastTitle = f
"Title:E{event} (#{self.eventCounter})"
1887 enoughXYHits =
False
1888 for sector
in range(0, 8):
1896 title = f
'e{int(self.exp):02d}r{int(self.run)}: event {event} phi-readout hits'
1901 for sector
in range(0, 8):
1902 for g
in xyList[sector]:
1906 self.
lastTitle = f
"Title:E{event} (#{self.eventCounter})"
1911 self.
lastTitle = f
"Title:E{event} (#{self.eventCounter})"
1913 if drawnSectors > 0:
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()
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
1932 rpcHits[sectorFB] += 1
1937 n = rawklms[copper].GetDetectorNwords(0, finesse) >> 1
1938 trigCtime = (rawklms[copper].GetTTCtime(0) & 0x07ffffff) << 3
1945 for j
in range(0, n):
1946 if layer != rawLayer[dc][j]:
1948 if sector != rawSector[dc][j]:
1950 if fb != rawFb[dc][j]:
1952 strip = rawStrip[dc][j]
1953 plane = rawPlane[dc][j]
1955 if strip < zStripMin:
1957 if strip > zStripMax:
1959 ctZ = rawCtime[dc][j] << 3
1962 if strip < phiStripMin:
1964 if strip > phiStripMax:
1966 ctPhi = rawCtime[dc][j] << 3
1968 if (jZ >= 0)
and (jPhi >= 0):
1970 if abs(ctZ - ctPhi) > 40:
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))
1979 tCal = hit2d.getTime() - trigCtime - self.
t0RPC[plane][sectorFB][layer]
1983 tCal = hit2d.getTime() - self.
ct0Scint[plane][sectorFB][layer]
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)
1999 if abs(tCalTrunc - self.
ct0Cal2d) < 50:
2013 if abs(tCalTrunc - self.
t0Cal2d) < 50:
2024 elif abs(tCalTrunc - self.
t0Cal2d) >= 50:
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)
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)
2050 gXY.SetLineColor(promptColor)
2051 gZY.SetLineColor(promptColor)
2053 gXY.SetLineColor(bkgdColor)
2054 gZY.SetLineColor(bkgdColor)
2061 hasEnoughRPCHits =
False
2062 for count
in rpcHits:
2064 hasEnoughRPCHits =
True
2066 if hasEnoughRPCHits:
2068 title = f
'e{int(self.exp):02d}r{int(self.run)}: event {event} 2D hits'
2083 self.
lastTitle = f
"Title:E{event} (#{self.eventCounter})"