BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
ExtMdcTrack Class Reference

#include <ExtMdcTrack.h>

Public Member Functions

 ExtMdcTrack (void)
 
 ~ExtMdcTrack (void)
 
void SetMsgFlag (bool aFlag)
 
bool SetMdcRecTrkCol (RecMdcTrackCol *aPointer)
 
bool SetMdcKalTrkCol (RecMdcKalTrackCol *aPointer)
 
bool SetParId (int pid)
 
bool GetOneGoodTrk ()
 
bool ReadTrk (int pid)
 
int GetTrackID ()
 
RecMdcTrackGetMdcRecTrkPtr () const
 
const Hep3Vector GetPosition () const
 
const Hep3Vector GetMomentum () const
 
const HepSymMatrix GetErrorMatrix () const
 
double GetTrackLength () const
 
double GetTrkTof () const
 
double GetPt () const
 
double GetParticleCharge () const
 

Detailed Description

Definition at line 38 of file ExtMdcTrack.h.

Constructor & Destructor Documentation

◆ ExtMdcTrack()

ExtMdcTrack::ExtMdcTrack ( void  )

Definition at line 29 of file ExtMdcTrack.cxx.

29:myMsgFlag(true),myInputTrk("Kal"),myParID(2),myHelixPar(NumHelixPar),myMdcErr(NdimMdcErr,0),myPhiTerm(0.){}

◆ ~ExtMdcTrack()

ExtMdcTrack::~ExtMdcTrack ( void  )

Definition at line 31 of file ExtMdcTrack.cxx.

31{}

Member Function Documentation

◆ GetErrorMatrix()

const HepSymMatrix ExtMdcTrack::GetErrorMatrix ( ) const

Definition at line 251 of file ExtMdcTrack.cxx.

252{
253 Ext_Helix aHelix(myPivot,myHelixPar,myMdcErr);
254// aHelix.pivot(aHelix.x(myPhiTerm));//Move the pivot to the PhiTerm position.
255
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);
261 // 0 -> myPhiTerm, 2009-5-29, by wangll
262// double px = aHelix.momentum(0).x();
263// double py = aHelix.momentum(0).y();
264// double pz = aHelix.momentum(0).z();
265 double px = aHelix.momentum(myPhiTerm).x();
266 double py = aHelix.momentum(myPhiTerm).y();
267 double pz = aHelix.momentum(myPhiTerm).z();
268
269 //Calculate the Jacobian: d(xp)/d(helix).
270 HepMatrix Helix2XpJcb(NdimExtErr,NdimMdcErr,0);
271
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);
287
288 //Calculate the Ext error matrix(6x6) in (x,p).
289// if(myMsgFlag) cout<<"Error matrix at new pivot: "<<endl;
290// aHelix.Ea();
291// cout<<"haha"<<endl;
292 HepSymMatrix aErrorMatrix = aHelix.Ea().similarity(Helix2XpJcb);
293 if(myMsgFlag) cout<<"PhiTerm Error matrix:"<<aErrorMatrix<<endl;
294
295 //Uints Conversion.
296 for(int i=1;i<=6;i++)
297 {
298 for(int j=1;j<=i;j++)
299 {
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;
303 }
304 }
305
306 return aErrorMatrix;
307}
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213

Referenced by TrkExtAlg::execute().

◆ GetMdcRecTrkPtr()

RecMdcTrack * ExtMdcTrack::GetMdcRecTrkPtr ( ) const

Definition at line 222 of file ExtMdcTrack.cxx.

223{
224 return (*myMdcRecTrkIter);
225}

◆ GetMomentum()

const Hep3Vector ExtMdcTrack::GetMomentum ( ) const

Definition at line 242 of file ExtMdcTrack.cxx.

