1 #ifndef JORCASHOWERPREFIT_INCLUDE
2 #define JORCASHOWERPREFIT_INCLUDE
59 std::shared_ptr<JRegressor_t>
fit2_;
87 fit2_ = std::make_shared<JRegressor_t>(
true);
144 const int FACTORY_LIMIT = 40;
145 const double STANDARD_DEVIATIONS = 1.0;
146 const int NUMBER_OF_L1HITS = (useL0 ? 1 : 4);
158 JDataL0_t dataL0_selected;
161 buildL0(timeSliceBuildL0, *
moduleRouter_, back_inserter(dataL0));
162 buildL2(timeSliceBuildL1, *
moduleRouter_, back_inserter(data));
164 JDataL1_t::iterator __end =
clusterizeWeight(data.begin(), data.end(), match3G);
166 if(std::distance(data.begin(), __end) >= NUMBER_OF_L1HITS){
169 std::copy(data.begin(), data.end(), std::back_inserter(dataL1));
170 JDataL1_t::iterator __end1 = dataL1.end();
176 dataL1.erase(__end1, dataL1.end());
177 dataL1.reserve(dataL1.size() + dataL0.size());
178 __end1 = dataL1.end();
180 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
184 if (std::count_if(dataL1.begin(), __end1,
JTRIGGER::JBind2nd(match3G,hit)) >= NUMBER_OF_L1HITS){
185 dataL1.push_back(hit);
189 std::sort(__end1, dataL1.end(), compare);
190 __end1 =
clusterize(__end1, dataL1.end(), match3G);
197 double chi2 = std::numeric_limits<double>::max();
201 if(std::distance(dataL1.begin(), __end1) <= FACTORY_LIMIT){
203 double ymin = std::numeric_limits<double>::max();
205 JDataL1_t::iterator __end2 = __end1;
207 for (
int n = 0; n <= numberOfOutliers && std::distance(dataL1.begin(), __end2) >
210 std::sort(dataL1.begin(), __end1, compare);
215 fit(dataL1.begin(), __end2);
216 double y =
JFIT::getChi2(fit, dataL1.begin(), __end2, sigma_ns);
219 std::cout <<
"chi2(1) " << y << std::endl;
220 }
else if (y < ymin) {
232 ymin -= STANDARD_DEVIATIONS * STANDARD_DEVIATIONS;
238 fit(dataL1.begin(), __end1);
257 dataL0_selected.clear();
262 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
267 dataL0_selected.push_back(hit);
271 double simplex_step = 2;
272 fit2_->step.resize(4);
278 chi2 = (*fit2_)(point_shifted, dataL0_selected.begin(), dataL0_selected.end());
283 const double energy(0);
285 fitResult,
getQuality(chi2, (useL0 ? N : NDF)),
288 OutFits.push_back(outFit);
289 OutFits.rbegin()->setW(13, chi2);
290 OutFits.rbegin()->setW(14, NDF);
299 std::cout<<
"Too few hits " << std::endl;
static int debug
debug level (default is off).
JORCAShowerPrefit()
Default constructor.
JFIT::JRegressor< JPoint4D, JSimplex > JRegressor_t
Data structure for L1 hit.
JBinder2nd< JHit_t > JBind2nd(const JMatch< JHit_t > &match, const JHit_t &second)
Auxiliary method to create JBinder2nd object.
JTOOLS::JRange< double > time_grid
Definition for fit results, A good fit should hold: OKAY.
Algorithms for hit clustering and sorting.
JFIT::JShowerPrefitParameters_t parameters_
Data structure for vertex fit.
int getCount(const JHitL0 &hit)
Get hit count.
static bool totW(const JTRIGGER::JHitR1 &first, const JTRIGGER::JHitR1 &second)
Member function used in the predicate of std::sort, to sort hits according to ToT and W...
Container for historical events.
Template definition of linear fit.
void getJEvt(const KM3NETDAQ::JDAQTimeslice &timeSliceBuildL0, const KM3NETDAQ::JDAQTimeslice &timeSliceBuildL2, JFIT::JEvt &OutFits) const
Declaration of Member function that actually performs the reconstruction.
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.
Data structure for track fit results.
JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > moduleRouter_
Auxiliary class for permutations of L1 hits.
Basic data structure for time and time over threshold information of hit.
double getToT() const
Get calibrated time over threshold of hit.
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.
Regressor function object for JPoint4D fit using JSimplex minimiser.
Data structure for vector in three dimensions.
JORCAShowerPrefit(const JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > &moduleRouter, const JFIT::JShowerPrefitParameters_t ¶meters)
Parameterized constructor.
std::shared_ptr< JRegressor_t > fit2_
Auxiliary class to match data points with given model.
double getY() const
Get y position.
Linear fit of JFIT::JPoint3D.
Reduced data structure for L1 hit.
Linear fit of JFIT::JPoint4D.
double getQuality(const double chi2, const int NDF)
Get quality of fit.
Data structure for set of track fit results.
Auxiliary class to define a range between two values.
Data structure for L0 hit.
double getX() const
Get x position.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Reduced data structure for L1 hit.
double getW() const
Get weight.
static int MAXIMUM_ITERATIONS
maximal number of iterations
class to handle first step of the shower reconstruction, mainly dedicated for ORCA ...
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
double getChi2(const double P)
Get chi2 corresponding to given probability.
Data structure for normalised vector in positive z-direction.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
double getZ() const
Get z position.
JTOOLS::JRange< double > pos_grid
Match operator for Cherenkov light from shower in any direction.
Basic data structure for L1 hit.