CMS 3D CMS Logo

DuplicatedPhotonRemover.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatUtils_DuplicatedPhotonRemover_h
2 #define PhysicsTools_PatUtils_DuplicatedPhotonRemover_h
3 
6 
11 
13 
15 
16 namespace pat {
17 
19  public:
20  // Checks if two objects share the same supercluster seed
22  template <typename T1, typename T2>
23  bool operator()(const T1 &t1, const T2 &t2) const {
24  return (t1.superCluster()->seed() == t2.superCluster()->seed());
25  }
26  };
27 
28  // Checks if two objects share the same supercluster seed
30  template <typename T1, typename T2>
31  bool operator()(const T1 &t1, const T2 &t2) const {
32  return (t1.superCluster() == t2.superCluster());
33  }
34  };
35 
39  template <typename PhotonCollection>
40  std::unique_ptr<std::vector<size_t> > duplicatesBySuperCluster(const PhotonCollection &photons) const;
41 
45  template <typename PhotonCollection>
46  std::unique_ptr<std::vector<size_t> > duplicatesBySeed(const PhotonCollection &photons) const;
47 
49  template <typename PhotonCollection, typename ElectronCollection>
50  std::unique_ptr<pat::OverlapList> electronsBySeed(const PhotonCollection &photons,
51  const ElectronCollection &electrons) const;
52 
54  template <typename PhotonCollection, typename ElectronCollection>
55  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const PhotonCollection &photons,
56  const ElectronCollection &electrons) const;
57 
58  // ===== Concrete versions for users (and to get it compiled, so I can see if there are errors) ===
59  std::unique_ptr<std::vector<size_t> > duplicatesBySeed(const reco::PhotonCollection &photons) const;
60  std::unique_ptr<std::vector<size_t> > duplicatesBySeed(const edm::View<reco::Photon> &photons) const;
61  std::unique_ptr<std::vector<size_t> > duplicatesBySuperCluster(const edm::View<reco::Photon> &photons) const;
62  std::unique_ptr<std::vector<size_t> > duplicatesBySuperCluster(const reco::PhotonCollection &photons) const;
63  std::unique_ptr<pat::OverlapList> electronsBySeed(const reco::PhotonCollection &photons,
65  std::unique_ptr<pat::OverlapList> electronsBySeed(const edm::View<reco::Photon> &photons,
67  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const edm::View<reco::Photon> &photons,
69  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const reco::PhotonCollection &photons,
71  std::unique_ptr<pat::OverlapList> electronsBySeed(const reco::PhotonCollection &photons,
73  std::unique_ptr<pat::OverlapList> electronsBySeed(const edm::View<reco::Photon> &photons,
75  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const edm::View<reco::Photon> &photons,
77  std::unique_ptr<pat::OverlapList> electronsBySuperCluster(const reco::PhotonCollection &photons,
79  };
80 } // namespace pat
81 
82 template <typename PhotonCollection>
83 std::unique_ptr<std::vector<size_t> > pat::DuplicatedPhotonRemover::duplicatesBySuperCluster(
84  const PhotonCollection &photons) const {
85  typedef typename PhotonCollection::value_type PhotonType;
87  return dups.duplicates(photons);
88 }
89 
90 template <typename PhotonCollection>
91 std::unique_ptr<std::vector<size_t> > pat::DuplicatedPhotonRemover::duplicatesBySeed(
92  const PhotonCollection &photons) const {
93  typedef typename PhotonCollection::value_type PhotonType;
95  return dups.duplicates(photons);
96 }
97 
99 template <typename PhotonCollection, typename ElectronCollection>
101  const PhotonCollection &photons, const ElectronCollection &electrons) const {
103  return ovl.find(photons, electrons);
104 }
105 
107 template <typename PhotonCollection, typename ElectronCollection>
108 std::unique_ptr<pat::OverlapList> pat::DuplicatedPhotonRemover::electronsBySeed(
109  const PhotonCollection &photons, const ElectronCollection &electrons) const {
111  return ovl.find(photons, electrons);
112 }
113 
114 #endif
RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
pat::GenericOverlapFinder
Definition: GenericOverlapFinder.h:52
pat::ElectronCollection
std::vector< Electron > ElectronCollection
Definition: Electron.h:36
pat::DuplicatedPhotonRemover::electronsBySuperCluster
std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const PhotonCollection &photons, const ElectronCollection &electrons) const
Indices of photons which happen to be also electrons (that is, they share the same SC)
Definition: DuplicatedPhotonRemover.h:100
pat::GenericDuplicateRemover
Definition: GenericDuplicateRemover.h:11
pat::DuplicatedPhotonRemover::EqualBySuperCluster::operator()
bool operator()(const T1 &t1, const T2 &t2) const
Definition: DuplicatedPhotonRemover.h:31
PhotonFwd.h
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition: GsfElectronFwd.h:14
pat::PhotonCollection
std::vector< Photon > PhotonCollection
Definition: Photon.h:31
GenericOverlapFinder.h
Photon.h
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
pat::GenericDuplicateRemover::duplicates
std::unique_ptr< std::vector< size_t > > duplicates(const Collection &items) const
Definition: GenericDuplicateRemover.h:36
GenericDuplicateRemover.h
GsfElectron.h
pat::GenericOverlapFinder::find
std::unique_ptr< OverlapList > find(const Collection &items, const OtherCollection &other) const
pat::DuplicatedPhotonRemover::electronsBySeed
std::unique_ptr< pat::OverlapList > electronsBySeed(const PhotonCollection &photons, const ElectronCollection &electrons) const
Indices of photons which happen to be also electrons (that is, they share the same SC seed)
Definition: DuplicatedPhotonRemover.h:108
edm::View
Definition: CaloClusterFwd.h:14
pat::DuplicatedPhotonRemover::EqualBySuperClusterSeed
Definition: DuplicatedPhotonRemover.h:21
EtComparator.h
GsfElectronFwd.h
pat::DuplicatedPhotonRemover::duplicatesBySuperCluster
std::unique_ptr< std::vector< size_t > > duplicatesBySuperCluster(const PhotonCollection &photons) const
Definition: DuplicatedPhotonRemover.h:83
pat::DuplicatedPhotonRemover::duplicatesBySeed
std::unique_ptr< std::vector< size_t > > duplicatesBySeed(const PhotonCollection &photons) const
Definition: DuplicatedPhotonRemover.h:91
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
pat
Definition: HeavyIon.h:7
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
pat::DuplicatedPhotonRemover::EqualBySuperClusterSeed::operator()
bool operator()(const T1 &t1, const T2 &t2) const
Definition: DuplicatedPhotonRemover.h:23
reco::PhotonCollection
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
View.h
pat::DuplicatedPhotonRemover
Definition: DuplicatedPhotonRemover.h:18
pat::DuplicatedPhotonRemover::EqualBySuperCluster
Definition: DuplicatedPhotonRemover.h:29