Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
template<class T >
result_type< T > operator() (T __begin, T __end)
 Fit.
 

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

◆ JGlobalfit()

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 :
39 estimator(geometry, V, parameters.option),
40 evaluator(geometry, V, parameters.option),
41 gandalf (geometry, V, parameters.option)
42 {
43 using namespace JPP;
44
46 gandalf .estimator.reset(getMEstimator(parameters.mestimator));
47 }
JMEstimator * getMEstimator(const int type)
Get M-Estimator.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JKatoomba< JEstimator > estimator
JKatoomba< JGandalf > gandalf
JKatoomba< JAbstractMinimiser > evaluator
JFitParameters parameters

Member Function Documentation

◆ operator()()

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
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
double getWeight(T __begin, T __end)
Get total weight of data points.
void model(JModel_t &value)
Auxiliary function to constrain model during fit.
Definition JGandalf.hh:57
return result
Definition JPolint.hh:862
double stdev
standard deviation for outlier removal
Model for fit to acoustics data.
size_t getN() const
Get number of fit parameters.

Member Data Documentation

◆ parameters

JFitParameters JACOUSTICS::JGlobalfit::parameters

Definition at line 165 of file JGlobalfit.hh.

◆ estimator

JKatoomba<JEstimator> JACOUSTICS::JGlobalfit::estimator

Definition at line 166 of file JGlobalfit.hh.

◆ evaluator

JKatoomba<JAbstractMinimiser> JACOUSTICS::JGlobalfit::evaluator

Definition at line 167 of file JGlobalfit.hh.

◆ gandalf

JKatoomba<JGandalf> JACOUSTICS::JGlobalfit::gandalf

Definition at line 168 of file JGlobalfit.hh.


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