Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JACOUSTICS::JMODEL::JString Struct Reference

String parameters. More...

#include <JModel.hh>

Inheritance diagram for JACOUSTICS::JMODEL::JString:
JMATH::JMath< JFirst_t, JSecond_t > JLANG::JEquals< JFirst_t, JSecond_t > JACOUSTICS::JKatoomba< JType >::H_t

Public Member Functions

 JString ()
 Default constructor.
 
 JString (const double tx, const double ty, const double tx2=0.0, const double ty2=0.0, const double vs=0.0)
 Constructor.
 
JStringnegate ()
 Negate string.
 
JStringadd (const JString &string)
 Add string.
 
JStringsub (const JString &string)
 Subtract string.
 
JStringmul (const double factor)
 Scale string.
 
JStringdiv (const double factor)
 Scale string.
 
bool equals (const JString &string, const double precision=std::numeric_limits< double >::min()) const
 Check equality.
 
double getLengthSquared () const
 Get length squared.
 
double getLength () const
 Get length.
 
double getAngle () const
 Get angle.
 
double getDot (const JString &string) const
 Get dot product.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 

Static Public Member Functions

static size_t getN (const JMODEL::JOption_t option)
 Get number of fit parameters.
 

Public Attributes

double tx
 
double ty
 
double tx2
 
double ty2
 
double vs
 

Friends

std::istream & operator>> (std::istream &in, JString &string)
 Read string parameters from input stream.
 
std::ostream & operator<< (std::ostream &out, const JString &string)
 Write string parameters to output stream.
 

Detailed Description

String parameters.

Definition at line 59 of file JAcoustics/JModel.hh.

Constructor & Destructor Documentation

◆ JString() [1/2]

JACOUSTICS::JMODEL::JString::JString ( )
inline

Default constructor.

Definition at line 66 of file JAcoustics/JModel.hh.

◆ JString() [2/2]

JACOUSTICS::JMODEL::JString::JString ( const double tx,
const double ty,
const double tx2 = 0.0,
const double ty2 = 0.0,
const double vs = 0.0 )
inline

Constructor.

Parameters
txslope dx/dz
tyslope dy/dz
tx22nd order correction of slope dx/dz
ty22nd order correction of slope dy/dz
vsstretching factor

Definition at line 84 of file JAcoustics/JModel.hh.

88 :
89 tx (tx),
90 ty (ty),
91 tx2(tx2),
92 ty2(ty2),
93 vs (vs)
94 {}

Member Function Documentation

◆ getN()

static size_t JACOUSTICS::JMODEL::JString::getN ( const JMODEL::JOption_t option)
inlinestatic

Get number of fit parameters.

Parameters
optionoption
Returns
number of parameters

Definition at line 103 of file JAcoustics/JModel.hh.

