CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
EGExtraInfoModifierFromValueMaps< MapType, OutputType > Class Template Reference

#include <EGExtraInfoModifierFromValueMaps.h>

Inheritance diagram for EGExtraInfoModifierFromValueMaps< MapType, OutputType >:
ModifyObjectValueBase

Classes

struct  electron_config
 
struct  photon_config
 

Public Types

using ValMapToken = edm::EDGetTokenT< edm::ValueMap< MapType > >
 
using ValueMaps = std::unordered_map< std::string, ValMapToken >
 

Public Member Functions

 EGExtraInfoModifierFromValueMaps (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
void modifyObject (pat::Electron &) const final
 
void modifyObject (pat::Photon &) const final
 
void setEvent (const edm::Event &) final
 
- Public Member Functions inherited from ModifyObjectValueBase
virtual void modifyObject (pat::Jet &) const
 
virtual void modifyObject (pat::Muon &) const
 
virtual void modifyObject (pat::Tau &) const
 
virtual void modifyObject (reco::BaseTau &) const
 
virtual void modifyObject (reco::GsfElectron &) const
 
virtual void modifyObject (reco::Jet &) const
 
virtual void modifyObject (reco::Muon &) const
 
virtual void modifyObject (reco::Photon &) const
 
 ModifyObjectValueBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual void setEventContent (const edm::EventSetup &)
 
virtual ~ModifyObjectValueBase ()
 

Private Attributes

electron_config e_conf
 
unsigned ele_idx
 
std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType > > > ele_vmaps
 
std::vector< edm::Ptr< reco::GsfElectron > > eles_by_oop
 
bool overrideExistingValues_
 
photon_config ph_conf
 
unsigned pho_idx
 
std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType > > > pho_vmaps
 
std::vector< edm::Ptr< reco::Photon > > phos_by_oop
 

Detailed Description

template<typename MapType, typename OutputType = MapType>
class EGExtraInfoModifierFromValueMaps< MapType, OutputType >

Definition at line 81 of file EGExtraInfoModifierFromValueMaps.h.

Member Typedef Documentation

◆ ValMapToken

template<typename MapType , typename OutputType = MapType>
using EGExtraInfoModifierFromValueMaps< MapType, OutputType >::ValMapToken = edm::EDGetTokenT<edm::ValueMap<MapType> >

Definition at line 83 of file EGExtraInfoModifierFromValueMaps.h.

◆ ValueMaps

template<typename MapType , typename OutputType = MapType>
using EGExtraInfoModifierFromValueMaps< MapType, OutputType >::ValueMaps = std::unordered_map<std::string, ValMapToken>

Definition at line 84 of file EGExtraInfoModifierFromValueMaps.h.

Constructor & Destructor Documentation

◆ EGExtraInfoModifierFromValueMaps()

template<typename MapType , typename OutputType >
EGExtraInfoModifierFromValueMaps< MapType, OutputType >::EGExtraInfoModifierFromValueMaps ( const edm::ParameterSet conf,
edm::ConsumesCollector cc 
)

Definition at line 115 of file EGExtraInfoModifierFromValueMaps.h.

117  : ModifyObjectValueBase(conf) {
118  constexpr char electronSrc[] = "electronSrc";
119  constexpr char photonSrc[] = "photonSrc";
121  conf.exists("overrideExistingValues") ? conf.getParameter<bool>("overrideExistingValues") : false;
122  if (conf.exists("electron_config")) {
123  const edm::ParameterSet& electrons = conf.getParameter<edm::ParameterSet>("electron_config");
124  if (electrons.exists(electronSrc))
127 
128  const std::vector<std::string> parameters = electrons.getParameterNames();
129  for (const std::string& name : parameters) {
130  if (std::string(electronSrc) == name)
131  continue;
132  if (electrons.existsAs<edm::InputTag>(name)) {
134  }
135  }
136  }
137  if (conf.exists("photon_config")) {
138  const edm::ParameterSet& photons = conf.getParameter<edm::ParameterSet>("photon_config");
139  if (photons.exists(photonSrc))
141  const std::vector<std::string> parameters = photons.getParameterNames();
142  for (const std::string& name : parameters) {
143  if (std::string(photonSrc) == name)
144  continue;
145  if (photons.existsAs<edm::InputTag>(name)) {
147  }
148  }
149  }
150  ele_idx = pho_idx = 0;
151 }

References EGExtraInfoModifierFromValueMaps< MapType, OutputType >::e_conf, EGExtraInfoModifierFromValueMaps< MapType, OutputType >::ele_idx, pwdgSkimBPark_cfi::electrons, B2GDQM_cfi::electronSrc, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), ModifyObjectValueBase::name(), EGExtraInfoModifierFromValueMaps< MapType, OutputType >::overrideExistingValues_, EGExtraInfoModifierFromValueMaps< MapType, OutputType >::ph_conf, EGExtraInfoModifierFromValueMaps< MapType, OutputType >::pho_idx, BPHMonitor_cfi::photons, PatBasicAnalyzer_cfi::photonSrc, AlCaHLTBitMon_QueryRunRegistry::string, EGExtraInfoModifierFromValueMaps< MapType, OutputType >::electron_config::tok_electron_src, EGExtraInfoModifierFromValueMaps< MapType, OutputType >::photon_config::tok_photon_src, EGExtraInfoModifierFromValueMaps< MapType, OutputType >::electron_config::tok_valuemaps, and EGExtraInfoModifierFromValueMaps< MapType, OutputType >::photon_config::tok_valuemaps.

