BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/TrkBase/include/TrkBase/TrkMomCalculator.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3//
4// Description: TrkMomCalculator is the momentum calculation engine
5// for the TrkMomVisitor implementation of the Visitor pattern,
6// for use in calculating momenta for different types of
7// trajectories. Important note: in calculating momentum, these
8// functions make assumptions about how trajectories relate to mom.
9// Specifically, they assume: 1) that mom should be calculated using
10// the nominal B field, not B at the point in question -- this is valid
11// for (today's) KalmanTrack, but is not true in general; 2) that
12// B is parallel to the z axis.
13//
14// Environment:
15// Software developed for the BaBar Detector at the SLAC B-Factory.
16//
17// Author(s): Justin Albert, Steve Schaffner
18//
19//------------------------------------------------------------------------
20
21#ifndef TRKMOMCALCULATOR_HH
22#define TRKMOMCALCULATOR_HH
23#include "CLHEP/Matrix/Matrix.h"
24#include "CLHEP/Matrix/SymMatrix.h"
25#include "CLHEP/Vector/ThreeVector.h"
26
27class TrkSimpTraj;
28namespace MdcPatRec {
29 class BField;
30}
31
32using CLHEP::Hep3Vector;
33using CLHEP::HepMatrix;
34using CLHEP::HepSymMatrix;
35using CLHEP::HepVector;
36class BesVectorErr;
37
38// Class interface //
39class TrkMomCalculator {
40
41public:
44
45 //********************************
46 // The calculator functions:
47 //********************************
48
49 static double ptMom( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen );
50 static Hep3Vector vecMom( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen );
51 static BesVectorErr errMom( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen );
52 static int charge( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen );
53
54 // Interface to vertexing algorithms (M.Bondioli 7/17/98)
55 // covariance matrices of the track at fixed flight length
56 static HepMatrix posmomCov( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen );
57 static void getAllCovs( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen,
58 HepSymMatrix& xxCov, HepSymMatrix& ppCov, HepMatrix& xpCov );
59 // invert 6x6
60 static bool weightToCov( const HepSymMatrix& inXX, const HepSymMatrix& inPP,
61 const HepMatrix& inXP, HepSymMatrix& outXX, HepSymMatrix& outPP,
62 HepMatrix& outXP );
63
64 // accessors to 2nd derivative of chi2 wrt x and p.
65 // x0 and p0 are filled with the pos and 3mom around which expansion
66 // takes place, whilst Weights are filled with the 2nd deriv of chi2.
67 // so that:
68 // dx=x-x0 dp=p-p0
69 //
70 // chi2(x,p)=0.5 dx^t*Wxx*dx + dx^t*Wxp*dp + 0.5 dp^t*Wpp*dp
71 // where:
72 // pos and mom are 3-dim Vectors,
73 // xxWeight ppWeight and xpWeight are 3 by 3 matrices
74 //
75 // takes place, whilst Weights are filled with the 2nd deriv of chi2.
76 // so that:
77 // dx=x-x0 dp=p-p0
78 //
79 // chi2(x,p)=0.5 dx^t*Wxx*dx + dx^t*Wxp*dp + 0.5 dp^t*Wpp*dp
80 // where:
81 // pos and mom are 3-dim Vectors,
82 // xxWeight ppWeight and xpWeight are 3 by 3 matrices
83 //
84 static void getAllWeights( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen,
85 HepVector& pos, HepVector& mom, HepSymMatrix& xxWeight,
86 HepSymMatrix& ppWeight, HepMatrix& xpWeight );
87
88private:
89 static double calcCurvPtMom( const Hep3Vector&, double curvature, const MdcPatRec::BField& );
90 static Hep3Vector calcCurvVecMom( const Hep3Vector&, double curvature,
91 const MdcPatRec::BField& );
92 static BesVectorErr calcCurvErrMom( const TrkSimpTraj&, const MdcPatRec::BField&,
93 double flt );
94 static BesVectorErr calcNeutErrMom( const TrkSimpTraj&, const MdcPatRec::BField&,
95 double flt );
96 static int calcCurvCharge( const Hep3Vector&, double curvature, const MdcPatRec::BField& );
97
98 static HepMatrix calcCurvPosmomCov( const TrkSimpTraj&, const MdcPatRec::BField&,
99 double fltlen );
100 static HepMatrix calcNeutPosmomCov( const TrkSimpTraj&, const MdcPatRec::BField&,
101 double fltlen );
102
103 static void calcCurvAllCovs( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen,
104 HepSymMatrix& xxCov, HepSymMatrix& ppCov, HepMatrix& xpCov );
105
106 static void calcCurvAllCovsOLD( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen,
107 HepSymMatrix& xxCov, HepSymMatrix& ppCov, HepMatrix& xpCov );
108
109 static void calcNeutAllCovs( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen,
110 HepSymMatrix& xxCov, HepSymMatrix& ppCov, HepMatrix& xpCov );
111
112 static void calcNeutAllCovs( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen,
113 HepVector& x0, HepVector& p0, HepSymMatrix& xxCov,
114 HepSymMatrix& ppCov, HepMatrix& xpCov );
115
116 static void calcCurvAllWeights( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen,
117 HepVector& pos, HepVector& mom, HepSymMatrix& xxWeight,
118 HepSymMatrix& ppWeight, HepMatrix& xpWeight );
119
120 static void calcCurvAllWeightsOLD( const TrkSimpTraj&, const MdcPatRec::BField&,
121 double fltlen, HepVector& pos, HepVector& mom,
122 HepSymMatrix& xxWeight, HepSymMatrix& ppWeight,
123 HepMatrix& xpWeight );
124
125 static void calcNeutAllWeights( const TrkSimpTraj&, const MdcPatRec::BField&, double fltlen,
126 HepVector& pos, HepVector& mom, HepSymMatrix& xxWeight,
127 HepSymMatrix& ppWeight, HepMatrix& xpWeight );
128
129 static int nearestInt( double );
130};
131
132#endif
static int charge(const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static BesVectorErr errMom(const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static double ptMom(const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
static HepMatrix posmomCov(const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
virtual ~TrkMomCalculator()
static void getAllCovs(const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen, HepSymMatrix &xxCov, HepSymMatrix &ppCov, HepMatrix &xpCov)
static Hep3Vector vecMom(const TrkSimpTraj &, const MdcPatRec::BField &, double fltlen)
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)