Belle II Software development
printPIDLikelihoods Class Reference
Inheritance diagram for printPIDLikelihoods:

Public Member Functions

def event (self)
 

Detailed Description

Prints PID log likelihoods + basic track info in a well formatted way.
User is prompted to continue or quit at each event

Definition at line 21 of file printPIDLikelihoods.py.

Member Function Documentation

◆ event()

def event (   self)
Print log likelihoods and wait for user respond.

Definition at line 28 of file printPIDLikelihoods.py.

28 def event(self):
29 '''
30 Print log likelihoods and wait for user respond.
31 '''
32
33 evtMetaData = Belle2.PyStoreObj('EventMetaData')
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()
40 tracks = Belle2.PyStoreArray('Tracks')
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 # wait for user respond
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.
Definition: PyStoreArray.h:72
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67

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