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 
18 namespace reco
19 {
20 
22 {
23 
24 public:
25  using TrajParams = std::vector<LocalTrajectoryParameters>;
26  using Chi2sFive = std::vector<unsigned char>;
27 
30 
31  void setHits(TrackingRecHitRefProd const & prod, unsigned firstH, unsigned int nH) {
33  m_firstHit =firstH; m_nHits=nH;
34  }
35 
37 
38  unsigned int firstRecHit() const {
39  return m_firstHit;
40  }
41 
43  unsigned int recHitsSize() const {
44  return m_nHits;
45  }
46 
47 
50  return recHitsProduct().data().begin()+firstRecHit();
51  }
52 
55  return recHitsBegin()+recHitsSize();
56  }
57 
59  TrackingRecHitRef recHitRef(unsigned int i) const {
60  //Another thread might change the RefCore at the same time.
61  // By using a copy we will be safe.
63  if(hitCollection.productPtr()) {
65  TrackingRecHitRef::value_type const* item = finder(*(static_cast<TrackingRecHitRef::product_type const*>(hitCollection.productPtr())), m_firstHit+i);
66  return TrackingRecHitRef(hitCollection.id(), item, m_firstHit+i);
67  }
68  return TrackingRecHitRef(hitCollection,m_firstHit+i);
69  }
70 
72  TrackingRecHitRef recHit(unsigned int i) const {
73  return recHitRef(i);
74  }
75 
77  return *edm::getProduct<TrackingRecHitCollection>(m_hitCollection);
78 
79  }
80 
81  TrajParams const & trajParams() const {return m_trajParams;}
82  Chi2sFive const & chi2sX5() const { return m_chi2sX5;}
83 private:
84 
86  unsigned int m_firstHit;
87  unsigned int m_nHits;
89  Chi2sFive m_chi2sX5; // chi2 * 5 chopped at 255 (max chi2 is 51)
90 };
91 
92 }// namespace reco
93 
94 #endif
95 
void pushBackItem(RefCore const &productToBeInserted, bool checkPointer)
Definition: RefCore.cc:194
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned char > Chi2sFive
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
std::vector< LocalTrajectoryParameters > TrajParams
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
TrajParams const & trajParams() const
def move
Definition: eostools.py:510
void const * productPtr() const
Definition: RefCore.h:52
Chi2sFive const & chi2sX5() const
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:49
base const & data() const
Definition: OwnVector.h:440
unsigned int m_firstHit
unsigned int firstRecHit() const
void setTrajParams(TrajParams tmps, Chi2sFive chi2s)
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
edm::RefCore m_hitCollection