1 #include <io/CorsikaShowerFileGeometryProducer.h>
3 #include <io/RawCorsikaFile.h>
4 #include <io/CorsikaBlock.h>
5 #include <io/CorsikaIOException.h>
6 #include <io/CorsikaUtilities.h>
8 #include <utl/ErrorLogger.h>
9 #include <utl/AugerUnits.h>
10 #include <utl/CoordinateSystem.h>
11 #include <utl/CoordinateSystemPtr.h>
12 #include <utl/ReferenceEllipsoid.h>
13 #include <utl/UTMPoint.h>
14 #include <utl/Point.h>
16 #include <utl/Vector.h>
17 #include <utl/GeometryUtilities.h>
19 #include <det/Detector.h>
21 #include <fwk/LocalCoordinateSystem.h>
22 #include <fwk/MagneticFieldModel.h>
34 const double corsikaAzimuth,
35 const double obsLevelHeight,
38 const double corsikaRotation,
39 const bool correctForRealisticMagneticFieldDeclination) :
40 fCORSIKAZenith(corsikaZenith),
41 fCORSIKAAzimuth(corsikaAzimuth),
42 fObsLevelHeight(obsLevelHeight),
43 fHasMultiCore(multiCore),
45 fCoordinateRotation(corsikaRotation),
46 fCorrectForRealisticMagneticFieldDeclination(correctForRealisticMagneticFieldDeclination)
90 static bool showThisMessageOnlyOnce =
true;
99 north = det::Detector::GetInstance().GetGeoMagneticField().GetDeclination(anyPointOnShowerAxis);
101 info <<
"Magnetic field declination: " << north/
utl::degree <<
" deg";
121 const Vector direction(-cos(augerAzimuth)*sinZenith,
122 -sin(augerAzimuth)*sinZenith,
125 const vector<Point> intersections =
128 Line(anyPointOnShowerAxis, direction));
131 const UTMPoint theUTMPoint(anyPointOnShowerAxis, ReferenceEllipsoid::eWGS84);
132 const double altitude = theUTMPoint.
GetHeight();
134 inf <<
"Observation level height: " <<
fObsLevelHeight/
m <<
" m, Offline core height: " << altitude/
m <<
" m";
138 if (intersections.empty()) {
139 WARNING(
"Shower does not intersect observation level.");
147 for (
const auto& inter : intersections) {
148 const Vector coreToPoint = inter - anyPointOnShowerAxis;
149 const double dist = coreToPoint.
GetMag();
152 toPlane = coreToPoint;
154 }
else if (dist < closest) {
156 toPlane = coreToPoint;
160 if (showThisMessageOnlyOnce) {
162 inf <<
"CORSIKA particle ground plane is displaced by " << (toPlane*direction)/
m <<
"m "
163 "along shower axis with respect to Offline ground level.";
165 showThisMessageOnlyOnce =
false;
180 coreCS = CoordinateSystem::Translation(shift,
fRefCS);
182 if (showThisMessageOnlyOnce) {
184 inf <<
"CORSIKA particle ground plane is rotated by "
186 "in zenith with respect to Offline ground level.";
188 showThisMessageOnlyOnce =
false;
201 inf <<
"Rotation (around z axis) between Auger CS and Corsika CS: " << angle /
deg <<
" deg.";
204 return particlePlaneCS;
double fCoordinateRotation
double Angle(const double theta1, const double phi1, const double theta2, const double phi2)
Class to hold and convert a point in geodetic coordinates.
#define INFO(message)
Macro for logging informational messages.
bool fCorrectForRealisticMagneticFieldDeclination
Line Intersection(const Plane &p1, const Plane &p2)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
double GetHeight() const
Get the height.
double CorsikaAzimuthToAuger(const double corsikaAzimuth, const double magneticFieldDeclination)
Returns the azimuth rotated from Corisika's system to Auger standard.
#define WARNING(message)
Macro for logging warning messages.
CorsikaShowerFileGeometryProducer()=default
virtual utl::CoordinateSystemPtr MakeGroundParticleCoordinateSystem(const utl::Point &anyPointOnShowerAxis)
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
utl::CoordinateSystemPtr fRefCS