Member Function Documentation

◆ modifyObject() [1/2]

template<typename MapType , typename OutputType >
void EGExtraInfoModifierFromValueMaps< MapType, OutputType >::modifyObject ( pat::Electron ele) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 194 of file EGExtraInfoModifierFromValueMaps.h.

194  {
195  // we encounter two cases here, either we are running AOD -> MINIAOD
196  // and the value maps are to the reducedEG object, can use original object ptr
197  // or we are running MINIAOD->MINIAOD and we need to fetch the pat objects to reference
200  ptr = eles_by_oop.at(ele_idx);
201  //now we go through and modify the objects using the valuemaps we read in
204  ++ele_idx;
205 }

References EGXtraModFromVMObjFiller< OutputType >::addValuesToObject(), and pat::PATObject< ObjectType >::originalObjectRef().

◆ modifyObject() [2/2]

template<typename MapType , typename OutputType >
void EGExtraInfoModifierFromValueMaps< MapType, OutputType >::modifyObject ( pat::Photon pho) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 208 of file EGExtraInfoModifierFromValueMaps.h.

208  {
209  // we encounter two cases here, either we are running AOD -> MINIAOD
210  // and the value maps are to the reducedEG object, can use original object ptr
211  // or we are running MINIAOD->MINIAOD and we need to fetch the pat objects to reference
214  ptr = phos_by_oop.at(pho_idx);
215  //now we go through and modify the objects using the valuemaps we read in
218 
219  ++pho_idx;
220 }

References EGXtraModFromVMObjFiller< OutputType >::addValuesToObject(), and pat::PATObject< ObjectType >::originalObjectRef().

◆ setEvent()

template<typename MapType , typename OutputType >
void EGExtraInfoModifierFromValueMaps< MapType, OutputType >::setEvent ( const edm::Event evt)
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 154 of file EGExtraInfoModifierFromValueMaps.h.

154  {
155  eles_by_oop.clear();
156  phos_by_oop.clear();
157  ele_vmaps.clear();
158  pho_vmaps.clear();
159 
160  ele_idx = pho_idx = 0;
161 
165 
166  eles_by_oop.resize(eles->size());
167  std::copy(eles->ptrs().begin(), eles->ptrs().end(), eles_by_oop.begin());
168  }
169 
170  for (auto const& itr : e_conf.tok_valuemaps)
171  evt.getByToken(itr.second, ele_vmaps[itr.second.index()]);
172 
175  evt.getByToken(ph_conf.tok_photon_src, phos);
176 
177  phos_by_oop.resize(phos->size());
178  std::copy(phos->ptrs().begin(), phos->ptrs().end(), phos_by_oop.begin());
179  }
180 
181  for (auto const& itr : ph_conf.tok_valuemaps)
182  evt.getByToken(itr.second, pho_vmaps[itr.second.index()]);
183 }

References filterCSVwithJSON::copy, and edm::Event::getByToken().

Member Data Documentation

◆ e_conf

template<typename MapType , typename OutputType = MapType>
electron_config EGExtraInfoModifierFromValueMaps< MapType, OutputType >::e_conf
private

◆ ele_idx

template<typename MapType , typename OutputType = MapType>
unsigned EGExtraInfoModifierFromValueMaps< MapType, OutputType >::ele_idx
mutableprivate

◆ ele_vmaps

template<typename MapType , typename OutputType = MapType>
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<MapType> > > EGExtraInfoModifierFromValueMaps< MapType, OutputType >::ele_vmaps
private

Definition at line 106 of file EGExtraInfoModifierFromValueMaps.h.

◆ eles_by_oop

template<typename MapType , typename OutputType = MapType>
std::vector<edm::Ptr<reco::GsfElectron> > EGExtraInfoModifierFromValueMaps< MapType, OutputType >::eles_by_oop
private

Definition at line 105 of file EGExtraInfoModifierFromValueMaps.h.

◆ overrideExistingValues_

template<typename MapType , typename OutputType = MapType>
bool EGExtraInfoModifierFromValueMaps< MapType, OutputType >::overrideExistingValues_
private

◆ ph_conf

template<typename MapType , typename OutputType = MapType>
photon_config EGExtraInfoModifierFromValueMaps< MapType, OutputType >::ph_conf
private

