ATLAS Offline Software
Loading...
Searching...
No Matches
jet::JetCaloCalculator Class Referenceabstract

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

#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.
virtual double jetCalculation () const
 return the result of the calculation
virtual double operator() (const xAOD::Jet *jet, xAOD::JetConstitScale s=xAOD::UncalibratedJetConstituent)
 convenience function to perform the full calculation on a given jet
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.

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 }
xAOD::JetAttribute::AttributeID m_id
std::string name(xAOD::JetAttribute::AttributeID id)

◆ ~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::JetCalcQualityHEC, and jet::JetCaloCellCalculator.

◆ 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 }
virtual double jetCalculation() const
return the result of the calculation
virtual bool setupJet(const xAOD::Jet *)=0
virtual bool processConstituent(xAOD::JetConstituentVector::iterator &)
Perform 1 calculation step using 1 constituent.
const CaloConstitHelpers::CaloConstitExtractor * m_constitExtractor
iterator begin() const
iterator on the first constituent
iterator end() const
iterator after the last constituent
size_t numConstituents() const
Number of constituents in this jets (this is valid even when reading a file where the constituents ha...
Definition Jet_v1.cxx:153
JetConstituentVector getConstituents() const
Return a vector of consituents. The object behaves like vector<const IParticle*>. See JetConstituentV...
Definition Jet_v1.cxx:147
const CaloConstitExtractor * extractorForJet(const xAOD::Jet *jet)
returns a pointer to a CaloConstitExtractor for a given jet.

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

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

115{}; // used to retrieve the cluster moment from the constituent (which can be a PFO object or a cluster)

◆ m_id

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

Definition at line 114 of file JetCaloCalculations.h.

114{}; // unused for now.

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