243{
244 Ext_Helix aHelix(myPivot,myHelixPar,myMdcErr);
245 Hep3Vector aMomentum = aHelix.momentum(myPhiTerm);//In GeV/c units.
246 if(myMsgFlag) cout<<"PhiTerm Momentum: "<<aMomentum<<endl;
247 aMomentum*=1000.0;//In MeV/c uints.
248 return (aMomentum);
249}

Referenced by TrkExtAlg::execute(), and ReadTrk().

◆ GetOneGoodTrk()

bool ExtMdcTrack::GetOneGoodTrk ( )

Definition at line 51 of file ExtMdcTrack.cxx.

52{
53 if(myMsgFlag) cout<<"ExtMdcTrack::GetOneGoodTrk() begin"<<endl;
54 if(myInputTrk=="Mdc")
55 {
56 myMdcRecTrkIter++;
57 if(myMdcRecTrkIter!=myMdcTrackCol->end()) return true;
58 else
59 {
60 if(myMsgFlag) cout<<"No more track!"<<endl;
61 return false;
62 }
63 }
64 else if(myInputTrk=="Kal") // use KalTrack as input
65 {
66 myMdcKalTrkIter++;
67 if(myMdcKalTrkIter!=myMdcKalTrackCol->end()) return true;
68 else
69 {
70 if(myMsgFlag) cout<<"No more track!"<<endl;
71 return false;
72 }
73 }
74}

Referenced by TrkExtAlg::execute().

◆ GetParticleCharge()

double ExtMdcTrack::GetParticleCharge ( ) const

Definition at line 356 of file ExtMdcTrack.cxx.

357{
358 return ((myHelixPar[2]>0.)? 1.0:-1.0);
359}

Referenced by TrkExtAlg::execute().

◆ GetPosition()

const Hep3Vector ExtMdcTrack::GetPosition ( ) const

Definition at line 227 of file ExtMdcTrack.cxx.

228{
229// if(myInputTrk=="Mdc") {
230 Ext_Helix aHelix(myPivot,myHelixPar,myMdcErr);
231 Hep3Vector aPoint = aHelix.x(myPhiTerm);
232 if(myMsgFlag) cout<<"PhiTerm Position: "<<aPoint<<endl;
233 aPoint*=10.0;
234 return (aPoint);
235/* }
236 else if(myInputTrk=="Kal") {
237 return (myLPosition);
238 }
239*/
240}

Referenced by TrkExtAlg::execute().

◆ GetPt()

double ExtMdcTrack::GetPt ( ) const

Definition at line 351 of file ExtMdcTrack.cxx.

352{
353 return (1.0/fabs(myHelixPar[2]));
354}

Referenced by ReadTrk().

◆ GetTrackID()

int ExtMdcTrack::GetTrackID ( )
inline

Definition at line 50 of file ExtMdcTrack.h.

50{return myTrackID;}//Get RecMdcTrackl ID.

Referenced by TrkExtAlg::execute().

◆ GetTrackLength()

double ExtMdcTrack::GetTrackLength ( ) const

Definition at line 309 of file ExtMdcTrack.cxx.

310{
311 if(myInputTrk=="Mdc") {
312
313/* //old version
314 Helix aHelix(myPivot,myHelixPar,myMdcErr);
315
316 double phi0 = aHelix.phi0();
317 HepPoint3D w = -(*this).GetParticleCharge() * aHelix.center();
318 Hep3Vector center( w.x(),w.y(),w.z() );
319 double centerX = center.x();
320 double centerY = center.y();
321 double phiCenter;
322 if(fabs(centerX) > 1.0e-10)
323 {
324 phiCenter = atan2(centerY,centerX);
325 if(phiCenter < 0.) phiCenter += 2.0*M_PI;
326 }
327 else
328 {
329 phiCenter = (centerY>0)? M_PI_2:3.0*M_PI_2;
330 }
331 double dPhi = fabs(phi0 + myPhiTerm - phiCenter);
332 if(dPhi >= 2.0*M_PI) dPhi -= 2.0*M_PI;
333 double tanLambda = aHelix.tanl();
334 double cosLambdaInv = sqrt(tanLambda*tanLambda + 1.0);
335 return (10*fabs(aHelix.radius() * dPhi * cosLambdaInv));//10* for cm -> mm
336*/
337
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));//10* for cm -> mm
343
344 }
345 else if(myInputTrk=="Kal")
346 {
347 return 10*myTrkLength; //10* for cm -> mm
348 }
349}

