1#ifndef __JRECONSTRUCTION__JENERGYCORRECTION__
2#define __JRECONSTRUCTION__JENERGYCORRECTION__
39 public std::shared_ptr<const TFormula>
67 std::shared_ptr<const TFormula>(fcn)
78 return (
bool) std::shared_ptr<const TFormula>(*
this);
90 return get()->GetExpFormula();
110 TString buffer(formula.c_str());
112 if (buffer.EndsWith(
".root") ||
113 buffer.EndsWith(
".txt")) {
135 const double y = get()->Eval(log10(E));
151 return "energy_correction";
167 void load(
const char* file_name)
170 using namespace JLANG;
171 using namespace JEEP;
173 TString buffer(getFullFilename(LD_LIBRARY_PATH, file_name).c_str());
175 if (buffer.EndsWith(
".root")) {
177 TFile in(buffer,
"READ");
194 }
else if (buffer.EndsWith(
".txt")) {
204 for (Ssiz_t i = 0; i != buffer.Length(); ++i) {
205 if (iscntrl(buffer[i])) {
238 using namespace JLANG;
239 using namespace JEEP;
243 const TString buffer(file_name);
245 if (buffer.EndsWith(
".root")) {
247 TFile out(file_name,
"RECREATE");
254 }
else if (buffer.EndsWith(
".txt")) {
256 ofstream out(file_name);
286 object.setFormula(buffer);
301 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 E) const
Get corrected energy.
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).