CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InterestingEcalDetIdProducer.cc
Go to the documentation of this file.
2 
8 
10 
13 
17 
21 
24 
26 {
27  inputCollection_ = iConfig.getParameter< edm::InputTag >("inputCollection");
28  produces< DetIdCollection >() ;
29 }
30 
31 
33 {}
34 
36 {
37  edm::ESHandle<CaloTopology> theCaloTopology;
38  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
39  caloTopology_ = &(*theCaloTopology);
40 }
41 
42 void
44  const edm::EventSetup& iSetup)
45 {
47  iEvent.getByLabel(inputCollection_,muons);
48 
49  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
50 
51  for(reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon){
52  if (! muon->isEnergyValid() ) continue;
53  if ( muon->calEnergy().ecal_id.rawId()==0 ) continue;
54  const CaloSubdetectorTopology* topology = caloTopology_->getSubdetectorTopology(DetId::Ecal,muon->calEnergy().ecal_id.subdetId());
55  const std::vector<DetId>& ids = topology->getWindow(muon->calEnergy().ecal_id, 5, 5);
56  for ( std::vector<DetId>::const_iterator id = ids.begin(); id != ids.end(); ++id )
57  if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *id)
58  == interestingDetIdCollection->end())
59  interestingDetIdCollection->push_back(*id);
60  }
61  iEvent.put(interestingDetIdCollection);
62 }
T getParameter(std::string const &) const
InterestingEcalDetIdProducer(const edm::ParameterSet &)
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:7
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
const T & get() const
Definition: EventSetup.h:55
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
void beginRun(const edm::Run &, const edm::EventSetup &) override
tuple muons
Definition: patZpeak.py:38
edm::EDCollection< DetId > DetIdCollection
Definition: Run.h:36