ATLAS Offline Software
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
jet::JetIsolation::IsolationCalculator Class Reference

IsolationCalculator : base class for isolation calculations Implementations of this class encapsulate all the needed calculations inside the calcIsolationVariables(jet, constituents) function, where 'constituents' is expected to be a vector a consituent NOT containing the jet's constitents. More...

Inheritance diagram for jet::JetIsolation::IsolationCalculator:
Collaboration diagram for jet::JetIsolation::IsolationCalculator:

Classes

struct  IsolationResult
 Holds the 4-vector of all constituents contributing to isolation. More...
 

Public Types

enum  Kinematics {
  Pt, PtPUsub, SumPt, Par,
  Perp, P
}
 Define the available isolation variables. More...
 

Public Member Functions

virtual ~IsolationCalculator ()=default
 
virtual string baseName () const
 
virtual IsolationCalculatorclone (const xAOD::Jet *) const
 
virtual void copyFrom (const IsolationCalculator *o, const xAOD::Jet *)
 
virtual IsolationResult jetIsolation (const xAOD::Jet *, std::vector< const xAOD::IParticle * > &) const
 Compute the isolation 4-momentum from jet and jet inputs. More...
 
bool scheduleKinematicCalculation (const std::string &kname)
 
virtual std::vector< float > calcIsolationVariables (const xAOD::Jet *jet, std::vector< const xAOD::IParticle * > &nearbyConstit) const
 Implement the calculation of isolation variables for this jet. More...
 
virtual std::vector< std::string > calculationNames () const
 
void dump () const
 
void setEventDensity (float rho)
 

Static Public Attributes

static constexpr std::array< std::string_view, 6 > s_kname = {"Pt","PtPUsub" , "SumPt", "Par", "Perp", "P"}
 names for isolation variables. Must match EXACTLY the enum. More...
 

Protected Attributes

std::vector< Kinematicsm_kinematics
 kinematics isolation variables to be computed More...
 
float m_rho =-9999.
 Value of the event density in case it is needed. More...
 

Detailed Description

IsolationCalculator : base class for isolation calculations Implementations of this class encapsulate all the needed calculations inside the calcIsolationVariables(jet, constituents) function, where 'constituents' is expected to be a vector a consituent NOT containing the jet's constitents.

Definition at line 33 of file JetIsolationTool.cxx.

Member Enumeration Documentation

◆ Kinematics

Define the available isolation variables.

Enumerator
Pt 
PtPUsub 
SumPt 
Par 
Perp 

Definition at line 37 of file JetIsolationTool.cxx.

37  {
38  Pt, PtPUsub, SumPt, Par, Perp, P
39  };

Constructor & Destructor Documentation

◆ ~IsolationCalculator()

virtual jet::JetIsolation::IsolationCalculator::~IsolationCalculator ( )
virtualdefault

Member Function Documentation

◆ baseName()

virtual string jet::JetIsolation::IsolationCalculator::baseName ( ) const
inlinevirtual

Reimplemented in jet::JetIsolation::IsolationCalculatorT< ISOCRITERIA >.

Definition at line 54 of file JetIsolationTool.cxx.

54 {return "";}

◆ calcIsolationVariables()

virtual std::vector<float> jet::JetIsolation::IsolationCalculator::calcIsolationVariables ( const xAOD::Jet jet,
std::vector< const xAOD::IParticle * > &  nearbyConstit 
) const
inlinevirtual

Implement the calculation of isolation variables for this jet.

The vector<IParticle*> nearbyConstit is expected to contain all the constituents which can fall in the isolation area AND which are not constituent of the jet.

Definition at line 80 of file JetIsolationTool.cxx.

80  {
81  IsolationResult result = jetIsolation(jet, nearbyConstit);
82  std::vector<float> calcVector;
83  float pt = jet->jetP4(xAOD::JetConstitScaleMomentum).pt();
84  static const SG::AuxElement::Accessor<float> areaAcc("ActiveArea");
85  float jetArea=0;
86  for(auto k : m_kinematics){
87  float v=-1;
88  switch( k ) {
89  case Pt:
90  v = result.isoP.Pt() / pt; break ;
91  case PtPUsub:
92  jetArea= areaAcc(*jet);
93  v = (result.isoP.Pt() - (result.isoArea-jetArea)*m_rho)/ (pt-jetArea*m_rho);
94  break;
95  case Perp:
96  v = result.isoP.Vect().Dot(unitVector(jet->p4())) /pt; break;
97  case SumPt:
98  v = result.isoSumPt; break;
99  case Par:
100  v = result.isoP.Vect().Perp(unitVector(jet->p4())) /pt ; break;
101  case P:
102  v = result.isoP.Vect().Mag()/pt; break ;
103  }
104  calcVector.push_back(v);
105  }
106  return calcVector;
107  }

◆ calculationNames()

virtual std::vector<std::string> jet::JetIsolation::IsolationCalculator::calculationNames ( ) const
inlinevirtual

Definition at line 110 of file JetIsolationTool.cxx.

110  {
111  std::vector<std::string> v;
112  v.reserve(m_kinematics.size());
113  for(auto k : m_kinematics) {
114  v.emplace_back(baseName() + string(s_kname[k]));
115  }
116  return v;
117  }

◆ clone()

virtual IsolationCalculator* jet::JetIsolation::IsolationCalculator::clone ( const xAOD::Jet ) const
inlinevirtual

Reimplemented in jet::JetIsolation::IsolationCalculatorT< ISOCRITERIA >.

