ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
JetVar::FChargedVar Struct Reference

#include <JetVariable.h>

Inheritance diagram for JetVar::FChargedVar:
Collaboration diagram for JetVar::FChargedVar:

Public Member Functions

virtual float value (const xAOD::Jet &j) const
 
 Variable (const std::string &name)
 
virtual bool isVector () const
 return true if the underlying variable is of type vector<X> More...
 
virtual VectorValue vector (const xAOD::Jet &) const
 return a helper object allowing to iterate over the underlying vector. !!! use only if isVector()==true !!! More...
 
virtual std::string name () const
 
float scale () const
 
void setScale (float s)
 

Static Public Member Functions

static std::unique_ptr< Variablecreate (const std::string &name, const std::string &type="float", int index=-1)
 create and return a new Variable of a given name & type. More...
 

Public Attributes

std::string m_name
 
float m_scale = 1
 
int m_index = -1
 

Detailed Description

Definition at line 186 of file JetVariable.h.

Member Function Documentation

◆ create()

std::unique_ptr< Variable > Variable::create ( const std::string &  name,
const std::string &  type = "float",
int  index = -1 
)
staticinherited

create and return a new Variable of a given name & type.

If type is a vector an index can be specified : the variable will behave as a non-vector Variable corresponding to the value at the given index

Definition at line 10 of file JetVariable.cxx.

10  {
11 
12  // if known name, return the corresponding dedicated class
13  if(name=="e") return std::make_unique<EVar>(name);
14  if(name=="et") return std::make_unique<EtVar>(name);
15  if(name=="pz") return std::make_unique<PzVar>(name);
16  if(name=="nconstit") return std::make_unique<NconstitVar>(name);
17  if(name=="abseta") return std::make_unique<AbsEtaVar>(name);
18  if(name=="|eta|") return std::make_unique<AbsEtaVar>(name);
19  if(name=="rapidity") return std::make_unique<Rapidity>(name);
20  if(name=="fCharged") return std::make_unique<FChargedVar>(name);
21  if(name=="EM3Frac") return std::make_unique<EM3FracVar>(name);
22  if(name=="Tile0Frac") return std::make_unique<Tile0FracVar>(name);
23 
24  // Else assume we're looking for an attribute attached to the jet
25  if(type=="float") return std::make_unique<VariableAtt<float> >(name);
26  if(type=="int") return std::make_unique<VariableAtt<int> >(name);
27  if(type=="vecfloat") return std::make_unique<VariableAtt<std::vector<float> > >(name, index);
28  if(type=="vecint") return std::make_unique<VariableAtt< std::vector<int> > >(name, index);
29 
30 
31  return nullptr;
32  }

◆ isVector()

virtual bool JetVar::Variable::isVector ( ) const
inlinevirtualinherited

return true if the underlying variable is of type vector<X>

Reimplemented in JetVar::VariableAtt< std::vector< T > >.

Definition at line 59 of file JetVariable.h.

59 {return false;}

◆ name()

virtual std::string JetVar::Variable::name ( ) const
inlinevirtualinherited

Reimplemented in JetVar::VariableAtt< std::vector< T > >.

Definition at line 65 of file JetVariable.h.

65 {return m_name;}

◆ scale()

float JetVar::Variable::scale ( ) const
inlineinherited

Definition at line 67 of file JetVariable.h.

67 {return m_scale;}

◆ setScale()

void JetVar::Variable::setScale ( float  s)
inlineinherited

Definition at line 68 of file JetVariable.h.

68 { m_scale=s;}

◆ value()

virtual float JetVar::FChargedVar::value ( const xAOD::Jet j) const
inlinevirtual

Implements JetVar::Variable.

Definition at line 188 of file JetVariable.h.

188  {
189  bool status = false;
190  float constScalePt = 0.;
191  std::vector<float> SumPtChargedPFOPt500;
192  status = j.getAttribute<float>("JetConstitScaleMomentum_pt", constScalePt ); // Jet pT at the constituent scale
193  if (!status) return 0;
194  status = j.getAttribute<std::vector<float> >("SumPtChargedPFOPt500", SumPtChargedPFOPt500 ); //Vector over all vertices in the event, each element contains the sum pT of all charged PFO with a pT > 0.5 GeV associated to the vertex.
195  if (!status) return 0;
196  return SumPtChargedPFOPt500.at(0)/=constScalePt; //definition of "fCharge", index 0 points to the primary vertex
197  }

◆ Variable()

JetVar::Variable::Variable
inline

Definition at line 54 of file JetVariable.h.

54 : m_name(name) {}

◆ vector()

virtual VectorValue JetVar::Variable::vector ( const xAOD::Jet ) const
inlinevirtualinherited

return a helper object allowing to iterate over the underlying vector. !!! use only if isVector()==true !!!

Reimplemented in JetVar::VariableAtt< std::vector< T > >.

Definition at line 62 of file JetVariable.h.

62 {return VectorValue();}

Member Data Documentation

◆ m_index

int JetVar::Variable::m_index = -1
inherited

Definition at line 78 of file JetVariable.h.

◆ m_name

std::string JetVar::Variable::m_name
inherited

Definition at line 76 of file JetVariable.h.

◆ m_scale

float JetVar::Variable::m_scale = 1
inherited

Definition at line 77 of file JetVariable.h.


The documentation for this struct was generated from the following file:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
xAOD::Jet_v1::getAttribute
bool getAttribute(AttributeID type, T &value) const
Retrieve attribute moment by enum.
JetVar::Variable::name
virtual std::string name() const
Definition: JetVariable.h:65
DeMoScan.index
string index
Definition: DeMoScan.py:362
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
merge.status
status
Definition: merge.py:17
JetVar::Variable::m_name
std::string m_name
Definition: JetVariable.h:76
JetVar::Variable::m_scale
float m_scale
Definition: JetVariable.h:77