CMS 3D CMS Logo

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