CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/RecoTracker/TkTrackingRegions/src/GlobalDetRangeRPhi.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TkTrackingRegions/interface/GlobalDetRangeRPhi.h"
00002 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00003 #include "DataFormats/GeometrySurface/interface/Bounds.h"
00004 #include "TrackingTools/DetLayers/interface/PhiLess.h"
00005 #include <functional>
00006 #include <cmath>
00007 #include <vector>
00008 
00009 using namespace std;
00010 
00011 GlobalDetRangeRPhi::GlobalDetRangeRPhi( const BoundPlane& plane) {
00012 
00013   float dx = plane.bounds().width()/2.;
00014   float dy = plane.bounds().length()/2.;
00015 
00016   std::vector<Surface::GlobalPoint> corners(4);
00017   corners[0] = plane.toGlobal( LocalPoint( -dx, -dy, 0));
00018   corners[1] = plane.toGlobal( LocalPoint( -dx,  dy, 0));
00019   corners[2] = plane.toGlobal( LocalPoint(  dx, -dy, 0));
00020   corners[3] = plane.toGlobal( LocalPoint(  dx,  dy, 0));
00021 
00022   float phimin = corners[0].phi();  float phimax = phimin;
00023   float rmin   = corners[0].perp(); float rmax   = rmin;
00024   for ( int i=1; i<4; i++) {
00025     float phi = corners[i].phi();
00026     if ( PhiLess()( phi, phimin)) phimin = phi;
00027     if ( PhiLess()( phimax, phi)) phimax = phi;
00028 
00029 //    if ( phi < phimin) phimin = phi;
00030 //    if ( phi > phimax) phimax = phi;
00031 
00032     float r = corners[i].perp();
00033     if ( r < rmin) rmin = r;
00034     if ( r > rmax) rmax = r;
00035   }
00036 
00037   theRRange.first    = rmin;
00038   theRRange.second   = rmax;
00039   thePhiRange.first  = phimin;
00040   thePhiRange.second = phimax;
00041 
00042 }