CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

FastHelix Class Reference

#include <FastHelix.h>

List of all members.

Public Member Functions

 FastHelix (const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex, const edm::EventSetup &iSetup)
 FastHelix (const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex, const edm::EventSetup &iSetup, const GlobalPoint &bVertex)
FTS helixStateAtVertex () const
bool isValid () const
FTS stateAtVertex () const
FTS straightLineStateAtVertex () const
 ~FastHelix ()

Private Types

typedef FreeTrajectoryState FTS

Private Attributes

GlobalPoint basisVertex
edm::ESHandle< MagneticFieldpSetup
GlobalVector tesla0
FastCircle theCircle
GlobalPoint theMiddleHit
GlobalPoint theOuterHit
GlobalPoint theVertex
bool useBasisVertex

Detailed Description

Generation of track parameters at a vertex using two hits and a vertex. It is used e.g. by a seed generator.

21.02.2001: Old FastHelix is now called FastHelixFit. Replace FastLineFit by FastLine (z0, dz/drphi calculated without vertex and errors) 14.02.2001: Replace general Circle by FastCircle. 13.02.2001: LinearFitErrorsInTwoCoordinates replaced by FastLineFit 29.11.2000: (Pascal Vanlaer) Modification of calculation of sign of px,py and change in calculation of pz, z0. 29.11.2000: (Matthias Winkler) Split stateAtVertex() in two parts (Circle is valid or not): helixStateAtVertex() and straightLineStateAtVertex()

Definition at line 27 of file FastHelix.h.


Member Typedef Documentation

Definition at line 31 of file FastHelix.h.


Constructor & Destructor Documentation

FastHelix::FastHelix ( const GlobalPoint outerHit,
const GlobalPoint middleHit,
const GlobalPoint aVertex,
const edm::EventSetup iSetup 
) [inline]

Definition at line 37 of file FastHelix.h.

References edm::EventSetup::get(), pSetup, tesla0, and useBasisVertex.

                                             : theOuterHit(outerHit),
                                                 theMiddleHit(middleHit),
                                                 theVertex(aVertex),
                                                 theCircle(outerHit,
                                                           middleHit,
                                                           aVertex) {
                  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
                  tesla0=pSetup->inTesla(GlobalPoint(0,0,0));
                  useBasisVertex = false;
                }
FastHelix::FastHelix ( const GlobalPoint outerHit,
const GlobalPoint middleHit,
const GlobalPoint aVertex,
const edm::EventSetup iSetup,
const GlobalPoint bVertex 
) [inline]

Definition at line 52 of file FastHelix.h.

References edm::EventSetup::get(), pSetup, tesla0, and useBasisVertex.

                                            : theOuterHit(outerHit),
                                              theMiddleHit(middleHit),
                                              theVertex(aVertex),
                                              basisVertex(bVertex),
                                              theCircle(outerHit,
                                                        middleHit,
                                                        aVertex) {
                  iSetup.get<IdealMagneticFieldRecord>().get(pSetup);
                  tesla0=pSetup->inTesla(GlobalPoint(0,0,0));
                  useBasisVertex = true;
                }
FastHelix::~FastHelix ( ) [inline]

Definition at line 68 of file FastHelix.h.

{}

Member Function Documentation

FreeTrajectoryState FastHelix::helixStateAtVertex ( ) const

Definition at line 16 of file FastHelix.cc.

