Belle II Software  release-08-01-10
FourCFitKFit.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #pragma once
10 #include <analysis/VertexFitting/KFit/KFitConst.h>
11 #include <analysis/VertexFitting/KFit/KFitError.h>
12 #include <analysis/VertexFitting/KFit/KFitBase.h>
13 #include <Math/Vector4D.h>
14 
15 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
17 #endif
18 
19 namespace Belle2 {
25  namespace analysis {
26 
30  class FourCFitKFit : public KFitBase {
31  public:
33  FourCFitKFit(void);
36 
37 
38  public:
43  enum KFitError::ECode setVertex(const HepPoint3D& v);
48  enum KFitError::ECode setVertexError(const CLHEP::HepSymMatrix& e);
53  enum KFitError::ECode setInvariantMass(const double m);
58  enum KFitError::ECode setFourMomentum(const ROOT::Math::PxPyPzEVector& m);
63  enum KFitError::ECode setFlagAtDecayPoint(const bool flag);
68  enum KFitError::ECode fixMass(void);
73  enum KFitError::ECode unfixMass(void);
78  enum KFitError::ECode setTrackVertexError(const CLHEP::HepMatrix& e);
83  enum KFitError::ECode setCorrelation(const CLHEP::HepMatrix& m) override;
84  enum KFitError::ECode setZeroCorrelation(void) override;
85 
86 
91  const HepPoint3D getVertex(const int flag = KFitConst::kAfterFit) const;
96  const CLHEP::HepSymMatrix getVertexError(const int flag = KFitConst::kAfterFit) const;
100  double getInvariantMass(void) const;
104  bool getFlagAtDecayPoint(void) const;
108  bool getFlagFitWithVertex(void) const;
109  double getCHIsq(void) const override;
115  const CLHEP::HepMatrix getTrackVertexError(const int id, const int flag = KFitConst::kAfterFit) const;
116  double getTrackCHIsq(const int id) const override;
117  const CLHEP::HepMatrix getCorrelation(const int id1, const int id2,
118  const int flag = KFitConst::kAfterFit) const override;
119 
120 
121  public:
125  enum KFitError::ECode doFit(void);
126 
131  enum KFitError::ECode updateMother(Particle* mother);
132 
133  private:
134  enum KFitError::ECode prepareInputMatrix(void) override;
135  enum KFitError::ECode prepareInputSubMatrix(void) override;
136  enum KFitError::ECode prepareCorrelation(void) override;
137  enum KFitError::ECode prepareOutputMatrix(void) override;
138  enum KFitError::ECode makeCoreMatrix(void) override;
139  enum KFitError::ECode calculateNDF(void) override;
140 
141 
142  private:
146  CLHEP::HepSymMatrix m_BeforeVertexError;
148  std::vector<CLHEP::HepMatrix> m_BeforeTrackVertexError;
149 
153  CLHEP::HepSymMatrix m_AfterVertexError;
155  std::vector<CLHEP::HepMatrix> m_AfterTrackVertexError;
156 
163 
166 
168  ROOT::Math::PxPyPzEVector m_FourMomentum;
169 
171  std::vector<int> m_IsFixMass;
172  };
173 
174  } // namespace analysis
175 
177 } // namespace Belle2
Class to store reconstructed particles.
Definition: Particle.h:75
FourCFitKFit is a derived class from KFitBase to perform 4 momentum-constraint kinematical fit.
Definition: FourCFitKFit.h:30
enum KFitError::ECode setZeroCorrelation(void) override
Indicate no correlation between tracks.
enum KFitError::ECode setVertex(const HepPoint3D &v)
Set an initial vertex position for the four momentum-constraint fit.
Definition: FourCFitKFit.cc:45
bool m_FlagTrackVertexError
Flag to indicate if the vertex error matrix of the child particle is preset.
Definition: FourCFitKFit.h:158
enum KFitError::ECode setFourMomentum(const ROOT::Math::PxPyPzEVector &m)
Set an 4 Momentum for the FourC-constraint fit.
Definition: FourCFitKFit.cc:77
bool m_FlagAtDecayPoint
Flag controlled by setFlagAtDecayPoint().
Definition: FourCFitKFit.h:162
bool getFlagAtDecayPoint(void) const
Get a flag if to constraint at the decay point in the four momentum-constraint fit.
enum KFitError::ECode prepareInputMatrix(void) override
Build grand matrices for minimum search from input-track properties.
bool getFlagFitWithVertex(void) const
Get a flag if the fit is allowed with moving the vertex position.
enum KFitError::ECode calculateNDF(void) override
Calculate an NDF of the fit.
double getCHIsq(void) const override
Get a chi-square of the fit.
enum KFitError::ECode setFlagAtDecayPoint(const bool flag)
Set a flag if to constraint at the decay point in the four momentum-constraint fit.
Definition: FourCFitKFit.cc:85
enum KFitError::ECode setTrackZeroVertexError(void)
Indicate no vertex uncertainty in the child particle in the addTrack'ed order.
std::vector< int > m_IsFixMass
Array of flags whether the track property is fixed at the mass.
Definition: FourCFitKFit.h:171
enum KFitError::ECode updateMother(Particle *mother)
Update mother particle.
enum KFitError::ECode unfixMass(void)
Tell the object to unfix the last added track property at the invariant mass.
FourCFitKFit(void)
Construct an object with no argument.
Definition: FourCFitKFit.cc:25
enum KFitError::ECode prepareInputSubMatrix(void) override
Build sub-matrices for minimum search from input-track properties.
bool m_FlagFitIncludingVertex
Flag to indicate if the fit is allowed with moving the vertex position.
Definition: FourCFitKFit.h:160
enum KFitError::ECode doFit(void)
Perform a four momentum-constraint fit.
double m_InvariantMass
Invariant mass.
Definition: FourCFitKFit.h:165
enum KFitError::ECode setInvariantMass(const double m)
Set an invariant mass for the four momentum-constraint fit.
Definition: FourCFitKFit.cc:69
std::vector< CLHEP::HepMatrix > m_BeforeTrackVertexError
array of vertex error matrices before the fit.
Definition: FourCFitKFit.h:148
enum KFitError::ECode makeCoreMatrix(void) override
Build matrices using the kinematical constraint.
enum KFitError::ECode setVertexError(const CLHEP::HepSymMatrix &e)
Set an initial vertex error matrix for the four momentum-constraint fit.
Definition: FourCFitKFit.cc:53
enum KFitError::ECode setTrackVertexError(const CLHEP::HepMatrix &e)
Set a vertex error matrix of the child particle in the addTrack'ed order.
~FourCFitKFit(void)
Destruct the object.
enum KFitError::ECode prepareCorrelation(void) override
Build a grand correlation matrix from input-track properties.
HepPoint3D m_AfterVertex
Vertex position after the fit.
Definition: FourCFitKFit.h:151
enum KFitError::ECode setCorrelation(const CLHEP::HepMatrix &m) override
Set a correlation matrix.
std::vector< CLHEP::HepMatrix > m_AfterTrackVertexError
array of vertex error matrices after the fit.
Definition: FourCFitKFit.h:155
const CLHEP::HepMatrix getCorrelation(const int id1, const int id2, const int flag=KFitConst::kAfterFit) const override
Get a correlation matrix between two tracks.
double getTrackCHIsq(const int id) const override
Get a chi-square of the track.
const CLHEP::HepSymMatrix getVertexError(const int flag=KFitConst::kAfterFit) const
Get a vertex error matrix.
const HepPoint3D getVertex(const int flag=KFitConst::kAfterFit) const
Get a vertex position.
const CLHEP::HepMatrix getTrackVertexError(const int id, const int flag=KFitConst::kAfterFit) const
Get a vertex error matrix of the track.
CLHEP::HepSymMatrix m_AfterVertexError
Vertex error matrix after the fit.
Definition: FourCFitKFit.h:153
enum KFitError::ECode prepareOutputMatrix(void) override
Build an output error matrix.
CLHEP::HepSymMatrix m_BeforeVertexError
Vertex error matrix before the fit.
Definition: FourCFitKFit.h:146
HepPoint3D m_BeforeVertex
Vertex position before the fit.
Definition: FourCFitKFit.h:144
enum KFitError::ECode fixMass(void)
Tell the object to fix the last added track property at the invariant mass.
Definition: FourCFitKFit.cc:93
ROOT::Math::PxPyPzEVector m_FourMomentum
Four Momentum.
Definition: FourCFitKFit.h:168
double getInvariantMass(void) const
Get an invariant mass.
KFitBase is a base class for kinematical fitters.
Definition: KFitBase.h:37
ECode
ECode is a error code enumerate.
Definition: KFitError.h:34
Abstract base class for different kinds of events.
static const int kAfterFit
Input parameter to specify after-fit when setting/getting a track attribute.
Definition: KFitConst.h:37