CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/RecoTracker/TkDetLayers/src/DiskSectorBounds.cc

Go to the documentation of this file.
00001 #include "DiskSectorBounds.h"
00002 
00003 using namespace std;
00004 
00005 bool DiskSectorBounds::inside( const Local3DPoint& p) const {
00006   
00007   // transform to system with local frame situated at disk center
00008   // and rotated  x/y axis
00009   Local3DPoint tmp( p.y()+theOffset, -p.x(), p.z());
00010   
00011   return  fabs(tmp.phi()) <= thePhiExt/2. &&
00012     tmp.perp() >= theRmin && tmp.perp() <= theRmax &&
00013     tmp.z() >= theZmin && tmp.z() <= theZmax ;
00014 
00015 }
00016 
00017 bool DiskSectorBounds::inside( const Local3DPoint& p, const LocalError& err, float scale) const {
00018 
00019   if (p.z() < theZmin || p.z() > theZmax) return false;
00020 
00021   Local3DPoint tmp( p.x(), p.y()+ theOffset, p.z());
00022   double perp2 = tmp.perp2();
00023   double perp = sqrt(perp2);
00024 
00025   // this is not really correct, should consider also the angle of the error ellipse
00026    if (perp2 == 0) return scale*scale*err.yy()   > theRmin*theRmin;
00027 
00028    LocalError tmpErr( err.xx(), err.xy(), err.yy());
00029    LocalError rotatedErr = tmpErr.rotate(tmp.x(), tmp.y());
00030    // x direction in this system is now r, phi is y
00031  
00032    float deltaR = scale*sqrt(rotatedErr.xx());
00033    float deltaPhi = atan( scale*sqrt(rotatedErr.yy())/perp);
00034 
00035    float tmpPhi = acos( tmp.y() / perp);
00036    
00037    return  perp >= max(theRmin-deltaR, 0.f) && perp <= theRmax+deltaR 
00038      && tmpPhi <= thePhiExt + deltaPhi ;  
00039 
00040 }