Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:15:55

0001 /**
0002  *  @file   PandoraSDK/include/Objects/Helix.h
0003  * 
0004  *  @brief  Header file for the helix class, based on marlin util helix class.
0005  * 
0006  *  $Log: $
0007  */
0008 #ifndef PANDORA_HELIX_H
0009 #define PANDORA_HELIX_H 1
0010 
0011 #include "Objects/CartesianVector.h"
0012 
0013 #include "Pandora/StatusCodes.h"
0014 
0015 namespace pandora
0016 {
0017 
0018 /**
0019  *  @brief  Helix class
0020  */
0021 class Helix
0022 {
0023 public:
0024     /**
0025      *  @brief  Constructor using canonical (LEP-wise) parameterisation
0026      *
0027      *  @param  phi0 phi angle of momentum vector at the point of closest approach to IP in R-Phi plane
0028      *  @param  d0 signed distance of closest approach in R-Phi plane
0029      *  @param  z0 z coordinate of the point of closest approach to IP in R-Phi plane
0030      *  @param  omega signed curvature
0031      *  @param  tanLambda tangent of dip angle
0032      *  @param  bField magnetic field (in Tesla)
0033      */
0034     Helix(const float phi0, const float d0, const float z0, const float omega, const float tanlambda, const float bField);
0035 
0036     /**
0037      *  @brief  Constructor
0038      * 
0039      *  @param  position position of the reference point
0040      *  @param  momentum momentum vector at the reference point
0041      *  @param  charge particle charge
0042      *  @param  bField magnetic field (in Tesla)
0043      */  
0044     Helix(const CartesianVector &position, const CartesianVector &momentum, const float charge, const float bField);
0045 
0046     /**
0047      *  @brief  Get helix intersection point with a plane parallel to z axis. The plane is defined by two coordinates in the
0048      *          plane (x0,y0) and a normal vector (ax,ay).
0049      * 
0050      *  @param  x0 x coordinate in the specified plane
0051      *  @param  y0 y coordinate in the specified plane
0052      *  @param  ax x component of vector normal to specified plane
0053      *  @param  ay y component of vector normal to specified plane
0054      *  @param  referencePoint the reference point of the helix
0055      *  @param  intersectionPoint to receive the coordinates of the intersection point
0056      */
0057     StatusCode GetPointInXY(const float x0, const float y0, const float ax, const float ay, const CartesianVector &referencePoint,
0058         CartesianVector &intersectionPoint) const;
0059 
0060     /**
0061      *  @brief  Get helix intersection point with a plane parallel to z axis. The plane is defined by two coordinates in the
0062      *          plane (x0,y0) and a normal vector (ax,ay).
0063      * 
0064      *  @param  x0 x coordinate in the specified plane
0065      *  @param  y0 y coordinate in the specified plane
0066      *  @param  ax x component of vector normal to specified plane
0067      *  @param  ay y component of vector normal to specified plane
0068      *  @param  referencePoint the reference point of the helix
0069      *  @param  intersectionPoint to receive the coordinates of the intersection point
0070      *  @param  genericTime to receive the generic time (helix length, from reference point to intersection, divided by particle momentum)
0071      */
0072     StatusCode GetPointInXY(const float x0, const float y0, const float ax, const float ay, const CartesianVector &referencePoint,
0073         CartesianVector &intersectionPoint, float &genericTime) const;
0074 
0075     /**
0076      *  @brief  Get helix intersection point with a plane perpendicular to z axis.
0077      * 
0078      *  @param  zPlane the z coordinate for the specified plane
0079      *  @param  referencePoint the reference point of the helix
0080      *  @param  intersectionPoint to receive the coordinates of the intersection point
0081      */
0082     StatusCode GetPointInZ(const float zPlane, const CartesianVector &referencePoint, CartesianVector &intersectionPoint) const;
0083 
0084     /**
0085      *  @brief  Get helix intersection point with a plane perpendicular to z axis.
0086      * 
0087      *  @param  zPlane the z coordinate for the specified plane
0088      *  @param  referencePoint the reference point of the helix
0089      *  @param  intersectionPoint to receive the coordinates of the intersection point
0090      *  @param  genericTime to receive the generic time (helix length, from reference point to intersection, divided by particle momentum)
0091      */
0092     StatusCode GetPointInZ(const float zPlane, const CartesianVector &referencePoint, CartesianVector &intersectionPoint,
0093         float &genericTime) const;
0094 
0095     /**
0096      *  @brief  Get coordinates of helix intersection with cylinder, aligned along z-axis
0097      * 
0098      *  @param  radius the radius of the cylinder
0099      *  @param  referencePoint the reference point of the helix
0100      *  @param  intersectionPoint to receive the coordinates of the intersection point
0101      */
0102     StatusCode GetPointOnCircle(const float radius, const CartesianVector &referencePoint, CartesianVector &intersectionPoint) const;
0103 
0104     /**
0105      *  @brief  Get coordinates of helix intersection with cylinder, aligned along z-axis
0106      * 
0107      *  @param  radius the radius of the cylinder
0108      *  @param  referencePoint the reference point of the helix
0109      *  @param  intersectionPoint to receive the coordinates of the intersection point
0110      *  @param  genericTime to receive the generic time (helix length, from reference point to intersection, divided by particle momentum)
0111      */
0112     StatusCode GetPointOnCircle(const float radius, const CartesianVector &referencePoint, CartesianVector &intersectionPoint,
0113         float &genericTime) const;
0114 
0115     /**
0116      *  @brief  Get distance of the closest approach of helix to an arbitrary point in space
0117      * 
0118      *  @param  point coordinates of the specified point
0119      *  @param  distance to receive a vector of distances from helix to point in the following projections:
0120      *          x component: distance in R-Phi plane
0121      *          y-component: distance along Z axis
0122      *          z-component: 3D distance magnitude
0123      */
0124     StatusCode GetDistanceToPoint(const CartesianVector &point, CartesianVector &distance) const;
0125 
0126     /**
0127      *  @brief  Get distance of the closest approach of helix to an arbitrary point in space
0128      * 
0129      *  @param  point coordinates of the specified point
0130      *  @param  distance to receive a vector of distances from helix to point in the following projections:
0131      *          x component: distance in R-Phi plane
0132      *          y-component: distance along Z axis
0133      *          z-component: 3D distance magnitude
0134      *  @param  genericTime to receive the generic time (helix length, from reference point to intersection, divided by particle momentum)
0135      */
0136     StatusCode GetDistanceToPoint(const CartesianVector &point, CartesianVector &distance, float &genericTime) const;
0137 
0138     /**
0139      *  @brief  Get distance between two helices
0140      * 
0141      *  @param  pHelix address of a second helix
0142      *  @param  positionOfClosestApproach to receive position of the point of closest approach
0143      *  @param  v0momentum to receive the v0 momentum
0144      *  @param  helixDistance to receive the distance between the two helices
0145      */
0146     StatusCode GetDistanceToHelix(const Helix *const pHelix, CartesianVector &positionOfClosestApproach, CartesianVector &v0momentum,
0147         float &helixDistance) const;
0148 
0149     /**
0150      *  @param  Get extrapolated momentum at a specified position
0151      * 
0152      *  @param  position the specified position
0153      * 
0154      *  @return the extrapolated momentum
0155      */
0156     CartesianVector GetExtrapolatedMomentum(const CartesianVector &position) const;
0157 
0158     /**
0159      *  @brief  Get momentum of particle at the point of closest approach to IP
0160      * 
0161      *  @return the momentum of particle
0162      */
0163     const CartesianVector &GetMomentum() const;
0164 
0165     /**
0166      *  @brief  Get reference point of track
0167      * 
0168      *  @return the reference point of track
0169      */
0170     const CartesianVector &GetReferencePoint() const;
0171 
0172     /**
0173      *  @brief  Get phi angle of the momentum vector at the point of closest approach to IP
0174      * 
0175      *  @return the phi angle of the momentum vector
0176      */
0177     float GetPhi0() const;
0178 
0179     /**
0180      *  @brief  Get z signed distance of closest approach to IP in the R-Phi plane
0181      * 
0182      *  @return the signed distance of closest approach
0183      */
0184     float GetD0() const;
0185 
0186     /**
0187      *  @brief  Get z coordinate of the point of closest approach to IP in the R-Phi plane
0188      * 
0189      *  @return the z coordinate of the point of closest approach
0190      */
0191     float GetZ0() const;
0192 
0193     /**
0194      *  @brief  Get signed curvature of the track
0195      * 
0196      *  @return the signed curvature of the track
0197      */
0198     float GetOmega() const;
0199 
0200     /**
0201      *  @brief  Get tangent of dip angle of the track
0202      * 
0203      *  @return the tangent of dip angle of the track
0204      */
0205     float GetTanLambda() const;
0206 
0207     /**
0208      *  @brief  Get transverse momentum of the track
0209      * 
0210      *  @return the transverse momentum of the track
0211      */
0212     float GetPxy() const;
0213 
0214     /**
0215      *  @brief  Get charge
0216      * 
0217      *  @return the charge
0218      */
0219     float GetCharge() const;
0220 
0221     /**
0222      *  @brief  Get x coordinate of circumference
0223      * 
0224      *  @return the x coordinate of circumference
0225      */
0226     float GetXCentre() const;
0227 
0228     /**
0229      *  @brief  Get y coordinate of circumference
0230      * 
0231      *  @return the y coordinate of circumference
0232      */
0233     float GetYCentre() const;
0234 
0235     /**
0236      *  @brief  Get radius of circumference
0237      * 
0238      *  @return the radius of circumference
0239      */
0240     float GetRadius() const;
0241 
0242 private:
0243     static const float FCT;
0244     static const float TWO_PI;
0245     static const float HALF_PI;
0246 
0247     CartesianVector     m_referencePoint;       ///< The coordinates of the reference point
0248     CartesianVector     m_momentum;             ///< The momentum vector at reference point 
0249 
0250     float               m_phi0;                 ///< phi0 in canonical parameterization 
0251     float               m_d0;                   ///< d0 in canonical parameterisation
0252     float               m_z0;                   ///< z0 in canonical parameterisation
0253     float               m_omega;                ///< signed curvature in canonical parameterisation
0254     float               m_tanLambda;            ///< tanLambda 
0255     float               m_pxy;                  ///< The transverse momentum
0256     float               m_charge;               ///< The particle charge
0257     float               m_xCentre;              ///< The circle centre x coordinate
0258     float               m_yCentre;              ///< The circle centre y coordinate
0259     float               m_radius;               ///< The radius of circle in XY plane
0260     float               m_phiRefPoint;          ///< Phi w.r.t. (X0, Y0) of circle at reference point
0261     float               m_phiAtPCA;             ///< Phi w.r.t. (X0, Y0) of circle at point of closest approach
0262     float               m_xAtPCA;               ///< x coordinate at point of closest approach
0263     float               m_yAtPCA;               ///< y coordinate at point of closest approach
0264     float               m_pxAtPCA;              ///< Momentum x component at point of closest approach
0265     float               m_pyAtPCA;              ///< Momentum y component at point of closest approach
0266     float               m_phiMomRefPoint;       ///< Phi of Momentum vector at reference point
0267 };
0268 
0269 //------------------------------------------------------------------------------------------------------------------------------------------
0270 
0271 inline StatusCode Helix::GetPointInXY(const float x0, const float y0, const float ax, const float ay, const CartesianVector &referencePoint,
0272     CartesianVector &intersectionPoint) const
0273 {
0274     float genericTime;
0275     return this->GetPointInXY(x0, y0, ax, ay, referencePoint, intersectionPoint, genericTime);
0276 }
0277 
0278 //------------------------------------------------------------------------------------------------------------------------------------------
0279 
0280 inline StatusCode Helix::GetPointInZ(const float zPlane, const CartesianVector &referencePoint, CartesianVector &intersectionPoint) const
0281 {
0282     float genericTime;
0283     return this->GetPointInZ(zPlane, referencePoint, intersectionPoint, genericTime);
0284 }
0285 
0286 //------------------------------------------------------------------------------------------------------------------------------------------
0287 
0288 inline StatusCode Helix::GetPointOnCircle(const float radius, const CartesianVector &referencePoint, CartesianVector &intersectionPoint) const
0289 {
0290     float genericTime;
0291     return this->GetPointOnCircle(radius, referencePoint, intersectionPoint, genericTime);
0292 }
0293 
0294 //------------------------------------------------------------------------------------------------------------------------------------------
0295 
0296 inline StatusCode Helix::GetDistanceToPoint(const CartesianVector &point, CartesianVector &distance) const
0297 {
0298     float genericTime;
0299     return this->GetDistanceToPoint(point, distance, genericTime);
0300 }
0301 
0302 //------------------------------------------------------------------------------------------------------------------------------------------
0303 
0304 inline const CartesianVector &Helix::GetMomentum() const
0305 {
0306     return m_momentum;
0307 }
0308 
0309 //------------------------------------------------------------------------------------------------------------------------------------------
0310 
0311 inline const CartesianVector &Helix::GetReferencePoint() const
0312 {
0313     return m_referencePoint;
0314 }
0315 
0316 //------------------------------------------------------------------------------------------------------------------------------------------
0317 
0318 inline float Helix::GetPhi0() const
0319 {
0320     if (m_phi0 < 0.)
0321         return m_phi0 + TWO_PI;
0322 
0323     return m_phi0;
0324 }
0325 
0326 //------------------------------------------------------------------------------------------------------------------------------------------
0327 
0328 inline float Helix::GetD0() const
0329 {
0330     return m_d0;
0331 }
0332 
0333 //------------------------------------------------------------------------------------------------------------------------------------------
0334 
0335 inline float Helix::GetZ0() const
0336 {
0337     return m_z0;
0338 }
0339 
0340 //------------------------------------------------------------------------------------------------------------------------------------------
0341 
0342 inline float Helix::GetOmega() const
0343 {
0344     return m_omega;
0345 }
0346 
0347 //------------------------------------------------------------------------------------------------------------------------------------------
0348 
0349 inline float Helix::GetTanLambda() const
0350 {
0351     return m_tanLambda;
0352 }
0353 
0354 //------------------------------------------------------------------------------------------------------------------------------------------
0355 
0356 inline float Helix::GetPxy() const
0357 {
0358     return m_pxy;
0359 }
0360 
0361 //------------------------------------------------------------------------------------------------------------------------------------------
0362 
0363 inline float Helix::GetCharge() const
0364 {
0365     return m_charge;
0366 }
0367 
0368 //------------------------------------------------------------------------------------------------------------------------------------------
0369 
0370 inline float Helix::GetXCentre() const
0371 {
0372     return m_xCentre;
0373 }
0374 
0375 //------------------------------------------------------------------------------------------------------------------------------------------
0376 
0377 inline float Helix::GetYCentre() const
0378 {
0379     return m_yCentre;
0380 }
0381 
0382 //------------------------------------------------------------------------------------------------------------------------------------------
0383 
0384 inline float Helix::GetRadius() const
0385 {
0386     return m_radius;
0387 }
0388 
0389 } // namespace pandora
0390 
0391 #endif // #ifndef PANDORA_HELIX_H