test
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
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  std::auto_ptr<edm::ValueMap<float> > caloIsoMap( new 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(caloIsoMap);
79 
80 }
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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:121
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
L3MuonSumCaloPFIsolationProducer(const edm::ParameterSet &)
constructor with config
virtual void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override