CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/RecoEgamma/EgammaPhotonAlgos/src/ConversionForwardEstimator.cc

Go to the documentation of this file.
00001 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionForwardEstimator.h"
00004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" 
00005 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00006 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00007 
00008 
00009 
00010 
00011   // zero value indicates incompatible ts - hit pair
00012 std::pair<bool,double> ConversionForwardEstimator::estimate( const TrajectoryStateOnSurface& ts, 
00013                                                         const TransientTrackingRecHit& hit) const {
00014   LogDebug("ConversionForwardEstimator") << "ConversionForwardEstimator::estimate( const TrajectoryStateOnSurface& ts ...) " << "\n";
00015   //  std::cout  << "ConversionForwardEstimator::estimate( const TrajectoryStateOnSurface& ts ...) " << "\n";
00016   
00017   std::pair<bool,double> result;
00018   
00019   float tsPhi = ts.globalParameters().position().phi();
00020   GlobalPoint gp = hit.globalPosition();
00021   float rhPhi = gp.phi();
00022   float rhR = gp.perp();
00023 
00024   // allow an r fudge of 1.5 * times the sigma
00025   // nodt used float dr = 1.5 * hit.localPositionError().yy();
00026   //std::cout << " err " << hit.globalPositionError().phierr(gp) 
00027   //    << " "     << hit.globalPositionError().rerr(gp) << std::endl;
00028 
00029   // not used float zLayer = ts.globalParameters().position().z();
00030   float rLayer = ts.globalParameters().position().perp();
00031 
00032   float newdr = sqrt(pow(dr_,2)+4.*hit.localPositionError().yy());
00033   float rMin = rLayer - newdr;
00034   float rMax = rLayer + newdr;
00035   float phiDiff = tsPhi - rhPhi;
00036   if (phiDiff > pi) phiDiff -= twopi;
00037   if (phiDiff < -pi) phiDiff += twopi; 
00038 
00039   //std::cout << " ConversionForwardEstimator: RecHit at " << gp << "\n";
00040   //std::cout << "                   rMin = " << rMin << ", rMax = " << rMax << ", rHit = " << rhR << "\n";
00041   //std::cout << "                   thePhiRangeMin = " << thePhiRangeMin << ", thePhiRangeMax = " << thePhiRangeMax << ", phiDiff = " << phiDiff << "\n";
00042 
00043   
00044   if ( phiDiff < thePhiRangeMax && phiDiff > thePhiRangeMin && 
00045        rhR < rMax && rhR > rMin) {
00046   
00047     
00048     //    std::cout << "      estimator returns 1 with phiDiff " << thePhiRangeMin << " < " << phiDiff << " < "
00049     // << thePhiRangeMax << " and rhR " << rMin << " < " << rhR << " < " << rMax << "\n";
00050     //std::cout << " YES " << phiDiff << " " <<rLayer-rhR << "\n";
00051     //std::cout << "                  => RECHIT ACCEPTED " << "\n";
00052    
00053     result.first= true;
00054     result.second=phiDiff;
00055   } else {
00056     /*
00057     cout << "      estimator returns 0 with phiDiff " << thePhiRangeMin << " < " << phiDiff << " < "
00058      << thePhiRangeMax << " and  rhR " << rMin << " < " << rhR << " < " << rMax << endl;
00059     */
00060     result.first= false;
00061     result.second=0;    
00062     
00063   }
00064   
00065   return result;
00066   
00067 }
00068 
00069 bool ConversionForwardEstimator::estimate( const TrajectoryStateOnSurface& ts, 
00070                            const BoundPlane& plane) const {
00071 
00072   //  std::cout << "ConversionForwardEstimator::estimate( const TrajectoryStateOnSurface& ts, const BoundPlane& plane) always TRUE " << "\n";  
00073   // this method should return one if a detector ring is close enough
00074   //     to the hit, zero otherwise.
00075   //     Now time is wasted looking for hits in the rings which are anyhow
00076   //     too far from the prediction   
00077   return true ;
00078 
00079 }
00080 
00081 
00082 
00083 MeasurementEstimator::Local2DVector
00084 ConversionForwardEstimator::maximalLocalDisplacement( const TrajectoryStateOnSurface& ts,
00085                                                         const BoundPlane& plane) const
00086 {
00087   
00088   /*
00089   if ( ts.hasError() ) {
00090     LocalError le = ts.localError().positionError();
00091     std::cout << "  ConversionForwardEstimator::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;
00092     return Local2DVector( sqrt(le.xx())*nSigmaCut(), sqrt(le.yy())*nSigmaCut());
00093     
00094   }
00095   else return Local2DVector(99999,99999);
00096   */
00097 
00098   return Local2DVector(99999,99999);
00099 
00100 }
00101 
00102