CMS 3D CMS Logo

BarrelMeasurementEstimator.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    EgammaElectronAlgos
00004 // Class:      BarrelMeasurementEstimator
00005 // 
00013 //
00014 // Original Author:  Ursula Berthon, Claude Charlot
00015 //         Created:  Mon Mar 27 13:22:06 CEST 2006
00016 // $Id: BarrelMeasurementEstimator.cc,v 1.12 2008/04/12 22:33:58 charlot Exp $
00017 //
00018 //
00019 
00020 #include "RecoEgamma/EgammaElectronAlgos/interface/BarrelMeasurementEstimator.h"
00021 #include "RecoTracker/TkTrackingRegions/interface/GlobalDetRangeZPhi.h"
00022 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00023 #include "TrackingTools/DetLayers/interface/rangesIntersect.h"
00024 #include "TrackingTools/DetLayers/interface/PhiLess.h"
00025 #include "CLHEP/Units/PhysicalConstants.h"
00026 
00027 
00028 // zero value indicates incompatible ts - hit pair
00029 std::pair<bool,double> BarrelMeasurementEstimator::estimate( const TrajectoryStateOnSurface& ts, 
00030                                                              const TransientTrackingRecHit& hit) const {
00031   LocalPoint lp = hit.localPosition();
00032   GlobalPoint gp = hit.det()->surface().toGlobal( lp);
00033   return this->estimate(ts,gp);
00034 }
00035   
00036 //usable in case we have no TransientTrackingRecHit
00037 std::pair<bool,double> BarrelMeasurementEstimator::estimate( const TrajectoryStateOnSurface& ts, 
00038                                            GlobalPoint &gp) const {
00039   float tsPhi = ts.globalParameters().position().phi();
00040   float myR = gp.perp();
00041   float myZ = gp.z();
00042   
00043   float myZmax =  theZMax;
00044   float myZmin =  theZMin;
00045 
00046   if(fabs(myZ)<30. && myR>8.)
00047     {
00048       myZmax = 0.09;
00049       myZmin = -0.09;
00050     } 
00051 
00052   float rhPhi = gp.phi();
00053   
00054   float zDiff = ts.globalParameters().position().z() - gp.z(); 
00055   float phiDiff = tsPhi - rhPhi;
00056   if (phiDiff > pi) phiDiff -= twopi;
00057   if (phiDiff < -pi) phiDiff += twopi; 
00058    
00059   if ( phiDiff < thePhiMax && phiDiff > thePhiMin && 
00060        zDiff < myZmax && zDiff > myZmin) {
00061     
00062     return std::pair<bool,double>(true,1.);
00063      } else {
00064 
00065     return std::pair<bool,double>(false,0.);
00066     }
00067 }
00068 
00069 bool BarrelMeasurementEstimator::estimate( const TrajectoryStateOnSurface& ts, 
00070                                            const BoundPlane& plane) const {
00071     
00072   typedef std::pair<float,float> Range; 
00073 
00074 
00075   GlobalPoint trajPos(ts.globalParameters().position());
00076   GlobalDetRangeZPhi detRange(plane);
00077 
00078   Range trajZRange(trajPos.z() - fabs(theZMin), trajPos.z() + fabs(theZMax));
00079   Range trajPhiRange(trajPos.phi() - fabs(thePhiMin), trajPos.phi() + fabs(thePhiMax));
00080 
00081   if(rangesIntersect(trajZRange, detRange.zRange()) &&
00082      rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess())) {
00083     return true;
00084   }
00085   else { 
00086     //     cout <<cout<<" barrel boundpl est returns false!!"<<endl;
00087     //     cout<<"BarrelMeasurementEstimator(estimate) :thePhiMin,thePhiMax, theZMin,theZMax "<<thePhiMin<<" "<<thePhiMax<<" "<< theZMin<<" "<<theZMax<<endl;
00088     //     cout<<" trajZRange "<<trajZRange.first<<" "<<trajZRange.second<<endl;
00089     //     cout<<" trajPhiRange "<<trajPhiRange.first<<" "<<trajPhiRange.second<<endl;
00090     //     cout<<" detZRange "<<detRange.zRange().first<<" "<<detRange.zRange().second<<endl;
00091     //     cout<<" detPhiRange "<<detRange.phiRange().first<<" "<<detRange.phiRange().second<<endl;
00092     //     cout<<" intersect z: "<<rangesIntersect(trajZRange, detRange.zRange())<<endl;
00093     //     cout<<" intersect phi: "<<rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess())<<endl;
00094     return false;
00095   }
00096 
00097 }
00098 
00099 MeasurementEstimator::Local2DVector 
00100 BarrelMeasurementEstimator::maximalLocalDisplacement( const TrajectoryStateOnSurface& ts,
00101                                                         const BoundPlane& plane) const
00102 {
00103   float nSigmaCut = 3.;
00104   if ( ts.hasError()) {
00105     LocalError le = ts.localError().positionError();
00106     return Local2DVector( sqrt(le.xx())*nSigmaCut, sqrt(le.yy())*nSigmaCut);
00107   }
00108   else return Local2DVector(99999,99999);
00109 }
00110 
00111 
00112 

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