23from ROOT
import Belle2
24from ROOT
import TCanvas, TH2F
25from simulation
import add_simulation
26from reconstruction
import add_reconstruction
40hist[0].SetTitle(
'True pions, dE/dx')
41hist[1].SetTitle(
'True kaons, dE/dx')
42hist[2].SetTitle(
'True pions, TOP')
43hist[3].SetTitle(
'True kaons, TOP')
51 Get LL differences from PIDLikelihood
and fill them into histograms
56 call constructor of base class, required.
63 reimplement Module::event()
68 track = pid.getRelatedFrom(
'Tracks')
70 mcpart = track.getRelatedTo(
'MCParticles')
71 if not track
or not mcpart:
73 b2.B2WARNING(
'problems with track <-> mcparticle relations')
75 print(f
'event: {int(event)}, track: {int(track.getArrayIndex())}')
77 pdg = abs(mcpart.getPDG())
78 momentumVec = mcpart.getMomentum()
79 momentum = momentumVec.Mag()
85 selectedpart = Belle2.Const.kaon
88 logl_sel = pid.getLogL(selectedpart, pid_dedx)
89 logl_pi = pid.getLogL(Belle2.Const.pion, pid_dedx)
90 dedx_DLL = logl_pi - logl_sel
92 logl_sel = pid.getLogL(selectedpart, pid_top)
93 logl_pi = pid.getLogL(Belle2.Const.pion, pid_top)
94 top_DLL = logl_pi - logl_sel
96 if pdg == selectedpart.getPDGCode():
97 hist[0].Fill(momentum, dedx_DLL)
98 hist[2].Fill(momentum, top_DLL)
100 hist[1].Fill(momentum, dedx_DLL)
101 hist[3].Fill(momentum, top_DLL)
105 Draw histograms on canvas and save image.
108 c1 = TCanvas('c',
'c', 800, 600)
116 c1.SaveAs(
'll_diff.png')
117 print(
'Output plots saved in ll_diff.png')
121main = b2.create_path()
124eventinfosetter = b2.register_module(
'EventInfoSetter')
125eventinfosetter.param(
'evtNumList', [20])
126main.add_module(eventinfosetter)
127main.add_module(
'EvtGenInput')
131add_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.