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 Member Functions | Private Attributes
GSFElectronsMixer Class Reference

#include <TauAnalysis/GSFElectronsMixer/src/GSFElectronsMixer.cc>

Inheritance diagram for GSFElectronsMixer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 GSFElectronsMixer (const edm::ParameterSet &)
 
 ~GSFElectronsMixer ()
 
- 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 Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag _electrons1
 
edm::InputTag _electrons2
 

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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 42 of file GSFElectronsMixer.cc.

Constructor & Destructor Documentation

GSFElectronsMixer::GSFElectronsMixer ( const edm::ParameterSet iConfig)
explicit

Definition at line 69 of file GSFElectronsMixer.cc.

69  :
70  _electrons1(iConfig.getParameter< edm::InputTag > ("col1")),
71  _electrons2(iConfig.getParameter< edm::InputTag > ("col2"))
72 {
73 
74  produces<reco::GsfElectronCollection>();
75 }
T getParameter(std::string const &) const
edm::InputTag _electrons1
edm::InputTag _electrons2
GSFElectronsMixer::~GSFElectronsMixer ( )

Definition at line 78 of file GSFElectronsMixer.cc.

79 {
80 
81  // do anything here that needs to be done at desctruction time
82  // (e.g. close files, deallocate resources etc.)
83 
84 }

Member Function Documentation

void GSFElectronsMixer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 135 of file GSFElectronsMixer.cc.

136 {
137 }
void GSFElectronsMixer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 141 of file GSFElectronsMixer.cc.

141  {
142 }
void GSFElectronsMixer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 93 of file GSFElectronsMixer.cc.

References _electrons1, _electrons2, edm::Event::getByLabel(), and edm::Event::put().

94 {
95  using namespace edm;
96 
97  std::vector< edm::Handle<reco::GsfElectronCollection> > cols;
99  iEvent.getByLabel( _electrons1, tks1);
100 
102  iEvent.getByLabel( _electrons2, tks2);
103 
104  cols.push_back(tks1);
105  cols.push_back(tks2);
106 
107  std::auto_ptr<reco::GsfElectronCollection> finalCollection( new reco::GsfElectronCollection ) ;
108 
109  //std::cout << "##########################################\n";
110  //int i = 0;
111  std::vector< edm::Handle< reco::GsfElectronCollection > >::iterator it = cols.begin();
112  for(;it != cols.end(); ++it)
113  {
114  //std::cout << " col " << i++ << std::endl;
115  for ( reco::GsfElectronCollection::const_iterator itT = (*it)->begin() ; itT != (*it)->end(); ++itT)
116  {
117  /*
118  std::cout << " " << itT->vx()
119  << " " << itT->vy()
120  << " " << itT->vz()
121  << " " << itT->pt()
122  << std::endl;*/
123 
124  finalCollection->push_back(*itT);
125  }
126 
127  }
128 
129  iEvent.put(finalCollection);
130 
131 }
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
edm::InputTag _electrons1
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::InputTag _electrons2

Member Data Documentation

edm::InputTag GSFElectronsMixer::_electrons1
private

Definition at line 51 of file GSFElectronsMixer.cc.

Referenced by produce().

edm::InputTag GSFElectronsMixer::_electrons2
private

Definition at line 52 of file GSFElectronsMixer.cc.

Referenced by produce().