268 def DrawFittedTracks(self,option=''):
269 n,ntot = -1,0
270 for fT in sTree.FitTracks:
271 n+=1
272 fst = fT.getFitStatus()
273 if not fst.isFitConverged(): continue
274 if fst.getNdf() < 20: continue
275 DTrack = ROOT.TEveLine()
276 DTrack.SetPickable(ROOT.kTRUE)
277 DTrack.SetTitle(fT.__repr__())
278 fstate = fT.getFittedState(0)
279 fPos = fstate.getPos()
280 fMom = fstate.getMom()
281 pos = fPos
282 mom = fMom
283 pid = fstate.getPDG()
284 zs = self.z_start
285 before = True
286 for i in range(self.niter):
288 if rc:
289 DTrack.SetNextPoint(newpos.X(),newpos.Y(),newpos.Z())
290 else:
291 print('error with extrapolation: z=',zs)
292
293 px,py,pz = mom.X(),mom.Y(),mom.Z()
294 lam = (zs-pos.Z())/pz
295 DTrack.SetNextPoint(pos.X()+lam*px,pos.Y()+lam*py,zs)
296 zs+=self.dz
297 DTrack.SetName('FitTrack_'+str(n))
298 c = ROOT.kWhite
299 if abs(pid) in self.trackColors : c = self.trackColors[abs(pid)]
300 DTrack.SetMainColor(c)
301 DTrack.SetLineWidth(3)
302 self.comp.AddElement(DTrack)
303 ntot+=1
304 print("draw ",ntot," fitted tracks")
305 n=-1
306 for aP in sTree.Particles:
307 n+=1
308
309 tracksOK = True
310 if aP.GetMother(1)==99:
311 if aP.T()>3*u.cm : continue
312 for k in range(aP.GetNDaughters()):
313 if k>1: break
314 fT = sTree.FitTracks[aP.GetDaughter(k)]
315 fst = fT.getFitStatus()
316 if not fst.isFitConverged(): tracksOK=False
317 if fst.getNdf() < 20: tracksOK=False
318 if not tracksOK: continue
319 DTrack = ROOT.TEveLine()
320 DTrack.SetPickable(ROOT.kTRUE)
321 DTrack.SetMainColor(ROOT.kCyan)
322 DTrack.SetLineWidth(4)
323 DTrack.SetName('Particle_'+str(n))
324 DTrack.SetTitle(aP.__repr__())
325 DTrack.SetNextPoint(aP.Vx(),aP.Vy(),aP.Vz())
326 lam = (self.Targetz - aP.Vz())/aP.Pz()
327 DTrack.SetNextPoint(aP.Vx()+lam*aP.Px(),aP.Vy()+lam*aP.Py(),self.Targetz)
328 self.comp.AddElement(DTrack)
329