CMS 3D CMS Logo

Public Member Functions | Private Attributes

PixelFitterByConformalMappingAndLine Class Reference

#include <PixelFitterByConformalMappingAndLine.h>

Inheritance diagram for PixelFitterByConformalMappingAndLine:
PixelFitter

List of all members.

Public Member Functions

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

Private Attributes

edm::ParameterSet theConfig

Detailed Description

Definition at line 12 of file PixelFitterByConformalMappingAndLine.h.


Constructor & Destructor Documentation

PixelFitterByConformalMappingAndLine::PixelFitterByConformalMappingAndLine ( const edm::ParameterSet cfg)

Definition at line 40 of file PixelFitterByConformalMappingAndLine.cc.

                                : theConfig(cfg)
{ }
PixelFitterByConformalMappingAndLine::PixelFitterByConformalMappingAndLine ( )

Definition at line 44 of file PixelFitterByConformalMappingAndLine.cc.

{ }
virtual PixelFitterByConformalMappingAndLine::~PixelFitterByConformalMappingAndLine ( ) [inline, virtual]

Definition at line 16 of file PixelFitterByConformalMappingAndLine.h.

{ }

Member Function Documentation

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

Reimplemented from PixelFitter.

Definition at line 47 of file PixelFitterByConformalMappingAndLine.cc.

References PixelTrackBuilder::build(), ConformalMappingFit::charge(), DeDxDiscriminatorTools::charge(), RZLine::chi2(), ConformalMappingFit::chi2(), ConformalMappingFit::curvature(), GlobalErrorBase< T, ErrorWeightType >::czz(), ConformalMappingFit::directionPhi(), Measurement1D::error(), error, benchmark_cfg::errors, edm::ParameterSet::exists(), RZLine::fit(), ConformalMappingFit::fixImpactParmaeter(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), i, ConformalMappingFit::impactParameter(), PixelRecoUtilities::inversePt(), TrackingRegion::origin(), PV3DBase< T, PVType, FrameType >::perp2(), phi, point, edm::ESHandle< T >::product(), alignCSCRings::r, GlobalErrorBase< T, ErrorWeightType >::rerr(), funct::sqr(), mathSSE::sqrt(), theConfig, patCandidatesForDimuonsSequences_cff::tracker, Measurement1D::value(), PV3DBase< T, PVType, FrameType >::x(), create_public_lumi_plots::xy, PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and z.

{

  int nhits = hits.size();

  vector<GlobalPoint> points;
  vector<GlobalError> errors;
  vector<bool> isBarrel;
  

  edm::ESHandle<TrackerGeometry> tracker;
  es.get<TrackerDigiGeometryRecord>().get(tracker);

  edm::ESHandle<MagneticField> field;
  es.get<IdealMagneticFieldRecord>().get(field);

  edm::ESHandle<TransientTrackingRecHitBuilder> ttrhBuilder;
  string ttrhBuilderName = theConfig.getParameter<std::string>("TTRHBuilder");
  es.get<TransientRecHitRecord>().get( ttrhBuilderName, ttrhBuilder);

  for (vector<const TrackingRecHit*>::const_iterator ih=hits.begin();  ih!=hits.end(); ih++) {
    TransientTrackingRecHit::RecHitPointer recHit = ttrhBuilder->build(*ih);
    points.push_back( recHit->globalPosition() );
    errors.push_back( recHit->globalPositionError() );
    isBarrel.push_back( recHit->detUnit()->type().isBarrel() );
  }

//    if (useMultScatt) {
//      MultipleScatteringParametrisation ms(hits[i].layer());
//      float cotTheta = (p.z()-zVtx)/p.perp();
//      err += sqr( ms( pt, cotTheta, PixelRecoPointRZ(0.,zVtx) ) );
//    }

  //
  // simple fit to get pt, phi0 used for precise calcul.
  //
  typedef ConformalMappingFit::PointXY PointXY;
  vector<PointXY> xy; vector<float> errRPhi2;
  for (int i=0; i < nhits; ++i) {
    const GlobalPoint & point = points[i];
    xy.push_back(PointXY( point.x()-region.origin().x(), point.y()-region.origin().y()));
    float phiErr2 = errors[i].phierr(point);
    errRPhi2.push_back( point.perp2()*phiErr2);
  }
  ConformalMappingFit parabola(xy, errRPhi2);
  if (theConfig.exists("fixImpactParameter")) 
    parabola.fixImpactParmaeter(theConfig.getParameter<double>("fixImpactParameter"));
  else if (nhits < 3) parabola.fixImpactParmaeter(0.);
 

  Measurement1D curv = parabola.curvature();
  float invPt = PixelRecoUtilities::inversePt( curv.value(), es);
  float valPt =  (invPt > 1.e-4) ? 1./invPt : 1.e4;
  float errPt =PixelRecoUtilities::inversePt(curv.error(), es) * sqr(valPt);
  Measurement1D pt (valPt,errPt);
  Measurement1D phi = parabola.directionPhi();
  Measurement1D tip = parabola.impactParameter();

  //
  // precalculate theta to correct errors:
  //
  vector<float> r(nhits),z(nhits),errZ(nhits);
  float simpleCot = ( points.back().z()-points.front().z() )/ (points.back().perp() - points.front().perp() );
  for (int i=0; i< nhits; ++i) {
    const GlobalPoint & point = points[i]; 
    const GlobalError & error = errors[i];
    r[i] = sqrt( sqr(point.x()-region.origin().x()) + sqr(point.y()-region.origin().y()) );
    r[i] += pixelrecoutilities::LongitudinalBendingCorrection(pt.value(),es)(r[i]);
    z[i] = point.z()-region.origin().z();  
    errZ[i] =  (isBarrel[i]) ? sqrt(error.czz()) : sqrt( error.rerr(point) )*simpleCot;
  }

  //
  // line fit (R-Z plane)
  //
  RZLine rzLine(r,z,errZ);
  float      cottheta, intercept, covss, covii, covsi;
  rzLine.fit(cottheta, intercept, covss, covii, covsi);
  
//
// parameters for track builder 
//
  Measurement1D zip(intercept, sqrt(covii));
  Measurement1D cotTheta(cottheta, sqrt(covss));  
  float chi2 = parabola.chi2() +  rzLine.chi2(cottheta, intercept);
  int charge = parabola.charge();


  PixelTrackBuilder builder;
  return builder.build(pt, phi, cotTheta, tip, zip, chi2, charge, hits,  field.product(), region.origin());
}

Member Data Documentation

Definition at line 22 of file PixelFitterByConformalMappingAndLine.h.

Referenced by run().