Belle II Software  release-08-01-10
EventInspectorPocketDAQ.py
1 #!/usr/bin/env python3
2 
3 
10 
11 # Purpose:
12 # basf2 module to histogram useful values in PocketDAQ data created by the
13 # test stand at Indiana University.
14 #
15 import ROOT
16 
17 
19  """Fill BKLM histograms of values from RawKLMs, KLMDigits, BKLMHit1ds, and BKLMHit2ds;
20  (optionally) draw event displays from these data-objects."""
21 
22 
23  BKLM_ID = 0x07000000
24 
25  EKLM_ID = 0x08000000
26 
27  BKLM_STRIP_BIT = 0
28 
29  BKLM_PLANE_BIT = 6
30 
31  BKLM_LAYER_BIT = 7
32 
33  BKLM_SECTOR_BIT = 11
34 
35  BKLM_SECTION_BIT = 14
36 
37  BKLM_MAXSTRIP_BIT = 15
38 
39  BKLM_STRIP_MASK = 0x3f
40 
41  BKLM_PLANE_MASK = (1 << BKLM_PLANE_BIT)
42 
43  BKLM_LAYER_MASK = (15 << BKLM_LAYER_BIT)
44 
45  BKLM_SECTOR_MASK = (7 << BKLM_SECTOR_BIT)
46 
47  BKLM_SECTION_MASK = (1 << BKLM_SECTION_BIT)
48 
49  BKLM_MAXSTRIP_MASK = (63 << BKLM_MAXSTRIP_BIT)
50 
51  BKLM_MODULEID_MASK = (BKLM_SECTION_MASK | BKLM_SECTOR_MASK | BKLM_LAYER_MASK)
52 
53  def __init__(self, exp, run, histName, pdfName):
54  """Constructor
55 
56  Arguments:
57  exp (str): formatted experiment number
58  run (str): formatter run number
59  histName (str): path name of the output histogram ROOT file
60  pdfName (str): path name of the output histogram PDF file
61  eventPdfName (str): path name of the output event-display PDF file
62  maxDisplays (int): max # of events displays to write
63  minRPCHits (int): min # of RPC BKLMHit2ds in any sector for event display
64  """
65  super().__init__()
66 
67  self.expexp = exp
68 
69  self.runrun = run
70 
71  self.histNamehistName = histName
72 
73  self.pdfNamepdfName = pdfName
74 
75  def makeGraph(self, x, y):
76  """Create and return a ROOT TGraph
77 
78  Arguments:
79  x[] (real): x coordinates
80  y[] (real): y coordinates
81  """
82  graph = ROOT.TGraph()
83  for i in range(0, len(x)):
84  graph.SetPoint(i, x[i], y[i])
85  graph.SetLineColor(2)
86  graph.SetLineWidth(1)
87  return graph
88 
89  def makeText(self, x, y, s):
90  """Create and return a ROOT TLatex with the following properties:
91  size = 0.04, color = red, alignment = middle centre, angle = 90 degrees
92 
93  Arguments:
94  x (real): x coordinate
95  y (real): y coordinate
96  s (str): character string
97  """
98  text = ROOT.TLatex(x, y, s)
99  text.SetTextSize(0.04)
100  text.SetTextColor(2)
101  text.SetTextAlign(22)
102  text.SetTextAngle(90)
103  return text
104 
105  def initialize(self):
106  """Handle job initialization: create histograms"""
107 
108  expRun = f'e{int(self.exp):02d}r{int(self.run)}: '
109 
110 
111  self.histogramFilehistogramFile = ROOT.TFile.Open(self.histNamehistName, "RECREATE")
112 
113  # create the rawKLM histograms
114 
115 
116  self.hist_ttc_trigtimehist_ttc_trigtime = ROOT.TH1F('ttc_trigtime',
117  expRun + 'tt_ctime relative to triggertime;' +
118  'tt_ctime - triggertime (ns)',
119  256, -0.5, 2047.5)
120 
121  self.hist_rawKLMlanehist_rawKLMlane = ROOT.TH1F('rawKLMlane',
122  expRun + 'RawKLM lane;Lane (scint: 1..7, RPC: 8..20)',
123  21, -0.5, 20.5)
124 
125  self.hist_rawKLMsizeMultihithist_rawKLMsizeMultihit = ROOT.TH1F('rawKLMsizeMultihit',
126  expRun + 'RawKLM word count (N/channel)',
127  200, -0.5, 199.5)
128 
129  self.hist_rawKLMsizehist_rawKLMsize = ROOT.TH1F('rawKLMsize',
130  expRun + 'RawKLM word count (1/channel)',
131  200, -0.5, 199.5)
132 
133  self.hist_PerChannelMultiplicityhist_PerChannelMultiplicity = ROOT.TH2F(
134  'PerChannelMultiplicity',
135  expRun + 'Per-channel multiplicity (N/channel > 1);' +
136  'Per-channel multiplicity;' +
137  '(Lane #) * 2 + (Axis #)',
138  30, -0.5, 29.5, 42, -0.5, 41.5)
139 
140  self.hist_RPCLaneAxisOccupancyhist_RPCLaneAxisOccupancy = ROOT.TH2F(
141  'RPCLaneAxisOccupancy',
142  expRun + 'Lane/axis occupancy of RPC channels (1/channel);' +
143  'Sector # (always 0);' +
144  '(Lane #) * 2 + (Axis #)',
145  3, -1.5, 1.5, 42, -0.5, 41.5)
146 
147  self.hist_ScintLaneAxisOccupancyhist_ScintLaneAxisOccupancy = ROOT.TH2F(
148  'ScintLaneAxisOccupancy',
149  expRun + 'Lane/axis occupancy of scint channels (1/channel);' +
150  'Sector # (always 0);' +
151  '(Lane #) * 2 + (Axis #)',
152  3, -1.5, 1.5, 42, -0.5, 41.5)
153 
154  self.hist_ChannelOccupancyhist_ChannelOccupancy = [0, 0]
155  self.hist_ChannelOccupancyhist_ChannelOccupancy[0] = ROOT.TH2F('ChannelOccupancy_a0',
156  expRun + 'Channel occupancy for axis 0;lane;channel',
157  42, -0.25, 20.75, 128, -0.25, 63.75)
158  self.hist_ChannelOccupancyhist_ChannelOccupancy[1] = ROOT.TH2F('ChannelOccupancy_a1',
159  expRun + 'Channel occupancy for axis 1;lane;channel',
160  42, -0.25, 20.75, 128, -0.25, 63.75)
161 
162  self.hist_ChannelOccupancyALhist_ChannelOccupancyAL = [
163  [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
164  [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0],
165  [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]
166  for lane in range(0, 21):
167  nChannels = 64 if (lane > 2) else 128
168  label = f'ChannelOccupancy_A0L{lane}'
169  title = f'{expRun}Channel occupancy for axis 0 lane {lane};channel'
170  self.hist_ChannelOccupancyALhist_ChannelOccupancyAL[lane][0] = ROOT.TH1F(label, title, nChannels, -0.5, nChannels - 0.5)
171  label = f'ChannelOccupancy_A1L{lane}'
172  title = f'{expRun}Channel occupancy for axis 1 lane {lane};channel'
173  self.hist_ChannelOccupancyALhist_ChannelOccupancyAL[lane][1] = ROOT.TH1F(label, title, nChannels, -0.5, nChannels - 0.5)
174 
175  self.hist_RPCTimeLowBitsBySectorhist_RPCTimeLowBitsBySector = ROOT.TH2F('RPCTimeLowBitsBySector',
176  expRun + 'RPC TDC lowest-order bits;' +
177  'Sector # (always 0);' +
178  'TDC % 4 (ns) [should be 0]',
179  3, -1.5, 1.5, 8, -0.25, 3.75)
180 
181  self.hist_RPCTimehist_RPCTime = ROOT.TH1F('RPCTime',
182  expRun + 'RPC tdc relative to event trigtime;tdc - triggerTime (ns)',
183  256, -0.5, 1023.5)
184 
185  self.hist_RPCTime2hist_RPCTime2 = ROOT.TH1F('RPCTime_Ctime',
186  expRun + 'RPC tdc relative to event ctime;tdc - trigCtime (ns)',
187  256, -0.5, 1023.5)
188 
189  self.hist_RPCTimePerLayerA0hist_RPCTimePerLayerA0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
190  for lane in range(0, 21):
191  label = f'RPCTimeA0L{lane:02d}'
192  title = f'{expRun}RPC axis 0 lane {lane} time relative to trigtime;t - triggerTime (ns)'
193  self.hist_RPCTimePerLayerA0hist_RPCTimePerLayerA0[lane] = ROOT.TH1F(label, title, 256, -0.5, 1023.5)
194 
195  self.hist_RPCTimePerLayerA1hist_RPCTimePerLayerA1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
196  for lane in range(0, 21):
197  label = f'RPCTimeA1L{lane:02d}'
198  title = f'{expRun}RPC axis 1 lane {lane} time relative to trigtime;t - triggerTime (ns)'
199  self.hist_RPCTimePerLayerA1hist_RPCTimePerLayerA1[lane] = ROOT.TH1F(label, title, 256, -0.5, 1023.5)
200 
201  self.hist_RPCTime2PerLayerA0hist_RPCTime2PerLayerA0 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
202  for lane in range(0, 21):
203  label = f'RPCTime2A0L{lane:02d}'
204  title = f'{expRun}RPC axis 0 lane {lane} time relative to trigCtime;t - trigCtime (ns)'
205  self.hist_RPCTime2PerLayerA0hist_RPCTime2PerLayerA0[lane] = ROOT.TH1F(label, title, 256, -0.5, 1023.5)
206 
207  self.hist_RPCTime2PerLayerA1hist_RPCTime2PerLayerA1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
208  for lane in range(0, 21):
209  label = f'RPCTime2A1L{lane:02d}'
210  title = f'{expRun}RPC axis 1 lane {lane} time relative to trigCtime;t - trigCtime (ns)'
211  self.hist_RPCTime2PerLayerA1hist_RPCTime2PerLayerA1[lane] = ROOT.TH1F(label, title, 256, -0.5, 1023.5)
212 
213  self.hist_RPCTdcRangehist_RPCTdcRange = ROOT.TH1F('RPCTdcRange', expRun + 'RPC TDC-range in event;TDCMax - TDCMin (ns)', 512, -0.5, 2047.5)
214 
215  self.hist_RPCRevotimeRangehist_RPCRevotimeRange = ROOT.TH1F('RPCRevotimeRange',
216  expRun + 'RPC revotime-range in event;revotimeMax - revotimeMin (ns)',
217  128, -0.5, 8191.5)
218 
219  self.hist_revotimeRPCtdchist_revotimeRPCtdc = ROOT.TH2F('revotimeRPCtdc',
220  expRun + 'RPC TDC vs revotime;tdc (ns);revotime - minRevotime',
221  64, 767.5, 1023.5, 10, -0.5, 159.5)
222 
223  self.hist_revotimeRPCtdc2hist_revotimeRPCtdc2 = ROOT.TH2F(
224  'revotimeRPCtdc2',
225  expRun + 'RPC TDC vs revotime;' +
226  'tdc - dt(index) (ns);' +
227  'revotime - minRevotime',
228  64, 767.5, 1023.5, 10, -0.5, 159.5)
229 
230  self.hist_jRPCtdchist_jRPCtdc = ROOT.TH2F('jRPCtdc',
231  expRun + 'RPC TDC vs hit index;tdc (ns);Hit index',
232  64, 767.5, 1023.5, 60, -0.5, 59.5)
233 
234  self.hist_jRPCtdc2hist_jRPCtdc2 = ROOT.TH2F('jRPCtdc2',
235  expRun + 'RPC TDC vs hit index;tdc - dt(index) (ns);Hit index',
236  64, 767.5, 1023.5, 60, -0.5, 59.5)
237 
238  self.hist_ScintTimeLowBitsBySectorhist_ScintTimeLowBitsBySector = ROOT.TH2F(
239  'ScintTimeLowBitsBySector',
240  expRun + 'Scint TDC lowest-order bits;' +
241  'Sector # (always 0);' +
242  'TDC % 4 (ns)',
243  3, -1.5, 1.5, 8, -0.25, 3.75)
244 
245  self.hist_ScintTimehist_ScintTime = ROOT.TH1F('ScintTime',
246  expRun + 'Scint tdc distribution;tdc - triggerTime (ns)',
247  256, -0.5, 1023.5)
248 
249  self.hist_ScintCtimehist_ScintCtime = ROOT.TH1F('ScintCtime',
250  expRun + 'Scint ctime distribution;ctime - triggerCtime (ns)',
251  32, -0.5, 1023.5)
252 
253  self.hist_ScintCtime0hist_ScintCtime0 = ROOT.TH1F('ScintCtime0',
254  expRun + 'Scint ctime distribution;ctime - triggerTime (ns)',
255  32, -0.5, 1023.5)
256 
257  self.hist_ScintCtimeRangehist_ScintCtimeRange = ROOT.TH1F(
258  'ScintCtimeRange', expRun + 'Scint ctime-range in event;ctimeMax - ctimeMin (ns)', 128, -0.5, 8191.5)
259 
260  def terminate(self):
261  """Handle job termination: draw histograms, close output files"""
262 
263  canvas = ROOT.TCanvas("canvas", self.pdfNamepdfName, 1600, 1600)
264  title = f'{self.pdfName}['
265  canvas.SaveAs(title)
266  canvas.Clear()
267  canvas.GetPad(0).SetGrid(1, 1)
268  canvas.GetPad(0).Update()
269  self.hist_rawKLMlanehist_rawKLMlane.Draw()
270  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_rawKLMlane.GetName()}")
271  self.hist_rawKLMsizeMultihithist_rawKLMsizeMultihit.Draw()
272  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_rawKLMsizeMultihit.GetName()}")
273  self.hist_rawKLMsizehist_rawKLMsize.Draw()
274  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_rawKLMsize.GetName()}")
275  self.hist_PerChannelMultiplicityhist_PerChannelMultiplicity.Draw("box")
276  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_PerChannelMultiplicity.GetName()}")
277  canvas.Clear()
278  canvas.Divide(2, 1)
279  canvas.GetPad(0).SetGrid(1, 1)
280  canvas.GetPad(1).SetGrid(1, 1)
281  canvas.GetPad(2).SetGrid(1, 1)
282  for sectorFB in range(0, 1):
283  canvas.cd(1)
284  self.hist_ChannelOccupancyhist_ChannelOccupancy[0].Draw("colz")
285  canvas.cd(2)
286  self.hist_ChannelOccupancyhist_ChannelOccupancy[1].Draw("colz")
287  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_ChannelOccupancy[0].GetName()}")
288  for lane in range(0, 21):
289  n0 = self.hist_ChannelOccupancyALhist_ChannelOccupancyAL[lane][0].GetEntries()
290  n1 = self.hist_ChannelOccupancyALhist_ChannelOccupancyAL[lane][1].GetEntries()
291  if n0 + n1 > 0:
292  canvas.cd(1)
293  self.hist_ChannelOccupancyALhist_ChannelOccupancyAL[lane][0].Draw()
294  canvas.cd(2)
295  self.hist_ChannelOccupancyALhist_ChannelOccupancyAL[lane][1].Draw()
296  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_ChannelOccupancyAL[lane][0].GetName()}")
297  canvas.Clear()
298  canvas.Divide(1, 1)
299  self.hist_ttc_trigtimehist_ttc_trigtime.Draw()
300  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_ttc_trigtime.GetName()}")
301  self.hist_RPCTimeLowBitsBySectorhist_RPCTimeLowBitsBySector.Draw("box")
302  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_RPCTimeLowBitsBySector.GetName()}")
303  self.hist_RPCTimehist_RPCTime.Draw()
304  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_RPCTime.GetName()}")
305  for lane in range(0, 21):
306  if self.hist_RPCTimePerLayerA0hist_RPCTimePerLayerA0[lane].GetEntries() > 0:
307  self.hist_RPCTimePerLayerA0hist_RPCTimePerLayerA0[lane].Draw()
308  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_RPCTimePerLayerA0[lane].GetName()}")
309  for lane in range(0, 21):
310  if self.hist_RPCTimePerLayerA1hist_RPCTimePerLayerA1[lane].GetEntries() > 0:
311  self.hist_RPCTimePerLayerA1hist_RPCTimePerLayerA1[lane].Draw()
312  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_RPCTimePerLayerA1[lane].GetName()}")
313  self.hist_RPCTdcRangehist_RPCTdcRange.Draw()
314  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_RPCTdcRange.GetName()}")
315  self.hist_RPCRevotimeRangehist_RPCRevotimeRange.Draw()
316  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_RPCRevotimeRange.GetName()}")
317  self.hist_revotimeRPCtdchist_revotimeRPCtdc.Draw("colz")
318  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_revotimeRPCtdc.GetName()}")
319  # self.hist_revotimeRPCtdc2.Draw("colz")
320  # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_revotimeRPCtdc2.GetName()))
321  self.hist_jRPCtdchist_jRPCtdc.Draw("colz")
322  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_jRPCtdc.GetName()}")
323  # self.hist_jRPCtdc2.Draw("colz")
324  # canvas.Print(self.pdfName, "Title:{0}".format(self.hist_jRPCtdc2.GetName()))
325  self.hist_ScintTimeLowBitsBySectorhist_ScintTimeLowBitsBySector.Draw("box")
326  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_ScintTimeLowBitsBySector.GetName()}")
327  self.hist_ScintTimehist_ScintTime.Draw()
328  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_ScintTime.GetName()}")
329  self.hist_ScintCtimehist_ScintCtime.Draw()
330  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_ScintCtime.GetName()}")
331  self.hist_ScintCtime0hist_ScintCtime0.Draw()
332  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_ScintCtime0.GetName()}")
333  self.hist_ScintCtimeRangehist_ScintCtimeRange.Draw()
334  canvas.Print(self.pdfNamepdfName, f"Title:{self.hist_ScintCtimeRange.GetName()}")
335  pdfNameLast = f'{self.pdfName}]'
336  canvas.Print(pdfNameLast, f"Title:{self.hist_ScintCtimeRange.GetName()}")
337  self.histogramFilehistogramFile.Write()
338  self.histogramFilehistogramFile.Close()
339  print('Goodbye')
340 
341  def beginRun(self):
342  """Handle begin of run: print diagnostic message"""
343  print('beginRun', self.runrun)
344 
345  def endRun(self):
346  """Handle end of run: print diagnostic message"""
347  print('endRun', self.runrun)
348 
349  def event(self, eventHits, tt_ctime, raw_time):
350  """Process one event: fill histograms"""
351 
352  sectorFB = 0
353  n = len(eventHits)
354  countAllMultihit = 2 * n + 1 if (n > 0) else 0
355  countAll = 1
356  channelMultiplicity = {}
357  minCtime = 99999
358  minRPCTdc = 99999
359  maxRPCTdc = 0
360  minRPCCtime = 99999
361  maxRPCCtime = 0
362  minScintCtime = 99999
363  maxScintCtime = 0
364  self.hist_ttc_trigtimehist_ttc_trigtime.Fill((tt_ctime - raw_time) & 0x0fff)
365  for j in range(0, n):
366  items = eventHits[j]
367  lane = items[0]
368  channel = items[1]
369  axis = items[2]
370  ctime = items[3] # this is revo9 time for RPCs, ctime for scintillators
371  flag = 1 if (lane > 2) else 2
372  isRPC = (flag == 1)
373  isScint = (flag == 2) # noqa (F841) kept for completeness
374  laneAxisChannel = (((lane << 1) + axis) << 7) + channel
375  if laneAxisChannel not in channelMultiplicity:
376  countAll = countAll + 2
377  channelMultiplicity[laneAxisChannel] = 0
378  channelMultiplicity[laneAxisChannel] = channelMultiplicity[laneAxisChannel] + 1
379  if ctime < minCtime:
380  minCtime = ctime
381  self.hist_rawKLMlanehist_rawKLMlane.Fill(lane)
382  for j in range(0, n):
383  items = eventHits[j]
384  lane = items[0]
385  channel = items[1]
386  axis = items[2]
387  ctime = items[3] # this is revo9 time for RPCs, ctime for scintillators
388  tdc = items[4]
389  charge = items[5] # noqa (F841) kept for completeness
390  flag = 1 if (lane > 2) else 2
391  isRPC = (flag == 1)
392  isScint = (flag == 2) # noqa (F841) kept for completeness
393  laneAxisChannel = (((lane << 1) + axis) << 7) + channel
394  laneAxis = axis if ((lane < 1) or (lane > 20)) else ((lane << 1) + axis)
395  if laneAxisChannel in channelMultiplicity:
396  if channelMultiplicity[laneAxisChannel] > 1:
397  self.hist_PerChannelMultiplicityhist_PerChannelMultiplicity.Fill(channelMultiplicity[laneAxisChannel], laneAxis)
398  # DIVOT del channelMultiplicity[laneAxisChannel] # consider only first hit in the channel/axis/lane of this dc
399  t = (tdc - raw_time) & 0x03ff # in ns, range is 0..1023
400  t2 = (tdc - tt_ctime) & 0x03ff # in ns, range is 0..1023
401  ct = ((ctime << 3) - tt_ctime) & 0x3ff
402  if isRPC:
403  if tdc < minRPCTdc:
404  minRPCTdc = tdc
405  if tdc > maxRPCTdc:
406  maxRPCTdc = tdc
407  if ctime < minRPCCtime:
408  minRPCCtime = ctime
409  if ctime > maxRPCCtime:
410  maxRPCCtime = ctime
411  self.hist_RPCTimeLowBitsBySectorhist_RPCTimeLowBitsBySector.Fill(sectorFB, (tdc & 3))
412  self.hist_RPCLaneAxisOccupancyhist_RPCLaneAxisOccupancy.Fill(sectorFB, laneAxis)
413  self.hist_RPCTimehist_RPCTime.Fill(t)
414  self.hist_RPCTime2hist_RPCTime2.Fill(t2)
415  if axis == 0:
416  self.hist_RPCTimePerLayerA0hist_RPCTimePerLayerA0[lane].Fill(t)
417  self.hist_RPCTime2PerLayerA0hist_RPCTime2PerLayerA0[lane].Fill(t2)
418  else:
419  self.hist_RPCTimePerLayerA1hist_RPCTimePerLayerA1[lane].Fill(t)
420  self.hist_RPCTime2PerLayerA1hist_RPCTime2PerLayerA1[lane].Fill(t2)
421  if n > 0:
422  t0j = 0.75 * j
423  self.hist_revotimeRPCtdchist_revotimeRPCtdc.Fill(t, ctime - minCtime)
424  self.hist_revotimeRPCtdc2hist_revotimeRPCtdc2.Fill(t - t0j, ctime - minCtime)
425  self.hist_jRPCtdchist_jRPCtdc.Fill(t, j)
426  self.hist_jRPCtdc2hist_jRPCtdc2.Fill(t - t0j, j)
427  else:
428  if ctime < minScintCtime:
429  minScintCtime = ctime
430  if ctime > maxScintCtime:
431  maxScintCtime = ctime
432  self.hist_ScintTimeLowBitsBySectorhist_ScintTimeLowBitsBySector.Fill(sectorFB, (tdc & 3))
433  self.hist_ScintLaneAxisOccupancyhist_ScintLaneAxisOccupancy.Fill(sectorFB, laneAxis)
434  self.hist_ScintTimehist_ScintTime.Fill(t)
435  self.hist_ScintCtimehist_ScintCtime.Fill(ct)
436  self.hist_ScintCtime0hist_ScintCtime0.Fill(((ctime << 3) - raw_time) & 0x3ff)
437  self.hist_ChannelOccupancyhist_ChannelOccupancy[axis].Fill(lane, channel)
438  self.hist_ChannelOccupancyALhist_ChannelOccupancyAL[lane][axis].Fill(channel)
439  if n > 1:
440  if maxRPCTdc > 0:
441  self.hist_RPCTdcRangehist_RPCTdcRange.Fill(maxRPCTdc - minRPCTdc)
442  if maxRPCCtime > 0:
443  self.hist_RPCRevotimeRangehist_RPCRevotimeRange.Fill((maxRPCCtime - minRPCCtime) << 3)
444  if maxScintCtime > 0:
445  self.hist_ScintCtimeRangehist_ScintCtimeRange.Fill((maxScintCtime - minScintCtime) << 3)
446  self.hist_rawKLMsizeMultihithist_rawKLMsizeMultihit.Fill(countAllMultihit)
447  self.hist_rawKLMsizehist_rawKLMsize.Fill(countAll)
hist_ChannelOccupancyAL
histograms of channel occupancy (1 hit per readout channel), indexed by axis/lane
hist_PerChannelMultiplicity
scatterplot of multiplicity of entries in one readout channel vs lane/axis
hist_ScintCtimeRange
histogram of scint CTIME range in event
hist_RPCTimePerLayerA0
histograms of RPC TDC value relative to event's trigger time for axis 0, indexed by lane
hist_jRPCtdc
scatterplot of RPC calibrated time vs hit's index
hist_RPCTimePerLayerA1
histograms of RPC TDC value relative to event's trigger time for axis 1, indexed by lane
hist_RPCTdcRange
histogram of RPC TDC range in event
hist_RPCTime2PerLayerA0
histograms of RPC TDC value relative to event's ctime for axis 0, indexed by lane
hist_ScintLaneAxisOccupancy
scatterplot of number of mapped scint hits by lane/axis vs sector, at most one entry per readout chan...
def event(self, eventHits, tt_ctime, raw_time)
hist_rawKLMsizeMultihit
histogram of number of hits, including multiple entries on one readout channel
hist_revotimeRPCtdc
scatterplot of RPC REVO9 range vs TDC value in event
hist_ChannelOccupancy
scatterplots of channel occupancy (1 hit per readout channel) for each axis
hist_revotimeRPCtdc2
scatterplot of RPC REVO9 range vs TDC value corrected for DC-processing delay in event
hist_ttc_trigtime
histogram of the tt_ctime relative to triggertime
def __init__(self, exp, run, histName, pdfName)
hist_RPCRevotimeRange
histogram of RPC REVO9 range in event
hist_RPCTimeLowBitsBySector
scatterplot of RPC TDC low-order bits vs sector (should be 0 since granularity is 4 ns)
hist_RPCTime2
histogram of RPC TDC value relative to event's ctime in event header
hist_ScintCtime
histogram of scint CTIME value relative to event's ctime
hist_RPCTime
histogram of RPC TDC value relative to event's REVO9 trigger time in last word of event
hist_ScintTime
histogram of scint TDC value relative to event's trigger time
pdfName
internal copy of the pathname of the output histogram PDF file
hist_RPCTime2PerLayerA1
histograms of RPC TDC value relative to event's ctime for axis 1, indexed by lane
histogramFile
Output ROOT TFile that will contain the histograms/scatterplots.
hist_ScintTimeLowBitsBySector
scatterplot of scint TDC low-order bits vs sector
histName
internal copy of the pathname of the output histogram ROOT file
hist_RPCLaneAxisOccupancy
scatterplot of number of mapped RPC hits by lane/axis vs sector, at most one entry per readout channe...
hist_ScintCtime0
histogram of scint CTIME value relative to event's trigger time
hist_rawKLMsize
histogram of number of hits, at most one entry per readout channel
hist_jRPCtdc2
scatterplot of RPC calibrated time vs hit's index, corrected for DC-processing delay