CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
EGXtraModFromVMObjFiller< OutputType > Class Template Reference

#include <EGExtraInfoModifierFromValueMaps.h>

Public Member Functions

template<>
void addValuesToObject (pat::Electron &obj, const edm::Ptr< reco::Candidate > &ptr, const std::unordered_map< std::string, edm::EDGetTokenT< edm::ValueMap< float >>> &vmaps_token, const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< float >>> &vmaps, bool overrideExistingValues)
 
template<>
void addValuesToObject (pat::Photon &obj, const edm::Ptr< reco::Candidate > &ptr, const std::unordered_map< std::string, edm::EDGetTokenT< edm::ValueMap< float >>> &vmaps_token, const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< float >>> &vmaps, bool overrideExistingValues)
 
template<>
void addValueToObject (ObjType &obj, const edm::Ptr< reco::Candidate > &ptr, const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType >>> &vmaps, const std::pair< const std::string, edm::EDGetTokenT< edm::ValueMap< MapType >>> &val_map, bool overrideExistingValues)
 
template<>
void addValueToObject (ObjType &obj, const edm::Ptr< reco::Candidate > &ptr, const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType >>> &vmaps, const std::pair< const std::string, edm::EDGetTokenT< edm::ValueMap< MapType >>> &val_map, bool overrideExistingValues)
 
 EGXtraModFromVMObjFiller ()=delete
 
 ~EGXtraModFromVMObjFiller ()=delete
 

Static Public Member Functions

template<typename ObjType , typename MapType >
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)
 
template<typename ObjType , typename MapType >
static void addValueToObject (ObjType &obj, const edm::Ptr< reco::Candidate > &ptr, const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType >>> &vmaps, const std::pair< const std::string, edm::EDGetTokenT< edm::ValueMap< MapType >>> &val_map, bool overrideExistingValues)
 

Detailed Description

template<typename OutputType>
class EGXtraModFromVMObjFiller< OutputType >

Definition at line 54 of file EGExtraInfoModifierFromValueMaps.h.

Constructor & Destructor Documentation

◆ EGXtraModFromVMObjFiller()

template<typename OutputType >
EGXtraModFromVMObjFiller< OutputType >::EGXtraModFromVMObjFiller ( )
delete

◆ ~EGXtraModFromVMObjFiller()

template<typename OutputType >
EGXtraModFromVMObjFiller< OutputType >::~EGXtraModFromVMObjFiller ( )
delete

Member Function Documentation

◆ addValuesToObject() [1/3]

template<typename OutputType >
template<typename ObjType , typename MapType >
static void EGXtraModFromVMObjFiller< OutputType >::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 
)
inlinestatic

Definition at line 68 of file EGExtraInfoModifierFromValueMaps.h.

73  {
74  for (auto itr = vmaps_token.begin(); itr != vmaps_token.end(); ++itr) {
75  addValueToObject(obj, ptr, vmaps, *itr, overrideExistingValues);
76  }
77  }

References EGXtraModFromVMObjFiller< OutputType >::addValueToObject(), and getGTfromDQMFile::obj.

Referenced by EGExtraInfoModifierFromValueMaps< MapType, OutputType >::modifyObject().

◆ addValuesToObject() [2/3]

template<>
void EGXtraModFromVMObjFiller< egmodifier::EGID >::addValuesToObject ( pat::Electron obj,
const edm::Ptr< reco::Candidate > &  ptr,
const std::unordered_map< std::string, edm::EDGetTokenT< edm::ValueMap< float >>> &  vmaps_token,
const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< float >>> &  vmaps,
bool  overrideExistingValues 
)

Definition at line 284 of file EGExtraInfoModifierFromValueMaps.h.

289  {
290  std::vector<std::pair<std::string, float>> ids;
291  for (auto itr = vmaps_token.begin(); itr != vmaps_token.end(); ++itr) {
292  float idVal(0);
293  assignValue(ptr, itr->second, vmaps, idVal);
294  ids.push_back({itr->first, idVal});
295  }
296  std::sort(ids.begin(), ids.end(), [](auto& lhs, auto& rhs) { return lhs.first < rhs.first; });
297  obj.setElectronIDs(ids);
298 }

References getGTfromDQMFile::obj.

◆ addValuesToObject() [3/3]

template<>
void EGXtraModFromVMObjFiller< egmodifier::EGID >::addValuesToObject ( pat::Photon obj,
const edm::Ptr< reco::Candidate > &  ptr,
const std::unordered_map< std::string, edm::EDGetTokenT< edm::ValueMap< float >>> &  vmaps_token,
const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< float >>> &  vmaps,
bool  overrideExistingValues 
)

