1 #ifndef JMUONPREFIT_INCLUDE
2 #define JMUONPREFIT_INCLUDE
79 omega_(parameters.gridAngle_deg* JTOOLS::
PI/180.0)
151 const int FACTORY_LIMIT = 8;
152 const double STANDARD_DEVIATIONS = 3.0;
153 const double HIT_OFF = 1.0e3 * sigma_ns * sigma_ns;
154 const int NUMBER_OF_L1HITS = (useL0 ? 1 : 4);
155 const int MAXIMUM_NUMBER_OF_HITS = 50;
172 buildL0( timeSliceBuildL0, *
router_, back_inserter(dataL0) );
173 buildL2( timeSliceBuildL2, *
router_, back_inserter(dataL1) );
177 JDataL1_t::iterator __end = std::unique(dataL1.begin(), dataL1.end(),
178 std::equal_to<KM3NETDAQ::JDAQModuleIdentifier>()
183 if (std::distance(dataL1.begin(), __end) >= NUMBER_OF_L1HITS) {
187 for (JGEOMETRY3D::JOmega3D_t::const_iterator dir =
omega_.begin(); dir !=
omega_.end(); ++dir) {
193 std::copy(dataL1.begin(), __end, back_inserter(data));
195 for (JDataR1_t::iterator i = data.begin(); i != data.end(); ++i) {
200 JDataR1_t::iterator __end1 = data.end();
205 if ( std::distance(data.begin(), __end1) > MAXIMUM_NUMBER_OF_HITS ) {
207 std::advance(__end1 = data.begin(), MAXIMUM_NUMBER_OF_HITS);
209 std::partial_sort(data.begin(), __end1, data.end(),
cmz);
217 if ( std::distance(data.begin(), __end1) < NUMBER_OF_L1HITS ) {
223 data.erase(__end1, data.end());
225 data.reserve(data.size() + dataL0.size());
229 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
231 if ( std::find_if( data.begin(), __end1,
232 std::bind2nd(std::equal_to<KM3NETDAQ::JDAQModuleIdentifier>(), i->getModuleID())
238 if ( std::count_if(data.begin(), __end1,
JBind2nd(match1D,hit)) >= NUMBER_OF_L1HITS ) {
255 double chi2 = std::numeric_limits<double>::max();
262 if ( std::distance(data.begin(), __end1) <= FACTORY_LIMIT ) {
264 double ymin = std::numeric_limits<double>::max();
266 JDataR1_t::iterator __end2 = __end1;
272 std::sort(data.begin(), __end1, compare);
280 V.
set(fit, data.begin(), __end2, gridAngle_deg, sigma_ns);
281 Y.
set(fit, data.begin(), __end2);
290 }
else if (y < ymin) {
302 ymin -= STANDARD_DEVIATIONS * STANDARD_DEVIATIONS;
313 V.
set(fit, data.begin(), __end1, gridAngle_deg, sigma_ns);
314 Y.
set(fit, data.begin(), __end1);
321 for (
int n = 0; n <= number_of_outliers && NDF > 0; ++n, --NDF) {
326 for (
unsigned int i = 0; i != Y.size(); ++i) {
333 }
else if (y > ymax) {
339 if (ymax < STANDARD_DEVIATIONS * STANDARD_DEVIATIONS) {
345 fit.update(data.begin(), __end1, V);
347 Y.
set(fit, data.begin(), __end1);
362 const double energy(0);
371 if (numberOfPrefits > 0) {
373 JEvt::iterator __end = out.end();
375 std::advance(__end = out.begin(), std::min(numberOfPrefits, out.size()));
377 std::partial_sort(out.begin(), __end, out.end(),
qualitySorter);
381 if ( std::count_if(out.begin(), __end,
385 JEvt::iterator __begin = __end;
386 JEvt::iterator __q = std::partition(__begin, out.end(),
390 std::advance(__end = __begin, std::min(numberOfPrefits, (
size_t) std::distance(__begin, __q)));
395 out.erase(__end, out.end());
JMuonPrefit()
Default constructor.
double getT() const
Get calibrated time of hit.
Linear fit of straight line parallel to z-axis to set of hits (objects with position and time)...
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Match operator for Cherenkov light from muon with given direction.
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
JMuonPrefit(const JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > &router, const JFIT::JMuonPrefitParameters_t ¶meters, const JGEOMETRY3D::JOmega3D &omega)
Parameterized constructor.
void set(const JVector3D &pos, T __begin, T __end, const double alpha, const double sigma)
Set co-variance matrix.
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Definition for fit results, A good fit should hold: OKAY.
Algorithms for hit clustering and sorting.
int getCount(const JHitL0 &hit)
Get hit count.
Container for historical events.
Direction set covering (part of) solid angle.
Linear fit of JFIT::JLine1Z.
Template definition of linear fit.
void update(const unsigned int k, const double extra)
Update inverted matrix at given diagonal element.
JHitIterator_t clusterizeWeight(JHitIterator_t __begin, JHitIterator_t __end, const JMatch< JHit_t > &match)
Partition data according given binary match operator.
JFit getFit(const JHistory &history, const JTrack3D &track, const double Q, const int NDF, const double energy=0.0, const int status=0)
Get fit.
Basic data structure for L0 hit.
Auxiliary class for permutations of L1 hits.
Definition of fit parameters from various applications.
JMuonPrefit(const JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > &router, const JFIT::JMuonPrefitParameters_t ¶meters)
Parameterized constructor.
JHitIterator_t clusterize(JHitIterator_t __begin, JHitIterator_t __end, const JMatch< JHit_t > &match, const int Nmin=1)
Partition data according given binary match operator.
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
Match operator for Cherenkov light from muon in any direction.
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
void set(const JLine1Z &track, T __begin, T __end)
Set time residual vector.
Data struct that holds the parameters for JMuonPrefit angular reconstruction This is part of the cons...
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
double getDZ() const
Get Z-slope.
Reduced data structure for L1 hit.
JGEOMETRY3D::JOmega3D omega_
double getQuality(const double chi2, const int NDF)
Get quality of fit.
Data structure for set of track fit results.
JFIT::JMuonPrefitParameters_t parameters_
static bool cmz(const JTRIGGER::JHitR1 &first, const JTRIGGER::JHitR1 &second)
Sort hits according times corrected for position along z-axis.
Data structure for fit of straight line paralel to z-axis.
JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > router_
void copy(const Head &from, JHead &to)
Copy header from from to to.
2-dimensional frame with time calibrated data from one optical module.
Reduced data structure for L1 hit.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
void getJEvt(const KM3NETDAQ::JDAQTimeslice &timeSliceBuildL0, const KM3NETDAQ::JDAQTimeslice &timeSliceBuildL2, JFIT::JEvt &out) const
Declaration Member function that actually performs the reconstruction.
class to handle Prefit angular reconstruction.
double getChi2(const double P)
Get chi2 corresponding to given probability.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
double getZ() const
Get z position.
void invert()
Invert matrix.
Basic data structure for L1 hit.
3D match criterion with road width.