CMS 3D CMS Logo

BPHKinematicFit.h
Go to the documentation of this file.
1 #ifndef HeavyFlavorAnalysis_RecoDecay_BPHKinematicFit_h
2 #define HeavyFlavorAnalysis_RecoDecay_BPHKinematicFit_h
3 
12 //----------------------
13 // Base Class Headers --
14 //----------------------
16 
17 //------------------------------------
18 // Collaborating Class Declarations --
19 //------------------------------------
22 
25 
26 //---------------
27 // C++ Headers --
28 //---------------
29 #include <map>
30 
31 // ---------------------
32 // -- Class Interface --
33 // ---------------------
34 
35 class BPHKinematicFit: public virtual BPHDecayVertex {
36 
37  public:
38 
45  ~BPHKinematicFit() override;
46 
50  void setConstraint( double mass, double sigma );
53  double constrMass() const;
54  double constrSigma() const;
55 
57  virtual const std::vector<RefCountedKinematicParticle>& kinParticles() const;
58  virtual std::vector<RefCountedKinematicParticle> kinParticles(
59  const std::vector<std::string>& names ) const;
60 
62  virtual const RefCountedKinematicTree& kinematicTree() const;
64  const std::string& name, double mass, double sigma ) const;
66  const std::string& name, double mass ) const;
68  const std::string& name, KinematicConstraint* kc ) const;
70  const std::string& name, MultiTrackKinematicConstraint* kc ) const;
71 
73  virtual void resetKinematicFit() const;
74 
75  // get current particle
76  virtual bool isEmpty() const;
77  virtual bool isValidFit() const;
78  virtual const RefCountedKinematicParticle currentParticle () const;
79  virtual const RefCountedKinematicVertex currentDecayVertex() const;
80  virtual ParticleMass mass () const;
81 
83  virtual const math::XYZTLorentzVector& p4() const;
84 
85  protected:
86 
87  // constructors
89  // pointer used to retrieve informations from other bases
90  BPHKinematicFit( const BPHKinematicFit* ptr );
91 
95  virtual void addK( const std::string& name,
96  const reco::Candidate* daug,
97  double mass = -1.0, double sigma = -1.0 );
100  virtual void addK( const std::string& name,
101  const reco::Candidate* daug,
102  const std::string& searchList,
103  double mass = -1.0, double sigma = -1.0 );
105  virtual void addK( const std::string& name,
106  const BPHRecoConstCandPtr& comp );
107 
108  // utility function used to cash reconstruction results
109  void setNotUpdated() const override;
110 
111  private:
112 
113  // mass constraint
114  double massConst;
115  double massSigma;
116 
117  // map linking daughters to mass sigma
118  std::map<const reco::Candidate*,double> dMSig;
119 
120  // reconstruction results cache
121  mutable bool oldKPs;
122  mutable bool oldFit;
123  mutable bool oldMom;
124  mutable std::map <const reco::Candidate*,
126  mutable std::vector<RefCountedKinematicParticle> allParticles;
129 
130  // build kin particles, perform the fit and compute the total momentum
131  virtual void buildParticles() const;
132  virtual void fitMomentum() const;
133 
134 };
135 
136 
137 #endif
138 
virtual const math::XYZTLorentzVector & p4() const
compute total momentum after the fit
virtual void buildParticles() const
virtual void addK(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
double ParticleMass
Definition: ParticleMass.h:5
virtual bool isEmpty() const
virtual ParticleMass mass() const
const std::string names[nVars_]
virtual const RefCountedKinematicParticle currentParticle() const
std::map< const reco::Candidate *, double > dMSig
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double constrSigma() const
std::map< const reco::Candidate *, RefCountedKinematicParticle > kinMap
double constrMass() const
retrieve the constraint
virtual void fitMomentum() const
virtual const RefCountedKinematicTree & kinematicTree() const
perform the kinematic fit and get the result
virtual const RefCountedKinematicVertex currentDecayVertex() const
virtual const std::vector< RefCountedKinematicParticle > & kinParticles() const
get kinematic particles
void setNotUpdated() const override
virtual void resetKinematicFit() const
reset the kinematic fit
std::vector< RefCountedKinematicParticle > allParticles
virtual bool isValidFit() const
RefCountedKinematicTree kinTree
void setConstraint(double mass, double sigma)
apply a mass constraint
math::XYZTLorentzVector totalMomentum
~BPHKinematicFit() override