Fit function.
148 {
151
152 const double STANDARD_DEVIATIONS = 3.0;
153
155
157
159
162
164
165 for (buffer_type::const_iterator
root = dataL1.begin();
root != dataL1.end(); ++
root) {
166
168
170
171 for (buffer_type::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
172
173 if((
root->getModuleIdentifier() != i->getModuleIdentifier() ) && matching(*i)){
175 }
176 }
177
179
180
181 JEstimator_t fit;
183 double chi2 = numeric_limits<double>::max();
184 int NDF =
distance(
data.begin(), __end1) - JEstimator_t::NUMBER_OF_PARAMETERS;
186
187 if(NDF > 0){
189
190 double ymin = numeric_limits<double>::max();
191
192 buffer_type::iterator __end2 = __end1;
193
195 JEstimator_t::NUMBER_OF_PARAMETERS; ++
n, --__end2) {
196
198
199 do {
200 try {
201
202 fit(
data.begin(), __end2);
203
205
206 if (y < ymin) {
208 vx = fit;
209 chi2 = ymin;
210 NDF =
distance(
data.begin(), __end2) - JEstimator_t::NUMBER_OF_PARAMETERS;
212 }
213 }
215
217
218 ymin -= STANDARD_DEVIATIONS * STANDARD_DEVIATIONS;
219 }
220
221 } else {
222
223 const int number_of_outliers =
distance(
data.begin(), __end1) - JEstimator_t::NUMBER_OF_PARAMETERS - 1;
224
225 buffer_type::iterator __end2 = __end1;
226
227 for (
int n = 0;
n <= number_of_outliers; ++
n) {
228
229 try{
230
231 fit(
data.begin(), __end2);
232 vx = fit;
234 NDF =
distance(
data.begin(), __end2) - JEstimator_t::NUMBER_OF_PARAMETERS;
236
237 }
239
240 double ymax = 0;
241 buffer_type::iterator imax = __end2;
242
243 for (buffer_type::iterator i =
data.begin() + 1; i != __end2; ++i) {
244
246
247 if (y > ymax) {
249 imax = i;
250 }
251 }
252
253 if (ymax > STANDARD_DEVIATIONS * STANDARD_DEVIATIONS) {
254 --__end2;
255 swap(*imax, *__end2);
256 } else {
257 break;
258 }
259 }
260 }
261
263
264
265
268
269 }
270 }
271
273
274 size_t solutions = out.size();
275
276 for(size_t i=0; i < solutions; i++){
281 if (x != 0 || y != 0 || z != 0 || t != 0) {
282
283 out.push_back(
getFit(event(),
285 0,
286 0));
287
288
289
292
293 }
294 }
295 }
296 }
297 }
298 }
299
300
302
303
304
305 JFIT::JEvt::iterator __end = out.end();
306
308
310
312
313 out.erase(__end, out.end());
314
315 } else {
316
318 }
319
320 } else {
321
323 }
324
325 return out;
326 }
Template definition of linear fit.
Data structure for vertex fit.
Data structure for position in three dimensions.
Data structure for normalised vector in positive z-direction.
Auxiliary class to convert binary JMatch operator and given hit to unary match operator.
static const struct JTRIGGER::JHitR1::compare compare
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration of this event
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration of this event
double getChi2(const double P)
Get chi2 corresponding to given probability.
size_t getCount(const array_type< T > &buffer, const JCompare_t &compare)
Count number of unique values.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getQuality(const double chi2, const int N, const int NDF)
Get quality of fit.
JPosition3D getPosition(const JFit &fit)
Get position.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=SINGLE_STAGE)
Get fit.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
JHitIterator_t clusterizeWeight(JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match)
Partition data according given binary match operator.
double sigma_ns
time resolution [ns]
int factoryLimit
factory limit for combinatorics
int numberOfOutliers
maximum number of outliers
int time_grid_ns
edge [ns] of the time grid
int pos_step_m
step in [m] of position grid
int pos_grid_m
edge [m] of the position grid
double DMax_m
maximal distance to optical module [m]
size_t numberOfPrefits
number of prefits
size_t numberOfGrids
number of prefits to be used to build a grid around
int time_step_ns
step in [ns] of time grid