1 #ifndef JORCASHOWERPOSITIONFIT_INCLUDE
2 #define JORCASHOWERPOSITIONFIT_INCLUDE
63 std::shared_ptr<JRegressor_t>
fit0_;
64 std::shared_ptr<JRegressor_t>
fit_;
86 const std::string pdfFile):
90 TFile* pdf_file =
new TFile(pdfFile.c_str());
91 TH2D* hpdf = (TH2D*)pdf_file->Get(
"hPDF2Dist");
94 JRegressor_t::MAXIMUM_ITERATIONS = 10000;
96 fit0_ = std::make_shared<JRegressor_t>(
true);
99 fit_ = std::make_shared<JRegressor_t>(hpdf,
false);
141 if ( InPreFits.empty() )
return;
160 JEvt::iterator __end = InPreFits.end();
161 if (numberOfPrefits > 0) {
162 std::advance(__end = InPreFits.begin(), std::min(static_cast<std::size_t>(numberOfPrefits), InPreFits.size()));
164 std::partial_sort(InPreFits.begin(), __end, InPreFits.end(),
qualitySorter);
166 if(!InPreFits.empty()) {
168 std::copy(InPreFits.begin(), __end, std::back_inserter(OutFits));
171 JDataL0_t dataL0_selected;
174 buildL0(timeSliceBuildL0, *
moduleRouter_, std::back_inserter(dataL0));
175 buildL2(timeSliceBuildL2,*
moduleRouter_, std::back_inserter(data));
177 for (JEvt::const_iterator shower = InPreFits.begin(); shower != __end; ++shower) {
181 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
186 const double t_res = hit.
getT() - vertex.getT(hit_pos);
191 if(D < Dmax_m && (t_res > -40 && t_res < 40) && (cosT >= -1 && cosT <= 0.1)){
192 dataL0_selected.push_back(hit);
195 if(D < Dmax_m && (t_res > -50 && t_res < 50) && (cosT >= -1 && cosT <= 0.1)){
196 dataL0_selected.push_back(hit);
202 if(dataL0_selected.size() != 0){
221 const JFIT::JPoint4D point_shifted(pos_shifted, vertex.getT() + t);
223 for(JDataL0_t::const_iterator i = dataL0_selected.begin(); i != dataL0_selected.end(); ++i){
225 chi2 += (*fit0_)(point_shifted, hit);
228 vertex_hypothesis.
LogLik = chi2;
229 vertex_hypothesis.
Vertex = point_shifted;
231 vertex_hypotheses.push_back(vertex_hypothesis);
239 std::partial_sort(vertex_hypotheses.begin(), __end2, vertex_hypotheses.end(),
sortLogLik);
243 double simplex_step = 1;
244 fit0_->step.resize(4);
250 chi2 = (*fit0_)(
JPoint4D(hp->Vertex), dataL0_selected.begin(), dataL0_selected.end());
256 fit_->step.resize(4);
262 chi2 = (*fit_)(pt, dataL0_selected.begin(), dataL0_selected.end());
264 const int NDF = dataL0_selected.size() -
fit_->step.size();
269 const double energy(0);
274 OutFits.push_back(outFit);
275 OutFits.rbegin()->setW(13, chi2);
276 OutFits.rbegin()->setW(14, NDF);
279 std::cout<<
"Too few hits " << std::endl;
JFIT::JRegressor< JFIT::JPoint4D, JFIT::JSimplex > JRegressor_t
Template definition of a data regressor of given model.
double getT() const
Get calibrated time of hit.
JORCAShowerPositionFit()
Default constructor.
Data structure for direction in three dimensions.
Definition for fit results, A good fit should hold: OKAY.
Algorithms for hit clustering and sorting.
Data structure for vertex fit.
const JDirection3D & getDirection() const
Get direction.
std::shared_ptr< JRegressor_t > fit0_
JShowerPositionFitParameters_t parameters_
JORCAShowerPositionFit(const JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > &moduleRouter, const JShowerPositionFitParameters_t ¶meters, const std::string pdfFile)
Parameterized constructor.
Container for historical events.
~JORCAShowerPositionFit()
double getDistance(const JVector3D &pos) const
Get distance to point.
class to handle the second step of the shower reconstruction, mainly dedicated for ORCA ...
double getDot(const JAngle3D &angle) const
Get dot product.
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.
Basic data structure for time and time over threshold information of hit.
JTOOLS::JRange< double > pos_grid
Data structure for vector in three dimensions.
Container of vertex hypothesis: During the fit the algorithm creates a grid in position space (x...
std::shared_ptr< JRegressor_t > fit_
const JPosition3D & getPosition() const
Get position.
JTOOLS::JRange< double > time_grid
void getJEvt(const KM3NETDAQ::JDAQTimeslice &timeSliceBuildL0, const KM3NETDAQ::JDAQTimeslice &timeSliceBuildL2, JFIT::JEvt &InPreFits, JFIT::JEvt &OutFits) const
Declaration of Member function that actually performs the reconstruction.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Direct access to module in detector data structure.
static bool sortLogLik(JVertexHypothesis A, JVertexHypothesis B)
Function to sort different vertex hypotheses by their likelihood.
Linear fit of JFIT::JPoint3D.
Reduced data structure for L1 hit.
Linear fit of JFIT::JPoint4D.
JPosition3D getPosition(const JFit &fit)
Get position.
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.
JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > moduleRouter_
void copy(const Head &from, JHead &to)
Copy header from from to to.
Data structure for position in three dimensions.
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
Data structure for normalised vector in positive z-direction.
Tukey's biweight M-estimator.
Match operator for Cherenkov light from shower in any direction.
Basic data structure for L1 hit.