CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrackExtraBase.h
Go to the documentation of this file.
1 #ifndef DataFormats_TrackReco_TrackExtraBase_h
2 #define DataFormats_TrackReco_TrackExtraBase_h
3 
19 
20 namespace reco {
21 
23  public:
24  using TrajParams = std::vector<LocalTrajectoryParameters>;
25  using Chi2sFive = std::vector<unsigned char>;
26 
28  TrackExtraBase() : m_firstHit((unsigned int)-1), m_nHits(0) {}
29 
30  void setHits(TrackingRecHitRefProd const& prod, unsigned firstH, unsigned int nH) {
31  m_hitCollection.pushBackItem(prod.refCore(), true);
32  m_firstHit = firstH;
33  m_nHits = nH;
34  }
35 
36  void setTrajParams(TrajParams tmps, Chi2sFive chi2s) {
37  m_trajParams = std::move(tmps);
38  m_chi2sX5 = std::move(chi2s);
39  }
40 
41  unsigned int firstRecHit() const { return m_firstHit; }
42 
44  unsigned int recHitsSize() const { return m_nHits; }
45 
47  auto recHits() const { return TrackingRecHitRange(recHitsBegin(), recHitsEnd()); }
48 
51 
54 
56  TrackingRecHitRef recHitRef(unsigned int i) const {
57  //Another thread might change the RefCore at the same time.
58  // By using a copy we will be safe.
60  if (hitCollection.productPtr()) {
63  finder(*(static_cast<TrackingRecHitRef::product_type const*>(hitCollection.productPtr())), m_firstHit + i);
64  return TrackingRecHitRef(hitCollection.id(), item, m_firstHit + i);
65  }
66  return TrackingRecHitRef(hitCollection, m_firstHit + i);
67  }
68 
70  TrackingRecHitRef recHit(unsigned int i) const { return recHitRef(i); }
71 
73  return *edm::getProduct<TrackingRecHitCollection>(m_hitCollection);
74  }
75 
76  TrajParams const& trajParams() const { return m_trajParams; }
77  Chi2sFive const& chi2sX5() const { return m_chi2sX5; }
78 
79  private:
81  unsigned int m_firstHit;
82  unsigned int m_nHits;
84  Chi2sFive m_chi2sX5; // chi2 * 5 chopped at 255 (max chi2 is 51)
85  };
86 
87 } // namespace reco
88 
89 #endif // DataFormats_TrackReco_TrackExtraBase_h
void pushBackItem(RefCore const &productToBeInserted, bool checkPointer)
Definition: RefCore.cc:165
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
auto recHits() const
accessor to RecHits
def move
Definition: eostools.py:511
void const * productPtr() const
Definition: RefCore.h:51
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:112
edm::Range< trackingRecHit_iterator > TrackingRecHitRange
Range class to enable range-based loops for a tracks RecHits.
T value_type
Definition: Ref.h:160
F finder_type
Definition: Ref.h:162
ProductID id() const
Definition: RefCore.h:48
base const & data() const
Definition: OwnVector.h:476
unsigned int m_firstHit
unsigned int firstRecHit() const
void setTrajParams(TrajParams tmps, Chi2sFive chi2s)
edm::RefCore m_hitCollection