Jpp  18.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
JACOUSTICS::JKatoomba< JEstimator > Struct Template Reference

Template specialisation of fit function of acoustic model based on linear approximation. More...

#include <JKatoomba.hh>

Inheritance diagram for JACOUSTICS::JKatoomba< JEstimator >:
JACOUSTICS::JKatoomba<>

Public Member Functions

 JKatoomba (const JGeometry &geometry, const JSoundVelocity &velocity, const int option)
 Constructor. More...
 
template<class T >
JModeloperator() (T __begin, T __end) const
 Get start values of string parameters. More...
 

Static Public Attributes

static constexpr double TOLERANCE = 1.0e-8
 Tolerance for SVD. More...
 
static JMatrix_t MATRIX_INVERSION = SVD_t
 

Private Member Functions

template<class T , class JMatrixNS_t >
JModelevaluate (T __begin, T __end, const JType< JMatrixNS_t > &type) const
 Get start values of string parameters. More...
 

Static Private Member Functions

static void invert (TMatrixD &V)
 Invert matrix using SVD algorithm. More...
 
static void invert (JMatrixNS &V)
 Invert matrix using LDU algorithm. More...
 

Private Attributes

JModel value
 

Detailed Description

template<>
struct JACOUSTICS::JKatoomba< JEstimator >

Template specialisation of fit function of acoustic model based on linear approximation.

Definition at line 365 of file JKatoomba.hh.

Constructor & Destructor Documentation

JACOUSTICS::JKatoomba< JEstimator >::JKatoomba ( const JGeometry geometry,
const JSoundVelocity velocity,
const int  option 
)
inline

Constructor.

Parameters
geometrydetector geometry
velocitysound velocity
optionoption

Definition at line 377 of file JKatoomba.hh.

379  :
380  JKatoomba<>(geometry, velocity, option)
381  {};

Member Function Documentation

template<class T >
JModel& JACOUSTICS::JKatoomba< JEstimator >::operator() ( T  __begin,
T  __end 
) const
inline

Get start values of string parameters.


Note that this method may throw an exception.

Parameters
__beginbegin of hits
__endend of hits
Returns
model

Definition at line 393 of file JKatoomba.hh.

