1#ifndef JSHOWERFIT_INCLUDE
2#define JSHOWERFIT_INCLUDE
86 using JRegressor_t::operator();
133 const storage_type& storage,
135 const int debug = 0):
142 JRegressor_t::debug =
debug;
143 JRegressor_t::T_ns.setRange(parameters.
TMin_ns, parameters.
TMax_ns);
144 JRegressor_t::Vmax_npe = parameters.
Vmax_npe;
145 JRegressor_t::MAXIMUM_ITERATIONS = 1000;
146 JRegressor_t::EPSILON = 1e-3;
147 JRegressor_t::EPSILON_ABSOLUTE =
true;
149 this->parameters.resize(3);
155 this->estimator.reset(getMEstimator(parameters.
mestimator));
179 const JBuildL0 <JHitR0> buildL0;
186 for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
188 if (router.
hasModule(i->getModuleID())) {
190 buffer(*i, router.
getModule(i->getModuleID()));
192 buildL0(buffer, back_inserter(data[i->getModuleID()]));
197 if (!module.empty()) {
228 for (JEvt::const_iterator shower = in.begin(); shower != in.end(); ++shower) {
233 const double time = shower->getT();
237 for (
const auto& module : input.
data) {
244 for (
size_t i = 0; i !=
module->size(); ++i) {
245 if (module.getStatus(i)) {
253 return (hit.
getPMT() == pmt && T_ns(hit.
getT()));
259 } match = { JRegressor_t::T_ns + t1, i };
261 JPMT pmt =
module->getPMT(i);
265 data.push_back(
JPMTW0(pmt, module.frame.getRate(i), count_if(module.begin(), module.end(), match)));
273 shower->getE()), data.begin(), data.end());
275 double NDF =
getCount(data.begin(), data.end()) - this->parameters.size();
277 JShower3E sh_fit(this->value.getPosition(), this->value.getDirection(),
278 this->value.getT(),
correct(this->value.getE()));
283 for (
size_t i = 0; i != this->V.size(); ++i) {
284 if (std::isnan(this->V(i,i)) || this->V(i,i) < 0.0) {
295 NDF, sh_fit.
getE()));
296 out.rbegin()->setV(this->V.size(), this->V);
307 copy(input.
in.begin(), input.
in.end(), back_inserter(out));
Algorithms for hit clustering and sorting.
Coverage of dynamical detector calibration.
Auxiliary class to extract a subset of optical modules from a detector.
Data structure for detector geometry and calibration.
Basic data structure for L0 hit.
Basic data structure for L1 hit.
Reduced data structure for L1 hit.
Match operator for Cherenkov light from shower in any direction.
Data regression method for JFIT::JShower3EZ.
Basic data structure for time and time over threshold information of hit.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Router for direct addressing of module data in detector data structure.
bool hasModule(const JObjectID &id) const
Has module.
const JModule & getModule(const JObjectID &id) const
Get module parameters.
Data structure for PMT geometry, calibration and status.
Data structure for fit of energy.
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 in positive z-direction with energy.
static parameter_type pE()
static parameter_type pDY()
static parameter_type pDX()
Auxiliary class for correction of energy determined by JShowerEnergy.cc.
JAxis3D & rotate_back(const JRotation3D &R)
Rotate back axis.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
JTime & add(const JTime &value)
Addition operator.
double getE() const
Get energy.
Data structure for vector in three dimensions.
double getLength() const
Get length.
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Data structure for normalised vector in positive z-direction.
const JClass_t & getReference() const
Get reference to object.
class to handle the direction fit of the shower reconstruction, mainly dedicated for ORCA
JEvt operator()(const input_type &input)
Fit function.
std::vector< module_type > detector_type
JRegressor< JShower3EZ, JGandalf > JRegressor_t
JShowerFit(const JShowerFitParameters_t ¶meters, const storage_type &storage, const JShowerEnergyCorrection &correct, const int debug=0)
Parameterized constructor.
input_type getInput(const JModuleRouter &router, const JSummaryRouter &summary, const JDAQEvent &event, const JEvt &in, const coverage_type &coverage) const
Get input data.
const JShowerEnergyCorrection & correct
Router for fast addressing of summary data in KM3NETDAQ::JDAQSummaryslice data structure as a functio...
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
Reduced data structure for L0 hit.
JPMT_t getPMT() const
Get PMT.
double getT() const
Get calibrated time of hit.
2-dimensional frame with time calibrated data from one optical module.
Data storage class for rate measurements of all PMTs in one module.
static const int JSHOWERCOMPLETEFIT
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application
static const int JSHOWERFIT_ENERGY
uncorrected energy [GeV] from JShowerFit.cc
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
void copy(const Head &from, JHead &to)
Copy header from from to to.
size_t getCount(const array_type< T > &buffer, const JCompare_t &compare)
Count number of unique values.
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
const double getInverseSpeedOfLight()
Get inverse speed of light.
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.
JDirection3D getDirection(const JFit &fit)
Get direction.
Auxiliary classes and methods for triggering.
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.
Auxiliary class for handling PMT geometry, rate and response.
Template definition of a data regressor of given model.
Auxiliary class for handling module response.
Data structure for fit parameters.
double Vmax_npe
maximum number of of photo-electrons
int mestimator
M-estimator
double DMax_m
maximal distance to optical module [m]
double TMax_ns
maximum time for local coincidences [ns]
double TMin_ns
minimum time for local coincidences [ns]
double DStep_m
step increase for the distance to optical module [m]
size_t numberOfPrefits
number of prefits