8#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit3D.h>
10#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit2D.h>
11#include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
12#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
14#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
15#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
16#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
18#include <tracking/trackFindingCDC/topology/CDCWire.h>
19#include <tracking/trackFindingCDC/topology/EStereoKind.h>
21#include <tracking/trackFindingCDC/geometry/Vector3D.h>
22#include <tracking/trackFindingCDC/geometry/Vector2D.h>
24#include <tracking/trackFindingCDC/numerics/ERightLeft.h>
26#include <tracking/trackFindingCDC/numerics/ESign.h>
28#include <cdc/dataobjects/CDCSimHit.h>
30#include <framework/logging/Logger.h>
35using namespace TrackFindingCDC;
40 : m_rlWireHit(rlWireHit)
41 , m_recoPos3D(recoPos3D)
42 , m_arcLength2D(arcLength2D)
49 double arcLength2D = std::numeric_limits<double>::quiet_NaN();
68 Vector3D recoPos3D = wireHit->reconstruct3D(trajectory2D, rlInfo);
89 return reconstruct(recoHit, trajectory2D, trajectorySZ);
98 double arcLength2D = 0;
99 if (stereoKind == EStereoKind::c_StereoU or stereoKind == EStereoKind::c_StereoV) {
115 const double z = trajectorySZ.
mapSToZ(arcLength2D);
121 const double correctedPerpS = trajectory2D.
calcArcLength2D(correctedRecoPos2D);
122 const double correctedZ = trajectorySZ.
mapSToZ(correctedPerpS);
123 const Vector3D correctedRecoPos3D(correctedRecoPos2D, correctedZ);
126 result.snapToDriftCircle();
133 B2ASSERT(
"This function can only be used with axial hits.", axialWireHit->isAxial());
141 if (first.getRLWireHit() == second.getRLWireHit()) {
143 Vector3D::average(first.getRecoPos3D(), second.getRecoPos3D()),
144 (first.getArcLength2D() + second.getArcLength2D()) / 2);
146 B2ERROR(
"Averaging three dimensional hits which are on different oriented wire hits. Return "
147 "first one unchanged");
192 bool switchSide = sign(oldDriftLength) != sign(driftLength);
B2Vector3D getPosTrack() const
The method to get position on the track.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
void reverse()
Switches the right left passage to its opposite in place.
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
void setRefDriftLength(double driftLength)
Setter for the drift length at the reference position of the wire.
static CDCRLWireHit fromSimHit(const CDCWireHit *wirehit, const CDCSimHit &simhit)
Constructs an oriented wire hit from a CDCSimHit and the associated wirehit.
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, double z=0) const
Attempts to reconstruct a three dimensional position (especially of stereo hits).
Class representing a two dimensional reconstructed hit in the central drift chamber.
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit associated with the reconstructed hit.
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determining the z coordinat...
const CDCWire & getWire() const
Getter for the wire the reconstructed hit associated to.
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
EStereoKind getStereoKind() const
Getter for the stereo type of the underlying wire.
Class representing a three dimensional reconstructed hit.
static CDCRecoHit3D average(const CDCRecoHit3D &first, const CDCRecoHit3D &second)
Constructs the average of two reconstructed hit positions.
const Vector3D & getRecoPos3D() const
Getter for the 3d position of the hit.
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit.
CDCRecoHit3D()=default
Default constructor for ROOT.
void reverse()
Turns the orientation in place.
double getSignedRecoDriftLength() const
Returns the drift length next to the reconstructed position.
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.
const CDCWire & getWire() const
Getter for the wire.
CDCRecoHit2D getRecoHit2D() const
Constructs a two dimensional reconstructed hit by carrying out the stereo ! projection to the wire re...
Vector2D getRecoWirePos2D() const
Returns the position of the wire in the xy plain the reconstructed position is located in.
static CDCRecoHit3D fromSimHit(const CDCWireHit *wireHit, const CDCSimHit &simHit)
Constructs a three dimensional reconstructed hit from a sim hit and the associated wirehit.
void snapToDriftCircle(bool switchSide=false)
Scales the displacement vector in place to lie on the drift circle.
double getRecoZ() const
Getter for the z coordinate of the reconstructed position.
double getArcLength2D() const
Getter for the travel distance in the xy projection.
CDCRecoHit2D stereoProjectToRef() const
Constructs a two dimensional reconstructed hit by carrying out the stereo ! projection to the wire re...
CDCRLWireHit m_rlWireHit
Memory for the oriented wire hit reference.
CDCRecoHit3D reversed() const
Returns the recohit with the opposite right left information.
void setRecoDriftLength(double driftLength, bool snapRecoPos)
Setter to update the drift length of the hit.
static CDCRecoHit3D reconstructNearest(const CDCWireHit *axialWireHit, const CDCTrajectory2D &trajectory2D)
Reconstruct a three dimensional hit from a wire hit (as in reconstruct(rlWireHit, trajectory2D)),...
Vector2D getRecoDisp2D() const
Gets the displacement from the wire position in the xy plain at the reconstructed position.
Vector3D m_recoPos3D
Memory for the reconstructed hit position.
bool isInCellZBounds(const double factor=1) const
Indicator if the hit is in the cdc (scaled by the factor) or already outside its boundaries.
Particle trajectory as it is seen in xy projection represented as a circle.
double calcArcLength2D(const Vector2D &point) const
Calculate the travel distance from the start position of the trajectory.
ERightLeft isRightOrLeft(const Vector2D &point) const
Checks if the given point is to the right or to the left of the trajectory.
Vector2D getClosest(const Vector2D &point) const
Calculates the closest approach on the trajectory to the given point.
Particle full three dimensional trajectory.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz trajectory.
Linear trajectory in sz space.
double mapSToZ(const double s=0) const
Translates the travel distance to the z coordinate.
Class representing a hit wire in the central drift chamber.
Class representing a sense wire in the central drift chamber.
bool isInCellZBounds(const Vector3D &pos3D, const double factor=1) const
Checks whether the position is in the z bounds of the drift cell (scaled by the factor) surrounding t...
Vector2D getWirePos2DAtZ(const double z) const
Gives the xy projected position of the wire at the given z coordinate.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
double normalizeTo(const double toLength)
Normalizes the vector to the given length.
A three dimensional vector.
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
double z() const
Getter for the z coordinate.
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Abstract base class for different kinds of events.