CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitByValue.h

Go to the documentation of this file.
00001 #ifndef TransientTrackingRecHitByValue_H
00002 #define TransientTrackingRecHitByValue_H
00003 
00004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00005 
00006 template<typename RecHit>
00007 class TransientTrackingRecHitByValue: public TransientTrackingRecHit{
00008 public:
00009   typedef TrackingRecHit::Type Type;
00010   
00011   virtual ~TransientTrackingRecHitByValue() {}
00012   
00013   virtual AlgebraicVector parameters() const {return m_trackingRecHit.parameters();}
00014   virtual AlgebraicSymMatrix parametersError() const {return m_trackingRecHit.parametersError();}
00015   virtual AlgebraicMatrix projectionMatrix() const {return m_trackingRecHit.projectionMatrix();}
00016   virtual int dimension() const {return m_trackingRecHit.dimension();}
00017   
00018   virtual LocalPoint localPosition() const {return m_trackingRecHit.localPosition();}
00019   virtual LocalError localPositionError() const {return m_trackingRecHit.localPositionError();}
00020   
00021   virtual bool canImproveWithTrack() const {return false;}
00022   
00023   virtual const RecHit * hit() const {return &m_trackingRecHit;};
00024   
00025   
00026   virtual std::vector<const TrackingRecHit*> recHits() const {
00027     return hit()->recHits();
00028   }
00029   virtual std::vector<TrackingRecHit*> recHits() {
00030     return m_trackingRecHit.recHits();
00031   }
00032   
00033   static RecHitPointer build( const GeomDet * geom, const RecHit * rh) {
00034     return RecHitPointer( new TransientTrackingRecHitByValue<RecHit>( geom, *rh));
00035   }
00036   
00037 protected:
00038   
00039   // private constructors enforce usage of builders
00040   TransientTrackingRecHitByValue(const GeomDet * geom, const RecHit& rh) :
00041     TransientTrackingRecHit(geom,rh), m_trackingRecHit(rh) {
00042   }
00043   
00044   
00045   TransientTrackingRecHitByValue( const TransientTrackingRecHitByValue<RecHit> & other ) :
00046     TransientTrackingRecHit( other.det(),other), m_trackingRecHit(*other.hit()) {
00047   }
00048   
00049 private:
00050   
00051   RecHit m_trackingRecHit;
00052   
00053   // should not have assignment operator (?)
00054   TransientTrackingRecHitByValue<RecHit> & operator= (const TransientTrackingRecHitByValue<RecHit> & t) {
00055     m_trackingRecHit = *t.hit();
00056     return *(this);
00057   }
00058   
00059   // hide the clone method for ReferenceCounted. Warning: this method is still 
00060   // accessible via the bas class TrackingRecHit interface!
00061   virtual TransientTrackingRecHitByValue<RecHit> * clone() const {
00062     return new TransientTrackingRecHitByValue<RecHit>(*this);
00063   }
00064   
00065 };
00066 
00067 #endif // TransientTrackingRecHitByValue_H
00068