Belle II Software development
CKFState.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#pragma once
9
10#include <tracking/trackFindingCDC/ca/AutomatonCell.h>
11
12#include <genfit/MeasuredStateOnPlane.h>
13#include <framework/logging/Logger.h>
14
15#include <vxd/dataobjects/VxdID.h>
16
17namespace Belle2 {
28 template<class ASeed, class AHit>
29 class CKFState {
30 public:
32 using Seed = ASeed;
34 using Hit = AHit;
35
37 CKFState() = default;
39 CKFState(CKFState&&) = default;
41 CKFState(const CKFState&) = delete;
43 CKFState& operator=(const CKFState&) = delete;
47 ~CKFState() = default;
48
50 explicit CKFState(const Seed* seed) : m_seed(seed)
51 {
52 }
53
55 explicit CKFState(const Hit* hit) : m_hit(hit)
56 {
57 }
58
60 const Seed* getSeed() const
61 {
62 return m_seed;
63 }
64
66 const Hit* getHit() const
67 {
68 return m_hit;
69 }
70
72 double getChi2() const
73 {
74 B2ASSERT("Chi2 is not set", isFitted());
75 return m_chi2;
76 }
77
79 void setChi2(double chi2)
80 {
81 m_chi2 = chi2;
82 m_isFitted = true;
83 }
84
86 void setMeasuredStateOnPlane(const genfit::MeasuredStateOnPlane& mSoP)
87 {
89 m_hasMSoP = true;
90 }
91
93 const genfit::MeasuredStateOnPlane& getMeasuredStateOnPlane() const
94 {
95 B2ASSERT("You are asking for an invalid variable!", mSoPSet());
97 }
98
100 bool isFitted() const
101 {
102 return m_isFitted;
103 }
104
106 bool mSoPSet() const
107 {
108 return m_hasMSoP;
109 }
110
112 void reset()
113 {
114 m_isFitted = false;
115 m_hasMSoP = false;
116 }
117
120 {
121 return m_automatonCell;
122 }
123
125 struct stateCache {
127 float ptSeed = 0.;
129 float thetaSeed = 0.;
131 float sensorCenterPhi = std::numeric_limits<float>::quiet_NaN();
133 float phi = std::numeric_limits<float>::quiet_NaN();
135 float theta = std::numeric_limits<float>::quiet_NaN();
137 float perp = std::numeric_limits<float>::quiet_NaN();
139 float localNormalizedu = std::numeric_limits<float>::quiet_NaN();
141 float localNormalizedv = std::numeric_limits<float>::quiet_NaN();
143 unsigned short geoLayer = std::numeric_limits<unsigned short>::quiet_NaN();
145 unsigned short ladder = std::numeric_limits<unsigned short>::quiet_NaN();
149 bool isHitState = false;
150 };
151
152 protected:
155
156
157 private:
159 const Seed* m_seed = nullptr;
161 const Hit* m_hit = nullptr;
163 double m_chi2 = 0;
165 genfit::MeasuredStateOnPlane m_measuredStateOnPlane;
169 bool m_isFitted = false;
171 bool m_hasMSoP = false;
172 };
174}
State object to store one step in the CKF algorithm together with its parent (the state before),...
Definition: CKFState.h:29
CKFState()=default
Default constructor needed for STL containers.
AHit Hit
Copy the class of the hits.
Definition: CKFState.h:34
CKFState(const Hit *hit)
Initialize the state as non-root with a related hit (and with a seed)
Definition: CKFState.h:55
TrackFindingCDC::AutomatonCell m_automatonCell
Memory for the automaton cell.
Definition: CKFState.h:167
CKFState(CKFState &&)=default
Move constructor needed for STL containers.
CKFState(const CKFState &)=delete
No copy constructor.
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlane() const
Get the mSoP if already set during extrapolation (or fitting)
Definition: CKFState.h:93
const Hit * getHit() const
Return the SP this state is related to. May be nullptr.
Definition: CKFState.h:66
const Seed * m_seed
The seed this state is related with.
Definition: CKFState.h:159
double getChi2() const
Return the chi2 set during fitting. Is only valid after fitting.
Definition: CKFState.h:72
CKFState & operator=(CKFState &&)=default
Move assignment constructor.
CKFState & operator=(const CKFState &)=delete
No copy constructor.
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:163
bool isFitted() const
Check if state was already fitted.
Definition: CKFState.h:100
void setMeasuredStateOnPlane(const genfit::MeasuredStateOnPlane &mSoP)
Set the mSoP.
Definition: CKFState.h:86
void setChi2(double chi2)
Set the chi2 of this state during fitting.
Definition: CKFState.h:79
CKFState(const Seed *seed)
Initialize the state as a root without a related hit (but with a seed)
Definition: CKFState.h:50
bool m_hasMSoP
Flag, if this state has a valid mSoP.
Definition: CKFState.h:171
const Hit * m_hit
The hit object this state is attached to.
Definition: CKFState.h:161
stateCache m_stateCache
Cache the most important data of this state for better runtime performance.
Definition: CKFState.h:154
TrackFindingCDC::AutomatonCell & getAutomatonCell()
Getter for the automaton cell.
Definition: CKFState.h:119
ASeed Seed
Copy the class of the seed track.
Definition: CKFState.h:32
bool mSoPSet() const
Is the mSoP already set? (= state was already extrapolated)
Definition: CKFState.h:106
genfit::MeasuredStateOnPlane m_measuredStateOnPlane
MSoP after advancing. Is undetermined before extrapolating!
Definition: CKFState.h:165
bool m_isFitted
Flag, if this state was already fitted.
Definition: CKFState.h:169
~CKFState()=default
Destructor.
void reset()
Reset the state to be seen as "new".
Definition: CKFState.h:112
const Seed * getSeed() const
Return the track this state is related to.
Definition: CKFState.h:60
Cell used by the cellular automata.
Definition: AutomatonCell.h:29
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
Abstract base class for different kinds of events.
Cache containing the most important information of this state which will often be needed.
Definition: CKFState.h:125
float sensorCenterPhi
Phi of the sensor this state is based on, only set if based on SpacePoint.
Definition: CKFState.h:131
float ptSeed
getPtOfSeed (if seed state)
Definition: CKFState.h:127
float localNormalizedu
Local normalized uCoordinate of this state, only set if based on SpacePoint.
Definition: CKFState.h:139
float thetaSeed
getThetaOfSeed (if seed state)
Definition: CKFState.h:129
bool isHitState
Is this state based on a hit (=SpacePoint) or a seed (=RecoTrack)
Definition: CKFState.h:149
VxdID sensorID
VxdID of this state, only set if based on SpacePoint.
Definition: CKFState.h:147
float perp
Perp of this state (from SpacePoint or RecoTrack)
Definition: CKFState.h:137
unsigned short ladder
Ladder this state is based on (only use for SpacePoint based states)
Definition: CKFState.h:145
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:143
float theta
Theta if this state (from SpacePoint or RecoTrack)
Definition: CKFState.h:135
float phi
Phi if this state (from SpacePoint or RecoTrack)
Definition: CKFState.h:133
float localNormalizedv
Local normalized vCoordinate of this state, only set if based on SpacePoint.
Definition: CKFState.h:141