CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 GSFElectronsMixer (const edm::ParameterSet &)
 ~GSFElectronsMixer ()

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

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.

                                                                   :
  _electrons1(iConfig.getParameter< edm::InputTag > ("col1")),
  _electrons2(iConfig.getParameter< edm::InputTag > ("col2"))
{

   produces<reco::GsfElectronCollection>();
}
GSFElectronsMixer::~GSFElectronsMixer ( )

Definition at line 78 of file GSFElectronsMixer.cc.

{

   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void GSFElectronsMixer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 135 of file GSFElectronsMixer.cc.

{
}
void GSFElectronsMixer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 141 of file GSFElectronsMixer.cc.

                          {
}
void GSFElectronsMixer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 93 of file GSFElectronsMixer.cc.

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

{
   using namespace edm;

   std::vector< edm::Handle<reco::GsfElectronCollection> > cols;
   edm::Handle<reco::GsfElectronCollection> tks1;
   iEvent.getByLabel( _electrons1, tks1);

   edm::Handle<reco::GsfElectronCollection> tks2;
   iEvent.getByLabel( _electrons2, tks2);

   cols.push_back(tks1);
   cols.push_back(tks2);

   std::auto_ptr<reco::GsfElectronCollection> finalCollection( new reco::GsfElectronCollection ) ;

   //std::cout << "##########################################\n";
   //int i  = 0;
   std::vector< edm::Handle< reco::GsfElectronCollection > >::iterator it = cols.begin();
   for(;it != cols.end(); ++it)
   {
     //std::cout << " col " << i++ << std::endl;
     for ( reco::GsfElectronCollection::const_iterator itT = (*it)->begin() ; itT != (*it)->end(); ++itT)
     {
       /*
       std::cout << " " << itT->vx()
           << " " << itT->vy()
           << " " << itT->vz()
           << " " << itT->pt()
           << std::endl;*/

       finalCollection->push_back(*itT);
     }

   }

   iEvent.put(finalCollection);

}

Member Data Documentation

Definition at line 51 of file GSFElectronsMixer.cc.

Referenced by produce().

Definition at line 52 of file GSFElectronsMixer.cc.

Referenced by produce().