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

#include <JetVariable.h>

Inheritance diagram for JetVar::EM3FracVar:
Collaboration diagram for JetVar::EM3FracVar:

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 200 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::EM3FracVar::value ( const xAOD::Jet j) const
inlinevirtual

Implements JetVar::Variable.

Definition at line 202 of file JetVariable.h.

202  {
203  float constitScaleEnergy = 0.;
204  std::vector<float> samplingFrac;
205  xAOD::JetFourMom_t fourVec;
206  bool status = false;
207 
208  status = j.getAttribute<xAOD::JetFourMom_t>( "JetConstitScaleMomentum", fourVec ); // Jet four-momentum at constituent scale
209  if( status ) constitScaleEnergy = fourVec.E() * m_scale ;
210  else return 0.;
211  status = j.getAttribute<std::vector<float> >("EnergyPerSampling", samplingFrac ); //EnergyPerSampling is a vector of size 24; element i refers to the energy deposited in calo sampling i, see https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/Run2JetMoments#Sampling_layers
212  if( status ) return (samplingFrac[3]+samplingFrac[7])/constitScaleEnergy; //3 is 'EMB3' in the LAr barrel, 7 is 'EME3' in the LAr EM endcap
213  else return 0.;
214  }

◆ 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.
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
JetVar::Variable::name
virtual std::string name() const
Definition: JetVariable.h:65
DeMoScan.index
string index
Definition: DeMoScan.py:364
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