CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L3MuonSumCaloPFIsolationProducer.cc
Go to the documentation of this file.
2 
3 // Framework
9 
11 
13 
19 
21 
23 
24 #include <string>
25 
26 using namespace edm;
27 using namespace std;
28 using namespace reco;
29 
32 
33  recoChargedCandidateProducer_ = consumes<reco::RecoChargedCandidateCollection>(config.getParameter<edm::InputTag>("recoChargedCandidateProducer"));
34  pfEcalClusterProducer_ = consumes<reco::RecoChargedCandidateIsolationMap>(config.getParameter<edm::InputTag>("pfEcalClusterProducer"));
35  pfHcalClusterProducer_ = consumes<reco::RecoChargedCandidateIsolationMap>(config.getParameter<edm::InputTag>("pfHcalClusterProducer"));
36 
37  produces < edm::ValueMap<float> >();
38 
39 }
40 
42 {}
43 
46  desc.add<edm::InputTag>("recoChargedCandidateProducer", edm::InputTag("hltL1SeededRecoChargedCandidatePF"));
47  desc.add<edm::InputTag>("pfEcalClusterProducer", edm::InputTag("hltParticleFlowClusterECAL"));
48  desc.add<edm::InputTag>("pfHcalClusterProducer", edm::InputTag("hltParticleFlowClusterHCAL"));
49  descriptions.add(("hltL3MuonSumCaloPFIsolationProducer"), desc);
50 }
51 
53 
55  iEvent.getByToken(recoChargedCandidateProducer_,recochargedcandHandle);
56 
58  iEvent.getByToken (pfEcalClusterProducer_,ecalIsolation);
59 
61  iEvent.getByToken (pfHcalClusterProducer_,hcalIsolation);
62 
63  std::auto_ptr<edm::ValueMap<float> > caloIsoMap( new edm::ValueMap<float> ());
64  std::vector<float> isoFloats(recochargedcandHandle->size(), 0);
65 
66  for (unsigned int iReco = 0; iReco < recochargedcandHandle->size(); iReco++) {
67  reco::RecoChargedCandidateRef candRef(recochargedcandHandle, iReco);
68  reco::RecoChargedCandidateIsolationMap::const_iterator mapiECAL = (*ecalIsolation).find( candRef );
69  float valisoECAL = mapiECAL->val;
70  reco::RecoChargedCandidateIsolationMap::const_iterator mapiHCAL = (*hcalIsolation).find( candRef );
71  float valisoHCAL = mapiHCAL->val;
72  float caloIso = valisoECAL + valisoHCAL;
73  isoFloats[iReco] = caloIso;
74  }
75 
76  edm::ValueMap<float> ::Filler isoFloatFiller(*caloIsoMap);
77  isoFloatFiller.insert(recochargedcandHandle, isoFloats.begin(), isoFloats.end());
78  isoFloatFiller.fill();
79  iEvent.put(caloIsoMap);
80 
81 }
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
virtual void produce(edm::Event &, const edm::EventSetup &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
L3MuonSumCaloPFIsolationProducer(const edm::ParameterSet &)
constructor with config