test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastTrackerRecHit.h
Go to the documentation of this file.
1 
10 #ifndef FastTrackerRecHit_H
11 #define FastTrackerRecHit_H
12 
14 #include "stdint.h"
15 
16 namespace fastTrackerRecHitType {
17  enum HitType {
18  siPixel = 0,
19  siStrip1D = 1,
20  siStrip2D = 2,
24  };
26  if(hitType >=0 && hitType <= 2) return trackerHitRTTI::fastSingle;
27  else if(hitType == siStripMatched2D) return trackerHitRTTI::fastMatch;
28  else if(hitType == siStripProjectedMono2D) return trackerHitRTTI::fastProjMono;
30  else return trackerHitRTTI::undef;
31  }
32  inline bool is2D(HitType hitType) {return hitType != siStrip1D;}
33  inline bool isPixel(HitType hitType) {return hitType == siPixel;}
34 }
35 
36 
38 {
39  public:
40 
45  , isPixel_(false)
46  , is2D_(true)
48  {}
49 
53 
58  : BaseTrackerRecHit(p,e,idet,fastTrackerRecHitType::rtti(hitType))
59  , isPixel_(fastTrackerRecHitType::isPixel(hitType))
60  , is2D_(fastTrackerRecHitType::is2D(hitType))
62  {store();}
63 
64  virtual FastTrackerRecHit * clone() const override {FastTrackerRecHit * p = new FastTrackerRecHit( * this); p->load(); return p;}
65 
68  void getKfComponents( KfComponentsHolder & holder ) const override { if(is2D_) getKfComponents2D(holder); else getKfComponents1D(holder);}
69 
72  int dimension() const override {return is2D_ ? 2 : 1;}
73 
76  virtual bool canImproveWithTrack() const override {return false;}
77 
78  /* getters */
79 
80  virtual size_t nIds() const { return 0;}
81  virtual int32_t id(size_t i = 0) const { return -1;}
82  virtual int32_t eventId(size_t i = 0) const { return -1;}
83 
84  virtual size_t nSimTrackIds() const { return 0;}
85  virtual int32_t simTrackId(size_t i) const { return -1;}
86  virtual int32_t simTrackEventId(size_t i) const { return -1;}
87 
88  virtual int32_t recHitCombinationIndex() const { return recHitCombinationIndex_;}
89 
90  bool isPixel() const override {return isPixel_;}
91 
92  /* setters */
93 
94  virtual void setEventId(int32_t eventId) {};
95 
96  void set2D(bool is2D=true){is2D_ = is2D;}
97 
99 
102  virtual std::vector<const TrackingRecHit*> recHits() const override { return std::vector<TrackingRecHit const*>();}
103 
106  virtual std::vector<TrackingRecHit*> recHits() override { return std::vector<TrackingRecHit*>();}
107 
110  OmniClusterRef const & firstClusterRef() const override;
111 
116  // used by functions
117  // - FastTrackerSingleRecHit::sharesInput
118  // - FastSiStripMatchedRecHit::sharesInput
119  // - FastProjectedSiStripRecHit2D::sharesInput
120  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);}
121  inline bool sharesInput(const TrackingRecHit * other,SharedInputType what) const override {
122 
123  // cast other hit
124  if(!trackerHitRTTI::isFast(*other) )
125  return false;
126  const FastTrackerRecHit * otherCast = static_cast<const FastTrackerRecHit *>(other);
127 
128  // checks
129  if(this->nIds() == 1){ // this hit is single/projected
130  if(otherCast->nIds() == 1){ // other hit is single/projected
131  return this->sameId(otherCast,0,0);
132  }
133  else { // other hit is matched
134  if(what == all){
135  return false;
136  }
137  else {
138  return(this->sameId(otherCast,0,0) || this->sameId(otherCast,0,1));
139  }
140  }
141  }
142  else{ // this hit is matched
143  if(otherCast->nIds() == 1){ // other hit is single/projected
144  if (what == all){
145  return false;
146  }
147  else{
148  return(this->sameId(otherCast,0,0) || this->sameId(otherCast,1,0));
149  }
150  }
151  else{ // other hit is matched
152  if(what == all){
153  return(this->sameId(otherCast,0,0) && this->sameId(otherCast,1,1));
154  }
155  else {
156  return(this->sameId(otherCast,0,0) || this->sameId(otherCast,1,1));
157  }
158  }
159  }
160  }
161 
162  protected:
163 
164  const bool isPixel_;
165  bool is2D_;
166 
169 
170  void store() { myPos_=pos_; myErr_=err_;}
171  void load() { pos_=myPos_; err_=myErr_;}
172 
174 
175  protected:
176 
177  virtual FastTrackerRecHit * clone(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
178  return this->clone();
179  }
180 
181 };
182 
185 inline bool operator<( const FastTrackerRecHit& one, const FastTrackerRecHit& other) {
186  return ( one.geographicalId() < other.geographicalId() );
187 }
188 
189 #endif
trackerHitRTTI::RTTI rtti(HitType hitType)
SharedInputType
definition of equality via shared input
virtual FastTrackerRecHit * clone() const override
int i
Definition: DBlmapReader.cc:9
virtual size_t nIds() const
virtual std::vector< const TrackingRecHit * > recHits() const override
void set2D(bool is2D=true)
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
OmniClusterRef const & firstClusterRef() const override
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
bool operator<(const FedChannelConnection &, const FedChannelConnection &)
void store()
helps making the hit postion and error persistent
bool is2D(HitType hitType)
void getKfComponents2D(KfComponentsHolder &holder) const
virtual int32_t simTrackId(size_t i) const
int j
Definition: DBlmapReader.cc:9
virtual int32_t recHitCombinationIndex() const
bool isFast(TrackingRecHit const &hit)
virtual bool canImproveWithTrack() const override
int dimension() const override
get the dimensions right
void getKfComponents(KfComponentsHolder &holder) const override
virtual FastTrackerRecHit * clone(TkCloner const &cloner, TrajectoryStateOnSurface const &tsos) const override
bool isPixel() const override
pixel or strip?
virtual size_t nSimTrackIds() const
void getKfComponents1D(KfComponentsHolder &holder) const
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
trackerHitRTTI::RTTI rtti() const
bool sharesInput(const TrackingRecHit *other, SharedInputType what) const override
virtual void setRecHitCombinationIndex(int32_t recHitCombinationIndex)
DetId geographicalId() const
volatile std::atomic< bool > shutdown_flag false
virtual std::vector< TrackingRecHit * > recHits() override
LocalPoint myPos_
helps making the hit postion and error persistent
bool is2D_
hit is either one dimensional (is2D_ = false) or two dimensions (is2D_ = true)