CMS 3D CMS Logo

ConversionBarrelEstimator.cc

Go to the documentation of this file.
00001 #include "CLHEP/Units/PhysicalConstants.h"
00002 #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionBarrelEstimator.h"
00003 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00004 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00005 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" 
00006 #include "TrackingTools/DetLayers/interface/PhiLess.h"
00007 #include "TrackingTools/DetLayers/interface/rangesIntersect.h"
00008 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00009 #include "RecoTracker/TkTrackingRegions/interface/GlobalDetRangeZPhi.h"
00010 
00011 
00012   // zero value indicates incompatible ts - hit pair
00013 std::pair<bool,double> ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, 
00014                                                             const TransientTrackingRecHit& hit) const {
00015   std::pair<bool,double> result;
00016   
00017   //std::cout << "  ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const TransientTrackingRecHit& hit) " << std::endl;
00018  
00019   float tsPhi = ts.globalParameters().position().phi();
00020   GlobalPoint gp = hit.globalPosition();
00021   float rhPhi = gp.phi();
00022   
00023   // allow a z fudge of 2 sigma
00024   float dz = 2. * sqrt(hit.localPositionError().yy()) ;
00025   float zDiff = ts.globalParameters().position().z() - gp.z(); 
00026   float phiDiff = tsPhi - rhPhi;
00027   if (phiDiff > pi) phiDiff -= twopi;
00028   if (phiDiff < -pi) phiDiff += twopi; 
00029   
00030   // add the errors on the window and the point in quadrature
00031   float zrange = sqrt(theZRangeMax*theZRangeMax + dz*dz);
00032   
00033   /*
00034   std::cout << "  BarrelEstimator ts local error " <<ts.localError().positionError()  << " hit local error " << hit.localPositionError() << std::endl; 
00035   std::cout << "  BarrelEstimator:  RecHit at " << gp << " phi " << rhPhi << " eta " << gp.eta() <<  std::endl;
00036   std::cout << "  BarrelEstimator:  ts at " << ts.globalParameters().position() << " phi " <<ts.globalParameters().position().phi() << " eta " << ts.globalParameters().position().eta()<<  std::endl;
00037   std::cout << "                    zrange = +/-" << zrange << ", zDiff = " << zDiff << std::endl;
00038   std::cout << "                    thePhiRangeMin = " << thePhiRangeMin << ", thePhiRangeMax = " << thePhiRangeMax << ", phiDiff = " << phiDiff << std::endl;
00039   */
00040 
00041   
00042   
00043   if ( phiDiff < thePhiRangeMax && phiDiff > thePhiRangeMin && 
00044        zDiff < zrange && zDiff > -zrange) {
00045     
00046     //    std::cout << "      estimator returns 1 with phiDiff " << thePhiRangeMin << " < " << phiDiff << " < "
00047     //    << thePhiRangeMax << " and zDiff " << zDiff << " < " << zrange << std::endl;
00048     // std::cout << " YES " << phiDiff << " " << zDiff << std::endl;
00049     // std::cout << "                  => RECHIT ACCEPTED " << std::endl;
00050     
00051     result.first=true;
00052     result.second=phiDiff;
00053   } else {
00054     
00055     //     std::cout << "      estimator returns NOT ACCEPTED  with phiDiff " << thePhiRangeMin << " < " << phiDiff << " < "
00056     //<< thePhiRangeMax << " and zDiff " << zDiff << " < " << theZRangeMax+dz << std::endl;
00057     
00058     result.first=false;
00059     result.second=0;
00060     
00061   }
00062   
00063   return result;
00064   
00065 }
00066 
00067 
00068 
00069 bool ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, 
00070                                                        const BoundPlane& plane) const {
00071   
00072   typedef     std::pair<float,float>   Range;
00073   //  std::cout << "  ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) " << std::endl;
00074 
00075   GlobalPoint trajPos(ts.globalParameters().position());
00076   GlobalDetRangeZPhi detRange(plane);
00077   Range trajZRange(trajPos.z() - 2.*theZRangeMax, trajPos.z() + 2.*theZRangeMax);
00078   Range trajPhiRange(trajPos.phi() + thePhiRangeMin, trajPos.phi() + thePhiRangeMax);
00079 
00080 
00081    if(rangesIntersect(trajZRange, detRange.zRange()) &&
00082       rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess())) {
00083      //     std::cout << "   ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane)  IN RANGE " << std::endl;  
00084     return true;   
00085 
00086 
00087 
00088   } else {
00089 
00090     //    std::cout << "   ConversionBarrelEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) NOT IN RANGE " << std::endl;  
00091     return false;
00092 
00093   }
00094 
00095 
00096 }
00097 
00098 
00099 MeasurementEstimator::Local2DVector
00100 ConversionBarrelEstimator::maximalLocalDisplacement( const TrajectoryStateOnSurface& ts,
00101                                                         const BoundPlane& plane) const
00102 {
00103   
00104 
00105   
00106   /* 
00107   if ( ts.hasError() ) {
00108     LocalError le = ts.localError().positionError();
00109     std::cout << "  ConversionBarrelEstimator::maximalLocalDisplacent local error " << sqrt(le.xx()) << " " << sqrt(le.yy()) << " nSigma " << nSigmaCut() << " sqrt(le.xx())*nSigmaCut() " << sqrt(le.xx())*nSigmaCut()  << "  sqrt(le.yy())*nSigmaCut() " <<  sqrt(le.yy())*nSigmaCut() << std::endl;
00110     return Local2DVector( sqrt(le.xx())*nSigmaCut(), sqrt(le.yy())*nSigmaCut());
00111   }
00112 
00113   else return Local2DVector(9999,9999);
00114   */
00115 return Local2DVector(9999,9999);
00116 
00117 }
00118 
00119 

Generated on Tue Jun 9 17:43:26 2009 for CMSSW by  doxygen 1.5.4