|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef ElectronPhotonVariableCorrectionBase_H
6 #define ElectronPhotonVariableCorrectionBase_H
233 const StatusCode getObjectFromRootFile(TEnv&
env,
const int parameter_number,
const TString& filePathKey,
const TString& nameKey, std::unique_ptr<TObject>& return_object);
260 const StatusCode get2DBinnedParameter(
float& return_parameter_value,
const float etaEvalPoint,
const float ptEvalPoint,
const int parameter_number)
const;
268 const StatusCode get2DHistParameter(
float& return_parameter_value,
const float etaEvalPoint,
const float phiEvalPoint,
const int parameter_number)
const;
290 const StatusCode interpolate(
float& return_parameter_value,
const float evalPoint,
const int bin,
const std::vector<float>&
binning,
const std::vector<float>& binValues)
const;
306 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) ;
329 void correct(
float& return_corrected_variable,
const float original_variable,
330 const std::vector<float>&
properties,
unsigned int rndSeed = 0)
const;
std::vector< float > m_uncorrectedDiscontinuities
Values of discontinuities in the variable which should not be corrected.
bool applyToConvertedPhotons() const
Check if the ApplyTo flag passed in the conf file is compatible with converted photons.
const StatusCode getKinematicProperties(const xAOD::Egamma &egamma_object, float &pt, float &eta, float &phi) const
Get the e/y kinematic properties.
virtual StatusCode initialize() override
Initialize the class instance.
std::vector< parameterType > m_ParameterTypeVector
Map of the correction function parameter number to the parameter type.
Scalar phi() const
phi method
const CP::CorrectionCode applyCorrection(xAOD::Photon &photon) const
Apply the correction given in the conf file to the passed photon.
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...
Scalar eta() const
pseudorapidity method
bool applyToElectrons() const
Check if the ApplyTo flag passed in the conf file is compatible with electrons.
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.
ElectronPhotonVariableCorrectionBase::EGammaObjects m_applyToObjects
The type of objects to which the specific conf file settings are allowed to be applied to.
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.
const StatusCode getDensity(float &value, const std::string &eventShapeContainer) const
Get the events energy density from the eventShape.
bool m_retrievedEtaBinning
Store if already retrieved eta binning.
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...
bool m_useAbsEtaBinned
Store if the eta binned parameters need the eta or abs(eta) value for evaluation.
int m_numberOfFunctionParameters
Number of parameters of the variable correction function.
~ElectronPhotonVariableCorrectionBase()
Standard destructor.
std::vector< std::vector< float > > m_binValues
List of eta/pt dependent values, stored if needed by the respective correction function parameter.
parameterType
Use enum and not string for type of function parameter in order to do faster comparisons.
ElectronPhotonVariableCorrectionBase::EGammaObjects stringToEGammaObject(const std::string &input) const
Convert input string to egamma object type.
std::vector< TGraph * > m_graphCopies
Copy of the TGraph from the root file, stored if needed by the respective correction function paramet...
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.
::StatusCode StatusCode
StatusCode definition for legacy code.
EGammaObjects
Define the categories of EGamma objects tool can be applied to.
std::string m_correctionFunctionString
Function to use for the variable correction, TFormula style.
Class to correct electron and photon MC variables.
std::string m_configFile
The name of the configuration file.
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.
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.
std::vector< float > m_etaBins
List of bin boundaries in eta, stored if needed by any correction function parameter.
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.
std::unique_ptr< SG::AuxElement::Accessor< float > > m_variableToCorrect
Accessor for the variable to be corrected.
bool getInterpolationFlag(const int parameter_number) const
Return the interpolation flag of parameter parameter_number as a boolean.
std::unique_ptr< TFormula > m_correctionFunctionTFormula
The actual TFormula correction function.
std::vector< float > m_ptBins
List of bin boundaries in pT, stored if needed by any correction function parameter.
bool m_doGaussianSmearing
Whether to apply normal correction or smearing correction.
std::vector< TH2 * > m_TH2Copies
Copy of the TH2 from the root file, stored if needed by the respective correction function parameter.
boost::thread_specific_ptr< TRandom3 > m_TRandom_tls
thread-safe TRandom3 for setting seed of random smearing correction
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.
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.
bool m_retrievedPtBinning
Store if already retrieved pt binning.
const std::string & getCorrectionVariable()
Returns the variable which should be corrected according to the passed configuration file.
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.
ElectronPhotonVariableCorrectionBase::parameterType stringToParameterType(const std::string &input) const
Convert input string to a parameter function type.
Return value from object correction CP tools.
bool isEqualToUncorrectedDiscontinuity(const float value) const
Check if the value passed is equal to one of the values passed via the UncorrectedDiscontinuites flag...
std::vector< float > m_useAbsEtaTH2
Store the lowest eta bin boundary: used for checking if the respective TH2 needs the eta or abs(eta) ...
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.
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 ...
TRandom3 * getTLSRandomGen(unsigned int seed) const
Getting thread safe random number generator (and resetting its seed)
std::string m_correctionVariable
The name of the variable to correct.
std::unique_ptr< SG::AuxElement::Accessor< float > > m_originalVariable
Accessor to store the original value of the corrected variable.
ElectronPhotonVariableCorrectionBase::EGammaObjects isAppliedTo()
Returns the type of EGamma object to which the correction should be applied.
ElectronPhotonVariableCorrectionBase(const std::string &myname)
Standard constructor.
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.
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.
bool applyToUnconvertedPhotons() const
Check if the ApplyTo flag passed in the conf file is compatible with uconverted photons.