CMS 3D CMS Logo

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