10 sTree = lsOfGlobals.FindObject(
"cbmsim")
12 fPos = ROOT.TVector3()
13 fMom = ROOT.TVector3()
16 for index, track
in enumerate(sTree.MCTrack):
17 if abs(track.GetPdgCode()) == MUON
and index
not in checked_muons:
18 muon_to_follow = index
19 checked_muons.add(muon_to_follow)
22 if muon_to_follow == -1:
25 fT = sTree.MCTrack[muon_to_follow]
26 fT.GetStartVertex(fPos)
28 hitlist[fPos.Z()] = [fPos.X(), fPos.Y(), fT.GetP()]
30 for P
in [
"vetoPoint",
"strawtubesPoint",
"ShipRpcPoint",
"TargetPoint"]:
31 if not sTree.GetBranch(P):
33 c = eval(
"sTree." + P)
35 if p.GetTrackID() == muon_to_follow:
37 if hasattr(p,
"LastPoint"):
39 hitlist[lp.z()] = [lp.x(), lp.y(), p.LastMom().Mag()]
40 hitlist[2.0 * p.GetZ() - lp.z()] = [2.0 * p.GetX() - lp.x(), 2.0 * p.GetY() - lp.y(), fMom.Mag()]
42 hitlist[p.GetZ()] = [p.GetX(), p.GetY(), fMom.Mag()]
47 traj = lsOfGlobals.FindObject(name)
59 canvas = ROOT.gROOT.FindObject(
"Root Canvas EnergyLoss")
61 print(
"add particle flower not started!")
63 lsOfGlobals = ROOT.gROOT.GetListOfGlobals()
68 SHiPDisplay = eveGlobal.SHiPDisplay
69 v = ROOT.gEve.GetViewers().FindChild(
"Bar Embedded Viewer side")
71 cam = vw.CurrentCamera()
72 ed = v.GetEditorObject()
73 co = ed.GetCameraOverlay()
76 test = ROOT.TGLVertex3(0.0, 0.0, 0.0)
77 vtest = cam.ViewportToWorld(test)
79 test = ROOT.TGLVertex3(fr.GetWidth(), 0.0, 0.0)
80 vtest = cam.ViewportToWorld(test)
84 all_muons_hitlist = [
collect_hits(lsOfGlobals, checked_muons)
for _
in range(N_MUONS)]
85 all_muons_hitlist = list(filter(
lambda x: x, all_muons_hitlist))
87 trajectory_init(lsOfGlobals,
"SHiP MuonTraj_" + str(index))
for index
in range(len(all_muons_hitlist))
90 emin, emax = 1e9, -1e9
91 for trajectory, hitlist
in zip(trajectories, all_muons_hitlist):
92 for index, z
in enumerate(sorted(hitlist.keys())):
94 trajectory.SetPoint(index, z, E)
98 emin, emax = emin * 0.9, emax * 1.1
99 print(
"zmin/max", zmin, zmax)
100 hist = c1.DrawFrame(zmin, emin, zmax, emax)
101 hist.SetYTitle(
"p (GeV/c)")
102 hist.SetXTitle(
"z cm")
103 xaxis = hist.GetXaxis()
104 xaxis.SetNdivisions(ax.GetNdivisions())
105 for trajectory
in trajectories:
108 txt.DrawLatexNDC(0.6, 0.8,
"event index:" + str(SHiPDisplay.n))
112if __name__ ==
"__main__":
def trajectory_init(lsOfGlobals, str name="SHiP MuonTraj")
def collect_hits(lsOfGlobals, checked_muons)