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();
Exception for opening of file.
friend std::istream & operator>>(std::istream &in, JEnergyCorrection &object)
Read energy correction from input.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
friend std::ostream & operator<<(std::ostream &out, const JEnergyCorrection &object)
Write energy correction to output.
JEnergyCorrection(const TFormula *fcn)
Constructor.
static const char *const LD_LIBRARY_PATH
Nick names of environment variables.
JClass_t *const & getReference() const
Get rereference to internal pointer.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
bool is_valid() const
Check validity of pointer.
void setFormula(const std::string &formula)
Set formula.
The template JSharedPointer class can be used to share a pointer to an object.
Auxiliary class for correction of energy determined by JEnergy.cc.
set_variable E_E log10(E_{fit}/E_{#mu})"
JEnergyCorrection()
Default constructor.
T pow(const T &x, const double y)
Power .
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
void load(const char *file_name)
Load formula from file.
static const char * getName()
Get name of energy correction formula.
void store(const char *file_name)
Store formula to file.
TString getFormula() const
Get formula.
std::string getFullFilename(const std::string &variable, const std::string &file_name)
Get full file name (see JEEP::getPath).
double operator()(const double E) const
Get corrected energy.
JEnergyCorrection(const std::string &formula)
Constructor.
virtual void reset() override
Reset pointer.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in