8#include <tracking/trackFindingCDC/fitting/CDCAxialStereoFusion.h>
10#include <tracking/trackFindingCDC/fitting/CDCSZFitter.h>
11#include <tracking/trackFindingCDC/fitting/CDCRiemannFitter.h>
13#include <tracking/trackFindingCDC/eventdata/tracks/CDCSegmentPair.h>
14#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment3D.h>
15#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
16#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
17#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
18#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
20#include <tracking/trackFindingCDC/topology/CDCWire.h>
23using namespace TrackFindingCDC;
33 result.reserve(segment2D.size());
46 if (not ptrFromSegment) {
47 B2WARNING(
"From segment unset.");
51 if (not ptrToSegment) {
52 B2WARNING(
"To segment unset.");
68 if (not ptrFromSegment) {
69 B2WARNING(
"From segment unset.");
73 if (not ptrToSegment) {
74 B2WARNING(
"To segment unset.");
95 if (fromSegment2D.empty()) {
96 B2WARNING(
"From segment is empty.");
100 if (toSegment2D.empty()) {
101 B2WARNING(
"To segment is empty.");
105 bool fromIsAxial = fromSegment2D.
isAxial();
106 const CDCSegment2D& axialSegment2D = fromIsAxial ? fromSegment2D : toSegment2D;
107 const CDCSegment2D& stereoSegment2D = not fromIsAxial ? fromSegment2D : toSegment2D;
111 Vector2D localOrigin2D = (fromIsAxial ? fromSegment2D.back() : toSegment2D.front()).getRecoPos2D();
119 trajectorySZ = szFitter.
fit(stereoSegment3D);
126 CDCTrajectory3D preliminaryTrajectory3D(axialTrajectory2D, trajectorySZ);
127 Vector3D localOrigin3D(localOrigin2D, 0.0);
129 return preliminaryTrajectory3D;
143 CDCSegment3D fromSegment3D = reconstruct(fromSegment2D, preliminaryTrajectory3D);
144 CDCSegment3D toSegment3D = reconstruct(toSegment2D, preliminaryTrajectory3D);
147 double tanLambda = preliminaryTrajectory3D.
getTanLambda();
173 size_t nHits = segment3D.size();
180 const Vector2D& recoPos2D = recoHit3D.getRecoPos2D();
181 const Vector2D localRecoPos2D = recoPos2D - localOrigin2D;
183 const CDCWire& wire = recoHit3D.getWire();
190 using namespace NHelixParameterIndices;
191 result(c_Curv, c_Curv) = 1.0;
192 result(c_Phi0, c_Phi0) = 1.0;
193 result(c_I, c_I) = 1.0;
195 result(c_Phi0, c_TanL) = zeta;
196 result(c_I, c_Z0) = - zeta;
DriftLengthEstimator m_driftLengthEstimator
Helper object to carry out the drift length estimation.
void fusePreliminary(const CDCSegmentPair &segmentPair)
Fit the given segment pair using the preliminary helix fit without proper covariance matrix.
void reconstructFuseTrajectories(const CDCSegmentPair &segmentPair)
Combine the two trajectories of the segments in the pair and assign the resulting three dimensional t...
bool m_reestimateDriftLength
Switch to re-estimate the drift length.
PerigeeHelixAmbiguity calcAmbiguity(const CDCSegment3D &segment3D, const CDCTrajectory2D &trajectory2D)
Calculate the ambiguity of the helix parameters relative to the three circle parameters given the hit...
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.
Class representing a two dimensional reconstructed hit in the central drift chamber.
Class representing a three dimensional reconstructed hit.
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.
Class implementing the Riemann fit for two dimensional trajectory circle.
Class implementing the z coordinate over travel distance line fit.
static const CDCSZFitter & getFitter()
Getter for a standard sz line fitter instance.
CDCTrajectorySZ fit(const CDCSegment2D &stereoSegment, const CDCTrajectory2D &axialTrajectory2D) const
Returns a fitted trajectory.
A reconstructed sequence of two dimensional hits in one super layer.
A segment consisting of three dimensional reconstructed hits.
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...
Class representing a pair of one reconstructed axial segment and one stereo segment in adjacent super...
const CDCSegment2D * getToSegment() const
Getter for the to segment.
void setTrajectory3D(const CDCTrajectory3D &trajectory3D) const
Setter for the three dimensional trajectory.
const CDCSegment2D * getFromSegment() const
Getter for the from segment.
bool isAxial() const
Indicator if the underlying wires are axial.
CDCTrajectory2D & getTrajectory2D() const
Getter for the two dimensional trajectory fitted to the segment.
Particle trajectory as it is seen in xy projection represented as a circle.
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
const Vector2D & getLocalOrigin() const
Getter for the origin of the local coordinate system.
const UncertainPerigeeCircle & getLocalCircle() const
Getter for the circle in local coordinates.
Particle full three dimensional trajectory.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
UncertainSZLine getLocalSZLine() const
Getter for the sz line starting from the local origin.
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz trajectory.
double getTanLambda() const
Getter for the slope of z over the transverse travel distance s.
double setLocalOrigin(const Vector3D &localOrigin)
Setter for the origin of the local coordinate system.
const Vector3D & getLocalOrigin() const
Getter for the origin of the local coordinate system.
Linear trajectory in sz space.
bool isFitted() const
Indicates if the line has been fitted.
Class representing a sense wire in the central drift chamber.
const WireLine & getWireLine() const
Getter for the wire line representation of the wire.
Vector2D normal(const Vector2D &point) const
Unit normal vector from the circle to the given point.
A matrix implementation to be used as an interface typ through out the track finder.
A general helix class including a covariance matrix.
static UncertainHelix average(const UncertainHelix &fromHelix, const UncertainHelix &toHelix)
Construct the averages of the two given helices by properly considering their covariance matrix.
Adds an uncertainty matrix to the circle in perigee parameterisation.
SZParameters szParameters() const
Getter for the sz parameters in the order defined by ESZParameter.h.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
double dot(const Vector2D &rhs) const
Calculates the two dimensional dot product.
A three dimensional vector.
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Vector2D sagMovePerZ(const double z) const
Gives the two dimensional position with wire sag effect of the line at the given z value.
Abstract base class for different kinds of events.
double updateDriftLength(CDCRecoHit2D &recoHit2D)
Update the drift length of the reconstructed hit in place.
static PerigeeAmbiguity defaultPerigeeAmbiguity()
Initialise a default covariance matrix to zero.