1#ifndef __JRECONSTRUCTION__JMUONGANDALF__
2#define __JRECONSTRUCTION__JMUONGANDALF__
10#include "TMatrixDSym.h"
11#include "TMatrixDSymEigen.h"
88 using JRegressor_t::operator();
132 const storage_type& storage,
133 const int debug = 0) :
141 JRegressor_t::debug =
debug;
143 JRegressor_t::MAXIMUM_ITERATIONS =
NMax;
145 this->parameters.resize(5);
180 buildL0(event, router,
true, back_inserter(data));
182 for (
const auto& hit : data) {
199 using namespace JFIT;
218 for (JEvt::const_iterator track = in.begin(); track != in.end(); ++track) {
235 for (buffer_type::const_iterator i = data.begin(); i != data.end(); ++i) {
242 buffer.push_back(hit);
250 buffer_type::iterator __end = unique(buffer.begin(), buffer.end(), equal_to<JDAQPMTIdentifier>());
253 const int NDF =
distance(buffer.begin(), __end) - this->parameters.size();
259 if (track->getE() > 0.1)
260 JRegressor_t::E_GeV = track->getE();
264 const double chi2 = (*this)(
JLine3Z(tz), buffer.begin(), __end);
270 for (
size_t i = 0; i != this->V.size(); ++i) {
271 if (std::isnan(this->V(i,i)) || this->V(i,i) <= 0.0) {
286 const size_t N = this->V.size();
290 for (
size_t row = 0; row != N; ++row) {
291 for (
size_t col = 0; col != N; ++col) {
292 M(row,col) = this->V(row,col);
296 const TMatrixDSymEigen E(M);
297 const TVectorD& Y = E.GetEigenValues();
299 out.rbegin()->setV(this->V.size(), this->V);
301 out.rbegin()->setW(track->getW());
302 out.rbegin()->setW(
JGANDALF_BETA0_RAD, sqrt(this->error.getDX() * this->error.getDX() +
303 this->error.getDY() * this->error.getDY()));
304 out.rbegin()->setW(
JGANDALF_BETA1_RAD, sqrt(this->error.getDX() * this->error.getDY()));
315 for (JEvt::iterator i = out.begin(); i != out.end(); ++i) {
317 double Q = numeric_limits<double>::max();
319 for (JEvt::iterator p = out.begin(); p != out.end(); ++p) {
322 if (i->getQ() - p->getQ() < Q) {
323 Q = i->getQ() - p->getQ();
337 copy(input.
in.begin(), input.
in.end(), back_inserter(out));
Coverage of dynamical detector calibration.
Basic data structure for L0 hit.
Data regression method for JFIT::JLine3Z.
General purpose messaging.
Direct access to module in detector data structure.
Auxiliary class to define a range between two values.
Router for direct addressing of module data in detector data structure.
Data structure for set of track fit results.
void select(const JSelector_t &selector)
Select fits.
Fit method based on the Levenberg-Marquardt method.
Data structure for fit of straight line paralel to z-axis.
static parameter_type pY()
static parameter_type pX()
static parameter_type pT()
Data structure for fit of straight line in positive z-direction.
static parameter_type pDY()
static parameter_type pDX()
JAxis3D & rotate_back(const JRotation3D &R)
Rotate back axis.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Auxiliary class for a hit with background rate value.
Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a functio...
double getRate(const JDAQPMTIdentifier &id) const
Get rate.
static const int JGANDALF_LIKELIHOOD_RATIO
likelihood ratio between this and best alternative fit from JMuonGandalf
static const int JGANDALF_LAMBDA
largest eigenvalue of error matrix from JMuonGandalf
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application
static const int JSTART_LENGTH_METRES
distance between projected positions on the track of optical modules for which the response does not ...
static const int JGANDALF_BETA0_RAD
KM3NeT Data Definitions v3.6.1-2-g905a24d https://git.km3net.de/common/km3net-dataformat.
static const int JGANDALF_NUMBER_OF_ITERATIONS
number of iterations from JMuonGandalf
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
static const int JGANDALF_BETA1_RAD
uncertainty on the reconstructed track direction from the error matrix [rad] (to be deprecated) from ...
static const int JGANDALF_NUMBER_OF_HITS
number of hits from JMuonGandalf
Auxiliary classes and methods for linear and iterative data regression.
JTOOLS::JRange< double > JZRange
Auxiliary classes and methods for 3D geometrical objects and operations.
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.
void copy(const JFIT::JEvt::const_iterator __begin, const JFIT::JEvt::const_iterator __end, Evt &out)
Copy tracks.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
double getDot(const JFit &first, const JFit &second)
Get dot product.
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.
JDirection3D getDirection(const JFit &fit)
Get direction.
Auxiliary classes and methods for triggering.
Model for fit to acoustics data.
Data structure for coverage of detector by dynamical calibrations.
double position
coverage of detector by available position calibration [0,1]
double orientation
coverage of detector by available orientation calibration [0,1]
Auxiliary class for historical event.
Auxiliary class to test history.
Template definition of a data regressor of given model.
Data structure for fit parameters.
double cosLR
maximal cosine space angle likelihood ratio test
double roadWidth_m
road width [m]
double VMax_npe
maximum number of of photo-electrons
double ZMax_m
maximal z-positon [m]
double ZMin_m
minimal z-positon [m]
int NMax
maximum number of iterations
size_t numberOfPrefits
number of prefits
Wrapper class to make final fit of muon trajectory.
input_type getInput(const JModuleRouter &router, const JSummaryRouter &summary, const JDAQEvent &event, const JEvt &in, const coverage_type &coverage) const
Get input data.
std::vector< hit_type > buffer_type
JMuonGandalf(const JMuonGandalfParameters_t ¶meters, const storage_type &storage, const int debug=0)
Constructor.
JRegressor< JLine3Z, JGandalf > JRegressor_t
JEvt operator()(const input_type &input)
Fit function.
Auxiliary data structure for sorting of hits.