Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:23:35

0001 #ifndef TFitConstraintEp_hh
0002 #define TFitConstraintEp_hh
0003 
0004 #include "PhysicsTools/KinFitter/interface/TAbsFitConstraint.h"
0005 #include "PhysicsTools/KinFitter/interface/TAbsFitParticle.h"
0006 #include "TMatrixD.h"
0007 #include <vector>
0008 
0009 class TFitConstraintEp : public TAbsFitConstraint {
0010 public:
0011   enum component { pX, pY, pZ, E };
0012 
0013   TFitConstraintEp();
0014 
0015   TFitConstraintEp(const TString& name,
0016                    const TString& title,
0017                    TFitConstraintEp::component thecomponent,
0018                    Double_t constraint = 0.);
0019 
0020   TFitConstraintEp(std::vector<TAbsFitParticle*>* particles,
0021                    TFitConstraintEp::component thecomponent,
0022                    Double_t constraint = 0.);
0023 
0024   TFitConstraintEp(const TString& name,
0025                    const TString& title,
0026                    std::vector<TAbsFitParticle*>* particles,
0027                    TFitConstraintEp::component thecomponent,
0028                    Double_t constraint = 0.);
0029   ~TFitConstraintEp() override;
0030 
0031   void addParticle(TAbsFitParticle* particle);
0032   void addParticles(TAbsFitParticle* p1,
0033                     TAbsFitParticle* p2 = nullptr,
0034                     TAbsFitParticle* p3 = nullptr,
0035                     TAbsFitParticle* p4 = nullptr,
0036                     TAbsFitParticle* p5 = nullptr,
0037                     TAbsFitParticle* p6 = nullptr,
0038                     TAbsFitParticle* p7 = nullptr,
0039                     TAbsFitParticle* p8 = nullptr,
0040                     TAbsFitParticle* p9 = nullptr,
0041                     TAbsFitParticle* p10 = nullptr);
0042   void setConstraint(Double_t constraint) { _constraint = constraint; };
0043 
0044   // returns derivative df/dP with P=(p,E) and f the constraint f=0.
0045   // The matrix contains one row (df/dp, df/dE).
0046   TMatrixD* getDerivative(TAbsFitParticle* particle) override;
0047   Double_t getInitValue() override;
0048   Double_t getCurrentValue() override;
0049 
0050   TString getInfoString() override;
0051   void print() override;
0052 
0053 protected:
0054 private:
0055   std::vector<TAbsFitParticle*> _particles;  // Vector containing constrained particles
0056   Double_t _constraint;                      // Value of constraint
0057   TFitConstraintEp::component _component;    // 4vector component to be constrained
0058 
0059   ClassDefOverride(TFitConstraintEp, 0)
0060 };
0061 
0062 #endif