BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkMomCalculator Class Reference

#include <TrkMomCalculator.h>

Public Member Functions

 TrkMomCalculator ()
virtual ~TrkMomCalculator ()
 TrkMomCalculator ()
virtual ~TrkMomCalculator ()
 TrkMomCalculator ()
virtual ~TrkMomCalculator ()

Static Public Member Functions

static double ptMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static Hep3Vector vecMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static BesVectorErr errMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static int charge (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static HepMatrix posmomCov (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static void getAllCovs (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen, HepSymMatrix &xxCov, HepSymMatrix &ppCov, HepMatrix &xpCov)
static bool weightToCov (const HepSymMatrix &inXX, const HepSymMatrix &inPP, const HepMatrix &inXP, HepSymMatrix &outXX, HepSymMatrix &outPP, HepMatrix &outXP)
static void getAllWeights (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen, HepVector &pos, HepVector &mom, HepSymMatrix &xxWeight, HepSymMatrix &ppWeight, HepMatrix &xpWeight)
static double ptMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static Hep3Vector vecMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static BesVectorErr errMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static int charge (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static HepMatrix posmomCov (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static void getAllCovs (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen, HepSymMatrix &xxCov, HepSymMatrix &ppCov, HepMatrix &xpCov)
static bool weightToCov (const HepSymMatrix &inXX, const HepSymMatrix &inPP, const HepMatrix &inXP, HepSymMatrix &outXX, HepSymMatrix &outPP, HepMatrix &outXP)
static void getAllWeights (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen, HepVector &pos, HepVector &mom, HepSymMatrix &xxWeight, HepSymMatrix &ppWeight, HepMatrix &xpWeight)
static double ptMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static Hep3Vector vecMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static BesVectorErr errMom (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static int charge (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static HepMatrix posmomCov (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static void getAllCovs (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen, HepSymMatrix &xxCov, HepSymMatrix &ppCov, HepMatrix &xpCov)
static bool weightToCov (const HepSymMatrix &inXX, const HepSymMatrix &inPP, const HepMatrix &inXP, HepSymMatrix &outXX, HepSymMatrix &outPP, HepMatrix &outXP)
static void getAllWeights (const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen, HepVector &pos, HepVector &mom, HepSymMatrix &xxWeight, HepSymMatrix &ppWeight, HepMatrix &xpWeight)

Detailed Description

Constructor & Destructor Documentation

◆ TrkMomCalculator() [1/3]

TrkMomCalculator::TrkMomCalculator ( )

Definition at line 43 of file TrkMomCalculator.cxx.

43 {
44 //------------------------------------------------------------------------
45}

◆ ~TrkMomCalculator() [1/3]

TrkMomCalculator::~TrkMomCalculator ( )
virtual

Definition at line 38 of file TrkMomCalculator.cxx.

38 {
39 //------------------------------------------------------------------------
40}

◆ TrkMomCalculator() [2/3]

TrkMomCalculator::TrkMomCalculator ( )

◆ ~TrkMomCalculator() [2/3]

virtual TrkMomCalculator::~TrkMomCalculator ( )
virtual

◆ TrkMomCalculator() [3/3]

TrkMomCalculator::TrkMomCalculator ( )

◆ ~TrkMomCalculator() [3/3]

virtual TrkMomCalculator::~TrkMomCalculator ( )
virtual

Member Function Documentation

◆ charge() [1/3]

int TrkMomCalculator::charge ( const TrkSimpTraj & theTraj,
const MdcPatRec::BField & theField,
double fltlen )
static

Definition at line 143 of file TrkMomCalculator.cxx.

144 {
145 //------------------------------------------------------------------------
146
147 TrkMomVisitor theVisitor( theTraj );
148
149 if ( theVisitor.helix() != 0 || theVisitor.circle() != 0 )
150 {
151
152 // treat as curve, calculate Pt accordingly (see calcCurvMom function
153 // below)
154
155 bool plus = false;
157 int index = parInd;
158 plus =
159 ( theField.bFieldNominal() < 0.0 && theTraj.parameters()->parameter()[index] > 0.0 ) ||
160 ( theField.bFieldNominal() > 0.0 && theTraj.parameters()->parameter()[index] < 0.0 );
161 return ( plus ? 1 : -1 );
162
163 // return calcCurvCharge(
164 // theTraj.direction(fltlen),
165 // theTraj.curvature(fltlen), theField);
166 }
167 else if ( theVisitor.neut() != 0 )
168 {
169
170 // treat as neutral particle, so charge is zero
171 return 0;
172 }
173 else
174 {
175
176 // particle must be a plain line--take charge as zero
177 return 0;
178 }
179}

Referenced by TrkSimpleRep::charge().

◆ charge() [2/3]

int TrkMomCalculator::charge ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ charge() [3/3]

int TrkMomCalculator::charge ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ errMom() [1/3]

BesVectorErr TrkMomCalculator::errMom ( const TrkSimpTraj & theTraj,
const MdcPatRec::BField & theField,
double fltlen )
static

Definition at line 113 of file TrkMomCalculator.cxx.

114 {
115 //------------------------------------------------------------------------
116
117 TrkMomVisitor theVisitor( theTraj );
118
119 if ( theVisitor.helix() != 0 || theVisitor.circle() != 0 )
120 {
121
122 // treat as curve, calculate ErrMom accordingly (see calcCurvMom function
123 // below)
124 return calcCurvErrMom( theTraj, theField, fltlen );
125 }
126 else if ( theVisitor.neut() != 0 )
127 {
128
129 // treat as neutral particle, same as curve in this case
130 return calcNeutErrMom( theTraj, theField, fltlen );
131 }
132 else
133 {
134
135 // particle must be a plain line--no way to calculate momentum or err
136 // The matrix is initialized to zero (see BesError constructor)
137 BesError theErr( 3 );
138 return BesVectorErr( Hep3Vector( 999, 999, 999 ), theErr );
139 }
140}

Referenced by TrkCompTrk::momentumErr(), and TrkSimpleRep::momentumErr().

◆ errMom() [2/3]

BesVectorErr TrkMomCalculator::errMom ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ errMom() [3/3]

BesVectorErr TrkMomCalculator::errMom ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ getAllCovs() [1/3]

void TrkMomCalculator::getAllCovs ( const TrkSimpTraj & theTraj,
const MdcPatRec::BField & theField,
double fltlen,
HepSymMatrix & xxCov,
HepSymMatrix & ppCov,
HepMatrix & xpCov )
static

Definition at line 211 of file TrkMomCalculator.cxx.

213 {
214 //------------------------------------------------------------------------
215
216 TrkMomVisitor theVisitor( theTraj );
217
218 if ( theVisitor.helix() != 0 )
219 {
220
221 // fast inline calculation...
222 calcCurvAllCovs( theTraj, theField, fltlen, xxCov, ppCov, xpCov );
223 }
224 else if ( theVisitor.circle() != 0 )
225 {
226
227 // treat as curve, calculate ErrMom accordingly (see calcCurvMom function
228 // below)
229 calcCurvAllCovsOLD( theTraj, theField, fltlen, xxCov, ppCov, xpCov );
230 }
231 else if ( theVisitor.neut() != 0 )
232 {
233
234 // treat as neutral particle, same as curve in this case
235 calcNeutAllCovs( theTraj, theField, fltlen, xxCov, ppCov, xpCov );
236 }
237 else
238 {
239
240 // particle must be a plain line--no way to calculate momentum or err
241 // The matrix is initialized to zero (see BesError constructor)
242 int i, j;
243 for ( i = 0; i < 3; i++ )
244 for ( j = i; j < 3; j++ )
245 {
246 xxCov[i][j] = 0;
247 ppCov[i][j] = 0;
248 xpCov[i][j] = 0;
249 xpCov[j][i] = 0;
250 }
251 }
252}

Referenced by TrkCompTrk::getAllCovs(), and TrkSimpleRep::getAllCovs().

◆ getAllCovs() [2/3]

void TrkMomCalculator::getAllCovs ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen,
HepSymMatrix & xxCov,
HepSymMatrix & ppCov,
HepMatrix & xpCov )
static

◆ getAllCovs() [3/3]

void TrkMomCalculator::getAllCovs ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen,
HepSymMatrix & xxCov,
HepSymMatrix & ppCov,
HepMatrix & xpCov )
static

◆ getAllWeights() [1/3]

void TrkMomCalculator::getAllWeights ( const TrkSimpTraj & theTraj,
const MdcPatRec::BField & theField,
double fltlen,
HepVector & pos,
HepVector & mom,
HepSymMatrix & xxWeight,
HepSymMatrix & ppWeight,
HepMatrix & xpWeight )
static

Definition at line 255 of file TrkMomCalculator.cxx.

258 {
259 //------------------------------------------------------------------------
260
261 TrkMomVisitor theVisitor( theTraj );
262
263 if ( theVisitor.helix() != 0 )
264 {
265
266 // treat as curve, calculate ErrMom accordingly (see calcCurvMom function
267 // below)
268 calcCurvAllWeights( theTraj, theField, fltlen, pos, mom, xxWeight, ppWeight, xpWeight );
269 }
270 else if ( theVisitor.circle() != 0 )
271 {
272
273 calcCurvAllWeightsOLD( theTraj, theField, fltlen, pos, mom, xxWeight, ppWeight, xpWeight );
274 }
275 else if ( theVisitor.neut() != 0 )
276 {
277
278 // treat as neutral particle, same as curve in this case
279 calcNeutAllWeights( theTraj, theField, fltlen, pos, mom, xxWeight, ppWeight, xpWeight );
280 }
281 else
282 {
283
284 // particle must be a plain line--no way to calculate momentum or err
285 // temporary: initialize everything to 0
286 int i, j;
287 for ( i = 0; i < 3; i++ )
288 for ( j = i; j < 3; j++ )
289 {
290 xxWeight[i][j] = 0;
291 ppWeight[i][j] = 0;
292 xpWeight[i][j] = 0;
293 xpWeight[j][i] = 0;
294 }
295
296 for ( i = 0; i < 3; i++ )
297 {
298 pos[i] = 0;
299 mom[i] = 0;
300 }
301 }
302}

Referenced by TrkCompTrk::getAllWeights(), and TrkSimpleRep::getAllWeights().

◆ getAllWeights() [2/3]

void TrkMomCalculator::getAllWeights ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen,
HepVector & pos,
HepVector & mom,
HepSymMatrix & xxWeight,
HepSymMatrix & ppWeight,
HepMatrix & xpWeight )
static

◆ getAllWeights() [3/3]

void TrkMomCalculator::getAllWeights ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen,
HepVector & pos,
HepVector & mom,
HepSymMatrix & xxWeight,
HepSymMatrix & ppWeight,
HepMatrix & xpWeight )
static

◆ posmomCov() [1/3]

HepMatrix TrkMomCalculator::posmomCov ( const TrkSimpTraj & theTraj,
const MdcPatRec::BField & theField,
double fltlen )
static

Definition at line 182 of file TrkMomCalculator.cxx.

183 {
184 //------------------------------------------------------------------------
185
186 TrkMomVisitor theVisitor( theTraj );
187
188 if ( theVisitor.helix() != 0 || theVisitor.circle() != 0 )
189 {
190
191 // treat as curve, calculate ErrMom accordingly (see calcCurvMom function
192 // below)
193 return calcCurvPosmomCov( theTraj, theField, fltlen );
194 }
195 else if ( theVisitor.neut() != 0 )
196 {
197
198 // treat as neutral particle, same as curve in this case
199 return calcNeutPosmomCov( theTraj, theField, fltlen );
200 }
201 else
202 {
203
204 // particle must be a plain line--no way to calculate momentum or err
205 // The matrix is initialized to zero (see BesError constructor)
206 return HepMatrix( 3, 3, 0 );
207 }
208}

Referenced by TrkCompTrk::posmomCov(), and TrkSimpleRep::posmomCov().

◆ posmomCov() [2/3]

HepMatrix TrkMomCalculator::posmomCov ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ posmomCov() [3/3]

HepMatrix TrkMomCalculator::posmomCov ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ ptMom() [1/3]

double TrkMomCalculator::ptMom ( const TrkSimpTraj & theTraj,
const MdcPatRec::BField & theField,
double fltlen )
static

Definition at line 48 of file TrkMomCalculator.cxx.

49 {
50 //------------------------------------------------------------------------
51
52 TrkMomVisitor theVisitor( theTraj );
53
54 if ( theVisitor.helix() != 0 || theVisitor.circle() != 0 )
55 {
56
57 // treat as curve, calculate Pt accordingly (see calcCurvMom function
58 // below)
59 return calcCurvPtMom( theTraj.direction( fltlen ), theTraj.curvature( fltlen ), theField );
60 }
61 else if ( theVisitor.neut() != 0 )
62 {
63
64 // treat as neutral particle (with the ptot as a parameter)
65 double sindip = theTraj.direction( fltlen ).z();
66 double arg = 1.0 - sindip * sindip;
67 if ( arg < 0.0 ) arg = 0.0;
68 double cosdip = sqrt( arg );
69 double ptot = theTraj.parameters()->parameter()[NeutParams::_p];
70
71 return cosdip * ptot;
72 }
73 else
74 {
75
76 // particle must be a plain line--no way to calculate momentum
77 return 999999.99;
78 }
79}
double arg(const EvtComplex &c)
virtual Hep3Vector direction(double) const =0
virtual double curvature(double) const =0

Referenced by TrkCompTrk::pt(), and TrkSimpleRep::pt().

◆ ptMom() [2/3]

double TrkMomCalculator::ptMom ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ ptMom() [3/3]

double TrkMomCalculator::ptMom ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ vecMom() [1/3]

Hep3Vector TrkMomCalculator::vecMom ( const TrkSimpTraj & theTraj,
const MdcPatRec::BField & theField,
double fltlen )
static

Definition at line 82 of file TrkMomCalculator.cxx.

83 {
84 //------------------------------------------------------------------------
85 TrkMomVisitor theVisitor( theTraj );
86
87 if ( theVisitor.helix() != 0 || theVisitor.circle() != 0 )
88 {
89
90 // treat as curve, calculate VecMom accordingly (see calcCurvMom function
91 // below)
92
93 return calcCurvVecMom( theTraj.direction( fltlen ), theTraj.curvature( fltlen ),
94 theField );
95 }
96 else if ( theVisitor.neut() != 0 )
97 {
98
99 // treat as neutral particle (with the pt as a parameter)
100 Hep3Vector theMom = theTraj.direction( fltlen );
101 theMom.setMag( theTraj.parameters()->parameter()[NeutParams::_p] );
102 return theMom;
103 }
104 else
105 {
106
107 // particle must be a plain line--no way to calculate momentum
108 return Hep3Vector( 999, 999, 999 );
109 }
110}

Referenced by TrkCompTrk::momentum(), and TrkSimpleRep::momentum().

◆ vecMom() [2/3]

Hep3Vector TrkMomCalculator::vecMom ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ vecMom() [3/3]

Hep3Vector TrkMomCalculator::vecMom ( const TrkSimpTraj & ,
const MdcPatRec::BField & ,
double fltlen )
static

◆ weightToCov() [1/3]

bool TrkMomCalculator::weightToCov ( const HepSymMatrix & inXX,
const HepSymMatrix & inPP,
const HepMatrix & inXP,
HepSymMatrix & outXX,
HepSymMatrix & outPP,
HepMatrix & outXP )
static

Definition at line 533 of file TrkMomCalculator.cxx.

535 {
536 assert( inXX.num_row() == outXX.num_row() );
537 assert( inPP.num_row() == outPP.num_row() );
538 assert( inXP.num_row() == outXP.num_row() );
539 assert( inXP.num_col() == outXP.num_col() );
540 assert( inXX.num_row() == inXP.num_row() );
541 assert( inPP.num_row() == inXP.num_col() );
542 int status;
543 HepSymMatrix aInv = inXX.inverse( status );
544 if ( status ) return false;
545 HepSymMatrix beta = inPP - aInv.similarityT( inXP );
546 outPP = beta.inverse( status );
547 if ( status ) return false;
548 outXP = -aInv * inXP * outPP;
549 HepMatrix alpha( aInv - aInv * inXP * outXP.T() );
550 outXX.assign( alpha );
551 return true;
552}
double alpha

◆ weightToCov() [2/3]

bool TrkMomCalculator::weightToCov ( const HepSymMatrix & inXX,
const HepSymMatrix & inPP,
const HepMatrix & inXP,
HepSymMatrix & outXX,
HepSymMatrix & outPP,
HepMatrix & outXP )
static

◆ weightToCov() [3/3]

bool TrkMomCalculator::weightToCov ( const HepSymMatrix & inXX,
const HepSymMatrix & inPP,
const HepMatrix & inXP,
HepSymMatrix & outXX,
HepSymMatrix & outPP,
HepMatrix & outXP )
static

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