00001 #ifndef GenericTransientTrackingRecHit_H 00002 #define GenericTransientTrackingRecHit_H 00003 00004 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" 00005 #include "DataFormats/CLHEP/interface/AlgebraicObjects.h" 00006 00007 class GenericTransientTrackingRecHit: public TransientTrackingRecHit{ 00008 public: 00009 typedef TrackingRecHit::Type Type; 00010 00011 virtual ~GenericTransientTrackingRecHit() {delete trackingRecHit_;} 00012 00013 virtual AlgebraicVector parameters() const {return trackingRecHit_->parameters();} 00014 virtual AlgebraicSymMatrix parametersError() const {return trackingRecHit_->parametersError();} 00015 virtual AlgebraicMatrix projectionMatrix() const {return trackingRecHit_->projectionMatrix();} 00016 virtual int dimension() const {return trackingRecHit_->dimension();} 00017 00018 // virtual void getKfComponents( KfComponentsHolder & holder ) const { trackingRecHit_->getKfComponents(holder); } 00019 // NO, because someone might specialize parametersError, projectionMatrix or parameters in the transient rechit 00020 // and in fact this happens for alignment 00021 00022 virtual LocalPoint localPosition() const {return trackingRecHit_->localPosition();} 00023 virtual LocalError localPositionError() const {return trackingRecHit_->localPositionError();} 00024 00025 virtual bool canImproveWithTrack() const {return false;} 00026 00027 virtual const TrackingRecHit * hit() const {return trackingRecHit_;} 00028 00029 00030 virtual std::vector<const TrackingRecHit*> recHits() const { 00031 return ((const TrackingRecHit *)(trackingRecHit_))->recHits(); 00032 } 00033 virtual std::vector<TrackingRecHit*> recHits() { 00034 return trackingRecHit_->recHits(); 00035 } 00036 00037 static RecHitPointer build( const GeomDet * geom, const TrackingRecHit * rh) { 00038 return RecHitPointer( new GenericTransientTrackingRecHit( geom, *rh)); 00039 } 00040 00041 protected: 00042 00043 // private constructors enforce usage of builders 00044 GenericTransientTrackingRecHit(const GeomDet * geom, const TrackingRecHit& rh) : 00045 TransientTrackingRecHit(geom) { 00046 trackingRecHit_ = rh.clone(); 00047 } 00048 00050 GenericTransientTrackingRecHit(const GeomDet * geom, TrackingRecHit* rh) : 00051 TransientTrackingRecHit(geom,*rh), trackingRecHit_(rh) {} 00052 00053 GenericTransientTrackingRecHit( const GenericTransientTrackingRecHit & other ) : 00054 TransientTrackingRecHit( other.det(),other) { 00055 trackingRecHit_ = other.hit()->clone(); 00056 } 00057 00058 TrackingRecHit * trackingRecHit_; 00059 00060 private: 00061 00062 // should not have assignment operator (?) 00063 GenericTransientTrackingRecHit & operator= (const GenericTransientTrackingRecHit & t) { 00064 trackingRecHit_ = t.hit()->clone(); 00065 return *(this); 00066 } 00067 00068 // hide the clone method for ReferenceCounted. Warning: this method is still 00069 // accessible via the bas class TrackingRecHit interface! 00070 virtual GenericTransientTrackingRecHit * clone() const { 00071 return new GenericTransientTrackingRecHit(*this); 00072 } 00073 00074 }; 00075 00076 #endif 00077