ATLAS Offline Software
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ElectronPhotonVariableCorrectionBase Class Reference

Class to correct electron and photon MC variables. More...

#include <ElectronPhotonVariableCorrectionBase.h>

Inheritance diagram for ElectronPhotonVariableCorrectionBase:
Collaboration diagram for ElectronPhotonVariableCorrectionBase:

Public Types

enum  EGammaObjects {
  EGammaObjects::Failure = 0, EGammaObjects::unconvertedPhotons = 1, EGammaObjects::convertedPhotons, EGammaObjects::allPhotons,
  EGammaObjects::allElectrons, EGammaObjects::allEGammaObjects
}
 Define the categories of EGamma objects tool can be applied to. More...
 

Public Member Functions

 ElectronPhotonVariableCorrectionBase (const std::string &myname)
 Standard constructor. More...
 
 ~ElectronPhotonVariableCorrectionBase ()
 Standard destructor. More...
 
virtual StatusCode initialize () override
 Initialize the class instance. More...
 
const CP::CorrectionCode applyCorrection (xAOD::Photon &photon) const
 Apply the correction given in the conf file to the passed photon. More...
 
const CP::CorrectionCode applyCorrection (xAOD::Electron &electron) const
 Apply the correction given in the conf file to the passed electron. More...
 
const CP::CorrectionCode correctedCopy (const xAOD::Photon &in_photon, xAOD::Photon *&out_photon) const
 Make a corrected copy of the passed photon according to the given conf file. More...
 
const CP::CorrectionCode correctedCopy (const xAOD::Electron &in_electron, xAOD::Electron *&out_electron) const
 Make a corrected copy of the passed electron according to the given conf file. More...
 
const std::string & getCorrectionVariable ()
 Returns the variable which should be corrected according to the passed configuration file. More...
 
ElectronPhotonVariableCorrectionBase::EGammaObjects isAppliedTo ()
 Returns the type of EGamma object to which the correction should be applied. More...
 
bool applyToConvertedPhotons () const
 Check if the ApplyTo flag passed in the conf file is compatible with converted photons. More...
 
bool applyToUnconvertedPhotons () const
 Check if the ApplyTo flag passed in the conf file is compatible with uconverted photons. More...
 
bool applyToElectrons () const
 Check if the ApplyTo flag passed in the conf file is compatible with electrons. More...
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

enum  parameterType {
  parameterType::Failure = 0, parameterType::EtaDependentTGraph = 1, parameterType::PtDependentTGraph, parameterType::EtaBinned,
  parameterType::PtBinned, parameterType::EtaTimesPtBinned, parameterType::EtaTimesPhiTH2, parameterType::EventDensity
}
 Use enum and not string for type of function parameter in order to do faster comparisons. More...
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

ElectronPhotonVariableCorrectionBase::parameterType stringToParameterType (const std::string &input) const
 Convert input string to a parameter function type. More...
 
ElectronPhotonVariableCorrectionBase::EGammaObjects stringToEGammaObject (const std::string &input) const
 Convert input string to egamma object type. More...
 
bool passedCorrectPhotonType (const xAOD::Photon &photon) const
 Check if the photon which was passed to the tool has the correct type, if only (un)converted photons were requested to be corrected. More...
 
bool isEqualToUncorrectedDiscontinuity (const float value) const
 Check if the value passed is equal to one of the values passed via the UncorrectedDiscontinuites flag and should thus not be corrected. More...
 
const StatusCode getParameterInformationFromConf (TEnv &env, const int parameter_number, const ElectronPhotonVariableCorrectionBase::parameterType type)
 Get the relevant information for a correction function parameter from the given conf file. More...
 
const StatusCode getEtaPtBinningsFromConf (const bool getEtaBins, const bool getPtBins, const TString &binValues, const TString &interpolate, TEnv &env, const int parameter_number)
 Get the eta and pt binning as well as the respective correction values from the given conf file. More...
 
const StatusCode getObjectFromRootFile (TEnv &env, const int parameter_number, const TString &filePathKey, const TString &nameKey, std::unique_ptr< TObject > &return_object)
 Get a TObject storing corrections (i.e. More...
 
const StatusCode getCorrectionParameters (const float pt, const float eta, const float ph, std::vector< float > &properties) const
 Get the actual parameters of the TF1 function used for the current e/y object to be corrected. More...
 
const StatusCode get1DBinnedParameter (float &return_parameter_value, const float evalPoint, const std::vector< float > &binning, const int parameter_number) const
 Get the correction function parameter value if its type is eta- or pT-binned. More...
 
const StatusCode get2DBinnedParameter (float &return_parameter_value, const float etaEvalPoint, const float ptEvalPoint, const int parameter_number) const
 Get the correction function parameter value if its type is eta- and pT-binned. More...
 
const StatusCode get2DHistParameter (float &return_parameter_value, const float etaEvalPoint, const float phiEvalPoint, const int parameter_number) const
 Get the correction function parameter value if its type is eta- and pT-binned. More...
 
bool getInterpolationFlag (const int parameter_number) const
 Return the interpolation flag of parameter parameter_number as a boolean. More...
 
const StatusCode interpolate (float &return_parameter_value, const float evalPoint, const int bin, const std::vector< float > &binning, const std::vector< float > &binValues) const
 Given a point x, approximates the value via linear interpolation based on the two nearest bin centers. More...
 
const StatusCode getBinCenter (float &return_bin_center, const std::vector< float > &binning, const int bin_int) const
 Get the bin center of a bin bin_int using the binning binning. More...
 
const StatusCode getDensity (float &value, const std::string &eventShapeContainer) const
 Get the events energy density from the eventShape. More...
 
const StatusCode getKinematicProperties (const xAOD::Egamma &egamma_object, float &pt, float &eta, float &phi) const
 Get the e/y kinematic properties. More...
 
void correct (float &return_corrected_variable, const float original_variable, const std::vector< float > &properties, unsigned int rndSeed=0) const
 Actual application of the correction to the variable. More...
 
TRandom3 * getTLSRandomGen (unsigned int seed) const
 Getting thread safe random number generator (and resetting its seed) More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Static Private Member Functions

static const StatusCode findBin (int &return_bin, const float evalPoint, const std::vector< float > &binning)
 Find the bin number in which the evalPoint is located in the binning binning. More...
 
static float interpolate_function (const float value, const float left_bin_center, const float left_bin_value, const float right_bin_center, const float right_bin_value)
 Returns the linearly intrpolated value of value given the bin centers and bin values. More...
 

Private Attributes

std::string m_configFile
 The name of the configuration file. More...
 
std::string m_correctionVariable
 The name of the variable to correct. More...
 
bool m_doGaussianSmearing = false
 Whether to apply normal correction or smearing correction. More...
 
boost::thread_specific_ptr< TRandom3 > m_TRandom_tls
 thread-safe TRandom3 for setting seed of random smearing correction More...
 
std::vector< float > m_uncorrectedDiscontinuities
 Values of discontinuities in the variable which should not be corrected. More...
 
std::string m_correctionFunctionString
 Function to use for the variable correction, TFormula style. More...
 
std::unique_ptr< TFormula > m_correctionFunctionTFormula
 The actual TFormula correction function. More...
 
int m_numberOfFunctionParameters {}
 Number of parameters of the variable correction function. More...
 
std::vector< parameterTypem_ParameterTypeVector
 Map of the correction function parameter number to the parameter type. More...
 
std::vector< TGraph * > m_graphCopies
 Copy of the TGraph from the root file, stored if needed by the respective correction function parameter. More...
 
std::vector< TH2 * > m_TH2Copies
 Copy of the TH2 from the root file, stored if needed by the respective correction function parameter. More...
 
std::vector< float > m_useAbsEtaTH2
 Store the lowest eta bin boundary: used for checking if the respective TH2 needs the eta or abs(eta) value for evaluation. More...
 
std::vector< std::vector< float > > m_binValues
 List of eta/pt dependent values, stored if needed by the respective correction function parameter. More...
 
std::vector< float > m_etaBins
 List of bin boundaries in eta, stored if needed by any correction function parameter. More...
 
bool m_useAbsEtaBinned {}
 Store if the eta binned parameters need the eta or abs(eta) value for evaluation. More...
 
std::vector< float > m_ptBins
 List of bin boundaries in pT, stored if needed by any correction function parameter. More...
 
std::vector< bool > m_interpolatePtFlags
 List of bools whether a parameter should use linear interpolation in pT if it's some kind of pT binned parameter. More...
 
ElectronPhotonVariableCorrectionBase::EGammaObjects m_applyToObjects {}
 The type of objects to which the specific conf file settings are allowed to be applied to. More...
 
bool m_retrievedEtaBinning = false
 Store if already retrieved eta binning. More...
 
bool m_retrievedPtBinning = false
 Store if already retrieved pt binning. More...
 
std::unique_ptr< SG::AuxElement::Accessor< float > > m_variableToCorrect
 Accessor for the variable to be corrected. More...
 
std::unique_ptr< SG::AuxElement::Accessor< float > > m_originalVariable
 Accessor to store the original value of the corrected variable. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Class to correct electron and photon MC variables.

Tool to correct electron and photon MC variables.

For a detailed documentation, please refer to the gitlab readme

Author
Nils Gillwald (DESY) nils..nosp@m.gill.nosp@m.wald@.nosp@m.desy.nosp@m..de
Date
February 2020
Author
Nils Gillwald (DESY) nils..nosp@m.gill.nosp@m.wald@.nosp@m.desy.nosp@m..de
Date
February 2020

Definition at line 41 of file ElectronPhotonVariableCorrectionBase.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ EGammaObjects

Define the categories of EGamma objects tool can be applied to.

The tool can be applied to electrons and photons, but the latter could also have different corrections according to whether they are converted or unconverted photons. The categories are designed in such a way, that the analyzer can freely choose whether he_she_* wants all objects (i.e. e and y) to be corrected in the same way, or wheter he_she_* wants to apply different corrections to different types of objects.

Enumerator
Failure 
unconvertedPhotons 
convertedPhotons 
allPhotons 
allElectrons 
allEGammaObjects 

Definition at line 102 of file ElectronPhotonVariableCorrectionBase.h.

102  {
103  Failure = 0,
104  unconvertedPhotons = 1,
105  convertedPhotons,
106  allPhotons,
107  allElectrons,
108  allEGammaObjects
109  }; //end enum EGammaObjects

◆ parameterType

Use enum and not string for type of function parameter in order to do faster comparisons.

Enumerator
Failure 
EtaDependentTGraph 
PtDependentTGraph 
EtaBinned 
PtBinned 
EtaTimesPtBinned 
EtaTimesPhiTH2 
EventDensity 

Definition at line 131 of file ElectronPhotonVariableCorrectionBase.h.

131  {
132  Failure = 0,
133  EtaDependentTGraph = 1,
134  PtDependentTGraph,
135  EtaBinned,
136  PtBinned,
137  EtaTimesPtBinned,
138  EtaTimesPhiTH2,
139  EventDensity
140  }; // end enum ParameterType

Constructor & Destructor Documentation

◆ ElectronPhotonVariableCorrectionBase()

ElectronPhotonVariableCorrectionBase::ElectronPhotonVariableCorrectionBase ( const std::string &  myname)

Standard constructor.

Parameters
mynameInternal name of the class instance, so they can be distinguished

Definition at line 37 of file ElectronPhotonVariableCorrectionBase.cxx.

37  :
38  AsgTool(myname)
39 {
40  //declare the needed properties
41  declareProperty("ConfigFile",m_configFile="","The configuration file to use");
42 }

◆ ~ElectronPhotonVariableCorrectionBase()

ElectronPhotonVariableCorrectionBase::~ElectronPhotonVariableCorrectionBase ( )
inline

Standard destructor.

Definition at line 50 of file ElectronPhotonVariableCorrectionBase.h.

50 {};

Member Function Documentation

◆ applyCorrection() [1/2]

const CP::CorrectionCode ElectronPhotonVariableCorrectionBase::applyCorrection ( xAOD::Electron electron) const

Apply the correction given in the conf file to the passed electron.

Parameters
electronThe electron which should be corrected

Pass an electron which should be corrected by the tool to this function. The tool gets the original electron variable value, corrects it according to the configuration file given, and overwrites the original value of the variable. The original variable is saved as <variable_name>_original. Note that the variable to be corrected should be an auxiliary variable, and that the electron or electron container, respectively, must not be const if you want to use this function. If you are running on const objects, please make a deep / shallow copy of the container or use the correctedCopy function of this class.

Definition at line 256 of file ElectronPhotonVariableCorrectionBase.cxx.

257 {
258  if (!applyToElectrons())
259  {
260  ATH_MSG_ERROR("You want to correct electrons, but passed a conf file with ApplyTo flag not set for electrons. Are you using the correct conf file?");
262  }
263 
264  // From the object, get the variable value according to the variable from the conf file
265  // if variable not found, fail
266  float original_variable = 0.;
267 
268  if (m_correctionVariable == "transformed_e_probability_ht") {
269  // this is a special case, since what we want to fudge is not the variable
270  // usually stoared in (D)xAOD, but a transformed version
271  // here we compute the transormed version
272  // this is code duplication from AsgElectronLikelihoodTool.cxx
273 
274  const xAOD::TrackParticle* track = electron.trackParticle();
275  if (!track) {
276  ATH_MSG_ERROR("you are trying to fudge transformed_e_probability_ht but the electron has no track!");
278  }
279  float TRT_PID = 0.;
280  if (!track->summaryValue(TRT_PID, xAOD::eProbabilityHT)) {
281  ATH_MSG_ERROR("you are trying to fudge transformed_e_probability_ht but eProbabilityHT is not present");
283  }
284 
285  const double tau = 15.0;
286  const double fEpsilon = 1.0e-30; // to avoid zero division
287  double pid_tmp = TRT_PID;
288  if (pid_tmp >= 1.0)
289  pid_tmp = 1.0 - 1.0e-15; // this number comes from TMVA
290  else if (pid_tmp <= fEpsilon)
291  pid_tmp = fEpsilon;
292  double trans_TRT_PID = -std::log(1.0 / pid_tmp - 1.0) * (1. / double(tau));
293 
294  (*m_variableToCorrect)(electron) = (float)trans_TRT_PID;
295  }
296 
297  if (m_variableToCorrect->isAvailable(electron))
298  {
299  original_variable = (*m_variableToCorrect)(electron);
300  //Save the original value to the photon under different name
301  (*m_originalVariable)(electron) = original_variable;
302  // check if tool should skip correcting this variable, as it's from some discontinuity
303  if (isEqualToUncorrectedDiscontinuity(original_variable))
304  {
305  return CP::CorrectionCode::Ok;
306  }
307  }
308  else
309  {
310  ATH_MSG_ERROR("The correction variable \"" << m_correctionVariable << "\" provided in the conf file is not available.");
312  }
313 
314  float eta; //safe value of eta of event
315  float pt; //safe pt of event
316  float phi; //safe phi of event
317 
318  //Get all the properties from the electron and fill them to properties, eta, pt, phi
319  if (getKinematicProperties(electron, pt, eta, phi) != StatusCode::SUCCESS)
320  {
321  ATH_MSG_ERROR("Could not retrieve kinematic properties of this electron object.");
323  }
324  ATH_MSG_VERBOSE("Got the electron kinematics , pT = " << pt << " eta = " << eta << "phi = " << phi);
325  std::vector<float> properties;
326  if (getCorrectionParameters(pt, eta, phi, properties) != StatusCode::SUCCESS)
327  {
328  ATH_MSG_ERROR("Could not get the correction parameters for this electron object.");
330  }
331 
332  // If applying a Gaussian smearing correction, set the seed based on the
333  // electron properties
334  unsigned int rndSeed(0);
336  {
337  rndSeed = 1 + static_cast<unsigned int>(pt + std::abs(eta) * 1E3 + std::abs(phi) * 1E6);
338  }
339 
340  // Apply the correction, write to the corrected AuxElement
341  correct((*m_variableToCorrect)(electron),original_variable, properties, rndSeed);
342 
343  // everything worked out, so
344  return CP::CorrectionCode::Ok;
345 }

◆ applyCorrection() [2/2]

const CP::CorrectionCode ElectronPhotonVariableCorrectionBase::applyCorrection ( xAOD::Photon photon) const

Apply the correction given in the conf file to the passed photon.

Parameters
photonThe photon which should be corrected

Pass a photon which should be corrected by the tool to this function. The tool gets the original photon variable value, corrects it according to the configuration file given, and overwrites the original value of the variable. The original variable is saved as <variable_name>_original. Note that the variable to be corrected should be an auxiliary variable, and that the photon or photon container, respectively, must not be const if you want to use this function. If you are running on const objects, please make a deep / shallow copy of the container or use the correctedCopy function of this class.

Definition at line 202 of file ElectronPhotonVariableCorrectionBase.cxx.

203 {
204  // check if we should only deal with converted / unconverted photons
206  {
207  ATH_MSG_ERROR("You specified in the conf file that the tool should only be used for (un-)converted photons, but passed the other conversion type.");
209  }
210 
211  // From the object, get the variable value according to the variable from the conf file
212  // if variable not found, fail
213  float original_variable = 0.;
214  if( m_variableToCorrect->isAvailable(photon) )
215  {
216  original_variable = (*m_variableToCorrect)(photon);
217  //Save the original value to the photon under different name
218  (*m_originalVariable)(photon) = original_variable;
219  // check if tool should skip correcting this variable, as it's from some discontinuity
220  if (isEqualToUncorrectedDiscontinuity(original_variable))
221  {
222  return CP::CorrectionCode::Ok;
223  }
224  }
225  else
226  {
227  ATH_MSG_ERROR("The correction variable \"" << m_correctionVariable << "\" provided in the conf file is not available.");
229  }
230 
231  float eta; //safe value of eta of event
232  float pt; //safe pt of event
233  float phi; //safe phi of event
234 
235  //Get all the properties from the photon and fill them to properties, eta, pt, phi
236  if (getKinematicProperties(photon, pt, eta, phi) != StatusCode::SUCCESS)
237  {
238  ATH_MSG_ERROR("Could not retrieve kinematic properties of this photon object.");
240  }
241  ATH_MSG_VERBOSE("Got the photon kinematics , pT = " << pt << " eta = " << eta << "phi = " << phi);
242  std::vector<float> properties;
243  if (getCorrectionParameters(pt, eta, phi, properties) != StatusCode::SUCCESS)
244  {
245  ATH_MSG_ERROR("Could not get the correction parameters for this photon object.");
247  }
248 
249  // Apply the correction, write to the corrected AuxElement
250  correct((*m_variableToCorrect)(photon),original_variable, properties);
251 
252  // everything worked out, so
253  return CP::CorrectionCode::Ok;
254 }

◆ applyToConvertedPhotons()

bool ElectronPhotonVariableCorrectionBase::applyToConvertedPhotons ( ) const

Check if the ApplyTo flag passed in the conf file is compatible with converted photons.

Returns
True if the ApplyTo flag is compatible, False if not

Definition at line 1065 of file ElectronPhotonVariableCorrectionBase.cxx.

◆ applyToElectrons()

bool ElectronPhotonVariableCorrectionBase::applyToElectrons ( ) const

Check if the ApplyTo flag passed in the conf file is compatible with electrons.

Returns
True if the ApplyTo flag is compatible, False if not

Definition at line 1081 of file ElectronPhotonVariableCorrectionBase.cxx.

1082 {
1085  return (applyToAllEGamma || applyToAllElectrons);
1086 }

◆ applyToUnconvertedPhotons()

bool ElectronPhotonVariableCorrectionBase::applyToUnconvertedPhotons ( ) const

Check if the ApplyTo flag passed in the conf file is compatible with uconverted photons.

Returns
True if the ApplyTo flag is compatible, False if not

Definition at line 1073 of file ElectronPhotonVariableCorrectionBase.cxx.

◆ correct()

void ElectronPhotonVariableCorrectionBase::correct ( float &  return_corrected_variable,
const float  original_variable,
const std::vector< float > &  properties,
unsigned int  rndSeed = 0 
) const
private

Actual application of the correction to the variable.

Parameters
return_corrected_variableThe corrected variable value is saved in this parameter
original_variableThe original value of the corrected variable
propertiesFunction parameters for the evaluation.
rndSeedA random seed determined from pT, eta and phi, in case a Gaussian smearing is used.

Definition at line 347 of file ElectronPhotonVariableCorrectionBase.cxx.

350 {
351  ATH_MSG_VERBOSE("original var " << original_variable);
352 
353  // If not smearing, apply correction in normal way
355  {
356  double x = original_variable;
357  std::vector<double> dpars (properties.begin(), properties.end());
358  return_corrected_variable = m_correctionFunctionTFormula->EvalPar(&x,
359  dpars.data());
360  }
361  else
362  {
363  // Get Gaussian mean and width from the parameters, to be used with
364  // TRandom::Gaus (assumes function given is a gaussian)
365  const double gaussMean = properties.at(0);
366  const double gaussAbsWidth = std::abs(properties.at(1));
367 
368  // If the Gaussian width is 0, can't use TRandom::Gaus - just apply shift
369  if (gaussAbsWidth == 0.0)
370  {
371  return_corrected_variable = original_variable + gaussMean;
372  }
373  // Otherwise, can apply smear using TRandom::Gaus
374  else
375  {
376  return_corrected_variable = original_variable +
377  getTLSRandomGen(rndSeed)->Gaus(gaussMean, gaussAbsWidth);
378  }
379  }
380 
381  ATH_MSG_VERBOSE("corrected var " << return_corrected_variable);
382 }

◆ correctedCopy() [1/2]

const CP::CorrectionCode ElectronPhotonVariableCorrectionBase::correctedCopy ( const xAOD::Electron in_electron,
xAOD::Electron *&  out_electron 
) const

Make a corrected copy of the passed electron according to the given conf file.

Parameters
in_electronThe original electron of which a corrected copy should be made
out_electronEmpty new electron where the corrected copy will be stored in

Makes a corrected copy of the passed electron object according to the correction provided in the configuration file. The in_electron is copied to the out_electron, which is then passed to the applyCorrection function.

Definition at line 393 of file ElectronPhotonVariableCorrectionBase.cxx.

394 {
395  out_electron = new xAOD::Electron(in_electron);
396  return applyCorrection(*out_electron);
397 }

◆ correctedCopy() [2/2]

const CP::CorrectionCode ElectronPhotonVariableCorrectionBase::correctedCopy ( const xAOD::Photon in_photon,
xAOD::Photon *&  out_photon 
) const

Make a corrected copy of the passed photon according to the given conf file.

Parameters
in_photonThe original photon of which a corrected copy should be made
out_photonEmpty new photon where the corrected copy will be stored in

Makes a corrected copy of the passed photon object according to the correction provided in the configuration file. The in_photon is copied to the out_photon, which is then passed to the applyCorrection function.

Definition at line 387 of file ElectronPhotonVariableCorrectionBase.cxx.

388 {
389  out_photon = new xAOD::Photon(in_photon);
390  return applyCorrection(*out_photon);
391 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ findBin()

const StatusCode ElectronPhotonVariableCorrectionBase::findBin ( int &  return_bin,
const float  evalPoint,
const std::vector< float > &  binning 
)
staticprivate

Find the bin number in which the evalPoint is located in the binning binning.

Parameters
return_binThe respective bin number is saved in this parameter
evalPointThe evaluation point for which the bin number should be found
binningThe binning which should be evaluated

Definition at line 845 of file ElectronPhotonVariableCorrectionBase.cxx.

846 {
847  // need to find the bin in which the evalPoint is
848  return_bin = -1;
849  // if the evalPoint is < lowest bin edge, interpolate to -inf and return leftmost value
850  if (evalPoint < binning.at(0))
851  {
852  return_bin = 0;
853  // found bin, no need to continue here
854  return StatusCode::SUCCESS;
855  }
856  // loop over bin boundaries
857  //run only up to binning.size()-1, as running to binning.size() will get a seg fault for the boundary check
858  for (unsigned int bin_itr = 0; bin_itr < binning.size()-1; bin_itr++)
859  {
860  // if the evaluation point is within the checked bins boundaries, this is the value we want
861  if (evalPoint > binning.at(bin_itr) && evalPoint < binning.at(bin_itr + 1))
862  {
863  // we found the according bin, so return the according value
864  return_bin = bin_itr;
865  // we can stop now
866  break;
867  }
868  }
869  //if this point is ever reached and bin == -1, the evaluation point is larger then the largest lowest bin edge
870  //if that's the case, return the value for the last bin
871  //the -1 is because the parameter numbering in a vector starts at 0
872  if (return_bin == -1)
873  {
874  return_bin = binning.size()-1;
875  }
876 
877  // everythin went fine, so
878  return StatusCode::SUCCESS;
879 }

◆ get1DBinnedParameter()

const StatusCode ElectronPhotonVariableCorrectionBase::get1DBinnedParameter ( float &  return_parameter_value,
const float  evalPoint,
const std::vector< float > &  binning,
const int  parameter_number 
) const
private

Get the correction function parameter value if its type is eta- or pT-binned.

Parameters
return_parameter_valueThe respective correction function parameter value is saved in this parameter
evalPointpT or eta evaluation point - i.e., the eta or pT value of the current e/y object to be corrected. Used to find the correct eta/pT bin to use for the correction
binningThe eta or pT binning
parameter_numberThe number of the parameter with respect to the correction TF1. Needed in order to retrieve the correct values matching this parameter.

Definition at line 751 of file ElectronPhotonVariableCorrectionBase.cxx.

752 {
753  ANA_MSG_VERBOSE("EvalPoint: " << evalPoint);
754  // need to find the bin in which the evalPoint is
755  int bin = -1;
756  ATH_CHECK(findBin(bin, evalPoint, binning));
757 
758  // calculate return value
759  // if interpolation flag is true, interpolate
760  if (getInterpolationFlag(parameter_number))
761  {
762  ATH_CHECK(interpolate(return_parameter_value, evalPoint, bin, binning, m_binValues.at(parameter_number)));
763  }
764  else
765  {
766  return_parameter_value = m_binValues.at(parameter_number).at(bin);
767  }
768 
769  // everything went fine, so
770  return StatusCode::SUCCESS;
771 }

◆ get2DBinnedParameter()

const StatusCode ElectronPhotonVariableCorrectionBase::get2DBinnedParameter ( float &  return_parameter_value,
const float  etaEvalPoint,
const float  ptEvalPoint,
const int  parameter_number 
) const
private

Get the correction function parameter value if its type is eta- and pT-binned.

Parameters
return_parameter_valueThe respective correction function parameter value is saved in this parameter
etaEvalPointeta evaluation point - i.e., the eta value of the current e/y object to be corrected. Used to find the correct eta bin to use for the correction
ptEvalPointpT evaluation point - i.e., the pT value of the current e/y object to be corrected. Used to find the correct pT bin to use for the correction
parameter_numberThe number of the parameter with respect to the correction TF1. Needed in order to retrieve the correct values matching this parameter.

Definition at line 773 of file ElectronPhotonVariableCorrectionBase.cxx.

774 {
775  //need to find eta bin, and need to find pt bin
776  //from this, calculate which parameter of the list is needed to be returned.
777  int etaBin = -1;
778  int ptBin = -1;
779 
780  ATH_MSG_VERBOSE("eta = " << etaEvalPoint << " pt = " << ptEvalPoint);
781 
782  ATH_CHECK(findBin(etaBin, etaEvalPoint, m_etaBins));
783  ATH_CHECK(findBin(ptBin, ptEvalPoint, m_ptBins));
784 
785  // get the corresponding pt x eta bin found
786  /* Note: Assuming that the values are binned in pt x eta in the conf file:
787  * eta bin 0 | eta bin 1 | eta bin 2 | eta bin 3 | eta bin 4 | etc.
788  * pt bin 0 0 1 2 3 4
789  * pt bin 1 5 6 7 8 9
790  * pt bin 2 10 11 12 13 14
791  * pt bin 3 15 16 17 18 19
792  * pt bin 4 20 21 22 23 24
793  * etc.
794  * the correct parameter is saved in the vector at (number of eta bins) * ptBinNumber + etaBinNumber
795  * */
796 
797  ATH_MSG_VERBOSE(" eta bin " << etaBin << " pT bin " << ptBin);
798 
799  int bin_number_in_bin_values = m_etaBins.size() * ptBin + etaBin;
800 
801  // calculate return value
802  // if interpolation flag is true, interpolate
803  if (getInterpolationFlag(parameter_number))
804  {
805  // create the vector of correction values binned in pT at the found eta bin
806  std::vector<float> tmp_binValuesAtEtaSlice;
807  // from the full binning vector, need to cut one of the columns
808  for (unsigned int binValue_itr = etaBin; binValue_itr < m_binValues.at(parameter_number).size(); binValue_itr += m_etaBins.size())
809  {
810  tmp_binValuesAtEtaSlice.push_back(m_binValues.at(parameter_number).at(binValue_itr));
811  }
812  // interpolate using the above slice of the correction values
813  ATH_CHECK(interpolate(return_parameter_value, ptEvalPoint, ptBin, m_ptBins, tmp_binValuesAtEtaSlice));
814  }
815  else
816  {
817  return_parameter_value = m_binValues.at(parameter_number).at(bin_number_in_bin_values);
818  }
819 
820  // everything went fine, so
821  return StatusCode::SUCCESS;
822 }

◆ get2DHistParameter()

const StatusCode ElectronPhotonVariableCorrectionBase::get2DHistParameter ( float &  return_parameter_value,
const float  etaEvalPoint,
const float  phiEvalPoint,
const int  parameter_number 
) const
private

Get the correction function parameter value if its type is eta- and pT-binned.

Parameters
return_parameter_valueThe respective correction function parameter value is saved in this parameter
etaEvalPointeta evaluation point - i.e., the eta value of the current e/y object to be corrected. Used to find the correct eta bin to use for the correction
phiEvalPointphi evaluation point - i.e., the phi value of the current e/y object to be corrected. Used to find the correct phi bin to use for the correction
parameter_numberThe number of the parameter with respect to the correction TF1. Needed in order to retrieve the correct values matching this parameter.

Definition at line 824 of file ElectronPhotonVariableCorrectionBase.cxx.

825 {
826  // might need to update eta evaluation point and can't update const float
827  float this_etaEvalPoint = etaEvalPoint;
828  ATH_MSG_VERBOSE("eta = " << this_etaEvalPoint << " phi = " << phiEvalPoint);
829  // make sure the eta eval point is inside the bounds of the histogram (i.e. pretend the lowest bin boundary is -infinity)
830  if (this_etaEvalPoint < m_useAbsEtaTH2.at(parameter_number))
831  {
832  this_etaEvalPoint = m_TH2Copies.at(parameter_number)->GetXaxis()->GetBinCenter(1);
833  ATH_MSG_VERBOSE("eta was out of bounds of TH2, corrected to eta = " << this_etaEvalPoint);
834  }
835  // get the value of the TH2 at the corresponding eta x phi pair
836  const int bin_number = m_TH2Copies.at(parameter_number)->FindBin(this_etaEvalPoint, phiEvalPoint);
837  return_parameter_value = m_TH2Copies.at(parameter_number)->GetBinContent(bin_number);
838  ATH_MSG_VERBOSE("Correction factor:" << return_parameter_value);
839 
840  // everything went fine, so
841  return StatusCode::SUCCESS;
842 }

◆ getBinCenter()

const StatusCode ElectronPhotonVariableCorrectionBase::getBinCenter ( float &  return_bin_center,
const std::vector< float > &  binning,
const int  bin_int 
) const
private

Get the bin center of a bin bin_int using the binning binning.

Parameters
return_bin_centerThe bin center is saved in this parameter
binningThe binning which should be used to find the bin centers
bin_intThe bin for which the bin center should be found

Definition at line 955 of file ElectronPhotonVariableCorrectionBase.cxx.

956 {
957  if (bin_int < 0)
958  {
959  ATH_MSG_ERROR("Bin number must be a non-negative integer.");
960  return StatusCode::FAILURE;
961  }
962 
963  // implicitly convert to loong unsigend int for comparisons, to get rid of compiler warnings resulting from comparisons of int and unsigned int
964  long unsigned int bin = bin_int;
965 
966  if (bin >= binning.size())
967  {
968  ATH_MSG_ERROR("The requested bin is out of range of the passed binning.");
969  return StatusCode::FAILURE;
970  }
971 
972  // need special treatment for rightmost bin center:
973  // it goes up to infinity...assume it's as broad as the
974  // next to the rightmost bin for the interpolation
975  if (bin == binning.size()-1)
976  {
977  //calculate the width of the next to rightmost bin
978  float bin_width = binning.at(bin) - binning.at(bin-1);
979  return_bin_center = binning.at(bin) + 0.5 * bin_width;
980  }
981  // normal calculation
982  else
983  {
984  return_bin_center = 0.5 * (binning.at(bin) + binning.at(bin+1));
985  }
986 
987  //everything went fine, so
988  return StatusCode::SUCCESS;
989 }

◆ getCorrectionParameters()

const StatusCode ElectronPhotonVariableCorrectionBase::getCorrectionParameters ( const float  pt,
const float  eta,
const float  ph,
std::vector< float > &  properties 
) const
private

Get the actual parameters of the TF1 function used for the current e/y object to be corrected.

Parameters
ptThe pT of the current e/y object to be corrected
etaThe eta of the current e/y object to be corrected
phiThe phi of the current e/y object to be corrected
propertiesVector of parameters to use.

As every electron/photon has different values of pT/eta, the correction function must be adapted accordingly for every e/y. The according values of each of the correction function parameters are updated with this function.

Definition at line 681 of file ElectronPhotonVariableCorrectionBase.cxx.

683 {
685 
686  // check if eta or abs(eta) is used for the binned variables
687  float etaForBinned = eta;
688  if (m_useAbsEtaBinned)
689  { etaForBinned = std::abs(eta); }
690  // if use eta, correct for cases where eta is smaller than lowest bin boundary
691  // i.e. treat lowest bin boundary as -inf!
692  else if (etaForBinned < m_etaBins.at(0))
693  {
694  // set eta to midpoint of lowest bin
695  etaForBinned = 0.5*(m_etaBins.at(0) + m_etaBins.at(1));
696  }
697 
698  // according to the parameter type, get the actual parameter going to the correction function
699  // for this, loop over the parameter type vector
700  for (unsigned int parameter_itr = 0; parameter_itr < m_ParameterTypeVector.size(); parameter_itr++)
701  {
702  switch (m_ParameterTypeVector.at(parameter_itr))
703  {
705  // evaluate TGraph at eta
706  properties.at(parameter_itr) = m_graphCopies.at(parameter_itr)->Eval(etaForBinned);
707  break;
709  // evaluate TGraph at pt
710  properties.at(parameter_itr) = m_graphCopies.at(parameter_itr)->Eval(pt);
711  break;
713  // get value of correct eta bin
714  ATH_CHECK(get1DBinnedParameter(properties.at(parameter_itr),etaForBinned,m_etaBins,parameter_itr));
715  break;
717  // get value of correct pt bin
718  ATH_CHECK(get1DBinnedParameter(properties.at(parameter_itr),pt,m_ptBins,parameter_itr));
719  break;
721  // get value of correct eta x pt bin
722  ATH_CHECK(get2DBinnedParameter(properties.at(parameter_itr),etaForBinned,pt,parameter_itr));
723  break;
725  { // need curly brackets here to mark scope - since etaForThisTH2 is initialized (and only needed) here
726  // check if need to use eta or abseta for this parameter (depends on the respective TH2)
727  float etaForThisTH2 = eta;
728  if (m_useAbsEtaTH2.at(parameter_itr) == 0.)
729  { etaForThisTH2 = std::abs(eta); }
730  // get value of correct eta x phi bin
731  ATH_CHECK(get2DHistParameter(properties.at(parameter_itr),etaForThisTH2,phi,parameter_itr));
732  }
733  break;
735  // get event density
736  ATH_CHECK(getDensity(properties.at(parameter_itr), "TopoClusterIsoCentralEventShape"));
737  break;
738  default:
739  {}//only adding default to omit compile time warnings for not including parameterType::Failure
740  // this case will never occur, since returning this case fails earlier
741  }
742  }
743 
744  for (auto p : properties)
745  ATH_MSG_VERBOSE("prop " << p);
746 
747  // everything went fine, so
748  return StatusCode::SUCCESS;
749 }

◆ getCorrectionVariable()

const std::string& ElectronPhotonVariableCorrectionBase::getCorrectionVariable ( )
inline

Returns the variable which should be corrected according to the passed configuration file.

Definition at line 95 of file ElectronPhotonVariableCorrectionBase.h.

95 { return m_correctionVariable; };

◆ getDensity()

const StatusCode ElectronPhotonVariableCorrectionBase::getDensity ( float &  value,
const std::string &  eventShapeContainer 
) const
private

Get the events energy density from the eventShape.

Parameters
valueThe respective correction function parameter value is saved in this parameter
eventShapeContainerThe name of the respective event shape container to use

Definition at line 996 of file ElectronPhotonVariableCorrectionBase.cxx.

997 {
998  // retrieve the event shape container
999  const xAOD::EventShape* evtShape = nullptr;
1000  if(evtStore()->retrieve(evtShape, eventShapeContainer).isFailure()){
1001  ATH_MSG_ERROR("Cannot retrieve density container " << eventShapeContainer);
1002  return StatusCode::FAILURE;
1003  }
1004  // get the density from the container
1006  return StatusCode::SUCCESS;
1007 }

◆ getEtaPtBinningsFromConf()

const StatusCode ElectronPhotonVariableCorrectionBase::getEtaPtBinningsFromConf ( const bool  getEtaBins,
const bool  getPtBins,
const TString &  binValues,
const TString &  interpolate,
TEnv &  env,
const int  parameter_number 
)
private

Get the eta and pt binning as well as the respective correction values from the given conf file.

Parameters
getEtaBinsif to get the eta binning and bin values
getPtBinsif to get the pt binning and bin values
binValuesthe conf file key to retrieve the bin values
interpolatethe conf file key on wheather to interpolate the pt values
envThe given TEnv,, which is used to read out the current conf file
parameter_numberThe parameter number with respect to the m_correctionFunctionTF1

Definition at line 538 of file ElectronPhotonVariableCorrectionBase.cxx.

539 {
540  // if needed and not already retrieved, get eta binning
541  if (getEtaBins && !m_retrievedEtaBinning)
542  {
543  // check if necessary information is in conf, else fail
544  if (env.Lookup("EtaBins"))
545  {
546  //get the eta binning (global!)
548  //force that the low bin edges are given by the conf file, starting with 0 or a negative value
549  if (m_etaBins.at(0) > 0.)
550  {
551  ATH_MSG_ERROR("Lowest bin edge given for parameter " << parameter_number << " is > 0. Please provide the lower bin edges of your correction binning in the conf file, starting with either 0 (for corrections symmetric in eta) or a negative number (being treated as -infinity).");
552  return StatusCode::FAILURE;
553  }
554  else
555  {
556  m_useAbsEtaBinned = m_etaBins.at(0) >= 0;
557  }
558  // don't want to retrieve the same thing twice from conf
559  m_retrievedEtaBinning = true;
560  }
561  else
562  {
563  ATH_MSG_ERROR("Could not retrieve eta binning.");
564  return StatusCode::FAILURE;
565  }
566  }
567  // if needed and not already retrieved, get pt binning
568  if (getPtBins && !m_retrievedPtBinning)
569  {
570  // check if necessary information is in conf, else fail
571  if (env.Lookup("PtBins"))
572  {
573  //get the pt binning (global!)
575  //force that the low bin edges are given by the conf file, starting with 0
576  if (m_ptBins.at(0) != 0.)
577  {
578  ATH_MSG_ERROR("Lowest bin edge given for parameter " << parameter_number << " is not 0. Please provide the lower bin edges of your correction binning in the conf file, starting with 0.");
579  return StatusCode::FAILURE;
580  }
581  // don't want to retrieve the same thing twice from conf
582  m_retrievedPtBinning = true;
583  }
584  else
585  {
586  ATH_MSG_ERROR("Could not retrieve pt binning.");
587  return StatusCode::FAILURE;
588  }
589  }
590  //check if interpolation should be done
591  if (getPtBins)
592  {
593  // default is false
594  m_interpolatePtFlags.at(parameter_number) = env.GetValue(interpolate.Data(),false);
595  }
596  if ( getEtaBins || getPtBins)
597  {
598  // check if necessary information is in conf, else fail
599  if (env.Lookup(binValues))
600  {
601  //get the binned values of the eta/pt dependent parameter
602  m_binValues.at(parameter_number) = AsgConfigHelper::HelperFloat(binValues.Data(),env);
603  }
604  else
605  {
606  ATH_MSG_ERROR("Could not retrieve binned values.");
607  return StatusCode::FAILURE;
608  }
609  }
610 
611  // everything went fine, so
612  return StatusCode::SUCCESS;
613 }

◆ getInterpolationFlag()

bool ElectronPhotonVariableCorrectionBase::getInterpolationFlag ( const int  parameter_number) const
private

Return the interpolation flag of parameter parameter_number as a boolean.

Parameters
parameter_numberNumber of the parameter for which the interpolation flag should be checked
Returns
The interpolation flag of parameter parameter_number (boolean)

Definition at line 881 of file ElectronPhotonVariableCorrectionBase.cxx.

882 {
883  bool do_interpolation = false;
884  // get parameter number type
886  // check if parameter has a type for which we need to check if interpolation is wanted
888  {
889  // get the flag
890  do_interpolation = m_interpolatePtFlags.at(parameter_number);
891  }
892  return do_interpolation;
893 }

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void *  ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119  {
120 
121 #ifdef XAOD_STANDALONE
122  // In case we use @c xAOD::TEvent, we have a direct function call
123  // for this.
124  return evtStore()->event()->getKey( ptr );
125 #else
126  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127  return ( proxy == nullptr ? 0 : proxy->sgkey() );
128 #endif // XAOD_STANDALONE
129  }

◆ getKinematicProperties()

const StatusCode ElectronPhotonVariableCorrectionBase::getKinematicProperties ( const xAOD::Egamma egamma_object,
float &  pt,
float &  eta,
float &  phi 
) const
private

Get the e/y kinematic properties.

Parameters
egamma_objectThe e/y object to get the kinematic properties of
ptThe pT value is saved in this parameter
etaThe eta value is saved in this parameter

As every electron/photon has different values of pT/eta, the correction function must be adapted accordingly for every e/y. The according values of eta and pt are updated with this function.

Definition at line 424 of file ElectronPhotonVariableCorrectionBase.cxx.

425 {
426  // just retrieving eta and pt is probably less expensive then checking if I need it and
427  // then retrieve it only if I actually need it
428 
429  // protection against bad clusters
430  const xAOD::CaloCluster* cluster = egamma_object.caloCluster();
431  if ( cluster == nullptr )
432  {
433  ATH_MSG_ERROR("EGamma object calorimeter cluster is NULL: Cluster " << cluster);
434  return StatusCode::FAILURE;
435  }
436 
437  // Fill variables
438  // eta position in second sampling
439  eta = cluster->etaBE(2);
440  // transverse energy in calorimeter (using eta position in second sampling)
441  const double energy = cluster->e();
442  double et = 0.;
443  if (eta<999.) {
444  const double cosheta = cosh(eta);
445  et = (cosheta != 0.) ? energy/cosheta : 0.;
446  }
447  pt = et;
448  // issue a warning if pT is unphysical - i.e. < 0
449  if (pt < 0)
450  {
451  ATH_MSG_WARNING("Encountered EGamma object with strange pT: " << pt << " MeV. Correcting as if it has a pT of 0.");
452  }
453  // phi
454  phi = cluster->phiBE(2);
455 
456  // everything went fine, so
457  return StatusCode::SUCCESS;
458 }

◆ getName()

const std::string & asg::AsgTool::getName ( const void *  ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106  {
107 
108 #ifdef XAOD_STANDALONE
109  // In case we use @c xAOD::TEvent, we have a direct function call
110  // for this.
111  return evtStore()->event()->getName( ptr );
112 #else
113  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114  static const std::string dummy = "";
115  return ( proxy == nullptr ? dummy : proxy->name() );
116 #endif // XAOD_STANDALONE
117  }

◆ getObjectFromRootFile()

const StatusCode ElectronPhotonVariableCorrectionBase::getObjectFromRootFile ( TEnv &  env,
const int  parameter_number,
const TString &  filePathKey,
const TString &  nameKey,
std::unique_ptr< TObject > &  return_object 
)
private

Get a TObject storing corrections (i.e.

TGraph or TH2) from a root file

Parameters
envThe configuration file to search for the relevant information (file path, object name)
parameter_numberThe number of the respective parameter, used to display error messages correctly
filePathKeyThe key for finding the file path in env
nameKeyThe key for finding the object name in env
return_objectThe retrieved TObject will be saved in this variable

The TObject with the name matching the key nameKey stored in the file with path matching filePathKey in the configuration file env will be retrieved and saved in return_object.

Definition at line 615 of file ElectronPhotonVariableCorrectionBase.cxx.

616 {
617  // helpers
618  TString filePath = "";
619  TString objectName = "";
620  // check if necessary information is in conf, else fail
621  if (env.Lookup(filePathKey))
622  {
623  //get the path to the root file where the graph is saved
624  filePath = PathResolverFindCalibFile(env.GetValue(filePathKey.Data(),""));
625  // fail if file not found
626  if (filePath == "")
627  {
628  ATH_MSG_ERROR("Could not locate Parameter" << parameter_number << " TObject file.");
629  return StatusCode::FAILURE;
630  }
631  }
632  else
633  {
634  ATH_MSG_ERROR("Could not retrieve Parameter" << parameter_number << " file path.");
635  return StatusCode::FAILURE;
636  }
637  // check if necessary information is in conf, else fail
638  if (env.Lookup(nameKey))
639  {
640  //get the name of the TGraph
641  objectName = env.GetValue(nameKey.Data(),"");
642  }
643  else
644  {
645  ATH_MSG_ERROR("Could not retrieve Parameter" << parameter_number << " object name.");
646  return StatusCode::FAILURE;
647  }
648  // open file, if it works, try to find object, get object, store a copy, else warning + fail
649  std::unique_ptr<TFile> file (new TFile(filePath.Data(),"READ"));
650  // check if file is open - if open, get graph, if not, fail
651  if (file->IsOpen())
652  {
653  // if object exists, get it, else fail
654  if (file->Get(objectName))
655  {
656  return_object = std::unique_ptr<TObject> (file->Get(objectName.Data())->Clone());
657  // need to un-associate THx type objects from file directory, so they remain accessible
658  if (dynamic_cast<TH1*>(return_object.get()) != nullptr)
659  {
660  dynamic_cast<TH1*>(return_object.get())->SetDirectory(nullptr);
661  }
662  file->Close();
663  }
664  else
665  {
666  ATH_MSG_ERROR("Could not find TObject " << objectName << " in file " << filePath);
667  return StatusCode::FAILURE;
668  }
669  }
670  else
671  {
672  ATH_MSG_ERROR("Could not open Parameter" << parameter_number << " TObject file " << filePath.Data());
673  return StatusCode::FAILURE;
674  }
675 
676  // everything went fine, so
677  return StatusCode::SUCCESS;
678 }

◆ getParameterInformationFromConf()

const StatusCode ElectronPhotonVariableCorrectionBase::getParameterInformationFromConf ( TEnv &  env,
const int  parameter_number,
const ElectronPhotonVariableCorrectionBase::parameterType  type 
)
private

Get the relevant information for a correction function parameter from the given conf file.

Parameters
envThe given TEnv, which is used to read out the current conf file
parameter_numberThe parameter number with respect to the m_correctionFunctionTF1
typeThe type of the respective parameter with this parameter_number

The relevant information for the parameter with the given parameter number and given parameter type is retrieved from the current configuration file, and saved in the according member variables of the class, i.e. m_graphCopies, m_binValues, m_etaBins, m_ptBins

Definition at line 460 of file ElectronPhotonVariableCorrectionBase.cxx.

461 {
462  // don't want to write the same code multiple times, so set flags when to retrieve eta/pt bins
463  bool getEtaBins = false;
464  bool getPtBins = false;
465  // form strings according to which parameter to retrieve
466  TString filePathKey = TString::Format("Parameter%dFile",parameter_number);
467  TString graphNameKey = TString::Format("Parameter%dGraphName",parameter_number);
468  TString histNameKey = TString::Format("Parameter%dTH2Name",parameter_number);
469  TString binValues = TString::Format("Parameter%dValues",parameter_number);
470  TString interpolate = TString::Format("Parameter%dInterpolate",parameter_number);
471 
472  // according to the parameter type, retrieve the information from conf
473  switch (type)
474  {
476  // this fallthrough is intentional!
478  { // need to mark scope, since variables are initialized in this case
479  std::unique_ptr<TObject> graph;
480  ATH_CHECK(getObjectFromRootFile(env, parameter_number, filePathKey, graphNameKey, graph));
481  m_graphCopies.at(parameter_number) = (TGraph*)graph.get();
482  }
483  break;
485  //get eta binning later
486  getEtaBins = true;
487  break;
489  //get pt binning later
490  getPtBins = true;
491  break;
493  //get eta and pt binning later
494  getEtaBins = true;
495  getPtBins = true;
496  break;
498  { // need to mark scope, since variables are initialized in this case
499  // Retreive TH2F steering eta x phi corrections
500  std::unique_ptr<TObject> th2;
501  ATH_CHECK(getObjectFromRootFile(env, parameter_number, filePathKey, histNameKey, th2));
502  m_TH2Copies.at(parameter_number) = (TH2*)th2.get();
503  // check and store if this TH2 needs eta or abs(eta) for evaluation
504  // for this, check if lowest bin boundary < 0
505  // bin 0 is the undeflow bin, so use bin 1
506  float lowest_bin_boundary = ((TH2*)th2.get())->GetXaxis()->GetBinLowEdge(1);
507  // the lowest boundary should never be greater than 0! Fail if it is
508  if (lowest_bin_boundary > 0)
509  {
510  ATH_MSG_ERROR("Lowest bin edge in TH2 for parameter " << parameter_number << " is > 0. Please provide the TH2 including corrections either for the positive eta range (starting at 0), or the whole eta range (starting with a negative dummy value which is treated as -infinity.");
511  return StatusCode::FAILURE;
512  }
513  else
514  {
515  // use eta for evaluation of this TH2 if corrections for eta < 0 are in the TH2
516  // store the actual value so it can be used in the TH2 parameter check
517  // (need to make sure the object eta is not smaller than the smallest TH2 bin boundary)
518  m_useAbsEtaTH2.at(parameter_number) = lowest_bin_boundary;
519  }
520  }
521  break;
523  // nothing has to be retrieved, no additional parameters for EventDensity currently
524  return StatusCode::SUCCESS;
525  default:
526  {}//only adding default to omit compile time warnings for not including parameterType::Failure
527  // this case will never occur, since returning this case fails earlier
528  }
529 
530  //get the pt and eta binning from the conf file, if necessary
531  if (getEtaBins || getPtBins)
532  { ATH_CHECK(getEtaPtBinningsFromConf(getEtaBins, getPtBins, binValues, interpolate, env, parameter_number)); }
533 
534  //everything went fine, so
535  return StatusCode::SUCCESS;
536 }

◆ getProperty()

template<class T >
const T* asg::AsgTool::getProperty ( const std::string &  name) const
inherited

Get one of the tool's properties.

◆ getTLSRandomGen()

TRandom3 * ElectronPhotonVariableCorrectionBase::getTLSRandomGen ( unsigned int  seed) const
private

Getting thread safe random number generator (and resetting its seed)

Definition at line 1089 of file ElectronPhotonVariableCorrectionBase.cxx.

1090 {
1091  TRandom3* random = m_TRandom_tls.get();
1092  if (!random) {
1093  random = new TRandom3();
1094  m_TRandom_tls.reset(random);
1095  }
1096  random->SetSeed(seed);
1097  return random;
1098 }

◆ initialize()

StatusCode ElectronPhotonVariableCorrectionBase::initialize ( )
overridevirtual

Initialize the class instance.

Reads out the configuration file set via the setProperty(ConfigFile, "/path/to/conf/file.conf") function and sets up the class instance accordingly

Reimplemented from asg::AsgTool.

Definition at line 47 of file ElectronPhotonVariableCorrectionBase.cxx.

48 {
49  // Locate configuration file, abort if not found
50  std::string configFile;
51  if (!m_configFile.empty())
52  {
54  if (configFile.empty())
55  {
56  ATH_MSG_ERROR("Could not locate configuration file " << m_configFile);
57  return StatusCode::FAILURE;
58  }
59  ATH_MSG_DEBUG("Use configuration file " << m_configFile << " " << configFile);
60  }
61  else
62  {
63  ATH_MSG_ERROR("Config file string is empty. Please provide a config file to the tool.");
64  return StatusCode::FAILURE;
65  }
66 
67  // retrieve properties from configuration file, using TEnv class
68  TEnv env;
69  env.ReadFile(configFile.c_str(), kEnvLocal);
70  // Send warning if duplicates found in conf file
71  env.IgnoreDuplicates(false);
72 
73  //retrieve variable to correct
74  if (env.Lookup("Variable"))
75  {
76  m_correctionVariable = env.GetValue("Variable","");
77  }
78  else
79  {
80  ATH_MSG_ERROR("Correction variable is empty or not in configuration file.");
81  return StatusCode::FAILURE;
82  }
83 
84  // initialize the variable aux element accessors
85  // variable to be corrected
86  m_variableToCorrect = std::make_unique<SG::AuxElement::Accessor<float>>(m_correctionVariable);
87  // save original value under different name
88  m_originalVariable = std::make_unique<SG::AuxElement::Accessor<float>>(m_correctionVariable + "_original");
89 
90  // Get whether to apply a pure correction or to smear the variable (shift by a random amount,
91  // determined using function as probability density function)
92  if (env.Lookup("doGaussianSmearing"))
93  {
94  m_doGaussianSmearing = env.GetValue("doGaussianSmearing", false); // Default is to not do smearing - keeps previous configs valid
95  }
96  // Get the function used to correct the variable
97  if (env.Lookup("Function"))
98  {
99  m_correctionFunctionString = env.GetValue("Function","failure");
100  // initialize the actual correction function TFormula
101  m_correctionFunctionTFormula = std::make_unique<TFormula>("m_correctionFunctionTF1",m_correctionFunctionString.c_str(), false);
102  }
103  else
104  {
105  ATH_MSG_ERROR("Correction function is empty or not in configuration file.");
106  return StatusCode::FAILURE;
107  }
108 
109  // Get the number of parameters used in the correction function
110  if (env.Lookup("nFunctionParameters"))
111  {
112  m_numberOfFunctionParameters = env.GetValue("nFunctionParameters",-1);
113 
114  // If doing the Gaussian smearing, there can only be two parameters
115  // so fail if there is more or less than this
117  {
118  ATH_MSG_ERROR("When using Gaussian smearing, there can only be two " <<
119  "function parameters, the Gaussian mean and the Gaussian width");
120  return StatusCode::FAILURE;
121  }
122 
123  }
124  else
125  {
126  ATH_MSG_ERROR("You did not specify the number of parameters in the correction function.");
127  return StatusCode::FAILURE;
128  }
129 
130  // resize all vectors used for getting parameters to m_numberOfFunctionParameters
137 
138  // Save the type of all parameters in the correction function (assuming m_numberOfFunctionParameters parameters)
139  for (int parameter_itr = 0; parameter_itr < m_numberOfFunctionParameters; parameter_itr++)
140  {
141  // if the parameter #parameter_itr is in the conf file, save its type
142  TString parameterType = TString::Format("Parameter%dType",parameter_itr);
143  if (env.Lookup(parameterType))
144  {
145  // convert string to ParameterType, fail if non-existing type
148  {
149  ATH_MSG_ERROR("Parameter " << parameter_itr << " read-in failed, not an allowed parameter type.");
150  return StatusCode::FAILURE;
151  }
152  // save type, get according type information and save it
153  m_ParameterTypeVector.at(parameter_itr) = type;
155  }
156  // else fail
157  else
158  {
159  ATH_MSG_ERROR("Did not find Parameter" << parameter_itr << ", although you specified there were " << m_numberOfFunctionParameters << " parameters for the correction function.");
160  return StatusCode::FAILURE;
161  }
162  } // end loop over all function parameters
163 
164  // check to which EGamma object the conf file should be applied to, if flag is set
165  if (env.Lookup("ApplyTo"))
166  {
167  std::string applyToObjectsFlag = env.GetValue("ApplyTo","Failure");
168  m_applyToObjects = stringToEGammaObject(applyToObjectsFlag);
169  // fail if not passed a proper type
171  {
172  ATH_MSG_ERROR("You did not correctly specify the object type in the ApplyTo flag.");
173  return StatusCode::FAILURE;
174  }
175  }
176  // else fail
177  else
178  {
179  ATH_MSG_ERROR("You did not specify to which objects this conf file should be applied to (ApplyTo).");
180  return StatusCode::FAILURE;
181  }
182 
183  // check if there are any (discrete) values which should be left uncorrected
184  if (env.Lookup("UncorrectedDiscontinuities"))
185  {
186  m_uncorrectedDiscontinuities = AsgConfigHelper::HelperFloat("UncorrectedDiscontinuities", env);
187  // if flag is given, but no values, fail
188  if (m_uncorrectedDiscontinuities.empty())
189  {
190  ATH_MSG_ERROR("Did not find any discontinuities to not correct, despite finding the flag UncorrectedDiscontinuities.");
191  return StatusCode::FAILURE;
192  }
193  }
194 
195  //everything worked out, so
196  return StatusCode::SUCCESS;
197 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interpolate()

const StatusCode ElectronPhotonVariableCorrectionBase::interpolate ( float &  return_parameter_value,
const float  evalPoint,
const int  bin,
const std::vector< float > &  binning,
const std::vector< float > &  binValues 
) const
private

Given a point x, approximates the value via linear interpolation based on the two nearest bin centers.

Re-implementation of Double_t TH1::Interpolate( Double_t x) const.

Parameters
return_parameter_valueThe interpolated parameter value is saved in this parameter
evalPointThe point for which the interpolation should be done
binThe bin in which the evalPoint is located with respect to binning
binningThe binning based on which the interpolation should be done
binValuesThe bin values according to the binning given in binning

Definition at line 895 of file ElectronPhotonVariableCorrectionBase.cxx.

896 {
897  // check if passed binning is consistent
898  if (binning.size() != binValues.size())
899  {
900  ATH_MSG_ERROR("Binning and bin values have different sizes.");
901  return StatusCode::FAILURE;
902  }
903 
904  // if evalPoint is left to the leftmost bin center, return the leftmost bin center without interpolation
905  float leftmost_bin_center = 0;
906  ANA_CHECK(getBinCenter(leftmost_bin_center, binning, 0));
907  if (evalPoint <= leftmost_bin_center)
908  {
909  return_parameter_value = binValues.at(0);
910  return StatusCode::SUCCESS;
911  }
912 
913  // if evalPoint is right to the rightmost bin center, return the rightmost bin center without interpolation
914  float rightmost_bin_center = 0;
915  ANA_CHECK(getBinCenter(rightmost_bin_center, binning, binning.size()-1))
916  if (evalPoint >= rightmost_bin_center)
917  {
918  return_parameter_value = binValues.at(binValues.size()-1);
919  return StatusCode::SUCCESS;
920  }
921 
922  float left_bin_center = 0;
923  float right_bin_center = 0;
924  float left_bin_value = 0;
925  float right_bin_value = 0;
926  float current_bin_center = 0;
927  ANA_CHECK(getBinCenter(current_bin_center, binning, bin));
928 
929  // else interpolate using next left or next right bin
930  if (evalPoint <= current_bin_center)
931  {
932  //interpolate left
933  ANA_CHECK(getBinCenter(left_bin_center, binning, bin-1));
934  ANA_CHECK(getBinCenter(right_bin_center, binning, bin));
935  left_bin_value = binValues.at(bin-1);
936  right_bin_value = binValues.at(bin);
937  }
938  else // evalPoint is right from bin center
939  {
940  //interpolate right
941  ANA_CHECK(getBinCenter(left_bin_center, binning, bin));
942  ANA_CHECK(getBinCenter(right_bin_center, binning, bin+1));
943  left_bin_value = binValues.at(bin);
944  right_bin_value = binValues.at(bin+1);
945  }
946  ATH_MSG_VERBOSE("bin centers : " << left_bin_center << " " << right_bin_center << " current : " << current_bin_center << " values : " << left_bin_value << " " << right_bin_value);
947 
948  // calculate return value
949  return_parameter_value = interpolate_function(evalPoint, left_bin_center, left_bin_value, right_bin_center, right_bin_value);
950 
951  // everything went fine, so
952  return StatusCode::SUCCESS;
953 }

◆ interpolate_function()

float ElectronPhotonVariableCorrectionBase::interpolate_function ( const float  value,
const float  left_bin_center,
const float  left_bin_value,
const float  right_bin_center,
const float  right_bin_value 
)
staticprivate

Returns the linearly intrpolated value of value given the bin centers and bin values.

Parameters
valueThe x-value at which the interpolation should be done
left_bin_centerThe x-value of the left bin center used for the interpolation
left_bin_valueThe y-value of the left bin at the left bin center
right_bin_centerThe x-value of the right bin center used for the interpolation
right_bin_valueThe y-value of the right bin at the right bin center

Definition at line 991 of file ElectronPhotonVariableCorrectionBase.cxx.

992 {
993  return left_bin_value + (value - left_bin_center) * (right_bin_value - left_bin_value) / (right_bin_center - left_bin_center);
994 }

◆ isAppliedTo()

ElectronPhotonVariableCorrectionBase::EGammaObjects ElectronPhotonVariableCorrectionBase::isAppliedTo ( )
inline

Returns the type of EGamma object to which the correction should be applied.

Definition at line 112 of file ElectronPhotonVariableCorrectionBase.h.

112 { return m_applyToObjects; };

◆ isEqualToUncorrectedDiscontinuity()

bool ElectronPhotonVariableCorrectionBase::isEqualToUncorrectedDiscontinuity ( const float  value) const
private

Check if the value passed is equal to one of the values passed via the UncorrectedDiscontinuites flag and should thus not be corrected.

Parameters
valueThe value which should be checked

Definition at line 403 of file ElectronPhotonVariableCorrectionBase.cxx.

404 {
405  // if no values set, return false as there is nothing to check
406  if (m_uncorrectedDiscontinuities.empty())
407  {
408  return false;
409  }
410 
411  // check all discontinuities which where passed
412  for (unsigned int value_itr = 0; value_itr < m_uncorrectedDiscontinuities.size(); value_itr++)
413  {
414  if (value == m_uncorrectedDiscontinuities.at(value_itr))
415  {
416  // if the value is equal to one of the discontinuities, no need to check further
417  return true;
418  }
419  }
420  // if we eer get here, the value was never equal to a discontinuity
421  return false;
422 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101  {
102 
103  return MSG::name( msg().level() );
104  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ passedCorrectPhotonType()

bool ElectronPhotonVariableCorrectionBase::passedCorrectPhotonType ( const xAOD::Photon photon) const
private

Check if the photon which was passed to the tool has the correct type, if only (un)converted photons were requested to be corrected.

Parameters
photonThe photon which was passed to the tool to be corrected

Definition at line 1055 of file ElectronPhotonVariableCorrectionBase.cxx.

1056 {
1057  // retrieve if photon is converted or unconverted
1059  bool isUnconvertedPhoton = !isConvertedPhoton;
1060 
1061  // check if conf file ApplyTo flag matches photon conversion type
1062  return ((applyToConvertedPhotons() && isConvertedPhoton) || (applyToUnconvertedPhotons() && isUnconvertedPhoton));
1063 }

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ stringToEGammaObject()

ElectronPhotonVariableCorrectionBase::EGammaObjects ElectronPhotonVariableCorrectionBase::stringToEGammaObject ( const std::string &  input) const
private

Convert input string to egamma object type.

Parameters
inputThe string to convert to ElectronPhotonVariableCorrectionBase::EGammaObjects
Returns
ElectronPhotonVariableCorrectionBase::EGammaObjects, returns ElectronPhotonVariableCorrectionBase::EGammaObjects::Failure if no match found

Definition at line 1034 of file ElectronPhotonVariableCorrectionBase.cxx.

1035 {
1036  // return object type which correction should be applied to
1037  if( input == "unconvertedPhotons" )
1039  else if( input == "convertedPhotons" )
1041  else if( input == "allPhotons" )
1043  else if( input == "allElectrons" )
1045  else if( input == "allEGammaObjects" )
1047  else
1048  {
1049  // if not a proper object type, return failure type - check and fail on this!
1050  ATH_MSG_ERROR(input.c_str() << " is not an allowed EGamma object type to apply corrections to.");
1052  }
1053 }

◆ stringToParameterType()

ElectronPhotonVariableCorrectionBase::parameterType ElectronPhotonVariableCorrectionBase::stringToParameterType ( const std::string &  input) const
private

Convert input string to a parameter function type.

Parameters
inputThe string to convert to ElectronPhotonVariableCorrectionBase::parameterType
Returns
ElectronPhotonVariableCorrectionBase::parameterType, returns ElectronPhotonVariableCorrectionBase::parameterType::Failure if no match found

Definition at line 1009 of file ElectronPhotonVariableCorrectionBase.cxx.

1010 {
1011  // return parameter type according to string given in conf file
1012  if( input == "EtaDependentTGraph")
1014  else if( input == "PtDependentTGraph")
1016  else if( input == "EtaBinned")
1018  else if( input == "PtBinned")
1020  else if( input == "EtaTimesPtBinned")
1022  else if( input == "EtaTimesPhiTH2")
1024  else if( input == "EventDensity")
1026  else
1027  {
1028  // if not a proper type, return failure type - check and fail on this!
1029  ATH_MSG_ERROR(input.c_str() << " is not an allowed parameter type.");
1031  }
1032 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_applyToObjects

ElectronPhotonVariableCorrectionBase::EGammaObjects ElectronPhotonVariableCorrectionBase::m_applyToObjects {}
private

The type of objects to which the specific conf file settings are allowed to be applied to.

Definition at line 176 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_binValues

std::vector<std::vector<float> > ElectronPhotonVariableCorrectionBase::m_binValues
private

List of eta/pt dependent values, stored if needed by the respective correction function parameter.

Definition at line 166 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_configFile

std::string ElectronPhotonVariableCorrectionBase::m_configFile
private

The name of the configuration file.

Definition at line 142 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_correctionFunctionString

std::string ElectronPhotonVariableCorrectionBase::m_correctionFunctionString
private

Function to use for the variable correction, TFormula style.

Definition at line 152 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_correctionFunctionTFormula

std::unique_ptr<TFormula> ElectronPhotonVariableCorrectionBase::m_correctionFunctionTFormula
private

The actual TFormula correction function.

Definition at line 154 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_correctionVariable

std::string ElectronPhotonVariableCorrectionBase::m_correctionVariable
private

The name of the variable to correct.

Definition at line 144 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doGaussianSmearing

bool ElectronPhotonVariableCorrectionBase::m_doGaussianSmearing = false
private

Whether to apply normal correction or smearing correction.

Definition at line 146 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_etaBins

std::vector<float> ElectronPhotonVariableCorrectionBase::m_etaBins
private

List of bin boundaries in eta, stored if needed by any correction function parameter.

Definition at line 168 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_graphCopies

std::vector<TGraph*> ElectronPhotonVariableCorrectionBase::m_graphCopies
private

Copy of the TGraph from the root file, stored if needed by the respective correction function parameter.

Definition at line 160 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_interpolatePtFlags

std::vector<bool> ElectronPhotonVariableCorrectionBase::m_interpolatePtFlags
private

List of bools whether a parameter should use linear interpolation in pT if it's some kind of pT binned parameter.

Definition at line 174 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_numberOfFunctionParameters

int ElectronPhotonVariableCorrectionBase::m_numberOfFunctionParameters {}
private

Number of parameters of the variable correction function.

Definition at line 156 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_originalVariable

std::unique_ptr<SG::AuxElement::Accessor<float> > ElectronPhotonVariableCorrectionBase::m_originalVariable
private

Accessor to store the original value of the corrected variable.

Definition at line 184 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_ParameterTypeVector

std::vector<parameterType> ElectronPhotonVariableCorrectionBase::m_ParameterTypeVector
private

Map of the correction function parameter number to the parameter type.

Definition at line 158 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_ptBins

std::vector<float> ElectronPhotonVariableCorrectionBase::m_ptBins
private

List of bin boundaries in pT, stored if needed by any correction function parameter.

Definition at line 172 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_retrievedEtaBinning

bool ElectronPhotonVariableCorrectionBase::m_retrievedEtaBinning = false
private

Store if already retrieved eta binning.

Definition at line 178 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_retrievedPtBinning

bool ElectronPhotonVariableCorrectionBase::m_retrievedPtBinning = false
private

Store if already retrieved pt binning.

Definition at line 180 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_TH2Copies

std::vector<TH2*> ElectronPhotonVariableCorrectionBase::m_TH2Copies
private

Copy of the TH2 from the root file, stored if needed by the respective correction function parameter.

Definition at line 162 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_TRandom_tls

boost::thread_specific_ptr<TRandom3> ElectronPhotonVariableCorrectionBase::m_TRandom_tls
mutableprivate

thread-safe TRandom3 for setting seed of random smearing correction

Definition at line 148 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_uncorrectedDiscontinuities

std::vector<float> ElectronPhotonVariableCorrectionBase::m_uncorrectedDiscontinuities
private

Values of discontinuities in the variable which should not be corrected.

Definition at line 150 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_useAbsEtaBinned

bool ElectronPhotonVariableCorrectionBase::m_useAbsEtaBinned {}
private

Store if the eta binned parameters need the eta or abs(eta) value for evaluation.

Definition at line 170 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_useAbsEtaTH2

std::vector<float> ElectronPhotonVariableCorrectionBase::m_useAbsEtaTH2
private

Store the lowest eta bin boundary: used for checking if the respective TH2 needs the eta or abs(eta) value for evaluation.

Definition at line 164 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_variableToCorrect

std::unique_ptr<SG::AuxElement::Accessor<float> > ElectronPhotonVariableCorrectionBase::m_variableToCorrect
private

Accessor for the variable to be corrected.

Definition at line 182 of file ElectronPhotonVariableCorrectionBase.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::EventShape_v1::getDensity
bool getDensity(EventDensityID id, double &v) const
Get a density variable from the object.
Definition: EventShape_v1.cxx:135
ElectronPhotonVariableCorrectionBase::m_uncorrectedDiscontinuities
std::vector< float > m_uncorrectedDiscontinuities
Values of discontinuities in the variable which should not be corrected.
Definition: ElectronPhotonVariableCorrectionBase.h:150
ElectronPhotonVariableCorrectionBase::applyToConvertedPhotons
bool applyToConvertedPhotons() const
Check if the ApplyTo flag passed in the conf file is compatible with converted photons.
Definition: ElectronPhotonVariableCorrectionBase.cxx:1065
ElectronPhotonVariableCorrectionBase::getKinematicProperties
const StatusCode getKinematicProperties(const xAOD::Egamma &egamma_object, float &pt, float &eta, float &phi) const
Get the e/y kinematic properties.
Definition: ElectronPhotonVariableCorrectionBase.cxx:424
et
Extra patterns decribing particle interation process.
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
AddEmptyComponent.binning
binning
Definition: AddEmptyComponent.py:34
taskman.configFile
configFile
Definition: taskman.py:311
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ElectronPhotonVariableCorrectionBase::m_ParameterTypeVector
std::vector< parameterType > m_ParameterTypeVector
Map of the correction function parameter number to the parameter type.
Definition: ElectronPhotonVariableCorrectionBase.h:158
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
python.TestDriveDummies.properties
dictionary properties
Definition: TestDriveDummies.py:14
ElectronPhotonVariableCorrectionBase::applyCorrection
const CP::CorrectionCode applyCorrection(xAOD::Photon &photon) const
Apply the correction given in the conf file to the passed photon.
Definition: ElectronPhotonVariableCorrectionBase.cxx:202
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
ElectronPhotonVariableCorrectionBase::m_interpolatePtFlags
std::vector< bool > m_interpolatePtFlags
List of bools whether a parameter should use linear interpolation in pT if it's some kind of pT binne...
Definition: ElectronPhotonVariableCorrectionBase.h:174
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CheckAppliedSFs.bin_width
bin_width
Definition: CheckAppliedSFs.py:242
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
ElectronPhotonVariableCorrectionBase::applyToElectrons
bool applyToElectrons() const
Check if the ApplyTo flag passed in the conf file is compatible with electrons.
Definition: ElectronPhotonVariableCorrectionBase.cxx:1081
test_pyathena.pt
pt
Definition: test_pyathena.py:11
ElectronPhotonVariableCorrectionBase::correct
void correct(float &return_corrected_variable, const float original_variable, const std::vector< float > &properties, unsigned int rndSeed=0) const
Actual application of the correction to the variable.
Definition: ElectronPhotonVariableCorrectionBase.cxx:347
bin
Definition: BinsDiffFromStripMedian.h:43
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
athena.value
value
Definition: athena.py:124
ElectronPhotonVariableCorrectionBase::m_applyToObjects
ElectronPhotonVariableCorrectionBase::EGammaObjects m_applyToObjects
The type of objects to which the specific conf file settings are allowed to be applied to.
Definition: ElectronPhotonVariableCorrectionBase.h:176
ElectronPhotonVariableCorrectionBase::findBin
static const StatusCode findBin(int &return_bin, const float evalPoint, const std::vector< float > &binning)
Find the bin number in which the evalPoint is located in the binning binning.
Definition: ElectronPhotonVariableCorrectionBase.cxx:845
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
ElectronPhotonVariableCorrectionBase::getDensity
const StatusCode getDensity(float &value, const std::string &eventShapeContainer) const
Get the events energy density from the eventShape.
Definition: ElectronPhotonVariableCorrectionBase.cxx:996
xAOD::CaloCluster_v1::phiBE
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:680
ElectronPhotonVariableCorrectionBase::EGammaObjects::allElectrons
@ allElectrons
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ElectronPhotonVariableCorrectionBase::m_retrievedEtaBinning
bool m_retrievedEtaBinning
Store if already retrieved eta binning.
Definition: ElectronPhotonVariableCorrectionBase.h:178
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
ElectronPhotonVariableCorrectionBase::parameterType::EtaBinned
@ EtaBinned
x
#define x
ElectronPhotonVariableCorrectionBase::interpolate
const StatusCode interpolate(float &return_parameter_value, const float evalPoint, const int bin, const std::vector< float > &binning, const std::vector< float > &binValues) const
Given a point x, approximates the value via linear interpolation based on the two nearest bin centers...
Definition: ElectronPhotonVariableCorrectionBase.cxx:895
ElectronPhotonVariableCorrectionBase::parameterType::EtaDependentTGraph
@ EtaDependentTGraph
ElectronPhotonVariableCorrectionBase::m_useAbsEtaBinned
bool m_useAbsEtaBinned
Store if the eta binned parameters need the eta or abs(eta) value for evaluation.
Definition: ElectronPhotonVariableCorrectionBase.h:170
ElectronPhotonVariableCorrectionBase::m_numberOfFunctionParameters
int m_numberOfFunctionParameters
Number of parameters of the variable correction function.
Definition: ElectronPhotonVariableCorrectionBase.h:156
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
xAOD::EventShape_v1::Density
@ Density
Definition: EventShape_v1.h:47
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:644
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
ElectronPhotonVariableCorrectionBase::m_binValues
std::vector< std::vector< float > > m_binValues
List of eta/pt dependent values, stored if needed by the respective correction function parameter.
Definition: ElectronPhotonVariableCorrectionBase.h:166
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ElectronPhotonVariableCorrectionBase::parameterType
parameterType
Use enum and not string for type of function parameter in order to do faster comparisons.
Definition: ElectronPhotonVariableCorrectionBase.h:131
ElectronPhotonVariableCorrectionBase::parameterType::EtaTimesPhiTH2
@ EtaTimesPhiTH2
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition: AsgTool.cxx:58
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
ElectronPhotonVariableCorrectionBase::parameterType::EtaTimesPtBinned
@ EtaTimesPtBinned
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::EgammaHelpers::isConvertedPhoton
bool isConvertedPhoton(const xAOD::Egamma *eg, bool excludeTRT=false)
is the object a converted photon
Definition: EgammaxAODHelpers.cxx:25
ElectronPhotonVariableCorrectionBase::parameterType::PtDependentTGraph
@ PtDependentTGraph
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ElectronPhotonVariableCorrectionBase::stringToEGammaObject
ElectronPhotonVariableCorrectionBase::EGammaObjects stringToEGammaObject(const std::string &input) const
Convert input string to egamma object type.
Definition: ElectronPhotonVariableCorrectionBase.cxx:1034
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
ElectronPhotonVariableCorrectionBase::EGammaObjects::convertedPhotons
@ convertedPhotons
ElectronPhotonVariableCorrectionBase::m_graphCopies
std::vector< TGraph * > m_graphCopies
Copy of the TGraph from the root file, stored if needed by the respective correction function paramet...
Definition: ElectronPhotonVariableCorrectionBase.h:160
ElectronPhotonVariableCorrectionBase::get2DHistParameter
const StatusCode get2DHistParameter(float &return_parameter_value, const float etaEvalPoint, const float phiEvalPoint, const int parameter_number) const
Get the correction function parameter value if its type is eta- and pT-binned.
Definition: ElectronPhotonVariableCorrectionBase.cxx:824
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
xAOD::Egamma_v1::caloCluster
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
Definition: Egamma_v1.cxx:388
ElectronPhotonVariableCorrectionBase::m_correctionFunctionString
std::string m_correctionFunctionString
Function to use for the variable correction, TFormula style.
Definition: ElectronPhotonVariableCorrectionBase.h:152
file
TFile * file
Definition: tile_monitor.h:29
ElectronPhotonVariableCorrectionBase::m_configFile
std::string m_configFile
The name of the configuration file.
Definition: ElectronPhotonVariableCorrectionBase.h:142
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ElectronPhotonVariableCorrectionBase::get2DBinnedParameter
const StatusCode get2DBinnedParameter(float &return_parameter_value, const float etaEvalPoint, const float ptEvalPoint, const int parameter_number) const
Get the correction function parameter value if its type is eta- and pT-binned.
Definition: ElectronPhotonVariableCorrectionBase.cxx:773
ElectronPhotonVariableCorrectionBase::getObjectFromRootFile
const StatusCode getObjectFromRootFile(TEnv &env, const int parameter_number, const TString &filePathKey, const TString &nameKey, std::unique_ptr< TObject > &return_object)
Get a TObject storing corrections (i.e.
Definition: ElectronPhotonVariableCorrectionBase.cxx:615
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
ElectronPhotonVariableCorrectionBase::m_etaBins
std::vector< float > m_etaBins
List of bin boundaries in eta, stored if needed by any correction function parameter.
Definition: ElectronPhotonVariableCorrectionBase.h:168
ElectronPhotonVariableCorrectionBase::EGammaObjects::Failure
@ Failure
ElectronPhotonVariableCorrectionBase::get1DBinnedParameter
const StatusCode get1DBinnedParameter(float &return_parameter_value, const float evalPoint, const std::vector< float > &binning, const int parameter_number) const
Get the correction function parameter value if its type is eta- or pT-binned.
Definition: ElectronPhotonVariableCorrectionBase.cxx:751
xAOD::EventShape_v1
Data class for event shapes.
Definition: EventShape_v1.h:28
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
ElectronPhotonVariableCorrectionBase::m_variableToCorrect
std::unique_ptr< SG::AuxElement::Accessor< float > > m_variableToCorrect
Accessor for the variable to be corrected.
Definition: ElectronPhotonVariableCorrectionBase.h:182
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
ANA_MSG_VERBOSE
#define ANA_MSG_VERBOSE(xmsg)
Macro printing verbose messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:286
hancool.filePath
string filePath
Definition: hancool.py:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ElectronPhotonVariableCorrectionBase::getInterpolationFlag
bool getInterpolationFlag(const int parameter_number) const
Return the interpolation flag of parameter parameter_number as a boolean.
Definition: ElectronPhotonVariableCorrectionBase.cxx:881
RCU::SetDirectory
bool SetDirectory(TObject *object, TDirectory *directory)
effects: set the directory this object is associated with returns: whether the object type actively k...
Definition: RootUtils.cxx:28
ElectronPhotonVariableCorrectionBase::m_correctionFunctionTFormula
std::unique_ptr< TFormula > m_correctionFunctionTFormula
The actual TFormula correction function.
Definition: ElectronPhotonVariableCorrectionBase.h:154
ElectronPhotonVariableCorrectionBase::m_ptBins
std::vector< float > m_ptBins
List of bin boundaries in pT, stored if needed by any correction function parameter.
Definition: ElectronPhotonVariableCorrectionBase.h:172
ElectronPhotonVariableCorrectionBase::parameterType::PtBinned
@ PtBinned
ElectronPhotonVariableCorrectionBase::m_doGaussianSmearing
bool m_doGaussianSmearing
Whether to apply normal correction or smearing correction.
Definition: ElectronPhotonVariableCorrectionBase.h:146
ElectronPhotonVariableCorrectionBase::m_TH2Copies
std::vector< TH2 * > m_TH2Copies
Copy of the TH2 from the root file, stored if needed by the respective correction function parameter.
Definition: ElectronPhotonVariableCorrectionBase.h:162
ElectronPhotonVariableCorrectionBase::m_TRandom_tls
boost::thread_specific_ptr< TRandom3 > m_TRandom_tls
thread-safe TRandom3 for setting seed of random smearing correction
Definition: ElectronPhotonVariableCorrectionBase.h:148
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
ElectronPhotonVariableCorrectionBase::getEtaPtBinningsFromConf
const StatusCode getEtaPtBinningsFromConf(const bool getEtaBins, const bool getPtBins, const TString &binValues, const TString &interpolate, TEnv &env, const int parameter_number)
Get the eta and pt binning as well as the respective correction values from the given conf file.
Definition: ElectronPhotonVariableCorrectionBase.cxx:538
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
ElectronPhotonVariableCorrectionBase::parameterType::Failure
@ Failure
ElectronPhotonVariableCorrectionBase::getBinCenter
const StatusCode getBinCenter(float &return_bin_center, const std::vector< float > &binning, const int bin_int) const
Get the bin center of a bin bin_int using the binning binning.
Definition: ElectronPhotonVariableCorrectionBase.cxx:955
ElectronPhotonVariableCorrectionBase::m_retrievedPtBinning
bool m_retrievedPtBinning
Store if already retrieved pt binning.
Definition: ElectronPhotonVariableCorrectionBase.h:180
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:199
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ElectronPhotonVariableCorrectionBase::stringToParameterType
ElectronPhotonVariableCorrectionBase::parameterType stringToParameterType(const std::string &input) const
Convert input string to a parameter function type.
Definition: ElectronPhotonVariableCorrectionBase.cxx:1009
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
xAOD::EgammaParameters::electron
@ electron
Definition: EgammaEnums.h:18
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
ElectronPhotonVariableCorrectionBase::isEqualToUncorrectedDiscontinuity
bool isEqualToUncorrectedDiscontinuity(const float value) const
Check if the value passed is equal to one of the values passed via the UncorrectedDiscontinuites flag...
Definition: ElectronPhotonVariableCorrectionBase.cxx:403
xAOD::eProbabilityHT
@ eProbabilityHT
Electron probability from High Threshold (HT) information [float].
Definition: TrackingPrimitives.h:301
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
ElectronPhotonVariableCorrectionBase::EGammaObjects::allEGammaObjects
@ allEGammaObjects
ElectronPhotonVariableCorrectionBase::m_useAbsEtaTH2
std::vector< float > m_useAbsEtaTH2
Store the lowest eta bin boundary: used for checking if the respective TH2 needs the eta or abs(eta) ...
Definition: ElectronPhotonVariableCorrectionBase.h:164
ElectronPhotonVariableCorrectionBase::parameterType::EventDensity
@ EventDensity
ElectronPhotonVariableCorrectionBase::getCorrectionParameters
const StatusCode getCorrectionParameters(const float pt, const float eta, const float ph, std::vector< float > &properties) const
Get the actual parameters of the TF1 function used for the current e/y object to be corrected.
Definition: ElectronPhotonVariableCorrectionBase.cxx:681
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
ElectronPhotonVariableCorrectionBase::passedCorrectPhotonType
bool passedCorrectPhotonType(const xAOD::Photon &photon) const
Check if the photon which was passed to the tool has the correct type, if only (un)converted photons ...
Definition: ElectronPhotonVariableCorrectionBase.cxx:1055
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ElectronPhotonVariableCorrectionBase::getTLSRandomGen
TRandom3 * getTLSRandomGen(unsigned int seed) const
Getting thread safe random number generator (and resetting its seed)
Definition: ElectronPhotonVariableCorrectionBase.cxx:1089
ElectronPhotonVariableCorrectionBase::m_correctionVariable
std::string m_correctionVariable
The name of the variable to correct.
Definition: ElectronPhotonVariableCorrectionBase.h:144
AsgConfigHelper::HelperFloat
std::vector< float > HelperFloat(const std::string &input, TEnv &env)
Definition: AsgEGammaConfigHelper.cxx:110
python.DataFormatRates.env
env
Definition: DataFormatRates.py:32
SG::DataProxy
Definition: DataProxy.h:45
ElectronPhotonVariableCorrectionBase::EGammaObjects::allPhotons
@ allPhotons
ElectronPhotonVariableCorrectionBase::m_originalVariable
std::unique_ptr< SG::AuxElement::Accessor< float > > m_originalVariable
Accessor to store the original value of the corrected variable.
Definition: ElectronPhotonVariableCorrectionBase.h:184
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
fitman.k
k
Definition: fitman.py:528
ElectronPhotonVariableCorrectionBase::getParameterInformationFromConf
const StatusCode getParameterInformationFromConf(TEnv &env, const int parameter_number, const ElectronPhotonVariableCorrectionBase::parameterType type)
Get the relevant information for a correction function parameter from the given conf file.
Definition: ElectronPhotonVariableCorrectionBase.cxx:460
ElectronPhotonVariableCorrectionBase::interpolate_function
static float interpolate_function(const float value, const float left_bin_center, const float left_bin_value, const float right_bin_center, const float right_bin_value)
Returns the linearly intrpolated value of value given the bin centers and bin values.
Definition: ElectronPhotonVariableCorrectionBase.cxx:991
ElectronPhotonVariableCorrectionBase::applyToUnconvertedPhotons
bool applyToUnconvertedPhotons() const
Check if the ApplyTo flag passed in the conf file is compatible with uconverted photons.
Definition: ElectronPhotonVariableCorrectionBase.cxx:1073
ElectronPhotonVariableCorrectionBase::EGammaObjects::unconvertedPhotons
@ unconvertedPhotons