CMS 3D CMS Logo

pat::DuplicatedElectronCleaner Class Reference

Remove duplicates from the list of electrons. More...

Inheritance diagram for pat::DuplicatedElectronCleaner:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

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_


Detailed Description

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>

Author:
Giovanni Petrucciani
Version:
Id
DuplicatedElectronCleaner.cc,v 1.1.2.2.2.1 2009/01/12 22:08:06 gpetrucc Exp

Definition at line 38 of file DuplicatedElectronCleaner.cc.


Constructor & Destructor Documentation

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 (  ) 

Definition at line 63 of file DuplicatedElectronCleaner.cc.

00063                                                          {
00064 }


Member Function Documentation

void pat::DuplicatedElectronCleaner::endJob ( void   )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 94 of file DuplicatedElectronCleaner.cc.

00094                                      { 
00095 }

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 }


Member Data Documentation

pat::DuplicatedElectronRemover pat::DuplicatedElectronCleaner::duplicateRemover_ [private]

Definition at line 48 of file DuplicatedElectronCleaner.cc.

Referenced by produce().

edm::InputTag pat::DuplicatedElectronCleaner::electronSrc_ [private]

Definition at line 47 of file DuplicatedElectronCleaner.cc.

Referenced by produce().

uint64_t pat::DuplicatedElectronCleaner::pass_ [private]

Definition at line 49 of file DuplicatedElectronCleaner.cc.

Referenced by produce().

uint64_t pat::DuplicatedElectronCleaner::try_ [private]

Definition at line 49 of file DuplicatedElectronCleaner.cc.

Referenced by produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:49:31 2009 for CMSSW by  doxygen 1.5.4