Belle II Software  release-08-01-10
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 121 of file TOPFE_qualityPlots.py.

Member Function Documentation

◆ event()

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

Definition at line 150 of file TOPFE_qualityPlots.py.

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

◆ initialize()

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

Definition at line 126 of file TOPFE_qualityPlots.py.

◆ terminate()

def terminate (   self)
End of run

Definition at line 277 of file TOPFE_qualityPlots.py.

Member Data Documentation

◆ plotCounter

plotCounter

counts how many plots were created.

Stop after 10

Definition at line 148 of file TOPFE_qualityPlots.py.


The documentation for this class was generated from the following file: