CMS 3D CMS Logo

L3MuonSumCaloPFIsolationProducer.cc
Go to the documentation of this file.
2 
3 // Framework
8 
10 
12 
18 
20 
22 
23 #include <string>
24 
25 using namespace edm;
26 using namespace std;
27 using namespace reco;
28 
31  recoChargedCandidateProducer_ = consumes<reco::RecoChargedCandidateCollection>(
32  config.getParameter<edm::InputTag>("recoChargedCandidateProducer"));
33  pfEcalClusterProducer_ =
34  consumes<reco::RecoChargedCandidateIsolationMap>(config.getParameter<edm::InputTag>("pfEcalClusterProducer"));
35  pfHcalClusterProducer_ =
36  consumes<reco::RecoChargedCandidateIsolationMap>(config.getParameter<edm::InputTag>("pfHcalClusterProducer"));
37 
38  produces<edm::ValueMap<float>>();
39 }
40 
42 
45  desc.add<edm::InputTag>("recoChargedCandidateProducer", edm::InputTag("hltL1SeededRecoChargedCandidatePF"));
46  desc.add<edm::InputTag>("pfEcalClusterProducer", edm::InputTag("hltParticleFlowClusterECAL"));
47  desc.add<edm::InputTag>("pfHcalClusterProducer", edm::InputTag("hltParticleFlowClusterHCAL"));
48  descriptions.add(("hltL3MuonSumCaloPFIsolationProducer"), desc);
49 }
50 
53  iEvent.getByToken(recoChargedCandidateProducer_, recochargedcandHandle);
54 
56  iEvent.getByToken(pfEcalClusterProducer_, ecalIsolation);
57 
59  iEvent.getByToken(pfHcalClusterProducer_, hcalIsolation);
60 
61  auto caloIsoMap = std::make_unique<edm::ValueMap<float>>();
62  std::vector<float> isoFloats(recochargedcandHandle->size(), 0);
63 
64  for (unsigned int iReco = 0; iReco < recochargedcandHandle->size(); iReco++) {
65  reco::RecoChargedCandidateRef candRef(recochargedcandHandle, iReco);
66  reco::RecoChargedCandidateIsolationMap::const_iterator mapiECAL = (*ecalIsolation).find(candRef);
67  float valisoECAL = mapiECAL->val;
68  reco::RecoChargedCandidateIsolationMap::const_iterator mapiHCAL = (*hcalIsolation).find(candRef);
69  float valisoHCAL = mapiHCAL->val;
70  float caloIso = valisoECAL + valisoHCAL;
71  isoFloats[iReco] = caloIso;
72  }
73 
74  edm::ValueMap<float>::Filler isoFloatFiller(*caloIsoMap);
75  isoFloatFiller.insert(recochargedcandHandle, isoFloats.begin(), isoFloats.end());
76  isoFloatFiller.fill();
77  iEvent.put(std::move(caloIsoMap));
78 }
edm::StreamID
Definition: StreamID.h:30
Handle.h
edm::helper::Filler::insert
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
MessageLogger.h
ESHandle.h
edm
HLT enums.
Definition: AlignableModifier.h:19
AssociationMap.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::helper::Filler::fill
void fill()
Definition: ValueMap.h:65
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
L3MuonSumCaloPFIsolationProducer.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
RecoChargedCandidateIsolation.h
L3MuonSumCaloPFIsolationProducer::~L3MuonSumCaloPFIsolationProducer
~L3MuonSumCaloPFIsolationProducer() override
Definition: L3MuonSumCaloPFIsolationProducer.cc:41
edm::Handle< reco::RecoChargedCandidateCollection >
L3MuonSumCaloPFIsolationProducer::L3MuonSumCaloPFIsolationProducer
L3MuonSumCaloPFIsolationProducer(const edm::ParameterSet &)
constructor with config
Definition: L3MuonSumCaloPFIsolationProducer.cc:30
edm::Ref
Definition: AssociativeIterator.h:58
config
Definition: config.py:1
Track.h
TrackFwd.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::helpers::KeyVal::val
V val
Definition: AssociationMapHelpers.h:33
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
ValueMap.h
L3MuonSumCaloPFIsolationProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: L3MuonSumCaloPFIsolationProducer.cc:43
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
RecoChargedCandidate.h
EventSetup.h
RecoTauCleanerPlugins.ecalIsolation
ecalIsolation
Definition: RecoTauCleanerPlugins.py:112
ConsumesCollector.h
edm::helper::Filler
Definition: ValueMap.h:22
edm::Event
Definition: Event.h:73
RecoChargedCandidateFwd.h
edm::AssociationMap::const_iterator
const iterator
Definition: AssociationMap.h:76
edm::InputTag
Definition: InputTag.h:15
L3MuonSumCaloPFIsolationProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: L3MuonSumCaloPFIsolationProducer.cc:51