CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

aod2patFilterZee Class Reference

Inheritance diagram for aod2patFilterZee:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

edm::InputTag electronCollectionTag_
edm::InputTag metCollectionTag_

Detailed Description

Definition at line 57 of file aod2patFilterZee.cc.


Constructor & Destructor Documentation

aod2patFilterZee::aod2patFilterZee ( const edm::ParameterSet iConfig) [explicit]

Definition at line 89 of file aod2patFilterZee.cc.

References electronCollectionTag_, edm::ParameterSet::getUntrackedParameter(), and metCollectionTag_.

{

  electronCollectionTag_=iConfig.getUntrackedParameter<edm::InputTag>
    ("electronCollectionTag");
  metCollectionTag_=iConfig.getUntrackedParameter<edm::InputTag>
    ("metCollectionTag");


  produces< pat::ElectronCollection > 
    ("patElectrons").setBranchAlias("patElectrons");

  produces< pat::METCollection>("patCaloMets").setBranchAlias("patCaloMets");
  //produces< pat::METCollection>("patPfMets").setBranchAlias("patPfMets");
  //produces< pat::METCollection>("patTcMets").setBranchAlias("patTcMets");
  //produces< pat::METCollection>("patT1cMets").setBranchAlias("patT1cMets");

}
aod2patFilterZee::~aod2patFilterZee ( )

Definition at line 108 of file aod2patFilterZee.cc.

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

}

Member Function Documentation

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

Reimplemented from edm::EDFilter.

Definition at line 178 of file aod2patFilterZee.cc.

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

Reimplemented from edm::EDFilter.

Definition at line 183 of file aod2patFilterZee.cc.

                         {
}
bool aod2patFilterZee::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDFilter.

Definition at line 118 of file aod2patFilterZee.cc.

References gather_cfg::cout, electronCollectionTag_, edm::Event::getByLabel(), gsfElectrons_cfi::gsfElectrons, CaloMET_cfi::met, metCollectionTag_, electronProducer_cfi::patElectrons, edm::Event::put(), pat::Lepton< LeptonType >::setEcalIso(), pat::Lepton< LeptonType >::setHcalIso(), and pat::Lepton< LeptonType >::setTrackIso().

{
  using namespace edm;
  using namespace std;
  using namespace pat;
  // *************************************************************************
  // ELECTRONS
  // *************************************************************************
  edm::Handle<reco::GsfElectronCollection> gsfElectrons;
  iEvent.getByLabel(electronCollectionTag_, gsfElectrons);
  if (!gsfElectrons.isValid()) {
    std::cout <<"aod2patFilterZee: Could not get electron collection with label: "
              <<electronCollectionTag_ << std::endl;
    return false;
  }
  const reco::GsfElectronCollection *pElecs = gsfElectrons.product();
  // calculate your electrons
  auto_ptr<pat::ElectronCollection> patElectrons(new pat::ElectronCollection);
  for (reco::GsfElectronCollection::const_iterator elec = pElecs->begin();
       elec != pElecs->end(); ++elec) {
    reco::GsfElectron mygsfelec = *elec;
    pat::Electron myElectron(mygsfelec);
    // now set the isolations from the Gsf electron
    myElectron.setTrackIso(elec->dr03TkSumPt());
    myElectron.setEcalIso(elec->dr04EcalRecHitSumEt());
    myElectron.setHcalIso(elec->dr04HcalTowerSumEt());

    patElectrons->push_back(myElectron);
  }
  // *************************************************************************
  // METs
  // *************************************************************************
  edm::Handle<reco::CaloMETCollection> calomets;
  iEvent.getByLabel(metCollectionTag_, calomets);
  if (! calomets.isValid()) {
    std::cout << "aod2patFilterZee: Could not get met collection with label: "
              << metCollectionTag_ << std::endl;
    return false;
  }
  const  reco::CaloMETCollection *mycalomets =  calomets.product();
  auto_ptr<pat::METCollection> patCaloMets(new pat::METCollection);
  for (reco::CaloMETCollection::const_iterator met = mycalomets->begin();
       met != mycalomets->end(); ++ met ) {
    pat::MET mymet(*met);
    patCaloMets->push_back(mymet);
  }

  //
  // put everything in the event
  //
  iEvent.put( patElectrons, "patElectrons");
  iEvent.put( patCaloMets, "patCaloMets");
  //

  return true;

}

Member Data Documentation

Definition at line 76 of file aod2patFilterZee.cc.

Referenced by aod2patFilterZee(), and filter().

Definition at line 77 of file aod2patFilterZee.cc.

Referenced by aod2patFilterZee(), and filter().