◆ pho_idx

template<typename MapType , typename OutputType = MapType>
unsigned EGExtraInfoModifierFromValueMaps< MapType, OutputType >::pho_idx
mutableprivate

◆ pho_vmaps

template<typename MapType , typename OutputType = MapType>
std::unordered_map<unsigned, edm::Handle<edm::ValueMap<MapType> > > EGExtraInfoModifierFromValueMaps< MapType, OutputType >::pho_vmaps
private

Definition at line 108 of file EGExtraInfoModifierFromValueMaps.h.

◆ phos_by_oop

template<typename MapType , typename OutputType = MapType>
std::vector<edm::Ptr<reco::Photon> > EGExtraInfoModifierFromValueMaps< MapType, OutputType >::phos_by_oop
private

Definition at line 107 of file EGExtraInfoModifierFromValueMaps.h.

EGExtraInfoModifierFromValueMaps::electron_config::tok_valuemaps
ValueMaps tok_valuemaps
Definition: EGExtraInfoModifierFromValueMaps.h:87
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
EGExtraInfoModifierFromValueMaps::photon_config::tok_photon_src
edm::EDGetTokenT< edm::View< pat::Photon > > tok_photon_src
Definition: EGExtraInfoModifierFromValueMaps.h:91
EGExtraInfoModifierFromValueMaps::ele_vmaps
std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType > > > ele_vmaps
Definition: EGExtraInfoModifierFromValueMaps.h:106
edm::Handle
Definition: AssociativeIterator.h:50
ModifyObjectValueBase::ModifyObjectValueBase
ModifyObjectValueBase(const edm::ParameterSet &conf)
Definition: ModifyObjectValueBase.h:20
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
ModifyObjectValueBase::name
const std::string & name() const
Definition: ModifyObjectValueBase.h:59
edm::EDGetTokenT::isUninitialized
bool isUninitialized() const
Definition: EDGetToken.h:70
EGExtraInfoModifierFromValueMaps::phos_by_oop
std::vector< edm::Ptr< reco::Photon > > phos_by_oop
Definition: EGExtraInfoModifierFromValueMaps.h:107
EGExtraInfoModifierFromValueMaps::photon_config::tok_valuemaps
ValueMaps tok_valuemaps
Definition: EGExtraInfoModifierFromValueMaps.h:92
EGExtraInfoModifierFromValueMaps::pho_idx
unsigned pho_idx
Definition: EGExtraInfoModifierFromValueMaps.h:109
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::PATObject::originalObjectRef
const edm::Ptr< reco::Candidate > & originalObjectRef() const
reference to original object. Returns a null reference if not available
Definition: PATObject.h:542
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
edm::View
Definition: CaloClusterFwd.h:14
edm::ParameterSet
Definition: ParameterSet.h:36
EGExtraInfoModifierFromValueMaps::overrideExistingValues_
bool overrideExistingValues_
Definition: EGExtraInfoModifierFromValueMaps.h:111
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
EGExtraInfoModifierFromValueMaps::e_conf
electron_config e_conf
Definition: EGExtraInfoModifierFromValueMaps.h:103
cc
edm::Ptr< reco::Candidate >
B2GDQM_cfi.electronSrc
electronSrc
Definition: B2GDQM_cfi.py:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EGExtraInfoModifierFromValueMaps::pho_vmaps
std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType > > > pho_vmaps
Definition: EGExtraInfoModifierFromValueMaps.h:108
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
edm::ValueMap
Definition: ValueMap.h:107
EGExtraInfoModifierFromValueMaps::electron_config::tok_electron_src
edm::EDGetTokenT< edm::View< pat::Electron > > tok_electron_src
Definition: EGExtraInfoModifierFromValueMaps.h:86
EGExtraInfoModifierFromValueMaps::eles_by_oop
std::vector< edm::Ptr< reco::GsfElectron > > eles_by_oop
Definition: EGExtraInfoModifierFromValueMaps.h:105
EGExtraInfoModifierFromValueMaps::ph_conf
photon_config ph_conf
Definition: EGExtraInfoModifierFromValueMaps.h:104
PatBasicAnalyzer_cfi.photonSrc
photonSrc
Definition: PatBasicAnalyzer_cfi.py:4
EGExtraInfoModifierFromValueMaps::ele_idx
unsigned ele_idx
Definition: EGExtraInfoModifierFromValueMaps.h:109
edm::InputTag
Definition: InputTag.h:15
EGXtraModFromVMObjFiller::addValuesToObject
static void addValuesToObject(ObjType &obj, const edm::Ptr< reco::Candidate > &ptr, const std::unordered_map< std::string, edm::EDGetTokenT< edm::ValueMap< MapType >>> &vmaps_token, const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType >>> &vmaps, bool overrideExistingValues)
Definition: EGExtraInfoModifierFromValueMaps.h:68