CMS 3D CMS Logo

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);
65  }
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  // Check validity of track rechits
81 
82  private:
84  unsigned int m_firstHit;
85  unsigned int m_nHits;
87  Chi2sFive m_chi2sX5; // chi2 * 5 chopped at 255 (max chi2 is 51)
88  };
89 
90 } // namespace reco
91 
92 #endif // DataFormats_TrackReco_TrackExtraBase_h
void pushBackItem(RefCore const &productToBeInserted, bool checkPointer)
Definition: RefCore.cc:165
TrajParams const & trajParams() const
std::vector< unsigned char > Chi2sFive
TrackingRecHitRef recHitRef(unsigned int i) const
get a ref to i-th recHit
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
unsigned int recHitsSize() const
number of RecHits
TrackingRecHitRef recHit(unsigned int i) const
get i-th recHit
bool isAvailable() const
Definition: RefCore.cc:146
base const & data() const
Definition: OwnVector.h:476
trackingRecHit_iterator recHitsEnd() const
last iterator over RecHits
unsigned int firstRecHit() const
std::vector< LocalTrajectoryParameters > TrajParams
TrackingRecHitCollection const & recHitsProduct() const
auto recHits() const
accessor to RecHits
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
bool isNonnull() const
Definition: RefCore.h:71
TrackExtraBase()
default constructor
unsigned int m_nHits
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
trackingRecHit_iterator recHitsBegin() const
first iterator over RecHits
fixed size matrix
unsigned int m_firstHit
bool recHitsOk() const
Chi2sFive const & chi2sX5() const
def move(src, dest)
Definition: eostools.py:511
void setTrajParams(TrajParams tmps, Chi2sFive chi2s)
edm::RefCore m_hitCollection