00001 #ifndef RECOTRACKER_TRANSIENTRACKINGRECHIT_TSiStripMatchedRecHit_H
00002 #define RECOTRACKER_TRANSIENTRACKINGRECHIT_TSiStripMatchedRecHit_H
00003
00004 #include "TrackingTools/TransientTrackingRecHit/interface/GenericTransientTrackingRecHit.h"
00005 #include "TrackingTools/TransientTrackingRecHit/interface/HelpertRecHit2DLocalPos.h"
00006 #include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitMatcher.h"
00007 #include "RecoLocalTracker/ClusterParameterEstimator/interface/StripClusterParameterEstimator.h"
00008 #include<memory>
00009
00010 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012
00013 class TSiStripMatchedRecHit GCC11_FINAL : public GenericTransientTrackingRecHit{
00014 public:
00015
00016 virtual void getKfComponents( KfComponentsHolder & holder ) const {
00017 HelpertRecHit2DLocalPos().getKfComponents(holder, *hit(), *det());
00018 }
00019
00020 virtual AlgebraicSymMatrix parametersError() const {
00021 return HelpertRecHit2DLocalPos().parError( localPositionError(), *det());
00022 }
00023
00024 const GeomDetUnit* detUnit() const {return 0;}
00025
00026 static RecHitPointer build( const GeomDet * geom, const TrackingRecHit * rh,
00027 const SiStripRecHitMatcher *matcher,
00028 const StripClusterParameterEstimator* cpe=0,
00029 bool computeCoarseLocalPosition=false) {
00030 return RecHitPointer( new TSiStripMatchedRecHit( geom, rh, matcher,cpe, computeCoarseLocalPosition));
00031 }
00032
00033 static RecHitPointer build( const GeomDet * geom, std::auto_ptr<TrackingRecHit> rh,
00034 const SiStripRecHitMatcher *matcher,
00035 const StripClusterParameterEstimator* cpe=0,
00036 bool computeCoarseLocalPosition=false) {
00037 return RecHitPointer( new TSiStripMatchedRecHit( geom, rh, matcher,cpe, computeCoarseLocalPosition));
00038 }
00039
00040 virtual RecHitPointer clone( const TrajectoryStateOnSurface& ts) const;
00041 virtual bool canImproveWithTrack() const {return (theMatcher != 0);}
00042 virtual ConstRecHitContainer transientHits () const;
00043
00045 struct DontCloneRecHit {};
00046
00051 static void buildInPlace(std::auto_ptr<TSiStripMatchedRecHit> &memory,
00052 const GeomDet * geom, const TrackingRecHit * rh,
00053 const SiStripRecHitMatcher *matcher,
00054 const StripClusterParameterEstimator* cpe=0,
00055 bool computeCoarseLocalPosition=false) {
00056 if (memory.get()) {
00057 memory->~TSiStripMatchedRecHit();
00058 new (memory.get()) TSiStripMatchedRecHit( geom, rh, matcher,cpe, computeCoarseLocalPosition, DontCloneRecHit());
00059 } else {
00060 memory.reset(new TSiStripMatchedRecHit( geom, rh, matcher,cpe,computeCoarseLocalPosition, DontCloneRecHit()));
00061 }
00062 }
00063
00065 void clonePersistentHit() { trackingRecHit_ = trackingRecHit_->clone(); }
00068 void clearPersistentHit() { trackingRecHit_ = 0; }
00069
00070 private:
00071 const SiStripRecHitMatcher* theMatcher;
00072 const StripClusterParameterEstimator* theCPE;
00073
00074 private:
00075 TSiStripMatchedRecHit (const GeomDet * geom, const TrackingRecHit * rh,
00076 const SiStripRecHitMatcher *matcher,
00077 const StripClusterParameterEstimator* cpe,
00078 bool computeCoarseLocalPosition) :
00079 GenericTransientTrackingRecHit(geom, *rh), theMatcher(matcher),theCPE(cpe) {
00080 if (computeCoarseLocalPosition) ComputeCoarseLocalPosition();
00081 }
00082
00083 TSiStripMatchedRecHit (const GeomDet * geom, std::auto_ptr<TrackingRecHit> rh,
00084 const SiStripRecHitMatcher *matcher,
00085 const StripClusterParameterEstimator* cpe,
00086 bool computeCoarseLocalPosition) :
00087 GenericTransientTrackingRecHit(geom, rh.release()), theMatcher(matcher),theCPE(cpe) {
00088 if (computeCoarseLocalPosition) ComputeCoarseLocalPosition();
00089 }
00090 TSiStripMatchedRecHit (const GeomDet * geom, const TrackingRecHit * rh,
00091 const SiStripRecHitMatcher *matcher,
00092 const StripClusterParameterEstimator* cpe,
00093 bool computeCoarseLocalPosition,
00094 const DontCloneRecHit &) :
00095 GenericTransientTrackingRecHit(geom, const_cast<TrackingRecHit *>(rh)), theMatcher(matcher),theCPE(cpe) {
00096 if (computeCoarseLocalPosition) ComputeCoarseLocalPosition();
00097 }
00098
00099 private:
00100 void ComputeCoarseLocalPosition();
00101
00102 virtual TSiStripMatchedRecHit* clone() const {
00103 return new TSiStripMatchedRecHit(*this);
00104 }
00105
00106 };
00107
00108
00109
00110 #endif