1 import ROOT,os,sys,getopt
23 self.Direction.clear()
32 print "\t", tid,
"{:10.4f}".format(self.
__info[tid][
'Ndf']),
"{:10.4f}".format(self.
__info[tid][
'Chi2']),
33 print " pos:",
" ".join(
"{:10.4f}".format(self.
Position[tid](ii))
for ii
in range(0,3)),
34 print " mom:",
" ".join(
"{:10.4f}".format(self.
Direction[tid](ii)*self.
Momentum[tid])
for ii
in range(0,3)),
35 print " P:",
"{:10.4f}".format(self.
Momentum[tid])
52 return self.
__info[tid][
'Ndf']
55 false2 = (Pos==
None or Dir==
None or Pval==
None)
56 false1 = (
not tid
in self.
__info)
57 if (false2
and false1):
return True
58 if (false2
or false1):
return False
63 if not tid
in self.
__info:
return None,
None,
None
76 uPerpend = crossDir*(1./crossDir.Mag())
78 minDist = deltaPos.Dot(uPerpend)
85 if (t2X == 0) : t2X = 0.00000000001
87 alpha = deltaPos - minDist*uPerpend
88 nomin = alpha.Y() - a2a*alpha.X()
91 s2 = ( alpha.X() + self.
Direction[t1].X()*s1 ) / t2X
97 if(abs(abs(minDist)-dif.Mag())>0.00000001):
98 print "myVertex2 - problem:"
100 if(self.
debug>2
or debugNeed):
102 print str(tid)+
": Pos : ",
"".join(str(self.
Position[tid](ii)) +
" " for ii
in range(0,3)),
103 print "\t\tMom : ",
"".join(str(self.
Direction[tid](ii))+
" " for ii
in range(0,3))
104 print "uPerpend: ",
"".join(str(uPerpend(ii))+
" " for ii
in range(0,3))
105 if(self.
debug>0
or debugNeed):
106 print "fit vertex: -> 1st poing : ", vec1.X(), vec1.Y(), vec1.Z()
107 print "fit vertex: -> 2nd point : ", vec2.X(), vec2.Y(), vec2.Z()
108 print "fit vertex: -> average : ", ave.X(), ave.Y(), ave.Z()
109 print "distance", abs(minDist), dif.Mag()
110 return ave, abs(minDist)
116 for atrack
in self.tree.FitTracks:
119 fitStatus = atrack.getFitStatus()
120 if not fitStatus.isFitConverged() :
continue
123 mcTrID = self.tree.fitTrack2MC[indx]
126 self.
__info[mcTrID][
'Ndf'] = fitStatus.getNdf()
127 self.
__info[mcTrID][
'Chi2'] = fitStatus.getChi2()
129 fittedState = atrack.getFittedState()
130 self.
Momentum[mcTrID] = fittedState.getMomMag()
131 self.
Direction[mcTrID] = fittedState.getDir()
132 self.
Position[mcTrID] = fittedState.getPos()
136 self.
createVertex(self.__info.keys()[0], self.__info.keys()[1])
147 def addNewTrack(self, mcTrID, position, direction, Pval, ndf, chi2, verb = True):
148 if (verb
and mcTrID
in self.
Momentum):
149 print "FotTrackInfo WARNING - trID ", mcTrID,
"already filled! Will rewrite all records for this trID!"
152 self.
__info[mcTrID][
'Ndf'] = ndf
153 self.
__info[mcTrID][
'Chi2'] = chi2
def getTrIDs
returns list of keys __info .