Belle II Software  release-06-02-00
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 #include <boost/optional.hpp>
19 
20 namespace Belle2 {
27  class CDCCKFState {
28  public:
30  CDCCKFState(const RecoTrack* seed, const genfit::MeasuredStateOnPlane& trackState) :
31  m_seed(seed), m_trackState(trackState) {}
32 
34  explicit CDCCKFState(const TrackFindingCDC::CDCWireHit* wireHit) : m_cdcWireHit(wireHit) {}
35 
38  {
39  B2ASSERT("State does not represent a wire hit", static_cast<bool>(m_cdcWireHit));
40  return *m_cdcWireHit;
41  }
42 
44  const RecoTrack* getSeed() const
45  {
46  B2ASSERT("State does not represent a seed", static_cast<bool>(m_seed));
47  return *m_seed;
48  }
49 
51  const RecoTrack* getMCRecoTrack(const std::string& mcRecoTrackStoreArrayName = "MCRecoTracks") const
52  {
53  const RecoTrack* seed = getSeed();
54  return seed->getRelated<RecoTrack>(mcRecoTrackStoreArrayName);
55  }
56 
58  bool isSeed() const
59  {
60  return static_cast<bool>(m_seed);
61  }
62 
65  {
66  B2ASSERT("State does not have a track state (yet)", static_cast<bool>(m_trackState));
67  return *m_trackState;
68  }
69 
72  {
73  m_trackState = trackState;
74  }
75 
78  {
79  m_rl = rl;
80  }
81 
84  {
85  B2ASSERT("LR info is not present yet", m_rl != TrackFindingCDC::ERightLeft::c_Unknown);
86  return m_rl;
87  }
88 
90  void setArcLength(double arcLength)
91  {
92  m_arcLength = arcLength;
93  }
94 
96  double getArcLength() const
97  {
98  return m_arcLength;
99  }
100 
102  void setHitDistance(double hitDistance)
103  {
104  m_hitDistance = hitDistance;
105  }
106 
108  double getHitDistance() const
109  {
110  return m_hitDistance;
111  }
112 
114  void setWeight(double weight)
115  {
116  m_weight = weight;
117  }
118 
120  double getWeight() const
121  {
122  return m_weight;
123  }
124 
126  void setChi2(double chi2)
127  {
128  m_chi2 = chi2;
129  }
130 
132  double getChi2() const
133  {
134  return m_chi2;
135  }
136 
138  void setReconstructedZ(double reconstructedZ)
139  {
140  m_reconstructedZ = reconstructedZ;
141  }
142 
144  double getReconstructedZ() const
145  {
146  return m_reconstructedZ;
147  }
148 
151  {
152  const auto& trackState = getTrackState();
153  const TrackFindingCDC::Vector3D trackPosition(trackState.getPos());
154  const TrackFindingCDC::Vector3D trackMomentum(trackState.getMom());
155  return TrackFindingCDC::CDCTrajectory3D(trackPosition, trackState.getTime(),
156  trackMomentum, trackState.getCharge());
157  }
158 
159  private:
161  boost::optional<const RecoTrack*> m_seed;
163  boost::optional<const TrackFindingCDC::CDCWireHit*> m_cdcWireHit;
164 
166  boost::optional<genfit::MeasuredStateOnPlane> m_trackState;
167 
169  double m_arcLength = 0;
170 
172  double m_hitDistance = 0;
173 
175  double m_weight = 0;
176 
178  double m_chi2 = 0;
179 
181  double m_reconstructedZ = 0;
182 
184  TrackFindingCDC::ERightLeft m_rl = TrackFindingCDC::ERightLeft::c_Unknown;
185  };
186 
188  std::ostream& operator<<(std::ostream& output, const CDCCKFState& state);
190 }
Define states for CKF algorithm, which can be seed track or CDC wire hit.
Definition: CDCCKFState.h:27
double getWeight() const
Get state weight.
Definition: CDCCKFState.h:120
const genfit::MeasuredStateOnPlane & getTrackState() const
Get genfit track state (but first check if already present)
Definition: CDCCKFState.h:64
void setRLinfo(const TrackFindingCDC::ERightLeft &rl)
Set right-left info for the hit.
Definition: CDCCKFState.h:77
void setTrackState(const genfit::MeasuredStateOnPlane &trackState)
Store genfit Measured state on plane.
Definition: CDCCKFState.h:71
void setHitDistance(double hitDistance)
Set hit distance to the trajectory.
Definition: CDCCKFState.h:102
boost::optional< genfit::MeasuredStateOnPlane > m_trackState
(optional) genfit MeasuredStateOnPlane
Definition: CDCCKFState.h:166
double m_reconstructedZ
reconstructed Z coordinate
Definition: CDCCKFState.h:181
const RecoTrack * getSeed() const
Get RecoTrack seed corresponding to the state.
Definition: CDCCKFState.h:44
double getHitDistance() const
Return hit distance to the trajectory.
Definition: CDCCKFState.h:108
double getChi2() const
Get state chi2.
Definition: CDCCKFState.h:132
TrackFindingCDC::ERightLeft getRLinfo() const
Return right-left info (check if present first)
Definition: CDCCKFState.h:83
double m_weight
state weight
Definition: CDCCKFState.h:175
double m_chi2
state chi2 (using genfit extrapolation)
Definition: CDCCKFState.h:178
double getArcLength() const
Return the arc-length along the tracjectory to the hit.
Definition: CDCCKFState.h:96
void setReconstructedZ(double reconstructedZ)
Set state Z information.
Definition: CDCCKFState.h:138
void setArcLength(double arcLength)
Set the arc-length along the tracjectory to the hit.
Definition: CDCCKFState.h:90
void setChi2(double chi2)
Set set chi2.
Definition: CDCCKFState.h:126
TrackFindingCDC::ERightLeft m_rl
Store if the track is on the right or left side of the hit.
Definition: CDCCKFState.h:184
double getReconstructedZ() const
Get state Z information.
Definition: CDCCKFState.h:144
CDCCKFState(const TrackFindingCDC::CDCWireHit *wireHit)
constructor from the CDC wireHit
Definition: CDCCKFState.h:34
boost::optional< const TrackFindingCDC::CDCWireHit * > m_cdcWireHit
(optional) pointer to the wire hit
Definition: CDCCKFState.h:163
void setWeight(double weight)
Set state weight.
Definition: CDCCKFState.h:114
CDCCKFState(const RecoTrack *seed, const genfit::MeasuredStateOnPlane &trackState)
constructor from the seed recoTrack and genfit trackState
Definition: CDCCKFState.h:30
TrackFindingCDC::CDCTrajectory3D getTrajectory() const
Helper method to get trajectory from the trackState.
Definition: CDCCKFState.h:150
double m_arcLength
arc length along the trajectory to the hit
Definition: CDCCKFState.h:169
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:51
double m_hitDistance
distance from the trajectory to the hit
Definition: CDCCKFState.h:172
bool isSeed() const
Returns true if the state corresponds to the seed track.
Definition: CDCCKFState.h:58
boost::optional< const RecoTrack * > m_seed
(optional) pointer to the seed track
Definition: CDCCKFState.h:161
const TrackFindingCDC::CDCWireHit * getWireHit() const
Get CDCWireHit corresponding to the state.
Definition: CDCCKFState.h:37
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:76
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:32
#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.