00001
00015 #ifndef __TRACKFITOBJECT_H
00016 #define __TRACKFITOBJECT_H
00017
00018 #include "BaseFitObject.h"
00019
00020 #include <iostream>
00021
00022 class TwoVector;
00023 class ThreeVector;
00024 class FourVector;
00025 class JBLHelix;
00026
00027
00028
00030
00060 class TrackFitObject: public BaseFitObject {
00061 public:
00063 TrackFitObject(const char *name_ = 0
00064 );
00066 TrackFitObject (const TrackFitObject& rhs
00067 );
00069 TrackFitObject& operator= (const TrackFitObject& rhs
00070 );
00072 virtual ~TrackFitObject();
00073
00075 virtual bool setParam (int ilocal,
00076 double par_,
00077 bool measured_,
00078 bool fixed_ = false
00079 );
00081 virtual bool setParam (int ilocal,
00082 double par_
00083 );
00084
00086 virtual bool setParameters (int ivertex,
00087 const ThreeVector& vertex,
00088 const FourVector& momentum,
00089 double charge_
00090 ) = 0;
00092 virtual bool setMParam (int ilocal,
00093 double mpar_
00094 );
00096 virtual bool setError (int ilocal,
00097 double err_
00098 );
00100 virtual bool setCov (int ilocal,
00101 int jlocal,
00102 double cov_
00103 );
00106 virtual bool setGlobalParNum (int ilocal,
00107 int iglobal
00108 );
00109
00111 virtual bool fixParam (int ilocal,
00112 bool fix=true
00113 );
00114
00116 virtual double getParam (int i
00117 ) const;
00119 virtual double getMParam (int i
00120 ) const;
00122 virtual double getError (int ilocal
00123 ) const;
00125 virtual double getCov (int ilocal,
00126 int jlocal
00127 ) const;
00129 virtual bool isParamMeasured (int ilocal
00130 ) const;
00132 virtual bool isParamFixed (int ilocal
00133 ) const;
00135 virtual int getGlobalParNum(int ilocal
00136 ) const;
00138 virtual int getNPar() const = 0;
00139
00141 virtual const char *getName () const;
00142
00144 virtual void setName (const char *name_
00145 );
00146
00148 virtual void getTrajectoryPointEx (double s,
00149 ThreeVector& p
00150 ) const = 0;
00152 virtual ThreeVector getTrajectoryPoint (double s
00153 ) const;
00155 virtual void getVertexEx (int ivertex,
00156 ThreeVector& p
00157 ) const = 0;
00159 virtual ThreeVector getVertex (int ivertex
00160 ) const;
00161
00163 virtual void setVertex (int ivertex,
00164 const TwoVector& v
00165 ) = 0;
00166
00168 virtual void getTrajectoryDerivativeEx (double s,
00169 int ilocal,
00170 ThreeVector& p
00171 ) const = 0;
00173 virtual ThreeVector getTrajectoryDerivative (double s,
00174 int ilocal
00175 ) const;
00177 virtual void getVertexDerivativeEx (int ivertex,
00178 int ilocal,
00179 ThreeVector& p
00180 ) const = 0;
00182 virtual ThreeVector getVertexDerivative (int ivertex,
00183 int ilocal
00184 ) const;
00185
00187 virtual void getMomentumAtTrajectoryEx (double s,
00188 FourVector& p
00189 ) const = 0;
00191 virtual FourVector getMomentumAtTrajectory (double s
00192 ) const;
00194 virtual void getMomentumEx (int ivertex,
00195 FourVector& p
00196 ) const = 0;
00198 virtual FourVector getMomentum (int ivertex
00199 ) const;
00200
00202 virtual double getCharge () const = 0;
00203
00205 virtual double getMass () const = 0;
00206
00208 virtual void getMomentumDerivativeAtTrajectoryEx (double s,
00209 int ilocal,
00210 FourVector& p
00211 ) const = 0;
00213 virtual FourVector getMomentumDerivativeAtTrajectory (double s,
00214 int ilocal
00215 ) const;
00217 virtual void getMomentumDerivativeEx (int ivertex,
00218 int ilocal,
00219 FourVector& p
00220 ) const = 0;
00222 virtual FourVector getMomentumDerivative (int ivertex,
00223 int ilocal
00224 ) const;
00226 virtual double getArcLength (int ivertex
00227 ) const = 0;
00230 virtual void addToGlobCov(double *globvcov,
00231 int idim
00232 ) const;
00233
00234
00236 virtual double getChi2() const;
00238 virtual double getDChi2DParam(int ilocal
00239 ) const = 0;
00241 virtual double getD2Chi2DParam2(int ilocal,
00242 int jlocal
00243 ) const = 0;
00244
00246 virtual void addToGlobalChi2DerMatrix (int idim, double *M) const = 0;
00248 virtual void addToGlobalDerMatrix (int idim,
00249 double c,
00250 double *M
00251 ) const = 0;
00252
00254 virtual JBLHelix getTangentialHelix (double s
00255 ) = 0;
00257 virtual std::ostream& print (std::ostream& os
00258 ) const;
00259
00261 virtual void invalidateCache();
00262
00263
00265 static double setBfield (double bfield_
00266 );
00267
00269 inline static double getBfield ();
00270
00272 static double bfield;
00273
00275 virtual bool fixVertexParam (int ivertex,
00276 bool fix=true
00277 ) = 0;
00279 virtual bool releaseVertexParam (int ivertex
00280 );
00282 virtual void TrackFitObject::printCov (std::ostream& os
00283 ) const;
00284 protected:
00286 virtual void initCov();
00288 virtual void checkCov();
00289
00291 virtual bool calculateCovInv() const;
00292
00294 virtual void calculateChi2() const;
00296 virtual void copy (const TrackFitObject& source
00297 );
00298
00299
00301 enum {NPARMAX = 8};
00302
00304 double par[NPARMAX];
00306 double mpar[NPARMAX];
00308 double err[NPARMAX];
00310 bool measured[NPARMAX];
00312 bool fixed[NPARMAX];
00314 int globalParNum [NPARMAX];
00316 double cov [NPARMAX][NPARMAX];
00318 mutable double covinv [NPARMAX][NPARMAX];
00320 mutable bool cachevalid;
00322 mutable bool covinvvalid;
00323
00324
00325 mutable double chi2;
00326 mutable double resid[NPARMAX];
00327 mutable bool chi2contr[NPARMAX];
00328
00329 char *name;
00330
00331 };
00332
00333 inline std::ostream& operator<< (std::ostream& os,
00334 const TrackFitObject& tfo
00335 ) {
00336 tfo.print(os);
00337 return os;
00338 }
00339
00340 double TrackFitObject::getBfield() {
00341 return bfield;
00342 }
00343
00344 #endif // __TRACKFITOBJECT_H
00345