ATLAS Offline Software
Loading...
Searching...
No Matches
JetVar::VariableAtt< T > Class Template Reference

is an attribute in the EDM More...

#include <JetVariable.h>

Inheritance diagram for JetVar::VariableAtt< T >:
Collaboration diagram for JetVar::VariableAtt< T >:

Public Member Functions

 VariableAtt (const std::string &name)
virtual float value (const xAOD::Jet &j) const
virtual bool isVector () const
 return true if the underlying variable is of type vector<X>
virtual VectorValue vector (const xAOD::Jet &) const
 return a helper object allowing to iterate over the underlying vector. !!! use only if isVector()==true !!!
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.

Public Attributes

Accessor< T > m_acc
std::string m_name
float m_scale = 1
int m_index = -1

Detailed Description

template<typename T>
class JetVar::VariableAtt< T >

is an attribute in the EDM

Definition at line 90 of file JetVariable.h.

Constructor & Destructor Documentation

◆ VariableAtt()

template<typename T>
JetVar::VariableAtt< T >::VariableAtt ( const std::string & name)
inline

Definition at line 91 of file JetVariable.h.

91: Variable(name), m_acc(name) {}
virtual std::string name() const
Definition JetVariable.h:65
Variable(const std::string &name)
Definition JetVariable.h:54
Accessor< T > m_acc
Definition JetVariable.h:96

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 }
str index
Definition DeMoScan.py:362

◆ 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;}
std::string m_name
Definition JetVariable.h:76

◆ 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.

◆ value()

template<typename T>
virtual float JetVar::VariableAtt< T >::value ( const xAOD::Jet & j) const
inlinevirtual

Implements JetVar::Variable.

Definition at line 92 of file JetVariable.h.

92 {
93 if ( m_acc.isAvailable( j ) ) return m_acc(j)*m_scale;
94 else return -999.;
95 }
is an attribute in the EDM
Definition JetVariable.h:90

◆ 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_acc

template<typename T>
Accessor<T> JetVar::VariableAtt< T >::m_acc

Definition at line 96 of file JetVariable.h.

◆ 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 class was generated from the following file: