Belle II Software  release-05-02-19
WaveformAnalyzer Class Reference
Inheritance diagram for WaveformAnalyzer:
Collaboration diagram for WaveformAnalyzer:

Public Member Functions

def initialize (self)
 
def event (self)
 
def terminate (self)
 

Public Attributes

 feProps
 output ntuple
 
 nWaveForms
 number of waveforms processed
 
 nWaveFormsOutOfOrder
 number of waveforms out of order
 
 f
 object of output file
 
 plotCounter
 counts how many plots were created. More...
 

Detailed Description

Analyzes waveform and FE data

Definition at line 116 of file TOPFE_qualityPlots.py.

Member Function Documentation

◆ event()

def event (   self)
Event processor: get data and print to screen

Definition at line 145 of file TOPFE_qualityPlots.py.

145  def event(self):
146  '''
147  Event processor: get data and print to screen
148  '''
149  evtMetaData = Belle2.PyStoreObj('EventMetaData')
150  event = evtMetaData.obj().getEvent()
151  run = evtMetaData.obj().getRun()
152  waveforms = Belle2.PyStoreArray('TOPRawWaveforms')
153  for waveform in waveforms:
154  chan = waveform.getChannel()
155  self.nWaveForms += 1
156  # declare some counters for our ntuple
157  nInFirstWindow, nNarrowPeaks, nHeight150, nOscillations = 0, 0, 0, 0
158 
159  # waveform.areWindowsInOrder is a bit too strict at the moment
160  wins = np.array(waveform.getStorageWindows())
161  if not np.all(wins[:-1] <= wins[1:]): # change false for pics
162  self.nWaveFormsOutOfOrder += 1
163  if False and args.plotWaveforms:
164  wf_display(waveform, run, event, "windowOrder")
165  self.plotCounter += 1
166 
167  wf = np.array(waveform.getWaveform())
168  if False and args.plotWaveforms:
169  wf_display(waveform, run, event, "general")
170  self.plotCounter += 1
171 
172  # If TOPWaveformFeatureExtractor has been run then there are extra
173  # TOPRawDigits related to this waveform
174  rawDigits = waveform.getRelationsWith("TOPRawDigits")
175  nTOPRawDigits = len(rawDigits)
176 
177  if False and args.plotWaveforms and nTOPRawDigits > 2:
178  # There are at least 3 Top raw digits
179  wf_display(waveform, run, event, "manyPeaks")
180  self.plotCounter += 1
181  if False and args.plotWaveforms and nTOPRawDigits > 3:
182  # There are at least 4 TOPRawDigits
183  wf_display(waveform, run, event, "tooManyPeaks")
184  self.plotCounter += 1
185  raw = rawDigits[0]
186  fePeakHt = raw.getValuePeak()
187  fePeakTDC = raw.getSamplePeak()
188  fePeakWd = raw.getSampleFall() - raw.getSampleRise()
189  fePeakIntegral = raw.getIntegral()
190  # we are sorting the peaks. The FE should always point to the highest one
191 
192  # the channel we get from the waveform encodes the asic, carrier, and the actual channel
193  if 0 < fePeakTDC < 65 and chan % 8 == 0:
194  # To see if cal pulse is in first window
195  nInFirstWindow += 1
196  if False and args.plotWaveforms:
197  wf_display(waveform, run, event, "calPuls_firstWin")
198  self.plotCounter += 1
199 
200  # there are strange bumps in the ADC distribtion of the cal channels
201  if (140 < fePeakHt < 220) and chan % 8 == 0:
202  if False and args.plotWaveforms:
203  wf_display(waveform, run, event, "strangeADCBump_1")
204  self.plotCounter += 1
205  if (300 < fePeakHt < 410) and chan % 8 == 0:
206  if False and args.plotWaveforms:
207  wf_display(waveform, run, event, "strangeADCBump_2")
208  self.plotCounter += 1
209 
210  fePeak1Ht = -1
211  fePeak1TDC = -1
212  fePeak1Wd = -1
213  fePeak1Integral = -1
214  if nTOPRawDigits > 1:
215  # if there is a second TOPRawDigit then get it for our ntuple
216  fePeak1Ht = rawDigits[1].getValuePeak()
217  fePeak1TDC = rawDigits[1].getSamplePeak()
218  fePeak1Wd = rawDigits[1].getSampleFall() - rawDigits[1].getSampleRise()
219  fePeak1Integral = rawDigits[1].getIntegral()
220 
221  if nTOPRawDigits > 1 and fePeak1TDC < 64:
222  # counting the times that the second digit is found in the first window
223  if False and args.plotWaveforms:
224  wf_display(waveform, run, event, "secondPeakInFirstWindow")
225  self.plotCounter += 1
226 
227  if fePeakWd < 5 or nTOPRawDigits > 1 and fePeak1Wd < 5:
228  # counting thin peaks
229  nNarrowPeaks += 1
230  if False and args.plotWaveforms:
231  wf_display(waveform, run, event, "thinpeak")
232  self.plotCounter += 1
233 
234  if 145 < fePeak1Ht < 155 and chan % 8 == 0:
235  # Jan needs to write a comment about why we're doing this test
236  nHeight150 += 1
237  if False and args.plotWaveforms:
238  wf_display(waveform, run, event, "peak1Ht_is_150")
239  self.plotCounter += 1
240 
241  if nTOPRawDigits > 5 and (fePeakHt - fePeak1Ht) < 5:
242  if np.mean(wf) < 10:
243  # want to count the portion of times we see this oscillation behavior
244  # guard the call to numpy.mean by the previous if statements
245  nOscillations += 1
246  if False and args.plotWaveforms:
247  wf_display(waveform, run, event, "oscillations")
248  self.plotCounter += 1
249 
250  self.feProps.Fill(
251  event,
252  run,
253  fePeak1Ht,
254  fePeak1TDC,
255  fePeak1Wd,
256  fePeakHt,
257  fePeakTDC,
258  fePeakWd,
259  fePeakIntegral,
260  nTOPRawDigits,
261  chan,
262  nNarrowPeaks,
263  nInFirstWindow,
264  nHeight150,
265  nOscillations,
266  )
267 
268  # only plot the first 10 figures.
269  if args.plotWaveforms and self.plotCounter >= 10:
270  evtMetaData.obj().setEndOfData()
271 

◆ initialize()

def initialize (   self)
Initialize the Module: open the canvas. 

Definition at line 121 of file TOPFE_qualityPlots.py.

◆ terminate()

def terminate (   self)
End of run

Definition at line 272 of file TOPFE_qualityPlots.py.

Member Data Documentation

◆ plotCounter

plotCounter

counts how many plots were created.

Stop after 10

Definition at line 143 of file TOPFE_qualityPlots.py.


The documentation for this class was generated from the following file:
Belle2::PyStoreObj
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:69
ClusterEfficiency.ClusterEfficiency.event
def event(self)
Definition: ClusterEfficiency.py:146
Belle2::getRun
static ExpRun getRun(map< ExpRun, pair< double, double >> runs, double t)
Get exp number + run number from time.
Definition: Splitter.cc:262
Belle2::PyStoreArray
a (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:58