12#include "CLHEP/Matrix/Matrix.h"
27const double mass[5] = { 0.511, 105.658, 139.57, 493.677, 938.27203 };
33 , myHelixPar( NumHelixPar )
34 , myMdcErr( NdimMdcErr, 0 )
40 myMdcTrackCol = aPointer;
41 myMdcRecTrkIter = myMdcTrackCol->begin();
48 myMdcKalTrackCol = aPointer;
49 myMdcKalTrkIter = myMdcKalTrackCol->begin();
56 if ( myMsgFlag ) cout <<
"ExtMdcTrack::GetOneGoodTrk() begin" << endl;
57 if ( myInputTrk ==
"Mdc" )
60 if ( myMdcRecTrkIter != myMdcTrackCol->end() )
return true;
63 if ( myMsgFlag ) cout <<
"No more track!" << endl;
67 else if ( myInputTrk ==
"Kal" )
70 if ( myMdcKalTrkIter != myMdcKalTrackCol->end() )
return true;
73 if ( myMsgFlag ) cout <<
"No more track!" << endl;
78 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
83 if ( myMsgFlag ) cout <<
"ExtMdcTrack::ReadTrk() begin" << endl;
85 if ( myInputTrk ==
"Mdc" )
87 if ( myMdcRecTrkIter != myMdcTrackCol->end() )
92 if ( myMsgFlag ) cout <<
"Read a good track!" << endl;
95 myTrackID = aMdcTrack->
trackId();
96 myHelixPar = aMdcTrack->
helix();
98 myMdcErr = aMdcTrack->
err();
103 double beta = p / sqrt(
mass[myParID] *
mass[myParID] + p * p );
104 myTrkTof = myTrkLength / ( beta * 299.792458 );
126 cout <<
"MDC track:" << myTrackID << endl;
127 cout <<
"Helix: " << myHelixPar;
128 cout <<
"pivot: " << myPivot <<
"cm" << endl;
129 cout <<
"Error: " << myMdcErr << endl;
137 cout <<
"Pt: " <<
GetPt() <<
"GeV/c" << endl;
138 cout <<
"PhiTerm: " << myPhiTerm << endl;
155 if ( myMsgFlag ) cout <<
"No more track!" << endl;
159 else if ( myInputTrk ==
"Kal" )
161 if ( myMdcKalTrkIter != myMdcKalTrackCol->end() )
165 if ( myMsgFlag ) cout <<
"Get a good track!" << endl;
169 myHelixPar = aMdcKalTrack->
getLHelix( myParID );
171 myPivot = aMdcKalTrack->
getLPivot( myParID );
172 myMdcErr = aMdcKalTrack->
getLError( myParID );
173 myPhiTerm = aMdcKalTrack->
getFiTerm( myParID );
175 myTrkLength = aMdcKalTrack->
getPathSM( myParID );
176 myLPosition = aMdcKalTrack->
getLPoint( myParID );
177 myTrkTof = aMdcKalTrack->
getTof( myParID );
182 cout <<
"Kal track:" << myTrackID << endl;
183 cout <<
"myParID:" << myParID << endl;
184 cout <<
"Helix: " << myHelixPar;
185 cout <<
"pivot: " << myPivot <<
"cm" << endl;
186 cout <<
"Error: " << myMdcErr << endl;
187 cout <<
"Pt: " <<
GetPt() <<
"GeV/c" << endl;
188 cout <<
"PhiTerm: " << myPhiTerm << endl;
191 cout <<
"trackLength(cm): " << myTrkLength << endl;
192 cout <<
"myTrkTof: " << myTrkTof << endl;
193 cout <<
"Last point position: " << myLPosition << endl;
200 if ( myMsgFlag ) cout <<
"No more track!" << endl;
204 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
208void ExtMdcTrack::Convert() {
209 myHelixPar( 1 ) *= 10.;
210 myHelixPar( 3 ) *= 0.001;
211 myHelixPar( 4 ) *= 10.;
213 myMdcErr.fast( 1, 1 ) *= 100.;
214 myMdcErr.fast( 2, 1 ) *= 10.;
215 myMdcErr.fast( 3, 1 ) *= 0.01;
216 myMdcErr.fast( 3, 2 ) *= 0.001;
217 myMdcErr.fast( 3, 3 ) *= 0.000001;
218 myMdcErr.fast( 4, 1 ) *= 100.;
219 myMdcErr.fast( 4, 2 ) *= 10.;
220 myMdcErr.fast( 4, 3 ) *= 0.01;
221 myMdcErr.fast( 4, 4 ) *= 100.;
222 myMdcErr.fast( 5, 1 ) *= 10.;
223 myMdcErr.fast( 5, 3 ) *= 0.001;
224 myMdcErr.fast( 5, 4 ) *= 10.;
231 Ext_Helix aHelix( myPivot, myHelixPar, myMdcErr );
232 Hep3Vector aPoint = aHelix.
x( myPhiTerm );
233 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;
248 return ( aMomentum );
252 Ext_Helix aHelix( myPivot, myHelixPar, myMdcErr );
255 Hep3Vector aPoint = aHelix.
x( myPhiTerm );
256 double phi0 = aHelix.
phi0();
257 double kappaInv = 1.0 / aHelix.
kappa();
258 double cosPhi0 =
cos( phi0 );
259 double sinPhi0 =
sin( phi0 );
264 double px = aHelix.
momentum( myPhiTerm ).x();
265 double py = aHelix.
momentum( myPhiTerm ).y();
266 double pz = aHelix.
momentum( myPhiTerm ).z();
269 HepMatrix Helix2XpJcb( NdimExtErr, NdimMdcErr, 0 );
271 Helix2XpJcb( 1, 1 ) = cosPhi0;
272 Helix2XpJcb( 1, 2 ) = myPivot.y() - aPoint.y();
273 Helix2XpJcb( 1, 3 ) = ( myPivot.x() - aPoint.x() + myHelixPar( 1 ) * cosPhi0 ) * kappaInv;
274 Helix2XpJcb( 2, 1 ) = sinPhi0;
275 Helix2XpJcb( 2, 2 ) = aPoint.x() - myPivot.x();
276 Helix2XpJcb( 2, 2 ) = ( myPivot.y() - aPoint.y() + myHelixPar( 1 ) * sinPhi0 ) * kappaInv;
277 Helix2XpJcb( 3, 3 ) = ( myPivot.z() - aPoint.z() + myHelixPar( 4 ) ) * kappaInv;
278 Helix2XpJcb( 3, 4 ) = 1.0;
279 Helix2XpJcb( 3, 5 ) = ( aPoint.z() - myPivot.z() - myHelixPar( 4 ) ) / myHelixPar( 5 );
280 Helix2XpJcb( 4, 2 ) = -py;
281 Helix2XpJcb( 4, 3 ) = -px * kappaInv;
282 Helix2XpJcb( 5, 2 ) = px;
283 Helix2XpJcb( 5, 3 ) = -py * kappaInv;
284 Helix2XpJcb( 6, 3 ) = -pz * kappaInv;
285 Helix2XpJcb( 6, 5 ) = fabs( kappaInv );
291 HepSymMatrix aErrorMatrix = aHelix.
Ea().similarity( Helix2XpJcb );
292 if ( myMsgFlag ) cout <<
"PhiTerm Error matrix:" << aErrorMatrix << endl;
295 for (
int i = 1; i <= 6; i++ )
297 for (
int j = 1; j <= i; j++ )
299 if ( i <= 3 && j <= 3 ) aErrorMatrix.fast( i, j ) *= 100.0;
300 if ( i >= 4 && j >= 4 ) aErrorMatrix.fast( i, j ) *= 1.0e+6;
301 if ( i >= 4 && j <= 3 ) aErrorMatrix.fast( i, j ) *= 10000.0;
309 if ( myInputTrk ==
"Mdc" )
337 Ext_Helix aHelix( myPivot, myHelixPar, myMdcErr );
338 double dPhi = fabs( myPhiTerm );
339 double tanLambda = aHelix.
tanl();
340 double cosLambdaInv = sqrt( tanLambda * tanLambda + 1.0 );
341 return ( 10 * fabs( aHelix.
radius() * dPhi * cosLambdaInv ) );
343 else if ( myInputTrk ==
"Kal" )
345 return 10 * myTrkLength;
347 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
354 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