CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaPFClusterIsolationRemapper.cc
Go to the documentation of this file.
2 
6 
8 
9 template<typename C>
11  emObjectProducer_ (consumes<C>(config.getParameter<edm::InputTag>("candidateProducer"))),
12  newToOldObjectMap_ (consumes<CRefMap>(config.getParameter<edm::InputTag>("newToOldObjectMap"))),
13  isolationMap_ (consumes<FloatMap>(config.getParameter<edm::InputTag>("isolationMap")))
14 {
15  produces<edm::ValueMap<float>>();
16 }
17 
18 template<typename C>
20 {
21 }
22 
23 template<typename C>
25 {
26  edm::Handle<C> emObjectHandle;
27  iEvent.getByToken(emObjectProducer_, emObjectHandle);
28 
29  edm::Handle<CRefMap> objectMapHandle;
30  iEvent.getByToken(newToOldObjectMap_, objectMapHandle);
31  auto& objectMap(*objectMapHandle);
32 
33  edm::Handle<FloatMap> isolationMapHandle;
34  iEvent.getByToken(isolationMap_, isolationMapHandle);
35  auto& isolationMap(*isolationMapHandle);
36 
37  std::vector<float> retV(emObjectHandle->size(), 0.);
38 
39  for (unsigned iO(0); iO != emObjectHandle->size(); ++iO) {
40  CRef ref(emObjectHandle, iO);
41  auto oldRef(objectMap[ref]);
42  retV[iO] = isolationMap[oldRef];
43  }
44 
45  std::auto_ptr<FloatMap> isoMap(new FloatMap());
46  FloatMap::Filler filler(*isoMap);
47 
48  filler.insert(emObjectHandle, retV.begin(), retV.end());
49  filler.fill();
50 
51  iEvent.put(isoMap);
52 }
53 
58 
61 
EgammaPFClusterIsolationRemapper< reco::PhotonCollection > PhotonPFClusterIsolationRemapper
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:52
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
void produce(edm::Event &, const edm::EventSetup &)
EgammaPFClusterIsolationRemapper(const edm::ParameterSet &)
EgammaPFClusterIsolationRemapper< reco::GsfElectronCollection > ElectronPFClusterIsolationRemapper