18from ROOT
import Belle2
24 Prints PID log likelihoods + basic track info in a well formatted way.
25 User
is prompted to
continue or quit at each event
30 Print log likelihoods and wait
for user respond.
34 exp = evtMetaData.obj().getExperiment()
35 run = evtMetaData.obj().getRun()
36 evt = evtMetaData.obj().getEvent()
38 print(
'Experiment ' + str(exp) +
' Run ' + str(run) +
' Event ' + str(evt) +
':')
42 fitresult = track.getTrackFitResult(Belle2.Const.pion)
44 p_mag = fitresult.getMomentum().Mag()
45 pmom =
'{:5.3f}'.format(p_mag) +
' GeV/c'
48 mcpart = track.getRelated(
'MCParticles')
50 pdg = str(mcpart.getPDG())
53 index = track.getArrayIndex()
54 print(
'Track ' + str(index) +
': p = ' + pmom +
' MCtruth = ' + pdg)
55 likelihood = track.getRelated(
'PIDLikelihoods')
57 print(
'logLikelihoods:')
58 likelihood.printArray()
60 print(
'--> No relation to PIDLikelihood')
64 response = input(
"Type Enter to continue or Q to quit.\n").lower().strip()
66 evtMetaData.obj().setEndOfData()
69b2.set_log_level(b2.LogLevel.ERROR)
72main = b2.create_path()
75roinput = b2.register_module(
'RootInput')
76main.add_module(roinput)
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.