1#ifndef __JRECONSTRUCTION__JENERGYCORRECTION__
2#define __JRECONSTRUCTION__JENERGYCORRECTION__
38 public std::shared_ptr<const TFormula>
66 std::shared_ptr<const TFormula>(fcn)
77 return (
bool) std::shared_ptr<const TFormula>(*
this);
89 return get()->GetExpFormula();
109 TString buffer(formula.c_str());
111 if (buffer.EndsWith(
".root") ||
112 buffer.EndsWith(
".txt")) {
133 return get()->Eval(x);
146 return "energy_correction";
162 void load(
const char* file_name)
165 using namespace JLANG;
166 using namespace JEEP;
168 TString buffer(getFullFilename(LD_LIBRARY_PATH, file_name).c_str());
170 if (buffer.EndsWith(
".root")) {
172 TFile in(buffer,
"READ");
190 }
else if (buffer.EndsWith(
".txt")) {
200 for (Ssiz_t i = 0; i != buffer.Length(); ++i) {
201 if (iscntrl(buffer[i])) {
234 using namespace JLANG;
235 using namespace JEEP;
239 const TString buffer(file_name);
241 if (buffer.EndsWith(
".root")) {
243 TFile out(file_name,
"RECREATE");
250 }
else if (buffer.EndsWith(
".txt")) {
252 ofstream out(file_name);
282 object.setFormula(buffer);
297 return out <<
object.getFormula();
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for opening of file.
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.
JEnergyCorrection(const TFormula *fcn)
Constructor.
friend std::istream & operator>>(std::istream &in, JEnergyCorrection &object)
Read energy correction from input.
JEnergyCorrection(const std::string &formula)
Constructor.
JEnergyCorrection()
Default constructor.
void store(const char *file_name)
Store formula to file.
TString getFormula() const
Get formula.
double operator()(const double x) const
Get corrected value.
bool is_valid() const
Check validity of pointer.
static const char * getName()
Get name of energy correction formula.
void setFormula(const std::string &formula)
Set formula.
General puprpose classes and methods.
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).