28 def event(self):
29 '''
30 Print log likelihoods and wait for user respond.
31 '''
32
34 exp = evtMetaData.obj().getExperiment()
35 run = evtMetaData.obj().getRun()
36 evt = evtMetaData.obj().getEvent()
37 print()
38 print('Experiment ' + str(exp) + ' Run ' + str(run) + ' Event ' + str(evt) + ':')
39 print()
41 for track in tracks:
42 fitresult = track.getTrackFitResult(Belle2.Const.pion)
43 if fitresult:
44 p_mag = fitresult.getMomentum().Mag()
45 pmom = '{:5.3f}'.format(p_mag) + ' GeV/c'
46 else:
47 pmom = '?'
48 mcpart = track.getRelated('MCParticles')
49 if mcpart:
50 pdg = str(mcpart.getPDG())
51 else:
52 pdg = '?'
53 index = track.getArrayIndex()
54 print('Track ' + str(index) + ': p = ' + pmom + ' MCtruth = ' + pdg)
55 likelihood = track.getRelated('PIDLikelihoods')
56 try:
57 print('logLikelihoods:')
58 likelihood.printArray()
59 except BaseException:
60 print('--> No relation to PIDLikelihood')
61 print()
62
63
64 response = input("Type Enter to continue or Q to quit.\n").lower().strip()
65 if response == "q":
66 evtMetaData.obj().setEndOfData()
67
68
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.