#include <InterestingEcalDetIdProducer.h>
Public Member Functions | |
void | beginRun (edm::Run &, const edm::EventSetup &) |
InterestingEcalDetIdProducer (const edm::ParameterSet &) | |
void | produce (edm::Event &, const edm::EventSetup &) |
~InterestingEcalDetIdProducer () | |
Private Attributes | |
const CaloTopology * | caloTopology_ |
edm::InputTag | inputCollection_ |
Definition at line 10 of file InterestingEcalDetIdProducer.h.
InterestingEcalDetIdProducer::InterestingEcalDetIdProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 25 of file InterestingEcalDetIdProducer.cc.
References edm::ParameterSet::getParameter(), and inputCollection_.
{ inputCollection_ = iConfig.getParameter< edm::InputTag >("inputCollection"); produces< DetIdCollection >() ; }
InterestingEcalDetIdProducer::~InterestingEcalDetIdProducer | ( | ) |
Definition at line 32 of file InterestingEcalDetIdProducer.cc.
{}
void InterestingEcalDetIdProducer::beginRun | ( | edm::Run & | run, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 35 of file InterestingEcalDetIdProducer.cc.
References caloTopology_, and edm::EventSetup::get().
{ edm::ESHandle<CaloTopology> theCaloTopology; iSetup.get<CaloTopologyRecord>().get(theCaloTopology); caloTopology_ = &(*theCaloTopology); }
void InterestingEcalDetIdProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 43 of file InterestingEcalDetIdProducer.cc.
References caloTopology_, DetId::Ecal, spr::find(), edm::Event::getByLabel(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), errorMatrix2Lands_multiChannel::id, inputCollection_, metsig::muon, patZpeak::muons, and edm::Event::put().
{ edm::Handle<reco::MuonCollection> muons; iEvent.getByLabel(inputCollection_,muons); std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ; for(reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon){ if (! muon->isEnergyValid() ) continue; if ( muon->calEnergy().ecal_id.rawId()==0 ) continue; const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(DetId::Ecal,muon->calEnergy().ecal_id.subdetId()); const std::vector<DetId>& ids = topology->getWindow(muon->calEnergy().ecal_id, 5, 5); for ( std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id ) if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id) == interestingDetIdCollection->end()) interestingDetIdCollection->push_back(*id); } iEvent.put(interestingDetIdCollection); }
const CaloTopology* InterestingEcalDetIdProducer::caloTopology_ [private] |
Definition at line 19 of file InterestingEcalDetIdProducer.h.
Referenced by beginRun(), and produce().
Definition at line 18 of file InterestingEcalDetIdProducer.h.
Referenced by InterestingEcalDetIdProducer(), and produce().