14 #include <fwk/CentralConfig.h>
15 #include <fwk/CoordinateSystemRegistry.h>
16 #include <fwk/LocalCoordinateSystem.h>
18 #include <utl/Reader.h>
19 #include <utl/ErrorLogger.h>
20 #include <utl/MathConstants.h>
21 #include <utl/PhysicalConstants.h>
22 #include <utl/Transformation.h>
23 #include <utl/TimeStamp.h>
24 #include <utl/Point.h>
25 #include <utl/UTMPoint.h>
26 #include <utl/ReferenceEllipsoid.h>
29 #include <evt/Event.h>
30 #include <evt/ShowerFRecData.h>
31 #include <evt/ShowerRecData.h>
32 #include <evt/ShowerSRecData.h>
34 #include <fevt/FEvent.h>
36 #include <fevt/Telescope.h>
37 #include <fevt/Pixel.h>
38 #include <fevt/PixelRecData.h>
39 #include <fevt/EyeRecData.h>
40 #include <fevt/TelescopeRecData.h>
41 #include <fevt/EyeHeader.h>
43 #include <det/Detector.h>
45 #include <fdet/FDetector.h>
47 #include <fdet/Telescope.h>
48 #include <fdet/Channel.h>
49 #include <fdet/Pixel.h>
50 #include <fdet/FTimeFitModel.h>
53 #include <sevt/SEvent.h>
54 #include <sevt/Station.h>
55 #include <sevt/StationTriggerData.h>
56 #include <sevt/StationRecData.h>
57 #include <sevt/EventTrigger.h>
59 #include <sdet/SDetector.h>
60 #include <sdet/Station.h>
76 using namespace HybridGeometryFinderOG;
80 fevt::Eye* HybridGeometryFinder::fCurEye = 0;
81 evt::Event* HybridGeometryFinder::fCurEvent = 0;
83 double HybridGeometryFinder::fDistanceStationSDP = 2000.;
84 double HybridGeometryFinder::fVerticalCurvature = 0.;
85 int HybridGeometryFinder::fHotStationId = 1;
86 int HybridGeometryFinder::fround = 1;
87 int HybridGeometryFinder::fTriggeredStations = 1;
88 double HybridGeometryFinder::fSdHybridOffset = 0;
89 double HybridGeometryFinder::fStationAxisDistance = 9999.9;
90 double HybridGeometryFinder::fsignal_max = 0;
91 double HybridGeometryFinder::fsignal_max_pre = 0;
94 int HybridGeometryFinder::fHybridCore = 0;
95 int HybridGeometryFinder::fDebuging = 0;
96 double HybridGeometryFinder::fChi2TimeFit =0;
97 int HybridGeometryFinder::fNDofTimeFit =0;
98 double HybridGeometryFinder::fNsCorrection=0;
99 int HybridGeometryFinder::fCeleste =0;
103 bool HybridGeometryFinder::fFoundAxis=
false;
120 if ( fUseNthStation == 0 ) fOptimize =
true;
121 else fOptimize =
false;
123 int timeFitModelSwitch;
127 switch (timeFitModelSwitch)
136 ERROR(
"Invalid input parameter for TimeFitModel");
143 << GetVersionInfo(VModule::eRevisionNumber) <<
"\n"
145 <<
"\ttank distance to sdp: " << fDistanceStationSDP/
m <<
" m\n"
146 <<
"\t vertical curvature: " << fVerticalCurvature*
m <<
" m^(-1) "
147 <<
"\ttime fit uses " << timeFitModel.
GetModelName() <<
"\n";
156 INFO(
"HybridGeometryFinder::Run()");
162 return eContinueLoop;
171 for (eyeiter = fevent.
EyesBegin(ComponentSelector::eHasData);
172 eyeiter != fevent.
EyesEnd(ComponentSelector::eHasData);
179 if (det::Detector::GetInstance().GetFDetector().GetEye(eye).IsVirtual())
183 det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
190 cout <<
"This eye "<<eye.
GetId()<<
" has only "<<
196 WARNING(
"This eye has no SDP!");
200 bool FirstGoodSt =
false;
201 int nHybridStations = 0;
224 cout<<
"Calling FindAxisHybrid (fHybridCore = 1)"<<
"\n";
231 fsignal_max = 90000000.0;
234 if(this->FindAxisHybrid(eye))
237 cout<<
"Calling FindAxisHybrid (fHybridCore = 0)"<<
"\n";
246 if(this->FindAxisHybrid(eye))
256 if ( (fChi0 <= 0. || fChi0 >
kPi ) && fStationAxisDistance > fDistanceStationSDP) {
260 if(this->FindAxisHybrid(eye))
264 if(this->FindAxisHybrid(eye))
276 cout<<
"The total number of potential good stations is: "<<fTriggeredStations<<
"\n";
277 cout<<
"(stations within "<<fDistanceStationSDP<<
"m from the SDP)"<<
"\n";
296 if (fTriggeredStations != 0) {
298 cout<<
"Tank with greatest signal: "<<fHotStationId<<
"\n";
299 cout<<
" fSdHybridOffset "<<fSdHybridOffset<<
"\n";
300 cout<<
" fStationAxisDistance "<<fStationAxisDistance<<
"\n";
301 cout<<
" TimeFitChiSquare/dof "<<fChi2TimeFit<<
" / "<<fNDofTimeFit<<
"\n";
305 cout<<
" There is not any station close to the \n";
306 cout<<
" SDP projection on the ground. Let's try \n";
307 cout<<
" another eye if available. Otherwise \n";
308 cout<<
" hybrid geometry finder has finished with this event \n";
313 if ( fNDofTimeFit == 0 )
continue;
317 bool GoodHybrid =
true;
318 if ( fabs(fSdHybridOffset) > 200. ||
319 fStationAxisDistance > fDistanceStationSDP ||
320 fChi2TimeFit/fNDofTimeFit > 50. )
328 if ( nHybridStations == 0 && fround == fTriggeredStations ) {
329 cout<<
" This event doesn't have any station consistent"<<
" \n";
330 cout<<
" with the FD time and geometry."<<
" \n";
331 cout<<
" from Eye: "<<eye.
GetId()<<
"\n";
333 cout<<
"No tank ( last tank tested "<<fHotStationId
334 <<
") was consistent with the FD geometry and timing "<<
"\n";
335 cout<<
" fSdHybridOffset "<<fSdHybridOffset<<
"\n";
336 cout<<
" fStationAxisDistance "<<fStationAxisDistance<<
"\n";
337 cout<<
" TimeFitChiSquare/dof "<<fChi2TimeFit<<
"/"<<fNDofTimeFit<<
"\n";
338 cout<<
" This was the trial number: "<<fround - 1<<
"\n";
341 fsignal_max = fsignal_max_pre;
350 fChi0_test[0] = fChi0;
351 fChi0Error_test[0] = fChi0Error;
353 fT0Error_test[0] = fT0Error;
356 fChi2TimeFit_test[0] = fChi2TimeFit;
357 fNDofTimeFit_test[0] = fNDofTimeFit;
358 fHotStationId_test[0] = fHotStationId;
359 fround_test[0] = fround;
360 for (
int i = 0; i < 3; i++)
361 for (
int j = 0; j < 3; j++)
362 fCovariance_test1[i][j] = fCovariance[i][j];
367 fChi2TimeFit_test[0] = -999.0;
378 if (fround < fUseNthStation )
382 if ( fUseNthStation > 1 && !fOptimize ) {
384 cout<<
"This hybrid reconstruction is forced to use the "<<fUseNthStation<<
"the hottest station (if available)"<<
"\n";
387 if ( fUseNthStation > 1 && fOptimize ) {
389 cout<<
"Now checking the second hot station (if available)"<<
"\n";
394 while ( !GoodHybrid && fTriggeredStations > fround )
397 if( fDebuging == 1) {
399 cout <<
"The tank with greatest signal ("<<fHotStationId<<
") "<<
"\n";
400 cout <<
"the hybrid reconstruction: "<<
"\n";
401 cout <<
" fSdHybridOffset "<<fSdHybridOffset<<
"\n";
402 cout <<
" fStationAxisDistance "<<fStationAxisDistance<<
"\n";
403 cout <<
" TimeFitChiSquare/dof "<<fChi2TimeFit<<
" / "<<fNDofTimeFit<<
"\n";
404 cout <<
"We will try the "<<
"\n";
405 cout <<
"reconstruction with the next tank with the greatest \n";
406 cout <<
"signal. This is the trial number: "<<fround<<
"\n";
415 cout<<
"Calling FindAxisHybrid (fHybridCore = 1)"<<
" round:" <<fround<<
"\n";
418 if(this->FindAxisHybrid(eye))
428 cout<<
"Calling FindAxisHybrid (fHybridCore = 0)"<<
" round:"<<fround<<
"\n";
429 if(this->FindAxisHybrid(eye))
438 if ( (fChi0 <= 0. || fChi0 > kPi ) && fStationAxisDistance > fDistanceStationSDP) {
442 if(this->FindAxisHybrid(eye))
445 if(this->FindAxisHybrid(eye))
451 if ( fabs(fSdHybridOffset) > 200 ||
452 fStationAxisDistance > fDistanceStationSDP ||
453 fChi2TimeFit/fNDofTimeFit > 50 ) {
454 cout<<
" Station "<<fHotStationId<<
" is not consistent \n";
455 cout<<
" with the FD event \n";
456 fsignal_max = fsignal_max_pre;
459 cout<<
"The tank with greatest signal ("<<fHotStationId<<
") "<<
"\n";
460 cout<<
"the hybrid reconstruction: "<<
"\n";
461 cout<<
" fSdHybridOffset "<<fSdHybridOffset<<
"\n";
462 cout<<
" fStationAxisDistance "<<fStationAxisDistance<<
"\n";
463 cout<<
" TimeFitChiSquare/dof "<<fChi2TimeFit<<
" / "<<fNDofTimeFit<<
"\n";
466 if (fround < fUseNthStation ) {
467 cout<<
" this is a good station ("<<fHotStationId <<
"), but we will force the \n";
468 cout<<
" reconstruction using the "<<fUseNthStation<<
"th hottest station. \n";
470 fsignal_max = fsignal_max_pre;
478 if ( !GoodHybrid && fround == fTriggeredStations ) {
479 cout<<
" This event doesn't have any station consistent"<<
" \n";
480 cout<<
" with the FD time and geometry."<<
" \n";
482 cout<<
"No tank ( last tank tested "<<fHotStationId
483 <<
") was consistent with the FD geometry and timing "<<
"\n";
484 cout<<
" fSdHybridOffset "<<fSdHybridOffset<<
"\n";
485 cout<<
" fStationAxisDistance "<<fStationAxisDistance<<
"\n";
486 cout<<
" TimeFitChiSquare/dof "<<fChi2TimeFit<<
"/"<<fNDofTimeFit<<
"\n";
487 cout<<
"This was the trial number: "<<fround - 1<<
"\n";
497 fChi0_test[1] = fChi0;
498 fChi0Error_test[1] = fChi0Error;
500 fT0Error_test[1] = fT0Error;
503 fChi2TimeFit_test[1] = fChi2TimeFit;
504 fNDofTimeFit_test[1] = fNDofTimeFit;
505 fHotStationId_test[1] = fHotStationId;
506 fround_test[1] = fround;
507 for (
int i = 0; i < 3; i++)
508 for (
int j = 0; j < 3; j++)
509 fCovariance_test2[i][j] = fCovariance[i][j];
513 fChi2TimeFit_test[1] = -999.0;
519 if ( nHybridStations == 0 )
continue;
521 if (nHybridStations == 1)
522 if ( fChi2TimeFit_test[0] > 0. ) FirstGoodSt =
true;
524 if (nHybridStations == 2) {
525 if ( ( fChi2TimeFit_test[0]/fNDofTimeFit_test[0] <
526 (fChi2TimeFit_test[1]/fNDofTimeFit_test[1]) + 1.0 ) )
540 fChi0 = fChi0_test[UseStation];
541 fChi0Error = fChi0Error_test[UseStation];
542 fT0 = fT0_test[UseStation];
543 fT0Error = fT0Error_test[UseStation];
544 fRp = fRp_test[UseStation];
545 fRpError = fRpError_test[UseStation];
546 fChi2TimeFit = fChi2TimeFit_test[UseStation];
547 fNDofTimeFit = fNDofTimeFit_test[UseStation];
548 fHotStationId = fHotStationId_test[UseStation];
549 fround = fround_test[UseStation];
550 for (
int i = 0; i < 3; i++)
552 for (
int j = 0; j < 3; j++)
554 if ( UseStation == 0 )
555 fCovariance[i][j] = fCovariance_test1[i][j];
557 fCovariance[i][j] = fCovariance_test2[i][j];
563 if ( nHybridStations == 2 &&
564 fabs( fChi0_test[1]-fChi0_test[0] ) > 1.0 *
degree &&
565 fabs( fChi2TimeFit_test[0] - fChi2TimeFit_test[1] ) < 0.5 ) {
566 cout<<
" There are two ambigous geometries (similar time fit chisqr) \n";
567 cout<<
" with a difference greater than 1.0 deg. \n";
568 cout<<
" The profile reconstruction may help two identify \n";
569 cout<<
" the correct geometry. This event should be \n";
570 cout<<
" FLAGGED for further quality check. \n";
579 while( ReadmitPixel(eye) )
580 if(this->FindAxisHybrid(eye)) fFoundAxis=
true;
583 while ( RejectPixel(eye) )
584 if(this->FindAxisHybrid(eye)) fFoundAxis=
true;
589 cerr <<
" FATAL ERROR in HybridGeometryFinder::FindAxisHybrid Minuit MIGRAD failed (Eye: "<<eye.
GetId()<<
"), try other Eye if available"<<endl;
593 cout<<
" number of pixels remaining "<<eyerecdata.
GetNTimeFitPixels()<<
"\n"; cout<<
"\n";
599 if (
abs (fChi0) > kPi ) {
600 fChi0 -= int ( fChi0 / (2* kPi) )* 2*
kPi;
601 if ( fChi0 < 0 ) fChi0 += 2*
kPi;
602 if ( fChi0 > kPi ) fChi0 -= 2*
kPi;
606 if (fChi0 == 0 &&
fRp == 0 && fT0 == 0)
616 cout<<
"Timing-Chisqr / dof "<<fChi2TimeFit<<
" / "<<fNDofTimeFit<<
"\n";
618 cout <<
" Chi0=" << fChi0/
deg <<
" (" << fChi0Error/
deg <<
") deg "
620 <<
" T0=" << fT0/
ns <<
" (" << fT0Error/
ns <<
") ns ";
624 info <<
" Chi0=" << fChi0/
deg <<
" (" << fChi0Error/
deg <<
") deg "
626 <<
" T0=" << fT0/
ns <<
" (" << fT0Error/
ns <<
") ns ";
630 const double rRpT0 = fCovariance[2][1]/
fRpError/fT0Error;
631 const double rRpChi0 = fCovariance[2][0]/
fRpError/fChi0Error;
632 const double rChi0T0 = fCovariance[0][1]/fChi0Error/fT0Error;
642 telIt != eye.
TelescopesEnd(ComponentSelector::eHasData); ++telIt)
644 if (!telIt->HasRecData())
645 telIt->MakeRecData();
657 Vector vertical2(0,0,1,eyeCS);
661 Vector axis (rot* horizontalInSDP);
664 det::Detector::GetInstance().GetSiteCoordinateSystem();
665 Vector core_eye_vec =
fRp / sin( kPi - fChi0) * horizontalInSDP;
666 const Point& eyeposition =
667 det::Detector::GetInstance().GetFDetector().GetEye(eye).GetPosition();
668 Point core = eyeposition + core_eye_vec;
696 TMinuit theMinuit(npar);
698 theMinuit.SetPrintLevel(-1);
700 theMinuit.SetFCN(HybridGeometryFinder::MinuitFitFuncHybrid);
702 double arglist[
npar];
707 theMinuit.mnexcm(
"SET ERR", arglist,1,ierflag);
709 if (ierflag)
ERROR (
"Minuit SET ERR failed");
711 static double vstart[
npar];
712 static double step[
npar];
724 theMinuit.mnparm(0,
"Chi0",vstart[0], step[0],0,0,ierflag);
725 theMinuit.mnparm(1,
"T0", vstart[1], step[1],0,0,ierflag);
726 theMinuit.mnparm(2,
"Rp", vstart[2], step[2],0,0,ierflag);
731 theMinuit.mnexcm(
"CALI", arglist, 1, ierflag);
735 theMinuit.mnexcm(
"MIGRAD", arglist ,2,ierflag);
738 ERROR (
"Minuit MIGRAD failed");
742 theMinuit.mnexcm(
"HESSE", arglist, 2, ierflag);
746 double fmin, fedm, errdef;
749 theMinuit.mnstat(fmin, fedm, errdef, npari, nparx, istat);
751 theMinuit.mnexcm(
"MINOS", arglist, 2, ierflag);
752 theMinuit.mnstat(fmin, fedm, errdef, npari, nparx, istat);
754 WARNING(
"Neither HESSE nor MINOS found accurate covariance matrix");
757 theMinuit.GetParameter(0,fChi0,fChi0Error);
758 theMinuit.GetParameter(1,fT0,fT0Error);
760 theMinuit.mnemat(&fCovariance[0][0],3);
767 HybridGeometryFinder::MinuitFitFuncHybrid(
int& ,
double*
const ,
768 double& value,
double*
const par,
774 double& chi_0 = par[0];
775 double& t_0 = par[1] ;
776 double& r_p = par[2] ;
778 double sum_charge = 0;
779 double chisq_time = 0;
780 double chisq_hybrid = 0;
784 static vector<double> t_i;
785 static vector<double> t_i_Err;
786 static vector<double> chi_i;
787 static vector<int> telID;
791 static Point eyeposition;
792 static Vector horizontalWithinSDP;
800 eyeID = fCurEye->GetId();
801 eyeCS = det::Detector::GetInstance().GetFDetector().GetEye(*fCurEye).GetEyeCoordinateSystem();
807 telID.push_back(pixelIter->GetTelescopeId());
811 chi_i.push_back( pixrec.
GetChi_i());
817 const Vector vertical(0,0,1,eyeCS,Vector::kCartesian);
818 horizontalWithinSDP =
cross(
fSDP, vertical);
819 horizontalWithinSDP /= horizontalWithinSDP.
GetMag();
821 eyeposition=det::Detector::GetInstance().GetFDetector().GetEye(*fCurEye).GetPosition();
824 const double sdpTheta =
fSDP.GetTheta(eyeCS);
825 for(
unsigned int pix=0; pix<t_i.size(); ++pix){
826 const double t_expected = timeFitModel.
GetTimeAtAperture(t_0, r_p, chi_0, chi_i[pix], sdpTheta, eyeID, telID[pix]);
827 const double tmp = t_i[pix] - t_expected;
829 const double chargeOne = 1.0;
830 chisq_time += tmp*tmp *chargeOne / (t_i_Err[pix] * t_i_Err[pix]);
831 sum_charge +=chargeOne;
833 chisq_time /= sum_charge;
835 static vector<Point> stationpos;
836 static vector<int> stationId;
837 static vector<double> station_d_to_SDP;
838 static vector<double> stNanosecond;
839 static vector<double> stSignal;
845 station_d_to_SDP.clear();
846 stNanosecond.clear();
852 if (!sditer->HasRecData())
857 const sdet::Station& detstation = det::Detector::GetInstance().GetSDetector().GetStation(station);
864 double distToSDP=
abs(eye_station.
GetMag() * cos(angle));
870 int FDSecond = fCurEye->GetHeader().GetTimeStamp().GetGPSSecond();
871 if ( SDSecond > FDSecond ) nanosecond += 1000000000;
872 if ( SDSecond < FDSecond ) nanosecond -= 1000000000;
876 stationId.push_back(station.
GetId());
877 station_d_to_SDP.push_back(distToSDP);
878 stNanosecond.push_back(nanosecond);
879 stSignal.push_back(signal);
884 double signal_max = 0;
885 int hotStationIter = 0;
887 fTriggeredStations = 0;
889 for(
unsigned int statIt=0; statIt<stationpos.size(); ++statIt){
891 if (station_d_to_SDP[statIt] < fDistanceStationSDP)
892 fTriggeredStations++;
897 if (stSignal[statIt] > signal_max ) {
898 signal_max = stSignal[statIt];
899 hotStationIter = statIt;
901 fsignal_max = stSignal[statIt];
902 fsignal_max_pre = signal_max;
903 fHotStationId = stationId[statIt];
907 if (stSignal[statIt] > signal_max && stSignal[statIt] < fsignal_max){
908 signal_max = stSignal[statIt];
909 fsignal_max_pre = signal_max;
910 hotStationIter = statIt;
912 fHotStationId = stationId[statIt];
920 Vector axis(rot* horizontalWithinSDP);
924 const double nx = axis.
GetX(eyeCS);
925 const double ny = axis.
GetY(eyeCS);
926 const double nz = axis.
GetZ(eyeCS);
928 const Vector core = horizontalWithinSDP*( r_p/ sin(
kPi-chi_0));
930 const Point PointCore = eyeposition + core;
932 int stations_used = 0;
933 if (NofStations > 0 ) {
934 const double x_hot = stationpos[hotStationIter].
GetX(eyeCS);
937 UTMPoint UTMposHot(stationpos[hotStationIter], ReferenceEllipsoid::GetWGS84());
939 double sum_total = 0;
940 for(
unsigned int stiter=0; stiter<stationId.size(); ++stiter){
949 const Vector distance_to_hot= stationpos[stiter]- stationpos[hotStationIter];
951 if ( distance_to_hot.
GetMag() > 500 )
954 const Vector st_core= stationpos[stiter] - PointCore;
955 const Vector sh_axis ( nx, ny, nz, eyeCS, Vector::kCartesian);
956 const double sh_axis_VS_st_core_angle =
Angle(st_core,sh_axis);
957 const double delta_d = st_core.
GetMag() * std::cos(sh_axis_VS_st_core_angle);
960 fStationAxisDistance = st_core.
GetMag() * std::sin(sh_axis_VS_st_core_angle);
962 double station_to_axis = st_core.
GetMag() * std::sin(sh_axis_VS_st_core_angle);
966 const double d2 = station_to_axis * station_to_axis;
967 const double curvature = fVerticalCurvature*sh_axis.
GetCosTheta(eyeCS);
969 exp_t_st += timeDelay;
982 eye_trigger_time -= 1000 *100;
983 exp_t_st += eye_trigger_time;
985 double SD_Time = stNanosecond[stiter];
986 double FD_Time = exp_t_st + fNsCorrection;
987 double chi_hybrid = SD_Time - FD_Time;
988 double hybrid_error = 100;
990 if (fHybridCore == 1) {
992 const double x_st=stationpos[stiter].GetX(eyeCS);
993 if (
abs(x_hot -x_st) < 1 ) {
994 chisq_hybrid += st_core.
GetMag()* st_core.
GetMag()/(10*10);
1007 const double hybrid_weight = (1/station_to_axis) * (1/station_to_axis);
1008 chisq_hybrid += chi_hybrid * chi_hybrid * hybrid_weight / (hybrid_error*hybrid_error);
1009 sum_total += hybrid_weight;
1011 fSdHybridOffset = chi_hybrid;
1014 chisq_hybrid /= sum_total;
1021 cout<<
"chisq time: "<<chisq_time<<
" chisq hybrid: "<<chisq_hybrid<<
" \n";
1026 chisq_hybrid *= stations_used;
1031 chisq += chisq_time;
1033 chisq += chisq_hybrid;
1035 cout<<
"chisq time (TOTAL): "
1036 <<chisq_time<<
" chisq hybrid: "
1037 <<chisq_hybrid<<
" total: "
1044 fChi2TimeFit = chisq_time;
1060 int ReadmittedPixels = 0;
1062 det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
1064 int eyeID = eye.
GetId();
1065 double sdpTheta =
fSDP.GetTheta(eyeCS);
1075 const unsigned int pixel_id = evtpixel.
GetId();
1079 bool timefit_pixel =
false;
1082 if (pixel_id == iter->GetId()) {
1083 timefit_pixel =
true;
1094 const double chi_i = pixrec.
GetChi_i();
1099 double t_expected = timeFitModel.
GetTimeAtAperture(fT0,
fRp, fChi0, chi_i, sdpTheta, eyeID, telID);
1100 double tmp = t_i - t_expected;
1101 double time_residue = tmp / (t_i_Err) ;
1104 det::Detector::GetInstance().GetFDetector().GetPixel(evtpixel);
1113 if ( fabs(time_residue) < 13 && AngleWithSDP < fTolerance) {
1116 cout <<
"readmitting pixel " << evtpixel.
GetId() <<
" for the Timing Fit\n";
1120 return ReadmittedPixels > 0;
1133 int RejectedPixels = 0;
1134 double residue_max = 0;
1135 int residue_max_pixid = -1;
1136 int residue_max_telid = -1;
1139 det::Detector::GetInstance().GetFDetector().GetEye(eye).GetEyeCoordinateSystem();
1141 int eyeID = eye.
GetId();
1142 double sdpTheta =
fSDP.GetTheta(eyeCS);
1162 const double t_expected =
1165 const double temp = t_i - t_expected ;
1166 const double time_residue = temp / t_i_Err;
1168 cout <<
"time chisq_i: " << (temp * temp ) / (t_i_Err * t_i_Err) <<
" pixelid " << evtpixel.
GetId()
1169 <<
" delta t: " << temp <<
" ti error: " << t_i_Err <<
" N Sigmas away: " << time_residue <<
"\n";
1171 if ( fabs(time_residue) > residue_max) {
1172 residue_max = fabs (time_residue);
1173 residue_max_pixid = evtpixel.
GetId();
1174 residue_max_telid = telid;
1197 const int pixid = evtpixel.
GetId();
1198 if (telid == residue_max_telid && pixid == residue_max_pixid) {
1207 if (RejectedPixels>0)
AxialVector cross(const Vector &l, const Vector &r)
vector cross product
unsigned int GetId() const
PixelIterator RemoveTimeFitPixel(PixelIterator it)
Remove a pixel from the list of Time Fit pixels.
const utl::Vector & GetDirection() const
pointing direction of this pixel
void SetChiZero(const double chiZero, const double error)
StationIterator StationsEnd()
End of all stations.
int GetId() const
Get the station Id.
void SetModel(const Model m)
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
Detector description interface for Station-related data.
Fluorescence Detector Eye Event.
PixelIterator PulsedPixelsEnd()
Interface class to access Shower Reconstructed parameters.
bool HasRecShower() const
Interface class to access to the SD part of an event.
void SetSDTimeResidual(const double time)
double GetChiZero() const
Class to hold and convert a point in geodetic coordinates.
void SetAxis(const utl::Vector &axis)
double GetCosTheta(const CoordinateSystemPtr &coordinateSystem) const
cos of zenith (theta) angle
void SetCorePosition(const utl::Point &core)
EyeIterator EyesEnd(const ComponentSelector::Status status)
sevt::StationRecData & GetRecData()
Get station level reconstructed data.
void SetTimeFitCorrelations(double rRpT0, double rRpChi0, double rChi0T0)
#define INFO(message)
Macro for logging informational messages.
std::string GetModelName() const
void SetTimeFitCorrelations(const double rRpT0, const double rRpChi0, const double rChi0T0)
void SetRp(const double rp, const double error)
void Init()
Initialise the registry.
boost::filter_iterator< ComponentSelector, AllEyeIterator > EyeIterator
selective Eye iterators
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
PixelIterator PulsedPixelsBegin()
bool IsSilent() const
Check if the station is silent.
bool IsCandidate() const
Check if the station is a candidate.
A TimeStamp holds GPS second and nanosecond for some event.
boost::indirect_iterator< ConstInternalPixelIterator, const Pixel & > ConstPixelIterator
Const iterator over pixels used in reconstruction.
utl::Point GetPosition() const
Tank position.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
unsigned int GetId() const
Class representing a document branch.
class to hold data at Station level
void MakeFRecShower()
Allocate reconstructed shower info.
utl::TimeStamp GetSignalStartTime() const
Start time of the signal.
Fluorescence Detector Pixel event.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
void SetCoreTime(const utl::TimeStamp &coreTime, const utl::TimeInterval &coreTimeErr)
TelescopeIterator TelescopesEnd()
first available tel of status eHasData (DEPRECATED)
utl::TimeInterval GetT_i() const
constexpr double nanosecond
void SetAxis(const utl::Vector &axis)
double abs(const SVector< n, T > &v)
double GetTotalSignal() const
Total integrated signal in VEM unit, averaged over pmts.
bool HasFRecShower() const
Check if reconstructed shower info has been allocated.
evt::ShowerFRecData & GetFRecShower()
Reconstructed shower info for this eye.
EyeIterator EyesBegin(const ComponentSelector::Status status)
void SetChiZero(const double chiZero, const double error)
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
Telescope-specific shower reconstruction data.
boost::filter_iterator< ComponentSelector, AllTelescopeIterator > TelescopeIterator
selective Telescope iterators
unsigned int GetNPulsedPixels() const
Get number of pulsed pixels.
#define WARNING(message)
Macro for logging warning messages.
void GetData(bool &b) const
Overloads of the GetData member template function.
Top of Fluorescence Detector event hierarchy.
Eye-specific shower reconstruction data.
TelescopeIterator TelescopesBegin()
first available tel of status eHasData (DEPRECATED)
double GetInterval() const
Get the time interval as a double (in Auger base units)
const utl::AxialVector & GetSDP() const
unsigned int GetTelescopeId() const
unsigned int GetNTimeFitPixels() const
Get number of Time Fit pixels.
boost::indirect_iterator< InternalPixelIterator, fevt::Pixel & > PixelIterator
Iterator over pixels used in reconstruction.
double GetY(const CoordinateSystemPtr &coordinateSystem) const
constexpr double kSpeedOfLight
A TimeInterval is used to represent time elapsed between two events.
ResultFlag
Flag returned by module methods to the RunController.
unsigned long GetGPSSecond() const
GPS second.
double GetGPSNanoSecond() const
GPS nanosecond.
void SetTZero(const double tzero, const double error)
StationIterator StationsBegin()
Beginning of all stations.
void SetTimeFitChiSquare(const double tfitChi2, const unsigned int ndof)
PixelIterator TimeFitPixelsEnd()
bool IsDense() const
Tells whether the station belongs to set of hypothetical "dense" stations.
void SetRp(const double rp, const double error)
utl::TimeInterval GetT_iError() const
Main configuration utility.
void SetCorePosition(const utl::Point &core)
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
double GetTimeAtAperture(const double t0, const double rp, const double chi0, const double chi_i, const double thetaSDP, const int eye, const int tel) const
void SetTZero(const double tzero, const double error)
void AddTimeFitPixel(fevt::Pixel &pixel)
add a pixel to the list of Time Fit pixels
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
double GetNanoSecond() const
Get integer number of nanoseconds past seconds boundary.
PixelIterator TimeFitPixelsBegin()
#define ERROR(message)
Macro for logging error messages.
Fluorescence Detector Pixel Reconstructed Data.
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
PixelRecData & GetRecData()
void AddStationId(const unsigned short int id)
add a station id to the list of used hybrid stations
fevt::EyeRecData & GetRecData()
Reconstructed data for this eye.