00001 #ifndef TransientTrackingRecHit_H
00002 #define TransientTrackingRecHit_H
00003
00004 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00005 #include "Geometry/CommonDetUnit/interface/GeomDet.h"
00006 #include <TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h>
00007 #include "DataFormats/GeometrySurface/interface/Surface.h"
00008
00009 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
00010 #include "DataFormats/GeometrySurface/interface/BlockWipedAllocator.h"
00011
00012
00013
00014 #define TTRH_NOGE
00015
00016
00017 class GeomDetUnit;
00018
00019 class TransientTrackingRecHit : public TrackingRecHit,
00020 public ReferenceCountedInEvent {
00021 public:
00022
00023
00024
00025 typedef ReferenceCountingPointer< TransientTrackingRecHit> RecHitPointer;
00026 typedef ConstReferenceCountingPointer< TransientTrackingRecHit> ConstRecHitPointer;
00027 typedef std::vector<ConstRecHitPointer> RecHitContainer;
00028 typedef std::vector<ConstRecHitPointer> ConstRecHitContainer;
00029
00030 explicit TransientTrackingRecHit(const GeomDet * geom=0, float weight=1., float annealing=1.) :
00031 TrackingRecHit(geom ? geom->geographicalId().rawId() : 0),
00032 geom_(geom), weight_(weight), annealing_(annealing),
00033 globalPosition_(0,0,0),
00034
00035 errorR_(0),errorZ_(0),errorRPhi_(0),
00036 hasGlobalPosition_(false), hasGlobalError_(false){}
00037
00038 explicit TransientTrackingRecHit(const GeomDet * geom, DetId id, Type type=valid, float weight=1., float annealing=1. ) :
00039 TrackingRecHit(id, type),
00040 geom_(geom), weight_(weight), annealing_(annealing),
00041 globalPosition_(0,0,0),
00042
00043 errorR_(0),errorZ_(0),errorRPhi_(0),
00044 hasGlobalPosition_(false),hasGlobalError_(false){}
00045
00046 explicit TransientTrackingRecHit(const GeomDet * geom, TrackingRecHit::id_type id, Type type=valid, float weight=1., float annealing=1. ) :
00047 TrackingRecHit(id, type),
00048 geom_(geom), weight_(weight), annealing_(annealing),
00049 globalPosition_(0,0,0),
00050
00051 errorR_(0),errorZ_(0),errorRPhi_(0),
00052 hasGlobalPosition_(false),hasGlobalError_(false){}
00053
00054 explicit TransientTrackingRecHit(const GeomDet * geom, TrackingRecHit const & rh, float weight=1., float annealing=1. ) :
00055 TrackingRecHit(rh.geographicalId(), rh.type()),
00056 geom_(geom), weight_(weight), annealing_(annealing),
00057 globalPosition_(0,0,0),
00058
00059 errorR_(0),errorZ_(0),errorRPhi_(0),
00060 hasGlobalPosition_(false),hasGlobalError_(false){}
00061
00062
00063
00064
00065
00067 const GeomDet * det() const {return geom_;}
00068 virtual const Surface * surface() const {return &(geom_->surface());}
00069
00073 virtual const GeomDetUnit * detUnit() const;
00074
00075 virtual GlobalPoint globalPosition() const ;
00076 virtual GlobalError globalPositionError() const ;
00077
00078 float errorGlobalR() const;
00079 float errorGlobalZ() const;
00080 float errorGlobalRPhi() const;
00081
00086 virtual RecHitPointer clone (const TrajectoryStateOnSurface& ts) const;
00087
00092 virtual bool canImproveWithTrack() const {return false;}
00093
00094 virtual const TrackingRecHit * hit() const = 0;
00095
00097 virtual ConstRecHitContainer transientHits() const;
00098
00100 void setWeight(float weight){weight_ = weight;}
00101
00102 float weight() const {return weight_;}
00103
00106
00107 void setAnnealingFactor(float annealing) {annealing_ = annealing;}
00108
00109 float getAnnealingFactor() const {return annealing_;}
00110
00112 virtual float clusterProbability() const { return 1; }
00113
00114 private:
00115 void setPositionErrors() const;
00116
00117 const GeomDet * geom_ ;
00118
00119 float weight_;
00120 float annealing_;
00121
00122
00123 mutable GlobalPoint globalPosition_;
00124 #ifndef TTRH_NOGE
00125 mutable GlobalError globalError_;
00126 #endif
00127 mutable float errorR_,errorZ_,errorRPhi_;
00128 mutable bool hasGlobalPosition_;
00129 mutable bool hasGlobalError_;
00130
00131
00132
00133 virtual TransientTrackingRecHit * clone() const = 0;
00134
00135 };
00136
00137 #endif
00138