1 #ifndef __JRECONSTRUCTION__JMUONPREFIT__
2 #define __JRECONSTRUCTION__JMUONPREFIT__
83 using JEstimator_t::operator();
94 const int debug = 0) :
115 const int debug = 0) :
142 buildL2(event,
router, !
useL0, back_inserter(dataL1));
150 buffer_type::iterator __end = dataL1.end();
152 __end = unique(dataL1.begin(), __end, equal_to<JDAQModuleIdentifier>());
156 dataL1.erase(__end, dataL1.end());
161 buildL0(event,
router,
true, back_inserter(dataL0));
163 __end = dataL0.end();
165 for (buffer_type::iterator i = dataL0.begin(); i != __end; ) {
167 if (match3B.count(*i, dataL1.begin(), dataL1.end()) != 0)
173 dataL0.erase(__end, dataL0.end());
176 return (*
this)(dataL0, dataL1);
193 const double STANDARD_DEVIATIONS = 3.0;
198 data.reserve(dataL0.size() +
203 for (JOmega3D_t::const_iterator dir =
omega.begin(); dir !=
omega.end(); ++dir) {
208 buffer_type::iterator __end =
copy(dataL1.begin(), dataL1.end(),
data.begin());
210 for (buffer_type::iterator i =
data.begin(); i != __end; ++i) {
219 buffer_type::iterator __p =
data.begin();
223 partial_sort(
data.begin(), __p, __end,
cmz);
235 buffer_type::iterator p = __end;
236 buffer_type::iterator q =
copy(dataL0.begin(), dataL0.end(), p);
238 for (buffer_type::iterator i = p; i != q; ++i) {
244 if (match1D.count(*i,
data.begin(), __end) != 0) {
255 if (
distance(
data.begin(), __end) <= NUMBER_OF_PARAMETERS) {
263 double chi2 = numeric_limits<double>::max();
264 int NDF =
distance(
data.begin(), __end) - NUMBER_OF_PARAMETERS;
272 if (number_of_outliers > NDF - 1) {
273 number_of_outliers = NDF - 1;
276 double ymin = numeric_limits<double>::max();
278 buffer_type::iterator __end1 = __end;
280 for (
int n = 0;
n <= number_of_outliers; ++
n, --__end1) {
292 (*this)(
data.begin(), __end1);
301 if (
y <= -(STANDARD_DEVIATIONS * STANDARD_DEVIATIONS)) {
303 WARNING(endl <<
"chi2(1) " <<
y << endl);
315 NDF =
distance(
data.begin(), __end1) - NUMBER_OF_PARAMETERS;
320 catch(
const exception& error) {}
324 ymin -= STANDARD_DEVIATIONS * STANDARD_DEVIATIONS;
329 const int number_of_outliers = NDF - 1;
333 (*this)(
data.begin(), __end);
340 for (
int n = 0;
n <= number_of_outliers; ++
n) {
345 for (
size_t i = 0; i !=
Y.size(); ++i) {
355 if (ymax < STANDARD_DEVIATIONS * STANDARD_DEVIATIONS) {
363 this->update(
data.begin(), __end,
V);
371 catch(
const exception& error) {
375 static_cast<JLine1Z&
>(*this) = tz;
386 catch(
const exception& error) {}
389 if (chi2 != numeric_limits<double>::max()) {
400 JEvt::iterator __end = out.end();
408 JEvt::iterator p2 =
p1;
410 for (JEvt::iterator i =
p1; i != out.end(); ++i) {
411 if (i->getQ() > p2->getQ()) {
422 for (
double Q = p2->getQ();
p1 != out.end() && (
p1->getQ() >= p2->getQ() -
Qmin ||
p1->getQ() <= Q); Q = (
p1++)->getQ()) {}
424 swap(*(__end++), *p2);
444 JEvt::iterator __p = __end;
459 out.erase(__end, out.end());
482 inline bool operator()(
const T& first,
const T& second)
const
Algorithms for hit clustering and sorting.
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.
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.
Linear fit of straight line parallel to z-axis to set of hits (objects with position and time).
Template definition of linear fit.
Data structure for set of track fit results.
double getDZ() const
Get Z-slope.
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.
const JClass_t & getReference() const
Get reference to object.
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 JMUONPREFIT
void copy(const Head &from, JHead &to)
Copy header from from to to.
double getQuality(const double chi2, const int NDF)
Get quality of fit.
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
int getNumberOfPMTs(const JModule &module)
Get number of PMTs.
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.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Auxiliary classes and methods for mathematical operations.
static const double PI
Mathematical constants.
const double getSpeedOfLight()
Get speed of light.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
static const struct JTRIGGER::clusterize clusterize
static const struct JTRIGGER::clusterizeWeight clusterizeWeight
static const JModuleCounter getNumberOfModules
Function object to count unique modules.
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.
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 DZMax
maximal slope for downward pointing solutions
double Qmin
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]
size_t numberOfDZMax
additional number of downward pointing solutions
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 const struct JRECONSTRUCTION::JMuonPrefit::cmz cmz
JTRIGGER::JHitR1 hit_type
JEvt operator()(const KM3NETDAQ::JDAQEvent &event)
Fit function.
JEvt operator()(const buffer_type &dataL0, const buffer_type &dataL1)
Fit function.
JMuonPrefit(const JMuonPrefitParameters_t ¶meters, const JModuleRouter &router, const JOmega3D &omega, const int debug=0)
Constructor.
JMuonPrefit(const JMuonPrefitParameters_t ¶meters, const JModuleRouter &router, const int debug=0)
Constructor.
const JModuleRouter & router
std::vector< hit_type > buffer_type
void configure()
Configure internal buffer(s).
JEstimator< JLine1Z > JEstimator_t
Auxiliary data structure for sorting of hits.
Data structure for L2 parameters.