8 #include <utl/config.h>
12 #include <fwk/CentralConfig.h>
13 #include <fwk/RandomEngineRegistry.h>
15 #include <det/Detector.h>
17 #include <evt/Event.h>
18 #include <evt/Header.h>
19 #include <evt/ShowerSimData.h>
21 #include <sevt/SEvent.h>
22 #include <sevt/Header.h>
24 #include <fevt/FEvent.h>
25 #include <fevt/Header.h>
27 #include <fevt/Telescope.h>
29 #include <utl/AugerCoordinateSystem.h>
30 #include <utl/AugerUnits.h>
31 #include <utl/CoordinateSystem.h>
32 #include <utl/ErrorLogger.h>
33 #include <utl/RandomEngine.h>
34 #include <utl/Reader.h>
35 #include <utl/UTMPoint.h>
36 #include <utl/Vector.h>
37 #include <utl/Point.h>
39 #include <sdet/SDetector.h>
41 #include <fdet/FDetector.h>
43 #include <fdet/Telescope.h>
45 #include <CLHEP/Random/RandFlat.h>
55 using CLHEP::RandFlat;
71 fSampleAzimuth =
true;
84 if (fZenithMin < 0 || fZenithMax < fZenithMin) {
86 err <<
"inconsistent zenith range: zenithMin = "
87 << fZenithMin /
degree <<
", zenithMax = " << fZenithMax /
degree;
91 if (fNcos != 0 && (fZenithMin <= 90*
degree) != (fZenithMax <= 90*
degree)) {
93 err <<
"Zenith range can be only down or up going in n_cos > 0: n_cos = " << fNcos <<
", "
94 "zenithMin = " << fZenithMin /
degree <<
", zenithMax = " << fZenithMax /
degree;
98 if (fNcos != 0 && fNcos != 1 && fZenithMin > 90*
degree) {
100 err <<
"n_cos must be 0 or 1 for up-going: n_cos = " << fNcos <<
", "
101 "zenithMin = " << fZenithMin /
degree <<
", zenithMax = " << fZenithMax /
degree;
107 fRandomEngine = &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector);
119 ERROR(
"Nothing to do. Shower already has a direction. Check your ModuleSequence!");
125 if (fSampleAzimuth) {
126 const double azimuth = GetPhi();
128 info <<
" set azimuth=" << azimuth/
deg <<
" deg ";
132 const double zenith = GetTheta();
134 info <<
" set zenith=" << zenith/
deg <<
" deg ";
143 GeometryGenerator::Finish()
153 GeometryGenerator::GetTheta()
155 if (fZenithMin == fZenithMax)
158 const auto n1 = fNcos + 1;
159 const double t1 =
pow(cos(fZenithMax), n1);
160 const double t2 =
pow(cos(fZenithMin), n1);
162 const double c = RandFlat::shoot(&fRandomEngine->GetEngine(), t1, t2);
167 else if (fNcos == 1) {
168 if (fZenithMin > 90*
degree)
169 theta = acos(-
sqrt(c));
171 theta = acos(
sqrt(c));
173 theta = acos(exp(log(c) / n1));
182 GeometryGenerator::GetPhi()
184 if (fAzimuthMax == fAzimuthMin)
187 return RandFlat::shoot(&fRandomEngine->GetEngine(), fAzimuthMin, fAzimuthMax);
bool HasDirection() const
Check initialization of shower geometry.
void SetGroundParticleCoordinateSystemAzimuth(const double azimuth)
Set the azimuth angle of the shower. Angle in x-y plane wrt. to the x axis (0 is from east)...
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
double pow(const double x, const unsigned int i)
Interface class to access Shower Simulated parameters.
Class representing a document branch.
void GetData(bool &b) const
Overloads of the GetData member template function.
ResultFlag
Flag returned by module methods to the RunController.
void SetGroundParticleCoordinateSystemZenith(const double zenith)
Set the zenith angle of the shower. Room angle between z-axis and direction from where the shower is ...
Main configuration utility.
#define ERROR(message)
Macro for logging error messages.
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)