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_ |
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 38 of file DuplicatedElectronCleaner.cc.
pat::DuplicatedElectronCleaner::DuplicatedElectronCleaner | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 54 of file DuplicatedElectronCleaner.cc.
00054 : 00055 electronSrc_(iConfig.getParameter<edm::InputTag>("electronSource")), 00056 try_(0), pass_(0) 00057 { 00058 //produces<edm::RefVector<reco::GsfElectronCollection> >(); 00059 produces<edm::RefToBaseVector<reco::GsfElectron> >(); 00060 //produces<edm::PtrVector<reco::GsfElectron> >(); 00061 }
pat::DuplicatedElectronCleaner::~DuplicatedElectronCleaner | ( | ) |
void pat::DuplicatedElectronCleaner::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 67 of file DuplicatedElectronCleaner.cc.
References duplicateRemover_, pat::DuplicatedElectronRemover::duplicatesToRemove(), electronSrc_, edm::Event::getByLabel(), i, n, pass_, edm::Event::put(), HLT_VtxMuL3::result, and try_.
00067 { 00068 using namespace edm; 00069 Handle<View<reco::GsfElectron> > electrons; 00070 iEvent.getByLabel(electronSrc_, electrons); 00071 try_ += electrons->size(); 00072 00073 //std::auto_ptr<RefVector<reco::GsfElectronCollection> > result(new RefVector<reco::GsfElectronCollection>()); 00074 std::auto_ptr<RefToBaseVector<reco::GsfElectron> > result(new RefToBaseVector<reco::GsfElectron>()); 00075 //std::auto_ptr<PtrVector<reco::GsfElectron> > result(new PtrVector<reco::GsfElectron>()); 00076 00077 std::auto_ptr< std::vector<size_t> > duplicates = duplicateRemover_.duplicatesToRemove(*electrons); 00078 00079 std::vector<size_t>::const_iterator itdup = duplicates->begin(), enddup = duplicates->end(); 00080 for (size_t i = 0, n = electrons->size(); i < n; ++i) { 00081 while ((itdup != enddup) && (*itdup < i)) { ++itdup; } 00082 if ((itdup != enddup) && (*itdup == i)) continue; 00083 //result->push_back(electrons->refAt(i).castTo<edm::Ref<reco::GsfElectronCollection> >()); 00084 result->push_back(electrons->refAt(i)); 00085 //result->push_back(electrons->ptrAt(i)); 00086 } 00087 00088 pass_ += result->size(); 00089 iEvent.put(result); 00090 }
uint64_t pat::DuplicatedElectronCleaner::pass_ [private] |
uint64_t pat::DuplicatedElectronCleaner::try_ [private] |