Belle II Software  release-05-01-25
CKFState.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun, Christian Wessel *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/ca/AutomatonCell.h>
13 
14 #include <genfit/MeasuredStateOnPlane.h>
15 #include <framework/logging/Logger.h>
16 
17 #include <vxd/dataobjects/VxdID.h>
18 
19 namespace Belle2 {
30  template<class ASeed, class AHit>
31  class CKFState {
32  public:
34  using Seed = ASeed;
36  using Hit = AHit;
37 
39  CKFState() = default;
41  CKFState(CKFState&&) = default;
43  CKFState(const CKFState&) = delete;
45  CKFState& operator=(const CKFState&) = delete;
47  CKFState& operator=(CKFState&&) = default;
49  ~CKFState() = default;
50 
52  explicit CKFState(const Seed* seed) : m_seed(seed)
53  {
54  }
55 
57  explicit CKFState(const Hit* hit) : m_hit(hit)
58  {
59  }
60 
62  const Seed* getSeed() const
63  {
64  return m_seed;
65  }
66 
68  const Hit* getHit() const
69  {
70  return m_hit;
71  }
72 
74  double getChi2() const
75  {
76  B2ASSERT("Chi2 is not set", isFitted());
77  return m_chi2;
78  }
79 
81  void setChi2(double chi2)
82  {
83  m_chi2 = chi2;
84  m_isFitted = true;
85  }
86 
89  {
91  m_hasMSoP = true;
92  }
93 
96  {
97  B2ASSERT("You are asking for an invalid variable!", mSoPSet());
99  }
100 
102  bool isFitted() const
103  {
104  return m_isFitted;
105  }
106 
108  bool mSoPSet() const
109  {
110  return m_hasMSoP;
111  }
112 
114  void reset()
115  {
116  m_isFitted = false;
117  m_hasMSoP = false;
118  }
119 
122  {
123  return m_automatonCell;
124  }
125 
127  struct stateCache {
129  bool isHitState = false;
131  VxdID sensorID = VxdID(0);
133  unsigned short geoLayer = std::numeric_limits<unsigned short>::quiet_NaN();
135  unsigned short ladder = std::numeric_limits<unsigned short>::quiet_NaN();
137  double sensorCenterPhi = std::numeric_limits<double>::quiet_NaN();
139  double phi = std::numeric_limits<double>::quiet_NaN();
141  double theta = std::numeric_limits<double>::quiet_NaN();
143  double localNormalizedu = std::numeric_limits<double>::quiet_NaN();
145  double localNormalizedv = std::numeric_limits<double>::quiet_NaN();
146  };
147 
148  protected:
151 
152 
153  private:
155  const Seed* m_seed = nullptr;
157  const Hit* m_hit = nullptr;
159  double m_chi2 = 0;
161  bool m_isFitted = false;
163  bool m_hasMSoP = false;
168  };
170 }
Belle2::CKFState::stateCache::isHitState
bool isHitState
Is this state based on a hit (=SpacePoint) or a seed (=RecoTrack)
Definition: CKFState.h:137
Belle2::CKFState::reset
void reset()
Reset the state to be seen as "new".
Definition: CKFState.h:122
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::CKFState::stateCache::theta
double theta
Theta if this state (from SpacePoint or RecoTrack)
Definition: CKFState.h:149
Belle2::CKFState::CKFState
CKFState()=default
Default constructor needed for STL containers.
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::CKFState::getAutomatonCell
TrackFindingCDC::AutomatonCell & getAutomatonCell()
Getter for the automaton cell.
Definition: CKFState.h:129
Belle2::CKFState::stateCache::sensorCenterPhi
double sensorCenterPhi
Phi of the sensor this state is based on, only set if based on SpacePoint.
Definition: CKFState.h:145
Belle2::CKFState::stateCache::localNormalizedv
double localNormalizedv
Local normalized vCoordinate of this state, only set if based on SpacePoint.
Definition: CKFState.h:153
Belle2::CKFState::~CKFState
~CKFState()=default
Destructor.
Belle2::CKFState::setChi2
void setChi2(double chi2)
Set the chi2 of this state during fitting.
Definition: CKFState.h:89
Belle2::CKFState::m_chi2
double m_chi2
Chi2 of this special state with this hit and this reco track. Will only be set after fitting state.
Definition: CKFState.h:167
Belle2::CKFState::getMeasuredStateOnPlane
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlane() const
Get the mSoP if already set during extrapolation (or fitting)
Definition: CKFState.h:103
Belle2::CKFState::m_stateCache
stateCache m_stateCache
Cache the most important data of this state for better runtime performance.
Definition: CKFState.h:158
Belle2::CKFState
State object to store one step in the CKF algorithm together with its parent (the state before),...
Definition: CKFState.h:39
Belle2::CKFState::mSoPSet
bool mSoPSet() const
Is the mSoP already set? (= state was already extrapolated)
Definition: CKFState.h:116
Belle2::CKFState::m_measuredStateOnPlane
genfit::MeasuredStateOnPlane m_measuredStateOnPlane
MSoP after advancing. Is undetermined before extrapolating!
Definition: CKFState.h:173
Belle2::CKFState::Hit
AHit Hit
Copy the class of the hits.
Definition: CKFState.h:44
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::CKFState::stateCache::localNormalizedu
double localNormalizedu
Local normalized uCoordinate of this state, only set if based on SpacePoint.
Definition: CKFState.h:151
Belle2::CKFState::stateCache::ladder
unsigned short ladder
Ladder this state is based on (only use for SpacePoint based states)
Definition: CKFState.h:143
Belle2::CKFState::m_hasMSoP
bool m_hasMSoP
Flag, if this state has a valid mSoP.
Definition: CKFState.h:171
Belle2::CKFState::operator=
CKFState & operator=(const CKFState &)=delete
No copy constructor.
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CKFState::m_isFitted
bool m_isFitted
Flag, if this state was already fitted.
Definition: CKFState.h:169
Belle2::CKFState::stateCache::geoLayer
unsigned short geoLayer
Geometrical Layer this state is based on. Will be set to the SVD layer number if it's a state based o...
Definition: CKFState.h:141
Belle2::TrackFindingCDC::AutomatonCell
Cell used by the cellular automata.
Definition: AutomatonCell.h:39
Belle2::CKFState::Seed
ASeed Seed
Copy the class of the seed track.
Definition: CKFState.h:42
Belle2::CKFState::stateCache::phi
double phi
Phi if this state (from SpacePoint or RecoTrack)
Definition: CKFState.h:147
Belle2::CKFState::setMeasuredStateOnPlane
void setMeasuredStateOnPlane(const genfit::MeasuredStateOnPlane &mSoP)
Set the mSoP.
Definition: CKFState.h:96
Belle2::CKFState::stateCache::sensorID
VxdID sensorID
VxdID of this state, only set if based on SpacePoint.
Definition: CKFState.h:139
Belle2::CKFState::getChi2
double getChi2() const
Return the chi2 set during fitting. Is only valid after fitting.
Definition: CKFState.h:82
Belle2::CKFState::m_automatonCell
TrackFindingCDC::AutomatonCell m_automatonCell
Memory for the automaton cell.
Definition: CKFState.h:175
Belle2::CKFState::getHit
const Hit * getHit() const
Return the SP this state is related to. May be nullptr.
Definition: CKFState.h:76
Belle2::CKFState::isFitted
bool isFitted() const
Check if state was already fitted.
Definition: CKFState.h:110
Belle2::CKFState::m_hit
const Hit * m_hit
The hit object this state is attached to.
Definition: CKFState.h:165
Belle2::CKFState::m_seed
const Seed * m_seed
The seed this state is related with.
Definition: CKFState.h:163
Belle2::CKFState::stateCache
Cache containing the most important information of this state which will often be needed.
Definition: CKFState.h:135
Belle2::CKFState::getSeed
const Seed * getSeed() const
Return the track this state is related to.
Definition: CKFState.h:70
Belle2::Hit
Structure to hold some of the calpulse data.
Definition: TOPTimeBaseCalibratorModule.h:40