11#include <framework/geometry/B2Vector3.h>
12#include "tracking/vxdCaTracking/TwoHitFilters.h"
13#include "tracking/vxdCaTracking/FilterExceptions.h"
14#include <framework/logging/Logger.h>
45 const double magneticFieldStrength = 1.5):
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()));
284 return ((circleCenter - a).Perp() + (circleCenter - b).Perp() + (circleCenter - c).Perp()) /
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.);
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();
DataType Perp2() const
The transverse component squared (R^2 in cylindrical coordinate system).
DataType Mag() const
The magnitude (rho in spherical coordinate system).
DataType Mag2() const
The magnitude squared (rho^2 in spherical coordinate system).
void SetZ(DataType z)
set Z/3rd-coordinate
DataType Dot(const B2Vector3< DataType > &p) const
Scalar product.
DataType Perp() const
The transverse component (R in cylindrical coordinate system).
void SetXYZ(DataType x, DataType y, DataType z)
set all coordinates using data type
The class 'ThreeHitFilters' bundles filter methods using 3 hits which are stored in B2Vector3Ds.
~ThreeHitFilters()
Destructor.
double calcAngle3D()
calculates the angle between the hits/vectors (3D), returning unit: none (calculation for degrees is ...
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
ThreeHitFilters(const B2Vector3D &outerHit, const B2Vector3D ¢erHit, const B2Vector3D &innerHit, const double magneticFieldStrength=1.5)
Constructor.
double m_radius
radius[cm] of a circle in r-phi-plane formed by the 3 hits
void resetValues(const B2Vector3D &outerHit, const B2Vector3D ¢erHit, const B2Vector3D &innerHit)
Overrides Constructor-Setup.
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
bool m_radiusCalculated
initially set to false, will be set true if calcInvCurvature() is used at least once
void checkCalcCircleCenter()
checks whether the calcCircleCenter()-Member has been executed already and executes it if not
B2Vector3D m_centerABC
center position of a circle in r-phi-plane formed by the 3 hits
void calcCircleCenter(const B2Vector3D &a, const B2Vector3D &b, const B2Vector3D &c, B2Vector3D &circleCenter)
calculates an estimation of circleCenter position, result is written into the 4th input-parameter
B2Vector3D m_vecAB
vector pointing from center hit to outer hit (outer segment)
double calcRadius(const B2Vector3D &a, const B2Vector3D &b, const B2Vector3D &c, const B2Vector3D &circleCenter)
calculates an estimation of the radius of given hits and existing estimation of circleCenter,...
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
B2Vector3D m_hitB
center hit (position relevant for useful filter calculation) used for the filter calculation
B2Vector3D m_vecBC
vector pointing from inner hit to center hit (inner segment)
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.
double calcCircleDist2IP()
calculates the distance of the point of closest approach of circle to the IP, returning unit: cm
double fullAngle2D(const B2Vector3D &vecA, const B2Vector3D &vecB)
calculates the angle between the hits/vectors (2D), generalized, returning unit: angle in radians WAR...
void resetMagneticField(const double magneticFieldStrength=1.5)
Overrides Constructor-Setup for magnetic field.
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...
int calcSign(const B2Vector3D &a, const B2Vector3D &b, const B2Vector3D &c, const B2Vector3D &sigma_a, const B2Vector3D &sigma_b, const B2Vector3D &sigma_c)
calculates calculates the sign of the curvature of given 3-hit-tracklet.
TwoHitFilters m_twoHitFilter
instance of TwoHitFilters-class used for some internal calculations
B2Vector3D m_hitC
inner hit (position relevant for useful filter calculation) used for the filter calculation
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 calcAngle2D(const B2Vector3D &vecA, const B2Vector3D &vecB)
calculates the angle between the hits/vectors (2D), generalized, returning unit: none.
double calcAngleXY()
calculates the angle between the hits/vectors (XY), returning unit: none (calculation for degrees is ...
int calcSign(const B2Vector3D &a, const B2Vector3D &b, const B2Vector3D &c)
calculates calculates the sign of the curvature of given 3-hit-tracklet.
ThreeHitFilters()
Empty constructor.
B2Vector3D m_hitA
outer hit (position relevant for useful filter calculation) used for the filter calculation
The class 'TwoHitFilters' bundles filter methods using 2 hits which are stored in B2Vector3Ds.
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)
void resetValues(const B2Vector3D &outerHit, const B2Vector3D &innerHit)
Overrides Constructor-Setup.
double sqrt(double a)
sqrt for double
B2Vector3D outerHit(0, 0, 0)
testing out of range behavior
Abstract base class for different kinds of events.