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