Belle II Software development
CDCObservations2D Class Reference

Class serving as a storage of observed drift circles to present to the Riemann fitter. More...

#include <CDCObservations2D.h>

Public Member Functions

 CDCObservations2D (EFitPos fitPos=EFitPos::c_RecoPos, EFitVariance fitVariance=EFitVariance::c_Proper)
 Constructor taking the flag if the reconstructed position of the hits should be used when they are available The default is to use the wire position and the drift length signed by the right left passage hypotheses.
 
std::size_t size () const
 Returns the number of observations stored.
 
double * data ()
 Return the pointer to the number buffer.
 
bool empty () const
 Returns true if there are no observations stored.
 
void clear ()
 Removes all observations stored.
 
void reserve (std::size_t nObservations)
 Reserves enough space for nObservations.
 
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.
 
double getDriftLength (int iObservation) const
 Getter for the signed drift radius of the observation at the given index.
 
double getWeight (int iObservation) const
 Getter for the weight / inverse variance of the observation at the given index.
 
std::size_t fill (double x, double y, double signedRadius=0.0, double weight=1.0)
 Appends the observed position.
 
std::size_t fill (const TrackingUtilities::Vector2D &pos2D, double signedRadius=0.0, double weight=1.0)
 Appends the observed position.
 
std::size_t append (const TrackingUtilities::CDCWireHit &wireHit, TrackingUtilities::ERightLeft rlInfo=TrackingUtilities::ERightLeft::c_Unknown)
 Appends the hit circle at wire reference position without a right left passage hypotheses.
 
std::size_t append (const TrackingUtilities::CDCWireHit *wireHit, TrackingUtilities::ERightLeft rlInfo=TrackingUtilities::ERightLeft::c_Unknown)
 Appends the position information of the given wire hit to the stored observations.
 
std::size_t append (const TrackingUtilities::CDCRLWireHit &rlWireHit)
 Appends the hit circle at wire reference position with a right left passage hypotheses.
 
std::size_t append (const TrackingUtilities::CDCRLWireHitPair &rlWireHitPair)
 Appends the two observed position.
 
std::size_t append (const TrackingUtilities::CDCRLWireHitTriple &rlWireHitTriple)
 Appends the three observed position.
 
std::size_t append (const TrackingUtilities::CDCFacet &facet)
 Appends the three observed position.
 
std::size_t append (const TrackingUtilities::CDCRecoHit2D &recoHit2D)
 Appends the hit using the reconstructed position if useRecoPos indicates it.
 
std::size_t append (const TrackingUtilities::CDCRecoHit3D &recoHit3D)
 Appends the observed position.
 
std::size_t appendRange (const TrackingUtilities::CDCSegment2D &segment2D)
 Appends all reconstructed hits from the two dimensional segment.
 
std::size_t appendRange (const TrackingUtilities::CDCSegment3D &segment3D)
 Appends all reconstructed hits from the three dimensional segment.
 
std::size_t appendRange (const TrackingUtilities::CDCAxialSegmentPair &axialSegmentPair)
 Appends all reconstructed hits from the two axial segments,.
 
std::size_t appendRange (const TrackingUtilities::CDCTrack &track)
 Appends all reconstructed hits from the three dimensional track.
 
std::size_t appendRange (const std::vector< const CDC::CDCWire * > &wires)
 Appends all the reference wire positions.
 
std::size_t appendRange (const TrackingUtilities::CDCWireHitSegment &wireHits)
 Appends all the wire hit reference positions with the pseudo variance.
 
template<class ARange>
std::size_t appendRange (const ARange &range)
 Append all hits from a generic range.
 
TrackingUtilities::Vector2D getFrontPos2D () const
 Get the position of the first observation.
 
TrackingUtilities::Vector2D getBackPos2D () const
 Get the position of the first observation.
 
double getTotalPerpS (const TrackingUtilities::CDCTrajectory2D &trajectory2D) const
 Calculate the total transverse travel distance traversed by these observations comparing the travel distance of first and last position.
 
bool isForwardTrajectory (const TrackingUtilities::CDCTrajectory2D &trajectory2D) const
 Checks if the last position of these observations lies at greater travel distance than the first.
 
