Go to the documentation of this file.00001 #ifndef PhysicsTools_PatUtils_DuplicatedElectronRemover_h
00002 #define PhysicsTools_PatUtils_DuplicatedElectronRemover_h
00003
00004 #include "PhysicsTools/PatUtils/interface/GenericDuplicateRemover.h"
00005
00006 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00007 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
00008 #include "DataFormats/Common/interface/View.h"
00009
00010 #include <memory>
00011 #include <vector>
00012
00013
00014 namespace pat {
00015
00016
00017
00018
00019
00020
00021
00022 class DuplicatedElectronRemover {
00023 public:
00024 struct SameSuperclusterOrTrack {
00025 template<typename T1, typename T2>
00026 bool operator()(const T1 &t1, const T2 &t2) const {
00027 return ((t1.superCluster() == t2.superCluster()) ||
00028 (t1.gsfTrack() == t2.gsfTrack()));
00029 }
00030 };
00031
00032 struct BestEoverP {
00033 template<typename T1, typename T2>
00034 bool operator()(const T1 &t1, const T2 &t2) const {
00035 float diff1 = fabs(t1.eSuperClusterOverP()-1);
00036 float diff2 = fabs(t2.eSuperClusterOverP()-1);
00037 return diff1 <= diff2;
00038 }
00039 };
00040
00041
00042
00043 std::auto_ptr< std::vector<size_t> > duplicatesToRemove(const std::vector<reco::GsfElectron> &electrons) const ;
00044
00045
00046
00047 std::auto_ptr< std::vector<size_t> > duplicatesToRemove(const edm::View<reco::GsfElectron> &electrons) const ;
00048
00049
00050 template<typename Collection>
00051 std::auto_ptr< std::vector<size_t> > duplicatesToRemove(const Collection &electrons) const ;
00052
00053 private:
00054 };
00055 }
00056
00057
00058 template<typename Collection>
00059 std::auto_ptr< std::vector<size_t> >
00060 pat::DuplicatedElectronRemover::duplicatesToRemove(const Collection &electrons) const {
00061 pat::GenericDuplicateRemover<SameSuperclusterOrTrack,BestEoverP> dups;
00062 return dups.duplicates(electrons);
00063 }
00064 #endif