CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

FastHelix Class Reference

#include <FastHelix.h>

List of all members.

Public Member Functions

const FastCirclecircle () const
 FastHelix (const GlobalPoint &oHit, const GlobalPoint &mHit, const GlobalPoint &aVertex, double nomField, MagneticField const *ibField, const GlobalPoint &bVertex)
 FastHelix (const GlobalPoint &oHit, const GlobalPoint &mHit, const GlobalPoint &aVertex, double nomField, MagneticField const *ibField)
bool isValid () const
GlobalTrajectoryParameters stateAtVertex () const
 ~FastHelix ()

Private Member Functions

void compute ()
void helixStateAtVertex () dso_hidden
GlobalPoint const & middleHit () const
GlobalPoint const & outerHit () const
void straightLineStateAtVertex () dso_hidden
GlobalPoint const & vertex () const

Private Attributes

GlobalTrajectoryParameters atVertex
GlobalPoint basisVertex
MagneticField const * bField
float maxRho
float tesla0
FastCircle theCircle
bool useBasisVertex

Static Private Attributes

static constexpr float maxPt = 10000

Detailed Description

Definition at line 26 of file FastHelix.h.


Constructor & Destructor Documentation

FastHelix::FastHelix ( const GlobalPoint oHit,
const GlobalPoint mHit,
const GlobalPoint aVertex,
double  nomField,
MagneticField const *  ibField 
) [inline]

Definition at line 30 of file FastHelix.h.

References compute(), maxPt, maxRho, tesla0, and useBasisVertex.

                                                            :
    bField(ibField),
    theCircle(oHit,
              mHit,
              aVertex) {
    tesla0=0.1*nomField;
    maxRho = maxPt/(0.01 * 0.3*tesla0);
    useBasisVertex = false;
    compute();
  }
FastHelix::FastHelix ( const GlobalPoint oHit,
const GlobalPoint mHit,
const GlobalPoint aVertex,
double  nomField,
MagneticField const *  ibField,
const GlobalPoint bVertex 
) [inline]

Definition at line 45 of file FastHelix.h.

References compute(), maxPt, maxRho, tesla0, and useBasisVertex.

                                        : 
    bField(ibField),
    basisVertex(bVertex),
    theCircle(oHit,
              mHit,
              aVertex) {
    tesla0=0.1*nomField;
    maxRho = maxPt/(0.01 * 0.3*tesla0);
    useBasisVertex = true;
    compute();
  }
FastHelix::~FastHelix ( ) [inline]

Definition at line 61 of file FastHelix.h.

{}

Member Function Documentation

const FastCircle& FastHelix::circle ( ) const [inline]

Definition at line 67 of file FastHelix.h.

References theCircle.

Referenced by PixelClusterShapeSeedComparitor::compatible().

{ return theCircle; }
void FastHelix::compute ( ) [private]
void FastHelix::helixStateAtVertex ( ) [private]

Definition at line 13 of file FastHelix.cc.

References abs, atVertex, basisVertex, bField, middleHit(), outerHit(), perp2(), lumiQueryAPI::q, FastCircle::rho(), rho, mathSSE::sqrt(), straightLineStateAtVertex(), tesla0, theCircle, useBasisVertex, findQualityFiles::v, vertex(), PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by compute().

                                   {

  // given the above rho>0.
  double rho = theCircle.rho();
  //remember (radius rho in cm):
  //rho = 
  //100. * pt * 
  //(10./(3.*MagneticField::inTesla(GlobalPoint(0., 0., 0.)).z()));
  
  // pt = 0.01 * rho * (0.3*MagneticField::inTesla(GlobalPoint(0.,0.,0.)).z());
  double cm2GeV = 0.01 * 0.3*tesla0;
  double pt = cm2GeV * rho; 
 
  // verify that rho is not toooo large
  double dcphi = ((outerHit().x()-theCircle.x0())*(middleHit().x()-theCircle.x0()) +
                 (outerHit().y()-theCircle.y0())*(middleHit().y()-theCircle.y0())
                 )/(rho*rho);
  if (std::abs(dcphi)>=1.f) { straightLineStateAtVertex(); return;}
  
  GlobalPoint pMid(middleHit());
  GlobalPoint v(vertex());
  
  // tangent in v (or the opposite...)
  double px = -cm2GeV * (v.y()-theCircle.y0());
  double py =  cm2GeV * (v.x()-theCircle.x0());
  // check sign with scalar product
  if(px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
    px = -px;
    py = -py;
  } 

 
 
  //calculate z0, pz
  //(z, R*phi) linear relation in a helix
  //with R, phi defined as radius and angle w.r.t. centre of circle
  //in transverse plane
  //pz = pT*(dz/d(R*phi)))
  

  // VI 23/01/2012
  double dzdrphi = outerHit().z() - middleHit().z();
  dzdrphi /= rho*acos(dcphi);
  double pz = pt*dzdrphi;


  TrackCharge q = 1;
  if (theCircle.x0()*py - theCircle.y0()*px < 0) q =-q;
  if (tesla0 < 0.) q =-q;

  //VI
  if ( useBasisVertex ) {
    atVertex =  GlobalTrajectoryParameters(basisVertex, 
                                           GlobalVector(px, py, pz),
                                           q, 
                                           bField
                                           );
  } else {
    double z_0 =  middleHit().z();
    // assume v is before middleHit (opposite to outer)
    double ds = ( (v.x()-theCircle.x0())*(middleHit().x()-theCircle.x0()) +
                  (v.y()-theCircle.y0())*(middleHit().y()-theCircle.y0())
                  )/(rho*rho);
    if (std::abs(ds)<1.f) {
      ds = rho*acos(ds);
      z_0 -= ds*dzdrphi;
    } else { // line????
      z_0 -= std::sqrt((middleHit()-v).perp2()/(outerHit()-middleHit()).perp2())*(outerHit().z()-middleHit().z());
    }
    
    //double z_old = -flfit.c()/flfit.n2();
    // std::cout << "v:xyz, z,old,new " << v << "   " << z_old << " " << z_0 << std::endl;

    atVertex =  GlobalTrajectoryParameters(GlobalPoint(v.x(),v.y(),z_0), 
                                           GlobalVector(px, py, pz),
                                           q, 
                                           bField
                                           );
  }
  
}
bool FastHelix::isValid ( void  ) const [inline]
GlobalPoint const& FastHelix::middleHit ( ) const [inline, private]

