1#ifndef __JFIT__JENERGYCORRECTION__
2#define __JFIT__JENERGYCORRECTION__
26namespace JPP {
using namespace JFIT; }
80 return get()->GetExpFormula();
100 TString buffer(formula.c_str());
102 if (buffer.EndsWith(
".root") ||
103 buffer.EndsWith(
".txt")) {
125 const double y =
get()->Eval(log10(E));
141 return "energy_correction";
157 void load(
const char* file_name)
160 using namespace JLANG;
161 using namespace JEEP;
163 TString buffer(getFullFilename(LD_LIBRARY_PATH, file_name).c_str());
165 if (buffer.EndsWith(
".root")) {
167 TFile in(buffer,
"READ");
180 }
else if (buffer.EndsWith(
".txt")) {
190 for (Ssiz_t i = 0; i != buffer.Length(); ++i) {
191 if (iscntrl(buffer[i])) {
224 using namespace JLANG;
225 using namespace JEEP;
229 const TString buffer(file_name);
231 if (buffer.EndsWith(
".root")) {
233 TFile out(file_name,
"RECREATE");
240 }
else if (buffer.EndsWith(
".txt")) {
242 ofstream out(file_name);
272 object.setFormula(buffer);
287 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 JEnergy.cc.
friend std::ostream & operator<<(std::ostream &out, const JEnergyCorrection &object)
Write energy correction to output.
void load(const char *file_name)
Load formula from file.
double operator()(const double E) const
Get corrected energy.
void store(const char *file_name)
Store formula to file.
friend std::istream & operator>>(std::istream &in, JEnergyCorrection &object)
Read energy correction from input.
JEnergyCorrection()
Default constructor.
TString getFormula() const
Get formula.
JEnergyCorrection(const TFormula *fcn)
Constructor.
JEnergyCorrection(const std::string &formula)
Constructor.
void setFormula(const std::string &formula)
Set formula.
static const char * getName()
Get name of energy correction formula.
bool is_valid() const
Check validity of pointer.
Exception for opening of file.
JClass_t *const & getReference() const
Get rereference to internal pointer.
virtual JClass_t * get() const override
Get pointer.
The template JSharedPointer class can be used to share a pointer to an object.
virtual void reset() override
Reset 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).