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 
32  recoChargedCandidateProducer_ = consumes<reco::RecoChargedCandidateCollection>(config.getParameter<edm::InputTag>("recoChargedCandidateProducer"));
33  pfEcalClusterProducer_ = consumes<reco::RecoChargedCandidateIsolationMap>(config.getParameter<edm::InputTag>("pfEcalClusterProducer"));
34  pfHcalClusterProducer_ = consumes<reco::RecoChargedCandidateIsolationMap>(config.getParameter<edm::InputTag>("pfHcalClusterProducer"));
35 
36  produces < edm::ValueMap<float> >();
37 
38 }
39 
41 {}
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 
52 
54  iEvent.getByToken(recoChargedCandidateProducer_,recochargedcandHandle);
55 
57  iEvent.getByToken (pfEcalClusterProducer_,ecalIsolation);
58 
60  iEvent.getByToken (pfHcalClusterProducer_,hcalIsolation);
61 
62  auto caloIsoMap = std::make_unique<edm::ValueMap<float>>();
63  std::vector<float> isoFloats(recochargedcandHandle->size(), 0);
64 
65  for (unsigned int iReco = 0; iReco < recochargedcandHandle->size(); iReco++) {
66  reco::RecoChargedCandidateRef candRef(recochargedcandHandle, iReco);
67  reco::RecoChargedCandidateIsolationMap::const_iterator mapiECAL = (*ecalIsolation).find( candRef );
68  float valisoECAL = mapiECAL->val;
69  reco::RecoChargedCandidateIsolationMap::const_iterator mapiHCAL = (*hcalIsolation).find( candRef );
70  float valisoHCAL = mapiHCAL->val;
71  float caloIso = valisoECAL + valisoHCAL;
72  isoFloats[iReco] = caloIso;
73  }
74 
75  edm::ValueMap<float> ::Filler isoFloatFiller(*caloIsoMap);
76  isoFloatFiller.insert(recochargedcandHandle, isoFloats.begin(), isoFloats.end());
77  isoFloatFiller.fill();
78  iEvent.put(std::move(caloIsoMap));
79 
80 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: config.py:1
int iEvent
Definition: GenABIO.cc:230
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
L3MuonSumCaloPFIsolationProducer(const edm::ParameterSet &)
constructor with config
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511