CMS 3D CMS Logo

Public Member Functions | Private Attributes

PixelFitterByHelixProjections Class Reference

#include <PixelFitterByHelixProjections.h>

Inheritance diagram for PixelFitterByHelixProjections:
PixelFitter

List of all members.

Public Member Functions

 PixelFitterByHelixProjections (const edm::ParameterSet &cfg)
virtual reco::Trackrun (const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region) const
virtual ~PixelFitterByHelixProjections ()

Private Attributes

edm::ParameterSet theConfig
const MagneticFieldtheField
const TrackerGeometrytheTracker
const
TransientTrackingRecHitBuilder
theTTRecHitBuilder

Detailed Description

Definition at line 19 of file PixelFitterByHelixProjections.h.


Constructor & Destructor Documentation

PixelFitterByHelixProjections::PixelFitterByHelixProjections ( const edm::ParameterSet cfg)

Definition at line 96 of file PixelFitterByHelixProjections.cc.

virtual PixelFitterByHelixProjections::~PixelFitterByHelixProjections ( ) [inline, virtual]

Definition at line 22 of file PixelFitterByHelixProjections.h.

{}

Member Function Documentation

reco::Track * PixelFitterByHelixProjections::run ( const edm::EventSetup es,
const std::vector< const TrackingRecHit * > &  hits,
const TrackingRegion region 
) const [virtual]

Reimplemented from PixelFitter.

Definition at line 100 of file PixelFitterByHelixProjections.cc.

References TransientTrackingRecHitBuilder::build(), PixelTrackBuilder::build(), CircleFromThreePoints::center(), DeDxDiscriminatorTools::charge(), edm::ESWatcher< T >::check(), RZLine::chi2(), funct::cos(), PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), alignCSCRings::e, PixelTrackErrorParam::errCot(), benchmark_cfg::errors, PixelTrackErrorParam::errPhi(), PixelTrackErrorParam::errPt(), PixelTrackErrorParam::errTip(), PixelTrackErrorParam::errZip(), f, RZLine::fit(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), i, MagneticField::inTesla(), PixelRecoUtilities::inversePt(), likely, Basic2DVector< T >::mag(), TrackingRegion::origin(), PV3DBase< T, PVType, FrameType >::phi(), phi, edm::ESHandle< T >::product(), funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, theConfig, theField, theTracker, theTTRecHitBuilder, PV3DBase< T, PVType, FrameType >::x(), Basic2DVector< T >::x(), PV3DBase< T, PVType, FrameType >::y(), Basic2DVector< T >::y(), and PV3DBase< T, PVType, FrameType >::z().

{
  int nhits = hits.size();
  if (nhits <2) return 0;

  vector<GlobalPoint> points(nhits);
  vector<GlobalError> errors(nhits);
  vector<bool> isBarrel(nhits);
  
  static edm::ESWatcher<TrackerDigiGeometryRecord> watcherTrackerDigiGeometryRecord;
  if (!theTracker || watcherTrackerDigiGeometryRecord.check(es)) {
    edm::ESHandle<TrackerGeometry> trackerESH;
    es.get<TrackerDigiGeometryRecord>().get(trackerESH);
    theTracker = trackerESH.product();
  }

  static edm::ESWatcher<IdealMagneticFieldRecord>  watcherIdealMagneticFieldRecord;
  if (!theField || watcherIdealMagneticFieldRecord.check(es)) {
    edm::ESHandle<MagneticField> fieldESH;
    es.get<IdealMagneticFieldRecord>().get(fieldESH);
    theField = fieldESH.product();
  }

  static edm::ESWatcher<TransientRecHitRecord> watcherTransientRecHitRecord;
  if (!theTTRecHitBuilder || watcherTransientRecHitRecord.check(es)) {
    edm::ESHandle<TransientTrackingRecHitBuilder> ttrhbESH;
    std::string builderName = theConfig.getParameter<std::string>("TTRHBuilder");
    es.get<TransientRecHitRecord>().get(builderName,ttrhbESH);
    theTTRecHitBuilder = ttrhbESH.product();
  }


  for ( int i=0; i!=nhits; ++i) {
    TransientTrackingRecHit::RecHitPointer recHit = theTTRecHitBuilder->build(hits[i]);
    points[i]  = GlobalPoint( recHit->globalPosition().x()-region.origin().x(), 
                              recHit->globalPosition().y()-region.origin().y(),
                              recHit->globalPosition().z()-region.origin().z() 
                              );
    errors[i] = recHit->globalPositionError();
    isBarrel[i] = recHit->detUnit()->type().isBarrel();
  }

  CircleFromThreePoints circle = (nhits==2) ?
        CircleFromThreePoints( GlobalPoint(0.,0.,0.), points[0], points[1]) :
        CircleFromThreePoints(points[0],points[1],points[2]); 

  float valPhi, valTip, valPt;

  int iCharge = charge(points);
  float curvature = circle.curvature();

  if ((curvature > 1.e-4)&&
        (likely(theField->inTesla(GlobalPoint(0.,0.,0.)).z()>0.01))) {
    float invPt = PixelRecoUtilities::inversePt( circle.curvature(), es);
    valPt = (invPt > 1.e-4f) ? 1.f/invPt : 1.e4f;
    CircleFromThreePoints::Vector2D center = circle.center();
    valTip = iCharge * (center.mag()-1.f/curvature);
    valPhi = phi(center.x(), center.y(), iCharge);
  } 
  else {
    valPt = 1.e4f; 
    GlobalVector direction(points[1]-points[0]);
    valPhi =  direction.phi(); 
    valTip = -points[0].x()*sin(valPhi) + points[0].y()*cos(valPhi); 
  }

  float valCotTheta = cotTheta(points[0],points[1]);
  float valEta = asinh(valCotTheta);
  float valZip = zip(valTip, valPhi, curvature, points[0],points[1]);

  PixelTrackErrorParam param(valEta, valPt);
  float errValPt  = param.errPt();
  float errValCot = param.errCot();
  float errValTip = param.errTip();
  float errValPhi = param.errPhi();
  float errValZip = param.errZip();


  float chi2 = 0;
  if (nhits > 2) {
    RZLine rzLine(points,errors,isBarrel);
    float cottheta, intercept, covss, covii, covsi; 
    rzLine.fit(cottheta, intercept, covss, covii, covsi);
    chi2 = rzLine.chi2(cottheta, intercept);         //FIXME: check which intercept to use!
  }

  PixelTrackBuilder builder;
  Measurement1D pt(valPt, errValPt);
  Measurement1D phi(valPhi, errValPhi);
  Measurement1D cotTheta(valCotTheta, errValCot);
  Measurement1D tip(valTip, errValTip);
  Measurement1D zip(valZip, errValZip);

  return builder.build(pt, phi, cotTheta, tip, zip, chi2, iCharge, hits, theField, region.origin() );
}

Member Data Documentation

Definition at line 40 of file PixelFitterByHelixProjections.h.

Referenced by run().

Definition at line 43 of file PixelFitterByHelixProjections.h.

Referenced by run().

Definition at line 42 of file PixelFitterByHelixProjections.h.

Referenced by run().

Definition at line 44 of file PixelFitterByHelixProjections.h.

Referenced by run().