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 Vector2D &pos2D, double signedRadius=0.0, double weight=1.0)
 Appends the observed position.
 
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.
 
std::size_t append (const CDCWireHit *wireHit, ERightLeft rlInfo=ERightLeft::c_Unknown)
 Appends the position information of the given wire hit to the stored observations.
 
std::size_t append (const CDCRLWireHit &rlWireHit)
 Appends the hit circle at wire reference position with a right left passage hypotheses.
 
std::size_t append (const CDCRLWireHitPair &rlWireHitPair)
 Appends the two observed position.
 
std::size_t append (const CDCRLWireHitTriple &rlWireHitTriple)
 Appends the three observed position.
 
std::size_t append (const CDCFacet &facet)
 Appends the three observed position.
 
std::size_t append (const CDCRecoHit2D &recoHit2D)
 Appends the hit using the reconstructed position if useRecoPos indicates it.
 
std::size_t append (const CDCRecoHit3D &recoHit3D)
 Appends the observed position.
 
std::size_t appendRange (const CDCSegment2D &segment2D)
 Appends all reconstructed hits from the two dimensional segment.
 
std::size_t appendRange (const CDCSegment3D &segment3D)
 Appends all reconstructed hits from the three dimensional segment.
 
std::size_t appendRange (const CDCAxialSegmentPair &axialSegmentPair)
 Appends all reconstructed hits from the two axial segments,.
 
std::size_t appendRange (const CDCTrack &track)
 Appends all reconstructed hits from the three dimensional track.
 
std::size_t appendRange (const std::vector< const CDCWire * > &wires)
 Appends all the reference wire positions.
 
std::size_t appendRange (const 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.
 
Vector2D getFrontPos2D () const
 Get the position of the first observation.
 
Vector2D getBackPos2D () const
 Get the position of the first observation.
 
double getTotalPerpS (const 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 CDCTrajectory2D &trajectory2D) const
 Checks if the last position of these observations lies at greater travel distance than the first.
 
EForwardBackward isCoaligned (const CDCTrajectory2D &trajectory2D) const
 Checks if the last observation in the vector lies at greater or lower travel distance than the last observation.
 
Vector2D getCentralPoint () const
 Extracts the observation center that is at the index in the middle.
 
void passiveMoveBy (const Vector2D &origin)
 Moves all observations passively such that the given vector becomes to origin of the new coordinate system.
 
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 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 43 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 50 of file CDCObservations2D.h.

52 : m_fitPos(fitPos)
53 , m_fitVariance(fitVariance)
54 {
55 }
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.

Member Function Documentation

◆ append() [1/8]

std::size_t append ( const CDCFacet facet)

Appends the three observed position.

Definition at line 154 of file CDCObservations2D.cc.

155{
156 if (m_fitPos == EFitPos::c_RecoPos) {
157 return append(facet.getStartRecoHit2D()) + append(facet.getMiddleRecoHit2D()) +
158 append(facet.getEndRecoHit2D());
159 } else {
160 const CDCRLWireHitTriple& rlWireHitTriple = facet;
161 return append(rlWireHitTriple);
162 }
163}
CDCRecoHit2D getEndRecoHit2D() const
Getter for the third reconstructed hit.
Definition: CDCFacet.cc:120
CDCRecoHit2D getMiddleRecoHit2D() const
Getter for the second reconstructed hit.
Definition: CDCFacet.cc:115
CDCRecoHit2D getStartRecoHit2D() const
Getter for the first reconstructed hit.
Definition: CDCFacet.cc:110
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.
Class representing a triple of neighboring wire hits.

◆ append() [2/8]

std::size_t append ( const CDCRecoHit2D recoHit2D)

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

Definition at line 165 of file CDCObservations2D.cc.

166{
167 Vector2D fitPos2D;
168 double signedDriftLength = 0;
169 if (m_fitPos == EFitPos::c_RecoPos) {
170 fitPos2D = recoHit2D.getRecoPos2D();
171 signedDriftLength = 0;
172
173 // Fall back to the rl circle in case position is not setup
174 if (fitPos2D.hasNAN()) {
175 fitPos2D = recoHit2D.getWire().getRefPos2D();
176 signedDriftLength = recoHit2D.getSignedRefDriftLength();
177 }
178
179 } else if (m_fitPos == EFitPos::c_RLDriftCircle) {
180 fitPos2D = recoHit2D.getWire().getRefPos2D();
181 signedDriftLength = recoHit2D.getSignedRefDriftLength();
182 } else if (m_fitPos == EFitPos::c_WirePos) {
183 fitPos2D = recoHit2D.getWire().getRefPos2D();
184 signedDriftLength = 0;
185 }
186
187 const double driftLength = recoHit2D.getRefDriftLength();
188 const ERightLeft rlInfo = recoHit2D.getRLInfo();
189
190 double variance = recoHit2D.getRefDriftLengthVariance();
191 if (m_fitVariance == EFitVariance::c_Unit) {
192 variance = 1;
193 } else if (m_fitVariance == EFitVariance::c_Nominal) {
195 } else if (m_fitVariance == EFitVariance::c_DriftLength) {
196 variance = std::fabs(driftLength);
197 } else if (m_fitVariance == EFitVariance::c_Pseudo or abs(rlInfo) != 1) {
198 // Fall back to the pseudo variance if the rl information is not known
199 variance = getPseudoDriftLengthVariance(driftLength, variance);
200 } else if (m_fitVariance == EFitVariance::c_Proper) {
201 variance = recoHit2D.getRefDriftLengthVariance();
202 }
203 return fill(fitPos2D, signedDriftLength, 1 / variance);
204}
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.
double getRefDriftLengthVariance() const
Getter for the uncertainty in the drift length at the wire reference position.
Definition: CDCRecoHit2D.h:232
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
Definition: CDCRecoHit2D.h:217
const CDCWire & getWire() const
Getter for the wire the reconstructed hit associated to.
Definition: CDCRecoHit2D.h:175
double getSignedRefDriftLength() const
Getter for the drift length at the wire reference position signed with the right left passage hypothe...
Definition: CDCRecoHit2D.h:226
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
Definition: CDCRecoHit2D.h:238
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRecoHit2D.h:205
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:64
const Vector2D & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition: CDCWire.h:229
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
bool hasNAN() const
Checks if one of the coordinates is NAN.
Definition: Vector2D.h:149
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:25

◆ append() [3/8]

std::size_t append ( const CDCRecoHit3D recoHit3D)

Appends the observed position.

Definition at line 206 of file CDCObservations2D.cc.

207{
208 Vector2D fitPos2D = recoHit3D.getRecoPos2D();
209 double signedDriftLength = 0;
210 if (m_fitPos == EFitPos::c_RecoPos) {
211 fitPos2D = recoHit3D.getRecoPos2D();
212 signedDriftLength = 0;
213 } else if (m_fitPos == EFitPos::c_RLDriftCircle) {
214 fitPos2D = recoHit3D.getRecoWirePos2D();
215 signedDriftLength = recoHit3D.getSignedRecoDriftLength();
216 } else if (m_fitPos == EFitPos::c_WirePos) {
217 fitPos2D = recoHit3D.getRecoWirePos2D();
218 signedDriftLength = 0;
219 }
220
221 const double driftLength = std::fabs(recoHit3D.getSignedRecoDriftLength());
222 const ERightLeft rlInfo = recoHit3D.getRLInfo();
223
224 double variance = recoHit3D.getRecoDriftLengthVariance();
225 if (m_fitVariance == EFitVariance::c_Unit) {
226 variance = 1;
227 } else if (m_fitVariance == EFitVariance::c_Nominal) {
229 } else if (m_fitVariance == EFitVariance::c_DriftLength) {
230 variance = std::fabs(driftLength);
231 } else if (m_fitVariance == EFitVariance::c_Pseudo or abs(rlInfo) != 1) {
232 // Fall back to the pseudo variance if the rl information is not known
233 variance = getPseudoDriftLengthVariance(driftLength, variance);
234 } else if (m_fitVariance == EFitVariance::c_Proper) {
235 variance = recoHit3D.getRecoDriftLengthVariance();
236 }
237 return fill(fitPos2D, signedDriftLength, 1 / variance);
238}
double getSignedRecoDriftLength() const
Returns the drift length next to the reconstructed position.
Definition: CDCRecoHit3D.h:346
const Vector2D & getRecoPos2D() const
Getter for the 2d position of the hit.
Definition: CDCRecoHit3D.h:297
Vector2D getRecoWirePos2D() const
Returns the position of the wire in the xy plain the reconstructed position is located in.
double getRecoDriftLengthVariance() const
Returns the drift length variance next to the reconstructed position.
Definition: CDCRecoHit3D.h:358
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRecoHit3D.h:267

◆ append() [4/8]

std::size_t append ( const 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 107 of file CDCObservations2D.cc.

108{
109 const ERightLeft rlInfo = rlWireHit.getRLInfo();
110
111 const double driftLength = rlWireHit.getRefDriftLength();
112 const double driftLengthVariance = rlWireHit.getRefDriftLengthVariance();
113
114 const Vector2D& wireRefPos2D = rlWireHit.getRefPos2D();
115
116 double signedDriftLength = 0;
117 if (m_fitPos == EFitPos::c_RLDriftCircle and isValid(rlInfo)) {
118 signedDriftLength = static_cast<double>(rlInfo) * driftLength;
119 } else {
120 signedDriftLength = 0;
121 }
122
123 double variance = 1;
124 if (m_fitVariance == EFitVariance::c_Unit) {
125 variance = 1;
126 } else if (m_fitVariance == EFitVariance::c_Nominal) {
128 } else if (m_fitVariance == EFitVariance::c_DriftLength) {
129 variance = fabs(driftLength);
130 } else if (m_fitVariance == EFitVariance::c_Pseudo) {
131 variance = getPseudoDriftLengthVariance(driftLength, driftLengthVariance);
132 } else if (m_fitVariance == EFitVariance::c_Proper) {
133 if (abs(rlInfo) != 1) {
134 variance = getPseudoDriftLengthVariance(driftLength, driftLengthVariance);
135 } else {
136 variance = driftLengthVariance;
137 }
138 }
139
140 return fill(wireRefPos2D, signedDriftLength, 1 / variance);
141}
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:222
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:204
const Vector2D & getRefPos2D() const
The two dimensional reference position of the underlying wire.
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:234
bool isValid(EForwardBackward eForwardBackward)
Check whether the given enum instance is one of the valid values.

◆ append() [5/8]

std::size_t append ( const CDCRLWireHitPair rlWireHitPair)

Appends the two observed position.

Definition at line 143 of file CDCObservations2D.cc.

144{
145 return append(rlWireHitPair.getFromRLWireHit()) + append(rlWireHitPair.getToRLWireHit());
146}
CDCRLWireHit & getToRLWireHit()
Getter for the second oriented wire hit.
CDCRLWireHit & getFromRLWireHit()
Getter for the first oriented wire hit.

◆ append() [6/8]

std::size_t append ( const CDCRLWireHitTriple rlWireHitTriple)

Appends the three observed position.

Definition at line 148 of file CDCObservations2D.cc.

149{
150 return append(rlWireHitTriple.getStartRLWireHit()) +
151 append(rlWireHitTriple.getMiddleRLWireHit()) + append(rlWireHitTriple.getEndRLWireHit());
152}
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.

◆ append() [7/8]

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.

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 67 of file CDCObservations2D.cc.

68{
69 const Vector2D& wireRefPos2D = wireHit.getRefPos2D();
70
71 double signedDriftLength = 0;
72 if (m_fitPos == EFitPos::c_RLDriftCircle and isValid(rlInfo)) {
73 signedDriftLength = static_cast<double>(rlInfo) * wireHit.getRefDriftLength();
74 } else {
75 signedDriftLength = 0;
76 }
77
78 double variance = 1;
79 if (m_fitVariance == EFitVariance::c_Unit) {
80 variance = 1;
81 } else if (m_fitVariance == EFitVariance::c_Nominal) {
83 } else if (m_fitVariance == EFitVariance::c_DriftLength) {
84 const double driftLength = wireHit.getRefDriftLength();
85 variance = fabs(driftLength);
86 } else if (m_fitVariance == EFitVariance::c_Pseudo) {
87 variance = getPseudoDriftLengthVariance(wireHit);
88 } else if (m_fitVariance == EFitVariance::c_Proper) {
89 if (abs(rlInfo) != 1) {
90 variance = getPseudoDriftLengthVariance(wireHit);
91 } else {
92 variance = wireHit.getRefDriftLengthVariance();
93 }
94 }
95 return fill(wireRefPos2D, signedDriftLength, 1 / variance);
96}
double getRefDriftLengthVariance() const
Getter for the variance of the drift length at the reference position of the wire.
Definition: CDCWireHit.h:230
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCWireHit.h:224
const Vector2D & getRefPos2D() const
The two dimensional reference position (z=0) of the underlying wire.
Definition: CDCWireHit.cc:212

◆ append() [8/8]

std::size_t append ( const CDCWireHit wireHit,
ERightLeft  rlInfo = 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 98 of file CDCObservations2D.cc.

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

◆ appendRange() [1/7]

std::size_t appendRange ( const ARange &  range)
inline

Append all hits from a generic range.

Definition at line 252 of file CDCObservations2D.h.

253 {
254 std::size_t nAppendedHits = 0;
255 using std::begin;
256 using std::end;
257 for (const auto& item : range) {
258 nAppendedHits += append(item);
259 }
260 return nAppendedHits;
261 }

◆ appendRange() [2/7]

std::size_t appendRange ( const CDCAxialSegmentPair axialSegmentPair)

Appends all reconstructed hits from the two axial segments,.

Returns
Number of added hits

Definition at line 258 of file CDCObservations2D.cc.

259{
260 std::size_t nAppendedHits = 0;
261 const CDCSegment2D* ptrStartSegment2D = axialSegmentPair.getStartSegment();
262 if (ptrStartSegment2D) {
263 const CDCSegment2D& startSegment2D = *ptrStartSegment2D;
264 nAppendedHits += appendRange(startSegment2D);
265 }
266
267 const CDCSegment2D* ptrEndSegment2D = axialSegmentPair.getEndSegment();
268 if (ptrEndSegment2D) {
269 const CDCSegment2D& endSegment2D = *ptrEndSegment2D;
270 nAppendedHits += appendRange(endSegment2D);
271 }
272 return nAppendedHits;
273}
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
std::size_t appendRange(const CDCSegment2D &segment2D)
Appends all reconstructed hits from the two dimensional segment.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39

◆ appendRange() [3/7]

std::size_t appendRange ( const CDCSegment2D segment2D)

Appends all reconstructed hits from the two dimensional segment.

Returns
Number of added hits

Definition at line 240 of file CDCObservations2D.cc.

241{
242 std::size_t nAppendedHits = 0;
243 for (const CDCRecoHit2D& recoHit2D : segment2D) {
244 nAppendedHits += append(recoHit2D);
245 }
246 return nAppendedHits;
247}
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47

◆ appendRange() [4/7]

std::size_t appendRange ( const CDCSegment3D segment3D)

Appends all reconstructed hits from the three dimensional segment.

Returns
Number of added hits

Definition at line 249 of file CDCObservations2D.cc.

250{
251 std::size_t nAppendedHits = 0;
252 for (const CDCRecoHit3D& recoHit3D : segment3D) {
253 nAppendedHits += append(recoHit3D);
254 }
255 return nAppendedHits;
256}
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52

◆ appendRange() [5/7]

std::size_t appendRange ( const CDCTrack track)

Appends all reconstructed hits from the three dimensional track.

Returns
Number of added hits

Definition at line 275 of file CDCObservations2D.cc.

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

◆ appendRange() [6/7]

std::size_t appendRange ( const 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 298 of file CDCObservations2D.cc.

299{
300 std::size_t nAppendedHits = 0;
301 for (const CDCWireHit* ptrWireHit : wireHits) {
302 if (not ptrWireHit) continue;
303 const CDCWireHit& wireHit = *ptrWireHit;
304 nAppendedHits += append(wireHit);
305 }
306 return nAppendedHits;
307}
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55

◆ appendRange() [7/7]

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

Appends all the reference wire positions.

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

Definition at line 284 of file CDCObservations2D.cc.

285{
286 std::size_t nAppendedHits = 0;
287 for (const CDCWire* ptrWire : wires) {
288 if (not ptrWire) continue;
289 const CDCWire& wire = *ptrWire;
290 const Vector2D& wirePos = wire.getRefPos2D();
291 const double driftLength = 0.0;
292 const double weight = 1.0;
293 nAppendedHits += fill(wirePos, driftLength, weight);
294 }
295 return nAppendedHits;
296}
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58

◆ centralize()

Vector2D centralize ( )

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

Definition at line 352 of file CDCObservations2D.cc.

353{
354 // Pick an observation at the center
355 Vector2D centralPoint = getCentralPoint();
356 passiveMoveBy(centralPoint);
357 return centralPoint;
358}
Vector2D getCentralPoint() const
Extracts the observation center that is at the index in the middle.
void passiveMoveBy(const 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 96 of file CDCObservations2D.h.

97 {
98 m_observations.clear();
99 }
std::vector< double > m_observations
Memory for the individual observations.

◆ data()

double * data ( )
inline

Return the pointer to the number buffer.

Definition at line 84 of file CDCObservations2D.h.

85 {
86 return m_observations.data();
87 }

◆ empty()

bool empty ( ) const
inline

Returns true if there are no observations stored.

Definition at line 90 of file CDCObservations2D.h.

91 {
92 return m_observations.empty();
93 }

◆ fill() [1/2]

std::size_t fill ( const 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 62 of file CDCObservations2D.cc.

63{
64 return fill(pos2D.x(), pos2D.y(), signedRadius, weight);
65}
double x() const
Getter for the x coordinate.
Definition: Vector2D.h:595
double y() const
Getter for the y coordinate.
Definition: Vector2D.h:605

◆ 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 39 of file CDCObservations2D.cc.

40{
41 if (std::isnan(x)) return 0;
42 if (std::isnan(y)) return 0;
43
44 if (std::isnan(signedRadius)) {
45 B2WARNING("Signed radius is nan. Skipping observation");
46 return 0;
47 }
48
49 if (std::isnan(weight)) {
50 B2WARNING("Weight is nan. Skipping observation");
51 return 0;
52 }
53
54 m_observations.push_back(x);
55 m_observations.push_back(y);
56 m_observations.push_back(signedRadius);
57 m_observations.push_back(weight);
58 return 1;
59}

◆ getBackPos2D()

Vector2D getBackPos2D ( ) const
inline

Get the position of the first observation.

Definition at line 270 of file CDCObservations2D.h.

271 {
272 return empty() ? Vector2D() : Vector2D(getX(size() - 1), getY(size() - 1));
273 }
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.
bool empty() const
Returns true if there are no observations stored.
std::size_t size() const
Returns the number of observations stored.

◆ getCentralPoint()

Vector2D getCentralPoint ( ) const

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

Definition at line 328 of file CDCObservations2D.cc.

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

◆ getDriftLength()

double getDriftLength ( int  iObservation) const
inline

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

Definition at line 120 of file CDCObservations2D.h.

121 {
122 return m_observations[iObservation * 4 + 2];
123 }

◆ getFitPos()

EFitPos getFitPos ( ) const
inline

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

Definition at line 314 of file CDCObservations2D.h.

315 {
316 return m_fitPos;
317 }

◆ getFrontPos2D()

Vector2D getFrontPos2D ( ) const
inline

Get the position of the first observation.

Definition at line 264 of file CDCObservations2D.h.

265 {
266 return empty() ? Vector2D() : Vector2D(getX(0), getY(0));
267 }

◆ getNObservationsWithDriftRadius()

std::size_t getNObservationsWithDriftRadius ( ) const

Returns the number of observations having a drift radius radius.

Definition at line 314 of file CDCObservations2D.cc.

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

◆ getPseudoDriftLengthVariance() [1/2]

double getPseudoDriftLengthVariance ( const CDCWireHit wireHit)
static

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

Definition at line 32 of file CDCObservations2D.cc.

33{
36}

◆ 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 68 of file CDCObservations2D.h.

70 {
71 return driftLength * driftLength + driftLengthVariance;
72 }

◆ getTotalPerpS()

double getTotalPerpS ( const 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 309 of file CDCObservations2D.cc.

310{
311 return trajectory2D.calcArcLength2DBetween(getFrontPos2D(), getBackPos2D());
312}
Vector2D getBackPos2D() const
Get the position of the first observation.
Vector2D getFrontPos2D() const
Get the position of the first observation.
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...

◆ getWeight()

double getWeight ( int  iObservation) const
inline

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

Definition at line 126 of file CDCObservations2D.h.

127 {
128 return m_observations[iObservation * 4 + 3];
129 }

◆ getX()

double getX ( int  iObservation) const
inline

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

Definition at line 108 of file CDCObservations2D.h.

109 {
110 return m_observations[iObservation * 4];
111 }

◆ getY()

double getY ( int  iObservation) const
inline

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

Definition at line 114 of file CDCObservations2D.h.

115 {
116 return m_observations[iObservation * 4 + 1];
117 }

◆ isCoaligned()

EForwardBackward isCoaligned ( const 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 295 of file CDCObservations2D.h.

296 {
297 return static_cast<EForwardBackward>(sign(getTotalPerpS(trajectory2D)));
298 }
double getTotalPerpS(const CDCTrajectory2D &trajectory2D) const
Calculate the total transverse travel distance traversed by these observations comparing the travel d...
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.

◆ isForwardTrajectory()

bool isForwardTrajectory ( const CDCTrajectory2D trajectory2D) const
inline

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

Definition at line 285 of file CDCObservations2D.h.

286 {
287 return getTotalPerpS(trajectory2D) > 0.0;
288 }

◆ passiveMoveBy()

void passiveMoveBy ( const Vector2D origin)

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

Definition at line 345 of file CDCObservations2D.cc.

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

◆ reserve()

void reserve ( std::size_t  nObservations)
inline

Reserves enough space for nObservations.

Definition at line 102 of file CDCObservations2D.h.

103 {
104 m_observations.reserve(nObservations * 4);
105 }

◆ setFitPos()

void setFitPos ( EFitPos  fitPos)
inline

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

Definition at line 320 of file CDCObservations2D.h.

321 {
322 m_fitPos = fitPos;
323 }

◆ setFitVariance()

void setFitVariance ( EFitVariance  fitVariance)
inline

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

Definition at line 326 of file CDCObservations2D.h.

327 {
328 m_fitVariance = fitVariance;
329 }

◆ size()

std::size_t size ( ) const
inline

Returns the number of observations stored.

Definition at line 78 of file CDCObservations2D.h.

79 {
80 return m_observations.size() / 4;
81 }

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 343 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 350 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 336 of file CDCObservations2D.h.


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