ATLAS Offline Software
Public Types | Public Member Functions | Protected Attributes | List of all members
jet::JetCaloCalculator Class Referenceabstract

#include <JetCaloCalculations.h>

Inheritance diagram for jet::JetCaloCalculator:
Collaboration diagram for jet::JetCaloCalculator:

Public Types

typedef double weight_t
 

Public Member Functions

 JetCaloCalculator ()
 
 JetCaloCalculator (xAOD::JetAttribute::AttributeID id)
 
virtual ~JetCaloCalculator ()
 
virtual bool setupEvent ()
 
virtual bool setupJet (const xAOD::Jet *)=0
 
virtual bool processConstituent (xAOD::JetConstituentVector::iterator &)
 Perform 1 calculation step using 1 constituent. More...
 
virtual double jetCalculation () const
 return the result of the calculation More...
 
virtual double operator() (const xAOD::Jet *jet, xAOD::JetConstitScale s=xAOD::UncalibratedJetConstituent)
 convenience function to perform the full calculation on a given jet More...
 
virtual std::string name () const
 
void setName (const std::string &n)
 
void setExtractor (const CaloConstitHelpers::CaloConstitExtractor *ex)
 
virtual JetCaloCalculatorclone () const =0
 Clone. Base class should not be cloned. More...
 

Protected Attributes

std::string m_name
 
xAOD::JetAttribute::AttributeID m_id {}
 
const CaloConstitHelpers::CaloConstitExtractorm_constitExtractor {}
 

Detailed Description

Base class to support cpu-efficient calculation on calorimeter jets either at CaloCell or constituent level (CaloCluster & PFO objects supported).

JetCaloCalculator instances use the CaloCluster moments in their calculation. Similar quantities build from CaloCell directly are calculated by JetCaloCellCalculator instances. These ones are defined separately in JetCaloCellQualityUtils.h, so they are not compiled in RootCore or AthAnalysis releases.

The reason for using classes rather than simple functions to perform cell based calculations is doing

for each cell { for each calculation {calculate on cell} } (1)

is more efficient than doing the loop the other way around :

for each calculation { for each cell {calculate on cell} } (2)

Implementing (1) in a modular way requires to use objects which can accumulate information when processing a cell. The calculation steps for 1 cell/constituent is to be implemented in processCell(cell)/processConstituent(constit) functions (whithin these functions the calculator object is expected to accumulate
relevant information from cell/constit in private members).

The function setupJet() is meant to prepare the calculation for a given jet (for ex: reset accumulation variables).

JetCalculators are expected to be used within a JetCalculation instance. They also act as functor and define operator() so one can use them as : JetCalcNegativeEnergy calculateNegE; double negEinJet = calculateNegE(jet);

Definition at line 76 of file JetCaloCalculations.h.

Member Typedef Documentation

◆ weight_t

Definition at line 79 of file JetCaloCalculations.h.

Constructor & Destructor Documentation

◆ JetCaloCalculator() [1/2]

jet::JetCaloCalculator::JetCaloCalculator ( )
inline

Definition at line 81 of file JetCaloCalculations.h.

81 : m_name("JetCaloCalculator"){}

◆ JetCaloCalculator() [2/2]

jet::JetCaloCalculator::JetCaloCalculator ( xAOD::JetAttribute::AttributeID  id)

Definition at line 215 of file JetCaloCalculations.cxx.

215  :
217  m_id(id)
218  {
219  // std::cout<< " JetCaloCalculatorBase" << " id "<< id <<std::endl;
220  }

◆ ~JetCaloCalculator()

virtual jet::JetCaloCalculator::~JetCaloCalculator ( )
inlinevirtual

Definition at line 84 of file JetCaloCalculations.h.

84 {}

Member Function Documentation

◆ clone()

virtual JetCaloCalculator* jet::JetCaloCalculator::clone ( ) const
pure virtual

Clone. Base class should not be cloned.

Implemented in jet::JetCaloCellCalculator, and jet::JetCalcQualityHEC.

◆ jetCalculation()

virtual double jet::JetCaloCalculator::jetCalculation ( ) const
inlinevirtual

return the result of the calculation

Definition at line 97 of file JetCaloCalculations.h.

97 {return 0;};

◆ name()

virtual std::string jet::JetCaloCalculator::name ( ) const
inlinevirtual

Definition at line 102 of file JetCaloCalculations.h.

102 {return m_name;}

◆ operator()()

double jet::JetCaloCalculator::operator() ( const xAOD::Jet jet,
xAOD::JetConstitScale  s = xAOD::UncalibratedJetConstituent 
)
virtual

convenience function to perform the full calculation on a given jet

Reimplemented in jet::JetCaloCellCalculator.

Definition at line 222 of file JetCaloCalculations.cxx.

