#include <IEfficiencyScaleFactorTool.h>
Public Member Functions | |
virtual | ~IEfficiencyScaleFactorTool () |
Default destructor. | |
virtual CorrectionCode | getEfficiencyScaleFactor (const xAOD::IParticle &p, double &sf) const =0 |
virtual CorrectionCode | applyEfficiencyScaleFactor (const xAOD::IParticle &p) const =0 |
General interface for tools providing analysis efficiency scale factors
This is a generic interface that should be implemented by all analysis tools that provide efficiency scale factors for xAOD::IParticle
type objects.
xAOD::IParticle
interface doesn't provide, please rely on the xAOD::IParticle::type()
function to identify whether you received an appropriate object. And then use static_cast
to cast the reference to the right type. Like:{.cpp} if( p.type() != xAOD::Type::Electron ) { ATH_MSG_ERROR( "Object of wrong type (" << p.type() << ") received" ); return CP::CorrectionCode::Error; } const xAOD::Electron& el = static_cast< const xAOD::Electron& >( p );
Just be very careful about writing the code correctly, as a wrong static_cast
could lead to memory corruption. But since its much faster than dynamic_cast
, it's still recommended to use this sort of code.
virtual CorrectionCode CP::IEfficiencyScaleFactorTool::applyEfficiencyScaleFactor | ( | const xAOD::IParticle & | p | ) | const [pure virtual] |
Decorate a particle with its efficiency scale factor
This function can be used to decorate a particle type object with an efficiency scale factor. The name and type of the scale factor variable is up to the specific tool implementation.
p | The particle for which a scale factor is to be calculated |
CP::CorrectionCode::Error
in case of a serious problem, CP::CorrectionCode::OutOfValidityRange
if no scale factor is available for the received object, or CP::CorrectionCode::Ok
if the scale factor could be correctly provided Implemented in CP::ElectronChargeEfficiencyCorrectionTool.
virtual CorrectionCode CP::IEfficiencyScaleFactorTool::getEfficiencyScaleFactor | ( | const xAOD::IParticle & | p, | |
double & | sf | |||
) | const [pure virtual] |
Retrieve an efficiency scale factor for a particle type object
This function is used to retrieve the efficiency scale factor for a specific particle object.
p | The particle for which a scale factor is to be calculated | |
sf | A reference to the scale factor variable to be set |
CP::CorrectionCode::Error
in case of a serious problem, CP::CorrectionCode::OutOfValidityRange
if no scale factor is available for the received object, or CP::CorrectionCode::Ok
if the scale factor could be correctly provided Implemented in CP::ElectronChargeEfficiencyCorrectionTool.