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 156 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]

Implements PixelFitter.

Definition at line 160 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(), benchmark_cfg::errors, f, RZLine::fit(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), i, PixelRecoUtilities::inversePt(), Basic2DVector< T >::mag(), TrackingRegion::origin(), PV3DBase< T, PVType, FrameType >::phi(), phi, edm::ESHandle< T >::product(), funct::sin(), 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) {
    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 errPt = 0.055f*valPt + 0.017f*valPt*valPt;
  float errValTip = errTip(valPt, points.back().eta());
  float errPhi = 0.002f;

  float valZip = zip(valTip, valPhi, curvature, points[0],points[1]);
  float errValZip = errZip(valPt, points.back().eta());

  float valCotTheta = cotTheta(points[0],points[1]);
  float errCotTheta = 0.002f;

  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, errPt);
  Measurement1D phi(valPhi, errPhi);
  Measurement1D cotTheta(valCotTheta, errCotTheta);
  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().