CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
pat::DuplicatedElectronCleaner Class Reference

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

Inheritance diagram for pat::DuplicatedElectronCleaner:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 DuplicatedElectronCleaner (const edm::ParameterSet &iConfig)
 
virtual void endJob ()
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~DuplicatedElectronCleaner ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

pat::DuplicatedElectronRemover duplicateRemover_
 
edm::InputTag electronSrc_
 
uint64_t pass_
 
uint64_t try_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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.4 2010/02/20 21:00:16 wmtan Exp

Definition at line 34 of file DuplicatedElectronCleaner.cc.

Constructor & Destructor Documentation

pat::DuplicatedElectronCleaner::DuplicatedElectronCleaner ( const edm::ParameterSet iConfig)
explicit

Definition at line 49 of file DuplicatedElectronCleaner.cc.

49  :
50  electronSrc_(iConfig.getParameter<edm::InputTag>("electronSource")),
51  try_(0), pass_(0)
52 {
53  //produces<edm::RefVector<reco::GsfElectronCollection> >();
54  produces<edm::RefToBaseVector<reco::GsfElectron> >();
55  //produces<edm::PtrVector<reco::GsfElectron> >();
56 }
T getParameter(std::string const &) const
pat::DuplicatedElectronCleaner::~DuplicatedElectronCleaner ( )

Definition at line 58 of file DuplicatedElectronCleaner.cc.

59 {
60 }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 88 of file DuplicatedElectronCleaner.cc.

89 {
90 }
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.

64 {
65  using namespace edm;
68  try_ += electrons->size();
69 
70  //std::auto_ptr<RefVector<reco::GsfElectronCollection> > result(new RefVector<reco::GsfElectronCollection>());
71  std::auto_ptr<RefToBaseVector<reco::GsfElectron> > result(new RefToBaseVector<reco::GsfElectron>());
72  //std::auto_ptr<PtrVector<reco::GsfElectron> > result(new PtrVector<reco::GsfElectron>());
73  std::auto_ptr< std::vector<size_t> > duplicates = duplicateRemover_.duplicatesToRemove(*electrons);
74 
75  std::vector<size_t>::const_iterator itdup = duplicates->begin(), enddup = duplicates->end();
76  for (size_t i = 0, n = electrons->size(); i < n; ++i) {
77  while ((itdup != enddup) && (*itdup < i)) { ++itdup; }
78  if ((itdup != enddup) && (*itdup == i)) continue;
79  //result->push_back(electrons->refAt(i).castTo<edm::Ref<reco::GsfElectronCollection> >());
80  result->push_back(electrons->refAt(i));
81  //result->push_back(electrons->ptrAt(i));
82  }
83  pass_ += result->size();
84  iEvent.put(result);
85 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
tuple result
Definition: query.py:137
pat::DuplicatedElectronRemover duplicateRemover_
std::auto_ptr< std::vector< size_t > > duplicatesToRemove(const std::vector< reco::GsfElectron > &electrons) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356

Member Data Documentation

pat::DuplicatedElectronRemover pat::DuplicatedElectronCleaner::duplicateRemover_
private

Definition at line 44 of file DuplicatedElectronCleaner.cc.

edm::InputTag pat::DuplicatedElectronCleaner::electronSrc_
private

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.