CMS 3D CMS Logo

InterestingEcalDetIdProducer.cc
Go to the documentation of this file.
2 
8 
10 
13 
17 
19 
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 }
26 
28 
30  edm::ESHandle<CaloTopology> theCaloTopology = iSetup.getHandle(caloTopoToken_);
31  caloTopology_ = &(*theCaloTopology);
32 }
33 
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)
51  interestingDetIdCollection->push_back(*id);
52  }
54 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
InterestingEcalDetIdProducer(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopoToken_
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_
int iEvent
Definition: GenABIO.cc:224
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
void beginRun(const edm::Run &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45