CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoMuon/Navigation/src/MuonNavigableLayer.cc

Go to the documentation of this file.
00001 
00019 #include "RecoMuon/Navigation/interface/MuonNavigableLayer.h"
00020 
00021 /* Collaborating Class Header */
00022 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00023 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
00024 #include "RecoMuon/Navigation/interface/MuonDetLayerMap.h"
00025 #include "RecoMuon/Navigation/interface/MuonEtaRange.h"
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027 /* C++ Headers */
00028 #include <algorithm>
00029 
00030 
00031 using namespace std;
00032 
00033 extern float calculateEta(float r, float z)  {
00034   if ( z > 0 ) return -log((tan(atan(r/z)/2.)));
00035   return log(-(tan(atan(r/z)/2.)));
00036 
00037 }
00038 
00039 MuonEtaRange MuonNavigableLayer::trackingRange(const FreeTrajectoryState& fts) const
00040 {  
00041   float z = fts.position().z();
00042   float r = fts.position().perp();
00043   float eta;
00044   if ( z>0 ) eta = -log((tan(atan(r/z)/2.)));
00045   else eta = log(-(tan(atan(r/z)/2.)));
00046 
00047   double theta = atan(r/z);
00048 
00049   double spread = 5.0*sqrt(fts.curvilinearError().matrix()(2,2))/fabs(sin(theta));  //5*sigma(eta)
00050 
00051   //C.L.: this spread could be too large to use.
00052   // convert it to a smaller one by assuming a virtual radius
00053   // that transforms the error on angle to error on z axis.
00054   // not accurate, but works!
00055 
00056   double eta_max = 0;
00057 
00058   if ( z > 0 ) eta_max = calculateEta(r, z+spread); 
00059   else eta_max = calculateEta(r, z-spread); 
00060 
00061   spread = std::min(0.07, fabs(eta_max-eta));
00062 
00063   MuonEtaRange range(eta+spread,eta-spread);
00064 
00065   spread = 0.07; 
00066   // special treatment for special geometry in overlap region
00067   
00068   if ( eta > 1.0 && eta < 1.1 )  range = MuonEtaRange(eta+3.0*spread,eta-spread);
00069   if ( eta < -1.0 && eta > -1.1 ) range = MuonEtaRange(eta+spread,eta-3.0*spread);
00070 
00071   return range;
00072 }
00073 
00074 bool MuonNavigableLayer::isInsideOut(const FreeTrajectoryState& fts) const {
00075   
00076   return (fts.position().basicVector().dot(fts.momentum().basicVector())>0);
00077   
00078 }
00079