CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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)
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
InterestingEcalDetIdProducer(const edm::ParameterSet &)
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
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
def move
Definition: eostools.py:511
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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
tuple muons
Definition: patZpeak.py:39
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
Definition: Run.h:45