TrackingUtilities::EForwardBackward isCoaligned (const TrackingUtilities::CDCTrajectory2D &trajectory2D) const
 Checks if the last observation in the vector lies at greater or lower travel distance than the last observation.
 
TrackingUtilities::Vector2D getCentralPoint () const
 Extracts the observation center that is at the index in the middle.
 
void passiveMoveBy (const TrackingUtilities::Vector2D &origin)
 Moves all observations passively such that the given vector becomes to origin of the new coordinate system.
 
TrackingUtilities::Vector2D centralize ()
 Picks one observation as a reference point and transform all observations to that new origin.
 
std::size_t getNObservationsWithDriftRadius () const
 Returns the number of observations having a drift radius radius.
 
EFitPos getFitPos () const
 Getter for the indicator that the reconstructed position should be favoured.
 
void setFitPos (EFitPos fitPos)
 Setter for the indicator that the reconstructed position should be favoured.
 
void setFitVariance (EFitVariance fitVariance)
 Setter for the indicator that the drift variance should be used.
 

Static Public Member Functions

static double getPseudoDriftLengthVariance (double driftLength, double driftLengthVariance)
 Gets the pseudo variance.
 
static double getPseudoDriftLengthVariance (const TrackingUtilities::CDCWireHit &wireHit)
 Calculate the pseudo variance from the drift length and its variance.
 

Private Attributes

std::vector< double > m_observations
 Memory for the individual observations.
 
EFitPos m_fitPos
 Indicator which positional information should preferably be extracted from hits in calls to append.
 
EFitVariance m_fitVariance
 Indicator which variance information should preferably be extracted from hits in calls to append.
 

Detailed Description

Class serving as a storage of observed drift circles to present to the Riemann fitter.

Definition at line 48 of file CDCObservations2D.h.

Constructor & Destructor Documentation

◆ CDCObservations2D()

CDCObservations2D ( EFitPos fitPos = EFitPos::c_RecoPos,
EFitVariance fitVariance = EFitVariance::c_Proper )
inlineexplicit

Constructor taking the flag if the reconstructed position of the hits should be used when they are available The default is to use the wire position and the drift length signed by the right left passage hypotheses.

Definition at line 55 of file CDCObservations2D.h.

57 : m_fitPos(fitPos)
58 , m_fitVariance(fitVariance)
59 {
60 }

Member Function Documentation

◆ append() [1/8]

std::size_t append ( const TrackingUtilities::CDCFacet & facet)

Appends the three observed position.

Definition at line 156 of file CDCObservations2D.cc.

157{
158 if (m_fitPos == EFitPos::c_RecoPos) {
159 return append(facet.getStartRecoHit2D()) + append(facet.getMiddleRecoHit2D()) +
160 append(facet.getEndRecoHit2D());
161 } else {
162 const CDCRLWireHitTriple& rlWireHitTriple = facet;
163 return append(rlWireHitTriple);
164 }
165}
EFitPos m_fitPos
Indicator which positional information should preferably be extracted from hits in calls to append.
std::size_t append(const TrackingUtilities::CDCWireHit &wireHit, TrackingUtilities::ERightLeft rlInfo=TrackingUtilities::ERightLeft::c_Unknown)
Appends the hit circle at wire reference position without a right left passage hypotheses.

◆ append() [2/8]

std::size_t append ( const TrackingUtilities::CDCRecoHit2D & recoHit2D)

Appends the hit using the reconstructed position if useRecoPos indicates it.

Definition at line 167 of file CDCObservations2D.cc.