Definition at line 55 of file JetIsolationTool.cxx.

55 {return nullptr;}

◆ copyFrom()

virtual void jet::JetIsolation::IsolationCalculator::copyFrom ( const IsolationCalculator o,
const xAOD::Jet  
)
inlinevirtual

Definition at line 56 of file JetIsolationTool.cxx.

56  {
58  }

◆ dump()

void jet::JetIsolation::IsolationCalculator::dump ( ) const
inline

Definition at line 120 of file JetIsolationTool.cxx.

120  {
121  std::cout << "Isolation calculator "<< baseName() <<std::endl;
122  for(const auto& n : calculationNames()){
123  std::cout << " - "<< n << std::endl;
124  }
125  }

◆ jetIsolation()

virtual IsolationResult jet::JetIsolation::IsolationCalculator::jetIsolation ( const xAOD::Jet ,
std::vector< const xAOD::IParticle * > &   
) const
inlinevirtual

Compute the isolation 4-momentum from jet and jet inputs.

It is assumed the caller has already removed jet constituents from the input list.

Reimplemented in jet::JetIsolation::IsolationCalculatorT< ISOCRITERIA >.

Definition at line 63 of file JetIsolationTool.cxx.

63  {
64  return {};
65  }

◆ scheduleKinematicCalculation()

bool jet::JetIsolation::IsolationCalculator::scheduleKinematicCalculation ( const std::string &  kname)
inline

Definition at line 67 of file JetIsolationTool.cxx.

67  {
68  auto it = std::ranges::find(s_kname, kname);
69  if( it != s_kname.end( )){
70  m_kinematics.push_back(static_cast<Kinematics>(it-s_kname.begin()) );
71  return true;
72  }
73  return false;
74  }

◆ setEventDensity()

void jet::JetIsolation::IsolationCalculator::setEventDensity ( float  rho)
inline

Definition at line 127 of file JetIsolationTool.cxx.

127  {
128  m_rho=rho;
129  }

Member Data Documentation

◆ m_kinematics

std::vector<Kinematics> jet::JetIsolation::IsolationCalculator::m_kinematics
protected

kinematics isolation variables to be computed

Definition at line 133 of file JetIsolationTool.cxx.

◆ m_rho

float jet::JetIsolation::IsolationCalculator::m_rho =-9999.
protected

Value of the event density in case it is needed.

Definition at line 135 of file JetIsolationTool.cxx.

◆ s_kname

constexpr std::array<std::string_view, 6> jet::JetIsolation::IsolationCalculator::s_kname = {"Pt","PtPUsub" , "SumPt", "Par", "Perp", "P"}
staticconstexpr

names for isolation variables. Must match EXACTLY the enum.

Definition at line 42 of file JetIsolationTool.cxx.


The documentation for this class was generated from the following file:
jet::JetIsolation::IsolationCalculator::Perp
@ Perp
Definition: JetIsolationTool.cxx:38
jet::JetIsolation::IsolationCalculator::m_kinematics
std::vector< Kinematics > m_kinematics
kinematics isolation variables to be computed
Definition: JetIsolationTool.cxx:133
get_generator_info.result
result
Definition: get_generator_info.py:21
jet::JetIsolation::IsolationCalculator::jetIsolation
virtual IsolationResult jetIsolation(const xAOD::Jet *, std::vector< const xAOD::IParticle * > &) const
Compute the isolation 4-momentum from jet and jet inputs.
Definition: JetIsolationTool.cxx:63
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
jet::JetIsolation::IsolationCalculator::calculationNames
virtual std::vector< std::string > calculationNames() const
Definition: JetIsolationTool.cxx:110
jet::JetIsolation::IsolationCalculator::P
@ P
Definition: JetIsolationTool.cxx:38
skel.it
it
Definition: skel.GENtoEVGEN.py:396
jet::JetIsolation::IsolationCalculator::m_rho
float m_rho
Value of the event density in case it is needed.
Definition: JetIsolationTool.cxx:135
test_pyathena.pt
pt
Definition: test_pyathena.py:11
xAOD::JetConstitScaleMomentum
@ JetConstitScaleMomentum
Definition: JetTypes.h:29
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
beamspotman.n
n
Definition: beamspotman.py:731
jet::JetIsolation::IsolationCalculator::Kinematics
Kinematics
Define the available isolation variables.
Definition: JetIsolationTool.cxx:37
jet::JetIsolation::IsolationCalculator::s_kname
static constexpr std::array< std::string_view, 6 > s_kname
names for isolation variables. Must match EXACTLY the enum.
Definition: JetIsolationTool.cxx:42
jet::JetIsolation::IsolationCalculator::Pt
@ Pt
Definition: JetIsolationTool.cxx:38
jet::JetIsolation::IsolationCalculator::SumPt
@ SumPt
Definition: JetIsolationTool.cxx:38
jet::JetIsolation::unitVector
TVector3 unitVector(const FourMom_t &v)
Definition: JetIsolationTool.cxx:24
jet::JetIsolation::IsolationCalculator::PtPUsub
@ PtPUsub
Definition: JetIsolationTool.cxx:38
python.PyAthena.v
v
Definition: PyAthena.py:154
jet::JetIsolation::IsolationCalculator::baseName
virtual string baseName() const
Definition: JetIsolationTool.cxx:54
jet::JetIsolation::IsolationCalculator::Par
@ Par
Definition: JetIsolationTool.cxx:38
fitman.rho
rho
Definition: fitman.py:532
fitman.k
k
Definition: fitman.py:528