CMS 3D CMS Logo

InterestingEcalDetIdProducer.cc
Go to the documentation of this file.
2 
8 
10 
13 
17 
21 
23  inputCollection_ = iConfig.getParameter<edm::InputTag>("inputCollection");
24  produces<DetIdCollection>();
25  muonToken_ = consumes<reco::MuonCollection>(inputCollection_);
26 }
27 
29 
31  edm::ESHandle<CaloTopology> theCaloTopology;
32  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
33  caloTopology_ = &(*theCaloTopology);
34 }
35 
38  iEvent.getByToken(muonToken_, muons);
39 
40  auto interestingDetIdCollection = std::make_unique<DetIdCollection>();
41 
42  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
43  if (!muon->isEnergyValid())
44  continue;
45  if (muon->calEnergy().ecal_id.rawId() == 0)
46  continue;
48  caloTopology_->getSubdetectorTopology(DetId::Ecal, muon->calEnergy().ecal_id.subdetId());
49  const std::vector<DetId>& ids = topology->getWindow(muon->calEnergy().ecal_id, 5, 5);
50  for (std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id)
53  interestingDetIdCollection->push_back(*id);
54  }
56 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
InterestingEcalDetIdProducer(const edm::ParameterSet &)
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
void produce(edm::Event &, const edm::EventSetup &) override
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
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
T get() const
Definition: EventSetup.h:73
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45