 |
Belle II Software
release-05-01-25
|
10 #include <tracking/trackFindingCDC/fitting/CDCObservations2D.h>
12 #include <tracking/trackFindingCDC/fitting/EigenObservationMatrix.h>
14 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
15 #include <tracking/trackFindingCDC/eventdata/tracks/CDCAxialSegmentPair.h>
16 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment3D.h>
17 #include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
18 #include <tracking/trackFindingCDC/eventdata/segments/CDCWireHitSegment.h>
19 #include <tracking/trackFindingCDC/eventdata/hits/CDCFacet.h>
20 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHitTriple.h>
21 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHitPair.h>
22 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
23 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
25 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
27 #include <tracking/trackFindingCDC/topology/CDCWire.h>
29 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
32 using namespace TrackFindingCDC;
43 if (std::isnan(x))
return 0;
44 if (std::isnan(y))
return 0;
46 if (std::isnan(signedRadius)) {
47 B2WARNING(
"Signed radius is nan. Skipping observation");
51 if (std::isnan(weight)) {
52 B2WARNING(
"Weight is nan. Skipping observation");
66 return fill(pos2D.x(), pos2D.y(), signedRadius, weight);
71 const Vector2D& wireRefPos2D = wireHit.
getRefPos2D();
73 double signedDriftLength = 0;
77 signedDriftLength = 0;
87 variance = fabs(driftLength);
91 if (abs(rlInfo) != 1) {
97 return fill(wireRefPos2D, signedDriftLength, 1 / variance);
103 return append(*(wireHit), rlInfo);
118 double signedDriftLength = 0;
119 if (
m_fitPos == EFitPos::c_RLDriftCircle and isValid(rlInfo)) {
120 signedDriftLength = rlInfo * driftLength;
122 signedDriftLength = 0;
131 variance = fabs(driftLength);
135 if (abs(rlInfo) != 1) {
138 variance = driftLengthVariance;
142 return fill(wireRefPos2D, signedDriftLength, 1 / variance);
158 if (
m_fitPos == EFitPos::c_RecoPos) {
163 return append(rlWireHitTriple);
170 double signedDriftLength = 0;
171 if (
m_fitPos == EFitPos::c_RecoPos) {
173 signedDriftLength = 0;
181 }
else if (
m_fitPos == EFitPos::c_RLDriftCircle) {
184 }
else if (
m_fitPos == EFitPos::c_WirePos) {
186 signedDriftLength = 0;
198 variance = std::fabs(driftLength);
199 }
else if (
m_fitVariance == EFitVariance::c_Pseudo or abs(rlInfo) != 1) {
205 return fill(fitPos2D, signedDriftLength, 1 / variance);
211 double signedDriftLength = 0;
212 if (
m_fitPos == EFitPos::c_RecoPos) {
214 signedDriftLength = 0;
215 }
else if (
m_fitPos == EFitPos::c_RLDriftCircle) {
218 }
else if (
m_fitPos == EFitPos::c_WirePos) {
220 signedDriftLength = 0;
232 variance = std::fabs(driftLength);
233 }
else if (
m_fitVariance == EFitVariance::c_Pseudo or abs(rlInfo) != 1) {
239 return fill(fitPos2D, signedDriftLength, 1 / variance);
244 std::size_t nAppendedHits = 0;
246 nAppendedHits +=
append(recoHit2D);
248 return nAppendedHits;
253 std::size_t nAppendedHits = 0;
255 nAppendedHits +=
append(recoHit3D);
257 return nAppendedHits;
262 std::size_t nAppendedHits = 0;
264 if (ptrStartSegment2D) {
265 const CDCSegment2D& startSegment2D = *ptrStartSegment2D;
270 if (ptrEndSegment2D) {
274 return nAppendedHits;
279 std::size_t nAppendedHits = 0;
281 nAppendedHits +=
append(recoHit3D);
283 return nAppendedHits;
288 std::size_t nAppendedHits = 0;
289 for (
const CDCWire* ptrWire : wires) {
290 if (not ptrWire)
continue;
291 const CDCWire& wire = *ptrWire;
293 const double driftLength = 0.0;
294 const double weight = 1.0;
295 nAppendedHits +=
fill(wirePos, driftLength, weight);
297 return nAppendedHits;
302 std::size_t nAppendedHits = 0;
303 for (
const CDCWireHit* ptrWireHit : wireHits) {
304 if (not ptrWireHit)
continue;
306 nAppendedHits +=
append(wireHit);
308 return nAppendedHits;
318 std::size_t result = 0;
319 Index nObservations =
size();
321 for (Index iObservation = 0; iObservation < nObservations; ++iObservation) {
323 bool hasDriftLength = (driftLength != 0.0);
324 result += hasDriftLength ? 1 : 0;
332 std::size_t n =
size();
333 if (n == 0)
return Vector2D(NAN, NAN);
334 std::size_t i = n / 2;
349 Eigen::Matrix<double, 1, 2> eigenOrigin(origin.
x(), origin.
y());
350 EigenObservationMatrix eigenObservations = getEigenObservationMatrix(
this);
351 eigenObservations.leftCols<2>().rowwise() -= eigenOrigin;
std::size_t size() const
Returns the number of observations stored.
CDCRecoHit2D getMiddleRecoHit2D() const
Getter for the second reconstucted hit.
double getRefDriftLengthVariance() const
Getter for the uncertainty in the drift length at the wire reference position.
Class representing a three dimensional reconstructed hit.
Class representing a sequence of three dimensional reconstructed hits.
double getX(int iObservation) const
Getter for the x value of the observation at the given index.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
Vector2D getRecoWirePos2D() const
Returns the position of the wire in the xy plain the reconstructed position is located in.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
std::vector< double > m_observations
Memory for the individual observations.
double normSquared() const
Calculates .
const Vector2D & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
double y() const
Getter for the y coordinate.
const Vector2D & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
void passiveMoveBy(const Vector2D &origin)
Moves all observations passively such that the given vector becomes to origin of the new coordinate s...
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
CDCRLWireHit & getToRLWireHit()
Getter for the second oriented wire hit.
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
bool isValid(EForwardBackward eForwardBackward)
Check whether the given enum instance is one of the valid values.
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
CDCRecoHit2D getStartRecoHit2D() const
Getter for the first reconstucted hit.
Class representing a triple of neighboring wire hits.
A segment consisting of three dimensional reconstructed hits.
ERightLeft getRLInfo() const
Getter for the right left passage information.
const Vector2D & getRecoPos2D() const
Getter for the 2d position of the hit.
Particle trajectory as it is seen in xy projection represented as a circle.
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
CDCRLWireHit & getFromRLWireHit()
Getter for the first oriented wire hit.
double getY(int iObservation) const
Getter for the y value of the observation at the given index.
double getTotalPerpS(const CDCTrajectory2D &trajectory2D) const
Calculate the total transvers travel distance traversed by these observations comparing the travel di...
bool hasNAN() const
Checks if one of the coordinates is NAN.
std::size_t appendRange(const CDCSegment2D &segment2D)
Appends all reconstructed hits from the two dimensional segment.
const CDCWire & getWire() const
Getter for the wire the reconstructed hit assoziated to.
A segment consisting of two dimensional reconsturcted hits.
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
double getRecoDriftLengthVariance() const
Returns the drift length variance next to the reconstructed position.
double calcArcLength2DBetween(const Vector2D &fromPoint, const Vector2D &toPoint) const
Calculate the travel distance between the two given positions Returns the travel distance on the traj...
Class representing a two dimensional reconstructed hit in the central drift chamber.
ERightLeft getRLInfo() const
Getter for the right left passage information.
Class representing a pair of reconstructed axial segements in adjacent superlayer.
Abstract base class for different kinds of events.
Vector2D getBackPos2D() const
Get the postion of the first observation.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
double getDriftLength(int iObservation) const
Getter for the signed drift radius of the observation at the given index.
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.
Class representing a triple of neighboring oriented wire with additional trajectory information.
double x() const
Getter for the x coordinate.
A pair of oriented wire hits.
const Vector2D & getRefPos2D() const
The two dimensional reference position of the underlying wire.
Class representing a sense wire in the central drift chamber.
A reconstructed sequence of two dimensional hits in one super layer.
double getSignedRecoDriftLength() const
Returns the drift length next to the reconstructed position.
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
std::size_t getNObservationsWithDriftRadius() const
Returns the number of observations having a drift radius radius.
Vector2D centralize()
Picks one observation as a reference point and transform all observations to that new origin.
Vector2D getFrontPos2D() const
Get the postion of the first observation.
Class representing a hit wire in the central drift chamber.
static double getPseudoDriftLengthVariance(double driftLength, double driftLengthVariance)
Gets the pseudo variance.
static constexpr const double c_simpleDriftLengthVariance
A default value for the drift length variance if no variance from the drift length translation is ava...
std::size_t fill(double x, double y, double signedRadius=0.0, double weight=1.0)
Appends the observed position.
EFitPos m_fitPos
Indicator which positional information should preferably be extracted from hits in calls to append.
double getSignedRefDriftLength() const
Getter for the drift length at the wire reference position signed with the right left passage hypothe...
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
EFitVariance m_fitVariance
Indicator which variance information should preferably be extracted from hits in calls to append.
Vector2D getCentralPoint() const
Extracts the observation center that is at the index in the middle.
CDCRecoHit2D getEndRecoHit2D() const
Getter for the third reconstucted hit.
ERightLeft getRLInfo() const
Getter for the right left passage information.
std::size_t append(const CDCWireHit &wireHit, ERightLeft rlInfo=ERightLeft::c_Unknown)
Appends the hit circle at wire reference position without a right left passage hypotheses.