CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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

Definition at line 267 of file TrigObjTnPHistColl.cc.

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

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

Member Function Documentation

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

Definition at line 149 of file TrigObjTnPHistColl.h.

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

149  {
150  return isAbs_ ? std::abs((obj.*varFunc_)()) : (obj.*varFunc_)();
151  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float(trigger::TriggerObject::* varFunc_)() const

Member Data Documentation

bool TrigObjTnPHistColl::TrigObjVarF::isAbs_
private

Definition at line 155 of file TrigObjTnPHistColl.h.

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

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

Definition at line 154 of file TrigObjTnPHistColl.h.

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