CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackExtraBase.h
Go to the documentation of this file.
1 #ifndef TrackReco_TrackExtraBase_h
2 #define TrackReco_TrackExtraBase_h
3 
17 
18 namespace reco
19 {
20 
22 {
23 
24 public:
27 
28  void setHits(TrackingRecHitRefProd const & prod, unsigned firstH, unsigned int nH) {
30  m_firstHit =firstH; m_nHits=nH;
31  }
32 
33  unsigned int firstRecHit() const {
34  return m_firstHit;
35  }
36 
38  unsigned int recHitsSize() const {
39  return m_nHits;
40  }
41 
42 
45  return recHitsProduct().data().begin()+firstRecHit();
46  }
47 
50  return recHitsBegin()+recHitsSize();
51  }
52 
54  TrackingRecHitRef recHitRef(unsigned int i) const {
55  //Another thread might change the RefCore at the same time.
56  // By using a copy we will be safe.
58  if(hitCollection.productPtr()) {
60  TrackingRecHitRef::value_type const* item = finder(*(static_cast<TrackingRecHitRef::product_type const*>(hitCollection.productPtr())), m_firstHit+i);
61  return TrackingRecHitRef(hitCollection.id(), item, m_firstHit+i);
62  }
63  return TrackingRecHitRef(hitCollection,m_firstHit+i);
64  }
65 
67  TrackingRecHitRef recHit(unsigned int i) const {
68  return recHitRef(i);
69  }
70 
72  return *edm::getProduct<TrackingRecHitCollection>(m_hitCollection);
73 
74  }
75 
76 private:
77 
79  unsigned int m_firstHit;
80  unsigned int m_nHits;
81 
82 };
83 
84 }// namespace reco
85 
86 #endif
87 
void pushBackItem(RefCore const &productToBeInserted, bool checkPointer)
Definition: RefCore.cc:193
int i
Definition: DBlmapReader.cc:9
TrackingRecHitCollection const & recHitsProduct() const
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
trackingRecHit_iterator recHitsEnd() const
last iterator over RecHits
TrackingRecHitRef recHitRef(unsigned int i) const
get a ref to i-th recHit
TrackingRecHitRef recHit(unsigned int i) const
get i-th recHit
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
unsigned int recHitsSize() const
number of RecHits
void const * productPtr() const
Definition: RefCore.h:41
TrackExtraBase()
default constructor
trackingRecHit_iterator recHitsBegin() const
first iterator over RecHits
unsigned int m_nHits
RefCore const & refCore() const
Definition: RefProd.h:123
ProductID id() const
Definition: RefCore.h:38
base const & data() const
Definition: OwnVector.h:446
unsigned int m_firstHit
unsigned int firstRecHit() const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
edm::RefCore m_hitCollection