168{
169 Vector2D fitPos2D;
170 double signedDriftLength = 0;
171 if (m_fitPos == EFitPos::c_RecoPos) {
172 fitPos2D = recoHit2D.getRecoPos2D();
173 signedDriftLength = 0;
174
175 // Fall back to the rl circle in case position is not setup
176 if (fitPos2D.hasNAN()) {
177 fitPos2D = recoHit2D.getWire().getRefPos2D();
178 signedDriftLength = recoHit2D.getSignedRefDriftLength();
179 }
180
181 } else if (m_fitPos == EFitPos::c_RLDriftCircle) {
182 fitPos2D = recoHit2D.getWire().getRefPos2D();
183 signedDriftLength = recoHit2D.getSignedRefDriftLength();
184 } else if (m_fitPos == EFitPos::c_WirePos) {
185 fitPos2D = recoHit2D.getWire().getRefPos2D();
186 signedDriftLength = 0;
187 }
188
189 const double driftLength = recoHit2D.getRefDriftLength();
190 const ERightLeft rlInfo = recoHit2D.getRLInfo();
191
192 double variance = recoHit2D.getRefDriftLengthVariance();
193 if (m_fitVariance == EFitVariance::c_Unit) {
194 variance = 1;
195 } else if (m_fitVariance == EFitVariance::c_Nominal) {
197 } else if (m_fitVariance == EFitVariance::c_DriftLength) {
198 variance = std::fabs(driftLength);
199 } else if (m_fitVariance == EFitVariance::c_Pseudo or abs(rlInfo) != 1) {
200 // Fall back to the pseudo variance if the rl information is not known
201 variance = getPseudoDriftLengthVariance(driftLength, variance);
202 } else if (m_fitVariance == EFitVariance::c_Proper) {
203 variance = recoHit2D.getRefDriftLengthVariance();
204 }
205 return fill(fitPos2D, signedDriftLength, 1 / variance);
206}
static constexpr const double c_simpleDriftLengthVariance
A default value for the drift length variance if no variance from the drift length translation is ava...
Definition CDCWireHit.h:67
static double getPseudoDriftLengthVariance(double driftLength, double driftLengthVariance)
Gets the pseudo variance.
std::size_t fill(double x, double y, double signedRadius=0.0, double weight=1.0)
Appends the observed position.
EFitVariance m_fitVariance
Indicator which variance information should preferably be extracted from hits in calls to append.
bool hasNAN() const
Checks if one of the coordinates is NAN.
Definition Vector2D.h:169
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition ERightLeft.h:25

◆ append() [3/8]

std::size_t append ( const TrackingUtilities::CDCRecoHit3D & recoHit3D)

Appends the observed position.

Definition at line 208 of file CDCObservations2D.cc.

209{
210 Vector2D fitPos2D = recoHit3D.getRecoPos2D();
211 double signedDriftLength = 0;
212 if (m_fitPos == EFitPos::c_RecoPos) {
213 fitPos2D = recoHit3D.getRecoPos2D();
214 signedDriftLength = 0;
215 } else if (m_fitPos == EFitPos::c_RLDriftCircle) {
216 fitPos2D = recoHit3D.getRecoWirePos2D();
217 signedDriftLength = recoHit3D.getSignedRecoDriftLength();
218 } else if (m_fitPos == EFitPos::c_WirePos) {
219 fitPos2D = recoHit3D.getRecoWirePos2D();
220 signedDriftLength = 0;
221 }
222
223 const double driftLength = std::fabs(recoHit3D.getSignedRecoDriftLength());
224 const ERightLeft rlInfo = recoHit3D.getRLInfo();
225
226 double variance = recoHit3D.getRecoDriftLengthVariance();
227 if (m_fitVariance == EFitVariance::c_Unit) {
228 variance = 1;
229 } else if (m_fitVariance == EFitVariance::c_Nominal) {
231 } else if (m_fitVariance == EFitVariance::c_DriftLength) {
232 variance = std::fabs(driftLength);
233 } else if (m_fitVariance == EFitVariance::c_Pseudo or abs(rlInfo) != 1) {
234 // Fall back to the pseudo variance if the rl information is not known
235 variance = getPseudoDriftLengthVariance(driftLength, variance);
236 } else if (m_fitVariance == EFitVariance::c_Proper) {
237 variance = recoHit3D.getRecoDriftLengthVariance();
238 }
239 return fill(fitPos2D, signedDriftLength, 1 / variance);
240}

◆ append() [4/8]

std::size_t append ( const TrackingUtilities::CDCRLWireHit & rlWireHit)

Appends the hit circle at wire reference position with a right left passage hypotheses.

Note
Observations are skipped, if one of the contained variables is NAN.
The left right passage information is always set to the right left passage hypotheses of the give hit.
Parameters
rlWireHitHit information to be appended as observation. XY position, signed drift length and inverse variance are taken at the wire reference position.
Returns
Number of observations added. One if the observation was added. Zero if one of the given variables is NAN.

Definition at line 109 of file CDCObservations2D.cc.

110{
111 const ERightLeft rlInfo = rlWireHit.getRLInfo();
112
113 const double driftLength = rlWireHit.getRefDriftLength();
114 const double driftLengthVariance = rlWireHit.getRefDriftLengthVariance();
115
116 const Vector2D& wireRefPos2D = rlWireHit.getRefPos2D();
117
118 double signedDriftLength = 0;
119 if (m_fitPos == EFitPos::c_RLDriftCircle and isValid(rlInfo)) {
120 signedDriftLength = static_cast<double>(rlInfo) * driftLength;
121 } else {
122 signedDriftLength = 0;
123 }
124
125 double variance = 1;
126 if (m_fitVariance == EFitVariance::c_Unit) {
127 variance = 1;
128 } else if (m_fitVariance == EFitVariance::c_Nominal) {
130 } else if (m_fitVariance == EFitVariance::c_DriftLength) {
131 variance = fabs(driftLength);
132 } else if (m_fitVariance == EFitVariance::c_Pseudo) {
133 variance = getPseudoDriftLengthVariance(driftLength, driftLengthVariance);
134 } else if (m_fitVariance == EFitVariance::c_Proper) {
135 if (abs(rlInfo) != 1) {
136 variance = getPseudoDriftLengthVariance(driftLength, driftLengthVariance);
137 } else {
138 variance = driftLengthVariance;
139 }
140 }
141
142 return fill(wireRefPos2D, signedDriftLength, 1 / variance);
143}
bool isValid(EForwardBackward eForwardBackward)
Check whether the given enum instance is one of the valid values.

◆ append() [5/8]

std::size_t append ( const TrackingUtilities::CDCRLWireHitPair & rlWireHitPair)

Appends the two observed position.

Definition at line 145 of file CDCObservations2D.cc.

146{
147 return append(rlWireHitPair.getFromRLWireHit()) + append(rlWireHitPair.getToRLWireHit());
148}

◆ append() [6/8]

std::size_t append ( const TrackingUtilities::CDCRLWireHitTriple & rlWireHitTriple)

Appends the three observed position.

Definition at line 150 of file CDCObservations2D.cc.

151{
152 return append(rlWireHitTriple.getStartRLWireHit()) +
153 append(rlWireHitTriple.getMiddleRLWireHit()) + append(rlWireHitTriple.getEndRLWireHit());
154}

◆ append() [7/8]

std::size_t append ( const TrackingUtilities::CDCWireHit & wireHit,
TrackingUtilities::ERightLeft rlInfo = TrackingUtilities::ERightLeft::c_Unknown )

Appends the hit circle at wire reference position without a right left passage hypotheses.

Note
Observations are skipped, if one of the contained variables is NAN.
The left right passage information is always set to ERightLeft::c_Right, since on specific assumption can be made from the wire hit alone.
Parameters
wireHitHit information to be appended as observation. XY position, drift length and inverse variance are taken at the wire reference position.
rlInfoRight left passage information with which the drift length should be signed.
Returns
Number of observations added. One if the observation was added. Zero if one of the given variables is NAN.

Definition at line 69 of file CDCObservations2D.cc.

70{
71 const Vector2D& wireRefPos2D = wireHit.getRefPos2D();
72
73 double signedDriftLength = 0;
74 if (m_fitPos == EFitPos::c_RLDriftCircle and isValid(rlInfo)) {
75 signedDriftLength = static_cast<double>(rlInfo) * wireHit.getRefDriftLength();
76 } else {
77 signedDriftLength = 0;
78 }
79
80 double variance = 1;
81 if (m_fitVariance == EFitVariance::c_Unit) {
82 variance = 1;
83 } else if (m_fitVariance == EFitVariance::c_Nominal) {
85 } else if (m_fitVariance == EFitVariance::c_DriftLength) {
86 const double driftLength = wireHit.getRefDriftLength();
87 variance = fabs(driftLength);
88 } else if (m_fitVariance == EFitVariance::c_Pseudo) {
89 variance = getPseudoDriftLengthVariance(wireHit);
90 } else if (m_fitVariance == EFitVariance::c_Proper) {
91 if (abs(rlInfo) != 1) {
92 variance = getPseudoDriftLengthVariance(wireHit);
93 } else {
94 variance = wireHit.getRefDriftLengthVariance();
95 }
96 }
97 return fill(wireRefPos2D, signedDriftLength, 1 / variance);
98}

◆ append() [8/8]

std::size_t append ( const TrackingUtilities::CDCWireHit * wireHit,
TrackingUtilities::ERightLeft rlInfo = TrackingUtilities::ERightLeft::c_Unknown )

Appends the position information of the given wire hit to the stored observations.

Optionally includes the drift length with the given right left orientation

Parameters
wireHitHit information to be appended as observation.
rlInfoRight left passage information with which the drift length should be signed.
Returns
Number of observations added. One if the observation was added. Zero if one of the given variables is NAN.

Definition at line 100 of file CDCObservations2D.cc.

101{
102 if (wireHit) {
103 return append(*(wireHit), rlInfo);
104 } else {
105 return 0;
106 }
107}

◆ appendRange() [1/7]

template<class ARange>
std::size_t appendRange ( const ARange & range)
inline

Append all hits from a generic range.

Definition at line 259 of file CDCObservations2D.h.

260 {
261 std::size_t nAppendedHits = 0;
262 using std::begin;
263 using std::end;
264 for (const auto& item : range) {
265 nAppendedHits += append(item);
266 }
267 return nAppendedHits;
268 }

◆ appendRange() [2/7]

std::size_t appendRange ( const std::vector< const CDC::CDCWire * > & wires)

Appends all the reference wire positions.

Note
For cross check to Legendre finder.
Returns
Number of added hits

Definition at line 286 of file CDCObservations2D.cc.

287{
288 std::size_t nAppendedHits = 0;
289 for (const CDCWire* ptrWire : wires) {
290 if (not ptrWire) continue;
291 const CDCWire& wire = *ptrWire;
292 const Vector2D& wirePos = wire.getRefPos2D();
293 const double driftLength = 0.0;
294 const double weight = 1.0;
295 nAppendedHits += fill(wirePos, driftLength, weight);
296 }
297 return nAppendedHits;
298}
const ROOT::Math::XYVector & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition CDCWire.h:221

◆ appendRange() [3/7]

std::size_t appendRange ( const TrackingUtilities::CDCAxialSegmentPair & axialSegmentPair)

Appends all reconstructed hits from the two axial segments,.

Returns
Number of added hits

Definition at line 260 of file CDCObservations2D.cc.

261{
262 std::size_t nAppendedHits = 0;
263 const CDCSegment2D* ptrStartSegment2D = axialSegmentPair.getStartSegment();
264 if (ptrStartSegment2D) {
265 const CDCSegment2D& startSegment2D = *ptrStartSegment2D;
266 nAppendedHits += appendRange(startSegment2D);
267 }
268
269 const CDCSegment2D* ptrEndSegment2D = axialSegmentPair.getEndSegment();
270 if (ptrEndSegment2D) {
271 const CDCSegment2D& endSegment2D = *ptrEndSegment2D;
272 nAppendedHits += appendRange(endSegment2D);
273 }
274 return nAppendedHits;
275}
std::size_t appendRange(const TrackingUtilities::CDCSegment2D &segment2D)
Appends all reconstructed hits from the two dimensional segment.

◆ appendRange() [4/7]

std::size_t appendRange ( const TrackingUtilities::CDCSegment2D & segment2D)

Appends all reconstructed hits from the two dimensional segment.

Returns
Number of added hits

Definition at line 242 of file CDCObservations2D.cc.

243{
244 std::size_t nAppendedHits = 0;
245 for (const CDCRecoHit2D& recoHit2D : segment2D) {
246 nAppendedHits += append(recoHit2D);
247 }
248 return nAppendedHits;
249}

◆ appendRange() [5/7]

std::size_t appendRange ( const TrackingUtilities::CDCSegment3D & segment3D)

Appends all reconstructed hits from the three dimensional segment.

Returns
Number of added hits

Definition at line 251 of file CDCObservations2D.cc.

252{
253 std::size_t nAppendedHits = 0;
254 for (const CDCRecoHit3D& recoHit3D : segment3D) {
255 nAppendedHits += append(recoHit3D);
256 }
257 return nAppendedHits;
258}

◆ appendRange() [6/7]

std::size_t appendRange ( const TrackingUtilities::CDCTrack & track)

Appends all reconstructed hits from the three dimensional track.

Returns
Number of added hits

Definition at line 277 of file CDCObservations2D.cc.

278{
279 std::size_t nAppendedHits = 0;
280 for (const CDCRecoHit3D& recoHit3D : track) {
281 nAppendedHits += append(recoHit3D);
282 }
283 return nAppendedHits;
284}

◆ appendRange() [7/7]

std::size_t appendRange ( const TrackingUtilities::CDCWireHitSegment & wireHits)

Appends all the wire hit reference positions with the pseudo variance.

Note
For cross check to Legendre finder.
Returns
Number of added hits

Definition at line 300 of file CDCObservations2D.cc.

301{
302 std::size_t nAppendedHits = 0;
303 for (const CDCWireHit* ptrWireHit : wireHits) {
304 if (not ptrWireHit) continue;
305 const CDCWireHit& wireHit = *ptrWireHit;
306 nAppendedHits += append(wireHit);
307 }
308 return nAppendedHits;
309}

◆ centralize()

Vector2D centralize ( )

Picks one observation as a reference point and transform all observations to that new origin.

Definition at line 354 of file CDCObservations2D.cc.

355{
356 // Pick an observation at the center
357 Vector2D centralPoint = getCentralPoint();
358 passiveMoveBy(centralPoint);
359 return centralPoint;
360}
TrackingUtilities::Vector2D getCentralPoint() const
Extracts the observation center that is at the index in the middle.
void passiveMoveBy(const TrackingUtilities::Vector2D &origin)
Moves all observations passively such that the given vector becomes to origin of the new coordinate s...

◆ clear()

void clear ( )
inline

Removes all observations stored.

Definition at line 101 of file CDCObservations2D.h.

102 {
103 m_observations.clear();
104 }

◆ data()

double * data ( )
inline

Return the pointer to the number buffer.

Definition at line 89 of file CDCObservations2D.h.

90 {
91 return m_observations.data();
92 }

◆ empty()

bool empty ( ) const
inline

Returns true if there are no observations stored.

Definition at line 95 of file CDCObservations2D.h.

96 {
97 return m_observations.empty();
98 }

◆ fill() [1/2]

std::size_t fill ( const TrackingUtilities::Vector2D & pos2D,
double signedRadius = 0.0,
double weight = 1.0 )

Appends the observed position.

Note
Observations are skipped, if one of the given variables is NAN.
Parameters
pos2DX, Y coordinate of the center of the observed circle.
signedRadiusThe radius of the observed circle signed with right left passage hypotheses. Defaults to 0.
weightThe relative weight of the observation. In order to generate a unit less chi^2 measure the weight should be chosen as the inverse variance of the drift length. Defaults to 1.
Returns
Number of observations added. One if the observation was added. Zero if one of the given variables is NAN.

Definition at line 64 of file CDCObservations2D.cc.

65{
66 return fill(pos2D.x(), pos2D.y(), signedRadius, weight);
67}

◆ fill() [2/2]

std::size_t fill ( double x,
double y,
double signedRadius = 0.0,
double weight = 1.0 )

Appends the observed position.

Note
Observations are skipped, if one of the given variables is NAN.
Parameters
xX coordinate of the center of the observed circle.
yY coordinate of the center of the observed circle.
signedRadiusThe radius of the observed circle signed with right left passage hypotheses. Defaults to 0.
weightThe relative weight of the observation. In order to generate a unit less chi^2 measure the weight should be chosen as the inverse variance of the drift length. Defaults to 1.
Returns
Number of observations added. One if the observation was added. Zero if one of the given variables is NAN.

Definition at line 41 of file CDCObservations2D.cc.

42{
43 if (std::isnan(x)) return 0;
44 if (std::isnan(y)) return 0;
45
46 if (std::isnan(signedRadius)) {
47 B2WARNING("Signed radius is nan. Skipping observation");
48 return 0;
49 }
50
51 if (std::isnan(weight)) {
52 B2WARNING("Weight is nan. Skipping observation");
53 return 0;
54 }
55
56 m_observations.push_back(x);
57 m_observations.push_back(y);
58 m_observations.push_back(signedRadius);
59 m_observations.push_back(weight);
60 return 1;
61}
std::vector< double > m_observations
Memory for the individual observations.

◆ getBackPos2D()

TrackingUtilities::Vector2D getBackPos2D ( ) const
inline

Get the position of the first observation.

Definition at line 277 of file CDCObservations2D.h.

278 {
279 return empty() ? TrackingUtilities::Vector2D() : TrackingUtilities::Vector2D(getX(size() - 1), getY(size() - 1));
280 }

◆ getCentralPoint()

Vector2D getCentralPoint ( ) const

Extracts the observation center that is at the index in the middle.

Definition at line 330 of file CDCObservations2D.cc.

331{
332 std::size_t n = size();
333 if (n == 0) return Vector2D(NAN, NAN);
334 std::size_t i = n / 2;
335
336 if (isEven(n)) {
337 // For even number of observations use the middle one with the bigger distance from IP
338 Vector2D center1(getX(i), getY(i));
339 Vector2D center2(getX(i - 1), getY(i - 1));
340 return center1.normSquared() > center2.normSquared() ? center1 : center2;
341 } else {
342 Vector2D center1(getX(i), getY(i));
343 return center1;
344 }
345}
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.

◆ getDriftLength()

double getDriftLength ( int iObservation) const
inline

Getter for the signed drift radius of the observation at the given index.

Definition at line 125 of file CDCObservations2D.h.

126 {
127 return m_observations[iObservation * 4 + 2];
128 }

◆ getFitPos()

EFitPos getFitPos ( ) const
inline

Getter for the indicator that the reconstructed position should be favoured.

Definition at line 321 of file CDCObservations2D.h.

322 {
323 return m_fitPos;
324 }

◆ getFrontPos2D()

TrackingUtilities::Vector2D getFrontPos2D ( ) const
inline

Get the position of the first observation.

Definition at line 271 of file CDCObservations2D.h.

272 {
273 return empty() ? TrackingUtilities::Vector2D() : TrackingUtilities::Vector2D(getX(0), getY(0));
274 }

◆ getNObservationsWithDriftRadius()

std::size_t getNObservationsWithDriftRadius ( ) const

Returns the number of observations having a drift radius radius.

Definition at line 316 of file CDCObservations2D.cc.

317{
318 std::size_t result = 0;
319 Index nObservations = size();
320
321 for (Index iObservation = 0; iObservation < nObservations; ++iObservation) {
322 const double driftLength = getDriftLength(iObservation);
323 bool hasDriftLength = (driftLength != 0.0);
324 result += hasDriftLength ? 1 : 0;
325 }
326
327 return result;
328}
double getDriftLength(int iObservation) const
Getter for the signed drift radius of the observation at the given index.

◆ getPseudoDriftLengthVariance() [1/2]

double getPseudoDriftLengthVariance ( const TrackingUtilities::CDCWireHit & wireHit)
static

Calculate the pseudo variance from the drift length and its variance.

Definition at line 34 of file CDCObservations2D.cc.

35{
36 return getPseudoDriftLengthVariance(wireHit.getRefDriftLength(),
37 wireHit.getRefDriftLengthVariance());
38}

◆ getPseudoDriftLengthVariance() [2/2]

static double getPseudoDriftLengthVariance ( double driftLength,
double driftLengthVariance )
inlinestatic

Gets the pseudo variance.

The pseudo drift length variance is a measure that tries to incorporate the drift length into the fit to drift circles where the right left passage ambiguity could not be resolved. In such situations only the position of an hit can be used, however if only the position that can be determined is the wire position the information of the drift length should at least weaken the gravity of that wire in relation to the fitted trajectory. The pseudo variance is therefore the square of the drift length itself (square for unit conformity) plus its reference drift length variance.

Definition at line 73 of file CDCObservations2D.h.

75 {
76 return driftLength * driftLength + driftLengthVariance;
77 }

◆ getTotalPerpS()

double getTotalPerpS ( const TrackingUtilities::CDCTrajectory2D & trajectory2D) const

Calculate the total transverse travel distance traversed by these observations comparing the travel distance of first and last position.

