CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoTracker/TkTrackingRegions/src/OuterHitCompatibility.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TkTrackingRegions/interface/OuterHitCompatibility.h"
00002 #include "TrackingTools/DetLayers/interface/PhiLess.h"
00003 #include "DataFormats/Common/interface/Handle.h"
00004 #include "FWCore/Framework/interface/ESHandle.h"
00005 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00006 
00007 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00008 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00009 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
00010 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00011 
00012 bool OuterHitCompatibility::operator() ( const TransientTrackingRecHit * hit) const
00013 {
00014   GlobalPoint hitPos = hit->globalPosition();
00015   float hitR = hitPos.perp();
00016   float hitPhi = hitPos.phi();
00017 
00018   if ( !checkPhi(hitPhi, hitR) ) return 0;
00019 
00020   float hitZ = hitPos.z();
00021   if ( !(*theRZCompatibility)(hitR,hitZ) ) return 0;
00022 
00023   return 1;
00024 }
00025 
00026 
00027 bool OuterHitCompatibility::operator() ( const TrackingRecHit* hit,  const edm::EventSetup& iSetup) const
00028 {
00029   edm::ESHandle<TrackerGeometry> tracker;
00030   iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
00031   DetId tmp=hit->geographicalId();
00032   GlobalPoint hitPos = tracker->idToDet(tmp)->surface().toGlobal(hit->localPosition());
00033   float hitR = hitPos.perp();
00034   float hitPhi = hitPos.phi();
00035 
00036   if ( !checkPhi(hitPhi, hitR) ) return 0;
00037  
00038   float hitZ = hitPos.z();
00039   if ( !(*theRZCompatibility)(hitR,hitZ) ) return 0;
00040 
00041   return 1;
00042 }
00043 
00044 bool OuterHitCompatibility::checkPhi(const float & phi, const float & r) const 
00045 {
00046   OuterHitPhiPrediction::Range hitPhiRange = thePhiPrediction(r);
00047   PhiLess less;
00048   bool phiOK = less(hitPhiRange.min(),phi) && less(phi,hitPhiRange.max());
00049   return phiOK;
00050 }
00051