24 from ROOT
import Belle2
25 from ROOT
import TCanvas, TH2F
26 from simulation
import add_simulation
27 from reconstruction
import add_reconstruction
41 hist[0].SetTitle(
'True pions, dE/dx')
42 hist[1].SetTitle(
'True kaons, dE/dx')
43 hist[2].SetTitle(
'True pions, TOP')
44 hist[3].SetTitle(
'True kaons, TOP')
52 Get LL differences from PIDLikelihood and fill them into histograms
57 call constructor of base class, required.
64 reimplement Module::event()
69 track = pid.getRelatedFrom(
'Tracks')
71 mcpart = track.getRelatedTo(
'MCParticles')
72 if not track
or not mcpart:
74 b2.B2WARNING(
'problems with track <-> mcparticle relations')
76 print(
'event: %d, track: %d' % (event, track.getArrayIndex()))
78 pdg = abs(mcpart.getPDG())
79 momentumVec = mcpart.getMomentum()
80 momentum = momentumVec.Mag()
86 selectedpart = Belle2.Const.kaon
89 logl_sel = pid.getLogL(selectedpart, pid_dedx)
90 logl_pi = pid.getLogL(Belle2.Const.pion, pid_dedx)
91 dedx_DLL = logl_pi - logl_sel
93 logl_sel = pid.getLogL(selectedpart, pid_top)
94 logl_pi = pid.getLogL(Belle2.Const.pion, pid_top)
95 top_DLL = logl_pi - logl_sel
97 if pdg == selectedpart.getPDGCode():
98 hist[0].Fill(momentum, dedx_DLL)
99 hist[2].Fill(momentum, top_DLL)
101 hist[1].Fill(momentum, dedx_DLL)
102 hist[3].Fill(momentum, top_DLL)
106 Draw histograms on canvas and save image.
109 c1 = TCanvas(
'c',
'c', 800, 600)
117 c1.SaveAs(
'll_diff.png')
118 print(
'Output plots saved in ll_diff.png')
122 main = b2.create_path()
125 eventinfosetter = b2.register_module(
'EventInfoSetter')
126 eventinfosetter.param(
'evtNumList', [20])
127 main.add_module(eventinfosetter)
128 main.add_module(
'EvtGenInput')
132 add_reconstruction(main)
A class for sets of detector IDs whose content is limited to restricted set of valid detector IDs.
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.