Go to the documentation of this file.00001 #ifndef TKinFitter_h
00002 #define TKinFitter_h
00003
00004 #include <vector>
00005 #include "TMatrixD.h"
00006 #include "TNamed.h"
00007
00008 class TAbsFitParticle;
00009 class TAbsFitConstraint;
00010 class TH1D;
00011
00012 class TKinFitter : public TNamed {
00013
00014 public :
00015
00016 TKinFitter();
00017 TKinFitter(const TString &name, const TString &title);
00018 ~TKinFitter();
00019 void reset();
00020 void resetStatus();
00021
00022 Int_t fit();
00023
00024 void addMeasParticle( TAbsFitParticle* particle );
00025 void addMeasParticles( TAbsFitParticle* p1, TAbsFitParticle* p2 = 0, TAbsFitParticle* p3 = 0,
00026 TAbsFitParticle* p4 = 0, TAbsFitParticle* p5 = 0, TAbsFitParticle* p6 = 0,
00027 TAbsFitParticle* p7 = 0, TAbsFitParticle* p8 = 0, TAbsFitParticle* p9 = 0);
00028 void addUnmeasParticle( TAbsFitParticle* particle );
00029 void addUnmeasParticles( TAbsFitParticle* p1, TAbsFitParticle* p2 = 0, TAbsFitParticle* p3 = 0,
00030 TAbsFitParticle* p4 = 0, TAbsFitParticle* p5 = 0, TAbsFitParticle* p6 = 0,
00031 TAbsFitParticle* p7 = 0, TAbsFitParticle* p8 = 0, TAbsFitParticle* p9 = 0);
00032 void addConstraint( TAbsFitConstraint* constraint );
00033
00034 Int_t getNDF() { return (_constraints.size() - _nParA); }
00035 Int_t getNParA() { return _nParA; }
00036 Int_t getNParB() { return _nParB; }
00037 void setMaxNbIter( Int_t maxNbIter ) { _maxNbIter = maxNbIter; }
00038 Int_t getMaxNumberIter() { return _maxNbIter; }
00039 Int_t getNbIter() { return _nbIter; }
00040 Int_t getStatus() { return _status; }
00041 void setMaxDeltaS( Double_t maxDeltaS ) { _maxDeltaS = TMath::Abs( maxDeltaS ); }
00042 Double_t getMaxDeltaS() { return _maxDeltaS; }
00043 void setMaxF( Double_t maxF ) { _maxF = TMath::Abs( maxF ); }
00044 Double_t getMaxF() { return _maxF; }
00045 const TMatrixD* getCovMatrix() { return &_V; }
00046 void setCovMatrix( TMatrixD &V );
00047 const TMatrixD* getCovMatrixFit() { return &_yaVFit; }
00048 Double_t getS();
00049 Double_t getF();
00050 void setVerbosity( Int_t verbosity = 1 );
00051 Int_t getVerbosity( ) { return _verbosity; }
00052
00053 Int_t nbMeasParticles() { return _measParticles.size(); }
00054 const TAbsFitParticle* getMeasParticle( Int_t index ) { return _measParticles[index]; }
00055 Int_t nbUnmeasParticles() { return _unmeasParticles.size(); }
00056 const TAbsFitParticle* getUnmeasParticle( Int_t index ) { return _unmeasParticles[index]; }
00057 Int_t nbConstraints() { return _constraints.size(); }
00058
00059 void print();
00060
00061 protected:
00062
00063 Bool_t calcA();
00064 Bool_t calcB();
00065 Bool_t calcVA();
00066 Bool_t calcVB();
00067 Bool_t calcC();
00068
00069 Bool_t calcC11();
00070 Bool_t calcC21();
00071 Bool_t calcC22();
00072 Bool_t calcC31();
00073 Bool_t calcC32();
00074 Bool_t calcC33();
00075
00076 Bool_t calcDeltaA();
00077 Bool_t calcDeltaY();
00078 Bool_t calcLambda();
00079
00080 Bool_t calcV();
00081 Bool_t calcVFit();
00082
00083 Bool_t applyDeltaA();
00084 Bool_t applyDeltaY();
00085 void applyVFit();
00086
00087 Bool_t converged(Double_t F, Double_t prevS, Double_t currS);
00088
00089 TString getStatusString();
00090 void countMeasParams();
00091 void countUnmeasParams();
00092 void resetParams();
00093
00094 void printMatrix(const TMatrixD &matrix, const TString name = "");
00095
00096 private :
00097
00098 Int_t _maxNbIter;
00099 Double_t _maxDeltaS;
00100 Double_t _maxF;
00101 Int_t _verbosity;
00102
00103 TMatrixD _A;
00104 TMatrixD _AT;
00105 TMatrixD _B;
00106 TMatrixD _BT;
00107 TMatrixD _V;
00108 TMatrixD _Vinv;
00109 TMatrixD _VB;
00110 TMatrixD _VBinv;
00111 TMatrixD _VA;
00112 TMatrixD _VAinv;
00113 TMatrixD _c;
00114
00115 TMatrixD _C11;
00116 TMatrixD _C11T;
00117 TMatrixD _C21;
00118 TMatrixD _C21T;
00119 TMatrixD _C22;
00120 TMatrixD _C22T;
00121 TMatrixD _C31;
00122 TMatrixD _C31T;
00123 TMatrixD _C32;
00124 TMatrixD _C32T;
00125 TMatrixD _C33;
00126 TMatrixD _C33T;
00127
00128 TMatrixD _deltaA;
00129 TMatrixD _deltaY;
00130 TMatrixD _deltaAstar;
00131 TMatrixD _deltaYstar;
00132 TMatrixD _lambda;
00133 TMatrixD _lambdaT;
00134
00135 TMatrixD _lambdaVFit;
00136 TMatrixD _yaVFit;
00137
00138 Int_t _nParA;
00139 Int_t _nParB;
00140
00141 std::vector<TAbsFitConstraint*> _constraints;
00142 std::vector<TAbsFitParticle*> _measParticles;
00143 std::vector<TAbsFitParticle*> _unmeasParticles;
00144
00145 Int_t _status;
00146 Int_t _nbIter;
00147
00148 };
00149
00150 #endif