Belle II Software  release-08-01-10
VertexFitKFit.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 #include <framework/geometry/B2Vector3.h>
17 
18 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
20 #endif
21 
22 
23 namespace Belle2 {
29  namespace analysis {
30 
34  class VertexFitKFit : public KFitBase {
35  public:
37  VertexFitKFit(void);
40 
41 
42  public:
58  enum KFitError::ECode setIpProfile(const HepPoint3D& ip, const CLHEP::HepSymMatrix& ipe);
66  enum KFitError::ECode setIpTubeProfile(const CLHEP::HepLorentzVector& p, const HepPoint3D& x, const CLHEP::HepSymMatrix& e,
67  const double q);
72  enum KFitError::ECode setKnownVertex(const bool flag = true);
77  enum KFitError::ECode setCorrelationMode(const bool m);
78 
79 
80  public:
85  const HepPoint3D getVertex(const int flag = KFitConst::kAfterFit) const;
89  const CLHEP::HepSymMatrix getVertexError(void) const;
90  double getCHIsq(void) const override;
94  double getCHIsqVertex(void) const;
100  const CLHEP::HepMatrix getTrackVertexError(const int id) const;
101  double getTrackCHIsq(const int id) const override;
106  double getTrackPartCHIsq(void) const;
110  int getTrackPartNDF(void) const;
111 
112 
113  public:
117  enum KFitError::ECode doFit(void);
118 
123  enum KFitError::ECode updateMother(Particle* mother);
124 
125  private:
129  enum KFitError::ECode doFit3(void);
133  enum KFitError::ECode doFit4(void);
137  enum KFitError::ECode doFit5(void);
138 
139 
140  private:
141  enum KFitError::ECode prepareInputMatrix(void) override;
142  enum KFitError::ECode prepareInputSubMatrix(void) override;
143  enum KFitError::ECode prepareOutputMatrix(void) override;
144  enum KFitError::ECode makeCoreMatrix(void) override;
145  enum KFitError::ECode calculateNDF(void) override;
146 
147 
148  private:
152  enum KFitError::ECode appendTube(void);
156  enum KFitError::ECode deleteTube(void);
157 
158 
159  private:
166 
169 
173  CLHEP::HepSymMatrix m_AfterVertexError;
175  std::vector<CLHEP::HepMatrix> m_AfterTrackVertexError;
176 
180  CLHEP::HepSymMatrix m_BeamError;
181 
184 
191  };
192 
193  } // namespace analysis
194 
196 } // 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
KFitTrack is a container of the track information (Lorentz vector, position, and error matrix),...
Definition: KFitTrack.h:38
VertexFitKFit is a derived class from KFitBase to perform vertex-constraint kinematical fit.
Definition: VertexFitKFit.h:34
enum KFitError::ECode setIpTubeProfile(const CLHEP::HepLorentzVector &p, const HepPoint3D &x, const CLHEP::HepSymMatrix &e, const double q)
Set a virtual IP-tube track for the vertex constraint fit.
enum KFitError::ECode doFit5(void)
Perform a fixed-vertex-position fit mainly for slow pion.
enum KFitError::ECode setKnownVertex(const bool flag=true)
Tell the object to perform a fit with vertex position fixed.
enum KFitError::ECode prepareInputMatrix(void) override
Build grand matrices for minimum search from input-track properties.
enum KFitError::ECode doFit4(void)
Perform a IP-ellipsoid and vertex-constraint fit.
enum KFitError::ECode calculateNDF(void) override
Calculate an NDF of the fit.
enum KFitError::ECode setInitialVertex(const HepPoint3D &v)
Set an initial vertex point for the vertex-vertex constraint fit.
double getCHIsq(void) const override
Get a chi-square of the fit.
KFitTrack m_TubeTrack
Entity of the virtual IP-tube track.
VertexFitKFit(void)
Construct an object with no argument.
enum KFitError::ECode deleteTube(void)
Delete the virtual tube track to m_Tracks just after the internal minimization call.
bool m_FlagTube
Flag if to perform IP-tube constraint fit.
bool m_FlagKnownVertex
Flag controlled by setKnownVertex().
enum KFitError::ECode updateMother(Particle *mother)
Update mother particle.
const CLHEP::HepSymMatrix getVertexError(void) const
Get a fitted vertex error matrix.
enum KFitError::ECode prepareInputSubMatrix(void) override
Build sub-matrices for minimum search from input-track properties.
CLHEP::HepSymMatrix m_BeamError
Error matrix modeling the IP ellipsoid.
enum KFitError::ECode doFit(void)
Perform a vertex-constraint fit.
double getTrackPartCHIsq(void) const
Get a sum of the chi-square associated to the input tracks.
enum KFitError::ECode doFit3(void)
Perform a standard vertex-constraint fit including IP-tube constraint.
~VertexFitKFit(void)
Destruct the object.
enum KFitError::ECode makeCoreMatrix(void) override
Build matrices using the kinematical constraint.
HepPoint3D m_AfterVertex
Vertex position after the fit.
std::vector< CLHEP::HepMatrix > m_AfterTrackVertexError
Array of vertex error matrices after the fit.
double m_EachCHIsq[KFitConst::kMaxTrackCount2]
Container of chi-square's of the input tracks.
double getTrackCHIsq(const int id) const override
Get a chi-square of the track.
enum KFitError::ECode setCorrelationMode(const bool m)
Tell the object to perform a fit with track correlations.
int getTrackPartNDF(void) const
Get an NDF relevant to the getTrackPartCHIsq().
bool m_FlagBeam
Flag if to perform IP-ellipsoid constraint fit.
int m_iTrackTube
ID of the virtual tube track in the m_Tracks.
enum KFitError::ECode setIpProfile(const HepPoint3D &ip, const CLHEP::HepSymMatrix &ipe)
Set an IP-ellipsoid shape for the vertex constraint fit.
const HepPoint3D getVertex(const int flag=KFitConst::kAfterFit) const
Get a vertex position.
double m_CHIsqVertex
chi-square of the fit excluding IP-constraint part.
double getCHIsqVertex(void) const
Get a chi-square of the fit excluding IP-constraint part.
enum KFitError::ECode appendTube(void)
Add the virtual tube track to m_Tracks just before the internal minimization call.
CLHEP::HepSymMatrix m_AfterVertexError
Vertex error matrix after the fit.
bool m_CorrelationMode
Flag controlled by setCorrelationMode().
enum KFitError::ECode prepareOutputMatrix(void) override
Build an output error matrix.
const CLHEP::HepMatrix getTrackVertexError(const int id) const
Get a vertex error matrix of the track.
HepPoint3D m_BeforeVertex
Vertex position before the fit.
Abstract base class for different kinds of events.
static const int kMaxTrackCount2
Maximum track size (internal use)
Definition: KFitConst.h:42
static const int kAfterFit
Input parameter to specify after-fit when setting/getting a track attribute.
Definition: KFitConst.h:37