CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
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/Vector/ThreeVector.h"
24#include "CLHEP/Matrix/Matrix.h"
25#include "CLHEP/Matrix/SymMatrix.h"
26
27class TrkSimpTraj;
28class BField;
29
30using CLHEP::Hep3Vector;
31using CLHEP::HepMatrix;
32using CLHEP::HepSymMatrix;
33class BesVectorErr;
34
35// Class interface //
37
38public:
39
41 virtual ~TrkMomCalculator();
42
43 //********************************
44 // The calculator functions:
45 //********************************
46
47 static double ptMom( const TrkSimpTraj&, const BField&, double fltlen);
48 static Hep3Vector vecMom(const TrkSimpTraj&, const BField&, double fltlen);
49 static BesVectorErr errMom(const TrkSimpTraj&, const BField&, double fltlen);
50 static int charge(const TrkSimpTraj&, const BField&, double fltlen);
51
52 // Interface to vertexing algorithms (M.Bondioli 7/17/98)
53 // covariance matrices of the track at fixed flight length
54 static HepMatrix posmomCov(const TrkSimpTraj&,const BField&,
55 double fltlen);
56 static void getAllCovs(const TrkSimpTraj&,const BField&,
57 double fltlen,
58 HepSymMatrix& xxCov,
59 HepSymMatrix& ppCov,
60 HepMatrix& xpCov);
61 // invert 6x6
62 static bool weightToCov(const HepSymMatrix& inXX,const HepSymMatrix& inPP,const HepMatrix& inXP,
63 HepSymMatrix& outXX, HepSymMatrix& outPP, HepMatrix& outXP);
64
65 // accessors to 2nd derivative of chi2 wrt x and p.
66 // x0 and p0 are filled with the pos and 3mom around which expansion
67 // takes place, whilst Weights are filled with the 2nd deriv of chi2.
68 // so that:
69 // dx=x-x0 dp=p-p0
70 //
71 // chi2(x,p)=0.5 dx^t*Wxx*dx + dx^t*Wxp*dp + 0.5 dp^t*Wpp*dp
72 // where:
73 // pos and mom are 3-dim Vectors,
74 // xxWeight ppWeight and xpWeight are 3 by 3 matrices
75 //
76 // takes place, whilst Weights are filled with the 2nd deriv of chi2.
77 // so that:
78 // dx=x-x0 dp=p-p0
79 //
80 // chi2(x,p)=0.5 dx^t*Wxx*dx + dx^t*Wxp*dp + 0.5 dp^t*Wpp*dp
81 // where:
82 // pos and mom are 3-dim Vectors,
83 // xxWeight ppWeight and xpWeight are 3 by 3 matrices
84 //
85 static void getAllWeights(const TrkSimpTraj&, const BField&,
86 double fltlen,
87 HepVector& pos,
88 HepVector& mom,
89 HepSymMatrix& xxWeight,
90 HepSymMatrix& ppWeight,
91 HepMatrix& xpWeight);
92
93private:
94
95 static double calcCurvPtMom(const Hep3Vector&,
96 double curvature,
97 const BField&);
98 static Hep3Vector calcCurvVecMom(const Hep3Vector&,
99 double curvature,
100 const BField&);
101 static BesVectorErr calcCurvErrMom(const TrkSimpTraj&,
102 const BField&,
103 double flt);
104 static BesVectorErr calcNeutErrMom(const TrkSimpTraj&, const BField&,
105 double flt);
106 static int calcCurvCharge(const Hep3Vector&,
107 double curvature,
108 const BField&);
109
110 static HepMatrix calcCurvPosmomCov(const TrkSimpTraj&,const BField&,
111 double fltlen);
112 static HepMatrix calcNeutPosmomCov(const TrkSimpTraj&,const BField&,
113 double fltlen);
114
115 static void calcCurvAllCovs(const TrkSimpTraj&,const BField&,
116 double fltlen,
117 HepSymMatrix& xxCov,
118 HepSymMatrix& ppCov,
119 HepMatrix& xpCov);
120
121 static void calcCurvAllCovsOLD(const TrkSimpTraj&,const BField&,
122 double fltlen,
123 HepSymMatrix& xxCov,
124 HepSymMatrix& ppCov,
125 HepMatrix& xpCov);
126
127 static void calcNeutAllCovs(const TrkSimpTraj&,const BField&,
128 double fltlen,
129 HepSymMatrix& xxCov,
130 HepSymMatrix& ppCov,
131 HepMatrix& xpCov);
132
133 static void calcNeutAllCovs(const TrkSimpTraj&,const BField&,
134 double fltlen,
135 HepVector& x0,HepVector& p0,
136 HepSymMatrix& xxCov,
137 HepSymMatrix& ppCov,
138 HepMatrix& xpCov);
139
140 static void calcCurvAllWeights(const TrkSimpTraj&,const BField&,
141 double fltlen,
142 HepVector& pos,
143 HepVector& mom,
144 HepSymMatrix& xxWeight,
145 HepSymMatrix& ppWeight,
146 HepMatrix& xpWeight);
147
148 static void calcCurvAllWeightsOLD(const TrkSimpTraj&,const BField&,
149 double fltlen,
150 HepVector& pos,
151 HepVector& mom,
152 HepSymMatrix& xxWeight,
153 HepSymMatrix& ppWeight,
154 HepMatrix& xpWeight);
155
156 static void calcNeutAllWeights(const TrkSimpTraj&,const BField&,
157 double fltlen,
158 HepVector& pos,
159 HepVector& mom,
160 HepSymMatrix& xxWeight,
161 HepSymMatrix& ppWeight,
162 HepMatrix& xpWeight);
163
164 static int nearestInt(double);
165
166};
167
168#endif
static void getAllWeights(const TrkSimpTraj &, const BField &, double fltlen, HepVector &pos, HepVector &mom, HepSymMatrix &xxWeight, HepSymMatrix &ppWeight, HepMatrix &xpWeight)
virtual ~TrkMomCalculator()
static bool weightToCov(const HepSymMatrix &inXX, const HepSymMatrix &inPP, const HepMatrix &inXP, HepSymMatrix &outXX, HepSymMatrix &outPP, HepMatrix &outXP)
static void getAllCovs(const TrkSimpTraj &, const BField &, double fltlen, HepSymMatrix &xxCov, HepSymMatrix &ppCov, HepMatrix &xpCov)
static HepMatrix posmomCov(const TrkSimpTraj &, const BField &, double fltlen)
static BesVectorErr errMom(const TrkSimpTraj &, const BField &, double fltlen)
static Hep3Vector vecMom(const TrkSimpTraj &, const BField &, double fltlen)
static int charge(const TrkSimpTraj &, const BField &, double fltlen)
static double ptMom(const TrkSimpTraj &, const BField &, double fltlen)