CMS 3D CMS Logo

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 44 of file FunctionDefs.h.

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

Definition at line 51 of file FunctionDefs.h.

References stringResolutionProvider_cfi::et, PVValHelper::eta, Exception, PVValHelper::phi, EnergyCorrector::pt, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 14 of file UtilFuncs.h.

References constexpr, 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().

15  {
16  constexpr float kMaxDR2 = 0.1*0.1;
17 
18  edm::InputTag filterTag(filterName,"",processName);
19  trigger::size_type filterIndex = trigEvt.filterIndex(filterTag);
20  if(filterIndex<trigEvt.sizeFilters()){ //check that filter is in triggerEvent
21  const trigger::Keys& trigKeys = trigEvt.filterKeys(filterIndex);
22  const trigger::TriggerObjectCollection & trigObjColl(trigEvt.getObjects());
23  for(unsigned short trigKey : trigKeys){
24  const trigger::TriggerObject& trigObj = trigObjColl[trigKey];
25  if(reco::deltaR2(trigObj.eta(),trigObj.phi(),objEta,objPhi)<kMaxDR2) return true;
26  }
27  }
28  return false;
29  }
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:135
float phi() const
Definition: TriggerObject.h:58
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
float eta() const
Definition: TriggerObject.h:57
uint16_t size_type
#define constexpr
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
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 
)

Definition at line 32 of file UtilFuncs.h.

References diMuonOutputModule_cfi::filterName, and passTrig().

33  {
34  if(orFilters){
35  if(filterNames.empty()) return true; //auto pass if empty filters
36  for(auto& filterName : filterNames){
37  if(passTrig(objEta,objPhi,trigEvt,filterName,processName)==true) return true;
38  }
39  return false;
40  }else{
41  for(auto& filterName : filterNames){
42  if(passTrig(objEta,objPhi,trigEvt,filterName,processName)==false) return false;
43  }
44  return true;
45  }
46  }
bool passTrig(const std::string &trigPattern, const edm::TriggerNames &trigNames, const edm::TriggerResults &trigResults)
Definition: UtilFuncs.h:51
bool hltdqm::passTrig ( const std::string &  trigPattern,
const edm::TriggerNames trigNames,
const edm::TriggerResults trigResults 
)

Definition at line 51 of file UtilFuncs.h.

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

51  {
52 
53  if(trigPattern.empty()) return true;
54 
55  std::vector<std::string> trigNamesToPass;
56  if(edm::is_glob(trigPattern)){
57 
58  //matches is vector of string iterators
59  const auto& matches = edm::regexMatch(trigNames.triggerNames(),trigPattern);
60  for(auto& name : matches) trigNamesToPass.push_back(*name);
61  }else{
62  trigNamesToPass.push_back(trigPattern); //not a pattern, much be a path
63  }
64  for(auto& trigName : trigNamesToPass){
65  size_t pathIndex = trigNames.triggerIndex(trigName);
66  if(pathIndex<trigResults.size() &&
67  trigResults.accept(pathIndex)) return true;
68  }
69 
70  return false;
71  }
bool accept() const
Has at least one path accepted the event?
bool is_glob(std::string const &pattern)
Definition: RegexMatch.cc:18
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
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:30
template<typename ObjType >
float hltdqm::scEtaFunc ( const ObjType &  obj)

Definition at line 39 of file FunctionDefs.h.

39 {return obj.superCluster()->eta();}