Referenced by TrkExtAlg::execute(), and ReadTrk().

◆ GetTrkTof()

double ExtMdcTrack::GetTrkTof ( ) const
inline

Definition at line 56 of file ExtMdcTrack.h.

56{return myTrkTof;};

Referenced by TrkExtAlg::execute().

◆ ReadTrk()

bool ExtMdcTrack::ReadTrk ( int  pid = 2)

Definition at line 77 of file ExtMdcTrack.cxx.

78{
79 if(myMsgFlag) cout<<"ExtMdcTrack::ReadTrk() begin"<<endl;
80 myParID = pid;
81 if(myInputTrk=="Mdc")
82 {
83 if(myMdcRecTrkIter!=myMdcTrackCol->end())
84 {
85 RecMdcTrack *aMdcTrack = *myMdcRecTrkIter;
86 // if(!aMdcTrack->getStat())//If good track.Now status default 0
87 {
88 if(myMsgFlag) cout<<"Read a good track!"<<endl;
89
90 //get MdcTrk data
91 myTrackID = aMdcTrack->trackId();
92 myHelixPar = aMdcTrack->helix();
93 myPivot = aMdcTrack->getPivot();
94 myMdcErr = aMdcTrack->err();
95 // double aPhiTerm = aMdcTrack->getFiTerm();
96 myPhiTerm = aMdcTrack->getFiTerm();
97 myTrkLength = GetTrackLength();
98 double p = (GetMomentum()).mag();
99 double beta = p/sqrt(mass[myParID]*mass[myParID]+p*p);
100 myTrkTof = myTrkLength/(beta*299.792458);
101
102 /* //Start caculation of myPhiTerm.(when pivot is (0,0,0).)
103 double r = DBL_MAX;
104 double rMdc = 81.0;
105 double dro = myHelixPar(1);
106 if(myHelixPar(3)!=0.0)
107 r = 333.564095/myHelixPar(3);
108 if( fabs(2.0*r+dro)>rMdc && fabs(dro)<rMdc )
109 {
110 double aValue = ((dro+r)*(dro+r)+r*r-rMdc*rMdc)/2.0/fabs(r)/fabs(dro+r);
111 if(r<0.0) myPhiTerm = acos(aValue);
112 else myPhiTerm = -1.0*acos(aValue);
113 }
114 else
115 {
116 if(myMsgFlag) cout<<"Get a track which can't go out of MDC!"<<endl;
117 myMdcRecTrkIter++;
118 continue;
119 }
120 */
121 // double aTrackLength=fabs(r*myPhiTerm)*sqrt(myHelixPar(5)*myHelixPar(5)+1);
122 if(myMsgFlag)
123 {
124 cout<<"MDC track:"<<myTrackID<<endl;
125 cout<<"Helix: "<<myHelixPar;
126 cout<<"pivot: "<<myPivot<<"cm"<<endl;
127 cout<<"Error: "<<myMdcErr<<endl;
128
129 /* Convert();
130 cout<<"********after convert:"<<endl;
131 cout<<"Helix: "<<myHelixPar;
132 cout<<"pivot: "<<myPivot;
133 cout<<"Error: "<<myMdcErr<<endl;
134 */
135 cout<<"Pt: "<<GetPt()<<"GeV/c"<<endl;
136 cout<<"PhiTerm: "<<myPhiTerm<<endl;
137 // cout<<"recPhiTerm: "<<aPhiTerm<<endl;
138 cout<<"trackLength(mm): "<<GetTrackLength()<<endl;
139 // cout<<"trackLengthTest(cm): "<<aTrackLength<<endl;
140 }
141
142 return true;
143 }
144 // else
145 // {
146 // myMdcRecTrkIter++;
147 // cout<<"Get a bad track!"<<endl;
148 // }
149 }
150 else
151 {
152 if(myMsgFlag) cout<<"No more track!"<<endl;
153 return false;
154 }
155 }
156 else if(myInputTrk=="Kal") // use KalTrack as input
157 {
158 if(myMdcKalTrkIter!=myMdcKalTrackCol->end())
159 {
160 RecMdcKalTrack *aMdcKalTrack = *myMdcKalTrkIter;
161 {
162 if(myMsgFlag) cout<<"Get a good track!"<<endl;
163
164 //get MdcTrk data
165 myTrackID = aMdcKalTrack->getTrackId();
166 myHelixPar = aMdcKalTrack->getLHelix(myParID);
167 //myPivot = HepPoint3D(0,0,0);
168 myPivot = aMdcKalTrack->getLPivot(myParID);
169 myMdcErr = aMdcKalTrack->getLError(myParID);
170 myPhiTerm = aMdcKalTrack->getFiTerm(myParID);
171 myPhiTerm = 0.0;
172 myTrkLength = aMdcKalTrack->getPathSM(myParID);
173 myLPosition = aMdcKalTrack->getLPoint(myParID);
174 myTrkTof = aMdcKalTrack->getTof(myParID);
175 //cout<<"myInitialTof = "<<myTrkTof<<endl;
176
177 if(myMsgFlag)
178 {
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;
186// cout<<"trackLength(mm): "<<GetTrackLength()<<endl;
187 cout<<"trackLength(cm): "<<myTrkLength<<endl;
188 cout<<"myTrkTof: "<<myTrkTof<<endl;
189 cout<<"Last point position: "<<myLPosition<<endl;
190 }
191 return true;
192 }
193 }
194 else
195 {
196 if(myMsgFlag) cout<<"No more track!"<<endl;
197 return false;
198 }
199 }
200}
double mass
const HepSymMatrix err() const
const int trackId() const
Definition: DstMdcTrack.h:52
const HepVector helix() const
......
double GetTrackLength() const
double GetPt() const
const Hep3Vector GetMomentum() const
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
Definition: RecMdcTrack.h:56
const double getFiTerm() const
Definition: RecMdcTrack.h:52

Referenced by TrkExtAlg::execute().

◆ SetMdcKalTrkCol()

bool ExtMdcTrack::SetMdcKalTrkCol ( RecMdcKalTrackCol aPointer)

Definition at line 42 of file ExtMdcTrack.cxx.

43{
44 myMdcKalTrackCol = aPointer;
45 myMdcKalTrkIter = myMdcKalTrackCol->begin();
46 myMdcKalTrkIter--;
47 myInputTrk="Kal";
48 return true;
49}

Referenced by TrkExtAlg::execute().

◆ SetMdcRecTrkCol()

bool ExtMdcTrack::SetMdcRecTrkCol ( RecMdcTrackCol aPointer)

Definition at line 33 of file ExtMdcTrack.cxx.

34{
35 myMdcTrackCol = aPointer;
36 myMdcRecTrkIter = myMdcTrackCol->begin();
37 myMdcRecTrkIter--;
38 myInputTrk="Mdc";
39 return true;
40}

Referenced by TrkExtAlg::execute().

◆ SetMsgFlag()

void ExtMdcTrack::SetMsgFlag ( bool  aFlag)
inline

Definition at line 44 of file ExtMdcTrack.h.

44{myMsgFlag=aFlag;};

Referenced by TrkExtAlg::execute().

◆ SetParId()

bool ExtMdcTrack::SetParId ( int  pid)
inline

Definition at line 47 of file ExtMdcTrack.h.

47{ myParID=pid; return true;};

The documentation for this class was generated from the following files: