12 #include "tracking/vxdCaTracking/TwoHitFilters.h"
13 #include "tracking/vxdCaTracking/FilterExceptions.h"
14 #include <framework/logging/Logger.h>
44 ThreeHitFilters(
const TVector3& outerHit,
const TVector3& centerHit,
const TVector3& innerHit,
45 const double magneticFieldStrength = 1.5):
66 void resetValues(
const TVector3& outerHit,
const TVector3& centerHit,
const TVector3& innerHit)
117 angle = (angle * (180. / M_PI));
136 angle = (angle * (180. / M_PI));
158 angle = (angle * (180. / M_PI));
218 double alfaAB =
fullAngle2D(points2hitA, points2hitB);
219 double alfaBC =
fullAngle2D(points2hitB, points2hitC);
221 return (alfaAB *
m_vecBC[2]) - (alfaBC *
250 double alfaAB =
calcAngle2D(points2hitA, points2hitB);
251 double alfaBC =
calcAngle2D(points2hitB, points2hitC);
266 double angle = ((vecA[0] * vecB[0] + vecA[1] * vecB[1]) / sqrt(vecA.Perp2() * vecB.Perp2()));
282 double calcRadius(
const TVector3& a,
const TVector3& b,
const TVector3& c,
const TVector3& circleCenter)
284 return ((circleCenter - a).Perp() + (circleCenter - b).Perp() + (circleCenter - c).Perp()) /
291 void calcCircleCenter(
const TVector3& a,
const TVector3& b,
const TVector3& c, TVector3& circleCenter)
295 double inX = b[0] - c[0];
296 double inY = b[1] - c[1];
297 double outX = a[0] - b[0];
298 double outY = a[1] - b[1];
305 double b1 = b[0] + outX * 0.5 - (c[0] + inX * 0.5);
306 double b2 = b[1] + outY * 0.5 - (c[1] + inY * 0.5);
308 if (a11 * a22 == a12 * a21) {
throw FilterExceptions::Straight_Line(); }
310 double s = (b1 * a22 - b2 * a21) / (a11 * a22 - a12 * a21);
312 circleCenter.SetXYZ(c[0] + inX * 0.5 + s * inY, c[1] + inY * 0.5 - s * inX, 0.);
318 int calcSign(
const TVector3& a,
const TVector3& b,
const TVector3& c);
323 int calcSign(
const TVector3& a,
const TVector3& b,
const TVector3& c,
const TVector3& sigma_a,
const TVector3& sigma_b,
324 const TVector3& sigma_c)
326 TVector3 c2b = b - c; c2b.SetZ(0.);
327 TVector3 b2a = a - b; b2a.SetZ(0.);
328 double angle = atan2(b2a[0], b2a[1]) - atan2(c2b[0], c2b[1]);
329 double sigmaan = (sigma_a.Mag() + sigma_b.Mag() + sigma_c.Mag()) / (3.*(c2b.Mag() +
331 if (angle < (-sigmaan)) {
return -1; }
332 else if (angle > sigmaan) {
return 1; }
371 B2ERROR(
"sanityCheckRadius: given radius is " << radius <<
", which is below threshold of " << 0.0000001 <<
", throwing exception");
372 throw FilterExceptions::Circle_too_small();
The class 'ThreeHitFilters' bundles filter methods using 3 hits which are stored in TVector3s.
~ThreeHitFilters()
Destructor.
double calcAngle3D()
calculates the angle between the hits/vectors (3D), returning unit: none (calculation for degrees is ...
int calcSign(const TVector3 &a, const TVector3 &b, const TVector3 &c, const TVector3 &sigma_a, const TVector3 &sigma_b, const TVector3 &sigma_c)
calculates calculates the sign of the curvature of given 3-hit-tracklet.
double calcDeltaSOverZ()
calculates the helixparameter describing the deviation in arc length per unit in z.
double fullAngle3D()
calculates the angle between the hits/vectors (3D), returning unit: angle in degrees
bool m_circleCenterCalculated
initially set to false, will be set true if calcCircleCenter() is used at least once
double m_radius
radius[cm] of a circle in r-phi-plane formed by the 3 hits
double calcPt()
calculates the estimation of the transverse momentum of the 3-hit-tracklet, returning unit: GeV/c
double calcHelixFit()
reverse compatibility, calls calcHelixParameterFit
double fullAngleRZ()
calculates the angle between the hits/vectors (RZ), returning unit: angle in degrees
double m_x2
internal intermediate value storing x^2, no enduser-relevance
TVector3 m_hitC
inner hit (position relevant for useful filter calculation) used for the filter calculation
bool m_radiusCalculated
initially set to false, will be set true if calcInvCurvature() is used at least once
double calcRadius(const TVector3 &a, const TVector3 &b, const TVector3 &c, const TVector3 &circleCenter)
calculates an estimation of the radius of given hits and existing estimation of circleCenter,...
void checkCalcCircleCenter()
checks whether the calcCircleCenter()-Member has been executed already and executes it if not
double filterNan(double value)
returns zero if value is nan or inf
double calcDeltaSlopeRZ()
calculates deviations in the slope of the inner segment and the outer segment, returning unit: none
TVector3 m_vecBC
vector pointing from inner hit to center hit (inner segment)
double fullAngle2D(const TVector3 &vecA, const TVector3 &vecB)
calculates the angle between the hits/vectors (2D), generalized, returning unit: angle in radians WAR...
double getMagneticField()
returns the set value of the magnetic field in Tesla
double m_y2
internal intermediate value storing y^2, no enduser-relevance
double calcAngleRZ()
calculates the angle between the hits/vectors (RZ), returning unit: none (calculation for degrees is ...
double fullAngleXY()
calculates the angle between the hits/vectors (XY), returning unit: angle in degrees
void sanityCheckRadius(double radius)
check Radius for bad values and throw exception if the value is bad
double calcDeltaSlopeZOverS()
compares the "slopes" z over arc length.
void calcCircleCenter(const TVector3 &a, const TVector3 &b, const TVector3 &c, TVector3 &circleCenter)
calculates an estimation of circleCenter position, result is written into the 4th input-parameter
void resetValues(const TVector3 &outerHit, const TVector3 ¢erHit, const TVector3 &innerHit)
Overrides Constructor-Setup.
double calcCircleDist2IP()
calculates the distance of the point of closest approach of circle to the IP, returning unit: cm
ThreeHitFilters(const TVector3 &outerHit, const TVector3 ¢erHit, const TVector3 &innerHit, const double magneticFieldStrength=1.5)
Constructor.
void resetMagneticField(const double magneticFieldStrength=1.5)
Overrides Constructor-Setup for magnetic field.
TVector3 m_vecAB
vector pointing from center hit to outer hit (outer segment)
double m_z2
internal intermediate value storing z^2, no enduser-relevance
double calcPt(double radius)
calculates the estimation of the transverse momentum of given radius using defined strength of magnet...
double calcAngle2D(const TVector3 &vecA, const TVector3 &vecB)
calculates the angle between the hits/vectors (2D), generalized, returning unit: none.
TwoHitFilters m_twoHitFilter
instance of TwoHitFilters-class used for some internal calculations
double calcHelixParameterFit()
calculates the helixparameter describing the deviation in z per unit angle, returning unit: none
void checkCalcRadius()
checks whether the calcRadius()-Member has been executed already and executes it if not
double m_magneticFieldFactor
is factor containing speed of light (c), the magnetic field (b) and the scaling factor s for conversi...
double calcAngleXY()
calculates the angle between the hits/vectors (XY), returning unit: none (calculation for degrees is ...
int calcSign(const TVector3 &a, const TVector3 &b, const TVector3 &c)
calculates calculates the sign of the curvature of given 3-hit-tracklet.
TVector3 m_hitA
outer hit (position relevant for useful filter calculation) used for the filter calculation
TVector3 m_centerABC
center position of a circle in r-phi-plane formed by the 3 hits
TVector3 m_hitB
center hit (position relevant for useful filter calculation) used for the filter calculation
ThreeHitFilters()
Empty constructor.
The class 'TwoHitFilters' bundles filter methods using 2 hits which are stored in TVector3s.
void resetValues(const TVector3 &outerHit, const TVector3 &innerHit)
Overrides Constructor-Setup.
double filterNan(double value) const
nice little nanChecker returns 0 if value was nan or inf, else returns value itself
double calcSlopeRZ() const
calculates the angle of the slope of the hits in RZ, returnValue = theta = atan(r/z)
Abstract base class for different kinds of events.