Belle II Software development
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/trackingUtilities/eventdata/trajectories/CDCTrajectory3D.h>
13#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
14#include <cdc/topology/CDCWire.h>
15#include <tracking/trackingUtilities/numerics/ERightLeft.h>
16
17#include <Math/Vector3D.h>
18
19namespace Belle2 {
24
27 public:
29 CDCCKFState(const RecoTrack* seed, const genfit::MeasuredStateOnPlane& trackState) :
30 m_seed(seed), m_trackState(trackState) {}
31
33 explicit CDCCKFState(const TrackingUtilities::CDCWireHit* wireHit) : m_cdcWireHit(wireHit) {}
34
37 {
38 B2ASSERT("State does not represent a wire hit", static_cast<bool>(m_cdcWireHit));
39 return *m_cdcWireHit;
40 }
41
43 const RecoTrack* getSeed() const
44 {
45 B2ASSERT("State does not represent a seed", static_cast<bool>(m_seed));
46 return *m_seed;
47 }
48
50 const RecoTrack* getMCRecoTrack(const std::string& mcRecoTrackStoreArrayName = "MCRecoTracks") const
51 {
52 const RecoTrack* seed = getSeed();
53 return seed->getRelated<RecoTrack>(mcRecoTrackStoreArrayName);
54 }
55
57 bool isSeed() const
58 {
59 return static_cast<bool>(m_seed);
60 }
61
63 const genfit::MeasuredStateOnPlane& getTrackState() const
64 {
65 B2ASSERT("State does not have a track state (yet)", static_cast<bool>(m_trackState));
66 return *m_trackState;
67 }
68
70 void setTrackState(const genfit::MeasuredStateOnPlane& trackState)
71 {
72 m_trackState = trackState;
73 }
74
76 void setRLinfo(const TrackingUtilities::ERightLeft& rl)
77 {
78 m_rl = rl;
79 }
80
82 TrackingUtilities::ERightLeft getRLinfo() const
83 {
84 B2ASSERT("LR info is not present yet", m_rl != TrackingUtilities::ERightLeft::c_Unknown);
85 return m_rl;
86 }
87
89 void setArcLength(double arcLength)
90 {
91 m_arcLength = arcLength;
92 }
93
95 double getArcLength() const
96 {
97 return m_arcLength;
98 }
99
101 void setHitDistance(double hitDistance)
102 {
103 m_hitDistance = hitDistance;
104 }
105
107 double getHitDistance() const
108 {
109 return m_hitDistance;
110 }
111
113 void setWeight(double weight)
114 {
115 m_weight = weight;
116 }
117
119 double getWeight() const
120 {
121 return m_weight;
122 }
123
125 void setChi2(double chi2)
126 {
127 m_chi2 = chi2;
128 }
129
131 double getChi2() const
132 {
133 return m_chi2;
134 }
135
137 void setReconstructedZ(double reconstructedZ)
138 {
139 m_reconstructedZ = reconstructedZ;
140 }
141
143 double getReconstructedZ() const
144 {
145 return m_reconstructedZ;
146 }
147
150 {
151 const auto& trackState = getTrackState();
152 const ROOT::Math::XYZVector trackPosition(trackState.getPos());
153 const ROOT::Math::XYZVector trackMomentum(trackState.getMom());
154 return TrackingUtilities::CDCTrajectory3D(trackPosition, trackState.getTime(),
155 trackMomentum, trackState.getCharge());
156 }
157
158 private:
160 std::optional<const RecoTrack*> m_seed;
162 std::optional<const TrackingUtilities::CDCWireHit*> m_cdcWireHit;
163
165 std::optional<genfit::MeasuredStateOnPlane> m_trackState;
166
168 double m_arcLength = 0;
169
171 double m_hitDistance = 0;
172
174 double m_weight = 0;
175
177 double m_chi2 = 0;
178
181
183 TrackingUtilities::ERightLeft m_rl = TrackingUtilities::ERightLeft::c_Unknown;
184 };
185
187 std::ostream& operator<<(std::ostream& output, const CDCCKFState& state);
189}
Define states for CKF algorithm, which can be seed track or CDC wire hit.
Definition CDCCKFState.h:26
double getWeight() const
Get state weight.
void setTrackState(const genfit::MeasuredStateOnPlane &trackState)
Store genfit Measured state on plane.
Definition CDCCKFState.h:70
void setHitDistance(double hitDistance)
Set hit distance to the trajectory.
std::optional< const RecoTrack * > m_seed
(optional) pointer to the seed track
void setRLinfo(const TrackingUtilities::ERightLeft &rl)
Set right-left info for the hit.
Definition CDCCKFState.h:76
double m_reconstructedZ
reconstructed Z coordinate
double getHitDistance() const
Return hit distance to the trajectory.
std::optional< const TrackingUtilities::CDCWireHit * > m_cdcWireHit
(optional) pointer to the wire hit
double getChi2() const
Get state chi2.
const RecoTrack * getSeed() const
Get RecoTrack seed corresponding to the state.
Definition CDCCKFState.h:43
TrackingUtilities::ERightLeft getRLinfo() const
Return right-left info (check if present first)
Definition CDCCKFState.h:82
double m_weight
state weight
double m_chi2
state chi2 (using genfit extrapolation)
double getArcLength() const
Return the arc-length along the tracjectory to the hit.
Definition CDCCKFState.h:95
CDCCKFState(const TrackingUtilities::CDCWireHit *wireHit)
constructor from the CDC wireHit
Definition CDCCKFState.h:33
void setReconstructedZ(double reconstructedZ)
Set state Z information.
void setArcLength(double arcLength)
Set the arc-length along the tracjectory to the hit.
Definition CDCCKFState.h:89
const TrackingUtilities::CDCWireHit * getWireHit() const
Get CDCWireHit corresponding to the state.
Definition CDCCKFState.h:36
void setChi2(double chi2)
Set set chi2.
TrackingUtilities::CDCTrajectory3D getTrajectory() const
Helper method to get trajectory from the trackState.
double getReconstructedZ() const
Get state Z information.
TrackingUtilities::ERightLeft m_rl
Store if the track is on the right or left side of the hit.
void setWeight(double weight)
Set state weight.
CDCCKFState(const RecoTrack *seed, const genfit::MeasuredStateOnPlane &trackState)
constructor from the seed recoTrack and genfit trackState
Definition CDCCKFState.h:29
const genfit::MeasuredStateOnPlane & getTrackState() const
Get genfit track state (but first check if already present)
Definition CDCCKFState.h:63
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:50
double m_arcLength
arc length along the trajectory to the hit
double m_hitDistance
distance from the trajectory to the hit
bool isSeed() const
Returns true if the state corresponds to the seed track.
Definition CDCCKFState.h:57
std::optional< genfit::MeasuredStateOnPlane > m_trackState
(optional) genfit MeasuredStateOnPlane
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:56
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Abstract base class for different kinds of events.