References basisVertex, funct::C, FastCircle::n1(), FastLine::n1(), FastCircle::n2(), pSetup, lumiQueryAPI::q, FastCircle::rho(), rho, mathSSE::sqrt(), tesla0, theCircle, theMiddleHit, theOuterHit, theVertex, useBasisVertex, v, PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by stateAtVertex().

                                                        {
  
  GlobalPoint pMid(theMiddleHit);
  GlobalPoint v(theVertex);
  
  double dydx = 0., dxdy = 0.;
  double pt = 0., px = 0., py = 0.;
  
  //remember (radius rho in cm):
  //rho = 
  //100. * pt * 
  //(10./(3.*MagneticField::inTesla(GlobalPoint(0., 0., 0.)).z()));
  
  double rho = theCircle.rho();
  // pt = 0.01 * rho * (0.3*MagneticField::inTesla(GlobalPoint(0.,0.,0.)).z());
  pt = 0.01 * rho * (0.3*tesla0.z());
  //  pt = 0.01 * rho * (0.3*GlobalPoint(0.,0.,0.).MagneticField().z());

  // (py/px)|x=v.x() = (dy/dx)|x=v.x()
  //remember:
  //y(x) = +-sqrt(rho^2 - (x-x0)^2) + y0 
  //y(x) =  sqrt(rho^2 - (x-x0)^2) + y0  if y(x) >= y0 
  //y(x) = -sqrt(rho^2 - (x-x0)^2) + y0  if y(x) < y0
  //=> (dy/dx) = -(x-x0)/sqrt(Q)  if y(x) >= y0
  //   (dy/dx) =  (x-x0)/sqrt(Q)  if y(x) < y0
  //with Q = rho^2 - (x-x0)^2
  // Check approximate slope to determine whether to use dydx or dxdy
  // Choose the one that goes to 0 rather than infinity.
  double arg1 = rho*rho - (v.x()-theCircle.x0())*(v.x()-theCircle.x0());
  double arg2 = rho*rho - (v.y()-theCircle.y0())*(v.y()-theCircle.y0());
  if (arg1<0.0 && arg2<0.0) {
    if(fabs(theCircle.n2()) > 0.) {
      dydx = -theCircle.n1()/theCircle.n2(); //else px = 0
      px = pt/sqrt(1. + dydx*dydx);
      py = px*dydx;
    } else {
      px = 0.;
      py = pt;
    }
  } else if ( arg1>arg2 ) {
    if( v.y() > theCircle.y0() )
      dydx = -(v.x() - theCircle.x0()) / sqrt(arg1);
    else
      dydx = (v.x() - theCircle.x0()) / sqrt(arg1);
    px = pt/sqrt(1. + dydx*dydx);
    py = px*dydx;
  } else {
    if( v.x() > theCircle.x0() )
      dxdy = -(v.y() - theCircle.y0()) / sqrt(arg2);
    else
      dxdy = (v.y() - theCircle.y0()) / sqrt(arg2);
    py = pt/sqrt(1. + dxdy*dxdy);
    px = py*dxdy;
  }
  // check sign with scalar product
  if(px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) {
    px *= -1.;
    py *= -1.;
  } 

  //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)))
  
  FastLine flfit(theOuterHit, theMiddleHit, theCircle.rho());
  double dzdrphi = -flfit.n1()/flfit.n2();
  double pz = pt*dzdrphi;
  //get sign of particle

  GlobalVector magvtx=pSetup->inTesla(v);
  TrackCharge q = 
    ((theCircle.x0()*py - theCircle.y0()*px) / 
     (magvtx.z()) < 0.) ? 
    -1 : 1;
  
  AlgebraicSymMatrix C(5,1);
  //MP

  if ( useBasisVertex ) {
    return FTS(GlobalTrajectoryParameters(basisVertex, 
                                                  GlobalVector(px, py, pz),
                                                  q, 
                                                  &(*pSetup)), 
                       CurvilinearTrajectoryError(C));
  } else {
    double z_0 = -flfit.c()/flfit.n2();
    return FTS(GlobalTrajectoryParameters(GlobalPoint(v.x(),v.y(),z_0), 
                                                  GlobalVector(px, py, pz),
                                                  q, 
                                                  &(*pSetup)), 
                       CurvilinearTrajectoryError(C));
  }
  
}
bool FastHelix::isValid ( void  ) const [inline]
FreeTrajectoryState FastHelix::stateAtVertex ( ) const
FreeTrajectoryState FastHelix::straightLineStateAtVertex ( ) const

Definition at line 113 of file FastHelix.cc.

References basisVertex, funct::C, FastLine::c(), FastCircle::n1(), FastLine::n1(), FastCircle::n2(), FastLine::n2(), pSetup, lumiQueryAPI::q, mathSSE::sqrt(), theCircle, theMiddleHit, theOuterHit, theVertex, useBasisVertex, v, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by stateAtVertex().

                                                               {

  //calculate FTS assuming straight line...

  GlobalPoint pMid(theMiddleHit);
  GlobalPoint v(theVertex);

  double dydx = 0.;
  double pt = 0., px = 0., py = 0.;
  
  if(fabs(theCircle.n1()) > 0. || fabs(theCircle.n2()) > 0.)
    pt = 1.e+4;// 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(theOuterHit, theMiddleHit);
  double dzdr = -flfit.n1()/flfit.n2();
  double pz = pt*dzdr; 
  
  TrackCharge q = 1;
  AlgebraicSymMatrix66 C = AlgebraicMatrixID();
  //MP

  if ( useBasisVertex ) {
    return FTS(GlobalTrajectoryParameters(basisVertex, 
                                                  GlobalVector(px, py, pz),
                                                  q, 
                                                  &(*pSetup)), 
                       CartesianTrajectoryError(C));
  } else {
  double z_0 = -flfit.c()/flfit.n2();
  return FTS(GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0),
                                                GlobalVector(px, py, pz),
                                                q,
                                                &(*pSetup)),
                     CartesianTrajectoryError());
  }
}

Member Data Documentation

Definition at line 83 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

Definition at line 85 of file FastHelix.h.

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

Definition at line 86 of file FastHelix.h.

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

Definition at line 84 of file FastHelix.h.

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

Definition at line 81 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

Definition at line 80 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

Definition at line 82 of file FastHelix.h.

Referenced by helixStateAtVertex(), and straightLineStateAtVertex().

bool FastHelix::useBasisVertex [private]

Definition at line 87 of file FastHelix.h.

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