CMS 3D CMS Logo

PFEGammaToCandidateRemapper.cc
Go to the documentation of this file.
1 
18 
20 public:
21  explicit PFEGammaToCandidateRemapper(const edm::ParameterSet &iConfig);
23 
24  void produce(edm::StreamID iID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override;
25 
26 private:
31 
32  template <typename T>
34  const edm::EDGetTokenT<std::vector<T>> &colltoken,
35  const edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef>>> &oldmaptoken,
37  const std::string &name) const {
39  iEvent.getByToken(colltoken, handle);
40 
42  iEvent.getByToken(oldmaptoken, oldmap);
43 
44  std::vector<std::vector<reco::PFCandidateRef>> refs(handle->size());
45  for (unsigned int i = 0, n = handle->size(); i < n; ++i) {
47  for (reco::PFCandidateRef pfRef : (*oldmap)[egRef]) {
48  refs[i].push_back(pf2pf[pfRef]);
49  }
50  }
51 
52  std::unique_ptr<edm::ValueMap<std::vector<reco::PFCandidateRef>>> out(
53  new edm::ValueMap<std::vector<reco::PFCandidateRef>>());
55  filler.insert(handle, refs.begin(), refs.end());
56  filler.fill();
57  iEvent.put(std::move(out), name);
58  }
59 };
60 
62  : photons_(consumes<std::vector<reco::Photon>>(iConfig.getParameter<edm::InputTag>("photons"))),
63  electrons_(consumes<std::vector<reco::GsfElectron>>(iConfig.getParameter<edm::InputTag>("electrons"))),
64  photon2pf_(
65  consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(iConfig.getParameter<edm::InputTag>("photon2pf"))),
66  electron2pf_(consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(
67  iConfig.getParameter<edm::InputTag>("electron2pf"))),
68  pf2pf_(consumes<edm::ValueMap<reco::PFCandidateRef>>(iConfig.getParameter<edm::InputTag>("pf2pf"))) {
69  produces<edm::ValueMap<std::vector<reco::PFCandidateRef>>>("photons");
70  produces<edm::ValueMap<std::vector<reco::PFCandidateRef>>>("electrons");
71 }
72 
75  iEvent.getByToken(pf2pf_, pf2pf);
76  run<reco::Photon>(iEvent, photons_, photon2pf_, *pf2pf, "photons");
77  run<reco::GsfElectron>(iEvent, electrons_, electron2pf_, *pf2pf, "electrons");
78 }
79 
edm::StreamID
Definition: StreamID.h:30
mps_fire.i
i
Definition: mps_fire.py:355
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
PFCandidate.h
patZpeak.handle
handle
Definition: patZpeak.py:23
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
PFEGammaToCandidateRemapper::PFEGammaToCandidateRemapper
PFEGammaToCandidateRemapper(const edm::ParameterSet &iConfig)
Definition: PFEGammaToCandidateRemapper.cc:61
PFEGammaToCandidateRemapper::electrons_
edm::EDGetTokenT< std::vector< reco::GsfElectron > > electrons_
Definition: PFEGammaToCandidateRemapper.cc:28
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref
Definition: AssociativeIterator.h:58
PFEGammaToCandidateRemapper
Definition: PFEGammaToCandidateRemapper.cc:19
MakerMacros.h
Photon.h
PFEGammaToCandidateRemapper::pf2pf_
edm::EDGetTokenT< edm::ValueMap< reco::PFCandidateRef > > pf2pf_
Definition: PFEGammaToCandidateRemapper.cc:30
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
l1t::PFCandidateRef
edm::Ref< l1t::PFCandidateCollection > PFCandidateRef
Definition: PFCandidate.h:58
PFEGammaToCandidateRemapper::run
void run(edm::Event &iEvent, const edm::EDGetTokenT< std::vector< T >> &colltoken, const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef >>> &oldmaptoken, const edm::ValueMap< reco::PFCandidateRef > &pf2pf, const std::string &name) const
Definition: PFEGammaToCandidateRemapper.cc:33
packedPFCandidateRefMixer_cfi.pf2pf
pf2pf
Definition: packedPFCandidateRefMixer_cfi.py:5
edm::global::EDProducer
Definition: EDProducer.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
PFEGammaToCandidateRemapper::~PFEGammaToCandidateRemapper
~PFEGammaToCandidateRemapper() override
Definition: PFEGammaToCandidateRemapper.cc:22
PFEGammaToCandidateRemapper::produce
void produce(edm::StreamID iID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition: PFEGammaToCandidateRemapper.cc:73
Photon
Definition: Photon.py:1
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
ValueMap.h
Electron.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
PFEGammaToCandidateRemapper::photons_
edm::EDGetTokenT< std::vector< reco::Photon > > photons_
Definition: PFEGammaToCandidateRemapper.cc:27
Frameworkfwd.h
edm::ValueMap
Definition: ValueMap.h:107
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
PFEGammaToCandidateRemapper::photon2pf_
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > photon2pf_
Definition: PFEGammaToCandidateRemapper.cc:29
ParameterSet.h
EDProducer.h
PFEGammaToCandidateRemapper::electron2pf_
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > electron2pf_
Definition: PFEGammaToCandidateRemapper.cc:29
edm::Event
Definition: Event.h:73