1#ifndef __JFIT__JSHOWERENERGYCORRECTION__
2#define __JFIT__JSHOWERENERGYCORRECTION__
26namespace JPP {
using namespace JFIT; }
79 return get()->GetExpFormula();
99 TString buffer(formula.c_str());
101 if (buffer.EndsWith(
".root") ||
102 buffer.EndsWith(
".txt")) {
124 const double y =
get()->Eval(E);
140 return "energy_correction";
156 void load(
const char* file_name)
159 using namespace JLANG;
160 using namespace JEEP;
162 TString buffer(getFullFilename(LD_LIBRARY_PATH, file_name).c_str());
164 if (buffer.EndsWith(
".root")) {
166 TFile in(buffer,
"READ");
179 }
else if (buffer.EndsWith(
".txt")) {
189 for (Ssiz_t i = 0; i != buffer.Length(); ++i) {
190 if (iscntrl(buffer[i])) {
223 using namespace JLANG;
224 using namespace JEEP;
228 const TString buffer(file_name);
230 if (buffer.EndsWith(
".root")) {
232 TFile out(file_name,
"RECREATE");
239 }
else if (buffer.EndsWith(
".txt")) {
241 ofstream out(file_name);
271 object.setFormula(buffer);
286 return out <<
object.getFormula();
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Auxiliary class for correction of energy determined by JShowerEnergy.cc.
double operator()(const double E) const
Get corrected energy.
void store(const char *file_name)
Store formula to file.
void setFormula(const std::string &formula)
Set formula.
JShowerEnergyCorrection()
Default constructor.
static const char * getName()
Get name of energy correction formula.
void load(const char *file_name)
Load formula from file.
JShowerEnergyCorrection(const TFormula *fcn)
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JShowerEnergyCorrection &object)
Write energy correction to output.
friend std::istream & operator>>(std::istream &in, JShowerEnergyCorrection &object)
Read energy correction from input.
TString getFormula() const
Get formula.
JShowerEnergyCorrection(const std::string &formula)
Constructor.
bool is_valid() const
Check validity of pointer.
Exception for opening of file.
Template implementation of class that holds pointer to object(s).
JClass_t *const & getReference() const
Get rereference to internal pointer.
virtual void reset() override
Reset pointer.
virtual JClass_t * get() const override
Get pointer.
General puprpose classes and methods.
Auxiliary classes and methods for linear and iterative data regression.
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).