11#ifndef ALICEO2_EMCAL_NONLINEARITYHANDLER__H
12#define ALICEO2_EMCAL_NONLINEARITYHANDLER__H
16#include <unordered_map>
58 const
char*
what() const noexcept final
60 return "Nonlinearity handler not initialized";
116 mNonlinearyFunction = nonlintype;
143 bool mApplyScaleCorrection =
false;
144 std::array<double, 11> mNonlinearityParam;
149 double evaluateTestbeamCorrected(
double energy)
const;
154 double evaluateTestbeamShaper(
double energy)
const;
159 double evaluatePi0MC(
double energy)
const;
164 double evaluatePi0MCv2(
double energy)
const;
198 mMessage =
"Nonlinearity funciton " + mName +
" not found";
206 const
char*
what() const noexcept final
208 return mMessage.data();
213 const std::string_view
getNonlinName() const noexcept {
return mName.data(); }
217 std::string mMessage;
233 const
char*
what() const noexcept final
235 return "Failed constructing nonlinearity handler";
244 return currentInstance;
271 ~NonlinearityFactory() =
default;
274 void initNonlinNames();
282 std::unordered_map<NonlinearityHandler::NonlinType_t, NonlinearityHandler> mHandlers;
283 std::unordered_map<std::string, NonlinearityHandler::NonlinType_t> mNonlinNames;
285 ClassDefNV(NonlinearityFactory, 1)
292std::ostream&
operator<<(std::ostream& in,
const NonlinearityHandler& handler);
Cluster class for kinematic cluster parametersported from AliVCluster in AliRoot.
Handling request of non-exisiting nonlinearity functions.
~FunctionNotFoundExcpetion() noexcept final=default
Destructor.
const std::string_view getNonlinName() const noexcept
Getting the name of the function raising the exception.
const char * what() const noexcept final
Provide error message.
FunctionNotFoundExcpetion(const std::string_view name)
Constructor.
Handling errors of initialisation of a certain nonlinearity function.
~NonlinInitError() noexcept final=default
Destructor.
NonlinInitError()
Constructor.
const char * what() const noexcept final
Provide error message.
Creator and handler class of nonlinearity parameterizations.
NonlinearityHandler & getNonlinearity(NonlinearityHandler::NonlinType_t nonlintype)
Get nonlinearity handler for the given nonlinearty type.
static NonlinearityFactory & getInstance()
Get instance of the nonlinearity factory.
Handling missing initialisation of the NonlinearityHanlder.
const char * what() const noexcept final
Provide error message.
UninitException()=default
Constructor.
~UninitException() noexcept final=default
Destructor.
Nonlinearity functions for energy correction.
NonlinType_t
Types of nonlinearity functions available.
@ MC_PI0
MC, function corresponding to inital testbeam nonlin without shaper correction.
@ MC_PI0_V5
MC, function corresponding to inital testbeam nonlin without shaper correction, version 5.
@ DATA_TESTBEAM_SHAPER_WOSCALE
Data, testbeam nonlin for shaper correction, without energy rescaling.
@ DATA_TESTBEAM_CORRECTED_V4
Data, inital testbeam nonlin without shaper correction, version 4.
@ MC_PI0_V6
MC, function corresponding to inital testbeam nonlin without shaper correction, version 6.
@ MC_TESTBEAM_FINAL
MC, function corresponding to data testbeam nonlin for shaper correction, with energy rescaling.
@ MC_PI0_V3
MC, function corresponding to inital testbeam nonlin without shaper correction, version 3.
@ DATA_TESTBEAM_CORRECTED
Data, inital testbeam nonlin without shaper correction.
@ UNKNOWN
No function set.
@ DATA_TESTBEAM_CORRECTED_V3
Data, inital testbeam nonlin without shaper correction, version 3.
@ DATA_TESTBEAM_CORRECTED_V2
Data, inital testbeam nonlin without shaper correction, version 2.
@ DATA_TESTBEAM_SHAPER
Data, testbeam nonlin for shaper correction, with energy rescaling.
@ MC_PI0_V2
MC, function corresponding to inital testbeam nonlin without shaper correction, version 2.
double getCorrectedClusterEnergy(double energy) const
Get corrected cluster energy for the selected nonlinearity parameterization.
static double evaluateShaperCorrectionCellEnergy(double energy, double ecalibHG=1)
Get corrected energy at cell level for the shaper saturation at high energy.
~NonlinearityHandler()=default
Destructor.
static NonlinType_t getNonlinType(const std::string_view name)
Get type of a nonlinearity function from its name.
void setNonlinType(NonlinType_t nonlintype)
Set type of nonlinearity function.
NonlinearityHandler()=default
Dummy constructor.
double getCorrectedClusterEnergy(const AnalysisCluster &cluster) const
Get corrected cluster energy for the selected nonlinearity parameterization.
void printStream(std::ostream &stream) const
Print information about the nonlinearity function.
static const char * getNonlinName(NonlinType_t nonlin)
Get name of the nonlinearity function from the function type.
GLuint const GLchar * name
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.