RecoMuon
MuonIdentification
plugins
InterestingEcalDetIdProducer.cc
Go to the documentation of this file.
1
#include "
RecoMuon/MuonIdentification/plugins/InterestingEcalDetIdProducer.h
"
2
3
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/Framework/interface/EventSetup.h
"
6
#include "
FWCore/Framework/interface/ESHandle.h
"
7
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
8
9
#include "
DataFormats/EcalRecHit/interface/EcalRecHitCollections.h
"
10
11
#include "
DataFormats/EcalDetId/interface/EBDetId.h
"
12
#include "
DataFormats/EcalDetId/interface/EEDetId.h
"
13
14
#include "
DataFormats/DetId/interface/DetIdCollection.h
"
15
#include "
DataFormats/EgammaReco/interface/BasicCluster.h
"
16
#include "
DataFormats/EgammaReco/interface/BasicClusterFwd.h
"
17
18
#include "
Geometry/CaloEventSetup/interface/CaloTopologyRecord.h
"
19
#include "
Geometry/CaloTopology/interface/CaloTopology.h
"
20
#include "
Geometry/CaloTopology/interface/CaloSubdetectorTopology.h
"
21
22
InterestingEcalDetIdProducer::InterestingEcalDetIdProducer
(
const
edm::ParameterSet
& iConfig) {
23
inputCollection_
= iConfig.
getParameter
<
edm::InputTag
>(
"inputCollection"
);
24
produces<DetIdCollection>();
25
muonToken_
= consumes<reco::MuonCollection>(
inputCollection_
);
26
}
27
28
InterestingEcalDetIdProducer::~InterestingEcalDetIdProducer
() {}
29
30
void
InterestingEcalDetIdProducer::beginRun
(
const
edm::Run
&
run
,
const
edm::EventSetup
& iSetup) {
31
edm::ESHandle<CaloTopology>
theCaloTopology;
32
iSetup.
get
<
CaloTopologyRecord
>().
get
(theCaloTopology);
33
caloTopology_
= &(*theCaloTopology);
34
}
35
36
void
InterestingEcalDetIdProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
37
edm::Handle<reco::MuonCollection>
muons
;
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
;
47
const
CaloSubdetectorTopology
*
topology
=
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
)
51
if
(
std::find
(
interestingDetIdCollection
->begin(),
interestingDetIdCollection
->end(), *
id
) ==
52
interestingDetIdCollection
->end())
53
interestingDetIdCollection
->push_back(*
id
);
54
}
55
iEvent
.put(
std::move
(
interestingDetIdCollection
));
56
}
PDWG_BPHSkim_cff.muons
muons
Definition:
PDWG_BPHSkim_cff.py:47
InterestingEcalDetIdProducer::InterestingEcalDetIdProducer
InterestingEcalDetIdProducer(const edm::ParameterSet &)
Definition:
InterestingEcalDetIdProducer.cc:22
MessageLogger.h
ESHandle.h
muon
Definition:
MuonCocktails.h:17
InterestingEcalDetIdProducer::beginRun
void beginRun(const edm::Run &, const edm::EventSetup &) override
Definition:
InterestingEcalDetIdProducer.cc:30
edm::Run
Definition:
Run.h:45
BasicCluster.h
CaloTopology::getWindow
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition:
CaloTopology.cc:64
EBDetId.h
EEDetId.h
CaloTopologyRecord
Definition:
CaloTopologyRecord.h:10
HLT_2018_cff.muon
muon
Definition:
HLT_2018_cff.py:10349
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:19
edm::Handle< reco::MuonCollection >
EcalRecHitCollections.h
InterestingEcalDetIdProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
InterestingEcalDetIdProducer.cc:36
InterestingEcalDetIdProducer::caloTopology_
const CaloTopology * caloTopology_
Definition:
InterestingEcalDetIdProducer.h:23
BasicClusterFwd.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
ecaldqm::topology
const CaloTopology * topology(nullptr)
edm::ESHandle< CaloTopology >
InterestingEcalDetIdProducer::~InterestingEcalDetIdProducer
~InterestingEcalDetIdProducer() override
Definition:
InterestingEcalDetIdProducer.cc:28
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
InterestingEcalDetIdProducer::muonToken_
edm::EDGetTokenT< reco::MuonCollection > muonToken_
Definition:
InterestingEcalDetIdProducer.h:22
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition:
CaloTopology.cc:17
CaloTopologyRecord.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
CaloSubdetectorTopology
Definition:
CaloSubdetectorTopology.h:17
DetId::Ecal
Definition:
DetId.h:27
get
#define get
CaloTopology.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CaloSubdetectorTopology.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
writedatasetfile.run
run
Definition:
writedatasetfile.py:27
triggerObjects_cff.id
id
Definition:
triggerObjects_cff.py:31
EventSetup.h
InterestingEcalDetIdProducer.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
interestingDetIdCollectionProducer_cfi.interestingDetIdCollection
interestingDetIdCollection
Definition:
interestingDetIdCollectionProducer_cfi.py:11
edm::InputTag
Definition:
InputTag.h:15
DetIdCollection.h
InterestingEcalDetIdProducer::inputCollection_
edm::InputTag inputCollection_
Definition:
InterestingEcalDetIdProducer.h:21
Generated for CMSSW Reference Manual by
1.8.16