CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
JetTrackMatch.h
Go to the documentation of this file.
1 #ifndef JetReco_JetTrackMatch_h
2 #define JetReco_JetTrackMatch_h
3 
36 
37 namespace reco {
38  template <typename JetC>
39  class JetTrackMatch {
40  public:
44 
45  private:
47 
48  public:
51 
53  void insert(const JetRef& fJet) { mMap.insert(fJet, TrackRef()); }
54 
56  void insert(const JetRef& fJet, const TrackRef& fTrack) { mMap.insert(fJet, fTrack); }
57 
59  std::vector<JetRef> allJets() const {
60  std::vector<JetRef> result;
61  typename Map::const_iterator it = mMap.begin();
62  for (; it != mMap.end(); ++it) {
63  result.push_back(it->key);
64  }
65  return result;
66  }
68  std::vector<TrackRef> getTracks(const JetRef& mJet) const {
69  std::vector<TrackRef> result;
71  int i = tracks.size();
72  while (--i >= 0) {
73  if (!tracks[i].isNull())
74  result.push_back(tracks[i]);
75  }
76  return result;
77  }
78  };
79 } // namespace reco
80 
81 #endif
Association between Jets from jet collection and tracks from track collection.
Definition: JetTrackMatch.h:39
const_iterator end() const
last iterator over the map (read only)
void insert(const JetRef &fJet)
insert orphan jet
Definition: JetTrackMatch.h:53
edm::AssociationMap< edm::OneToMany< JetC, reco::TrackCollection > > Map
Definition: JetTrackMatch.h:43
auto const & tracks
cannot be loose
void insert(const JetRef &fJet, const TrackRef &fTrack)
assign track to jet.
Definition: JetTrackMatch.h:56
edm::Ref< reco::TrackCollection > TrackRef
Definition: JetTrackMatch.h:42
tuple result
Definition: mps_fire.py:311
std::vector< JetRef > allJets() const
get list of all jats in the map
Definition: JetTrackMatch.h:59
void insert(const key_type &k, const data_type &v)
insert an association
std::vector< TrackRef > getTracks(const JetRef &mJet) const
get all tracks associated with jet
Definition: JetTrackMatch.h:68
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
const_iterator begin() const
first iterator over the map (read only)
edm::Ref< JetC > JetRef
Definition: JetTrackMatch.h:41