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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GSFElectronsMixer (const edm::ParameterSet &)
 
 ~GSFElectronsMixer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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:121
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
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().