Belle II Software development
CDCSZFitter Class Reference

Class implementing the z coordinate over travel distance line fit. More...

#include <CDCSZFitter.h>

Public Member Functions

TrackingUtilities::CDCTrajectorySZ fitWithStereoHits (const TrackingUtilities::CDCTrack &track) const
 Returns the fitted sz trajectory of the track with the z-information of all stereo hits of the number of stereo hits is big enough.
 
TrackingUtilities::CDCTrajectorySZ fit (const TrackingUtilities::CDCSegment2D &stereoSegment, const TrackingUtilities::CDCTrajectory2D &axialTrajectory2D) const
 Returns a fitted trajectory.
 
TrackingUtilities::CDCTrajectorySZ fit (const TrackingUtilities::CDCSegment3D &segment3D) const
 Fits a linear sz trajectory to the z and s coordinates in the stereo segment.
 
TrackingUtilities::CDCTrajectorySZ fit (CDCSZObservations observationsSZ) const
 Fits a linear sz trajectory to the s and z coordinates given in the observations.
 
TrackingUtilities::CDCTrajectorySZ fit (const CDCObservations2D &observations2D) const
 Legacy - Fits a linear sz trajectory to the x and y coordinates interpreted as sz space.
 
void update (const TrackingUtilities::CDCSegmentPair &segmentPair) const
 Updates the trajectory of the axial stereo segment pair inplace.
 
void update (TrackingUtilities::CDCTrajectorySZ &trajectorySZ, const TrackingUtilities::CDCSegment2D &stereoSegment, const TrackingUtilities::CDCTrajectory2D &axialTrajectory2D) const
 Update the given sz trajectory reconstructing the stereo segment with a near by axial segment.
 
void update (TrackingUtilities::CDCTrajectorySZ &trajectorySZ, CDCSZObservations &observationsSZ) const
 Update the trajectory with a fit to the observations.
 

Static Public Member Functions

static const CDCSZFittergetFitter ()
 Getter for a standard sz line fitter instance.
 

Detailed Description

Class implementing the z coordinate over travel distance line fit.

Definition at line 29 of file CDCSZFitter.h.

Member Function Documentation

◆ fit() [1/4]

CDCTrajectorySZ fit ( CDCSZObservations observationsSZ) const

Fits a linear sz trajectory to the s and z coordinates given in the observations.

Definition at line 157 of file CDCSZFitter.cc.

158{
159 CDCTrajectorySZ trajectorySZ;
160 update(trajectorySZ, observationsSZ);
161 return trajectorySZ;
162}
void update(const TrackingUtilities::CDCSegmentPair &segmentPair) const
Updates the trajectory of the axial stereo segment pair inplace.

◆ fit() [2/4]

CDCTrajectorySZ fit ( const CDCObservations2D & observations2D) const

Legacy - Fits a linear sz trajectory to the x and y coordinates interpreted as sz space.

Definition at line 183 of file CDCSZFitter.cc.

184{
185 CDCSZObservations szObservations;
186 for (size_t i = 0; i < observations2D.size(); ++i) {
187 const double s = observations2D.getX(i);
188 const double z = observations2D.getY(i);
189 szObservations.fill(s, z);
190 }
191 return fit(std::move(szObservations));
192}
double getX(int iObservation) const
Getter for the x value of the observation at the given index.
double getY(int iObservation) const
Getter for the y value of the observation at the given index.
std::size_t size() const
Returns the number of observations stored.
TrackingUtilities::CDCTrajectorySZ fit(const TrackingUtilities::CDCSegment2D &stereoSegment, const TrackingUtilities::CDCTrajectory2D &axialTrajectory2D) const
Returns a fitted trajectory.
std::size_t fill(double s, double z, double weight=1.0)
Appends the observed position.

◆ fit() [3/4]

CDCTrajectorySZ fit ( const TrackingUtilities::CDCSegment2D & stereoSegment,
const TrackingUtilities::CDCTrajectory2D & axialTrajectory2D ) const

Returns a fitted trajectory.

Definition at line 140 of file CDCSZFitter.cc.

142{
143 B2ASSERT("Expected stereo segment", not stereoSegment.isAxial());
144
145 CDCTrajectorySZ trajectorySZ;
146 update(trajectorySZ, stereoSegment, axialTrajectory2D);
147 return trajectorySZ;
148}

◆ fit() [4/4]

CDCTrajectorySZ fit ( const TrackingUtilities::CDCSegment3D & segment3D) const

Fits a linear sz trajectory to the z and s coordinates in the stereo segment.

Definition at line 150 of file CDCSZFitter.cc.

