CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
hltdqm Namespace Reference

Functions

template<typename ObjType >
std::function< float(const
ObjType &)> 
getUnaryFuncExtraFloat (const std::string &varName)
 
template<typename ObjType >
std::function< float(const
ObjType &)> 
getUnaryFuncFloat (const std::string &varName)
 
bool passTrig (const float objEta, float objPhi, const trigger::TriggerEvent &trigEvt, const std::string &filterName, const std::string &processName)
 
bool passTrig (const float objEta, float objPhi, const trigger::TriggerEvent &trigEvt, const std::vector< std::string > &filterNames, bool orFilters, const std::string &processName)
 
bool passTrig (const std::string &trigPattern, const edm::TriggerNames &trigNames, const edm::TriggerResults &trigResults)
 
template<typename ObjType >
float scEtaFunc (const ObjType &obj)
 

Function Documentation

template<typename ObjType >
std::function<float(const ObjType&)> hltdqm::getUnaryFuncExtraFloat ( const std::string &  varName)

Definition at line 46 of file FunctionDefs.h.

46  {
47  std::function<float(const ObjType&)> varFunc;
48  return varFunc;
49  }
template<typename ObjType >
std::function<float(const ObjType&)> hltdqm::getUnaryFuncFloat ( const std::string &  varName)

Definition at line 53 of file FunctionDefs.h.

References PVValHelper::eta, Exception, PVValHelper::phi, and DiDispStaMuonMonitor_cfi::pt.

53  {
54  std::function<float(const ObjType&)> varFunc;
55  if (varName == "et")
56  varFunc = &ObjType::et;
57  else if (varName == "pt")
58  varFunc = &ObjType::pt;
59  else if (varName == "eta")
60  varFunc = &ObjType::eta;
61  else if (varName == "phi")
62  varFunc = &ObjType::phi;
63  else
64  varFunc = getUnaryFuncExtraFloat<ObjType>(varName);
65  //check if we never set varFunc and throw an error for anything but an empty input string
66  if (!varFunc && !varName.empty()) {
67  throw cms::Exception("ConfigError")
68  << "var " << varName << " not recognised " << __FILE__ << "," << __LINE__ << std::endl;
69  }
70  return varFunc;
71  }
bool hltdqm::passTrig ( const float  objEta,
float  objPhi,
const trigger::TriggerEvent trigEvt,
const std::string &  filterName,
const std::string &  processName 
)
inline

Definition at line 14 of file UtilFuncs.h.

References reco::deltaR2(), trigger::TriggerObject::eta(), trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), trigger::TriggerEvent::getObjects(), trigger::TriggerObject::phi(), and trigger::TriggerEvent::sizeFilters().

Referenced by L1Muon2RecoTreeProducer::analyze(), HLTDQMFilterEffHists< ObjType >::fillHists(), HLTDQMFilterTnPEffHists< TagType, ProbeType >::fillHists(), HLTDQMTagAndProbeEff< TagType, TagCollType, ProbeType, ProbeCollType >::getPassingRefs(), WPlusJetsEventSelector::operator()(), and passTrig().

18  {
19  constexpr float kMaxDR2 = 0.1 * 0.1;
20 
21  edm::InputTag filterTag(filterName, "", processName);
22  trigger::size_type filterIndex = trigEvt.filterIndex(filterTag);
23  if (filterIndex < trigEvt.sizeFilters()) { //check that filter is in triggerEvent
24  const trigger::Keys& trigKeys = trigEvt.filterKeys(filterIndex);
25  const trigger::TriggerObjectCollection& trigObjColl(trigEvt.getObjects());
26  for (unsigned short trigKey : trigKeys) {
27  const trigger::TriggerObject& trigObj = trigObjColl[trigKey];
28  if (reco::deltaR2(trigObj.eta(), trigObj.phi(), objEta, objPhi) < kMaxDR2)
29  return true;
30  }
31  }
32  return false;
33  }
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
float phi() const
Definition: TriggerObject.h:54
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:132
float eta() const
Definition: TriggerObject.h:53
uint16_t size_type
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
std::vector< size_type > Keys
bool hltdqm::passTrig ( const float  objEta,
float  objPhi,
const trigger::TriggerEvent trigEvt,
const std::vector< std::string > &  filterNames,
bool  orFilters,
const std::string &  processName 
)
inline

Definition at line 36 of file UtilFuncs.h.

References reco_skim_cfg_mod::filterName, and passTrig().

41  {
42  if (orFilters) {
43  if (filterNames.empty())
44  return true; //auto pass if empty filters
45  for (auto& filterName : filterNames) {
46  if (passTrig(objEta, objPhi, trigEvt, filterName, processName) == true)
47  return true;
48  }
49  return false;
50  } else {
51  for (auto& filterName : filterNames) {
52  if (passTrig(objEta, objPhi, trigEvt, filterName, processName) == false)
53  return false;
54  }
55  return true;
56  }
57  }
bool passTrig(const float objEta, float objPhi, const trigger::TriggerEvent &trigEvt, const std::string &filterName, const std::string &processName)
Definition: UtilFuncs.h:14
bool hltdqm::passTrig ( const std::string &  trigPattern,
const edm::TriggerNames trigNames,
const edm::TriggerResults trigResults 
)
inline

Definition at line 62 of file UtilFuncs.h.

References edm::HLTGlobalStatus::accept(), edm::is_glob(), mergeVDriftHistosByStation::name, edm::regexMatch(), edm::HLTGlobalStatus::size(), edm::TriggerNames::triggerIndex(), and edm::TriggerNames::triggerNames().

64  {
65  if (trigPattern.empty())
66  return true;
67 
68  std::vector<std::string> trigNamesToPass;
69  if (edm::is_glob(trigPattern)) {
70  //matches is vector of string iterators
71  const auto& matches = edm::regexMatch(trigNames.triggerNames(), trigPattern);
72  for (auto& name : matches)
73  trigNamesToPass.push_back(*name);
74  } else {
75  trigNamesToPass.push_back(trigPattern); //not a pattern, much be a path
76  }
77  for (auto& trigName : trigNamesToPass) {
78  size_t pathIndex = trigNames.triggerIndex(trigName);
79  if (pathIndex < trigResults.size() && trigResults.accept(pathIndex))
80  return true;
81  }
82 
83  return false;
84  }
bool accept() const
Has at least one path accepted the event?
bool is_glob(std::string const &pattern)
Definition: RegexMatch.cc:17
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
Strings const & triggerNames() const
Definition: TriggerNames.cc:48
unsigned int size() const
Get number of paths stored.
std::vector< std::vector< std::string >::const_iterator > regexMatch(std::vector< std::string > const &strings, std::regex const &regexp)
Definition: RegexMatch.cc:26
template<typename ObjType >
float hltdqm::scEtaFunc ( const ObjType &  obj)

Definition at line 40 of file FunctionDefs.h.

40  {
41  return obj.superCluster()->eta();
42  }