1#ifndef __JACOUSTICS__JMECHANICS__
2#define __JACOUSTICS__JMECHANICS__
12#include "JSystem/JStat.hh"
14#include "JLang/JStringStream.hh"
15#include "JLang/JManip.hh"
16#include "JLang/JException.hh"
18#include "Jeep/JeepToolkit.hh"
19#include "Jeep/JComment.hh"
34 using JLANG::JFileOpenException;
72 return height + this->
b * log(1.0 - this->
a * height);
85 return in >> parameters.
a >> parameters.
b;
98 return out << FIXED(7,5) << parameters.
a <<
' '
99 << FIXED(7,3) << parameters.
b;
113 public std::map<int, JMechanics>
128 return MAKE_STRING(
"mechanics_" << FILL(8,
'0') <<
id <<
".txt");
137 void load(
const std::string& file_name)
139 std::ifstream in(file_name.c_str());
142 THROW(JFileOpenException,
"File not opened for reading: " << file_name);
174 if ((p = this->find(
string)) != this->end())
176 else if ((p = this->find(
WILDCARD)) != this->end())
194 JStringStream is(in);
196 if (getFileStatus(is.str().c_str())) {
202 is >>
object.comment;
207 while (is >>
string >> mechanics) {
208 object[string] = mechanics;
226 out <<
object.comment;
228 for (JDetectorMechanics::const_iterator i =
object.begin(); i !=
object.end(); ++i) {
229 out << setw(4) << i->first <<
' ' << i->second << endl;
Auxiliary classes and methods for acoustic position calibration.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
Auxiliary data structure for mechanical model parameters of strings in a given detector.
void load(const int id)
Load mechanical model parameters for given detector identifier.
@ WILDCARD
wild card for string number.
void load(const std::string &file_name)
Load mechanical model parameters from file.
const JMechanics & operator()(const int string) const
Get mechanical parameters for given string.
static std::string getFilename(const int id)
Get file name with mechanical model parameters for given detector identifier.
friend std::istream & operator>>(std::istream &in, JDetectorMechanics &object)
Read detector mechanics from input.
friend std::ostream & operator<<(std::ostream &out, const JDetectorMechanics &object)
Write detector mechanics to output.
Auxiliary data structure for parameters of mechanical model.
double a
0 <= a < (maximal height)⁻1; [m^-1]
JMechanics(const double a, const double b)
Constructor.
friend std::istream & operator>>(std::istream &in, JMechanics ¶meters)
Read parameters from input stream.
friend std::ostream & operator<<(std::ostream &out, const JMechanics ¶meters)
Write parameters to output stream.
double getHeight(const double height) const
Get effective height for given actual height.
JMechanics()
Default constructor.