Declaration of Member function that actually performs the reconstruction.
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);
188 const double cosT = photonDir.
getDot(hit.getDirection());
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){
224 const JHitL0 hit(*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;
Data structure for direction in three dimensions.
Data structure for vertex fit.
std::shared_ptr< JRegressor_t > fit0_
JShowerPositionFitParameters_t parameters_
Container for historical events.
double getDistance(const JVector3D &pos) const
Get distance to point.
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.
Data structure for track fit results.
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_
JTOOLS::JRange< double > time_grid
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
static bool sortLogLik(JVertexHypothesis A, JVertexHypothesis B)
Function to sort different vertex hypotheses by their likelihood.
JPosition3D getPosition(const JFit &fit)
Get position.
double getQuality(const double chi2, const int NDF)
Get quality of fit.
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.