CMS 3D CMS Logo

ThirdHitRZPrediction.cc

Go to the documentation of this file.
00001 #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitRZPrediction.h"
00002 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00003 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
00004 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
00005 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00006 #include "RecoTracker/TkMSParametrization/interface/MultipleScatteringParametrisation.h"
00007 #include "RecoTracker/TkMSParametrization/interface/LongitudinalBendingCorrection.h"
00008 
00009 template <class T> T sqr( T t) {return t*t;}
00010 
00011 ThirdHitRZPrediction::ThirdHitRZPrediction(
00012   const GlobalPoint &gp1, const GlobalPoint &gp2, float tolerance, const DetLayer* layer)
00013   : theBarrel(false), theForward(false), theTolerance( Margin(tolerance,tolerance) )
00014 {
00015     PixelRecoPointRZ p1(gp1.perp(), gp1.z());
00016     PixelRecoPointRZ p2(gp2.perp(), gp2.z());
00017     float dr = p2.r() - p1.r();
00018     if ( dr != 0.) {
00019       theLine = PixelRecoLineRZ(p2, p1);
00020     }
00021     else { theLine = PixelRecoLineRZ(p1, 99999.); }
00022    
00023     if (layer) initLayer(layer);
00024 
00025 }
00026 
00027 ThirdHitRZPrediction::Range ThirdHitRZPrediction:: operator()(const DetLayer *layer) 
00028 {
00029   if (layer) initLayer(layer);
00030 
00031   float v1,v2;
00032   if (theBarrel) {
00033     v1 = theLine.zAtR(theDetRange.min());
00034     v2 = theLine.zAtR(theDetRange.max());
00035   } else if (theForward) {
00036     v1 = theLine.rAtZ(theDetRange.min());
00037     v2 = theLine.rAtZ(theDetRange.max());
00038   } else return Range(0.,0.); 
00039 
00040   if (v1 > v2) std::swap(v1,v2);
00041   float rl = v1-theTolerance.left();
00042   float rr = v2+theTolerance.right();
00043   return Range(rl,rr);
00044 }
00045 
00046 ThirdHitRZPrediction::Range ThirdHitRZPrediction::operator()(float rORz)
00047 {
00048   float v;
00049   if (theBarrel) {
00050     v=theLine.zAtR(rORz); 
00051   } else {
00052     v=theLine.rAtZ(rORz); 
00053   }
00054 
00055   float rl = v-theTolerance.left();
00056   float rr = v+theTolerance.right();
00057   return Range(rl,rr);
00058 }
00059 
00060 void ThirdHitRZPrediction::initLayer(const DetLayer *layer)
00061 {
00062   if ( layer->location() == GeomDetEnumerators::barrel) {
00063     theBarrel = true;
00064     theForward = false;
00065     const BarrelDetLayer& bl = dynamic_cast<const BarrelDetLayer&>(*layer);
00066     float halfThickness  = bl.surface().bounds().thickness()/2;
00067     float radius = bl.specificSurface().radius();
00068     theDetRange = Range(radius-halfThickness, radius+halfThickness);
00069   } else if ( layer->location() == GeomDetEnumerators::endcap) {
00070     theBarrel= false;
00071     theForward = true;
00072     const ForwardDetLayer& fl = dynamic_cast<const ForwardDetLayer&>(*layer);
00073     float halfThickness  = fl.surface().bounds().thickness()/2;
00074     float zLayer = fl.position().z() ;
00075     theDetRange = Range(zLayer-halfThickness, zLayer+halfThickness);
00076   }
00077 }

Generated on Tue Jun 9 17:44:54 2009 for CMSSW by  doxygen 1.5.4