222  {
223 
224  if (! setupJet( jet ) ) return 0;
225  size_t nConstit = jet->numConstituents();
226  if( nConstit == 0) return true;
227 
228  // retrieve the cluster moment extractor for this jet.
230 
231 
232  xAOD::JetConstituentVector constits = jet->getConstituents();
233  // Use the constituent iterator
234  // IMPORTANT : use UncalibratedJetConstituent.
235  // By default the calculators will just use the kinematic from the iterator they are
236  // given. This allows to choose what scale we give them.
237  // Here we use UncalibratedJetConstituent as default, because most (or all) calo quantity to be calculated
238  // are based on EM scale cluster moments.
239  xAOD::JetConstituentVector::iterator it = constits.begin(constitscale );
240  xAOD::JetConstituentVector::iterator itE = constits.end(constitscale);
241 
242  for(; it != itE; ++it)
243  {
244  if( m_constitExtractor->valid(it) )
245  processConstituent(it); // (no support for weight now)
246  }
247 
248  return jetCalculation();
249 
250  }

◆ processConstituent()

virtual bool jet::JetCaloCalculator::processConstituent ( xAOD::JetConstituentVector::iterator )
inlinevirtual

Perform 1 calculation step using 1 constituent.

Implementation of these functions should use the kinematics from the iterator NOT from the underlying cluster
It is expected that the input is valid, i.e. : CaloConstitExtractor::valid(it) == true.

Reimplemented in jet::JetCalcQualityHEC.

Definition at line 93 of file JetCaloCalculations.h.

93 {return true;};

◆ setExtractor()

void jet::JetCaloCalculator::setExtractor ( const CaloConstitHelpers::CaloConstitExtractor ex)
inline

Definition at line 107 of file JetCaloCalculations.h.

107 {m_constitExtractor = ex;}

◆ setName()

void jet::JetCaloCalculator::setName ( const std::string &  n)
inline

Definition at line 104 of file JetCaloCalculations.h.

104 {m_name = n;}

◆ setupEvent()

virtual bool jet::JetCaloCalculator::setupEvent ( )
inlinevirtual

Definition at line 86 of file JetCaloCalculations.h.

86 {return true; };

◆ setupJet()

virtual bool jet::JetCaloCalculator::setupJet ( const xAOD::Jet )
pure virtual

Member Data Documentation

◆ m_constitExtractor

const CaloConstitHelpers::CaloConstitExtractor* jet::JetCaloCalculator::m_constitExtractor {}
protected

Definition at line 115 of file JetCaloCalculations.h.

◆ m_id

xAOD::JetAttribute::AttributeID jet::JetCaloCalculator::m_id {}
protected

Definition at line 114 of file JetCaloCalculations.h.

◆ m_name

std::string jet::JetCaloCalculator::m_name
protected

Definition at line 113 of file JetCaloCalculations.h.


The documentation for this class was generated from the following files:
jet::JetCaloCalculator::processConstituent
virtual bool processConstituent(xAOD::JetConstituentVector::iterator &)
Perform 1 calculation step using 1 constituent.
Definition: JetCaloCalculations.h:93
xAOD::JetConstituentVector::end
iterator end() const
iterator after the last constituent
Definition: JetConstituentVector.cxx:104
skel.it
it
Definition: skel.GENtoEVGEN.py:423
xAOD::JetAttributeAccessor::name
std::string name(xAOD::JetAttribute::AttributeID id)
Definition: JetAccessorMap.h:30
jet::JetCaloCalculator::setupJet
virtual bool setupJet(const xAOD::Jet *)=0
TruthTest.itE
itE
Definition: TruthTest.py:25
jet::JetCaloCalculator::m_id
xAOD::JetAttribute::AttributeID m_id
Definition: JetCaloCalculations.h:114
xAOD::JetConstituentVector::begin
iterator begin() const
iterator on the first constituent
Definition: JetConstituentVector.cxx:103
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
beamspotman.n
n
Definition: beamspotman.py:731
jet::JetCaloCalculator::m_constitExtractor
const CaloConstitHelpers::CaloConstitExtractor * m_constitExtractor
Definition: JetCaloCalculations.h:115
CaloConstitHelpers::extractorForJet
const CaloConstitExtractor * extractorForJet(const xAOD::Jet *jet)
returns a pointer to a CaloConstitExtractor for a given jet.
Definition: JetCaloCalculations.cxx:185
jet::JetCaloCalculator::m_name
std::string m_name
Definition: JetCaloCalculations.h:113
jet::JetCaloCalculator::jetCalculation
virtual double jetCalculation() const
return the result of the calculation
Definition: JetCaloCalculations.h:97
CaloConstitHelpers::CaloConstitExtractor::valid
virtual bool valid(xAOD::JetConstituentVector::iterator &) const
Definition: JetCaloCalculations.h:33
xAOD::JetConstituentVector
A vector of jet constituents at the scale used during jet finding.
Definition: JetConstituentVector.h:117
xAOD::JetConstituentVector::iterator
Definition: JetConstituentVector.h:121