Go to the documentation of this file. 1 #ifndef __JFIT__JENERGYCORRECTION__
2 #define __JFIT__JENERGYCORRECTION__
26 namespace 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;
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();
void store(const char *file_name)
Store formula to file.
const TFormula *const & getReference() const
Get rereference to internal pointer.
virtual const TFormula * get() const
Get pointer.
double operator()(const double E) const
Get corrected energy.
Auxiliary classes and methods for linear and iterative data regression.
TString getFormula() const
Get formula.
General puprpose classes and methods.
JEnergyCorrection(const std::string &formula)
Constructor.
Exception for opening of file.
void load(const char *file_name)
Load formula from file.
friend std::ostream & operator<<(std::ostream &out, const JEnergyCorrection &object)
Write energy correction to output.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template implementation of class that holds pointer to object(s).
virtual void reset()
Reset pointer.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
static const char *const LD_LIBRARY_PATH
Nick names of environment variables.
void setFormula(const std::string &formula)
Set formula.
friend std::istream & operator>>(std::istream &in, JEnergyCorrection &object)
Read energy correction from input.
JEnergyCorrection()
Default constructor.
static const char * getName()
Get name of energy correction formula.
JEnergyCorrection(const TFormula *fcn)
Constructor.
Auxiliary classes and methods for language specific functionality.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
std::string getFullFilename(const std::string &variable, const std::string &file_name)
Get full file name (see JEEP::getPath).
Auxiliary class for correction of energy determined by JEnergy.cc.
bool is_valid() const
Check validity of pointer.