Jpp  18.0.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 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 >
const 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...
 

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 334 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 346 of file JKatoomba.hh.

348  :
349  JKatoomba<>(geometry, velocity, option)
350  {};

Member Function Documentation

template<class T >
const 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 362 of file JKatoomba.hh.

363  {
364  using namespace std;
365  using namespace JPP;
366  using namespace JGEOMETRY;
367 
368 #ifdef THREAD_SAFE
369  static mutex mtx; // TDecompSVD
370 
371  unique_lock<mutex> lock(mtx);
372 #endif
373  value = JModel(__begin, __end); // set up global model according data
374 
375  if (this->option == JMODEL::fit_emitters_only_t)
377  else
379 
380  H_t H; // H-equation as per hit
381  I_t i; // indices of H-equation in global model
382 
383  const size_t N = value.getN();
384 
385  TMatrixD V(N,N); // V = H^T x H
386  vector<double> Y(N, 0.0); // Y = H^T x y
387 
388  for (T hit = __begin; hit != __end; ++hit) {
389 
390  const JString& string = geometry[hit->getString()];
391  const JPosition3D position = string.getPosition(hit->getFloor());
392  const double Vi = velocity.getInverseVelocity(hit->getDistance(position), hit->getZ(), position.getZ());
393 
394  const double h1 = string.getHeight(hit->getFloor());
395  const JPosition3D p1 = string.getPosition() - hit->getPosition();
396  const double ds = sqrt(p1.getLengthSquared() + h1*h1 + 2.0*p1.getZ()*h1);
397  const double y = hit->getValue() - Vi*ds;
398  const double W = sqrt(hit->getWeight());
399 
400  H.t1 = W * 1.0;
401  H.tx = W * Vi * p1.getX() * h1 / ds;
402  H.ty = W * Vi * p1.getY() * h1 / ds;
403 
404  i.t1 = value.getIndex(hit->getEKey(), &H_t::t1);
405  i.tx = value.getIndex(hit->getString(), &H_t::tx);
406  i.ty = value.getIndex(hit->getString(), &H_t::ty);
407 
408  V(i.t1, i.t1) += H.t1 * H.t1;
409 
410  Y[i.t1] += W * H.t1 * y;
411 
412  if (hit->getFloor() != 0) {
413 
414  if (this->option != JMODEL::fit_emitters_only_t) {
415 
416  V(i.t1, i.tx) += H.t1 * H.tx; V(i.t1, i.ty) += H.t1 * H.ty;
417  V(i.tx, i.t1) += H.tx * H.t1; V(i.ty, i.t1) += H.ty * H.t1;
418 
419  V(i.tx, i.tx) += H.tx * H.tx; V(i.tx, i.ty) += H.tx * H.ty;
420  V(i.ty, i.tx) += H.ty * H.tx; V(i.ty, i.ty) += H.ty * H.ty;
421 
422  Y[i.tx] += W * H.tx * y;
423  Y[i.ty] += W * H.ty * y;
424  }
425  }
426  }
427 
428  // evaluate (H^T x H)^-1 x H^T x y
429 
430  TDecompSVD svd(V, TOLERANCE);
431 
432  Bool_t status;
433 
434  V = svd.Invert(status);
435 
436  for (size_t row = 0; row != N; ++row) {
437  for (size_t col = 0; col != N; ++col) {
438  value[row] += V(row,col) * Y[col];
439  }
440  }
441 
442  return value;
443  }
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].
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
static constexpr double TOLERANCE
Tolerance for SVD.
Definition: JKatoomba.hh:337
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

Member Data Documentation

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

Tolerance for SVD.

Definition at line 337 of file JKatoomba.hh.

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

Definition at line 446 of file JKatoomba.hh.


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