CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
InterestingEcalDetIdProducer Class Reference

#include <InterestingEcalDetIdProducer.h>

Inheritance diagram for InterestingEcalDetIdProducer:
edm::stream::EDProducer<>

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 () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

const CaloTopologycaloTopology_
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
caloTopoToken_
 
edm::InputTag inputCollection_
 
edm::EDGetTokenT
< reco::MuonCollection
muonToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 16 of file InterestingEcalDetIdProducer.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file InterestingEcalDetIdProducer.cc.

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

20  {
21  inputCollection_ = iConfig.getParameter<edm::InputTag>("inputCollection");
22  produces<DetIdCollection>();
23  muonToken_ = consumes<reco::MuonCollection>(inputCollection_);
24  caloTopoToken_ = esConsumes<CaloTopology, CaloTopologyRecord, edm::Transition::BeginRun>();
25 }
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopoToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
InterestingEcalDetIdProducer::~InterestingEcalDetIdProducer ( )
override

Definition at line 27 of file InterestingEcalDetIdProducer.cc.

27 {}

Member Function Documentation

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

Definition at line 29 of file InterestingEcalDetIdProducer.cc.

References caloTopology_, caloTopoToken_, and edm::EventSetup::getHandle().

29  {
30  edm::ESHandle<CaloTopology> theCaloTopology = iSetup.getHandle(caloTopoToken_);
31  caloTopology_ = &(*theCaloTopology);
32 }
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopoToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
void InterestingEcalDetIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 34 of file InterestingEcalDetIdProducer.cc.

References caloTopology_, DetId::Ecal, spr::find(), edm::Event::getByToken(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), gpuClustering::id, eostools::move(), HLT_FULL_cff::muon, patZpeak::muons, muonToken_, and edm::Event::put().

34  {
36  iEvent.getByToken(muonToken_, muons);
37 
38  auto interestingDetIdCollection = std::make_unique<DetIdCollection>();
39 
40  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
41  if (!muon->isEnergyValid())
42  continue;
43  if (muon->calEnergy().ecal_id.rawId() == 0)
44  continue;
45  const CaloSubdetectorTopology* topology =
46  caloTopology_->getSubdetectorTopology(DetId::Ecal, muon->calEnergy().ecal_id.subdetId());
47  const std::vector<DetId>& ids = topology->getWindow(muon->calEnergy().ecal_id, 5, 5);
48  for (std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id)
49  if (std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id) ==
50  interestingDetIdCollection->end())
51  interestingDetIdCollection->push_back(*id);
52  }
53  iEvent.put(std::move(interestingDetIdCollection));
54 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::EDGetTokenT< reco::MuonCollection > muonToken_
def move
Definition: eostools.py:511
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:17
tuple muons
Definition: patZpeak.py:39

Member Data Documentation

const CaloTopology* InterestingEcalDetIdProducer::caloTopology_
private

Definition at line 27 of file InterestingEcalDetIdProducer.h.

Referenced by beginRun(), and produce().

edm::ESGetToken<CaloTopology, CaloTopologyRecord> InterestingEcalDetIdProducer::caloTopoToken_
private

Definition at line 26 of file InterestingEcalDetIdProducer.h.

Referenced by beginRun(), and InterestingEcalDetIdProducer().

edm::InputTag InterestingEcalDetIdProducer::inputCollection_
private

Definition at line 24 of file InterestingEcalDetIdProducer.h.

Referenced by InterestingEcalDetIdProducer().

edm::EDGetTokenT<reco::MuonCollection> InterestingEcalDetIdProducer::muonToken_
private

Definition at line 25 of file InterestingEcalDetIdProducer.h.

Referenced by InterestingEcalDetIdProducer(), and produce().