1#ifndef JSHOWERFIT_INCLUDE
2#define JSHOWERFIT_INCLUDE
70 using JRegressor_t::operator();
118 const storage_type& storage,
121 const int debug = 0):
129 JRegressor_t::debug =
debug;
130 JRegressor_t::T_ns.setRange(parameters.
TMin_ns, parameters.
TMax_ns);
131 JRegressor_t::Vmax_npe = parameters.
Vmax_npe;
132 JRegressor_t::MAXIMUM_ITERATIONS = 1000;
133 JRegressor_t::EPSILON = 1e-3;
134 JRegressor_t::EPSILON_ABSOLUTE =
true;
136 this->parameters.resize(3);
142 this->estimator.reset(getMEstimator(parameters.
mestimator));
166 const JBuildL0 <JHitR0> buildL0;
173 for (JDAQTimeslice::const_iterator i = timeslice.begin(); i != timeslice.end(); ++i) {
175 if (router.
hasModule(i->getModuleID())) {
177 buffer(*i, router.
getModule(i->getModuleID()));
179 buildL0(buffer, back_inserter(data[i->getModuleID()]));
184 if (!module.empty()) {
215 for (JEvt::const_iterator shower = in.begin(); shower != in.end(); ++shower) {
220 const double time = shower->getT();
224 for (
const auto& module : input.
data) {
232 for (
size_t i = 0; i !=
module->size(); ++i) {
234 if (module.getStatus(i)) {
242 return (hit.
getPMT() == pmt && T_ns(hit.
getT()));
248 } match = { JRegressor_t::T_ns + t1, i };
254 const size_t ns = count_if(module.begin(), module.end(), match);
255 const double QE = wip.
QE;
257 JPMT pmt =
module->getPMT(i);
262 data.push_back(
JPMTW0(pmt, QE, module.frame.getRate(i), ns));
270 shower->getE()), data.begin(), data.end());
272 double NDF =
getCount(data.begin(), data.end()) - this->parameters.size();
279 for (
size_t i = 0; i != this->V.size(); ++i) {
280 if (std::isnan(this->V(i,i)) || this->V(i,i) < 0.0) {
293 out.rbegin()->setV(this->V.size(), this->V);
304 copy(input.
in.begin(), input.
in.end(), back_inserter(out));
Coverage of dynamical detector calibration.
Basic data structure for L0 hit.
Direct access to module in detector data structure.
Data regression method for JFIT::JShower3EZ.
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.
Auxiliary class for map of PMT parameters.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Data structure for PMT parameters.
double QE
relative quantum efficiency
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()
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Data structure for position in three dimensions.
const JPosition3D & getPosition() const
Get position.
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.
Auxiliary class for correction of energy determined by JEnergy.cc.
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
const JEnergyCorrection & correct
input_type getInput(const JModuleRouter &router, const JSummaryRouter &summary, const JDAQEvent &event, const JEvt &in, const coverage_type &coverage) const
Get input data.
JShowerFit(const JShowerFitParameters_t ¶meters, const storage_type &storage, const JPMTParametersMap &pmtParameters, const JEnergyCorrection &correct, const int debug=0)
Parameterized constructor.
const JPMTParametersMap & pmtParameters
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 JPP_COVERAGE_POSITION
coverage of dynamic position calibration of this event
static const int JSHOWERFIT_ENERGY
uncorrected energy [GeV] see JRECONSTRUCTION::JShowerFit
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration of this event
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.
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.
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 (see JFIT::JMEstimator_t)
double DMax_m
maximal distance to optical module [m]
double TMax_ns
maximum time for local coincidences [ns]
double R_Hz
default rate [Hz]
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