Declaration of the member function that actually performs the reconstruction.
157 if ( InPreFits.empty() )
return;
165 JEvt::iterator __end = InPreFits.end();
166 std::copy(InPreFits.begin(), __end, std::back_inserter(OutFits));
168 if (numberOfPrefits > 0) {
169 std::advance(__end = InPreFits.begin(), std::min(numberOfPrefits, InPreFits.size()));
172 std::partial_sort(InPreFits.begin(), __end, InPreFits.end(),
qualitySorter);
175 buildL0(timeSliceBuildL0, *
moduleRouter_, std::back_inserter(dataL0));
177 for (JEvt::const_iterator shower = InPreFits.begin(); shower != __end; ++shower) {
181 JVector3D start_dir(0,0,0);
183 const JVector3D DetC(0.0, 0.0, 117);
184 const double radius = pos.getDistance(DetC);
190 for (JDataL0_t::const_iterator i = dataL0.begin(); i != dataL0.end(); ++i) {
195 const double D = hit_pos.
getDistance(pt.getPosition());
196 const double t_res = hit.getT() - pt.getT(hit_pos);
199 const double cosT = photonDir.
getDot(hit.getDirection());
201 if(D < Dmax_m && (t_res >= -25 && t_res <= 25) && (cosT >= -1 && cosT <= 0.1)){
202 top.insert(hit.getPMTIdentifier());
203 const JVector3D d(photonDir.getDX(), photonDir.getDY(), photonDir.getDZ());
206 if(D < Dmax_m && (t_res > -30 && t_res < 20)){
211 double start_E = exp((Nhits + 26)/26);
212 if(start_E > 100) start_E = 100;
219 double max_theta = 0, max_phi = 0, scan_step = 0;
222 if(start_E > 10 && radius < 100){
236 for(
double E = -15; E <= 5; E += 7.5){
237 for(
double th = -max_theta; th <= max_theta; th += scan_step){
238 for(
double ph = -max_phi; ph <= max_phi; ph += scan_step){
246 const double scan_E = start_E + E;
249 start_dir_angles.getPhi() + phi);
250 const JVector3D dir_shifted(dir_shifted_angles.getDX(),
251 dir_shifted_angles.getDY(),
252 dir_shifted_angles.getDZ());
259 for (JDETECTOR::JDetector::const_iterator module = detector.begin();
260 module != detector.end(); ++module) {
265 if (pt.getDistance(pos) < Dmax_m) {
266 for (
unsigned int i = 0; i != module->size(); ++i) {
270 buffer.push_back(JPMTW0(pmt, R_Hz, top.count(
id)));
275 for(JPMTW0_t::iterator pmt = buffer.begin(); pmt != buffer.end(); ++pmt ){
276 chi2 +=
fit_(JShower3EZ(pt, JVersor3Z(), JEnergy(log10(scan_E))), *pmt);
279 shower_hypothesis.
LogLik = chi2;
280 shower_hypothesis.
Energy = scan_E;
281 shower_hypothesis.
Direction = dir_shifted;
283 shower_hypotheses.push_back(shower_hypothesis);
292 std::partial_sort(shower_hypotheses.begin(), __end2, shower_hypotheses.end(),
sortLogLik);
297 const double dir_step = 0.05;
298 fit_.step[0] = JShower3EZ(JPoint4D(JVector3D(), 0.0), JVersor3Z(dir_step, 0.0),
JFIT::JEnergy());
299 fit_.step[1] = JShower3EZ(JPoint4D(JVector3D(), 0.0), JVersor3Z(0.0, dir_step),
JFIT::JEnergy());
300 fit_.step[2] = JShower3EZ(JPoint4D(JVector3D(), 0.0), JVersor3Z(), 0.05);
302 const double scan_E = hp->Energy;
306 const JDirection3D startVersor(hp->Direction);
312 for(JDETECTOR::JDetector::const_iterator module = detector.begin();
313 module != detector.end(); ++module) {
314 JPosition3D pos(module->getPosition());
317 if (pt.getDistance(pos) < Dmax_m) {
318 for (
unsigned int i = 0; i != module->size(); ++i) {
322 buffer.push_back(JPMTW0(pmt, R_Hz, top.count(
id)));
327 const int NDF = buffer.size() -
fit_.step.size();
329 chi2 =
fit_(JShower3EZ(pt, JVersor3Z(),
JFIT::JEnergy(log10(scan_E))), buffer.begin(), buffer.end());
333 const JVector3D resPos(
fit_.value);
334 const JVersor3D resDir(
fit_.value.getDX(),
fit_.value.getDY(),
fit_.value.getDZ());
337 const double E_reco_corrected =
fit_.value.getE() - 4;
345 OutFits.push_back(outFit);
346 OutFits.rbegin()->setE(E_reco_corrected);
Data structure for angles in three dimensions.
Data structure for direction in three dimensions.
Data structure for vertex fit.
JLANG::JSharedPointer< const JDETECTOR::JModuleRouter > moduleRouter_
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.
Data structure for fit of straight line in positive z-direction with energy.
JAxis3D & rotate(const JRotation3D &R)
Rotate axis.
Data structure for vector in three dimensions.
static bool sortLogLik(JShowerHypothesis A, JShowerHypothesis B)
Function to sort different shower hypotheses by their likelihood.
Data structure for PMT geometry and calibration.
Auxiliary class for a hit with background rate value.
JFIT::JShowerFitParameters_t parameters_
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
JPosition3D getPosition(const JFit &fit)
Get position.
const JClass_t & getReference() const
Get reference to object.
std::size_t numberOfPrefits
void copy(const Head &from, JHead &to)
Copy header from from to to.
Data structure for fit of energy.
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.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Container of shower hypothesis: During the fit the algorithm creates a grid in direction and energy s...