CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrigObjTnPHistColl::TrigObjVarF Class Reference

#include <TrigObjTnPHistColl.h>

Public Member Functions

float operator() (const trigger::TriggerObject &obj) const
 
 TrigObjVarF (std::string varName)
 

Private Attributes

bool isAbs_
 
float(trigger::TriggerObject::* varFunc_ )() const
 

Detailed Description

Definition at line 146 of file TrigObjTnPHistColl.h.

Constructor & Destructor Documentation

◆ TrigObjVarF()

TrigObjTnPHistColl::TrigObjVarF::TrigObjVarF ( std::string  varName)
explicit

Definition at line 266 of file TrigObjTnPHistColl.cc.

266  : isAbs_(false) {
267  //first look for "Abs" at the end of the string
268  auto absPos = varName.rfind("Abs");
269  if (absPos != std::string::npos && absPos + 3 == varName.size()) {
270  isAbs_ = true;
271  varName = varName.erase(absPos);
272  }
273  if (varName == "pt")
275  else if (varName == "eta")
277  else if (varName == "phi")
279  else {
280  std::ostringstream msg;
281  msg << "var " << varName << " not recognised (use pt or p rather than et or e for speed!) ";
282  if (isAbs_)
283  msg << " varName was \"Abs\" suffex cleaned where it tried to remove \"Abs\" at the end of the variable name ";
284  msg << __FILE__ << "," << __LINE__ << std::endl;
285  throw cms::Exception("ConfigError") << msg.str();
286  }
287 }

References trigger::TriggerObject::eta(), Exception, isAbs_, mps_check::msg, trigger::TriggerObject::phi(), trigger::TriggerObject::pt(), and varFunc_.

Member Function Documentation

◆ operator()()

float TrigObjTnPHistColl::TrigObjVarF::operator() ( const trigger::TriggerObject obj) const
inline

Definition at line 149 of file TrigObjTnPHistColl.h.

149  {
150  return isAbs_ ? std::abs((obj.*varFunc_)()) : (obj.*varFunc_)();
151  }

References funct::abs(), isAbs_, getGTfromDQMFile::obj, and varFunc_.

Member Data Documentation

◆ isAbs_

bool TrigObjTnPHistColl::TrigObjVarF::isAbs_
private

Definition at line 155 of file TrigObjTnPHistColl.h.

Referenced by operator()(), and TrigObjVarF().

◆ varFunc_

float(trigger::TriggerObject::* TrigObjTnPHistColl::TrigObjVarF::varFunc_) () const
private

Definition at line 154 of file TrigObjTnPHistColl.h.

Referenced by operator()(), and TrigObjVarF().

trigger::TriggerObject::phi
float phi() const
Definition: TriggerObject.h:54
mps_check.msg
tuple msg
Definition: mps_check.py:285
trigger::TriggerObject::pt
float pt() const
Definition: TriggerObject.h:52
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
trigger::TriggerObject::eta
float eta() const
Definition: TriggerObject.h:53
TrigObjTnPHistColl::TrigObjVarF::isAbs_
bool isAbs_
Definition: TrigObjTnPHistColl.h:155
Exception
Definition: hltDiff.cc:246
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TrigObjTnPHistColl::TrigObjVarF::varFunc_
float(trigger::TriggerObject::* varFunc_)() const
Definition: TrigObjTnPHistColl.h:154