Definition at line 311 of file CDCObservations2D.cc.

312{
313 return trajectory2D.calcArcLength2DBetween(getFrontPos2D(), getBackPos2D());
314}
TrackingUtilities::Vector2D getFrontPos2D() const
Get the position of the first observation.
TrackingUtilities::Vector2D getBackPos2D() const
Get the position of the first observation.

◆ getWeight()

double getWeight ( int iObservation) const
inline

Getter for the weight / inverse variance of the observation at the given index.

Definition at line 131 of file CDCObservations2D.h.

132 {
133 return m_observations[iObservation * 4 + 3];
134 }

◆ getX()

double getX ( int iObservation) const
inline

Getter for the x value of the observation at the given index.

Definition at line 113 of file CDCObservations2D.h.

114 {
115 return m_observations[iObservation * 4];
116 }

◆ getY()

double getY ( int iObservation) const
inline

Getter for the y value of the observation at the given index.

Definition at line 119 of file CDCObservations2D.h.

120 {
121 return m_observations[iObservation * 4 + 1];
122 }

◆ isCoaligned()

TrackingUtilities::EForwardBackward isCoaligned ( const TrackingUtilities::CDCTrajectory2D & trajectory2D) const
inline

Checks if the last observation in the vector lies at greater or lower travel distance than the last observation.

Return values
EForwardBackward::c_Forwardif the last observation lies behind the first.
EForwardBackward::c_Backwardif the last observation lies before the first.

Definition at line 302 of file CDCObservations2D.h.

303 {
304 return static_cast<TrackingUtilities::EForwardBackward>(TrackingUtilities::sign(getTotalPerpS(trajectory2D)));
305 }

◆ isForwardTrajectory()

bool isForwardTrajectory ( const TrackingUtilities::CDCTrajectory2D & trajectory2D) const
inline

Checks if the last position of these observations lies at greater travel distance than the first.

Definition at line 292 of file CDCObservations2D.h.

293 {
294 return getTotalPerpS(trajectory2D) > 0.0;
295 }

◆ passiveMoveBy()

void passiveMoveBy ( const TrackingUtilities::Vector2D & origin)

Moves all observations passively such that the given vector becomes to origin of the new coordinate system.

Definition at line 347 of file CDCObservations2D.cc.

348{
349 Eigen::Matrix<double, 1, 2> eigenOrigin(origin.x(), origin.y());
350 EigenObservationMatrix eigenObservations = getEigenObservationMatrix(this);
351 eigenObservations.leftCols<2>().rowwise() -= eigenOrigin;
352}

◆ reserve()

void reserve ( std::size_t nObservations)
inline

Reserves enough space for nObservations.

Definition at line 107 of file CDCObservations2D.h.

108 {
109 m_observations.reserve(nObservations * 4);
110 }

◆ setFitPos()

void setFitPos ( EFitPos fitPos)
inline

Setter for the indicator that the reconstructed position should be favoured.

Definition at line 327 of file CDCObservations2D.h.

328 {
329 m_fitPos = fitPos;
330 }

◆ setFitVariance()

void setFitVariance ( EFitVariance fitVariance)
inline

Setter for the indicator that the drift variance should be used.

Definition at line 333 of file CDCObservations2D.h.

334 {
335 m_fitVariance = fitVariance;
336 }

◆ size()

std::size_t size ( ) const
inline

Returns the number of observations stored.

Definition at line 83 of file CDCObservations2D.h.

84 {
85 return m_observations.size() / 4;
86 }

Member Data Documentation

◆ m_fitPos

EFitPos m_fitPos
private

Indicator which positional information should preferably be extracted from hits in calls to append.

Meaning of the constants detailed in EFitPos.

Definition at line 350 of file CDCObservations2D.h.

◆ m_fitVariance

EFitVariance m_fitVariance
private

Indicator which variance information should preferably be extracted from hits in calls to append.

Meaning of the constants detailed in EFitVariance.

Definition at line 357 of file CDCObservations2D.h.

◆ m_observations

std::vector<double> m_observations
private

Memory for the individual observations.

Arrangement of values is x,y, drift radius, weight, x, y, .....

Definition at line 343 of file CDCObservations2D.h.


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