18 from ROOT
import Belle2
19 from ROOT
import TH1F, TH2F, TCanvas
33 hist[0].SetTitle(
'True pions, dE/dx')
34 hist[1].SetTitle(
'True kaons, dE/dx')
35 hist[2].SetTitle(
'True pions, TOP')
36 hist[3].SetTitle(
'True kaons, TOP')
44 Get LL differences from PIDLikelihood and fill them into histograms
49 call constructor of base class, required.
56 reimplement Module::event()
61 track = pid.getRelatedFrom(
'Tracks')
63 mcpart = track.getRelatedTo(
'MCParticles')
64 if not track
or not mcpart:
66 B2WARNING(
'problems with track <-> mcparticle relations')
68 print(
'event: %d, track: %d' % (event, track.getArrayIndex()))
70 pdg = abs(mcpart.getPDG())
71 momentumVec = mcpart.getMomentum()
72 momentum = momentumVec.Mag()
75 theta = momentumVec.CosTheta()
78 selectedpart = Belle2.Const.kaon
81 logl_sel = pid.getLogL(selectedpart, pid_dedx)
82 logl_pi = pid.getLogL(Belle2.Const.pion, pid_dedx)
83 dedx_DLL = logl_pi - logl_sel
85 logl_sel = pid.getLogL(selectedpart, pid_top)
86 logl_pi = pid.getLogL(Belle2.Const.pion, pid_top)
87 top_DLL = logl_pi - logl_sel
89 if pdg == selectedpart.getPDGCode():
90 hist[0].Fill(momentum, dedx_DLL)
91 hist[2].Fill(momentum, top_DLL)
93 hist[1].Fill(momentum, dedx_DLL)
94 hist[3].Fill(momentum, top_DLL)
98 Draw histograms on canvas and save image.
101 c1 = TCanvas(
'c',
'c', 800, 600)
109 c1.SaveAs(
'll_diff.png')
110 print(
'Output plots saved in ll_diff.png')
117 eventinfosetter = register_module(
'EventInfoSetter')
118 eventinfosetter.param(
'evtNumList', [20])
119 main.add_module(eventinfosetter)
120 main.add_module(
'EvtGenInput')
123 from simulation
import add_simulation
124 from reconstruction
import add_reconstruction
126 add_reconstruction(main)