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/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
13#include <tracking/trackFindingCDC/geometry/Vector3D.h>
14#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
15#include <tracking/trackFindingCDC/numerics/ERightLeft.h>
16
17namespace Belle2 {
22
25 public:
27 CDCCKFState(const RecoTrack* seed, const genfit::MeasuredStateOnPlane& trackState) :
28 m_seed(seed), m_trackState(trackState) {}
29
31 explicit CDCCKFState(const TrackFindingCDC::CDCWireHit* wireHit) : m_cdcWireHit(wireHit) {}
32
35 {
36 B2ASSERT("State does not represent a wire hit", static_cast<bool>(m_cdcWireHit));
37 return *m_cdcWireHit;
38 }
39
41 const RecoTrack* getSeed() const
42 {
43 B2ASSERT("State does not represent a seed", static_cast<bool>(m_seed));
44 return *m_seed;
45 }
46
48 const RecoTrack* getMCRecoTrack(const std::string& mcRecoTrackStoreArrayName = "MCRecoTracks") const
49 {
50 const RecoTrack* seed = getSeed();
51 return seed->getRelated<RecoTrack>(mcRecoTrackStoreArrayName);
52 }
53
55 bool isSeed() const
56 {
57 return static_cast<bool>(m_seed);
58 }
59
61 const genfit::MeasuredStateOnPlane& getTrackState() const
62 {
63 B2ASSERT("State does not have a track state (yet)", static_cast<bool>(m_trackState));
64 return *m_trackState;
65 }
66
68 void setTrackState(const genfit::MeasuredStateOnPlane& trackState)
69 {
70 m_trackState = trackState;
71 }
72
74 void setRLinfo(const TrackFindingCDC::ERightLeft& rl)
75 {
76 m_rl = rl;
77 }
78
80 TrackFindingCDC::ERightLeft getRLinfo() const
81 {
82 B2ASSERT("LR info is not present yet", m_rl != TrackFindingCDC::ERightLeft::c_Unknown);
83 return m_rl;
84 }
85
87 void setArcLength(double arcLength)
88 {
89 m_arcLength = arcLength;
90 }
91
93 double getArcLength() const
94 {
95 return m_arcLength;
96 }
97
99 void setHitDistance(double hitDistance)
100 {
101 m_hitDistance = hitDistance;
102 }
103
105 double getHitDistance() const
106 {
107 return m_hitDistance;
108 }
109
111 void setWeight(double weight)
112 {
113 m_weight = weight;
114 }
115
117 double getWeight() const
118 {
119 return m_weight;
120 }
121
123 void setChi2(double chi2)
124 {
125 m_chi2 = chi2;
126 }
127
129 double getChi2() const
130 {
131 return m_chi2;
132 }
133
135 void setReconstructedZ(double reconstructedZ)
136 {
137 m_reconstructedZ = reconstructedZ;
138 }
139
141 double getReconstructedZ() const
142 {
143 return m_reconstructedZ;
144 }
145
148 {
149 const auto& trackState = getTrackState();
150 const TrackFindingCDC::Vector3D trackPosition(trackState.getPos());
151 const TrackFindingCDC::Vector3D trackMomentum(trackState.getMom());
152 return TrackFindingCDC::CDCTrajectory3D(trackPosition, trackState.getTime(),
153 trackMomentum, trackState.getCharge());
154 }
155
156 private:
158 std::optional<const RecoTrack*> m_seed;
160 std::optional<const TrackFindingCDC::CDCWireHit*> m_cdcWireHit;
161
163 std::optional<genfit::MeasuredStateOnPlane> m_trackState;
164
166 double m_arcLength = 0;
167
169 double m_hitDistance = 0;
170
172 double m_weight = 0;
173
175 double m_chi2 = 0;
176
179
181 TrackFindingCDC::ERightLeft m_rl = TrackFindingCDC::ERightLeft::c_Unknown;
182 };
183
185 std::ostream& operator<<(std::ostream& output, const CDCCKFState& state);
187}
Define states for CKF algorithm, which can be seed track or CDC wire hit.
Definition CDCCKFState.h:24
double getWeight() const
Get state weight.
void setRLinfo(const TrackFindingCDC::ERightLeft &rl)
Set right-left info for the hit.
Definition CDCCKFState.h:74
void setTrackState(const genfit::MeasuredStateOnPlane &trackState)
Store genfit Measured state on plane.
Definition CDCCKFState.h:68
void setHitDistance(double hitDistance)
Set hit distance to the trajectory.
Definition CDCCKFState.h:99
std::optional< const RecoTrack * > m_seed
(optional) pointer to the seed track
double m_reconstructedZ
reconstructed Z coordinate
double getHitDistance() const
Return hit distance to the trajectory.
double getChi2() const
Get state chi2.
TrackFindingCDC::ERightLeft getRLinfo() const
Return right-left info (check if present first)
Definition CDCCKFState.h:80
const RecoTrack * getSeed() const
Get RecoTrack seed corresponding to the state.
Definition CDCCKFState.h:41
std::optional< const TrackFindingCDC::CDCWireHit * > m_cdcWireHit
(optional) pointer to the wire hit
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:93
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:87
void setChi2(double chi2)
Set set chi2.
TrackFindingCDC::ERightLeft m_rl
Store if the track is on the right or left side of the hit.
double getReconstructedZ() const
Get state Z information.
CDCCKFState(const TrackFindingCDC::CDCWireHit *wireHit)
constructor from the CDC wireHit
Definition CDCCKFState.h:31
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:27
const genfit::MeasuredStateOnPlane & getTrackState() const
Get genfit track state (but first check if already present)
Definition CDCCKFState.h:61
TrackFindingCDC::CDCTrajectory3D getTrajectory() const
Helper method to get trajectory from the trackState.
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:48
double m_arcLength
arc length along the trajectory to the hit
const TrackFindingCDC::CDCWireHit * getWireHit() const
Get CDCWireHit corresponding to the state.
Definition CDCCKFState.h:34
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:55
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:55
A three dimensional vector.
Definition Vector3D.h:33
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Abstract base class for different kinds of events.