104 {
105 switch (option) {
106
107 case FIT_UNDEFINED_t:
109 return 0;
110
112 return 2;
113
115 return 4;
116
118 return 5;
119
120 default:
121 THROW(JValueOutOfRange, "Invalid option " << option);
122 }
123 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
@ FIT_EMITTERS_AND_STRINGS_1st_ORDER_t
fit times of emission of emitters and tilt angles of strings
@ FIT_EMITTERS_AND_STRINGS_2nd_ORDER_t
fit times of emission of emitters and tilt angles of strings with second order correction
@ FIT_UNDEFINED_t
fit undefined
@ FIT_EMITTERS_ONLY_t
fit only times of emission of emitters
@ FIT_EMITTERS_AND_STRINGS_2nd_ORDER_AND_STRETCHING_t
fit times of emission of emitters and tilt angles of strings with second order correction and stretch...

◆ negate()

JString & JACOUSTICS::JMODEL::JString::negate ( )
inline

Negate string.

Returns
this string

Definition at line 131 of file JAcoustics/JModel.hh.

132 {
133 tx = -tx;
134 ty = -ty;
135 tx2 = -tx2;
136 ty2 = -ty2;
137 vs = -vs;
138
139 return *this;
140 }

◆ add()

JString & JACOUSTICS::JMODEL::JString::add ( const JString & string)
inline

Add string.

Parameters
stringstring
Returns
this string

Definition at line 149 of file JAcoustics/JModel.hh.

150 {
151 tx += string.tx;
152 ty += string.ty;
153 tx2 += string.tx2;
154 ty2 += string.ty2;
155 vs += string.vs;
156
157 return *this;
158 }

◆ sub()

JString & JACOUSTICS::JMODEL::JString::sub ( const JString & string)
inline

Subtract string.

Parameters
stringstring
Returns
this string

Definition at line 167 of file JAcoustics/JModel.hh.

168 {
169 tx -= string.tx;
170 ty -= string.ty;
171 tx2 -= string.tx2;
172 ty2 -= string.ty2;
173 vs -= string.vs;
174
175 return *this;
176 }

◆ mul() [1/2]

JString & JACOUSTICS::JMODEL::JString::mul ( const double factor)
inline

Scale string.

Parameters
factormultiplication factor
Returns
this string

Definition at line 185 of file JAcoustics/JModel.hh.

186 {
187 tx *= factor;
188 ty *= factor;
189 tx2 *= factor;
190 ty2 *= factor;
191 vs *= factor;
192
193 return *this;
194 }

◆ div()

JString & JACOUSTICS::JMODEL::JString::div ( const double factor)
inline

Scale string.

Parameters
factordivision factor
Returns
this string

Definition at line 203 of file JAcoustics/JModel.hh.

204 {
205 tx /= factor;
206 ty /= factor;
207 tx2 /= factor;
208 ty2 /= factor;
209 vs /= factor;
210
211 return *this;
212 }

◆ equals()

bool JACOUSTICS::JMODEL::JString::equals ( const JString & string,
const double precision = std::numeric_limits<double>::min() ) const
inline

Check equality.

Parameters
stringstring
precisionprecision
Returns
true if strings are equal; else false

Definition at line 222 of file JAcoustics/JModel.hh.

224 {
225 return (fabs(tx - string.tx) <= precision &&
226 fabs(ty - string.ty) <= precision &&
227 fabs(tx2 - string.tx2) <= precision &&
228 fabs(ty2 - string.ty2) <= precision &&
229 fabs(vs - string.vs) <= precision);
230 }

◆ getLengthSquared()

double JACOUSTICS::JMODEL::JString::getLengthSquared ( ) const
inline

Get length squared.

Returns
square of length

Definition at line 238 of file JAcoustics/JModel.hh.

239 {
240 return tx*tx + ty*ty;
241 }

◆ getLength()

double JACOUSTICS::JMODEL::JString::getLength ( ) const
inline

Get length.

Returns
length

Definition at line 249 of file JAcoustics/JModel.hh.

250 {
251 return sqrt(getLengthSquared());
252 }
double getLengthSquared() const
Get length squared.

◆ getAngle()

double JACOUSTICS::JMODEL::JString::getAngle ( ) const
inline

Get angle.

Returns
angle [rad]

Definition at line 260 of file JAcoustics/JModel.hh.

261 {
262 return atan2(ty, tx);
263 }

◆ getDot()

double JACOUSTICS::JMODEL::JString::getDot ( const JString & string) const
inline

Get dot product.

Parameters
stringstring
Returns
dot product

Definition at line 272 of file JAcoustics/JModel.hh.

273 {
274 return (tx * string.tx +
275 ty * string.ty +
276 tx2 * string.tx2 +
277 ty2 * string.ty2 +
278 vs * string.vs);
279 }

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
JFirst_t & JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t & object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JString & string )
friend

Read string parameters from input stream.

Parameters
ininput stream
stringstring
Returns
input stream

Definition at line 289 of file JAcoustics/JModel.hh.

290 {
291 return in >> string.tx >> string.ty >> string.tx2 >> string.ty2 >> string.vs;
292 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JString & string )
friend

Write string parameters to output stream.

Parameters
outoutput stream
stringstring
Returns
output stream

Definition at line 302 of file JAcoustics/JModel.hh.

303 {
304 using namespace std;
305 using namespace JPP;
306
307 return out << FIXED(10,7) << string.tx << ' '
308 << FIXED(10,7) << string.ty << ' '
309 << SCIENTIFIC(12,3) << string.tx2 << ' '
310 << SCIENTIFIC(12,3) << string.ty2 << ' '
311 << FIXED(8,5) << string.vs;
312 }
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488

Member Data Documentation

◆ tx

double JACOUSTICS::JMODEL::JString::tx

Definition at line 315 of file JAcoustics/JModel.hh.

◆ ty

double JACOUSTICS::JMODEL::JString::ty

Definition at line 316 of file JAcoustics/JModel.hh.

◆ tx2

double JACOUSTICS::JMODEL::JString::tx2

Definition at line 317 of file JAcoustics/JModel.hh.

◆ ty2

double JACOUSTICS::JMODEL::JString::ty2

Definition at line 318 of file JAcoustics/JModel.hh.

◆ vs

double JACOUSTICS::JMODEL::JString::vs

Definition at line 319 of file JAcoustics/JModel.hh.


The documentation for this struct was generated from the following file: