Belle II Software  release-08-01-10
CDCCKFState.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 <genfit/MeasuredStateOnPlane.h>
11 #include <tracking/dataobjects/RecoTrack.h>
12 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
13 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
14 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
15 #include <tracking/trackFindingCDC/topology/CDCWire.h>
16 #include <tracking/trackFindingCDC/numerics/ERightLeft.h>
17 
18 namespace Belle2 {
25  class CDCCKFState {
26  public:
28  CDCCKFState(const RecoTrack* seed, const genfit::MeasuredStateOnPlane& trackState) :
29  m_seed(seed), m_trackState(trackState) {}
30 
32  explicit CDCCKFState(const TrackFindingCDC::CDCWireHit* wireHit) : m_cdcWireHit(wireHit) {}
33 
36  {
37  B2ASSERT("State does not represent a wire hit", static_cast<bool>(m_cdcWireHit));
38  return *m_cdcWireHit;
39  }
40 
42  const RecoTrack* getSeed() const
43  {
44  B2ASSERT("State does not represent a seed", static_cast<bool>(m_seed));
45  return *m_seed;
46  }
47 
49  const RecoTrack* getMCRecoTrack(const std::string& mcRecoTrackStoreArrayName = "MCRecoTracks") const
50  {
51  const RecoTrack* seed = getSeed();
52  return seed->getRelated<RecoTrack>(mcRecoTrackStoreArrayName);
53  }
54 
56  bool isSeed() const
57  {
58  return static_cast<bool>(m_seed);
59  }
60 
63  {
64  B2ASSERT("State does not have a track state (yet)", static_cast<bool>(m_trackState));
65  return *m_trackState;
66  }
67 
70  {
71  m_trackState = trackState;
72  }
73 
76  {
77  m_rl = rl;
78  }
79 
82  {
83  B2ASSERT("LR info is not present yet", m_rl != TrackFindingCDC::ERightLeft::c_Unknown);
84  return m_rl;
85  }
86 
88  void setArcLength(double arcLength)
89  {
90  m_arcLength = arcLength;
91  }
92 
94  double getArcLength() const
95  {
96  return m_arcLength;
97  }
98 
100  void setHitDistance(double hitDistance)
101  {
102  m_hitDistance = hitDistance;
103  }
104 
106  double getHitDistance() const
107  {
108  return m_hitDistance;
109  }
110 
112  void setWeight(double weight)
113  {
114  m_weight = weight;
115  }
116 
118  double getWeight() const
119  {
120  return m_weight;
121  }
122 
124  void setChi2(double chi2)
125  {
126  m_chi2 = chi2;
127  }
128 
130  double getChi2() const
131  {
132  return m_chi2;
133  }
134 
136  void setReconstructedZ(double reconstructedZ)
137  {
138  m_reconstructedZ = reconstructedZ;
139  }
140 
142  double getReconstructedZ() const
143  {
144  return m_reconstructedZ;
145  }
146 
149  {
150  const auto& trackState = getTrackState();
151  const TrackFindingCDC::Vector3D trackPosition(trackState.getPos());
152  const TrackFindingCDC::Vector3D trackMomentum(trackState.getMom());
153  return TrackFindingCDC::CDCTrajectory3D(trackPosition, trackState.getTime(),
154  trackMomentum, trackState.getCharge());
155  }
156 
157  private:
159  std::optional<const RecoTrack*> m_seed;
161  std::optional<const TrackFindingCDC::CDCWireHit*> m_cdcWireHit;
162 
164  std::optional<genfit::MeasuredStateOnPlane> m_trackState;
165 
167  double m_arcLength = 0;
168 
170  double m_hitDistance = 0;
171 
173  double m_weight = 0;
174 
176  double m_chi2 = 0;
177 
179  double m_reconstructedZ = 0;
180 
182  TrackFindingCDC::ERightLeft m_rl = TrackFindingCDC::ERightLeft::c_Unknown;
183  };
184 
186  std::ostream& operator<<(std::ostream& output, const CDCCKFState& state);
188 }
Define states for CKF algorithm, which can be seed track or CDC wire hit.
Definition: CDCCKFState.h:25
double getWeight() const
Get state weight.
Definition: CDCCKFState.h:118
const genfit::MeasuredStateOnPlane & getTrackState() const
Get genfit track state (but first check if already present)
Definition: CDCCKFState.h:62
void setRLinfo(const TrackFindingCDC::ERightLeft &rl)
Set right-left info for the hit.
Definition: CDCCKFState.h:75
void setTrackState(const genfit::MeasuredStateOnPlane &trackState)
Store genfit Measured state on plane.
Definition: CDCCKFState.h:69
void setHitDistance(double hitDistance)
Set hit distance to the trajectory.
Definition: CDCCKFState.h:100
std::optional< const RecoTrack * > m_seed
(optional) pointer to the seed track
Definition: CDCCKFState.h:159
double m_reconstructedZ
reconstructed Z coordinate
Definition: CDCCKFState.h:179
const RecoTrack * getSeed() const
Get RecoTrack seed corresponding to the state.
Definition: CDCCKFState.h:42
double getHitDistance() const
Return hit distance to the trajectory.
Definition: CDCCKFState.h:106
double getChi2() const
Get state chi2.
Definition: CDCCKFState.h:130
TrackFindingCDC::ERightLeft getRLinfo() const
Return right-left info (check if present first)
Definition: CDCCKFState.h:81
std::optional< const TrackFindingCDC::CDCWireHit * > m_cdcWireHit
(optional) pointer to the wire hit
Definition: CDCCKFState.h:161
double m_weight
state weight
Definition: CDCCKFState.h:173
double m_chi2
state chi2 (using genfit extrapolation)
Definition: CDCCKFState.h:176
double getArcLength() const
Return the arc-length along the tracjectory to the hit.
Definition: CDCCKFState.h:94
void setReconstructedZ(double reconstructedZ)
Set state Z information.
Definition: CDCCKFState.h:136
void setArcLength(double arcLength)
Set the arc-length along the tracjectory to the hit.
Definition: CDCCKFState.h:88
void setChi2(double chi2)
Set set chi2.
Definition: CDCCKFState.h:124
TrackFindingCDC::ERightLeft m_rl
Store if the track is on the right or left side of the hit.
Definition: CDCCKFState.h:182
double getReconstructedZ() const
Get state Z information.
Definition: CDCCKFState.h:142
CDCCKFState(const TrackFindingCDC::CDCWireHit *wireHit)
constructor from the CDC wireHit
Definition: CDCCKFState.h:32
void setWeight(double weight)
Set state weight.
Definition: CDCCKFState.h:112
CDCCKFState(const RecoTrack *seed, const genfit::MeasuredStateOnPlane &trackState)
constructor from the seed recoTrack and genfit trackState
Definition: CDCCKFState.h:28
TrackFindingCDC::CDCTrajectory3D getTrajectory() const
Helper method to get trajectory from the trackState.
Definition: CDCCKFState.h:148
double m_arcLength
arc length along the trajectory to the hit
Definition: CDCCKFState.h:167
const RecoTrack * getMCRecoTrack(const std::string &mcRecoTrackStoreArrayName="MCRecoTracks") const
Match seed to the MC track, return it. Works for seed-states only.
Definition: CDCCKFState.h:49
double m_hitDistance
distance from the trajectory to the hit
Definition: CDCCKFState.h:170
bool isSeed() const
Returns true if the state corresponds to the seed track.
Definition: CDCCKFState.h:56
const TrackFindingCDC::CDCWireHit * getWireHit() const
Get CDCWireHit corresponding to the state.
Definition: CDCCKFState.h:35
std::optional< genfit::MeasuredStateOnPlane > m_trackState
(optional) genfit MeasuredStateOnPlane
Definition: CDCCKFState.h:164
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
Particle full three dimensional trajectory.
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
A three dimensional vector.
Definition: Vector3D.h:33
#StateOnPlane with additional covariance matrix.
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:25
Abstract base class for different kinds of events.