394  {
395  switch (MATRIX_INVERSION) {
396 
397  case SVD_t:
398  return this->evaluate(__begin, __end, JType<TMatrixDS>());
399 
400  case LDU_t:
401  return this->evaluate(__begin, __end, JType<JMatrixNS>());
402 
403  default:
404  THROW(JValueOutOfRange, "Invalid matrix type " << MATRIX_INVERSION);
405  }
406  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
Auxiliary class for a type holder.
Definition: JType.hh:19
JModel & evaluate(T __begin, T __end, const JType< JMatrixNS_t > &type) const
Get start values of string parameters.
Definition: JKatoomba.hh:422
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162
template<class T , class JMatrixNS_t >
JModel& JACOUSTICS::JKatoomba< JEstimator >::evaluate ( T  __begin,
T  __end,
const JType< JMatrixNS_t > &  type 
) const
inlineprivate

Get start values of string parameters.


Note that this method may throw an exception.

Parameters
__beginbegin of hits
__endend of hits
typematrix type
Returns
model

Definition at line 422 of file JKatoomba.hh.

423  {
424  using namespace std;
425  using namespace JPP;
426  using namespace JGEOMETRY;
427 
428  value = move(JModel(__begin, __end)); // set up global model according data
429 
430  if (this->option == JMODEL::fit_emitters_only_t)
432  else
434 
435  H_t H; // H-equation as per hit
436  I_t i; // indices of H-equation in global model
437 
438  const size_t N = value.getN();
439 
440  JMatrixNS_t V(N); // V = H^T x H
441  vector<double> Y(N, 0.0); // Y = H^T x y
442 
443  for (T hit = __begin; hit != __end; ++hit) {
444 
445  const JString& string = geometry[hit->getString()];
446  const JPosition3D position = string.getPosition(hit->getFloor());
447  const double Vi = velocity.getInverseVelocity(hit->getDistance(position), hit->getZ(), position.getZ());
448 
449  const double h1 = string.getHeight(hit->getFloor());
450  const JPosition3D p1 = string.getPosition() - hit->getPosition();
451  const double ds = sqrt(p1.getLengthSquared() + h1*h1 + 2.0*p1.getZ()*h1);
452  const double y = hit->getValue() - Vi*ds;
453  const double W = sqrt(hit->getWeight());
454 
455  H.t1 = W * 1.0;
456  H.tx = W * Vi * p1.getX() * h1 / ds;
457  H.ty = W * Vi * p1.getY() * h1 / ds;
458 
459  i.t1 = value.getIndex(hit->getEKey(), &H_t::t1);
460  i.tx = value.getIndex(hit->getString(), &H_t::tx);
461  i.ty = value.getIndex(hit->getString(), &H_t::ty);
462 
463  V(i.t1, i.t1) += H.t1 * H.t1;
464 
465  Y[i.t1] += W * H.t1 * y;
466 
467  if (hit->getFloor() != 0) {
468 
469  if (this->option != JMODEL::fit_emitters_only_t) {
470 
471  V(i.t1, i.tx) += H.t1 * H.tx; V(i.t1, i.ty) += H.t1 * H.ty;
472  V(i.tx, i.t1) += H.tx * H.t1; V(i.ty, i.t1) += H.ty * H.t1;
473 
474  V(i.tx, i.tx) += H.tx * H.tx; V(i.tx, i.ty) += H.tx * H.ty;
475  V(i.ty, i.tx) += H.ty * H.tx; V(i.ty, i.ty) += H.ty * H.ty;
476 
477  Y[i.tx] += W * H.tx * y;
478  Y[i.ty] += W * H.ty * y;
479  }
480  }
481  }
482 
483  // evaluate (H^T x H)^-1 x H^T x y
484 
485  invert(V);
486 
487  for (size_t row = 0; row != N; ++row) {
488  for (size_t col = 0; col != N; ++col) {
489  value[row] += V(row,col) * Y[col];
490  }
491  }
492 
493  return value;
494  }
size_t getN() const
Get number of fit parameters.
void setOption(const int option)
Set fit option.
Wrapper class around STL string class.
Definition: JString.hh:27
TPaveText * p1
static void invert(TMatrixD &V)
Invert matrix using SVD algorithm.
Definition: JKatoomba.hh:502
static const double H
Planck constant [eV s].
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
fit times of emission of emitters and tilt angles of strings
Model for fit to acoustics data.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
double getY() const
Get y position.
Definition: JVector3D.hh:104
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:235
size_t getIndex(int id, double JString::*p) const
Get index of fit parameter for given string.
then usage $script< input file >[option[primary[working directory]]] nWhere option can be N
Definition: JMuonPostfit.sh:36
double getX() const
Get x position.
Definition: JVector3D.hh:94
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
fit only times of emission of emitters
double getZ() const
Get z position.
Definition: JVector3D.hh:115
static void JACOUSTICS::JKatoomba< JEstimator >::invert ( TMatrixD &  V)
inlinestaticprivate

Invert matrix using SVD algorithm.

Parameters
Vmatrix

Definition at line 502 of file JKatoomba.hh.

503  {
504 #ifdef THREAD_SAFE
505  using namespace std;
506 
507  unique_lock<mutex> lock(mtx);
508 #endif
509  TDecompSVD svd(V, TOLERANCE);
510 
511  Bool_t status;
512 
513  V = svd.Invert(status);
514  }
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
static constexpr double TOLERANCE
Tolerance for SVD.
Definition: JKatoomba.hh:368
static void JACOUSTICS::JKatoomba< JEstimator >::invert ( JMatrixNS V)
inlinestaticprivate

Invert matrix using LDU algorithm.

Parameters
Vmatrix

Definition at line 522 of file JKatoomba.hh.

523  {
524  V.invert();
525  }
void invert()
Invert matrix according LDU decomposition.
Definition: JMatrixNS.hh:80

Member Data Documentation

constexpr double JACOUSTICS::JKatoomba< JEstimator >::TOLERANCE = 1.0e-8
static

Tolerance for SVD.

Definition at line 368 of file JKatoomba.hh.

JMatrix_t JACOUSTICS::JKatoomba< JEstimator >::MATRIX_INVERSION = SVD_t
static

Definition at line 409 of file JKatoomba.hh.

JModel JACOUSTICS::JKatoomba< JEstimator >::value
mutableprivate

Definition at line 528 of file JKatoomba.hh.


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