Jpp  17.2.1-pre0
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 JDetector &detector, 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 332 of file JKatoomba.hh.

Constructor & Destructor Documentation

JACOUSTICS::JKatoomba< JEstimator >::JKatoomba ( const JDetector detector,
const JSoundVelocity velocity,
const int  option 
)
inline

Constructor.

Parameters
detectordetector
velocitysound velocity
optionoption

Definition at line 344 of file JKatoomba.hh.

346  :
347  JKatoomba<>(detector, velocity, option)
348  {};
do set_variable DETECTOR_TXT $WORKDIR detector

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

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

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

Definition at line 444 of file JKatoomba.hh.


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