Belle II Software development
CDCAxialStereoFusion Class Reference

Utility class implementing the Kalmanesk combination of to two dimensional trajectories to one three dimensional trajectory. More...

#include <CDCAxialStereoFusion.h>

Public Member Functions

 CDCAxialStereoFusion (bool reestimateDriftLength=true)
 Constructor setting up the options of the fit.
 
void reconstructFuseTrajectories (const TrackingUtilities::CDCSegmentPair &segmentPair)
 Combine the two trajectories of the segments in the pair and assign the resulting three dimensional trajectory to the segment pair.
 
void fusePreliminary (const TrackingUtilities::CDCSegmentPair &segmentPair)
 Fit the given segment pair using the preliminary helix fit without proper covariance matrix.
 
TrackingUtilities::CDCTrajectory3D reconstructFuseTrajectories (const TrackingUtilities::CDCSegment2D &fromSegment2D, const TrackingUtilities::CDCSegment2D &toSegment2D)
 Combine the trajectories of the two given segments to a full helix trajectory.
 
TrackingUtilities::CDCTrajectory3D fusePreliminary (const TrackingUtilities::CDCSegment2D &fromSegment2D, const TrackingUtilities::CDCSegment2D &toSegment2D)
 Fit the two given segments together using the preliminary helix fit without proper covariance matrix.
 
TrackingUtilities::CDCTrajectory3D reconstructFuseTrajectories (const TrackingUtilities::CDCSegment2D &fromSegment2D, const TrackingUtilities::CDCSegment2D &toSegment2D, const TrackingUtilities::CDCTrajectory3D &preliminaryTrajectory3D)
 Combine the two segments given a preliminary reference trajectory to which a creation is applied.
 
TrackingUtilities::PerigeeHelixAmbiguity calcAmbiguity (const TrackingUtilities::CDCSegment3D &segment3D, const TrackingUtilities::CDCTrajectory2D &trajectory2D)
 Calculate the ambiguity of the helix parameters relative to the three circle parameters given the hit content of the segment and their stereo displacement.
 

Private Attributes

bool m_reestimateDriftLength
 Switch to re-estimate the drift length.
 
DriftLengthEstimator m_driftLengthEstimator
 Helper object to carry out the drift length estimation.
 

Detailed Description

Utility class implementing the Kalmanesk combination of to two dimensional trajectories to one three dimensional trajectory.

Definition at line 32 of file CDCAxialStereoFusion.h.

Constructor & Destructor Documentation

◆ CDCAxialStereoFusion()

CDCAxialStereoFusion ( bool reestimateDriftLength = true)
inlineexplicit

Constructor setting up the options of the fit.

Definition at line 36 of file CDCAxialStereoFusion.h.

37 : m_reestimateDriftLength(reestimateDriftLength)
38 {
39 }

Member Function Documentation

◆ calcAmbiguity()

PerigeeHelixAmbiguity calcAmbiguity ( const TrackingUtilities::CDCSegment3D & segment3D,
const TrackingUtilities::CDCTrajectory2D & trajectory2D )

Calculate the ambiguity of the helix parameters relative to the three circle parameters given the hit content of the segment and their stereo displacement.

Definition at line 172 of file CDCAxialStereoFusion.cc.

174{
175 size_t nHits = segment3D.size();
176
177 const Vector2D& localOrigin2D = trajectory2D.getLocalOrigin();
178 const UncertainPerigeeCircle& localCircle = trajectory2D.getLocalCircle();
179
180 double zeta = 0;
181 for (const CDCRecoHit3D& recoHit3D : segment3D) {
182 const Vector2D& recoPos2D = recoHit3D.getRecoPos2D();
183 const Vector2D localRecoPos2D = recoPos2D - localOrigin2D;
184 const Vector2D normal = localCircle->normal(localRecoPos2D);
185 const CDCWire& wire = recoHit3D.getWire();
186 zeta += wire.getWireLine().sagMovePerZ(recoHit3D.getRecoZ()).Dot(normal);
187 }
188 zeta /= nHits;
189
190 PerigeeHelixAmbiguity result = HelixUtil::defaultPerigeeAmbiguity();
191
192 using namespace NHelixParameterIndices;
193 result(c_Curv, c_Curv) = 1.0;
194 result(c_Phi0, c_Phi0) = 1.0;
195 result(c_I, c_I) = 1.0;
196
197 result(c_Phi0, c_TanL) = zeta;
198 result(c_I, c_Z0) = - zeta;
199
200 return result;
201}
const WireLine & getWireLine() const
Getter for the wire line representation of the wire.
Definition CDCWire.h:180
ROOT::Math::XYVector sagMovePerZ(const double z) const
Gives the two dimensional position with wire sag effect of the line at the given z value.
Definition WireLine.h:83
Vector2D normal(const Vector2D &point) const
Unit normal vector from the circle to the given point.
static PerigeeAmbiguity defaultPerigeeAmbiguity()
Initialise a default covariance matrix to zero.

◆ fusePreliminary() [1/2]

CDCTrajectory3D fusePreliminary ( const TrackingUtilities::CDCSegment2D & fromSegment2D,
const TrackingUtilities::CDCSegment2D & toSegment2D )

Fit the two given segments together using the preliminary helix fit without proper covariance matrix.

The fit is used as the expansion point for the least square fuse fit with proper covariance.

Definition at line 94 of file CDCAxialStereoFusion.cc.

96{
97 if (fromSegment2D.empty()) {
98 B2WARNING("From segment is empty.");
99 return CDCTrajectory3D();
100 }
101
102 if (toSegment2D.empty()) {
103 B2WARNING("To segment is empty.");
104 return CDCTrajectory3D();
105 }
106
107 bool fromIsAxial = fromSegment2D.isAxial();
108 const CDCSegment2D& axialSegment2D = fromIsAxial ? fromSegment2D : toSegment2D;
109 const CDCSegment2D& stereoSegment2D = not fromIsAxial ? fromSegment2D : toSegment2D;
110
111 CDCTrajectory2D axialTrajectory2D = axialSegment2D.getTrajectory2D();
112
113 Vector2D localOrigin2D = (fromIsAxial ? fromSegment2D.back() : toSegment2D.front()).getRecoPos2D();
114 axialTrajectory2D.setLocalOrigin(localOrigin2D);
115
116 CDCSegment3D stereoSegment3D = CDCSegment3D::reconstruct(stereoSegment2D, axialTrajectory2D);
117
118 CDCTrajectorySZ trajectorySZ;
119
120 CDCSZFitter szFitter = CDCSZFitter::getFitter();
121 trajectorySZ = szFitter.fit(stereoSegment3D);
122 if (not trajectorySZ.isFitted()) {
123 CDCTrajectory3D result;
124 result.setChi2(NAN);
125 return result;
126 }
127
128 CDCTrajectory3D preliminaryTrajectory3D(axialTrajectory2D, trajectorySZ);
129 Vector3D localOrigin3D(localOrigin2D, 0.0);
130 preliminaryTrajectory3D.setLocalOrigin(localOrigin3D);
131 return preliminaryTrajectory3D;
132}
TrackingUtilities::CDCTrajectorySZ fit(const TrackingUtilities::CDCSegment2D &stereoSegment, const TrackingUtilities::CDCTrajectory2D &axialTrajectory2D) const
Returns a fitted trajectory.
static const CDCSZFitter & getFitter()
Getter for a standard sz line fitter instance.
static CDCSegment3D reconstruct(const CDCSegment2D &segment2D, const CDCTrajectory2D &trajectory2D)
Reconstructs a two dimensional stereo segment by shifting each hit onto the given two dimensional tra...
CDCTrajectory2D & getTrajectory2D() const
Getter for the two dimensional trajectory fitted to the segment.
Definition CDCSegment.h:69
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
bool isFitted() const
Indicates if the line has been fitted.
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition Cell.h:34

◆ fusePreliminary() [2/2]

void fusePreliminary ( const TrackingUtilities::CDCSegmentPair & segmentPair)

Fit the given segment pair using the preliminary helix fit without proper covariance matrix.

Updates the contained trajectory.

Definition at line 65 of file CDCAxialStereoFusion.cc.

66{
67 const CDCSegment2D* ptrFromSegment = segmentPair.getFromSegment();
68 const CDCSegment2D* ptrToSegment = segmentPair.getToSegment();
69
70 if (not ptrFromSegment) {
71 B2WARNING("From segment unset.");
72 return;
73 }
74
75 if (not ptrToSegment) {
76 B2WARNING("To segment unset.");
77 return;
78 }
79 const CDCSegment2D& fromSegment = *ptrFromSegment;
80 const CDCSegment2D& toSegment = *ptrToSegment;
81
82 CDCTrajectory3D trajectory3D = fusePreliminary(fromSegment, toSegment);
83 segmentPair.setTrajectory3D(trajectory3D);
84}
void fusePreliminary(const TrackingUtilities::CDCSegmentPair &segmentPair)
Fit the given segment pair using the preliminary helix fit without proper covariance matrix.

◆ reconstructFuseTrajectories() [1/3]

CDCTrajectory3D reconstructFuseTrajectories ( const TrackingUtilities::CDCSegment2D & fromSegment2D,
const TrackingUtilities::CDCSegment2D & toSegment2D )

Combine the trajectories of the two given segments to a full helix trajectory.

Definition at line 87 of file CDCAxialStereoFusion.cc.

89{
90 CDCTrajectory3D preliminaryTrajectory3D = fusePreliminary(fromSegment2D, toSegment2D);
91 return reconstructFuseTrajectories(fromSegment2D, toSegment2D, preliminaryTrajectory3D);
92}
void reconstructFuseTrajectories(const TrackingUtilities::CDCSegmentPair &segmentPair)
Combine the two trajectories of the segments in the pair and assign the resulting three dimensional t...

