1#ifndef __JRECONSTRUCTION__JMUONPREFIT__
2#define __JRECONSTRUCTION__JMUONPREFIT__
87 using JEstimator_t::operator();
127 const int debug = 0) :
143 const int debug = 0) :
175 buildL2(event, router, !
useL0, back_inserter(dataL1));
183 buffer_type::iterator __end = dataL1.end();
185 __end = unique(dataL1.begin(), __end, equal_to<JDAQModuleIdentifier>());
189 dataL1.erase(__end, dataL1.end());
194 buildL0(event, router,
true, back_inserter(dataL0));
196 __end = dataL0.end();
198 for (buffer_type::iterator i = dataL0.begin(); i != __end; ) {
200 if (match3B.count(*i, dataL1.begin(), dataL1.end()) != 0)
206 dataL0.erase(__end, dataL0.end());
231 data.reserve(dataL0.size() +
238 for (JOmega3D_t::const_iterator dir =
omega.begin(); dir !=
omega.end(); ++dir) {
243 buffer_type::iterator __end =
copy(dataL1.begin(), dataL1.end(),
data.begin());
245 for (buffer_type::iterator i =
data.begin(); i != __end; ++i) {
254 buffer_type::iterator __p =
data.begin();
258 partial_sort(
data.begin(), __p, __end,
cmz);
270 buffer_type::iterator p = __end;
271 buffer_type::iterator q =
copy(dataL0.begin(), dataL0.end(), p);
273 for (buffer_type::iterator i = p; i != q; ++i) {
279 if (match1D.count(*i,
data.begin(), __end) != 0) {
290 if (
distance(
data.begin(), __end) <= NUMBER_OF_PARAMETERS) {
298 double chi2 = numeric_limits<double>::max();
299 int NDF =
distance(
data.begin(), __end) - NUMBER_OF_PARAMETERS;
306 (*this)(
data.begin(), __end);
316 catch(
const exception& error) {
327 if (number_of_outliers > NDF - 1) {
328 number_of_outliers = NDF - 1;
337 buffer_type::iterator __end1 = prev(__end,
n);
343 (*this)(
data.begin(), __end1);
354 WARNING(endl <<
"JMuonPrefit: invalid chi2 " << y << endl);
366 NDF =
distance(
data.begin(), __end1) - NUMBER_OF_PARAMETERS;
371 catch(
const exception& error) {}
378 const int number_of_outliers = NDF - 1;
380 for (
int n = 1;
n <= number_of_outliers; ++
n) {
385 for (
size_t i = 0; i !=
Y.size(); ++i) {
403 this->update(
data.begin(), __end,
V);
412 catch(
const exception& error) {
431 JEvt::iterator __end = out.end();
439 JEvt::iterator p2 =
p1;
441 for (JEvt::iterator i =
p1; i != out.end(); ++i) {
453 sort(
p1, out.end(), pointing);
455 for (
double Q = p2->getQ();
462 swap(*(__end++), *p2);
477 out.erase(__end, out.end());
500 inline bool operator()(
const T& first,
const T& second)
const
505 second.getT() * getSpeedOfLight() - second.getZ());
Algorithms for hit clustering and sorting.
Coverage of dynamical detector calibration.
Reduced data structure for L1 hit.
Linear fit of JFIT::JLine1Z.
Match operator for Cherenkov light from muon with given direction.
Match operator for Cherenkov light from muon in any direction.
General purpose messaging.
Direct access to module in detector data structure.
Router for direct addressing of module data in detector data structure.
Template definition of linear fit.
Data structure for set of track fit results.
Data structure for fit of straight line paralel to z-axis.
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
void set(const JVector3D &pos, T __begin, T __end, const double alpha, const double sigma)
Set co-variance matrix.
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
void set(const JLine1Z &track, T __begin, T __end)
Set time residual vector.
Direction set covering (part of) solid angle.
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Auxiliary class to compare fit results with respect to a reference direction (e.g....
Reduced data structure for L1 hit.
3D match criterion with road width.
int getModuleID() const
Get module identifier.
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
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.
Auxiliary classes and methods for mathematical operations.
const double getSpeedOfLight()
Get 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.
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.
JEvt::iterator gridify(JEvt::iterator __begin, JEvt::iterator __end, const int N)
Gridify set of fits.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Auxiliary classes and methods for triggering.
JHitIterator_t clusterize(JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match, const int Nmin=1)
Partition data according given binary match operator.
JHitIterator_t clusterizeWeight(JHitIterator_t __begin, JHitIterator_t __end, const JMatch_t &match)
Partition data according given binary match operator.
KM3NeT DAQ data structures and auxiliaries.
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.
void update(const size_t k, const double value)
Update inverted matrix at given diagonal element.
void invert()
Invert matrix according LDU decomposition.
Data structure for fit parameters.
size_t numberOfPostfits
number of postfits
bool useL0
option for L0 hit use
double roadWidth_m
road width [m]
size_t numberOfPrefits
number of prefits
int numberOfOutliers
maximum number of outliers
double ctMin
minimal cosine space angle between PMT axes
double Qwatershed
minimal quality step
int factoryLimit
factory limit for combinatorics
double TMaxLocal_ns
time window for local coincidences [ns]
double gridAngle_deg
grid angle for directions [deg]
int NMaxHits
maximal number of hits
double sigma_ns
time resolution [ns]
Auxiliary data structure for sorting of hits.
bool operator()(const T &first, const T &second) const
Sort hits according times corrected for position along z-axis.
Wrapper class to make pre-fit of muon trajectory.
static constexpr double STANDARD_DEVIATIONS
number of standard deviations for outlier removal [unit]
static const struct JRECONSTRUCTION::JMuonPrefit::cmz cmz
input_type getInput(const JModuleRouter &router, const JDAQEvent &event, const coverage_type &coverage) const
Get input data.
JMuonPrefit(const JMuonPrefitParameters_t ¶meters, const int debug=0)
Constructor.
JTRIGGER::JHitR1 hit_type
JEstimator< JLine1Z > JEstimator_t
JEvt operator()(const input_type &input)
Fit function.
std::vector< hit_type > buffer_type
JMuonPrefit(const JMuonPrefitParameters_t ¶meters, const JOmega3D &omega, const int debug=0)
Constructor.
Auxiliary data structure for sorting of hits.
Data structure for L2 parameters.