CMS 3D CMS Logo

FastTrackerRecHit.h
Go to the documentation of this file.
1 
10 #ifndef FastTrackerRecHit_H
11 #define FastTrackerRecHit_H
12 
14 
16  enum HitType {
17  siPixel = 0,
18  siStrip1D = 1,
19  siStrip2D = 2,
23  };
25  if(hitType >=0 && hitType <= 2) return trackerHitRTTI::fastSingle;
26  else if(hitType == siStripMatched2D) return trackerHitRTTI::fastMatch;
27  else if(hitType == siStripProjectedMono2D) return trackerHitRTTI::fastProjMono;
29  else return trackerHitRTTI::undef;
30  }
31  inline bool is2D(HitType hitType) {return hitType != siStrip1D;}
32  inline bool isPixel(HitType hitType) {return hitType == siPixel;}
33 }
34 
35 
37 {
38  public:
39 
44  , isPixel_(false)
45  , is2D_(true)
46  , recHitCombinationIndex_(-1)
47  {}
48 
51  ~FastTrackerRecHit() override {}
52 
57  : BaseTrackerRecHit(p,e,idet,fastTrackerRecHitType::rtti(hitType))
58  , isPixel_(fastTrackerRecHitType::isPixel(hitType))
59  , is2D_(fastTrackerRecHitType::is2D(hitType))
60  , recHitCombinationIndex_(-1)
61  , energyLoss_(0.0) //holy golden seal
62  {store();}
63 
64  FastTrackerRecHit * clone() const override {FastTrackerRecHit * p = new FastTrackerRecHit( * this); p->load(); return p;}
65 
68 
69  float energyLoss() const { return energyLoss_;}// holy golden seal
70  void setEnergyLoss(float e) { energyLoss_=e;}// holy golden seal was a virtual void...
71  void getKfComponents( KfComponentsHolder & holder ) const override { if(is2D_) getKfComponents2D(holder); else getKfComponents1D(holder);}
72 
75  int dimension() const override {return is2D_ ? 2 : 1;}
76 
79  bool canImproveWithTrack() const override {return false;}
80 
81  /* getters */
82 
83  virtual size_t nIds() const { return 0;}
84  virtual int32_t id(size_t i = 0) const { return -1;}
85  virtual int32_t eventId(size_t i = 0) const { return -1;}
86 
87  virtual size_t nSimTrackIds() const { return 0;}
88  virtual int32_t simTrackId(size_t i) const { return -1;}
89  virtual int32_t simTrackEventId(size_t i) const { return -1;}
90 
91  virtual int32_t recHitCombinationIndex() const { return recHitCombinationIndex_;}
92 
93  bool isPixel() const override {return isPixel_;}
94 
95  /* setters */
96 
97  virtual void setEventId(int32_t eventId) {};
98 
99  void set2D(bool is2D=true){is2D_ = is2D;}
100 
101  virtual void setRecHitCombinationIndex(int32_t recHitCombinationIndex) {recHitCombinationIndex_ = recHitCombinationIndex;}
102 
105  std::vector<const TrackingRecHit*> recHits() const override { return std::vector<TrackingRecHit const*>();}
106 
109  std::vector<TrackingRecHit*> recHits() override { return std::vector<TrackingRecHit*>();}
110 
113  OmniClusterRef const & firstClusterRef() const override;
114 
119  // used by functions
120  // - FastTrackerSingleRecHit::sharesInput
121  // - FastSiStripMatchedRecHit::sharesInput
122  // - FastProjectedSiStripRecHit2D::sharesInput
123  inline bool sameId(const FastTrackerRecHit * other,size_t i=0,size_t j = 0) const {return id(i) == other->id(j) && eventId(i) == other->eventId(j);}
124  inline bool sharesInput(const TrackingRecHit * other,SharedInputType what) const override {
125 
126  // cast other hit
127  if(!trackerHitRTTI::isFast(*other) )
128  return false;
129  const FastTrackerRecHit * otherCast = static_cast<const FastTrackerRecHit *>(other);
130 
131  // checks
132  if(this->nIds() == 1){ // this hit is single/projected
133  if(otherCast->nIds() == 1){ // other hit is single/projected
134  return this->sameId(otherCast,0,0);
135  }
136  else { // other hit is matched
137  if(what == all){
138  return false;
139  }
140  else {
141  return(this->sameId(otherCast,0,0) || this->sameId(otherCast,0,1));
142  }
143  }
144  }
145  else{ // this hit is matched
146  if(otherCast->nIds() == 1){ // other hit is single/projected
147  if (what == all){
148  return false;
149  }
150  else{
151  return(this->sameId(otherCast,0,0) || this->sameId(otherCast,1,0));
152  }
153  }
154  else{ // other hit is matched
155  if(what == all){
156  return(this->sameId(otherCast,0,0) && this->sameId(otherCast,1,1));
157  }
158  else {
159  return(this->sameId(otherCast,0,0) || this->sameId(otherCast,1,1));
160  }
161  }
162  }
163  }
164 
165  protected:
166 
167  const bool isPixel_;
168  bool is2D_;
169 
172 
173  void store() { myPos_=pos_; myErr_=err_;}
174  void load() { pos_=myPos_; err_=myErr_;}
175 
177  float energyLoss_; //holy golden seal
178 
179  protected:
180 
181  FastTrackerRecHit * clone(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
182  return this->clone();
183  }
184 
185 };
186 
189 inline bool operator<( const FastTrackerRecHit& one, const FastTrackerRecHit& other) {
190  return ( one.geographicalId() < other.geographicalId() );
191 }
192 
193 #endif
trackerHitRTTI::RTTI rtti(HitType hitType)
SharedInputType
definition of equality via shared input
virtual size_t nIds() const
void set2D(bool is2D=true)
std::vector< const TrackingRecHit * > recHits() const override
const bool isPixel_
hit is either on pixel modul (isPixel_ = true) or strip module (isPixel_ = false) ...
bool sameId(const FastTrackerRecHit *other, size_t i=0, size_t j=0) const
virtual int32_t simTrackEventId(size_t i) const
uint32_t recHitCombinationIndex_
virtual void setEventId(int32_t eventId)
LocalError myErr_
helps making the hit postion and error persistent
void load()
helps making the hit postion and error persistent
FastTrackerRecHit * clone() const override
void store()
helps making the hit postion and error persistent
bool is2D(HitType hitType)
virtual int32_t simTrackId(size_t i) const
virtual int32_t recHitCombinationIndex() const
bool isFast(TrackingRecHit const &hit)
FastTrackerRecHit * clone(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
float energyLoss() const
int dimension() const override
get the dimensions right
virtual size_t nSimTrackIds() const
void setEnergyLoss(float e)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
bool isPixel() const override
pixel or strip?
bool canImproveWithTrack() const override
FastTrackerRecHit(const LocalPoint &p, const LocalError &e, GeomDet const &idet, fastTrackerRecHitType::HitType hitType)
virtual int32_t eventId(size_t i=0) const
bool isPixel(HitType hitType)
virtual int32_t id(size_t i=0) const
void getKfComponents(KfComponentsHolder &holder) const override
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const override
~FastTrackerRecHit() override
virtual void setRecHitCombinationIndex(int32_t recHitCombinationIndex)
DetId geographicalId() const
LocalPoint myPos_
helps making the hit postion and error persistent
bool operator<(const FastTrackerRecHit &one, const FastTrackerRecHit &other)
std::vector< TrackingRecHit * > recHits() override
bool is2D_
hit is either one dimensional (is2D_ = false) or two dimensions (is2D_ = true)