CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/RecoTracker/TkTrackingRegions/src/GlobalTrackingRegion.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TkTrackingRegions/interface/GlobalTrackingRegion.h"
00002 #include <cmath>
00003 #include <sstream>
00004 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00005 #include "RecoTracker/TkTrackingRegions/interface/HitEtaCheck.h"
00006 #include "RecoTracker/TkTrackingRegions/interface/HitRCheck.h"
00007 #include "RecoTracker/TkTrackingRegions/interface/HitZCheck.h"
00008 
00009 #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h"
00010 #include "RecoTracker/TkMSParametrization/interface/MultipleScatteringParametrisation.h"
00011 #include "RecoTracker/TkMSParametrization/interface/PixelRecoPointRZ.h"
00012 #include "RecoTracker/TkMSParametrization/interface/PixelRecoLineRZ.h"
00013 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00014 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00015 
00016 
00017 template <class T> T sqr( T t) {return t*t;}
00018 
00019 using namespace GeomDetEnumerators;
00020 
00021 std::string GlobalTrackingRegion::print() const {
00022   std::ostringstream str;
00023   str << TrackingRegionBase::print() << "precise: "<<thePrecise;
00024   return str.str(); 
00025 }
00026 
00027 TrackingRegion::Hits GlobalTrackingRegion::hits(
00028       const edm::Event& ev,
00029       const edm::EventSetup& es,
00030       const ctfseeding::SeedingLayer* layer) const
00031 {
00032  return layer->hits(ev,es);
00033 }
00034 
00035 HitRZCompatibility* GlobalTrackingRegion::checkRZ(const DetLayer* layer, 
00036         const Hit& outerHit, const edm::EventSetup& iSetup) const
00037 {
00038 
00039   bool isBarrel = (layer->location() == barrel);
00040   bool isPixel = (layer->subDetector() == PixelBarrel || layer->subDetector() == PixelEndcap);
00041   
00042 
00043   GlobalPoint ohit =  outerHit->globalPosition();
00044   float outerred_r = sqrt( sqr(ohit.x()-origin().x())+sqr(ohit.y()-origin().y()) );
00045   PixelRecoPointRZ outerred(outerred_r, ohit.z());
00046 
00047 
00048   PixelRecoPointRZ vtxR = (outerred.z() > origin().z()+originZBound()) ?
00049       PixelRecoPointRZ(-originRBound(), origin().z()+originZBound())
00050     : PixelRecoPointRZ( originRBound(), origin().z()+originZBound());
00051   PixelRecoPointRZ vtxL = (outerred.z() < origin().z()-originZBound()) ?
00052       PixelRecoPointRZ(-originRBound(), origin().z()-originZBound())
00053     : PixelRecoPointRZ( originRBound(), origin().z()-originZBound()); 
00054 
00055   if ((!thePrecise) &&(isPixel )) {
00056     double VcotMin = PixelRecoLineRZ( vtxR, outerred).cotLine();
00057     double VcotMax = PixelRecoLineRZ( vtxL, outerred).cotLine();
00058     return new HitEtaCheck(isBarrel, outerred, VcotMax, VcotMin);
00059   }
00060   
00061   float nSigmaPhi = 3.;
00062   float errZ =  nSigmaPhi*outerHit->errorGlobalZ(); 
00063   float errR =  nSigmaPhi*outerHit->errorGlobalR();
00064 
00065   PixelRecoPointRZ  outerL, outerR;
00066 
00067   if (layer->location() == barrel) {
00068     outerL = PixelRecoPointRZ(outerred.r(), outerred.z()-errZ);
00069     outerR = PixelRecoPointRZ(outerred.r(), outerred.z()+errZ);
00070   } 
00071   else if (outerred.z() > 0) {
00072     outerL = PixelRecoPointRZ(outerred.r()+errR, outerred.z());
00073     outerR = PixelRecoPointRZ(outerred.r()-errR, outerred.z());
00074   } 
00075   else {
00076     outerL = PixelRecoPointRZ(outerred.r()-errR, outerred.z());
00077     outerR = PixelRecoPointRZ(outerred.r()+errR, outerred.z());
00078   }
00079   
00080   MultipleScatteringParametrisation iSigma(layer,iSetup);
00081   PixelRecoPointRZ vtxMean(0.,origin().z());
00082   float innerScatt = 3 * iSigma( ptMin(), vtxMean, outerred);
00083 
00084   //
00085   //
00086   //
00087   PixelRecoLineRZ leftLine( vtxL, outerL);
00088   PixelRecoLineRZ rightLine( vtxR, outerR);
00089   HitRZConstraint rzConstraint(leftLine, rightLine);
00090   float cotTheta = PixelRecoLineRZ(vtxMean,outerred).cotLine();
00091 
00092   if (isBarrel) {
00093     float sinTheta = 1/sqrt(1+sqr(cotTheta));
00094     float corrZ = innerScatt/sinTheta + errZ;
00095     return new HitZCheck(rzConstraint, HitZCheck::Margin(corrZ,corrZ));
00096   } else {
00097     float cosTheta = 1/sqrt(1+sqr(1/cotTheta));
00098     float corrR = innerScatt/cosTheta + errR;
00099     return new HitRCheck( rzConstraint, HitRCheck::Margin(corrR,corrR));
00100   }
00101 }