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

Worker class for fit function of acoustic model. More...

#include <JKatoomba.hh>

Classes

struct  result_type
 Auxiliary data structure for return value of fit. More...
 

Public Member Functions

 JKatoomba_t (const JGeometry &geometry, const JSoundVelocity &V, const JFitParameters &parameters)
 Constructor. More...
 
template<class T >
result_type< Toperator() (T __begin, T __end)
 Fit. More...
 

Public Attributes

JFitParameters parameters
 
JKatoomba< JEstimatorestimator
 
JKatoomba< JAbstractMinimiserevaluator
 
JKatoomba< JGandalfgandalf
 

Private Attributes

JModel result
 

Detailed Description

Worker class for fit function of acoustic model.

Definition at line 870 of file JKatoomba.hh.

Constructor & Destructor Documentation

JACOUSTICS::JKatoomba_t::JKatoomba_t ( const JGeometry geometry,
const JSoundVelocity V,
const JFitParameters parameters 
)
inline

Constructor.

Parameters
geometrydetector geometry
Vsound velocity
parametersparameters

Definition at line 878 of file JKatoomba.hh.

878  :
879  parameters(parameters),
880  estimator(geometry, V, parameters.option),
881  evaluator(geometry, V, parameters.option),
882  gandalf (geometry, V, parameters.option)
883  {
884  using namespace JPP;
885 
886  evaluator.estimator.reset(getMEstimator(parameters.mestimator));
887  gandalf .estimator.reset(getMEstimator(parameters.mestimator));
888  }
JKatoomba< JEstimator > estimator
Definition: JKatoomba.hh:996
JKatoomba< JAbstractMinimiser > evaluator
Definition: JKatoomba.hh:997
JFitParameters parameters
Definition: JKatoomba.hh:995
int mestimator
M-estimator.
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
Definition: JMEstimator.hh:203
JKatoomba< JGandalf > gandalf
Definition: JKatoomba.hh:998

Member Function Documentation

template<class T >
result_type<T> JACOUSTICS::JKatoomba_t::operator() ( T  __begin,
T  __end 
)
inline

Fit.

Parameters
__beginbegin of data
__endend of data
Returns
fit result

Definition at line 938 of file JKatoomba.hh.

939  {
940  result = estimator(__begin, __end); // pre-fit
941 
942  if (parameters.stdev > 0.0) { // remove outliers
943 
944  for (double chi2 = evaluator(result, __begin, __end), chi2_old = chi2; ; ) {
945 
946  T out = __end;
947 
948  double xmax = 0.0;
949 
950  for (T hit = __begin; hit != __end; ++hit) {
951 
952  const double x = fabs(hit->getValue() - estimator.getToA(result, *hit)) / hit->sigma;
953 
954  if (x > xmax) {
955  xmax = x;
956  out = hit;
957  }
958  }
959 
960  if (xmax > parameters.stdev) {
961 
962  iter_swap(out, --__end);
963 
964  result = estimator(__begin, __end);
965  chi2 = evaluator(result, __begin, __end);
966 
967  if (chi2_old - chi2 > parameters.stdev * parameters.stdev) {
968 
969  chi2_old = chi2;
970 
971  continue;
972 
973  } else {
974 
975  iter_swap(out, __end++);
976 
977  result = estimator(__begin, __end);
978  chi2 = chi2_old;
979  }
980  }
981 
982  break;
983  }
984  }
985 
986  gandalf.value = result; // start value
987 
988  const double chi2 = gandalf (__begin, __end) / gandalf.estimator->getRho(1.0);
989  const double ndf = getWeight(__begin, __end) - gandalf.value.getN();
990 
991  return { gandalf.value, chi2, ndf, __begin, __end }; // return values
992  }
const double xmax
Definition: JQuadrature.cc:24
size_t getN() const
Get number of fit parameters.
JKatoomba< JEstimator > estimator
Definition: JKatoomba.hh:996
double getWeight(T __begin, T __end)
Get total weight of data points.
Definition: JKatoomba.hh:59
JKatoomba< JAbstractMinimiser > evaluator
Definition: JKatoomba.hh:997
double stdev
standard deviation for outlier removal
JFitParameters parameters
Definition: JKatoomba.hh:995
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable TRIPOD $argv[2] set_variable TX $argv[3] set_variable TY $argv[4] if[[!-f $DETECTOR]]
Definition: JFootprint.sh:28
then if[[!-f $DETECTOR]] then JDetector sh $DETECTOR fi cat $WORKDIR trigger_parameters txt<< EOFtrigger3DMuon.enabled=1;trigger3DMuon.numberOfHits=5;trigger3DMuon.gridAngle_deg=1;ctMin=0.0;TMaxLocal_ns=15.0;EOF set_variable TRIGGEREFFICIENCY_TRIGGERED_EVENTS_ONLY INPUT_FILES=() for((i=1;$i<=$NUMBER_OF_RUNS;++i));do JSirene.sh $DETECTOR $JPP_DATA/genhen.km3net_wpd_V2_0.evt.gz $WORKDIR/sirene_ ${i}.root JTriggerEfficiency.sh $DETECTOR $DETECTOR $WORKDIR/sirene_ ${i}.root $WORKDIR/trigger_efficiency_ ${i}.root $WORKDIR/trigger_parameters.txt $JPP_DATA/PMT_parameters.txt INPUT_FILES+=($WORKDIR/trigger_efficiency_ ${i}.root) done for ANGLE_DEG in $ANGLES_DEG[*];do set_variable SIGMA_NS 3.0 set_variable OUTLIERS 3 set_variable OUTPUT_FILE $WORKDIR/matrix\[${ANGLE_DEG}\deg\].root $JPP_DIR/examples/JReconstruction-f"$INPUT_FILES[*]"-o $OUTPUT_FILE-S ${SIGMA_NS}-A ${ANGLE_DEG}-O ${OUTLIERS}-d ${DEBUG}--!fiif[[$OPTION=="plot"]];then if((0));then for H1 in h0 h1;do JPlot1D-f"$WORKDIR/matrix["${^ANGLES_DEG}" deg].root:${H1}"-y"1 2e3"-Y-L TR-T""-\^"number of events [a.u.]"-> o chi2
Definition: JMatrixNZ.sh:106
JKatoomba< JGandalf > gandalf
Definition: JKatoomba.hh:998

Member Data Documentation

JFitParameters JACOUSTICS::JKatoomba_t::parameters

Definition at line 995 of file JKatoomba.hh.

JKatoomba<JEstimator> JACOUSTICS::JKatoomba_t::estimator

Definition at line 996 of file JKatoomba.hh.

JKatoomba<JAbstractMinimiser> JACOUSTICS::JKatoomba_t::evaluator

Definition at line 997 of file JKatoomba.hh.

JKatoomba<JGandalf> JACOUSTICS::JKatoomba_t::gandalf

Definition at line 998 of file JKatoomba.hh.

JModel JACOUSTICS::JKatoomba_t::result
private

Definition at line 1001 of file JKatoomba.hh.


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