CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PhotonIDExternalProducerRemapper.cc
Go to the documentation of this file.
2 
6 
8 
10  emObjectProducer_ (consumes<reco::PhotonCollection >(config.getParameter<edm::InputTag>("candidateProducer"))),
11  newToOldObjectMap_ (consumes<CRefMap>(config.getParameter<edm::InputTag>("newToOldObjectMap"))),
12  idMap_ (consumes<edm::ValueMap<bool> >(config.getParameter<edm::InputTag>("idMap")))
13 {
14  produces<edm::ValueMap<bool> >();
15 }
16 
18 {
19 }
20 
22 {
24  iEvent.getByToken(emObjectProducer_, emObjectHandle);
25 
26  edm::Handle<CRefMap> objectMapHandle;
27  iEvent.getByToken(newToOldObjectMap_, objectMapHandle);
28  auto& objectMap(*objectMapHandle);
29 
30  edm::Handle<edm::ValueMap<bool> > idMapHandle;
31  iEvent.getByToken(idMap_, idMapHandle);
32  auto& idMap(*idMapHandle);
33 
34  std::vector<bool> retV(emObjectHandle->size(), 0.);
35 
36  for (unsigned iO(0); iO != emObjectHandle->size(); ++iO) {
37  CRef ref(emObjectHandle, iO);
38  auto oldRef(objectMap[ref]);
39  retV[iO] = idMap[oldRef];
40  }
41 
42  std::auto_ptr<edm::ValueMap<bool> > isoMap(new edm::ValueMap<bool>);
43  edm::ValueMap<bool>::Filler filler(*isoMap);
44 
45  filler.insert(emObjectHandle, retV.begin(), retV.end());
46  filler.fill();
47 
48  iEvent.put(isoMap);
49 }
50 
51 
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
edm::EDGetTokenT< edm::ValueMap< bool > > idMap_
edm::EDGetTokenT< reco::PhotonCollection > emObjectProducer_
void produce(edm::Event &, const edm::EventSetup &)
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
PhotonIDExternalProducerRemapper(const edm::ParameterSet &)