Jpp  18.2.0-rc.1
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 | 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_t.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 JMatrix_t MATRIX_INVERSION = SVD_t
 Matrix inversion. More...
 

Private Member Functions

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

Private Attributes

JMatrixNS ldu
 
TMatrixDS svd
 
std::vector< double > Y
 
JModel value
 

Detailed Description

template<>
struct JACOUSTICS::JKatoomba< JEstimator >

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

Definition at line 495 of file JKatoomba_t.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 505 of file JKatoomba_t.hh.

507  :
508  JKatoomba<>(geometry, velocity, option)
509  {};

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 521 of file JKatoomba_t.hh.

522  {
523  switch (MATRIX_INVERSION) {
524 
525  case SVD_t:
526  return this->evaluate(__begin, __end, svd);
527 
528  case LDU_t:
529  return this->evaluate(__begin, __end, ldu);
530 
531  default:
532  THROW(JValueOutOfRange, "Invalid matrix type " << MATRIX_INVERSION);
533  }
534  }
JModel & evaluate(T __begin, T __end, JMatrixNS_t &V) const
Get start values of string parameters.
Definition: JKatoomba_t.hh:555
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
static JMatrix_t MATRIX_INVERSION
Matrix inversion.
Definition: JKatoomba_t.hh:537
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:178
template<class T , class JMatrixNS_t >
JModel& JACOUSTICS::JKatoomba< JEstimator >::evaluate ( T  __begin,
T  __end,
JMatrixNS_t &  V 
) const
inlineprivate

Get start values of string parameters.


Note that this method may throw an exception.

Parameters
__beginbegin of hits
__endend of hits
Vmatrix
Returns
model

Definition at line 555 of file JKatoomba_t.hh.

556  {
557  using namespace std;
558  using namespace JPP;
559  using namespace JGEOMETRY;
560 
561  value = JModel(__begin, __end); // set up global model according data
562 
563  if (this->option == JMODEL::FIT_EMITTERS_ONLY_t)
565  else
567 
568  H_t H; // H-equation as per hit
569  I_t i; // indices of H-equation in global model
570 
571  const size_t N = value.getN();
572 
573  V.resize(N);
574  Y.resize(N);
575 
576  V.reset();
577 
578  for (vector<double>::iterator i = Y.begin(); i != Y.end(); ++i) {
579  *i = 0.0;
580  }
581 
582  for (T hit = __begin; hit != __end; ++hit) {
583 
584  const JString& string = geometry[hit->getString()];
585  const JPosition3D position = string.getPosition(hit->getFloor());
586  const double Vi = velocity.getInverseVelocity(hit->getDistance(position), hit->getZ(), position.getZ());
587 
588  const double h1 = string.getHeight(hit->getFloor());
589  const JPosition3D p1 = string.getPosition() - hit->getPosition();
590  const double ds = sqrt(p1.getLengthSquared() + h1*h1 + 2.0*p1.getZ()*h1);
591  const double y = hit->getValue() - Vi*ds;
592  const double W = sqrt(hit->getWeight());
593 
594  H.t1 = W * 1.0;
595  H.tx = W * Vi * p1.getX() * h1 / ds;
596  H.ty = W * Vi * p1.getY() * h1 / ds;
597 
598  i.t1 = value.getIndex(hit->getEKey(), &H_t::t1);
599  i.tx = value.getIndex(hit->getString(), &H_t::tx);
600  i.ty = value.getIndex(hit->getString(), &H_t::ty);
601 
602  V(i.t1, i.t1) += H.t1 * H.t1;
603 
604  Y[i.t1] += W * H.t1 * y;
605 
606  if (hit->getFloor() != 0) {
607 
608  if (this->option != JMODEL::FIT_EMITTERS_ONLY_t) {
609 
610  V(i.t1, i.tx) += H.t1 * H.tx; V(i.t1, i.ty) += H.t1 * H.ty;
611  V(i.tx, i.t1) += H.tx * H.t1; V(i.ty, i.t1) += H.ty * H.t1;
612 
613  V(i.tx, i.tx) += H.tx * H.tx; V(i.tx, i.ty) += H.tx * H.ty;
614  V(i.ty, i.tx) += H.ty * H.tx; V(i.ty, i.ty) += H.ty * H.ty;
615 
616  Y[i.tx] += W * H.tx * y;
617  Y[i.ty] += W * H.ty * y;
618  }
619  }
620  }
621 
622  // solve A x = b
623 
624  V.solve(Y);
625 
626  for (size_t row = 0; row != N; ++row) {
627  value[row] += Y[row];
628  }
629 
630  return value;
631  }
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 const double H
Planck constant [eV s].
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Model for fit to acoustics data.
fit times of emission of emitters and tilt angles of strings
do set_variable OUTPUT_DIRECTORY $WORKDIR T
fit only times of emission of emitters
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:40
double getX() const
Get x position.
Definition: JVector3D.hh:94
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
double getZ() const
Get z position.
Definition: JVector3D.hh:115

Member Data Documentation

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

Matrix inversion.

Definition at line 537 of file JKatoomba_t.hh.

JMatrixNS JACOUSTICS::JKatoomba< JEstimator >::ldu
mutableprivate

Definition at line 540 of file JKatoomba_t.hh.

TMatrixDS JACOUSTICS::JKatoomba< JEstimator >::svd
mutableprivate

Definition at line 541 of file JKatoomba_t.hh.

std::vector<double> JACOUSTICS::JKatoomba< JEstimator >::Y
mutableprivate

Definition at line 543 of file JKatoomba_t.hh.

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

Definition at line 634 of file JKatoomba_t.hh.


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