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
Classes | Public Member Functions | Public Attributes | List of all members
JACOUSTICS::JGlobalfit Struct Reference

Global fit of prameterised detector geometry to acoustics data. More...

#include <JGlobalfit.hh>

Classes

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

Public Member Functions

 JGlobalfit (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
 

Detailed Description

Global fit of prameterised detector geometry to acoustics data.

Definition at line 29 of file JGlobalfit.hh.

Constructor & Destructor Documentation

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

Constructor.

Parameters
geometrydetector geometry
Vsound velocity
parametersparameters

Definition at line 37 of file JGlobalfit.hh.

37  :
38  parameters(parameters),
39  estimator(geometry, V, parameters.option),
40  evaluator(geometry, V, parameters.option),
41  gandalf (geometry, V, parameters.option)
42  {
43  using namespace JPP;
44 
45  evaluator.estimator.reset(getMEstimator(parameters.mestimator));
46  gandalf .estimator.reset(getMEstimator(parameters.mestimator));
47  }
JFitParameters parameters
Definition: JGlobalfit.hh:165
int mestimator
M-estimator.
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
Definition: JMEstimator.hh:203
JKatoomba< JGandalf > gandalf
Definition: JGlobalfit.hh:168
JKatoomba< JEstimator > estimator
Definition: JGlobalfit.hh:166
JKatoomba< JAbstractMinimiser > evaluator
Definition: JGlobalfit.hh:167

Member Function Documentation

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

Fit.

Parameters
__beginbegin of data
__endend of data
Returns
fit result

Definition at line 97 of file JGlobalfit.hh.

98  {
99  using namespace std;
100 
101  JModel model;
102  JModel& result = gandalf.value; // start value
103 
104  result = estimator(__begin, __end); // pre-fit
105 
106  if (parameters.stdev > 0.0) { // remove outliers
107 
108  double chi2[] = { numeric_limits<double>::max(),
109  numeric_limits<double>::max() };
110 
111  for ( ; ; ) {
112 
113  T out = __end;
114 
115  double xmax = 0.0;
116 
117  for (T hit = __begin; hit != __end; ++hit) {
118 
119  const double x = fabs(hit->getValue() - estimator.getToA(result, *hit)) / hit->getSigma();
120 
121  if (x > xmax) {
122  xmax = x;
123  out = hit;
124  }
125  }
126 
127  if (xmax > parameters.stdev) {
128 
129  if (chi2[0] == numeric_limits<double>::max()) {
130  chi2[0] = evaluator(result, __begin, __end);
131  }
132 
133  model = result;
134 
135  iter_swap(out, --__end);
136 
137  result = estimator(__begin, __end);
138  chi2[1] = evaluator(result, __begin, __end);
139 
140  if (chi2[0] - chi2[1] > parameters.stdev * parameters.stdev) {
141 
142  chi2[0] = chi2[1];
143 
144  continue;
145 
146  } else {
147 
148  iter_swap(out, __end++);
149 
150  result = model;
151  }
152  }
153 
154  break;
155  }
156  }
157 
158  const double chi2 = gandalf (__begin, __end) / gandalf.estimator->getRho(1.0);
159  const double ndf = getWeight(__begin, __end) - gandalf.value.getN();
160 
161  return { gandalf.value, chi2, ndf, __begin, __end }; // return values
162  }
const double xmax
Definition: JQuadrature.cc:24
size_t getN() const
Get number of fit parameters.
double getWeight(T __begin, T __end)
Get total weight of data points.
Definition: JKatoomba_t.hh:60
double stdev
standard deviation for outlier removal
Model for fit to acoustics data.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JFitParameters parameters
Definition: JGlobalfit.hh:165
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: JGlobalfit.hh:168
JKatoomba< JEstimator > estimator
Definition: JGlobalfit.hh:166
JKatoomba< JAbstractMinimiser > evaluator
Definition: JGlobalfit.hh:167

Member Data Documentation

JFitParameters JACOUSTICS::JGlobalfit::parameters

Definition at line 165 of file JGlobalfit.hh.

JKatoomba<JEstimator> JACOUSTICS::JGlobalfit::estimator

Definition at line 166 of file JGlobalfit.hh.

JKatoomba<JAbstractMinimiser> JACOUSTICS::JGlobalfit::evaluator

Definition at line 167 of file JGlobalfit.hh.

JKatoomba<JGandalf> JACOUSTICS::JGlobalfit::gandalf

Definition at line 168 of file JGlobalfit.hh.


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