Remove duplicates from the list of electrons. More...
Public Member Functions | |
DuplicatedElectronCleaner (const edm::ParameterSet &iConfig) | |
virtual void | endJob () |
virtual void | produce (edm::Event &iEvent, const edm::EventSetup &iSetup) |
~DuplicatedElectronCleaner () | |
Private Attributes | |
pat::DuplicatedElectronRemover | duplicateRemover_ |
edm::InputTag | electronSrc_ |
uint64_t | pass_ |
uint64_t | try_ |
Remove duplicates from the list of electrons.
The DuplicatedElectronCleaner removes duplicates from the input collection. Two electrons are considered duplicate if they share the same gsfTrack or the same superCluster. Among the two, the one with |E/P| nearest to 1 is kept. This is performed by the DuplicatedElectronRemover in PhysicsTools/PatUtils
The output is an edm::RefVector<reco:::GsfElectron>, which can be read through edm::View<reco::GsfElectron>
Definition at line 34 of file DuplicatedElectronCleaner.cc.
pat::DuplicatedElectronCleaner::DuplicatedElectronCleaner | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 49 of file DuplicatedElectronCleaner.cc.
: electronSrc_(iConfig.getParameter<edm::InputTag>("electronSource")), try_(0), pass_(0) { //produces<edm::RefVector<reco::GsfElectronCollection> >(); produces<edm::RefToBaseVector<reco::GsfElectron> >(); //produces<edm::PtrVector<reco::GsfElectron> >(); }
pat::DuplicatedElectronCleaner::~DuplicatedElectronCleaner | ( | ) |
Definition at line 58 of file DuplicatedElectronCleaner.cc.
{ }
void pat::DuplicatedElectronCleaner::endJob | ( | void | ) | [virtual] |
void pat::DuplicatedElectronCleaner::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 63 of file DuplicatedElectronCleaner.cc.
References HI_PhotonSkim_cff::electrons, edm::Event::getByLabel(), i, n, edm::Event::put(), and query::result.
{ using namespace edm; Handle<View<reco::GsfElectron> > electrons; iEvent.getByLabel(electronSrc_, electrons); try_ += electrons->size(); //std::auto_ptr<RefVector<reco::GsfElectronCollection> > result(new RefVector<reco::GsfElectronCollection>()); std::auto_ptr<RefToBaseVector<reco::GsfElectron> > result(new RefToBaseVector<reco::GsfElectron>()); //std::auto_ptr<PtrVector<reco::GsfElectron> > result(new PtrVector<reco::GsfElectron>()); std::auto_ptr< std::vector<size_t> > duplicates = duplicateRemover_.duplicatesToRemove(*electrons); std::vector<size_t>::const_iterator itdup = duplicates->begin(), enddup = duplicates->end(); for (size_t i = 0, n = electrons->size(); i < n; ++i) { while ((itdup != enddup) && (*itdup < i)) { ++itdup; } if ((itdup != enddup) && (*itdup == i)) continue; //result->push_back(electrons->refAt(i).castTo<edm::Ref<reco::GsfElectronCollection> >()); result->push_back(electrons->refAt(i)); //result->push_back(electrons->ptrAt(i)); } pass_ += result->size(); iEvent.put(result); }
Definition at line 44 of file DuplicatedElectronCleaner.cc.
Definition at line 43 of file DuplicatedElectronCleaner.cc.
uint64_t pat::DuplicatedElectronCleaner::pass_ [private] |
Definition at line 45 of file DuplicatedElectronCleaner.cc.
uint64_t pat::DuplicatedElectronCleaner::try_ [private] |
Definition at line 45 of file DuplicatedElectronCleaner.cc.