Definition at line 302 of file EGExtraInfoModifierFromValueMaps.h.

307  {
308  //we do a float->bool conversion here to make things easier to be consistent with electrons
309  std::vector<std::pair<std::string, bool>> ids;
310  for (auto itr = vmaps_token.begin(); itr != vmaps_token.end(); ++itr) {
311  float idVal(0);
312  assignValue(ptr, itr->second, vmaps, idVal);
313  ids.push_back({itr->first, idVal});
314  }
315  std::sort(ids.begin(), ids.end(), [](auto& lhs, auto& rhs) { return lhs.first < rhs.first; });
316  obj.setPhotonIDs(ids);
317 }

References getGTfromDQMFile::obj.

◆ addValueToObject() [1/3]

template<typename OutputType >
template<typename ObjType , typename MapType >
void EGXtraModFromVMObjFiller< OutputType >::addValueToObject ( ObjType &  obj,
const edm::Ptr< reco::Candidate > &  ptr,
const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType >>> &  vmaps,
const std::pair< const std::string, edm::EDGetTokenT< edm::ValueMap< MapType >>> &  val_map,
bool  overrideExistingValues 
)
static

Definition at line 224 of file EGExtraInfoModifierFromValueMaps.h.

229  {
230  MapType value{};
231  assignValue(ptr, val_map.second, vmaps, value);
232  if (overrideExistingValues || !obj.hasUserData(val_map.first)) {
233  obj.addUserData(val_map.first, value, true);
234  } else {
235  throw cms::Exception("ValueNameAlreadyExists")
236  << "Trying to add new UserData = " << val_map.first
237  << " failed because it already exists and you didnt specify to override it (set in the config "
238  "overrideExistingValues=cms.bool(True) )";
239  }
240 }

References Exception, and getGTfromDQMFile::obj.

Referenced by EGXtraModFromVMObjFiller< OutputType >::addValuesToObject().

◆ addValueToObject() [2/3]

template<>
void EGXtraModFromVMObjFiller< float >::addValueToObject ( ObjType &  obj,
const edm::Ptr< reco::Candidate > &  ptr,
const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType >>> &  vmaps,
const std::pair< const std::string, edm::EDGetTokenT< edm::ValueMap< MapType >>> &  val_map,
bool  overrideExistingValues 
)

Definition at line 244 of file EGExtraInfoModifierFromValueMaps.h.

249  {
250  float value(0.0);
251  assignValue(ptr, val_map.second, vmaps, value);
252  if (overrideExistingValues || !obj.hasUserFloat(val_map.first)) {
253  obj.addUserFloat(val_map.first, value, true);
254  } else {
255  throw cms::Exception("ValueNameAlreadyExists")
256  << "Trying to add new UserFloat = " << val_map.first
257  << " failed because it already exists and you didnt specify to override it (set in the config "
258  "overrideExistingValues=cms.bool(True) )";
259  }
260 }

References Exception, getGTfromDQMFile::obj, and relativeConstraints::value.

◆ addValueToObject() [3/3]

template<>
void EGXtraModFromVMObjFiller< int >::addValueToObject ( ObjType &  obj,
const edm::Ptr< reco::Candidate > &  ptr,
const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType >>> &  vmaps,
const std::pair< const std::string, edm::EDGetTokenT< edm::ValueMap< MapType >>> &  val_map,
bool  overrideExistingValues 
)

Definition at line 264 of file EGExtraInfoModifierFromValueMaps.h.

269  {
270  int value(0);
271  assignValue(ptr, val_map.second, vmaps, value);
272  if (overrideExistingValues || !obj.hasUserInt(val_map.first)) {
273  obj.addUserInt(val_map.first, value, true);
274  } else {
275  throw cms::Exception("ValueNameAlreadyExists")
276  << "Trying to add new UserInt = " << val_map.first
277  << " failed because it already exists and you didnt specify to override it (set in the config "
278  "overrideExistingValues=cms.bool(True) )";
279  }
280 }

References Exception, getGTfromDQMFile::obj, and relativeConstraints::value.

EGXtraModFromVMObjFiller::addValueToObject
static void addValueToObject(ObjType &obj, const edm::Ptr< reco::Candidate > &ptr, const std::unordered_map< unsigned, edm::Handle< edm::ValueMap< MapType >>> &vmaps, const std::pair< const std::string, edm::EDGetTokenT< edm::ValueMap< MapType >>> &val_map, bool overrideExistingValues)
Definition: EGExtraInfoModifierFromValueMaps.h:224
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
value
Definition: value.py:1
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:29
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246