1 #include <utl/config.h>
11 #include <FdPCGFData.h>
13 #include <adst/RecEvent.h>
14 #include <adst/FdApertureLight.h>
15 #include <adst/FdRecLevel.h>
17 #include <fwk/CentralConfig.h>
18 #include <fwk/LocalCoordinateSystem.h>
19 #include <fwk/CoordinateSystemRegistry.h>
21 #include <utl/AugerUnits.h>
22 #include <utl/CorrelationMatrix.h>
23 #include <utl/NumericalErrorPropagation.h>
24 #include <utl/ModifiedJulianDate.h>
25 #include <utl/PhysicalConstants.h>
26 #include <utl/Transformation.h>
27 #include <utl/TabulatedFunctionErrors.h>
28 #include <utl/UTMPoint.h>
30 #include <det/VManager.h>
31 #include <det/Detector.h>
32 #include <det/ManagerRegister.h>
34 #include <fdet/FDetector.h>
35 #include <fdet/Pixel.h>
36 #include <fdet/Camera.h>
38 #include <fdet/Telescope.h>
40 #include <atm/Atmosphere.h>
41 #include <atm/AttenuationResult.h>
42 #include <atm/InclinedAtmosphericProfile.h>
43 #include <atm/LidarCloudDBModel.h>
44 #include <atm/ProfileResult.h>
45 #include <atm/GOESDB.h>
47 #include <sdet/SDetector.h>
48 #include <sdet/Station.h>
50 #include <sevt/SEvent.h>
51 #include <sevt/Station.h>
52 #include <sevt/SortCriteria.h>
54 #include <evt/Event.h>
55 #include <evt/ShowerRecData.h>
56 #include <evt/ShowerSimData.h>
57 #include <evt/ShowerFRecData.h>
58 #include <evt/ShowerSRecData.h>
59 #include <evt/RiseTime1000.h>
61 #include <evt/GaisserHillas2Parameter.h>
62 #include <evt/GaisserHillas4Parameter.h>
63 #include <evt/GaisserHillas6Parameter.h>
64 #include <evt/MultipleGaisserHillasParameters.h>
66 #include <fevt/FEvent.h>
67 #include <fevt/Header.h>
69 #include <fevt/EyeHeader.h>
70 #include <fevt/EyeRecData.h>
71 #include <fevt/EyeTriggerData.h>
72 #include <fevt/Telescope.h>
73 #include <fevt/TelescopeTriggerData.h>
74 #include <fevt/TelescopeRecData.h>
75 #include <fevt/TelescopeSimData.h>
76 #include <fevt/TelescopeRecData.h>
77 #include <fevt/Pixel.h>
78 #include <fevt/PixelRecData.h>
79 #include <fevt/FdComponentSelector.h>
81 #include <AugerEvent.h>
82 #include <EyeEvent.hh>
83 #include <EyeEventHeader.hh>
109 end =
event.GetFEvent().EyesEnd(ComponentSelector::eInDAQ); iEye != end; ++iEye) {
111 if (iEye->HasHeader() ||
115 fdEvent.SetRecLevel(eNoFdEvent);
120 bool haveSimTelData =
false;
121 if (iEye->HasRecData() ||
128 if (iEye->HasRecData()) {
131 recEvent.GetDetector().SetHasMieDatabase();
133 recEvent.GetDetector().SetHasGDASDatabase();
141 if (
Config().StoreCloudCameraData() > 0)
144 if (
Config().StoreGOESData() > 0)
153 if (iEye->HasHeader() || haveSimTelData)
154 recEvent.AddEye(fdEvent);
160 if (
Config().GetFieldOfViewOption()) {
162 if (
Config().GetFieldOfViewOption() == 2)
175 const int eyeId = eye.
GetId();
176 theFd.SetEyeId((UShort_t) eyeId);
189 theFd.SetTimeCorrectionStatus(eOfflineCorrected);
191 theFd.SetTimeCorrectionStatus(eBadCorrection);
193 theFd.SetTimeCorrectionStatus(eGoodCorrection);
220 const fdet::Eye& detEye = det::Detector::GetInstance().GetFDetector().GetEye(eyeId);
225 for (
int thisTelId = 1; thisTelId <= nTel; ++thisTelId) {
226 if ((evStatus/(1ULL << (thisTelId-1))) % 2 > 0)
227 evBits.SetBitNumber(thisTelId,
true);
229 theFd.SetMirrorsInEvent(evBits);
232 string evClass(
"unknown"), evType(
"unknown");
236 evType =
" Simulated Shower ";
238 if (
Status().GetEvent().HasRawEvent()) {
240 AugerEvent*
const rawEvent = (AugerEvent*)&rawEventRef;
242 AugerEvent::EyeIterator iRawEye;
243 for (iRawEye = rawEvent->EyesBegin(); iRawEye != rawEvent->EyesEnd(); ++iRawEye) {
244 if (iRawEye->GetEventHeader()->GetEyeNo() == (
unsigned int)eyeId)
248 if (iRawEye != rawEvent->EyesEnd()) {
249 TEyeEventHeader& eyeheader = *iRawEye->GetEventHeader();
250 evClass = string(eyeheader.GetVerboseEventClass(eyeheader.GetEventClass()));
251 evType = string(eyeheader.GetVerboseEventType(eyeheader.GetEventType()));
255 theFd.SetEventClassAndType(evClass, evType);
264 const int eyeId = eye.
GetId();
265 const fdet::Eye& detEye = det::Detector::GetInstance().GetFDetector().GetEye(eyeId);
272 INFO(
" re-calculating slant tables...");
273 const atm::Atmosphere& atmo = det::Detector::GetInstance().GetAtmosphere();
295 unsigned int nTriggeredPixels = 0;
296 unsigned int nPulsedPixels = 0;
299 end = eye.
TelescopesEnd(ComponentSelector::eHasData); teliter != end; ++teliter) {
302 end = teliter->PixelsEnd(ComponentSelector::eHasData); iPixel != end; ++iPixel) {
303 if (iPixel->HasTriggerData() && iPixel->GetTriggerData().IsTriggered())
312 if (nTriggeredPixels <= 0)
317 if (nPulsedPixels <= 0)
331 FdRecGeometry& theGeometry = theFd.GetFdRecGeometry();
332 FillSDP(detEye, eyeRec, theGeometry);
366 FdRecShower& fdRecShower = theFd.GetFdRecShower();
422 theGeometry.SetGeomRecLevel(eHybridGeometry);
424 theGeometry.SetGeomRecLevel(eMonoGeometry);
427 theGeometry.SetGeomRecLevel(eAxisHybridGeometry);
429 theGeometry.SetGeomRecLevel(eAxisMonoGeometry);
436 double r_p = eyeRec.
GetRp();
444 const double chi_i = pixrec.
GetChi_i();
448 const double tmp = t_i - t_expected;
449 chisq += tmp*tmp / (t_i_Err*t_i_Err);
452 cout <<
" zero error in pixel! " << t_i << endl;
455 theGeometry.SetTimeFitFDChi2(chisq);
463 for (
auto it = eyeRec.
GetPCGF().begin(), end = eyeRec.
GetPCGF().end(); it != end; ++it) {
465 pcgf.SetChi0(it->GetChi0());
466 pcgf.SetRp(it->GetRp());
467 pcgf.SetT0(it->GetT0());
468 switch (it->GetStatus()) {
469 case PCGFData::eUnknown:
470 pcgf.SetStatus(ePCGFUnknown);
472 case PCGFData::eScan:
473 pcgf.SetStatus(ePCGFScan);
476 pcgf.SetStatus(ePCGFFit);
478 case PCGFData::ePreFit:
479 pcgf.SetStatus(ePCGFInitial);
481 case PCGFData::eFinal:
482 pcgf.SetStatus(ePCGFFinal);
485 for (
auto ichi2 = it->GetChi2().begin(), ichi2end = it->GetChi2().end(); ichi2 != ichi2end; ++ichi2)
486 pcgf.AddChi2(ichi2->first, ichi2->second);
488 for (
auto ichi2 = it->GetNDof().begin(), ichi2end = it->GetNDof().end(); ichi2 != ichi2end; ++ichi2)
489 pcgf.AddNDof(ichi2->first, ichi2->second);
491 theGeometry.AddPCGFData(pcgf);
500 FdRecShower& theShower = theFd.GetFdRecShower();
509 const CoordinateSystemPtr referenceCS = det::Detector::GetInstance().GetReferenceCoordinateSystem();
523 ERROR (
"UTMZoneException: fd rec shower invalid");
526 ERROR (
"UTMException: fd rec shower invalid");
531 if (
Status().GetEvent().HasSEvent()) {
535 double hottestSignal = 0;
537 const vector<unsigned short int>& hybridId = showerFRec.
GetStationIds();
538 for (
auto iStation = hybridId.begin(), end = hybridId.end(); iStation != end; ++iStation) {
550 hottestSignal = signal;
551 hottestId = *iStation;
552 }
else if (hottestSignal < signal) {
553 hottestSignal = signal;
554 hottestId = *iStation;
561 det::Detector::GetInstance().GetSDetector().GetStation(hottestId).GetLocalCoordinateSystem();
564 const utl::Point coreStationCS = core - axis * core.
GetZ(stationCS)/axis.
GetZ(stationCS);
569 utl::UTMPoint UTM(coreStationCS, ReferenceEllipsoid::GetWGS84());
574 ERROR(
"UTMZoneException: fd rec shower invalid");
576 ERROR(
"UTMException: fd rec shower invalid");
581 theShower.SetCoreUTMCS(TVector3(easting, northing, altitude));
588 TVector3 axisCore(0,0,1);
589 axisCore.SetTheta(axis.
GetTheta(coreLocalCS));
590 axisCore.SetPhi(axis.
GetPhi(coreLocalCS));
591 theShower.SetAxisCoreCS(axisCore);
593 TVector3 axisSite(0,0,1);
594 axisSite.SetTheta(axis.
GetTheta(referenceCS));
595 axisSite.SetPhi(axis.
GetPhi(referenceCS));
596 theShower.SetAxisSiteCS(axisSite);
609 FdRecShower& theShower = theFd.GetFdRecShower();
615 const double rp = eyeRec.
GetRp();
622 const double theta_sdp = sdp.
GetTheta(eyeCS);
623 const double phi_sdp = sdp.
GetPhi(eyeCS);
636 std::vector<utl::Parameter> coreParameters;
637 coreParameters.push_back(
Parameter(rp, rp_err));
638 coreParameters.push_back(
Parameter(chi0, chi0_err));
639 coreParameters.push_back(
Parameter(theta_sdp, theta_sdp_err));
640 coreParameters.push_back(
Parameter(phi_sdp, phi_sdp_err));
642 coreCorrelations.
Set(0, 1, corr_chi0rp);
643 coreCorrelations.
Set(0, 2, 0);
644 coreCorrelations.
Set(0, 3, 0);
645 coreCorrelations.
Set(1, 2, 0);
646 coreCorrelations.
Set(1, 3, 0);
647 coreCorrelations.
Set(2, 3, corr_tp);
658 std::vector<utl::Parameter> axisParameter;
659 axisParameter.push_back(
Parameter(chi0, chi0_err));
660 axisParameter.push_back(
Parameter(theta_sdp, theta_sdp_err));
661 axisParameter.push_back(
Parameter(phi_sdp, phi_sdp_err));
663 axisCorrelations.
Set(0, 1, 0);
664 axisCorrelations.
Set(0, 2, 0);
665 axisCorrelations.
Set(1, 2, corr_tp);
680 bool hasApertureLight =
false;
685 teliter != eye.
TelescopesEnd(ComponentSelector::eHasData); ++teliter) {
686 if (!teliter->HasRecData())
691 hasApertureLight =
true;
699 hasApertureLight =
true;
703 const double binSize = 100.*
ns;
704 const unsigned int time_size = diaPhotonTrace.
GetNPoints();
706 vector<double> dia_time(time_size);
707 vector<double> dia_time_err(time_size);
708 vector<double> dia_photons(time_size);
709 vector<double> dia_photons_err(time_size);
711 for (
unsigned int i = 0; i < time_size; ++i) {
712 dia_time[i] = diaPhotonTrace [i].X()/binSize;
713 dia_time_err[i] = diaPhotonTrace.
GetXErr(i)/binSize;
715 if (dia_time_err[i] == 0)
718 dia_photons[i] = diaPhotonTrace[i].
Y() / (2.*dia_time_err[i]);
719 dia_photons_err[i] = diaPhotonTrace.
GetYErr(i)/ (2.*dia_time_err[i]);
722 FdRecApertureLight& theProfile = theFd.GetFdRecApertureLight();
723 theProfile.SetTimeBinning(binSize/
ns);
726 theProfile.SetZeta(eyeRec.
GetZeta());
727 theProfile.SetTime(dia_time, dia_time_err);
728 theProfile.SetTotalLightAtAperture(dia_photons, dia_photons_err);
731 return hasApertureLight;
743 const atm::Atmosphere& atmo = det::Detector::GetInstance().GetAtmosphere();
748 det::Detector::GetInstance().GetFDetector().GetEye(evtEye.
GetId());
751 const TimeStamp eyeTraceStartTime = eyeGPSTime -
757 double maxFraction = -1;
758 bool maxFractionFilled =
false;
763 if (!iTel->HasRecData() ||
767 const Point& telescopePosition =
772 for (
unsigned int timeBin = 0; timeBin < photonTrace.
GetNPoints(); ++timeBin) {
773 const TimeStamp timeAtTelescope = eyeTraceStartTime + photonTrace.
GetX(timeBin);
775 const double thisFrac =
777 if (!maxFractionFilled || thisFrac > maxFraction)
778 maxFraction = thisFrac;
779 maxFractionFilled =
true;
783 if (maxFractionFilled) {
784 theFd.GetFdRecShower().SetMaxCloudFractionBetweenEyeAndShower(maxFraction);
793 for (
unsigned int timeBin = 0; timeBin < photonTrace.
GetNPoints(); ++timeBin) {
794 const TimeStamp timeAtEye = eyeTraceStartTime + photonTrace.
GetX(timeBin);
796 const double thisFrac =
798 if (!maxFractionFilled || thisFrac > maxFraction)
799 maxFraction = thisFrac;
800 maxFractionFilled =
true;
804 theFd.GetFdRecShower().SetMaxCloudFractionBetweenEyeAndShower(maxFraction);
818 float maxCloudFraction = -1;
819 float maxCloudFractionLidar = -1;
820 float maxCloudFractionHighElevation = -1;
821 float maxCloudFractionLidarHighElevation = -1;
822 const fdet::FDetector& theFDet = det::Detector::GetInstance().GetFDetector();
823 const atm::Atmosphere& atmo = det::Detector::GetInstance().GetAtmosphere();
828 const unsigned int physicalEyeId =
834 bool eyeHasCloudData =
true;
836 if (!iTel->HasRecData())
860 const double cDist = coreTelescopeVec.
GetMag();
861 const double cosBeta =
CosAngle(axis, coreTelescopeVec);
870 const vector<vector<unsigned int> >& aperturePixels =
871 iTel->GetRecData().GetPixelsInZetaOverTime();
873 if (aperturePixels.size() != photonTrace.
GetNPoints()) {
875 ostringstream errMsg;
876 errMsg <<
"inconsistent trace/zetaPixels: N(trace) = "
877 << photonTrace.
GetNPoints() <<
" N(zetaPixels)="
878 << aperturePixels.size() << endl;
884 for (
unsigned int timeBin = 0; timeBin < aperturePixels.size(); timeBin++) {
886 if (!eyeHasCloudData)
889 const double t = photonTrace.
GetX(timeBin);
891 TimeStamp TimeAtTelescope = eyeTriggerTime + t;
895 -(cDist*cDist-delta*delta)/(2*(delta+cDist*cosBeta));
896 const Point pointOnShower = core-aDist*axis;
899 for (
auto zetaIter = aperturePixels[timeBin].begin();
900 zetaIter != aperturePixels[timeBin].end(); ++zetaIter) {
902 if (!eyeHasCloudData)
906 const fevt::Pixel& evtPixel = iTel->GetPixel(*zetaIter);
908 const double pixelElevation =
910 const double highElevation = pixelElevation > 5.5*
degree;
914 eyeHasCloudData =
false;
920 if (cloudFraction > maxCloudFraction)
921 maxCloudFraction = cloudFraction;
923 if (highElevation && cloudFraction > maxCloudFractionHighElevation)
924 maxCloudFractionHighElevation = cloudFraction;
929 if (cloudFraction > maxCloudFractionLidar)
930 maxCloudFractionLidar = cloudFraction;
931 if (highElevation && cloudFraction > maxCloudFractionLidarHighElevation)
932 maxCloudFractionLidarHighElevation = cloudFraction;
939 const fevt::Pixel& evtPixel = iTel->GetPixel(*zetaIter);
940 ostringstream errMsg;
941 errMsg <<
"could not resolve fevt::Pixel to fdet::Pixel, "
943 <<
", pix " << evtPixel.
GetId();
945 FdRecApertureLight& theApLight = theFd.GetFdRecApertureLight();
946 theApLight.SetMaxCloudCameraFractionInZeta(-1.);
947 theApLight.SetMaxCloudCameraFractionWithLidarInZeta(-1.);
948 theApLight.SetMaxCloudCameraFractionInZetaHighElev(-1.);
949 theApLight.SetMaxCloudCameraFractionWithLidarInZetaHighElev(-1.);
956 FdRecApertureLight& theApLight = theFd.GetFdRecApertureLight();
957 theApLight.SetMaxCloudCameraFractionInZeta(maxCloudFraction);
958 theApLight.SetMaxCloudCameraFractionWithLidarInZeta(maxCloudFractionLidar);
959 theApLight.SetMaxCloudCameraFractionInZetaHighElev(maxCloudFractionHighElevation);
960 theApLight.SetMaxCloudCameraFractionWithLidarInZetaHighElev(maxCloudFractionLidarHighElevation);
974 FdRecApertureLight& theProfile = theFd.GetFdRecApertureLight();
975 const vector<double>& dia_time = theProfile.GetTime();
976 const vector<double>& dia_time_err = theProfile.GetTimeError();
981 unsigned int time_size = diaPhotonTrace.
GetNPoints();
982 vector<double> dia_fluor(time_size);
983 vector<double> dia_fluor_err(time_size);
984 vector<double> dia_direct_cher(time_size);
985 vector<double> dia_direct_cher_err(time_size);
986 vector<double> dia_mie_cher(time_size);
987 vector<double> dia_mie_cher_err(time_size);
988 vector<double> dia_ray_cher(time_size);
989 vector<double> dia_ray_cher_err(time_size);
990 vector<double> dia_mult_cher(time_size);
991 vector<double> dia_mult_fluor(time_size);
996 std::copy(directFluorescence.
YBegin(), directFluorescence.
YEnd(), &dia_fluor.front());
1002 std::copy(directCherenkov.
YBegin(), directCherenkov.
YEnd(), &dia_direct_cher.front());
1008 std::copy(mieCherenkov.
YBegin(), mieCherenkov.
YEnd(), &dia_mie_cher.front());
1014 std::copy(rayCherenkov.
YBegin(), rayCherenkov.
YEnd(), &dia_ray_cher.front());
1020 std::copy(rayCherenkov.
YBegin(), rayCherenkov.
YEnd(), &dia_mult_cher.front());
1026 std::copy(tmp.
YBegin(), tmp.
YEnd(), &dia_mult_fluor.front());
1029 for (
unsigned int i = 0, n = dia_time.size(); i < n; ++i) {
1030 const double timeBin = 2 * dia_time_err[i];
1031 dia_fluor[i] /= timeBin;
1032 dia_direct_cher[i] /= timeBin;
1033 dia_mie_cher[i] /= timeBin;
1034 dia_ray_cher[i] /= timeBin;
1035 dia_mult_fluor[i] /= timeBin;
1036 dia_mult_cher[i] /= timeBin;
1039 theProfile.SetFluorLightAtAperture(dia_fluor);
1040 theProfile.SetCherLightAtAperture(dia_direct_cher);
1041 theProfile.SetMieCherLightAtAperture(dia_mie_cher);
1042 theProfile.SetRayCherLightAtAperture(dia_ray_cher);
1043 theProfile.SetMultScatCherLightAtAperture(dia_mult_cher);
1044 theProfile.SetMultScatFluorLightAtAperture(dia_mult_fluor);
1047 double totalLight = 0;
1048 double totalCherenkov = 0;
1049 for (
unsigned int i = 0, n = dia_time.size(); i < n; ++i) {
1050 double timeBin = 2 * dia_time_err[i];
1051 totalLight += (dia_fluor[i] + dia_mult_fluor[i] +
1052 dia_direct_cher[i] + dia_mie_cher[i] +
1053 dia_ray_cher[i] + dia_mult_cher[i]) * timeBin;
1054 totalCherenkov += (dia_direct_cher[i] + dia_mie_cher[i] + dia_ray_cher[i] +
1055 dia_mult_cher[i]) * timeBin;
1058 FdRecShower& theShower = theFd.GetFdRecShower();
1059 if (totalCherenkov > 0 && totalLight > 0)
1060 theProfile.SetCherenkovFraction(100 * totalCherenkov / totalLight);
1062 theProfile.SetCherenkovFraction(-1);
1065 FillViewingAngle(&theProfile, &(theFd.GetFdRecGeometry()), theShower.GetXmaxChi());
1070 const unsigned int esize = electronTrace.
GetNPoints();
1072 vector<double> depth(electronTrace.XBegin(), electronTrace.XEnd());
1073 vector<double> depth_err(electronTrace.XErrBegin(), electronTrace.XErrEnd());
1074 vector<double>
electrons(electronTrace.YBegin(), electronTrace.YEnd());
1075 vector<double> electrons_err(electronTrace.YErrBegin(), electronTrace.YErrEnd());
1077 bool hasdEdX =
false;
1079 for (
unsigned int i = 0; i < esize; ++i) {
1081 depth_err[i] /=
g/
cm2;
1084 theShower.SetDepth(depth, depth_err);
1085 theShower.SetElectrons(
electrons, electrons_err);
1092 const unsigned int dedx_size = dedxTrace.
GetNPoints();
1094 if (dedx_size != esize) {
1095 ERROR(
"FillFdProfile - Error dedx_size!=size (?)");
1100 std::copy(dedxTrace.
YErrBegin(),dedxTrace.
YErrEnd(), &electrons_err.front());
1102 for (
unsigned int i = 0; i < esize; ++i) {
1104 electrons_err[i] /=
PeV/(
g/
cm2);
1107 theShower.SetEnergyDeposit(
electrons, electrons_err);
1131 const double rhoNmaxXmax =
1135 double xzeroErr = 0;
1146 double rhoNMaxLambda = 0;
1147 double rhoNMaxX0 = 0;
1148 double rhoXMaxLambda = 0;
1149 double rhoXMaxX0 = 0;
1150 double rhoLambdaX0 = 0;
1152 EGaisserHillasType ghType = eGHUndefinedType;
1161 using namespace evt::gh;
1164 ghType = eGHFourParClassic;
1167 ghType = eGHFourParWidth;
1170 ghType = eGHFourParUSP;
1174 ostringstream errMsg;
1175 errMsg <<
" no ADST enum for GH type "
1208 WARNING(
"6 Parameter GaisserHillas-fit? Are you serious?");
1214 const FdRecGeometry& recGeo = theFd.GetFdRecGeometry();
1216 det::Detector::GetInstance().GetReferenceCoordinateSystem();
1218 const Vector recSDP(1, recGeo.GetSDPTheta(), recGeo.GetSDPPhi(), eyeCS, Vector::kSpherical);
1221 FdRecShower& theShower = theFd.GetFdRecShower();
1222 theShower.SetGHType(ghType);
1224 const TVector3& coreSiteCS = theShower.GetCoreSiteCS();
1225 Point recCore(coreSiteCS.X()*
m, coreSiteCS.Y()*
m, coreSiteCS.Z()*
m, referenceCS);
1226 const TVector3& axisSiteCS = theShower.GetAxisSiteCS();
1227 const Vector recAxis(1, axisSiteCS.Theta(), axisSiteCS.Phi(), referenceCS, Vector::kSpherical);
1233 FdRecShower& theShower = theFd.GetFdRecShower();
1235 const double conv = (
PeV/
gcm2);
1236 theShower.SetdEdXmax(nmax / conv);
1237 theShower.SetdEdXError(nmaxErr / conv);
1239 theShower.SetXmax(xmax / gcm2, xMaxChi);
1244 theShower.SetX0(xzero);
1245 theShower.SetX0Error(xzeroErr);
1246 theShower.SetLambda(lam);
1247 theShower.SetLambdaError(lamErr);
1248 theShower.SetFWHM(fwhm);
1249 theShower.SetFWHMError(fwhmErr);
1250 theShower.SetAsymmetry(asym);
1251 theShower.SetAsymmetryError(asymErr);
1252 theShower.SetUspL(uspL);
1253 theShower.SetUspLError(uspLErr);
1254 theShower.SetUspR(uspR);
1255 theShower.SetUspRError(uspRErr);
1256 theShower.SetGHChi2(chisq);
1257 theShower.SetGHNdf(
int(ndof));
1259 theShower.SetdEdXmaxXMaxCorrelation(rhoNmaxXmax);
1260 theShower.SetdEdXmaxLambdaCorrelation(rhoNMaxLambda);
1261 theShower.SetdEdXmaxX0Correlation(rhoNMaxX0);
1262 theShower.SetXMaxLambdaCorrelation(rhoXMaxLambda);
1263 theShower.SetXMaxX0Correlation(rhoXMaxX0);
1264 theShower.SetLambdaX0Correlation(rhoLambdaX0);
1275 theShower.SetDGHXmax1(xmax1 / gcm2);
1276 theShower.SetDGHXmax2(xmax2 / gcm2);
1277 theShower.SetDGHChi2Improvement(mgChi2);
1294 FdRecShower& recShower = theFd.GetFdRecShower();
1295 const atm::Atmosphere& atmo = det::Detector::GetInstance().GetAtmosphere();
1304 double distCoreXmax = 0;
1305 double xMaxHeight = 0;
1306 double xMaxHeightAboveSeaLevel = 0;
1313 xMaxHeight = (heightVsSlantDepth.
MaxX() > xmax)
1314 ? heightVsSlantDepth.
Y(xmax) : 0.;
1317 distCoreXmax = (distVsSlantDepth.
MaxX() > xmax)
1318 ? -distVsSlantDepth.
Y (xmax) : 0.;
1320 xMaxHeightAboveSeaLevel = xMaxHeight;
1324 const double fdTheta = recShower.GetZenith();
1325 const double Xvert = xmax * cos(fdTheta);
1326 xMaxHeightAboveSeaLevel = heightVsDepth.
Y(Xvert);
1328 distCoreXmax = xMaxHeight / cos(fdTheta);
1334 const Point pointXmax = core + axis * distCoreXmax;
1335 recShower.SetCoreXmaxDist(distCoreXmax);
1337 double distXmax = (pointXmax - eyePos).GetMag();
1340 if (std::isnan(distXmax))
1342 recShower.SetDistXmax(distXmax);
1344 recShower.SetHeightXmax(xMaxHeightAboveSeaLevel);
1347 const vector<double>& depthVec = recShower.GetDepth();
1349 vector<double> xHeightAboveSeaLevel;
1354 for (
unsigned int iDepth = 0; iDepth < depthVec.size(); ++iDepth) {
1355 const double depth = depthVec[iDepth] *
g/
cm2;
1356 double heightAboveSeaLevel;
1357 if (heightVsSlantDepth.
MaxX() > depth && heightVsSlantDepth.
MinX() < depth)
1358 heightAboveSeaLevel = heightVsSlantDepth.
Y(depth);
1360 heightAboveSeaLevel = 0;
1361 xHeightAboveSeaLevel.push_back(heightAboveSeaLevel);
1364 xHeightAboveSeaLevel.clear();
1367 const double fdTheta = recShower.GetZenith();
1368 for (
unsigned int iDepth = 0; iDepth < depthVec.size(); ++iDepth) {
1369 const double depth = depthVec[iDepth] *
g/
cm2;
1370 const double Xvert = depth*cos(fdTheta);
1371 const double heightAboveSeaLevel = heightVsDepth.
Y(Xvert);
1372 xHeightAboveSeaLevel.push_back(heightAboveSeaLevel);
1377 recShower.SetHeight(xHeightAboveSeaLevel);
1379 std::vector<double> lambda;
1380 const double refLambda = det::Detector::GetInstance().GetFDetector().GetReferenceLambda();
1381 lambda.push_back(refLambda);
1387 double attXmax = mieCAtt.
GetY(0)*rayCAtt.
GetY(0);
1388 if (std::isnan(attXmax))
1390 double mieCAttXmax = mieCAtt.
GetY(0);
1391 if (std::isnan(mieCAttXmax))
1394 recShower.SetAttXmax(attXmax);
1395 recShower.SetMieAttXmax(mieCAttXmax);
1398 const double dX = 25*
g/
cm2;
1399 const std::vector<double> referenceWaveLength(1, refLambda);
1402 const unsigned int dedx_size = dedxTrace.
GetNPoints();
1406 const double depth1 = dedxTrace.
GetX(0);
1407 const double depth2 = dedxTrace.
GetX(dedx_size-1);
1408 const double minDepth = fmin(depth1, depth2);
1409 const double maxDepth = fmax(depth1, depth2);
1412 double rayleighCorrection = 0;
1413 double mieCorrection = 0;
1417 double profileSum = 0;
1418 double profileMieAttSum = 0;
1419 double profileRayAttSum = 0;
1421 for (
double currentDepth = maxDepth; currentDepth > minDepth; currentDepth -= dX) {
1423 if (currentDepth > distVsSlantDepth.
MinX() &&
1424 currentDepth < distVsSlantDepth.
MaxX()) {
1426 const double dEdX = ghParameters.
Eval(currentDepth);
1427 const double distance = -distVsSlantDepth.
Y(currentDepth);
1428 const Point pointOnShower = core + distance*axis;
1436 profileMieAttSum += dEdX * mieCAtt.
GetY(0);
1437 profileRayAttSum += dEdX * rayCAtt.
GetY(0);
1442 if (profileMieAttSum > 0)
1443 mieCorrection = profileSum / profileMieAttSum;
1444 if (profileRayAttSum > 0)
1445 rayleighCorrection = profileSum / profileRayAttSum;
1447 ERROR(
"calculation of transmission factors not implemented for flat atmosphere...");
1449 rayleighCorrection = 0;
1451 recShower.SetMieCorrection(mieCorrection);
1452 recShower.SetRayleighCorrection(rayleighCorrection);
1455 if (!depthVec.empty()) {
1456 recShower.SetXTrackMin(depthVec.front(), 0.);
1457 recShower.SetXTrackMax(depthVec.back());
1459 const vector<double>& aptime = theFd.GetFdRecApertureLight().GetTime();
1460 if (aptime.size() > 1)
1461 recShower.SetTimTrackObs(aptime.back() - aptime.front());
1463 recShower.SetTimTrackObs(0.);
1472 const int eyeId = fd.GetEyeId();
1485 unsigned int NWLengthFluo = WLengthFluo.size();
1486 unsigned int NWLengthCkov = WLengthCkov.size();
1488 const bool hasEyeTrigger = eye.
HasHeader();
1490 if (hasEyeTrigger) {
1497 bool oneTel =
false;
1501 if (!
Config().DropUntriggeredMCTelescopes())
1502 select = ComponentSelector::eInDAQ;
1506 const int telId = teliter->GetId();
1508 double totalGenLight = 0;
1509 double totalGenCherenkov = 0;
1511 if (!teliter->HasSimData())
1519 const bool hasNoPixels = (teliter->PixelsBegin(select) == teliter->PixelsEnd(select));
1523 const uint nBins = distanceTrace.
GetSize();
1524 double binWidth = distanceTrace.
GetBinning();
1525 const double telStartTime = hasEyeTrigger ? (simTel.
GetPhotonsStartTime()-eyeTriggerTime).GetInterval() : 0;
1527 vector<double> timeVec(nBins);
1528 vector<double> lightDiaTotal(nBins);
1529 vector<double> lightDiaFluo(nBins);
1530 vector<double> lightDiaCkovD(nBins);
1531 vector<double> lightDiaCkovM(nBins);
1532 vector<double> lightDiaCkovR(nBins);
1534 vector<double> lightDiaCkovPrimD(nBins);
1535 vector<double> lightDiaCkovPrimM(nBins);
1536 vector<double> lightDiaCkovPrimR(nBins);
1537 bool HasCkovPrimD =
false;
1538 bool HasCkovPrimM =
false;
1539 bool HasCkovPrimR =
false;
1541 bool HasTotal =
false;
1542 bool HasFluo =
false;
1543 bool HasCkovD =
false;
1544 bool HasCkovM =
false;
1545 bool HasCkovR =
false;
1553 for (uint iBin = 0; iBin < nBins; ++iBin) {
1555 timeVec[iBin] = (telStartTime + double(0.5 + iBin) * binWidth) / binWidth;
1558 for (
unsigned int iwl = 0; iwl < NWLengthFluo; ++iwl) {
1560 const double wavelength = WLengthFluo[iwl];
1561 if (wavelength<minWavelength || wavelength>maxWavelength)
1567 const TraceD& photonTrace =
1569 const double vBin = photonTrace[iBin] *
norm;
1570 lightDiaFluo[iBin] += vBin;
1571 lightDiaTotal[iBin] += vBin;
1572 totalGenLight += vBin;
1579 for (
unsigned int iwl = 0; iwl < NWLengthCkov; ++iwl) {
1581 const double wavelength = WLengthCkov[iwl];
1582 if (wavelength<minWavelength || wavelength>maxWavelength)
1588 const TraceD& photonTrace =
1590 const double vBin = iBin<photonTrace.
GetSize() ? photonTrace[iBin] * norm : 0;
1591 lightDiaCkovD[iBin] += vBin;
1592 lightDiaTotal[iBin] += vBin;
1593 totalGenLight += vBin;
1594 totalGenCherenkov += vBin;
1600 const TraceD& photonTrace =
1602 const double vBin = photonTrace[iBin] *
norm;
1603 lightDiaCkovM[iBin] += vBin;
1604 lightDiaTotal[iBin] += vBin;
1605 totalGenLight += vBin;
1606 totalGenCherenkov += vBin;
1612 const TraceD& photonTrace =
1614 const double vBin = photonTrace[iBin] *
norm;
1615 lightDiaCkovR[iBin] += vBin;
1616 lightDiaTotal[iBin] += vBin;
1617 totalGenLight += vBin;
1618 totalGenCherenkov += vBin;
1626 const double vBin = photonTrace[iBin] *
norm;
1627 lightDiaCkovPrimD[iBin] += vBin;
1628 lightDiaTotal[iBin] += vBin;
1629 HasCkovPrimD =
true;
1635 const double vBin = photonTrace[iBin] *
norm;
1636 lightDiaCkovPrimM[iBin] += vBin;
1637 lightDiaTotal[iBin] += vBin;
1638 HasCkovPrimM =
true;
1644 const double vBin = photonTrace[iBin] *
norm;
1645 lightDiaCkovPrimR[iBin] += vBin;
1646 lightDiaTotal[iBin] += vBin;
1647 HasCkovPrimR =
true;
1654 if (totalGenLight <= 0)
1658 if (
Config().GetRebinSimTelescopeTraces() > 0) {
1662 int nCombine =
max(1,
int(
Config().GetRebinSimTelescopeTraces() / binWidth));
1664 const int nOrg = timeVec.size();
1665 const int nReduced =
max(2, nOrg/nCombine);
1666 nCombine =
max(1,
int(
double(nOrg)/
double(nReduced)));
1669 binWidth *= nCombine;
1678 vector<double> time_comb;
1679 vector<double> fluo_comb;
1680 vector<double> dirC_comb;
1681 vector<double> mieC_comb;
1682 vector<double> rayC_comb;
1683 vector<double> total_comb;
1684 for (
unsigned int i = 0; i < timeVec.size(); ++i) {
1685 c1 = (telStartTime + double(0.5 + time_comb.size()) * binWidth) / binWidth;
1686 c2 += lightDiaFluo[i];
1687 c3 += lightDiaCkovD[i];
1688 c4 += lightDiaCkovM[i];
1689 c5 += lightDiaCkovR[i];
1690 c6 += lightDiaTotal[i];
1691 if (++iCombine >= nCombine) {
1692 time_comb.push_back(c1);
1693 fluo_comb.push_back(c2);
1694 dirC_comb.push_back(c3);
1695 mieC_comb.push_back(c4);
1696 rayC_comb.push_back(c5);
1697 total_comb.push_back(c6);
1698 c1 = c2 = c3 = c4 = c5 = c6 = 0;
1704 time_comb.push_back(c1);
1705 fluo_comb.push_back(c2);
1706 dirC_comb.push_back(c3);
1707 mieC_comb.push_back(c4);
1708 rayC_comb.push_back(c5);
1709 total_comb.push_back(c6);
1711 timeVec = time_comb;
1712 lightDiaFluo = fluo_comb;
1713 lightDiaCkovD = dirC_comb;
1714 lightDiaCkovM = mieC_comb;
1715 lightDiaCkovR = rayC_comb;
1716 lightDiaTotal = total_comb;
1721 if (!fd.HasTelescopeData(telId))
1722 fd.MakeTelescopeData(telId);
1724 FdTelescopeData& telSimD = fd.GetTelescopeData(telId);
1726 FdGenApertureLight& fdProfile = telSimD.GetGenApertureLight();
1727 fdProfile.SetTimeBinning(binWidth/
ns);
1730 fdProfile.SetTotalLightAtAperture(lightDiaTotal);
1732 fdProfile.SetFluorLightAtAperture(lightDiaFluo);
1734 fdProfile.SetCherLightAtAperture(lightDiaCkovD);
1736 fdProfile.SetRayCherLightAtAperture(lightDiaCkovR);
1738 fdProfile.SetMieCherLightAtAperture(lightDiaCkovM);
1741 fdProfile.SetCherPrimaryLightAtAperture(lightDiaCkovPrimD);
1743 fdProfile.SetRayCherPrimaryLightAtAperture(lightDiaCkovPrimR);
1745 fdProfile.SetMieCherPrimaryLightAtAperture(lightDiaCkovPrimM);
1748 if (HasTotal || HasFluo || HasCkovD || HasCkovR || HasCkovM)
1749 fdProfile.SetTime(timeVec);
1752 FillViewingAngle((FdApertureLight*)&(telSimD.GetGenApertureLight()), (FdGeometry*)&(fd.GetGenGeometry()), fd.GetGenShower().GetXmaxChi());
1754 telSimD.GetGenApertureLight().SetCherenkovFraction(0);
1755 if (totalGenCherenkov > 0 && totalGenLight > 0)
1756 telSimD.GetGenApertureLight().SetCherenkovFraction(100.*totalGenCherenkov/totalGenLight);
1767 const fdet::Eye& detEye = det::Detector::GetInstance().GetFDetector().GetEye(theEye);
1769 for (
auto teliter = theEye.
TelescopesBegin(ComponentSelector::eHasData);
1770 teliter != theEye.
TelescopesEnd(ComponentSelector::eHasData); ++teliter) {
1772 const unsigned int telId = teliter->
GetId();
1774 if (!teliter->HasRecData())
1778 if (!theFd.HasTelescopeData(telId))
1779 theFd.MakeTelescopeData(telId);
1780 FdTelescopeData& telRecD = theFd.GetTelescopeData(telId);
1784 FdRecGeometry& recGeo = telRecD.GetRecGeometry();
1789 recGeo.SetSDP(SDPtheta, SDPphi);
1802 FdRecApertureLight& recLight = telRecD.GetRecApertureLight();
1804 recLight.SetZeta(oRecData.
GetZeta());
1812 const double binSize = 100*
ns;
1813 const unsigned int time_size = diaPhotonTrace.
GetNPoints();
1814 vector<double> diaTime(time_size), diaTimeErr(time_size),
1815 diaPhotons(time_size), diaPhotonsErr(time_size);
1817 recLight.SetTimeBinning(binSize/
ns);
1826 unsigned int firstComponentBin = 0;
1827 const double firstComponentBinTime = (directFluorescence.
GetNPoints() == 0) ? 0 : directFluorescence.
GetX(0);
1830 for (
unsigned int i = 0; i < time_size; ++i) {
1831 if (diaPhotonTrace[i].X() <= firstComponentBinTime)
1832 firstComponentBin = i;
1834 diaTime[i] = diaPhotonTrace[i].X() / binSize;
1835 diaTimeErr[i] = diaPhotonTrace.
GetXErr(i) / binSize;
1837 if (diaTimeErr[i] == 0)
1840 diaPhotons[i] = diaPhotonTrace[i].
Y() / (2. * diaTimeErr[i]);
1841 diaPhotonsErr[i] = diaPhotonTrace.
GetYErr(i) / (2. * diaTimeErr[i]);
1844 recLight.SetTime(diaTime, diaTimeErr);
1845 recLight.SetTotalLightAtAperture(diaPhotons, diaPhotonsErr);
1853 vector<double> dia_fluor(time_size);
1854 vector<double> dia_fluor_err(time_size);
1855 vector<double> dia_direct_cher(time_size);
1856 vector<double> dia_direct_cher_err(time_size);
1857 vector<double> dia_mie_cher(time_size);
1858 vector<double> dia_mie_cher_err(time_size);
1859 vector<double> dia_ray_cher(time_size);
1860 vector<double> dia_ray_cher_err(time_size);
1861 vector<double> dia_mult_cher(time_size);
1862 vector<double> dia_mult_fluor(time_size);
1868 std::copy(directFluorescence.
YBegin(),
1869 directFluorescence.
YEnd(),
1870 dia_fluor.begin() + firstComponentBin);
1871 std::copy(directFluorescence.
YErrBegin(),
1873 dia_fluor_err.begin() + firstComponentBin);
1880 std::copy(directCherenkov.
YBegin(),
1881 directCherenkov.
YEnd(),
1882 dia_direct_cher.begin() + firstComponentBin);
1885 dia_direct_cher_err.begin() + firstComponentBin);
1892 std::copy(mieCherenkov.
YBegin(),
1893 mieCherenkov.
YEnd(),
1894 dia_mie_cher.begin() + firstComponentBin);
1897 dia_mie_cher_err.begin() + firstComponentBin);
1904 std::copy(rayCherenkov.
YBegin(),
1905 rayCherenkov.
YEnd(),
1906 dia_ray_cher.begin() + firstComponentBin);
1909 dia_ray_cher_err.begin() + firstComponentBin);
1916 std::copy(multCherenkov.
YBegin(),
1917 multCherenkov.
YEnd(),
1918 dia_mult_cher.begin() + firstComponentBin);
1925 std::copy(multFl.
YBegin(),
1927 dia_mult_fluor.begin() + firstComponentBin);
1930 for (
unsigned int i = 0; i< diaPhotons.size(); ++i) {
1932 const double timeBin = 2 * diaTimeErr[i];
1933 dia_fluor[i] /= timeBin;
1934 dia_fluor_err[i] /= timeBin;
1935 dia_direct_cher[i] /= timeBin;
1936 dia_direct_cher_err[i] /= timeBin;
1937 dia_mie_cher[i] /= timeBin;
1938 dia_mie_cher_err[i] /= timeBin;
1939 dia_ray_cher[i] /= timeBin;
1940 dia_ray_cher_err[i] /= timeBin;
1941 dia_mult_fluor[i] /= timeBin;
1942 dia_mult_cher[i] /= timeBin;
1945 recLight.SetFluorLightAtAperture(dia_fluor);
1946 recLight.SetCherLightAtAperture(dia_direct_cher);
1947 recLight.SetMieCherLightAtAperture(dia_mie_cher);
1948 recLight.SetRayCherLightAtAperture(dia_ray_cher);
1949 recLight.SetMultScatCherLightAtAperture(dia_mult_cher);
1950 recLight.SetMultScatFluorLightAtAperture(dia_mult_fluor);
1959 const vector<Double_t> eff(effTab.
YBegin(), effTab.
YEnd());
1960 recLight.SetFluorLightCollEfficiency(eff);
1962 recLight.SetFluorLightCollEfficiencyErrors(effErr);
1968 const vector<Double_t> eff(effTab.
YBegin(), effTab.
YEnd());
1969 recLight.SetCherLightCollEfficiency(eff);
1971 recLight.SetCherLightCollEfficiencyErrors(effErr);
1977 const vector<Double_t> eff(effTab.
YBegin(), effTab.
YEnd());
1978 recLight.SetMieCherLightCollEfficiency(eff);
1980 recLight.SetMieCherLightCollEfficiencyErrors(effErr);
1986 const vector<Double_t> eff(effTab.
YBegin(), effTab.
YEnd());
1987 recLight.SetRayCherLightCollEfficiency(eff);
1989 recLight.SetRayCherLightCollEfficiencyErrors(effErr);
2000 FdRecShower& theShower = theFd.GetFdRecShower();
2003 bool retval =
false;
2005 if (isfinite(enTot) &&
2010 theShower.SetCalorimetricEnergy(showerFRec.
GetEmEnergy());
2012 theShower.SetEnergy(enTot);
2026 if (fdevent.GetRecLevel() < reclevel)
2027 fdevent.SetRecLevel(reclevel);
2051 const atm::ProfileResult& depthProfile = det::Detector::GetInstance().GetAtmosphere().EvaluateDepthVsHeight();
2052 const double atmHeightMin = depthProfile.
MinX();
2053 const double atmHeightMax = depthProfile.
MaxX();
2066 const double Rp = eyeRec.
GetRp();
2067 const double T0 = eyeRec.
GetTZero();
2069 const Vector eyeCoreVec = Rp / sin(
kPi - Chi0) * horizontal;
2070 eyeCoreVec.TransformTo(CS) ;
2074 Vector axis(rot*horizontal);
2078 double cZen =
CosAngle(axis, vertical);
2088 if (!sditer->HasRecData())
2100 if (sditer->IsSilent())
2103 const unsigned int thisStationId = sditer->GetId();
2105 FdRecStation recStation;
2108 recStation.SetId(sditer->GetId());
2112 recStation.SetTime(time/100, 0);
2115 if (sditer->IsCandidate())
2116 recStation.SetCandidate();
2117 if (sditer->IsRejected())
2118 recStation.SetAccidental();
2121 if (sditer->HasTriggerData()) {
2126 recStation.SetToT();
2128 recStation.SetToTd();
2130 recStation.SetMoPS();
2132 recStation.SetT2Threshold();
2134 recStation.SetT1Threshold();
2136 recStation.SetRandom();
2138 recStation.SetRDThreshold();
2144 if (sditer->HasCalibData())
2145 recStation.SetCalibrationVersion(sditer->GetCalibData().GetVersion());
2148 const vector<unsigned short int>& hybridStations = showerfrec.
GetStationIds();
2149 for (
unsigned int k = 0; k < hybridStations.size(); ++k) {
2150 if (hybridStations[k] == thisStationId) {
2151 recStation.SetHybrid();
2161 const Vector coreTankVec = eyeTankVec - eyeCoreVec;
2163 const double azimuth = eyeTankVec.
GetPhi(EyeCS);
2164 const double elevation =
kPi/2 - eyeTankVec.GetTheta(EyeCS);
2166 recStation.SetAzimuthAndElevation(azimuth, elevation);
2168 const double tankProj = coreTankVec * axis;
2169 const Vector tankAxisVec = coreTankVec - (tankProj * axis);
2170 const Vector tankInAxisVec = eyeCoreVec + tankProj * axis;
2171 const double rho = tankAxisVec.
GetMag();
2178 - eyeTriggerTime).GetInterval() / 100;
2181 double chi_i =
Angle(tankInAxisVec,horizontal);
2182 if (tankInAxisVec.GetZ(CS) < 0)
2184 recStation.SetChi_i(chi_i);
2185 recStation.SetTimeEye(t_i);
2188 const double beta = Chi0 -
kPi/2 - chi_i;
2189 const double t_fit = (T0 + Rp/
kSpeedOfLight * (tan (beta)+1./cos (beta)))/100.;
2190 const double t_residual =
std::abs (t_fit - t_i);
2192 recStation.SetTimeResidual(t_residual);
2193 recStation.SetDistanceToAxis (rho);
2197 recStation.SetAge(-1);
2198 recStation.SetSlantDepth(-1/
g*
cm2);
2200 if (adstFDEvent.GetRecLevel() >= eHasLongitudinalProfile) {
2204 const double TankOverSeaLevel =
2207 if (TankOverSeaLevel>atmHeightMin && TankOverSeaLevel<atmHeightMax) {
2208 const double DepthTank = depthProfile.
Y (TankOverSeaLevel);
2209 const double P_USSTD = 1013.272684 *
pow(1 - 2.255771988e-5*TankOverSeaLevel/
m, 5.255876);
2211 Point tankInAxis = eyePos + tankInAxisVec;
2212 const double TankHeightAxis =
2215 double Xtank = 1013.272684 *
pow(1 - 2.255771988e-5*TankHeightAxis/
m, 5.255876)
2216 * (DepthTank/P_USSTD);
2219 const double Xmax = adstFDEvent.GetFdRecShower().GetXmax();
2223 recStation.SetSlantDepth(Xtank/
g*cm2);
2227 adstFDEvent.AddStation(recStation);
2237 FdRecGeometry& theGeometry = theFd.GetFdRecGeometry();
2238 FdRecShower& theShower = theFd.GetFdRecShower();
2244 int nTracePixel = 0;
2247 double meanPixelRMS = 0;
2248 double meanADCRMS = 0;
2249 vector<unsigned short int> pixelID;
2250 vector<unsigned short int> pixelStatus;
2251 vector<double> pixelTime;
2252 vector<double> pixelTimeErr;
2253 vector<double> pixelChi;
2254 vector<double> pixelCharge;
2255 vector<int> pixelThreshold;
2257 vector<FDSaturationStatus> pixelSaturationStatus;
2259 vector<vector<double>> pixelTrace;
2260 vector<vector<double>> spotRecPixelTrace;
2261 vector<map<int,vector<double>>> pixelSimTraces;
2262 vector<int> pixelSimTraceOffsets;
2264 vector<int> pulseStart;
2265 vector<int> pulseStop;
2266 vector<double> pixelRMS;
2267 map<int, double> calibConst;
2268 map<int, int> LookUp;
2270 UShort_t istat = eBackGroundPix;
2272 bool hasFdPixel =
false;
2273 bool hasFdTracePixel =
false;
2275 vector<int> evPixelID;
2276 vector<int> mirrorTimeOffset;
2277 vector<bool> triggeredPixel;
2281 double photonRMSSum = 0;
2282 double ADCRMSSum = 0;
2284 double angularTrackLength = 0;
2286 const double kTraceBinning = 100*
ns;
2293 const int nDetectorPixelsPerTel =
2294 TelescopeGeometry::GetMaxNumberOfPixelsPerCamera();
2297 for (
auto iPixel = iTel->PixelsBegin(ComponentSelector::eHasData); iPixel != iTel->PixelsEnd(ComponentSelector::eHasData); ++iPixel) {
2298 if (!iPixel->HasRecData())
2300 const int pixID = (iPixel->GetId()-1) +
2301 (iPixel->GetTelescopeId()-1)*nDetectorPixelsPerTel;
2303 evPixelID.push_back(pixID);
2304 LookUp[pixID] = nRawPix;
2307 const double photonRMS = iPixel->GetRecData().GetRMS();
2308 photonRMSSum += photonRMS;
2312 if (calibConst[nRawPix] != 0)
2313 ADCRMS = photonRMS / calibConst[nRawPix];
2314 ADCRMSSum += ADCRMS;
2316 mirrorTimeOffset.push_back(iTel->GetTimeOffset());
2320 int firstBin = iPixel->GetRecData().GetFirstTriggeredTimeBin();
2321 if (firstBin > -1) {
2322 triggeredPixel.push_back(
true);
2325 triggeredPixel.push_back(
false);
2336 nTrigPixel = nTrigPix;
2337 pixelID.resize(nRawPix);
2338 pixelStatus.resize(nRawPix);
2339 pixelTime.resize(nRawPix);
2340 pixelTimeErr.resize(nRawPix);
2341 pixelChi.resize(nRawPix);
2342 pixelCharge.resize(nRawPix);
2343 pixelSaturationStatus.resize(nRawPix);
2344 pixelThreshold.resize(nRawPix);
2346 meanPixelRMS = photonRMSSum / nRawPix;
2347 meanADCRMS = ADCRMSSum / nRawPix;
2349 for (
int pix = 0; pix < nRawPix; ++pix) {
2350 if (!triggeredPixel[pix])
2351 istat = eBackGroundPix;
2353 istat = eTriggeredPix;
2355 pixelID[pix] = evPixelID[pix];
2356 pixelStatus[pix] = istat;
2358 pixelTimeErr[pix] = 0;
2360 pixelCharge[pix] = 0;
2361 pixelThreshold[pix] = 0;
2367 const int thisTelId = pixelID[pix] / nDetectorPixelsPerTel + 1;
2368 const int thisPixelId = pixelID[pix] - (thisTelId-1)*nDetectorPixelsPerTel + 1;
2369 const fdet::Eye& eyeDet = det::Detector::GetInstance().GetFDetector().GetEye(eye.
GetId());
2370 const Vector& pixeldir = eyeDet.GetTelescope(thisTelId).GetPixel(thisPixelId).GetDirection();
2372 const Vector vertical(0, 0, 1, eyeCS);
2378 const double chi_i =
Angle(chi_i_vector, horizontalWithinSDP);
2379 pixelChi[pix] = chi_i;
2383 cerr <<
" RecDataWriter::ProvideFdRecPixel - no triggered pixels???" << endl;
2389 istat = ePulseRecPix;
2394 int pixNum = evtpixel.
GetId();
2397 int pixID = (miID-1)*nDetectorPixelsPerTel+pixNum-1;
2399 if (LookUp.count(pixID) == 0) {
2401 err <<
" RecDataWriter::ProvideFdRecPixel - empty lookup table slot"
2406 int pixSerial = LookUp[pixID];
2410 double time_err = 0;
2415 Double_t TelescopeTimeOffset = mirrorTimeOffset[pixSerial] / kTraceBinning;
2416 time = pixrec.
GetCentroid() + TelescopeTimeOffset;
2421 const double chi = pixrec.
GetChi_i();
2429 pixelStatus[pixSerial] = istat;
2430 pixelTime[pixSerial] = time;
2431 pixelTimeErr[pixSerial] = time_err;
2432 pixelCharge[pixSerial] = charge;
2433 pixelChi[pixSerial] = chi;
2434 pixelThreshold[pixSerial] = threshold;
2441 pixelSaturationStatus[pixSerial] =
eRecovered;
2450 nRecPixel = NRecPix;
2457 det::Detector::GetInstance().GetFDetector().GetEye(eye.
GetId()).GetEyeCoordinateSystem();
2469 det::Detector::GetInstance().GetFDetector().GetPixel(evtpixel);
2472 dir.TransformTo(eyeCS);
2476 const double d =
kPi/2 -
Angle(dir, SDP);
2479 const int pixNum = evtpixel.
GetId();
2482 const int pixID = (miID-1) * nDetectorPixelsPerTel+pixNum-1;
2484 if (LookUp.count(pixID) == 0) {
2485 cerr <<
" RecDataWriter::FillFdRecPixel - empty lookup table slot" << endl;
2488 const int pixSerial = LookUp[pixID];
2490 pixelStatus[pixSerial] = istat;
2494 RMS = (NSDPPix > 0 ?
sqrt(RMS/(
double)NSDPPix) : 0.);
2505 istat = eTimeFitPix;
2508 const int pixNum = evtpixel.
GetId();
2511 const int pixID = (miID-1) * nDetectorPixelsPerTel+pixNum-1;
2513 if (LookUp.count(pixID) == 0) {
2514 cerr <<
" RecDataWriter::FillFdRecPixel - empty lookup table slot" << endl;
2517 const int pixSerial = LookUp[pixID];
2519 if (start || pixelChi[pixSerial] > MaxChi || start)
2520 MaxChi = pixelChi[pixSerial];
2521 if (start || pixelChi[pixSerial] < MinChi || start)
2522 MinChi = pixelChi[pixSerial];
2526 pixelStatus[pixSerial] = istat;
2531 nAxisPixel = NAxisPix;
2532 if (nAxisPixel > 0) {
2533 angularTrackLength = fabs(MaxChi - MinChi);
2534 theShower.SetAngTrackObs(angularTrackLength);
2539 if (
Config().StoreFDTraces() > 0) {
2541 nTracePixel = nPixel;
2542 const fdet::FDetector& detFD = det::Detector::GetInstance().GetFDetector();
2546 pulseStart.resize(nTracePixel);
2547 pulseStop.resize(nTracePixel);
2548 pixelRMS.resize(nTracePixel);
2549 pixelTrace.resize(nTracePixel);
2550 spotRecPixelTrace.resize(nTracePixel);
2551 pixelSimTraces.resize(nTracePixel);
2552 pixelSimTraceOffsets.resize(nTracePixel);
2557 for (
auto iPixel = iTel->PixelsBegin(ComponentSelector::eHasData); iPixel != iTel->PixelsEnd(ComponentSelector::eHasData); ++iPixel) {
2563 const int tracePixNo = traceEvtPixel.
GetId();
2566 const int tracePixId = (traceMiID-1)*nDetectorPixelsPerTel+tracePixNo-1;
2568 if (LookUp.count(tracePixId) == 0) {
2570 err <<
" RecDataProvider::FillFdRecPixel - empty lookup table slot" << tracePixId << endl;
2574 const int tracePixSerial = LookUp.find(tracePixId)->second;
2591 FdApertureLight::ELightComponent sourceLabel = FdApertureLight::eUnknown;
2596 sourceLabel = FdApertureLight::eFluorescence;
2608 sourceLabel = FdApertureLight::eDirectCherenkov;
2611 sourceLabel = FdApertureLight::eRayleighCherenkov;
2614 sourceLabel = FdApertureLight::eMieCherenkov;
2632 pixelSimTraces[tracePixSerial][sourceLabel].assign(iSource->GetTrace().Begin(), iSource->GetTrace().End());
2633 pixelSimTraceOffsets[tracePixSerial] = detCamera.
GetSLTTriggerBin() - iTel->GetSimData().GetSltTimeShift();
2638 pulseStop[tracePixSerial] = tracePixRec.
GetPulseStop();
2639 pixelRMS[tracePixSerial] = tracePixRec.
GetRMS();
2644 nTracePixel = tracePixel;
2646 if (nTracePixel > 0)
2647 hasFdTracePixel =
true;
2655 FdRecPixel& thePixel = theFd.GetFdRecPixel();
2657 if (
Config().StoreAllPixels())
2658 thePixel.SetNumberOfPixels(nPixel);
2660 thePixel.SetNumberOfPixels(nTrigPixel);
2662 thePixel.SetNumberOfTriggeredPixels(nTrigPixel);
2663 thePixel.SetNumberOfPulsedPixels(nRecPixel);
2664 if (
Config().StoreFDTraces() > 0 && hasFdTracePixel)
2665 thePixel.SetNumberOfTracePixels(nTracePixel);
2667 thePixel.SetNumberOfTracePixels(0);
2669 thePixel.SetMeanPixelRMS(meanPixelRMS);
2670 thePixel.SetMeanADCRMS(meanADCRMS);
2673 for (
int pix = 0; pix < nPixel; ++pix) {
2675 if (
Config().StoreAllPixels() || (EPixelStatus) pixelStatus[pix] >= eTriggeredPix) {
2676 thePixel.SetID(pixSerial, pixelID[pix]);
2677 thePixel.SetStatus(pixSerial, (EPixelStatus)pixelStatus[pix]);
2678 thePixel.SetTime(pixSerial, pixelTime[pix]);
2679 thePixel.SetTimeErr(pixSerial, pixelTimeErr[pix]);
2680 thePixel.SetCharge(pixSerial, pixelCharge[pix]);
2681 thePixel.SetChi(pixSerial, pixelChi[pix]);
2682 thePixel.SetThreshold (pixSerial, pixelThreshold[pix]);
2684 thePixel.SetHighGainSaturated(pixSerial);
2685 else if (pixelSaturationStatus[pix] ==
eLowGainSat)
2686 thePixel.SetLowGainSaturated(pixSerial);
2687 else if (pixelSaturationStatus[pix] ==
eRecovered)
2688 thePixel.SetSaturationRecovered(pixSerial);
2690 if (
Config().StoreFDTraces() > 0 && hasFdTracePixel) {
2691 thePixel.SetDataTrace(pixSerial, pixelTrace[pix]);
2692 thePixel.SetPulseStart(pixSerial, pulseStart[pix]);
2693 thePixel.SetPulseStop(pixSerial, pulseStop[pix]);
2694 thePixel.SetRMS(pixSerial, pixelRMS[pix]);
2695 thePixel.SetCalibrationConstant(pixSerial, calibConst[pix]);
2696 if (
Config().StoreMCTraces()) {
2697 for (
auto iSource = pixelSimTraces[pix].begin(); iSource != pixelSimTraces[pix].end(); ++iSource) {
2698 thePixel.SetSimTrace(iSource->second, pixSerial, (FdApertureLight::ELightComponent)iSource->first, pixelSimTraceOffsets[pix]);
2708 if (!pixelChi.empty()) {
2712 double linearTimeFitChi2 = 0;
2715 if (!TMath::IsNaN(chi2))
2716 linearTimeFitChi2 = chi2;
2718 theGeometry.SetLinearTimeFitChi2(linearTimeFitChi2);
2726 if (!event.
HasSimShower() || !
event.GetSimShower().HasGeometry())
2729 const int eyeId = fd.GetEyeId();
2740 FdGenGeometry& fdGeometry = fd.GetGenGeometry();
2743 bool hasEyeTrigger =
false;
2745 hasEyeTrigger =
true;
2746 const fevt::Eye& eye =
event.GetFEvent().GetEye(eyeId, ComponentSelector::eInDAQ);
2749 if (hasEyeTrigger) {
2752 hasEyeTrigger =
false;
2759 Vector showerAxis = showerAxisReal;
2766 const Vector eyeToCore = showerCore - eyePos;
2768 const double rp = sdp.
GetMag() * (upward ? -1 : 1);
2771 const Vector vertical(0, 0, 1, eyeCS);
2774 const double chi0 =
Angle(horizontalInSDP, showerAxis) - (upward ? 180*
deg : 0);
2776 const double distCoreEye = eyeToCore.
GetMag();
2777 const double beta =
Angle(-showerAxisReal, eyeToCore);
2779 - eyeTriggerTime).GetInterval()
2782 fdGeometry.SetAxis(T0, rp, chi0);
2785 FdGenShower& fdShower = fd.GetGenShower();
2790 showerCore, showerAxis, sdp));
2793 showerCore, showerAxis, sdp));
2809 const SEvent& sevent =
event.GetSEvent();
2822 double Rp = eyeRec.
GetRp();
2824 Vector eyeCoreVec = Rp / sin(
kPi - Chi0) * horizontal;
2825 eyeCoreVec.TransformTo(CS) ;
2829 Vector axis(rot*horizontal);
2836 double hottestSignal = 0;
2837 double hottestRho = 0;
2838 double hottestSDPdist = 0;
2841 if (!sditer->HasRecData())
2846 if (sditer->IsSilent())
2849 unsigned int thisStationId = sditer->GetId();
2855 Vector coreTankVec = eyeTankVec - eyeCoreVec;
2857 double tankProj = (coreTankVec * axis);
2858 Vector tankAxisVec = coreTankVec - (tankProj * axis);
2859 Vector tankInAxisVec = eyeCoreVec + tankProj * axis;
2860 double rho = tankAxisVec.
GetMag();
2864 double sdp_dist = SDP * eyeTankVec;
2869 for (
unsigned int k = 0; k < hybridStations.size(); ++k) {
2870 if (hybridStations[k]==thisStationId) {
2873 hottestId = thisStationId;
2874 hottestSignal = signal;
2875 hottestSDPdist = sdp_dist;
2878 if (signal>hottestSignal) {
2879 hottestSignal = signal;
2881 hottestSDPdist = sdp_dist;
2882 hottestId = thisStationId;
2891 if (nStations > 0) {
2892 theGeometry.SetNHybridStations(nStations);
2893 theGeometry.SetHottestStation(hottestId);
2894 theGeometry.SetStationAxisDistance(hottestRho);
2896 theGeometry.SetStationSDPDistance(hottestSDPdist);
2907 const double rp = geo->GetRp();
2908 const double chi0 = geo->GetChi0();
2909 const double t0 = geo->GetT0() / apLight->GetTimeBinning();
2911 apLight->SetXmaxAngle(chi0 - XmaxChi);
2913 const vector<double>& time = apLight->GetTime();
2922 const unsigned int nPoints = time.size();
2925 const double c = 0.299792458 * apLight->GetTimeBinning();
2928 for (
unsigned int i = 0; i < nPoints; ++i) {
2929 const double B = (time[i]-t0) * c/rp;
2930 const double chii = chi0 - atan(B)*2;
2931 const double angl = chi0 - chii;
2946 meanang /= (double)nPoints;
2950 apLight->SetMinAngle(minang);
2951 apLight->SetMaxAngle(maxang);
2952 apLight->SetMeanAngle(meanang);
2959 SdRecGeometry& sdGeom = theFd.GetSdRecGeometry();
2970 utl::Point eyePos = det::Detector::GetInstance().GetFDetector().GetEye(theEye).GetPosition();
2976 CoordinateSystemPtr eyeCS = det::Detector::GetInstance().GetFDetector().GetEye(theEye).GetEyeCoordinateSystem();
2987 const Vector vertical(0,0,1, eyeCS);
2990 double chi0 =
Angle(horizontalInSDP, showerAxis);
2991 double Rp =
Cross(showerAxis, (showerCore - eyePos)).
GetMag() / showerAxis.
GetMag();
2993 double distCoreEye = vecCoreEye.
GetMag();
2994 double beta =
Angle(-showerAxis, vecCoreEye);
2997 sdGeom.SetAxis(T0,Rp,chi0);
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
The Auger coordinate system (x to east, z local verical) for this eye.
double GetModelRelativeEfficiency(const double wl) const
AxialVector Cross(const Vector &l, const Vector &r)
Class to access station level reconstructed data.
double GetShapeParameter(const gh::EShapeParameter par) const
access to all variants of shape parameters (see GaisserHillasTypes.h)
unsigned int GetId() const
bool IsTimeOverThresholdDeconvoluted() const
Time Over Threshold deconvoluted.
void FillTimeFit(const fdet::Eye &dEye, const fevt::EyeRecData &eyeRec, FdRecGeometry &geo)
Trigger data for an fevt::Eye.
double GetThetaTCoreCorrelation() const
std::string GetT3Class() const
const utl::Vector & GetDirection() const
pointing direction of this pixel
double GetXZeroError() const
unsigned int GetNPoints() const
void FillEyeHeader(const fevt::Eye &eye, FDEvent &fd)
Top of the interface to Atmosphere information.
double GetChi0TZeroCorrelation() const
void FillViewingAngle(FdApertureLight *apLight, FdGeometry *geo, const double xMaxChi)
void IncreaseFdRecLevel(FDEvent &fdevent, EFdRecLevel reclevel)
StationIterator StationsEnd()
End of all stations.
bool HasLightFlux(const FdConstants::LightSource source=FdConstants::eTotal) const
Check that light profile for source /par source is present.
bool FillEyeApertureLight(const fdet::Eye &dEye, const fevt::Eye &eye, FDEvent &fd)
double ConvertXToChi(const double x, const fdet::Eye &detEye, const utl::Point &core, const utl::Vector &axis, const utl::Vector &sdp)
bool HasTotalEnergyError(const EUncertaintyType type=eTotal) const
double GetCorrelationShapeParameters() const
int GetPulseStop() const
pulse stop (to be defined)
double GetCorrelationXMaxShapeParameter(const gh::EShapeParameter par) const
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
const otoa::Status & Status() const
const utl::TimeStamp & GetTimeStamp() const
Get the TimeStamp of the absolute shower core-time.
double GetRpError() const
double GetCorrelationNMaxShapeParameter(const gh::EShapeParameter par) const
bool HasStation(const int stationId) const
Check whether station exists.
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
void InitSlantProfileModel(const utl::Point &core, const utl::Vector &dir, const double deltaX) const
Detector description interface for Station-related data.
atm::AttenuationResult EvaluateMieAttenuation(const utl::Point &xInit, const utl::Point &xFinal, const std::vector< double > &wLength) const
unsigned int GetT3NPixels() const
double GetRMS() const
Get the baseline RMS of the trace.
fevt::EyeHeader & GetHeader()
Header for this Eye Event.
bool HasPhotonTrace(const fevt::FdConstants::LightSource source, const int wl) const
Check that light trace for source /par source is present for the given wavelength bin...
Base class for all exceptions used in the auger offline code.
const std::vector< double > & GetWavelengths(const EmissionMode mode=eFluorescence) const
utl::Point CalculatePointOnShower(const utl::TimeStamp &timeAtTelescope, const utl::Point &telescopePosition) const
point on shower corresponding to a certain light arrival time at telescope
Fluorescence Detector Eye Event.
bool HasMultipleGHParameters() const
PhotonTraceIterator PhotonTracesEnd()
Last std::pair<int source, TraceD * trace>
Interface class to access to the SD Reconstruction of a Shower.
const utl::TabulatedFunctionErrors & GetTransmissionFactor() const
Transmission factor.
const atm::ProfileResult & EvaluateHeightVsSlantDepth() const
Table of height as a function of slant depth.
Detector description interface for GOES cloud data.
boost::filter_iterator< ComponentSelector, ConstAllEyeIterator > ConstEyeIterator
const std::vector< double > & GetPropagatedErrors() const
PixelIterator PulsedPixelsEnd()
const evt::VGaisserHillasParameter & GetGHParameters() const
Get the Gaisser-Hillas parameters of the shower.
double GetCalibrationConstant(const fevt::Pixel &evtpixel)
Fetches the calibration constant for the given pixel.
bool HasRecShower() const
double GetTotalEnergy() const
retrieve total energy and its uncertainty
const Pixel & GetPixel(const fevt::Pixel &eventPixel) const
Get fdet::Pixel from fevt::Channel.
Interface class to access to the SD part of an event.
double GetRpError() const
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
double GetChiZero() const
Class to hold and convert a point in geodetic coordinates.
double GetSDPFitChiSquare() const
Fluorescence Detector Pixel Trigger Data.
double GetNorthThetaCorrelation() const
void FillSDEye(const evt::Event &theEvent, const fevt::Eye &theEye, FDEvent &fd)
Class to access parameters that were fitted by more than one Gaisser-Hillas function.
int GetPulseStart() const
pulse start (to be defined)
unsigned int GetParentPhysicalEyeId() const
bool HasCloudFraction() const
ShowerRecData & GetRecShower()
double GetCentroidError() const
std::vector< unsigned short int > & GetStationIds()
retrieve vector of station IDs used in hybrid fit
unsigned int GetSDPFitNDof() const
double GetT3SDPTheta() const
bool HasSimShower() const
PixelTriggerData & GetTriggerData()
int GetThreshold() const
FLT threshold.
double GetBinning() const
size of one slot
unsigned int GetTimeFitNDof() const
bool DropUntriggeredMCProfiles() const
const atm::ProfileResult & EvaluateDistanceVsSlantDepth() const
Table of distance as a function of slant depth.
double GetRpTZeroCorrelation() const
sevt::StationRecData & GetRecData()
Get station level reconstructed data.
#define INFO(message)
Macro for logging informational messages.
double GetModelMinWavelength() const
PixelSimData & GetSimData()
Base class for exceptions trying to access non-existing components.
const Eye & GetEye(const unsigned int eyeId) const
Find eye by numerical Id.
Detector description interface for Eye-related data.
utl::TimeStamp GetPhotonsStartTime() const
Start Time of the photons trace.
unsigned int TimeStamp2HHMMSS(const utl::TimeStamp ×t)
Convert a TimeStamp into an integer representing the time as HHMMSS.
PixelIterator PulsedPixelsBegin()
unsigned int GetFirstTelescopeId() const
First telescope id in the eye.
double pow(const double x, const unsigned int i)
double GetT3SDPPhi() const
double GetNorthing() const
Get the northing.
AugerEvent & GetRawEvent()
double GetSDPPhiError() const
const Camera & GetCamera() const
Get the Camera object that belongs to the telescope.
double GetTZeroError() const
ShowerSRecData & GetSRecShower()
Report attempts to use invalid UTM zone.
Detector description interface for FDetector-related data.
double GetChiZeroError() const
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
A TimeStamp holds GPS second and nanosecond for some event.
boost::indirect_iterator< ConstInternalPixelIterator, const Pixel & > ConstPixelIterator
Const iterator over pixels used in reconstruction.
std::string GetFunctionTypeName(const EFunctionType type)
Exception for reporting variable out of valid range.
utl::Point GetPosition() const
Tank position.
double GetEastTCoreCorrelation() const
double GetPhiTCoreCorrelation() const
Interface class to access Shower Simulated parameters.
const atm::Atmosphere & GetAtmosphere() const
Criterion to sort stations by decreasing signal.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
std::map< int, bool > CalcMirrorTLTMap(const fevt::Eye &eye)
unsigned int GetId() const
void Set(const int iPar, const int jPar, const double corr)
double GetXFirst() const
Get depth of first interaction.
Description of simulated data for one Telescope.
void FillEyeSim(const evt::Event &event, FDEvent &fd)
utl::TabulatedFunctionErrors & GetLightFlux(const FdConstants::LightSource source=fevt::FdConstants::eTotal)
Light flux at diaphragm, photons/m^2 versus time in ns.
class to hold data at Station level
void FillSDP(const fdet::Eye &dEye, const fevt::EyeRecData &eyeRec, FdRecGeometry &geo)
utl::TraceD & GetPhotonTrace(const FdConstants::LightSource source=FdConstants::eTotal)
const GHFits & GetVirtualParameters() const
utl::CoordinateSystemPtr GetTelescopeCoordinateSystem() const
bool IsT1Threshold() const
T1 threshold.
const double & GetYErr(const unsigned int idx) const
Reference ellipsoids for UTM transformations.
PixelIterator SDPPixelsBegin()
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
utl::TimeStamp GetSignalStartTime() const
Start time of the signal.
const std::vector< PCGFData > & GetPCGF() const
LightSource
Possible light sources.
double GetHeight() const
Get the height.
bool HasLongitudinalProfile() const
std::map< int, std::string > CalcMirrorTLTLabelMap(const fevt::Eye &eye)
const utl::TimeStamp & GetT3Time() const
Fluorescence Detector Pixel event.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
double GetModelMaxWavelength() const
const GOESDB & GetGOESDB() const
low-level interface to the cloud information from the GOES database
utl::CoordinateSystemPtr GetEyeCoordinateSystem() const
Returns the Eye Coordinate system.
Class describing the Atmospheric profile.
TelescopeIterator TelescopesEnd()
first available tel of status eHasData (DEPRECATED)
utl::TimeInterval GetT_i() const
bool HasLightFlux(const FdConstants::LightSource source=FdConstants::eTotal) const
Check that light profile for source /par source is present.
TelescopeIterator TelescopesBegin() const
Beginning of the collection of telescopes.
bool IsLowGainSaturation() const
double GetXmaxError(const EUncertaintyType type=eTotal) const
retrieve Xmax uncertainties
const utl::TimeStamp & GetCoreTime() const
time when shower front passes through the core point
double abs(const SVector< n, T > &v)
double GetTotalSignal() const
Total integrated signal in VEM unit, averaged over pmts.
const utl::Point & GetPosition() const
Get the position of the shower core.
const Telescope & GetTelescope(const unsigned int telescopeId) const
Find Telescope by numerical Id.
atm::AttenuationResult EvaluateRayleighAttenuation(const utl::Point &xInit, const utl::Point &xFinal, const std::vector< double > &wLength) const
Compute Rayleigh attenuation between points.
Top of the hierarchy of the detector description interface.
bool HasFRecShower() const
Check if reconstructed shower info has been allocated.
evt::MultipleGaisserHillasParameters & GetMultipleGHParameters()
evt::ShowerFRecData & GetFRecShower()
Reconstructed shower info for this eye.
const sdet::SDetector & GetSDetector() const
EyeIterator EyesBegin(const ComponentSelector::Status status)
Triple PointToLatitudeLongitudeHeight(const Point &thePoint) const
Convert Point to Lat/Long/Height.
void FillFdRecStations(const evt::Event &event, const fevt::Eye &eye, FDEvent &adstFDEvent) const
void FillGeometricalUncertainties(const fdet::Eye &dEye, const fevt::Eye &eye, FDEvent &fd)
double GetMaximumCloudProbability(const utl::Point &pos1, const utl::Point &pos2) const
Get max. cloud probability along line of sight between pos1 and pos2.
virtual double Eval(const double depth) const =0
double GetChiZeroError() const
const CorrelationMatrix & GetPropagatedCorrelations() const
unsigned int GetId() const
Eye numerical Id.
utl::TraceD & GetPhotonTrace(const fevt::FdConstants::LightSource source, const int wl)
Photon trace at diaphragm.
boost::filter_iterator< ComponentSelector, ConstAllPixelIterator > ConstPixelIterator
double GetEasting() const
Get the easting.
const fdet::FDetector & GetFDetector() const
constexpr double kPiOnTwo
double GetSDPCorrThetaPhi() const
Telescope-specific shower reconstruction data.
utl::MultiTabulatedFunctionErrors & GetLightCollectionEfficiency()
Get the light-collection-efficiency multi tabulated function (for various LightSources) ...
double GetEastThetaCorrelation() const
const utl::Vector & GetAxis() const
double GetTotalEnergyError(const EUncertaintyType type=eTotal) const
unsigned int GetNPulsedPixels() const
Get number of pulsed pixels.
void SetPLDVersion(const std::string version)
A collection of TabulatedFunctionErrors, which provides methods to access different sources...
unsigned int TimeStamp2YYMMDD(const utl::TimeStamp ×t)
Convert a TimeStamp into an integer representing the date as YYMMDD.
#define WARNING(message)
Macro for logging warning messages.
double GetEmEnergy() const
retrieve electromagnetic energy and its uncertainty
bool HasTriggerData() const
TabulatedFunctionErrors & GetTabulatedFunctionErrors(const int label=0)
Returns the TabulatedFunctionErrors for /par source.
bool IsT2Threshold() const
T2 threshold.
bool FillEnergy(const fdet::Eye &dEye, const fevt::Eye &eye, FDEvent &fd)
double GetRpChi0Correlation() const
double GetNorthTCoreCorrelation() const
double Get(const int iPar, const int jPar) const
double GetTotalSignalError() const
double LinearProfileFitChiSquare(const FdRecShower &recShower)
Calculates the chi2 of a linear fit to the fd profile.
Status
Possible component status.
const double & GetXErr(const unsigned int idx) const
double GetNorthPhiCorrelation() const
Eye-specific shower reconstruction data.
AxialVector Normalized(const AxialVector &v)
Gaisser Hillas with 4 parameters.
Base class for inconsistency/illogicality exceptions.
double GetEmEnergyError(const EUncertaintyType type=eTotal) const
bool HasDistanceTrace() const
Check that trace for the distance along the shower axis is present.
TelescopeIterator TelescopesBegin()
first available tel of status eHasData (DEPRECATED)
unsigned int GetEyeId() const
double GetThetaPhiCorrelation() const
const double & GetY(const unsigned int idx) const
Station & GetStation(const int stationId)
retrieve station by id throw utl::NonExistentComponentException if n.a.
bool HasLightCollectionEfficiency() const
Check that a light-collection-efficiency multi tabulated function exists (for various LightSources) ...
double GetTimeFitChiSquare() const
double GetInterval() const
Get the time interval as a double (in Auger base units)
void FillFdCoreAxis(const fdet::Eye &dEye, const fevt::Eye &eye, FDEvent &fd)
const utl::AxialVector & GetSDP() const
double GetTimeFitChiSquare() const
unsigned int GetTelescopeId() const
fevt::FEvent & GetFEvent()
bool IsMultiplicityOfPositiveSteps() const
const evt::Event & GetEvent() const
Returns the current evt::Event. Use only in dire need (otherwise pass things as arguments) ...
ArrayIterator YBegin()
begin of array of Y
void FillEye(const fevt::Eye &eye, FDEvent &fd)
unsigned int GetNTimeFitPixels() const
Get number of Time Fit pixels.
int GetPLDTimeOffset() const
bool StoreMCTraces() const
double GetRpChi0Correlation() const
bool UsingMieAttenuationDatabase()
Returns whether the Mie DB was used for the current event (i.e. current Detector...?)
bool HasGHParameters() const
bool IsTimeOverThreshold() const
T1 TOT is always promoted to T2 TOT.
bool HasEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
void FillAtmosphericProfileVars(const fdet::Eye &dEye, const fevt::Eye &eye, FDEvent &fd)
const otoa::Config & Config() const
double GetChi2Improvement() const
Gives back a value that stores the usefulness of the new fit.
read in ADST, let user do stuff, and write out a modfied one
double GetY(const CoordinateSystemPtr &coordinateSystem) const
constexpr double kSpeedOfLight
float GetCloudFraction() const
how much of pixel is obscured by clouds
void SetUseBGLoop(const bool use)
Detector description interface for Telescope-related data.
A TimeInterval is used to represent time elapsed between two events.
double MinX() const
Return the minimum value for X (ordinate) stored in the profile.
const Telescope & GetTelescope(const fevt::Telescope &eventTel) const
Get fdet::Telescope from fevt::Telescope.
ArrayIterator YErrBegin()
begin of array of errors Y
utl::TabulatedFunctionErrors & GetLongitudinalProfile()
retrieve longitudinal profile information (size vs depth)
unsigned long GetGPSSecond() const
GPS second.
Report problems in UTM handling.
bool FillFdProfile(const fdet::Eye &dEye, const fevt::Eye &eye, FDEvent &fd)
bool HasRecData() const
Check whether station reconstructed data exists.
void FillCloudsBetweenEyeAndShower(const fevt::Eye &eye, FDEvent &fd) const
bool IsSaturationRecovered() const
constexpr double kLambdaGH
double GetGPSNanoSecond() const
GPS nanosecond.
double ShowerAge(const double slantDepth, const double showerMax)
General definition of shower age.
bool IsRDThreshold() const
PhotonTraceIterator PhotonTracesBegin()
First std::pair<int source, TraceD * trace>
bool HasXmaxError(const EUncertaintyType type=eTotal) const
Station Trigger Data description
bool UsingGDASProfileDatabase()
Returns whether GDAS data was used for the current event (i.e. current Detector...?)
StationIterator StationsBegin()
Beginning of all stations.
unsigned int GetTimeFitNDof() const
double GetEastPhiCorrelation() const
double GetTotalCharge() const
integrated pulse charge
bool HasGHParameters() const
Check initialization of the Gaisser-Hillas parameters.
unsigned int GetAxisFitNDof() const
bool FillGaisserHillas(const fdet::Eye &dEye, const fevt::Eye &eye, FDEvent &fd)
utl::Point GetPosition() const
PixelIterator TimeFitPixelsEnd()
bool FillTelSimData(const fevt::Eye &theEye, FDEvent &fd)
Interface class for access to the Gaisser-Hillas parameters.
execption handling for calculation/access for inclined atmosphere model
Fluorescence emission model.
const double & GetX(const unsigned int idx) const
unsigned int GetLastTelescopeId() const
Last telescope id in the eye.
Interface class to access to Fluorescence reconstruction of a Shower.
Detector description interface for SDetector-related data.
double CosAngle(const Vector &l, const Vector &r)
double GetChi0TZeroCorrelation() const
const utl::Point & GetCorePosition() const
utl::TimeInterval GetT_iError() const
fevt::EyeTriggerData & GetTriggerData()
Trigger data for this eye.
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
const atm::ProfileResult & EvaluateHeightVsDepth() const
Tabulated function giving Y=height as a function of X=depth.
void FillFOVVariables(const fevt::FEvent &fEvent, RecEvent &recEvent)
ArrayIterator YEnd()
end of array of Y
PixelIterator SDPPixelsEnd()
void Convert(const evt::Event &event, RecEvent &recEvent)
TVector3 ToTVector3(const T &v, const utl::CoordinateSystemPtr &cs, const double unit=1)
utl::TabulatedFunctionErrors & GetLightFlux(const FdConstants::LightSource source=fevt::FdConstants::eTotal)
Light flux at diaphragm, photons/m^2 versus time in ns.
void FillCelestialCoordinates(RecShower &recShower)
double GetShapeParameterError(const gh::EShapeParameter par) const
bool IsHighGainSaturation() const
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
gh::EFunctionType GetFunctionType() const
double GetChiZero() const
Gaisser Hillas with 4 parameters.
const Station & GetStation(const int stationId) const
Get station by Station Id.
double Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
void LinearFit(const vector< double > &x, const vector< double > &y, const vector< double > &ey, double &a0, double &a1, double &chi2)
Do a linear fit and return coefficients and chi2.
double GetNanoSecond() const
Get integer number of nanoseconds past seconds boundary.
double GetCentroid() const
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
void FillTelRecData(const fevt::Eye &theEye, FDEvent &fd)
unsigned int GetNSDPPixels() const
Get number of SDP pixels.
void FillRecPixel(const fevt::Eye &eye, FDEvent &fd)
unsigned long long CalcMirrorsInEventBitField(const fevt::Eye &eye)
void FillCloudCameraDataBrief(const fevt::Eye &eye, FDEvent &fd)
const utl::AxialVector & GetSDP() const
PixelIterator TimeFitPixelsBegin()
#define ERROR(message)
Macro for logging error messages.
void FillHybridStations(const evt::Event &event, const fevt::Eye &eye, FdRecGeometry &geo)
const utl::Point & GetCorePosition() const
Shower core as reconstructed by the FD or FD eye.
std::string GetPLDVersion() const
bool HasSRecShower() const
sevt::SEvent & GetSEvent()
Fluorescence Detector Pixel Reconstructed Data.
atm::CloudResult EvaluateCloudCoverage(const fdet::Pixel &pix, const utl::Point &x) const
double GetTZeroError() const
Gaisser-Hillas with 6 parameters (CORSIKA)
boost::filter_iterator< ComponentSelector, ConstAllTelescopeIterator > ConstTelescopeIterator
const std::string & GetMessage() const
Retrieve the message from the exception.
bool HasEnergyDeposit() const
utl::Point GetPosition() const
Eye position.
bool HasLabel(const int label) const
ArrayIterator YErrEnd()
end of array of errors Y
PixelRecData & GetRecData()
int GetSLTTriggerBin() const
Class describing the Atmospheric attenuation.
double MaxX() const
Return the maximum value for X (ordinate) stored in the profile.
utl::TraceD & GetDistanceTrace()
Trace for the distance along the shower axis of the light at the diaphragm.
Converts an Offline event to ADST.
const utl::TimeStamp & GetCoreTime() const
time when shower front passes through the core point
utl::TabulatedFunctionErrors & GetEnergyDeposit()
retrieve dE/dX
double GetNorthEastCorrelation() const
double TimeStamp2MoonCycle(const utl::TimeStamp ×t)
Convert a TimeStamp into a fractional mooncycle since 2004/01/07.
double GetAxisFitChiSquare() const
fevt::EyeRecData & GetRecData()
Reconstructed data for this eye.
double GetT3AzimuthAtGround() const
double GetRpTZeroCorrelation() const
float GetCoverage() const
double GetSDTimeResidual() const
void FillPCGFit(const fdet::Eye &dEye, const fevt::EyeRecData &eyeRec, FdRecGeometry &geo)
bool HasTriggerData() const
Represents the status of a single event conversion.
double GetSDPThetaError() const
const utl::Vector & GetAxis() const
Shower Axis as reconstructed by the FD or FD eye.
std::map< UShort_t, Int_t > CalcMirrorTimeOffsetMap(const fevt::Eye &eye)