CMS 3D CMS Logo

PFEGammaToCandidate.cc
Go to the documentation of this file.
1 
22 
24 public:
25  explicit PFEGammaToCandidate(const edm::ParameterSet &iConfig);
26  ~PFEGammaToCandidate() override = default;
27 
28  void produce(edm::StreamID iID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override;
29  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
30 
31 private:
35 
36  template <typename T>
38  const edm::EDGetTokenT<edm::View<T>> &colltoken,
39  const edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef>>> &oldmaptoken,
40  const std::string &name) const {
41  auto const &coll = iEvent.get(colltoken);
42 
44  iEvent.getByToken(oldmaptoken, oldmap);
45 
46  auto result = std::make_unique<std::vector<reco::VertexCompositePtrCandidate>>();
47  for (auto const &obj : coll) {
49  for (const reco::PFCandidateRef &pfRef : (*oldmap)[obj.originalObjectRef()])
50  result->back().addDaughter(refToPtr(pfRef));
51  }
52  iEvent.put(std::move(result), name);
53  }
54 };
55 
57  : photons_(consumes<edm::View<pat::Photon>>(iConfig.getParameter<edm::InputTag>("photons"))),
58  electrons_(consumes<edm::View<pat::Electron>>(iConfig.getParameter<edm::InputTag>("electrons"))),
59  photon2pf_(
60  consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(iConfig.getParameter<edm::InputTag>("photon2pf"))),
61  electron2pf_(consumes<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(
62  iConfig.getParameter<edm::InputTag>("electron2pf"))) {
63  produces<std::vector<reco::VertexCompositePtrCandidate>>("photons");
64  produces<std::vector<reco::VertexCompositePtrCandidate>>("electrons");
65 }
66 
68  run<pat::Photon>(iEvent, photons_, photon2pf_, "photons");
69  run<pat::Electron>(iEvent, electrons_, electron2pf_, "electrons");
70 }
71 
74  desc.add<edm::InputTag>("photons", edm::InputTag("selectedPatPhotons"));
75  desc.add<edm::InputTag>("electrons", edm::InputTag("selectedPatElectrons"));
76  desc.add<edm::InputTag>("photon2pf", edm::InputTag("particleBasedIsolation", "gedPhotons"));
77  desc.add<edm::InputTag>("electron2pf", edm::InputTag("particleBasedIsolation", "gedGsfElectrons"));
78  descriptions.addWithDefaultLabel(desc);
79 }
80 
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
PFEGammaToCandidate::~PFEGammaToCandidate
~PFEGammaToCandidate() override=default
sistrip::View
View
Definition: ConstantsForView.h:26
PFCandidate.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
Electron
Definition: Electron.py:1
edm
HLT enums.
Definition: AlignableModifier.h:19
PFEGammaToCandidate::electron2pf_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > electron2pf_
Definition: PFEGammaToCandidate.cc:34
Photon.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
edm::Handle
Definition: AssociativeIterator.h:50
reco::VertexCompositePtrCandidate
Definition: VertexCompositePtrCandidate.h:16
edm::Ref< PFCandidateCollection >
edm::refToPtr
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
MakerMacros.h
PFEGammaToCandidate::photons_
const edm::EDGetTokenT< edm::View< pat::Photon > > photons_
Definition: PFEGammaToCandidate.cc:32
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
l1t::PFCandidateRef
edm::Ref< l1t::PFCandidateCollection > PFCandidateRef
Definition: PFCandidate.h:58
PtrVector.h
VertexCompositePtrCandidate.h
ParameterSetDescription.h
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
PFEGammaToCandidate::produce
void produce(edm::StreamID iID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition: PFEGammaToCandidate.cc:67
edm::View
Definition: CaloClusterFwd.h:14
PFEGammaToCandidate::photon2pf_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > photon2pf_
Definition: PFEGammaToCandidate.cc:34
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
Photon
Definition: Photon.py:1
iEvent
int iEvent
Definition: GenABIO.cc:224
RefToPtr.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:58
pat
Definition: HeavyIon.h:7
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ValueMap.h
PFEGammaToCandidate
Definition: PFEGammaToCandidate.cc:23
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
PFEGammaToCandidate::PFEGammaToCandidate
PFEGammaToCandidate(const edm::ParameterSet &iConfig)
Definition: PFEGammaToCandidate.cc:56
edm::ValueMap
Definition: ValueMap.h:107
PFEGammaToCandidate::run
void run(edm::Event &iEvent, const edm::EDGetTokenT< edm::View< T >> &colltoken, const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef >>> &oldmaptoken, const std::string &name) const
Definition: PFEGammaToCandidate.cc:37
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
Electron.h
mps_fire.result
result
Definition: mps_fire.py:311
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
PFEGammaToCandidate::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PFEGammaToCandidate.cc:72
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
PFEGammaToCandidate::electrons_
const edm::EDGetTokenT< edm::View< pat::Electron > > electrons_
Definition: PFEGammaToCandidate.cc:33