CMS 3D CMS Logo

Public Member Functions

PixelTrackBuilder Class Reference

#include <PixelTrackBuilder.h>

List of all members.

Public Member Functions

reco::Trackbuild (const Measurement1D &pt, const Measurement1D &phi, const Measurement1D &cotTheta, const Measurement1D &tip, const Measurement1D &zip, float chi2, int charge, const std::vector< const TrackingRecHit * > &hits, const MagneticField *mf, const GlobalPoint &reference=GlobalPoint(0, 0, 0)) const

Detailed Description

Definition at line 13 of file PixelTrackBuilder.h.


Member Function Documentation

reco::Track * PixelTrackBuilder::build ( const Measurement1D pt,
const Measurement1D phi,
const Measurement1D cotTheta,
const Measurement1D tip,
const Measurement1D zip,
float  chi2,
int  charge,
const std::vector< const TrackingRecHit * > &  hits,
const MagneticField mf,
const GlobalPoint reference = GlobalPoint(0,0,0) 
) const

Definition at line 132 of file PixelTrackBuilder.cc.

References BasicReferenceCounted::addReference(), BasicSingleTrajectoryState::charge(), funct::cos(), CommonMethods::cp(), BasicSingleTrajectoryState::curvilinearError(), Measurement1D::error(), error, BasicSingleTrajectoryState::globalMomentum(), BasicSingleTrajectoryState::globalPosition(), LogDebug, LogTrace, m, pos, createTree::pp, reco::print(), funct::sin(), funct::sqr(), mathSSE::sqrt(), ExpressReco_HICollisions_FallBack::track, Measurement1D::value(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by PixelFitterByConformalMappingAndLine::run(), TrackFitter::run(), and PixelFitterByHelixProjections::run().

{

  LogDebug("PixelTrackBuilder::build");
  LogTrace("")<<"reconstructed TRIPLET kinematics:\n"<<print(pt,phi,cotTheta,tip,zip,chi2,charge);

  double sinTheta = 1/std::sqrt(1+sqr(cotTheta.value()));
  double cosTheta = cotTheta.value()*sinTheta;
  int tipSign = tip.value() > 0 ? 1 : -1;

  AlgebraicSymMatrix55 m;
  double invPtErr = 1./sqr(pt.value()) * pt.error();
  m(0,0) = sqr(sinTheta) * (
              sqr(invPtErr)
            + sqr(cotTheta.error()/pt.value()*cosTheta * sinTheta)
            );
  m(0,2) = sqr( cotTheta.error()) * cosTheta * sqr(sinTheta) / pt.value();
  m(1,1) = sqr( phi.error() );
  m(2,2) = sqr( cotTheta.error());
  m(3,3) = sqr( tip.error() );
  m(4,4) = sqr( zip.error() );
  LocalTrajectoryError error(m);

  LocalTrajectoryParameters lpar(
    LocalPoint(tipSign*tip.value(), -tipSign*zip.value(), 0),
    LocalVector(0., -tipSign*pt.value()*cotTheta.value(), pt.value()),
    charge);

  
  float sp = std::sin(phi.value());
  float cp = std::cos(phi.value());
  Surface::RotationType rot(
                            sp*tipSign, -cp*tipSign,           0,
                            0         ,           0,    -tipSign,
                            cp        ,  sp        ,           0);

  // BTSOS hold BP in a shared pointer and  will be autodeleted when BTSOS goes out of scope...
  // to avoid memory churn we allocate it locally and just avoid it be deleted by refcount... 
  Plane impPointPlane(origin, rot);
  // (twice just to be sure!)
  impPointPlane.addReference(); impPointPlane.addReference();
  // use Base (too avoid a useless new) 
  BasicTrajectoryStateOnSurface impactPointState( lpar , error, impPointPlane, mf, 1.0);
  
  //checkState(impactPointState,mf);
  LogTrace("")<<"constructed TSOS :\n"<<print(impactPointState);

  int ndof = 2*hits.size()-5;
  GlobalPoint vv = impactPointState.globalPosition();
  math::XYZPoint  pos( vv.x(), vv.y(), vv.z() );
  GlobalVector pp = impactPointState.globalMomentum();
  math::XYZVector mom( pp.x(), pp.y(), pp.z() );

  reco::Track * track = new reco::Track( chi2, ndof, pos, mom, 
        impactPointState.charge(), impactPointState.curvilinearError());

  LogTrace("") <<"RECONSTRUCTED TRACK (0,0,0):\n"<< print(*track,GlobalPoint(0,0,0))<<std::endl;;
  LogTrace("") <<"RECONSTRUCTED TRACK "<<origin<<"\n"<< print(*track,origin)<<std::endl;;

  return track;
}