Definition at line 72 of file FastHelix.h.

References FastCircle::innerPoint(), and theCircle.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

{ return theCircle.innerPoint();} 
GlobalPoint const& FastHelix::outerHit ( ) const [inline, private]

Definition at line 71 of file FastHelix.h.

References FastCircle::outerPoint(), and theCircle.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

{ return theCircle.outerPoint();} 
GlobalTrajectoryParameters FastHelix::stateAtVertex ( ) const [inline]
void FastHelix::straightLineStateAtVertex ( ) [private]

Definition at line 95 of file FastHelix.cc.

References atVertex, basisVertex, bField, FastLine::c(), maxPt, middleHit(), FastLine::n1(), FastCircle::n1(), FastLine::n2(), FastCircle::n2(), outerHit(), lumiQueryAPI::q, mathSSE::sqrt(), theCircle, useBasisVertex, findQualityFiles::v, vertex(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by compute(), and helixStateAtVertex().

                                          {

  //calculate GlobalTrajectoryParameters assuming straight line...

  GlobalPoint pMid(middleHit());
  GlobalPoint v(vertex());

  double dydx = 0.;
  double pt = 0., px = 0., py = 0.;
  
  if(fabs(theCircle.n1()) > 0. || fabs(theCircle.n2()) > 0.)
    pt = maxPt  ;// 10 TeV //else no pt
  if(fabs(theCircle.n2()) > 0.) {
    dydx = -theCircle.n1()/theCircle.n2(); //else px = 0 
  }
  px = pt/sqrt(1. + dydx*dydx);
  py = px*dydx;
  // check sign with scalar product
  if (px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
    px *= -1.;
    py *= -1.;
  } 

  //calculate z_0 and pz at vertex using weighted mean
  //z = z(r) = z0 + (dz/dr)*r
  //tan(theta) = dr/dz = (dz/dr)^-1
  //theta = atan(1./dzdr)
  //p = pt/sin(theta)
  //pz = p*cos(theta) = pt/tan(theta) 

  FastLine flfit(outerHit(), middleHit());
  double dzdr = -flfit.n1()/flfit.n2();
  double pz = pt*dzdr; 
  
  TrackCharge q = 1;
  //VI

  if ( useBasisVertex ) {
    atVertex = GlobalTrajectoryParameters(basisVertex, 
                                          GlobalVector(px, py, pz),
                                          q, 
                                          bField
                                          );
  } else {
  double z_0 = -flfit.c()/flfit.n2();
  atVertex = GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0),
                                        GlobalVector(px, py, pz),
                                        q,
                                        bField
                                        );
  }
}
GlobalPoint const& FastHelix::vertex ( ) const [inline, private]

Definition at line 73 of file FastHelix.h.

References theCircle, and FastCircle::vertexPoint().

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

{ return theCircle.vertexPoint();} 

Member Data Documentation

Definition at line 86 of file FastHelix.h.

Referenced by helixStateAtVertex(), stateAtVertex(), and straightLineStateAtVertex().

Definition at line 87 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

MagneticField const* FastHelix::bField [private]

Definition at line 85 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

constexpr float FastHelix::maxPt = 10000 [static, private]

Definition at line 83 of file FastHelix.h.

Referenced by FastHelix(), and straightLineStateAtVertex().

float FastHelix::maxRho [private]

Definition at line 90 of file FastHelix.h.

Referenced by compute(), and FastHelix().

float FastHelix::tesla0 [private]

Definition at line 89 of file FastHelix.h.

Referenced by compute(), FastHelix(), and helixStateAtVertex().

bool FastHelix::useBasisVertex [private]

Definition at line 91 of file FastHelix.h.

Referenced by FastHelix(), helixStateAtVertex(), and straightLineStateAtVertex().