151{
152 CDCSZObservations observationsSZ;
153 observationsSZ.appendRange(segment3D);
154 return fit(std::move(observationsSZ));
155}
std::size_t appendRange(const std::vector< TrackingUtilities::CDCRecoHit3D > &recoHit3Ds)
Appends all reconstructed hits from the three dimensional track.

◆ fitWithStereoHits()

CDCTrajectorySZ fitWithStereoHits ( const TrackingUtilities::CDCTrack & track) const

Returns the fitted sz trajectory of the track with the z-information of all stereo hits of the number of stereo hits is big enough.

Else return the basic assumption.

Definition at line 126 of file CDCSZFitter.cc.

127{
128 const bool onlyStereo = true;
129 CDCSZObservations observationsSZ(EFitVariance::c_Proper, onlyStereo);
130 observationsSZ.appendRange(track);
131 if (observationsSZ.size() > 3) {
132 CDCTrajectorySZ szTrajectory;
133 update(szTrajectory, observationsSZ);
134 return szTrajectory;
135 } else {
137 }
138}
static CDCTrajectorySZ basicAssumption()
Constructs a basic assumption, what the z0 start position and the sz slope are, including some broad ...

◆ getFitter()

const CDCSZFitter & getFitter ( )
static

Getter for a standard sz line fitter instance.

Definition at line 37 of file CDCSZFitter.cc.

38{
39 static CDCSZFitter szFitter;
40 return szFitter;
41}

◆ update() [1/3]

void update ( const TrackingUtilities::CDCSegmentPair & segmentPair) const

Updates the trajectory of the axial stereo segment pair inplace.

Definition at line 164 of file CDCSZFitter.cc.

165{
166 const CDCSegment2D* ptrStereoSegment = segmentPair.getStereoSegment();
167 const CDCSegment2D* ptrAxialSegment = segmentPair.getAxialSegment();
168
169 assert(ptrStereoSegment);
170 assert(ptrAxialSegment);
171
172 const CDCSegment2D& stereoSegment = *ptrStereoSegment;
173 const CDCSegment2D& axialSegment = *ptrAxialSegment;
174 const CDCTrajectory2D& axialTrajectory2D = axialSegment.getTrajectory2D();
175
176 CDCTrajectorySZ trajectorySZ;
177 update(trajectorySZ, stereoSegment, axialTrajectory2D);
178
179 CDCTrajectory3D trajectory3D(axialTrajectory2D, trajectorySZ);
180 segmentPair.setTrajectory3D(trajectory3D);
181}
CDCTrajectory2D & getTrajectory2D() const
Getter for the two dimensional trajectory fitted to the segment.
Definition CDCSegment.h:69

◆ update() [2/3]

void update ( TrackingUtilities::CDCTrajectorySZ & trajectorySZ,
CDCSZObservations & observationsSZ ) const

Update the trajectory with a fit to the observations.

Definition at line 210 of file CDCSZFitter.cc.

211{
212 trajectorySZ.clear();
213 if (observationsSZ.size() < 3) {
214 return;
215 }
216
217 // Determine NDF : Line fit eats up 2 degrees of freedom.
218 size_t ndf = observationsSZ.size() - 2;
219
220 // Matrix of weighted sums
221 Eigen::Matrix<double, 3, 3> sumMatrixWSZ = getWSZSumMatrix(observationsSZ);
222 UncertainSZLine uncertainSZLine = fitZ(sumMatrixWSZ);
223
224 uncertainSZLine.setNDF(ndf);
225 trajectorySZ.setSZLine(uncertainSZLine);
226}
std::size_t size() const
Returns the number of observations stored.
void setNDF(std::size_t ndf)
Setter for the number of degrees of freediom used in the line fit.

◆ update() [3/3]

void update ( TrackingUtilities::CDCTrajectorySZ & trajectorySZ,
const TrackingUtilities::CDCSegment2D & stereoSegment,
const TrackingUtilities::CDCTrajectory2D & axialTrajectory2D ) const

Update the given sz trajectory reconstructing the stereo segment with a near by axial segment.

Definition at line 194 of file CDCSZFitter.cc.

197{
198 B2ASSERT("Expected stereo segment", not stereoSegment.isAxial());
199
200 // recostruct the stereo segment
201 CDCSZObservations observationsSZ;
202 for (const CDCRecoHit2D& recoHit2D : stereoSegment) {
203 CDCRecoHit3D recoHit3D = CDCRecoHit3D::reconstruct(recoHit2D, axialTrajectory2D);
204 observationsSZ.append(recoHit3D);
205 }
206
207 update(trajectorySZ, observationsSZ);
208}
std::size_t append(const TrackingUtilities::CDCRecoHit3D &recoHit3D)
Appends the observed position.
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.

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