CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
PFEGFootprintGSFixLinker Class Reference

#include <PFEGFootprintGSFixLinker.h>

Inheritance diagram for PFEGFootprintGSFixLinker:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

template<typename T >
edm::Handle< TgetHandle (edm::Event const &_event, edm::EDGetTokenT< T > const &token, std::string const &name)
 
template<typename T >
void getToken (edm::EDGetTokenT< T > &token, edm::ParameterSet const &pset, std::string const &label)
 
 PFEGFootprintGSFixLinker (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFEGFootprintGSFixLinker ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef edm::ValueMap
< reco::GsfElectronRef
ElectronRefMap
 
typedef std::vector
< reco::PFCandidateRef
Footprint
 
typedef edm::ValueMap< FootprintFootprintMap
 
typedef edm::ValueMap
< reco::PhotonRef
PhotonRefMap
 

Private Attributes

edm::EDGetTokenT< FootprintMapelectronFootprintMapToken_
 
edm::EDGetTokenT< ElectronRefMapelectronMapToken_
 
std::string electronsMapName_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
newCandidatesToken_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
newElectronsToken_
 
edm::EDGetTokenT
< reco::PhotonCollection
newPhotonsToken_
 
edm::EDGetTokenT< FootprintMapphotonFootprintMapToken_
 
edm::EDGetTokenT< PhotonRefMapphotonMapToken_
 
std::string photonsMapName_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Relink GS-fixed e/gamma objects

Author
Y. Iiyama (MIT)

Definition at line 22 of file PFEGFootprintGSFixLinker.h.

Member Typedef Documentation

Definition at line 47 of file PFEGFootprintGSFixLinker.h.

Definition at line 49 of file PFEGFootprintGSFixLinker.h.

Definition at line 50 of file PFEGFootprintGSFixLinker.h.

Definition at line 48 of file PFEGFootprintGSFixLinker.h.

Constructor & Destructor Documentation

PFEGFootprintGSFixLinker::PFEGFootprintGSFixLinker ( const edm::ParameterSet _config)
explicit

Definition at line 18 of file PFEGFootprintGSFixLinker.cc.

References electronFootprintMapToken_, electronMapToken_, electronsMapName_, getToken(), newCandidatesToken_, newElectronsToken_, newPhotonsToken_, photonFootprintMapToken_, photonMapToken_, and photonsMapName_.

18  :
19  electronsMapName_(_config.getParameter<std::string>("ValueMapElectrons")),
20  photonsMapName_(_config.getParameter<std::string>("ValueMapPhotons"))
21 {
22  getToken(newCandidatesToken_, _config, "PFCandidate");
23  getToken(newElectronsToken_, _config, "GsfElectrons");
24  getToken(newPhotonsToken_, _config, "Photons");
25  getToken(electronMapToken_, _config, "GsfElectrons");
26  getToken(photonMapToken_, _config, "Photons");
27  getToken(electronFootprintMapToken_, _config, "GsfElectronsFootprint");
28  getToken(photonFootprintMapToken_, _config, "PhotonsFootprint");
29 
30  // e/g collections to footprint PFs
31  produces<FootprintMap>(electronsMapName_);
32  produces<FootprintMap>(photonsMapName_);
33 }
edm::EDGetTokenT< reco::PhotonCollection > newPhotonsToken_
T getParameter(std::string const &) const
edm::EDGetTokenT< FootprintMap > photonFootprintMapToken_
edm::EDGetTokenT< ElectronRefMap > electronMapToken_
edm::EDGetTokenT< PhotonRefMap > photonMapToken_
edm::EDGetTokenT< reco::GsfElectronCollection > newElectronsToken_
edm::EDGetTokenT< FootprintMap > electronFootprintMapToken_
void getToken(edm::EDGetTokenT< T > &token, edm::ParameterSet const &pset, std::string const &label)
edm::EDGetTokenT< reco::PFCandidateCollection > newCandidatesToken_
PFEGFootprintGSFixLinker::~PFEGFootprintGSFixLinker ( )

Definition at line 35 of file PFEGFootprintGSFixLinker.cc.

36 {
37 }

Member Function Documentation

template<typename T >
edm::Handle<T> PFEGFootprintGSFixLinker::getHandle ( edm::Event const &  _event,
edm::EDGetTokenT< T > const &  token,
std::string const &  name 
)
inline

Definition at line 37 of file PFEGFootprintGSFixLinker.h.

References edm::Event::getByToken(), patZpeak::handle, and mergeVDriftHistosByStation::name.

Referenced by produce().

38  {
40  if (!_event.getByToken(token, handle))
41  throw cms::Exception("ProductNotFound") << name;
42 
43  return handle;
44  }
tuple handle
Definition: patZpeak.py:22
template<typename T >
void PFEGFootprintGSFixLinker::getToken ( edm::EDGetTokenT< T > &  token,
edm::ParameterSet const &  pset,
std::string const &  label 
)
inline

Definition at line 31 of file PFEGFootprintGSFixLinker.h.

References edm::ParameterSet::getParameter(), and diffTwoXMLs::label.

Referenced by PFEGFootprintGSFixLinker().

32  {
33  token = consumes<T>(pset.getParameter<edm::InputTag>(label));
34  }
void PFEGFootprintGSFixLinker::produce ( edm::Event _event,
const edm::EventSetup  
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 40 of file PFEGFootprintGSFixLinker.cc.

References electronFootprintMapToken_, electronMapToken_, electronsMapName_, edm::helper::Filler< Map >::fill(), getHandle(), edm::helper::Filler< Map >::insert(), newCandidatesToken_, newElectronsToken_, newPhotonsToken_, photonFootprintMapToken_, photonMapToken_, photonsMapName_, and edm::Event::put().

41 {
42  auto&& newCandidatesHandle(getHandle(_event, newCandidatesToken_, "PFCandidate"));
43  auto&& newElectronsHandle(getHandle(_event, newElectronsToken_, "GsfElectrons"));
44  auto& electronMap(*getHandle(_event, electronMapToken_, "GsfElectronsMap"));
45  auto&& newPhotonsHandle(getHandle(_event, newPhotonsToken_, "Photons"));
46  auto& photonMap(*getHandle(_event, photonMapToken_, "PhotonsMap"));
47  auto& electronFootprintMap(*getHandle(_event, electronFootprintMapToken_, "GsfElectronsFootprint"));
48  auto& photonFootprintMap(*getHandle(_event, photonFootprintMapToken_, "PhotonsFootprint"));
49 
50  std::vector<Footprint> electronFootprints;
51 
52  for (unsigned iE(0); iE != newElectronsHandle->size(); ++iE) {
53  electronFootprints.emplace_back();
54  auto& footprint(electronFootprints.back());
55 
56  reco::GsfElectronRef ref(newElectronsHandle, iE);
57  auto& oldEleRef(electronMap[ref]);
58  auto& oldFootprint(electronFootprintMap[oldEleRef]);
59  // relying on PFGSFixLinker producing PF candidates in the same order
60  for (auto& pfref : oldFootprint)
61  footprint.emplace_back(newCandidatesHandle, pfref.key());
62  }
63 
64  std::auto_ptr<FootprintMap> pEleFPMap(new FootprintMap);
65  FootprintMap::Filler eleFPMapFiller(*pEleFPMap);
66  eleFPMapFiller.insert(newElectronsHandle, electronFootprints.begin(), electronFootprints.end());
67  eleFPMapFiller.fill();
68  _event.put(pEleFPMap, electronsMapName_);
69 
70  std::vector<Footprint> photonFootprints;
71 
72  for (unsigned iE(0); iE != newPhotonsHandle->size(); ++iE) {
73  photonFootprints.emplace_back();
74  auto& footprint(photonFootprints.back());
75 
76  reco::PhotonRef ref(newPhotonsHandle, iE);
77  auto& oldPhoRef(photonMap[ref]);
78  auto& oldFootprint(photonFootprintMap[oldPhoRef]);
79  // relying on PFGSFixLinker producing PF candidates in the same order
80  for (auto& pfref : oldFootprint)
81  footprint.emplace_back(newCandidatesHandle, pfref.key());
82  }
83 
84  std::auto_ptr<FootprintMap> pPhoFPMap(new FootprintMap);
85  FootprintMap::Filler phoFPMapFiller(*pPhoFPMap);
86  phoFPMapFiller.insert(newPhotonsHandle, photonFootprints.begin(), photonFootprints.end());
87  phoFPMapFiller.fill();
88  _event.put(pPhoFPMap, photonsMapName_);
89 }
edm::EDGetTokenT< reco::PhotonCollection > newPhotonsToken_
edm::Handle< T > getHandle(edm::Event const &_event, edm::EDGetTokenT< T > const &token, std::string const &name)
edm::EDGetTokenT< FootprintMap > photonFootprintMapToken_
edm::EDGetTokenT< ElectronRefMap > electronMapToken_
edm::EDGetTokenT< PhotonRefMap > photonMapToken_
edm::EDGetTokenT< reco::GsfElectronCollection > newElectronsToken_
edm::EDGetTokenT< FootprintMap > electronFootprintMapToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
edm::EDGetTokenT< reco::PFCandidateCollection > newCandidatesToken_
edm::ValueMap< Footprint > FootprintMap

Member Data Documentation

edm::EDGetTokenT<FootprintMap> PFEGFootprintGSFixLinker::electronFootprintMapToken_
private

Definition at line 59 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().

edm::EDGetTokenT<ElectronRefMap> PFEGFootprintGSFixLinker::electronMapToken_
private

Definition at line 56 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().

std::string PFEGFootprintGSFixLinker::electronsMapName_
private

Definition at line 62 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().

edm::EDGetTokenT<reco::PFCandidateCollection> PFEGFootprintGSFixLinker::newCandidatesToken_
private

Definition at line 52 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().

edm::EDGetTokenT<reco::GsfElectronCollection> PFEGFootprintGSFixLinker::newElectronsToken_
private

Definition at line 53 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().

edm::EDGetTokenT<reco::PhotonCollection> PFEGFootprintGSFixLinker::newPhotonsToken_
private

Definition at line 54 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().

edm::EDGetTokenT<FootprintMap> PFEGFootprintGSFixLinker::photonFootprintMapToken_
private

Definition at line 60 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().

edm::EDGetTokenT<PhotonRefMap> PFEGFootprintGSFixLinker::photonMapToken_
private

Definition at line 57 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().

std::string PFEGFootprintGSFixLinker::photonsMapName_
private

Definition at line 63 of file PFEGFootprintGSFixLinker.h.

Referenced by PFEGFootprintGSFixLinker(), and produce().