Belle II Software  release-05-01-25
CDCCKFState.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 *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <genfit/MeasuredStateOnPlane.h>
13 #include <tracking/dataobjects/RecoTrack.h>
14 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
15 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
16 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
17 #include <tracking/trackFindingCDC/topology/CDCWire.h>
18 #include <tracking/trackFindingCDC/numerics/ERightLeft.h>
19 
20 #include <boost/optional.hpp>
21 
22 namespace Belle2 {
28  class CDCCKFState {
30  public:
32  CDCCKFState(const RecoTrack* seed, const genfit::MeasuredStateOnPlane& trackState) :
33  m_seed(seed), m_trackState(trackState) {}
34 
36  explicit CDCCKFState(const TrackFindingCDC::CDCWireHit* wireHit) : m_cdcWireHit(wireHit) {}
37 
40  {
41  B2ASSERT("State does not represent a wire hit", static_cast<bool>(m_cdcWireHit));
42  return *m_cdcWireHit;
43  }
44 
46  const RecoTrack* getSeed() const
47  {
48  B2ASSERT("State does not represent a seed", static_cast<bool>(m_seed));
49  return *m_seed;
50  }
51 
53  const RecoTrack* getMCRecoTrack(const std::string& mcRecoTrackStoreArrayName = "MCRecoTracks") const
54  {
55  const RecoTrack* seed = getSeed();
56  return seed->getRelated<RecoTrack>(mcRecoTrackStoreArrayName);
57  }
58 
60  bool isSeed() const
61  {
62  return static_cast<bool>(m_seed);
63  }
64 
67  {
68  B2ASSERT("State does not have a track state (yet)", static_cast<bool>(m_trackState));
69  return *m_trackState;
70  }
71 
73  void setTrackState(const genfit::MeasuredStateOnPlane& trackState)
74  {
75  m_trackState = trackState;
76  }
77 
80  {
81  m_rl = rl;
82  }
83 
86  {
87  B2ASSERT("LR info is not present yet", m_rl != TrackFindingCDC::ERightLeft::c_Unknown);
88  return m_rl;
89  }
90 
92  void setArcLength(double arcLength)
93  {
94  m_arcLength = arcLength;
95  }
96 
98  double getArcLength() const
99  {
100  return m_arcLength;
101  }
102 
104  void setHitDistance(double hitDistance)
105  {
106  m_hitDistance = hitDistance;
107  }
108 
110  double getHitDistance() const
111  {
113  }
114 
116  void setWeight(double weight)
117  {
118  m_weight = weight;
119  }
120 
122  double getWeight() const
123  {
124  return m_weight;
125  }
126 
128  void setChi2(double chi2)
129  {
130  m_chi2 = chi2;
131  }
132 
134  double getChi2() const
135  {
136  return m_chi2;
137  }
138 
140  void setReconstructedZ(double reconstructedZ)
141  {
142  m_reconstructedZ = reconstructedZ;
143  }
144 
146  double getReconstructedZ() const
147  {
149  }
150 
153  {
154  const auto& trackState = getTrackState();
155  const TrackFindingCDC::Vector3D trackPosition(trackState.getPos());
156  const TrackFindingCDC::Vector3D trackMomentum(trackState.getMom());
157  return TrackFindingCDC::CDCTrajectory3D(trackPosition, trackState.getTime(),
158  trackMomentum, trackState.getCharge());
159  }
160 
161  private:
163  boost::optional<const RecoTrack*> m_seed;
165  boost::optional<const TrackFindingCDC::CDCWireHit*> m_cdcWireHit;
166 
168  boost::optional<genfit::MeasuredStateOnPlane> m_trackState;
169 
171  double m_arcLength = 0;
172 
174  double m_hitDistance = 0;
175 
177  double m_weight = 0;
178 
180  double m_chi2 = 0;
181 
183  double m_reconstructedZ = 0;
184 
186  TrackFindingCDC::ERightLeft m_rl = TrackFindingCDC::ERightLeft::c_Unknown;
187  };
188 
190  std::ostream& operator<<(std::ostream& output, const CDCCKFState& state);
192 }
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::CDCCKFState::getSeed
const RecoTrack * getSeed() const
Get RecoTrack seed corresponding to the state.
Definition: CDCCKFState.h:54
Belle2::CDCCKFState::getTrajectory
TrackFindingCDC::CDCTrajectory3D getTrajectory() const
Helper method to get trajectory from the trackState.
Definition: CDCCKFState.h:160
Belle2::CDCCKFState::m_rl
TrackFindingCDC::ERightLeft m_rl
Store if the track is on the right or left side of the hit.
Definition: CDCCKFState.h:194
Belle2::CDCCKFState::setRLinfo
void setRLinfo(const TrackFindingCDC::ERightLeft &rl)
Set right-left info for the hit.
Definition: CDCCKFState.h:87
Belle2::CDCCKFState::setWeight
void setWeight(double weight)
Set state weight.
Definition: CDCCKFState.h:124
Belle2::CDCCKFState::m_cdcWireHit
boost::optional< const TrackFindingCDC::CDCWireHit * > m_cdcWireHit
(optional) pointer to the wire hit
Definition: CDCCKFState.h:173
Belle2::CDCCKFState::m_weight
double m_weight
state weight
Definition: CDCCKFState.h:185
Belle2::CDCCKFState::getWeight
double getWeight() const
Get state weight.
Definition: CDCCKFState.h:130
Belle2::CDCCKFState::m_chi2
double m_chi2
state chi2 (using genfit extrapolation)
Definition: CDCCKFState.h:188
Belle2::CDCCKFState::getArcLength
double getArcLength() const
Return the arc-length along the tracjectory to the hit.
Definition: CDCCKFState.h:106
Belle2::CDCCKFState::setTrackState
void setTrackState(const genfit::MeasuredStateOnPlane &trackState)
Store genfit Measured state on plane.
Definition: CDCCKFState.h:81
Belle2::CDCCKFState::m_seed
boost::optional< const RecoTrack * > m_seed
(optional) pointer to the seed track
Definition: CDCCKFState.h:171
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::CDCCKFState::setReconstructedZ
void setReconstructedZ(double reconstructedZ)
Set state Z information.
Definition: CDCCKFState.h:148
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CDCCKFState::getRLinfo
TrackFindingCDC::ERightLeft getRLinfo() const
Return right-left info (check if present first)
Definition: CDCCKFState.h:93
Belle2::CDCCKFState::getChi2
double getChi2() const
Get state chi2.
Definition: CDCCKFState.h:142
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::CDCCKFState::setChi2
void setChi2(double chi2)
Set set chi2.
Definition: CDCCKFState.h:136
Belle2::CDCCKFState::setArcLength
void setArcLength(double arcLength)
Set the arc-length along the tracjectory to the hit.
Definition: CDCCKFState.h:100
Belle2::TrackFindingCDC::NRightLeft::ERightLeft
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:35
Belle2::CDCCKFState::getTrackState
const genfit::MeasuredStateOnPlane & getTrackState() const
Get genfit track state (but first check if already present)
Definition: CDCCKFState.h:74
Belle2::CDCCKFState::setHitDistance
void setHitDistance(double hitDistance)
Set hit distance to the trajectory.
Definition: CDCCKFState.h:112
Belle2::CDCCKFState::getHitDistance
double getHitDistance() const
Return hit distance to the trajectory.
Definition: CDCCKFState.h:118
Belle2::CDCCKFState::m_trackState
boost::optional< genfit::MeasuredStateOnPlane > m_trackState
(optional) genfit MeasuredStateOnPlane
Definition: CDCCKFState.h:176
Belle2::CDCCKFState::m_arcLength
double m_arcLength
arc length along the trajectory to the hit
Definition: CDCCKFState.h:179
Belle2::CDCCKFState::getReconstructedZ
double getReconstructedZ() const
Get state Z information.
Definition: CDCCKFState.h:154
Belle2::CDCCKFState::getMCRecoTrack
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:61
Belle2::CDCCKFState
Define states for CKF algorithm, which can be seed track or CDC wire hit.
Definition: CDCCKFState.h:37
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65
Belle2::CDCCKFState::m_reconstructedZ
double m_reconstructedZ
reconstructed Z coordinate
Definition: CDCCKFState.h:191
Belle2::CDCCKFState::isSeed
bool isSeed() const
Returns true if the state corresponds to the seed track.
Definition: CDCCKFState.h:68
Belle2::TrackFindingCDC::CDCTrajectory3D
Particle full three dimensional trajectory.
Definition: CDCTrajectory3D.h:47
Belle2::CDCCKFState::getWireHit
const TrackFindingCDC::CDCWireHit * getWireHit() const
Get CDCWireHit corresponding to the state.
Definition: CDCCKFState.h:47
Belle2::CDCCKFState::m_hitDistance
double m_hitDistance
distance from the trajectory to the hit
Definition: CDCCKFState.h:182
Belle2::CDCCKFState::CDCCKFState
CDCCKFState(const RecoTrack *seed, const genfit::MeasuredStateOnPlane &trackState)
constructor from the seed recoTrack and genfit trackState
Definition: CDCCKFState.h:40