Belle II Software  release-08-01-10
MassFitKFit.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * External Contributor: J. Tanaka *
5  * *
6  * See git log for contributors and copyright holders. *
7  * This file is licensed under LGPL-3.0, see LICENSE.md. *
8  **************************************************************************/
9 
10 #pragma once
11 
12 #include <analysis/VertexFitting/KFit/KFitConst.h>
13 #include <analysis/VertexFitting/KFit/KFitError.h>
14 #include <analysis/VertexFitting/KFit/KFitBase.h>
15 
16 
17 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
19 #endif
20 
21 
22 namespace Belle2 {
28  namespace analysis {
29 
33  class MassFitKFit : public KFitBase {
34  public:
36  MassFitKFit(void);
38  ~MassFitKFit(void);
39 
40 
41  public:
46  enum KFitError::ECode setVertex(const HepPoint3D& v);
51  enum KFitError::ECode setVertexError(const CLHEP::HepSymMatrix& e);
56  enum KFitError::ECode setInvariantMass(const double m);
61  enum KFitError::ECode setFlagAtDecayPoint(const bool flag);
66  enum KFitError::ECode fixMass(void);
71  enum KFitError::ECode unfixMass(void);
76  enum KFitError::ECode setTrackVertexError(const CLHEP::HepMatrix& e);
81  enum KFitError::ECode setCorrelation(const CLHEP::HepMatrix& m) override;
82  enum KFitError::ECode setZeroCorrelation(void) override;
83 
84 
89  const HepPoint3D getVertex(const int flag = KFitConst::kAfterFit) const;
94  const CLHEP::HepSymMatrix getVertexError(const int flag = KFitConst::kAfterFit) const;
98  double getInvariantMass(void) const;
102  bool getFlagAtDecayPoint(void) const;
106  bool getFlagFitWithVertex(void) const;
107  double getCHIsq(void) const override;
113  const CLHEP::HepMatrix getTrackVertexError(const int id, const int flag = KFitConst::kAfterFit) const;
114  double getTrackCHIsq(const int id) const override;
115  const CLHEP::HepMatrix getCorrelation(const int id1, const int id2,
116  const int flag = KFitConst::kAfterFit) const override;
117 
118 
119  public:
123  enum KFitError::ECode doFit(void);
124 
129  enum KFitError::ECode updateMother(Particle* mother);
130 
131  private:
132  enum KFitError::ECode prepareInputMatrix(void) override;
133  enum KFitError::ECode prepareInputSubMatrix(void) override;
134  enum KFitError::ECode prepareCorrelation(void) override;
135  enum KFitError::ECode prepareOutputMatrix(void) override;
136  enum KFitError::ECode makeCoreMatrix(void) override;
137  enum KFitError::ECode calculateNDF(void) override;
138 
139 
140  private:
144  CLHEP::HepSymMatrix m_BeforeVertexError;
146  std::vector<CLHEP::HepMatrix> m_BeforeTrackVertexError;
147 
151  CLHEP::HepSymMatrix m_AfterVertexError;
153  std::vector<CLHEP::HepMatrix> m_AfterTrackVertexError;
154 
161 
165  std::vector<int> m_IsFixMass;
166  };
167 
168  } // namespace analysis
169 
171 } // namespace Belle2
Class to store reconstructed particles.
Definition: Particle.h:75
KFitBase is a base class for kinematical fitters.
Definition: KFitBase.h:37
ECode
ECode is a error code enumerate.
Definition: KFitError.h:34
MassFitKFit is a derived class from KFitBase to perform mass-constraint kinematical fit.
Definition: MassFitKFit.h:33
enum KFitError::ECode setZeroCorrelation(void) override
Indicate no correlation between tracks.
Definition: MassFitKFit.cc:131
enum KFitError::ECode setVertex(const HepPoint3D &v)
Set an initial vertex position for the mass-constraint fit.
Definition: MassFitKFit.cc:44
bool m_FlagTrackVertexError
Flag to indicate if the vertex error matrix of the child particle is preset.
Definition: MassFitKFit.h:156
bool m_FlagAtDecayPoint
Flag controlled by setFlagAtDecayPoint().
Definition: MassFitKFit.h:160
bool getFlagAtDecayPoint(void) const
Get a flag if to constraint at the decay point in the mass-constraint fit.
Definition: MassFitKFit.cc:179
enum KFitError::ECode prepareInputMatrix(void) override
Build grand matrices for minimum search from input-track properties.
Definition: MassFitKFit.cc:286
bool getFlagFitWithVertex(void) const
Get a flag if the fit is allowed with moving the vertex position.
Definition: MassFitKFit.cc:186
enum KFitError::ECode calculateNDF(void) override
Calculate an NDF of the fit.
Definition: MassFitKFit.cc:685
double getCHIsq(void) const override
Get a chi-square of the fit.
Definition: MassFitKFit.cc:193
enum KFitError::ECode setFlagAtDecayPoint(const bool flag)
Set a flag if to constraint at the decay point in the mass-constraint fit.
Definition: MassFitKFit.cc:76
enum KFitError::ECode setTrackZeroVertexError(void)
Indicate no vertex uncertainty in the child particle in the addTrack'ed order.
Definition: MassFitKFit.cc:117
std::vector< int > m_IsFixMass
Array of flags whether the track property is fixed at the mass.
Definition: MassFitKFit.h:165
enum KFitError::ECode updateMother(Particle *mother)
Update mother particle.
Definition: MassFitKFit.cc:691
enum KFitError::ECode unfixMass(void)
Tell the object to unfix the last added track property at the invariant mass.
Definition: MassFitKFit.cc:92
enum KFitError::ECode prepareInputSubMatrix(void) override
Build sub-matrices for minimum search from input-track properties.
Definition: MassFitKFit.cc:405
bool m_FlagFitIncludingVertex
Flag to indicate if the fit is allowed with moving the vertex position.
Definition: MassFitKFit.h:158
enum KFitError::ECode doFit(void)
Perform a mass-constraint fit.
Definition: MassFitKFit.cc:280
double m_InvariantMass
Invariant mass.
Definition: MassFitKFit.h:163
enum KFitError::ECode setInvariantMass(const double m)
Set an invariant mass for the mass-constraint fit.
Definition: MassFitKFit.cc:68
std::vector< CLHEP::HepMatrix > m_BeforeTrackVertexError
array of vertex error matrices before the fit.
Definition: MassFitKFit.h:146
enum KFitError::ECode makeCoreMatrix(void) override
Build matrices using the kinematical constraint.
Definition: MassFitKFit.cc:537
~MassFitKFit(void)
Destruct the object.
enum KFitError::ECode setVertexError(const CLHEP::HepSymMatrix &e)
Set an initial vertex error matrix for the mass-constraint fit.
Definition: MassFitKFit.cc:52
enum KFitError::ECode setTrackVertexError(const CLHEP::HepMatrix &e)
Set a vertex error matrix of the child particle in the addTrack'ed order.
Definition: MassFitKFit.cc:100
enum KFitError::ECode prepareCorrelation(void) override
Build a grand correlation matrix from input-track properties.
Definition: MassFitKFit.cc:416
HepPoint3D m_AfterVertex
Vertex position after the fit.
Definition: MassFitKFit.h:149
MassFitKFit(void)
Construct an object with no argument.
Definition: MassFitKFit.cc:25
enum KFitError::ECode setCorrelation(const CLHEP::HepMatrix &m) override
Set a correlation matrix.
Definition: MassFitKFit.cc:125
std::vector< CLHEP::HepMatrix > m_AfterTrackVertexError
array of vertex error matrices after the fit.
Definition: MassFitKFit.h:153
const CLHEP::HepMatrix getCorrelation(const int id1, const int id2, const int flag=KFitConst::kAfterFit) const override
Get a correlation matrix between two tracks.
Definition: MassFitKFit.cc:253
double getTrackCHIsq(const int id) const override
Get a chi-square of the track.
Definition: MassFitKFit.cc:217
const CLHEP::HepSymMatrix getVertexError(const int flag=KFitConst::kAfterFit) const
Get a vertex error matrix.
Definition: MassFitKFit.cc:156
const HepPoint3D getVertex(const int flag=KFitConst::kAfterFit) const
Get a vertex position.
Definition: MassFitKFit.cc:137
const CLHEP::HepMatrix getTrackVertexError(const int id, const int flag=KFitConst::kAfterFit) const
Get a vertex error matrix of the track.
Definition: MassFitKFit.cc:200
CLHEP::HepSymMatrix m_AfterVertexError
Vertex error matrix after the fit.
Definition: MassFitKFit.h:151
enum KFitError::ECode prepareOutputMatrix(void) override
Build an output error matrix.
Definition: MassFitKFit.cc:474
CLHEP::HepSymMatrix m_BeforeVertexError
Vertex error matrix before the fit.
Definition: MassFitKFit.h:144
HepPoint3D m_BeforeVertex
Vertex position before the fit.
Definition: MassFitKFit.h:142
enum KFitError::ECode fixMass(void)
Tell the object to fix the last added track property at the invariant mass.
Definition: MassFitKFit.cc:84
double getInvariantMass(void) const
Get an invariant mass.
Definition: MassFitKFit.cc:172
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