◆ reconstructFuseTrajectories() [2/3]

CDCTrajectory3D reconstructFuseTrajectories ( const TrackingUtilities::CDCSegment2D & fromSegment2D,
const TrackingUtilities::CDCSegment2D & toSegment2D,
const TrackingUtilities::CDCTrajectory3D & preliminaryTrajectory3D )

Combine the two segments given a preliminary reference trajectory to which a creation is applied.

Definition at line 134 of file CDCAxialStereoFusion.cc.

137{
138 Vector3D localOrigin3D = preliminaryTrajectory3D.getLocalOrigin();
139 Vector2D localOrigin2D = localOrigin3D.xy();
140
141 CDCRiemannFitter riemannFitter;
142 //riemannFitter.useOnlyOrientation();
143 riemannFitter.useOnlyPosition();
144
145 CDCSegment3D fromSegment3D = reconstruct(fromSegment2D, preliminaryTrajectory3D);
146 CDCSegment3D toSegment3D = reconstruct(toSegment2D, preliminaryTrajectory3D);
147
149 double tanLambda = preliminaryTrajectory3D.getTanLambda();
150 m_driftLengthEstimator.updateDriftLength(fromSegment3D, tanLambda);
151 m_driftLengthEstimator.updateDriftLength(toSegment3D, tanLambda);
152 }
153
154 CDCTrajectory2D fromTrajectory2D = riemannFitter.fit(fromSegment3D);
155 CDCTrajectory2D toTrajectory2D = riemannFitter.fit(toSegment3D);
156
157 fromTrajectory2D.setLocalOrigin(localOrigin2D);
158 toTrajectory2D.setLocalOrigin(localOrigin2D);
159
160 SZParameters refSZ = preliminaryTrajectory3D.getLocalSZLine().szParameters();
161
162 const UncertainPerigeeCircle& fromCircle = fromTrajectory2D.getLocalCircle();
163 const UncertainPerigeeCircle& toCircle = toTrajectory2D.getLocalCircle();
164
165 JacobianMatrix<3, 5> fromH = calcAmbiguity(fromSegment3D, fromTrajectory2D);
166 JacobianMatrix<3, 5> toH = calcAmbiguity(toSegment3D, toTrajectory2D);
167
168 UncertainHelix resultHelix = UncertainHelix::average(fromCircle, fromH, toCircle, toH, refSZ);
169 return CDCTrajectory3D(localOrigin3D, resultHelix);
170}
DriftLengthEstimator m_driftLengthEstimator
Helper object to carry out the drift length estimation.
bool m_reestimateDriftLength
Switch to re-estimate the drift length.
TrackingUtilities::PerigeeHelixAmbiguity calcAmbiguity(const TrackingUtilities::CDCSegment3D &segment3D, const TrackingUtilities::CDCTrajectory2D &trajectory2D)
Calculate the ambiguity of the helix parameters relative to the three circle parameters given the hit...
TrackingUtilities::CDCTrajectory2D fit(const CDCObservations2D &observations2D) const
Fits a collection of observation drift circles.
void useOnlyPosition()
Setup the fitter to use only the reconstructed positions of the hits.
const UncertainPerigeeCircle & getLocalCircle() const
Getter for the circle in local coordinates.
static UncertainHelix average(const UncertainHelix &fromHelix, const UncertainHelix &toHelix)
Construct the averages of the two given helices by properly considering their covariance matrix.
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition Vector3D.h:513

◆ reconstructFuseTrajectories() [3/3]

void reconstructFuseTrajectories ( const TrackingUtilities::CDCSegmentPair & segmentPair)

Combine the two trajectories of the segments in the pair and assign the resulting three dimensional trajectory to the segment pair.

Definition at line 43 of file CDCAxialStereoFusion.cc.

44{
45 const CDCSegment2D* ptrFromSegment = segmentPair.getFromSegment();
46 const CDCSegment2D* ptrToSegment = segmentPair.getToSegment();
47
48 if (not ptrFromSegment) {
49 B2WARNING("From segment unset.");
50 return;
51 }
52
53 if (not ptrToSegment) {
54 B2WARNING("To segment unset.");
55 return;
56 }
57
58 const CDCSegment2D& fromSegment = *ptrFromSegment;
59 const CDCSegment2D& toSegment = *ptrToSegment;
60
61 CDCTrajectory3D trajectory3D = reconstructFuseTrajectories(fromSegment, toSegment);
62 segmentPair.setTrajectory3D(trajectory3D);
63}

Member Data Documentation

◆ m_driftLengthEstimator

DriftLengthEstimator m_driftLengthEstimator
private

Helper object to carry out the drift length estimation.

Definition at line 88 of file CDCAxialStereoFusion.h.

◆ m_reestimateDriftLength

bool m_reestimateDriftLength
private

Switch to re-estimate the drift length.

Definition at line 85 of file CDCAxialStereoFusion.h.


The documentation for this class was generated from the following files: