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