240 ''' event processing '''
244 b2.B2ERROR(
'no TOPRecBunch')
246 if not recBunch.isReconstructed():
248 self.bunchOffset.Fill(recBunch.getCurrentOffset())
251 self.data.run = evtMetaData.getRun()
252 self.data.offset = recBunch.getCurrentOffset()
253 self.data.usedTrk = recBunch.getUsedTracks()
256 pdfs = track.getRelated(
'TOPPDFCollections')
259 self.data.slot = pdfs.getModuleID()
260 momentum = pdfs.getAssociatedLocalMomentum()
261 position = pdfs.getAssociatedLocalHit()
262 self.data.p = momentum.Mag()
263 self.data.cth = momentum.CosTheta()
264 self.data.phi = momentum.Phi()
265 self.data.z = position.Z()
266 self.data.x = position.X()
267 self.data.tof = self.getTOF(track, 13, self.data.slot)
269 tfit = track.getTrackFitResultWithClosestMass(Belle2.Const.muon)
270 except BaseException:
271 b2.B2ERROR(
"No trackFitResult available")
273 self.data.charge = tfit.getChargeSign()
274 pocaPosition = tfit.getPosition()
275 self.data.poca_x = pocaPosition.X()
276 self.data.poca_y = pocaPosition.Y()
277 self.data.poca_z = pocaPosition.Z()
278 self.data.hitsCDC = tfit.getHitPatternCDC().getNHits()
279 Ecms = self.getEcms(tfit, Belle2.Const.muon)
280 self.data.dEcms = Ecms[0] - Ecms[1]
281 if not self.trackSelected():
284 topll = track.getRelated(
'TOPLikelihoods')
285 extHit = topll.getRelated(
'ExtHits')
286 timeZero = extHit.getRelated(
'TOPTimeZeros')
287 self.data.rec_t0 = timeZero.getTime()
288 self.data.valid_t0 = timeZero.isValid()
289 except BaseException:
291 self.data.valid_t0 = 0
293 self.h_cth_vs_p.Fill(self.data.p, self.data.cth)
294 self.h_momentum.Fill(self.data.p)
295 self.h_cth.Fill(self.data.cth)
296 self.h_phi.Fill(self.data.phi)
297 self.h_z.Fill(self.data.z)
298 self.h_x.Fill(self.data.x)
299 self.h_charge.Fill(self.data.charge)
300 self.h_poca_xy.Fill(self.data.poca_x, self.data.poca_y)
301 self.h_poca_z.Fill(self.data.poca_z)
302 self.h_hitsCDC.Fill(self.data.hitsCDC)
303 self.h_Ecms.Fill(Ecms[0])
305 pdf = pdfs.getHypothesisPDF(13)
306 except BaseException:
307 b2.B2ERROR(
"No PDF available for PDG = 13")
310 self.pdfHistogram(pdf)
311 x0 = position.X() - momentum.X() / momentum.Y() * position.Y()
312 z0 = position.Z() - momentum.Z() / momentum.Y() * position.Y()
315 if digit.getModuleID() == self.data.slot
and digit.getHitQuality() == 1:
320 self.data.channel[k] = digit.getChannel()
321 self.data.pixel[k] = digit.getPixelID()
322 self.data.time[k] = digit.getTime()
323 self.data.timeErr[k] = digit.getTimeError()
324 self.data.pulseHeight[k] = digit.getPulseHeight()
325 self.data.pulseWidth[k] = digit.getPulseWidth()
326 self.data.sample[k] = digit.getModulo256Sample()
327 self.data.status[k] = digit.getStatus()
328 peaks = pdf[digit.getPixelID() - 1]
331 self.data.wid0[k] = 0
334 sorted_peaks = self.sortPeaks(peaks)
335 self.data.t0[k] = sorted_peaks[0].mean
336 self.data.wid0[k] = sorted_peaks[0].width
337 self.data.t1[k] = self.data.t0[k] + 100
339 self.data.t1[k] = sorted_peaks[1].mean
340 self.data.t_pdf[k] = 0
341 self.data.type[k] = 0
354 self.data.alpha[k] = 0
355 assocPDF = digit.getRelated(
'TOPAssociatedPDFs')
357 pik = assocPDF.getSinglePeak()
359 self.data.t_pdf[k] = pik.position
360 self.data.type[k] = pik.type
361 self.data.nx[k] = pik.nx
362 self.data.ny[k] = pik.ny
363 self.data.nxm[k] = pik.nxm
364 self.data.nym[k] = pik.nym
365 self.data.nxe[k] = pik.nxe
366 self.data.nye[k] = pik.nye
368 self.data.nys[k] = int(pik.nye / 2)
370 self.data.nys[k] = int((pik.nye + 1) / 2)
371 self.data.xd[k] = pik.xd
372 self.data.yd[k] = pik.yd
374 self.data.xm[k] = x0 + pik.kxe / pik.kze * (130.0 - z0)
375 self.data.kx[k] = pik.kxe
376 self.data.ky[k] = pik.kye
377 self.data.alpha[k] = math.degrees(math.acos(abs(pik.kzd)))
a (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.