4 #include <utl/ErrorLogger.h>
5 #include <utl/AugerUnits.h>
6 #include <utl/MathConstants.h>
7 #include <utl/PhysicalConstants.h>
8 #include <utl/TimeStamp.h>
9 #include <utl/UTCDateTime.h>
10 #include <utl/Point.h>
11 #include <utl/Plane.h>
13 #include <utl/GeometryUtilities.h>
14 #include <utl/UTMPoint.h>
15 #include <utl/Vector.h>
16 #include <utl/RandomSamplerFromPDF.h>
17 #include <utl/RandomEngine.h>
18 #include <utl/TabulatedFunction.h>
19 #include <utl/Branch.h>
20 #include <utl/AugerException.h>
22 #include <fwk/CoordinateSystemRegistry.h>
23 #include <fwk/RandomEngineRegistry.h>
24 #include <fwk/CentralConfig.h>
26 #include <evt/Event.h>
27 #include <evt/ShowerSimData.h>
28 #include <evt/DefaultShowerGeometryProducer.h>
30 #include <det/Detector.h>
32 #include <sdet/SDetector.h>
34 #include <CLHEP/Evaluator/Evaluator.h>
40 #include <boost/lexical_cast.hpp>
51 using namespace ShowerInventorNS;
54 ShowerInventor::ShowerInventor() :
61 fRandomCacheMaxSize(5e6),
62 fDiagnosticsOn(false),
63 fDiagnosticsFileName(
"")
70 INFO(
"ShowerInventor::Init()");
79 genAtts[
"generate"] =
"yes";
109 boost::lexical_cast<
int>(aM.find(
"type")->second);
112 boost::lexical_cast<
unsigned int>(aM.find(
"number")->second);
138 const unsigned int posBins = 150;
139 const double posMin = -15;
140 const double posMax = 15;
145 string pType = boost::lexical_cast<
string>(dIt->particleType);
152 string radialTitle =
"radial distribution (km), particle type " + pType;
157 string azimuthTitle =
"azimuthal distribution, particle type " + pType;
158 histos.azimuthDistro =
new TH1F(azimuthTitle.c_str(),
159 azimuthTitle.c_str(),
162 string timeTitle =
"time distribution (ns), particle type " + pType;
163 histos.timeDistro =
new TH1F(timeTitle.c_str(),
167 string weightTitle =
"weight distribution, particle type " + pType;
168 histos.weightDistro =
new TH1F(weightTitle.c_str(),
172 string positionsShowerCSTitle =
"particle positions, shower CS";
173 histos.positionsShowerCS =
new TH2F(positionsShowerCSTitle.c_str(),
174 positionsShowerCSTitle.c_str(),
175 posBins, posMin, posMax,
176 posBins, posMin, posMax);
178 string positionsGroundCSTitle =
"particle positions, ground CS";
179 histos.positionsGroundCS =
new TH2F(positionsGroundCSTitle.c_str(),
180 positionsGroundCSTitle.c_str(),
181 posBins, posMin, posMax,
182 posBins, posMin, posMax);
188 string stationPosGroundCSTitle =
"station positions, ground CS";
190 stationPosGroundCSTitle.c_str(),
191 posBins, posMin, posMax,
192 posBins, posMin, posMax);
213 det::Detector::GetInstance().Update(tEvt);
279 &RandomEngineRegistry::GetInstance().
280 Get(RandomEngineRegistry::eDetector).GetEngine();
294 const SDetector& sDet = Detector::GetInstance().GetSDetector();
311 INFO(
"ShowerInventor::Finish()");
319 delete it->radialDistro;
320 delete it->azimuthDistro;
321 delete it->timeDistro;
322 delete it->weightDistro;
333 dIt->second.radialDistro->Write();
334 dIt->second.azimuthDistro->Write();
335 dIt->second.timeDistro->Write();
336 dIt->second.weightDistro->Write();
337 dIt->second.positionsShowerCS->Write();
338 dIt->second.positionsGroundCS->Write();
342 diagnosticsFile.cd();
343 diagnosticsFile.Close();
369 const double y1 = r * sin(phi);
371 const double showerAzimuth =
fAzimuth;
372 const double sinShowerAzimuth = sin(-showerAzimuth);
373 const double cosShowerAzimuth = cos(-showerAzimuth);
377 particleDirection(-1, 0, 0,
fShowerCS, Vector::kSpherical);
380 particlePosition( cosShowerAzimuth * x1 + sinShowerAzimuth * y1,
381 -sinShowerAzimuth * x1 + cosShowerAzimuth * y1,
444 vector<double> xValues;
446 vector<double> yValues;
460 throw XMLParseException(
"No RandomSampler corresponds to the specifications in the configuration file.");
std::vector< double > RandomCacheContainer
Branch GetTopBranch() const
utl::VRandomSampler * GetSampler(const utl::Branch &b)
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger coordinate system associated to the shower core position.
double Plane(const utl::Point &point, const utl::Vector &normal, const utl::Photon &photonIn, utl::Photon &photonOut)
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
Report success to RunController.
utl::Particle * fCurrentParticle
utl::Point * fCoreLocation
utl::Particle * GetOneParticle()
unsigned int fCurrentDistIndex
StationIterator AllStationsEnd() const
End of the collection of pointers to all stations in the history of the array.
Describes a particle for Simulation.
RandomCacheContainer * timeRandomCache
Class to hold and convert a point in geodetic coordinates.
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
Class to hold collection (x,y) points and provide interpolation between them.
bool HasGroundParticles() const
bool HasSimShower() const
std::map< std::string, std::string > AttributeMap
utl::VRandomSampler * timeDistro
unsigned int fRandomCacheMaxSize
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.
utl::CoordinateSystemPtr fShowerLocalCS
ParticleDistInfo fCurrentPDI
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Exception for errors encountered when parsing XML.
A TimeStamp holds GPS second and nanosecond for some event.
void SetFileInterface(VShowerFileParticleIterator *const interface)
StationIterator AllStationsBegin() const
Beginning of the collection of pointers to all stations in the history of the array.
Interface class to access Shower Simulated parameters.
unsigned int fCurrentZenithIndex
unsigned int numGeneratedParticles
Branch GetNextSibling() const
Get next sibling of this branch.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class representing a document branch.
Break current loop. It works for nested loops too!
Reference ellipsoids for UTM transformations.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
constexpr double nanosecond
std::string fDiagnosticsFileName
utl::VRandomSampler * radialDistro
ShowerSimData & GetSimShower()
unsigned int fTotalNumRequestedParticles
utl::RandomEngine::RandomEngineType * fRandomEngine
utl::ShowerParticleList & GetGroundParticles()
Get particle list Proxy.
const CoordinateSystemPtr GetECEF() const
Get the ECEF.
utl::VRandomSampler * weightDistro
void GetData(bool &b) const
Overloads of the GetData member template function.
void MakeGroundParticles()
Iterator that generates particles "on-the-fly" . This uses the machinery in ShowerInventor to fetch p...
unsigned int cachePosition
double GetY(const CoordinateSystemPtr &coordinateSystem) const
std::vector< ParticleDistInfo > fParticleDistros
void SetPrimaryParticle(const int type)
Set the type of the shower primary particle.
A TimeInterval is used to represent time elapsed between two events.
unsigned int numRequestedParticles
utl::CoordinateSystemPtr fShowerCS
ResultFlag
Flag returned by module methods to the RunController.
TH2 * fStationPosGroundCS
void SetGroundParticleCoordinateSystemZenith(const double zenith)
Set the zenith angle of the shower. Room angle between z-axis and direction from where the shower is ...
bool HasGeometry() const
check initialization of shower geometry
void MakeGeometry(const utl::Point &pointOnShowerAxis)
initialize the shower geometry. Pos is a point on the shower axis, but not necessarily the core ...
constexpr double kilometer
void MakeSimShower(const evt::VShowerGeometryProducer &p)
utl::Plane * fGroundPlane
Detector description interface for SDetector-related data.
bool HasTimeStamp() const
Check initialization of the TimeStamp.
void MakeTimeStamp(const utl::TimeStamp &ts)
Make the TimeStamp of the shower.
RandomCacheContainer * radiusRandomCache
evt::Event * fCurrentEvent
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
Branch GetFirstChild() const
Get first child of this Branch.
utl::VRandomSampler * azimuthDistro
std::map< int, DiagnosticHistos > fDiagnosticHistos
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
Point GetPoint(const CoordinateSystemPtr &theCS=CoordinateSystemPtr()) const
Get a cartesian point from an UTMPoint.
std::vector< double > fZeniths
TimeStamp GetTimeStamp() const
RandomCacheContainer * weightRandomCache
Class to shoot random numbers given by a user-defined distribution function.
utl::CoordinateSystemPtr GetShowerCoordinateSystem() const
ShowerInventorParticleIterator * fFileIterator
RandomCacheContainer * azimuthRandomCache