12#include "CLHEP/Matrix/Matrix.h"
27const double mass[5] = {0.511,105.658,139.57,493.677,938.27203};
35 myMdcTrackCol = aPointer;
36 myMdcRecTrkIter = myMdcTrackCol->begin();
44 myMdcKalTrackCol = aPointer;
45 myMdcKalTrkIter = myMdcKalTrackCol->begin();
53 if(myMsgFlag) cout<<
"ExtMdcTrack::GetOneGoodTrk() begin"<<endl;
57 if(myMdcRecTrkIter!=myMdcTrackCol->end())
return true;
60 if(myMsgFlag) cout<<
"No more track!"<<endl;
64 else if(myInputTrk==
"Kal")
67 if(myMdcKalTrkIter!=myMdcKalTrackCol->end())
return true;
70 if(myMsgFlag) cout<<
"No more track!"<<endl;
79 if(myMsgFlag) cout<<
"ExtMdcTrack::ReadTrk() begin"<<endl;
83 if(myMdcRecTrkIter!=myMdcTrackCol->end())
88 if(myMsgFlag) cout<<
"Read a good track!"<<endl;
91 myTrackID = aMdcTrack->
trackId();
92 myHelixPar = aMdcTrack->
helix();
94 myMdcErr = aMdcTrack->
err();
99 double beta = p/sqrt(
mass[myParID]*
mass[myParID]+p*p);
100 myTrkTof = myTrkLength/(beta*299.792458);
124 cout<<
"MDC track:"<<myTrackID<<endl;
125 cout<<
"Helix: "<<myHelixPar;
126 cout<<
"pivot: "<<myPivot<<
"cm"<<endl;
127 cout<<
"Error: "<<myMdcErr<<endl;
135 cout<<
"Pt: "<<
GetPt()<<
"GeV/c"<<endl;
136 cout<<
"PhiTerm: "<<myPhiTerm<<endl;
152 if(myMsgFlag) cout<<
"No more track!"<<endl;
156 else if(myInputTrk==
"Kal")
158 if(myMdcKalTrkIter!=myMdcKalTrackCol->end())
162 if(myMsgFlag) cout<<
"Get a good track!"<<endl;
166 myHelixPar = aMdcKalTrack->
getLHelix(myParID);
168 myPivot = aMdcKalTrack->
getLPivot(myParID);
169 myMdcErr = aMdcKalTrack->
getLError(myParID);
170 myPhiTerm = aMdcKalTrack->
getFiTerm(myParID);
172 myTrkLength = aMdcKalTrack->
getPathSM(myParID);
173 myLPosition = aMdcKalTrack->
getLPoint(myParID);
174 myTrkTof = aMdcKalTrack->
getTof(myParID);
179 cout<<
"Kal track:"<<myTrackID<<endl;
180 cout<<
"myParID:"<<myParID<<endl;
181 cout<<
"Helix: "<<myHelixPar;
182 cout<<
"pivot: "<<myPivot<<
"cm"<<endl;
183 cout<<
"Error: "<<myMdcErr<<endl;
184 cout<<
"Pt: "<<
GetPt()<<
"GeV/c"<<endl;
185 cout<<
"PhiTerm: "<<myPhiTerm<<endl;
187 cout<<
"trackLength(cm): "<<myTrkLength<<endl;
188 cout<<
"myTrkTof: "<<myTrkTof<<endl;
189 cout<<
"Last point position: "<<myLPosition<<endl;
196 if(myMsgFlag) cout<<
"No more track!"<<endl;
202void ExtMdcTrack::Convert()
205 myHelixPar(3)*=0.001;
208 myMdcErr.fast(1,1)*=100.;
209 myMdcErr.fast(2,1)*=10.;
210 myMdcErr.fast(3,1)*=0.01;
211 myMdcErr.fast(3,2)*=0.001;
212 myMdcErr.fast(3,3)*=0.000001;
213 myMdcErr.fast(4,1)*=100.;
214 myMdcErr.fast(4,2)*=10.;
215 myMdcErr.fast(4,3)*=0.01;
216 myMdcErr.fast(4,4)*=100.;
217 myMdcErr.fast(5,1)*=10.;
218 myMdcErr.fast(5,3)*=0.001;
219 myMdcErr.fast(5,4)*=10.;
224 return (*myMdcRecTrkIter);
230 Ext_Helix aHelix(myPivot,myHelixPar,myMdcErr);
231 Hep3Vector aPoint = aHelix.
x(myPhiTerm);
232 if(myMsgFlag) cout<<
"PhiTerm Position: "<<aPoint<<endl;
244 Ext_Helix aHelix(myPivot,myHelixPar,myMdcErr);
245 Hep3Vector aMomentum = aHelix.
momentum(myPhiTerm);
246 if(myMsgFlag) cout<<
"PhiTerm Momentum: "<<aMomentum<<endl;
253 Ext_Helix aHelix(myPivot,myHelixPar,myMdcErr);
256 Hep3Vector aPoint = aHelix.
x(myPhiTerm);
257 double phi0 = aHelix.
phi0();
258 double kappaInv = 1.0/aHelix.
kappa();
259 double cosPhi0 =
cos(phi0);
260 double sinPhi0 =
sin(phi0);
265 double px = aHelix.
momentum(myPhiTerm).x();
266 double py = aHelix.
momentum(myPhiTerm).y();
267 double pz = aHelix.
momentum(myPhiTerm).z();
270 HepMatrix Helix2XpJcb(NdimExtErr,NdimMdcErr,0);
272 Helix2XpJcb(1,1) = cosPhi0;
273 Helix2XpJcb(1,2) = myPivot.y()-aPoint.y();
274 Helix2XpJcb(1,3) = (myPivot.x()-aPoint.x()+myHelixPar(1)*cosPhi0)*kappaInv;
275 Helix2XpJcb(2,1) = sinPhi0;
276 Helix2XpJcb(2,2) = aPoint.x()-myPivot.x();
277 Helix2XpJcb(2,2) = (myPivot.y()-aPoint.y()+myHelixPar(1)*sinPhi0)*kappaInv;
278 Helix2XpJcb(3,3) = (myPivot.z()-aPoint.z()+myHelixPar(4))*kappaInv;
279 Helix2XpJcb(3,4) = 1.0;
280 Helix2XpJcb(3,5) = (aPoint.z()-myPivot.z()-myHelixPar(4))/myHelixPar(5);
281 Helix2XpJcb(4,2) = -py;
282 Helix2XpJcb(4,3) = -px * kappaInv;
283 Helix2XpJcb(5,2) = px;
284 Helix2XpJcb(5,3) = -py * kappaInv;
285 Helix2XpJcb(6,3) = -pz * kappaInv;
286 Helix2XpJcb(6,5) = fabs(kappaInv);
292 HepSymMatrix aErrorMatrix = aHelix.
Ea().similarity(Helix2XpJcb);
293 if(myMsgFlag) cout<<
"PhiTerm Error matrix:"<<aErrorMatrix<<endl;
296 for(
int i=1;i<=6;i++)
298 for(
int j=1;j<=i;j++)
300 if(i<=3 && j<=3) aErrorMatrix.fast(i,j)*=100.0;
301 if(i>=4 && j>=4) aErrorMatrix.fast(i,j)*=1.0e+6;
302 if(i>=4 && j<=3) aErrorMatrix.fast(i,j)*=10000.0;
311 if(myInputTrk==
"Mdc") {
338 Ext_Helix aHelix(myPivot,myHelixPar,myMdcErr);
339 double dPhi = fabs(myPhiTerm);
340 double tanLambda = aHelix.
tanl();
341 double cosLambdaInv = sqrt(tanLambda*tanLambda + 1.0);
342 return (10*fabs(aHelix.
radius() * dPhi * cosLambdaInv));
345 else if(myInputTrk==
"Kal")
347 return 10*myTrkLength;
353 return (1.0/fabs(myHelixPar[2]));
358 return ((myHelixPar[2]>0.)? 1.0:-1.0);
double sin(const BesAngle a)
double cos(const BesAngle a)
ObjectVector< RecMdcKalTrack > RecMdcKalTrackCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
const HepSymMatrix err() const
const int trackId() const
const HepVector helix() const
......
double GetParticleCharge() const
double GetTrackLength() const
bool SetMdcKalTrkCol(RecMdcKalTrackCol *aPointer)
RecMdcTrack * GetMdcRecTrkPtr() const
bool SetMdcRecTrkCol(RecMdcTrackCol *aPointer)
const Hep3Vector GetPosition() const
const HepSymMatrix GetErrorMatrix() const
const Hep3Vector GetMomentum() const
double radius(void) const
returns radious of helix.
const HepSymMatrix & Ea(void) const
returns error matrix.
HepPoint3D x(double dPhi=0.) const
returns position after rotating angle dPhi in phi direction.
Hep3Vector momentum(double dPhi=0.) const
returns momentum vector after rotating angle dPhi in phi direction.
double getPathSM(int pid) const
const HepPoint3D & getLPoint() const
const double getFiTerm(const int pid) const
double getTof(int pid) const
const HepVector & getLHelix() const
const HepSymMatrix & getLError() const
const HepPoint3D & getLPivot() const
int getTrackId(void) const
const HepPoint3D & getPivot() const
const double getFiTerm() const