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 175 of file CDCAxialStereoFusion.cc.

177{
178 size_t nHits = segment3D.size();
179
180 const ROOT::Math::XYVector& localOrigin2D = trajectory2D.getLocalOrigin();
181 const UncertainPerigeeCircle& localCircle = trajectory2D.getLocalCircle();
182
183 double zeta = 0;
184 for (const CDCRecoHit3D& recoHit3D : segment3D) {
185 const ROOT::Math::XYVector& recoPos2D = recoHit3D.getRecoPos2D();
186 const ROOT::Math::XYVector localRecoPos2D = recoPos2D - localOrigin2D;
187 const ROOT::Math::XYVector normal = localCircle->normal(localRecoPos2D);
188 const CDCWire& wire = recoHit3D.getWire();
189 zeta += wire.getWireLine().sagMovePerZ(recoHit3D.getRecoZ()).Dot(normal);
190 }
191 zeta /= nHits;
192
193 PerigeeHelixAmbiguity result = HelixUtil::defaultPerigeeAmbiguity();
194
195 using namespace NHelixParameterIndices;
196 result(c_Curv, c_Curv) = 1.0;
197 result(c_Phi0, c_Phi0) = 1.0;
198 result(c_I, c_I) = 1.0;
199
200 result(c_Phi0, c_TanL) = zeta;
201 result(c_I, c_Z0) = - zeta;
202
203 return result;
204}
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
ROOT::Math::XYVector normal(const ROOT::Math::XYVector &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 97 of file CDCAxialStereoFusion.cc.

99{
100 if (fromSegment2D.empty()) {
101 B2WARNING("From segment is empty.");
102 return CDCTrajectory3D();
103 }
104
105 if (toSegment2D.empty()) {
106 B2WARNING("To segment is empty.");
107 return CDCTrajectory3D();
108 }
109
110 bool fromIsAxial = fromSegment2D.isAxial();
111 const CDCSegment2D& axialSegment2D = fromIsAxial ? fromSegment2D : toSegment2D;
112 const CDCSegment2D& stereoSegment2D = not fromIsAxial ? fromSegment2D : toSegment2D;
113
114 CDCTrajectory2D axialTrajectory2D = axialSegment2D.getTrajectory2D();
115
116 ROOT::Math::XYVector localOrigin2D = (fromIsAxial ? fromSegment2D.back() : toSegment2D.front()).getRecoPos2D();
117 axialTrajectory2D.setLocalOrigin(localOrigin2D);
118
119 CDCSegment3D stereoSegment3D = CDCSegment3D::reconstruct(stereoSegment2D, axialTrajectory2D);
120
121 CDCTrajectorySZ trajectorySZ;
122
123 CDCSZFitter szFitter = CDCSZFitter::getFitter();
124 trajectorySZ = szFitter.fit(stereoSegment3D);
125 if (not trajectorySZ.isFitted()) {
126 CDCTrajectory3D result;
127 result.setChi2(NAN);
128 return result;
129 }
130
131 CDCTrajectory3D preliminaryTrajectory3D(axialTrajectory2D, trajectorySZ);
132 ROOT::Math::XYZVector localOrigin3D(localOrigin2D.X(), localOrigin2D.Y(), 0.0);
133 preliminaryTrajectory3D.setLocalOrigin(localOrigin3D);
134 return preliminaryTrajectory3D;
135}
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 ROOT::Math::XYVector &localOrigin)
Setter for the origin of the local coordinate system.
bool isFitted() const
Indicates if the line has been fitted.

◆ 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 68 of file CDCAxialStereoFusion.cc.

69{
70 const CDCSegment2D* ptrFromSegment = segmentPair.getFromSegment();
71 const CDCSegment2D* ptrToSegment = segmentPair.getToSegment();
72
73 if (not ptrFromSegment) {
74 B2WARNING("From segment unset.");
75 return;
76 }
77
78 if (not ptrToSegment) {
79 B2WARNING("To segment unset.");
80 return;
81 }
82 const CDCSegment2D& fromSegment = *ptrFromSegment;
83 const CDCSegment2D& toSegment = *ptrToSegment;
84
85 CDCTrajectory3D trajectory3D = fusePreliminary(fromSegment, toSegment);
86 segmentPair.setTrajectory3D(trajectory3D);
87}
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 90 of file CDCAxialStereoFusion.cc.

92{
93 CDCTrajectory3D preliminaryTrajectory3D = fusePreliminary(fromSegment2D, toSegment2D);
94 return reconstructFuseTrajectories(fromSegment2D, toSegment2D, preliminaryTrajectory3D);
95}
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 137 of file CDCAxialStereoFusion.cc.

140{
141 ROOT::Math::XYZVector localOrigin3D = preliminaryTrajectory3D.getLocalOrigin();
142 ROOT::Math::XYVector localOrigin2D = VectorUtil::getXYVector(localOrigin3D);
143
144 CDCRiemannFitter riemannFitter;
145 //riemannFitter.useOnlyOrientation();
146 riemannFitter.useOnlyPosition();
147
148 CDCSegment3D fromSegment3D = reconstruct(fromSegment2D, preliminaryTrajectory3D);
149 CDCSegment3D toSegment3D = reconstruct(toSegment2D, preliminaryTrajectory3D);
150
152 double tanLambda = preliminaryTrajectory3D.getTanLambda();
153 m_driftLengthEstimator.updateDriftLength(fromSegment3D, tanLambda);
154 m_driftLengthEstimator.updateDriftLength(toSegment3D, tanLambda);
155 }
156
157 CDCTrajectory2D fromTrajectory2D = riemannFitter.fit(fromSegment3D);
158 CDCTrajectory2D toTrajectory2D = riemannFitter.fit(toSegment3D);
159
160 fromTrajectory2D.setLocalOrigin(localOrigin2D);
161 toTrajectory2D.setLocalOrigin(localOrigin2D);
162
163 SZParameters refSZ = preliminaryTrajectory3D.getLocalSZLine().szParameters();
164
165 const UncertainPerigeeCircle& fromCircle = fromTrajectory2D.getLocalCircle();
166 const UncertainPerigeeCircle& toCircle = toTrajectory2D.getLocalCircle();
167
168 JacobianMatrix<3, 5> fromH = calcAmbiguity(fromSegment3D, fromTrajectory2D);
169 JacobianMatrix<3, 5> toH = calcAmbiguity(toSegment3D, toTrajectory2D);
170
171 UncertainHelix resultHelix = UncertainHelix::average(fromCircle, fromH, toCircle, toH, refSZ);
172 return CDCTrajectory3D(localOrigin3D, resultHelix);
173}
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.

◆ 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 46 of file CDCAxialStereoFusion.cc.

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

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: