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 Attributes
InterestingEcalDetIdProducer Class Reference

#include <InterestingEcalDetIdProducer.h>

Inheritance diagram for InterestingEcalDetIdProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 InterestingEcalDetIdProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~InterestingEcalDetIdProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

const CaloTopologycaloTopology_
 
edm::InputTag inputCollection_
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

Definition at line 10 of file InterestingEcalDetIdProducer.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file InterestingEcalDetIdProducer.cc.

References edm::ParameterSet::getParameter(), and inputCollection_.

26 {
27  inputCollection_ = iConfig.getParameter< edm::InputTag >("inputCollection");
28  produces< DetIdCollection >() ;
29 }
T getParameter(std::string const &) const
InterestingEcalDetIdProducer::~InterestingEcalDetIdProducer ( )

Definition at line 32 of file InterestingEcalDetIdProducer.cc.

33 {}

Member Function Documentation

void InterestingEcalDetIdProducer::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 35 of file InterestingEcalDetIdProducer.cc.

References caloTopology_, and edm::EventSetup::get().

36 {
37  edm::ESHandle<CaloTopology> theCaloTopology;
38  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
39  caloTopology_ = &(*theCaloTopology);
40 }
const T & get() const
Definition: EventSetup.h:55
void InterestingEcalDetIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 43 of file InterestingEcalDetIdProducer.cc.

References caloTopology_, DetId::Ecal, spr::find(), edm::Event::getByLabel(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), inputCollection_, metsig::muon, patZpeak::muons, and edm::Event::put().

45 {
47  iEvent.getByLabel(inputCollection_,muons);
48 
49  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
50 
51  for(reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon){
52  if (! muon->isEnergyValid() ) continue;
53  if ( muon->calEnergy().ecal_id.rawId()==0 ) continue;
54  const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(DetId::Ecal,muon->calEnergy().ecal_id.subdetId());
55  const std::vector<DetId>& ids = topology->getWindow(muon->calEnergy().ecal_id, 5, 5);
56  for ( std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id )
57  if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id)
58  == interestingDetIdCollection->end())
59  interestingDetIdCollection->push_back(*id);
60  }
61  iEvent.put(interestingDetIdCollection);
62 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
tuple muons
Definition: patZpeak.py:38
edm::EDCollection< DetId > DetIdCollection

Member Data Documentation

const CaloTopology* InterestingEcalDetIdProducer::caloTopology_
private

Definition at line 19 of file InterestingEcalDetIdProducer.h.

Referenced by beginRun(), and produce().

edm::InputTag InterestingEcalDetIdProducer::inputCollection_
private

Definition at line 18 of file InterestingEcalDetIdProducer.h.

Referenced by InterestingEcalDetIdProducer(), and produce().