CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/TrackingTools/TransientTrackingRecHit/interface/TValidTrackingRecHit.h

Go to the documentation of this file.
00001 #ifndef TValidTrackingRecHit_H
00002 #define TValidTrackingRecHit_H
00003 
00004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00005 #include "DataFormats/TrackingRecHit/interface/TrackingRecHitGlobalState.h"
00006 #include "DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h"
00007 
00008 class GeomDetUnit;
00009 
00010 
00015 class TValidTrackingRecHit : public TransientTrackingRecHit {
00016 public:
00017   
00018   typedef ReferenceCountingPointer<TransientTrackingRecHit>        RecHitPointer;
00019   typedef ConstReferenceCountingPointer<TransientTrackingRecHit>   ConstRecHitPointer;
00020   typedef std::vector<ConstRecHitPointer>                           RecHitContainer;
00021   typedef std::vector<ConstRecHitPointer>                           ConstRecHitContainer;
00022 
00023   TValidTrackingRecHit(const GeomDet * geom) : 
00024     TransientTrackingRecHit(geom->geographicalId()), geom_(geom) {}
00025 
00026 
00027   template<typename... Args>
00028   TValidTrackingRecHit(const GeomDet * geom, Args && ...args) : 
00029     TransientTrackingRecHit(std::forward<Args>(args)...), geom_(geom) {}
00030 
00031   // to be moved in children
00032   TrackingRecHit * cloneHit() const { return hit()->clone();}
00033 
00034   // Extension of the TrackingRecHit interface
00035   virtual const GeomDet * det() const GCC11_FINAL {return geom_;}
00036   virtual const Surface * surface() const GCC11_FINAL {return &(det()->surface());}
00037 
00038 
00039   virtual GlobalPoint globalPosition() const GCC11_FINAL {
00040       return surface()->toGlobal(localPosition());
00041   }
00042   
00043   GlobalError globalPositionError() const GCC11_FINAL { return ErrorFrameTransformer().transform( localPositionError(), *surface() );}
00044   float errorGlobalR() const GCC11_FINAL { return std::sqrt(globalPositionError().rerr(globalPosition()));}
00045   float errorGlobalZ() const GCC11_FINAL { return std::sqrt(globalPositionError().czz()); }
00046   float errorGlobalRPhi() const GCC11_FINAL { return globalPosition().perp()*sqrt(globalPositionError().phierr(globalPosition())); }
00047 
00048   // once cache removed will obsolete the above
00049   TrackingRecHitGlobalState globalState() const {
00050     GlobalError  
00051       globalError = ErrorFrameTransformer::transform( localPositionError(), *surface() );
00052     auto gp = globalPosition();
00053     float r = gp.perp();
00054     float errorRPhi = r*std::sqrt(float(globalError.phierr(gp))); 
00055     float errorR = std::sqrt(float(globalError.rerr(gp)));
00056     float errorZ = std::sqrt(float(globalError.czz()));
00057     return (TrackingRecHitGlobalState){
00058       gp.basicVector(), r, gp.barePhi(),
00059         errorR,errorZ,errorRPhi
00060         };
00061   }
00062 
00063 
00068   virtual bool canImproveWithTrack() const {return false;}
00069 
00070  
00072   virtual float clusterProbability() const { return 1.f; }
00073 
00074 private:
00075   
00076   const GeomDet * geom_ ;
00077 
00078  
00079   // hide the clone method for ReferenceCounted. Warning: this method is still 
00080   // accessible via the bas class TrackingRecHit interface!
00081   virtual TValidTrackingRecHit * clone() const = 0;
00082 
00083 };
00084 
00085 #endif
00086