1 #include <utl/config.h>
5 #include <det/Detector.h>
7 #include <sdet/SDetector.h>
8 #include <sdet/Station.h>
10 #include <evt/Event.h>
12 #include <fwk/CentralConfig.h>
13 #include <fwk/RandomEngineRegistry.h>
15 #include <sevt/SEvent.h>
16 #include <sevt/Station.h>
17 #include <sevt/StationSimData.h>
18 #include <sevt/Header.h>
20 #include <utl/AugerCoordinateSystem.h>
21 #include <utl/AugerUnits.h>
22 #include <utl/MathConstants.h>
23 #include <utl/Particle.h>
24 #include <utl/PhysicalConstants.h>
25 #include <utl/Point.h>
26 #include <utl/TimeStamp.h>
27 #include <utl/ErrorLogger.h>
28 #include <utl/RandomEngine.h>
29 #include <utl/Reader.h>
30 #include <utl/Vector.h>
32 #include <CLHEP/Random/Randomize.h>
43 using namespace ParticleInjectorOG;
52 using CLHEP::RandFlat;
63 fUseSingleTank(false),
64 fUseDiscreteDirection(true),
65 fUseDiscreteSpectrum(true),
66 fUseInjectAllParticles(false),
67 fUseSinglePosition(false),
68 fUseDiscreteTime(true),
69 fNumberOfParticles(0),
71 fX(0.0), fY(0.0), fZ(0.0),
78 fContinuousZenithDistribution(NULL),
79 fContinuousAzimuthDistribution(NULL),
82 fElectronSpectrum(NULL),
83 fPhotonSpectrum(NULL),
84 fMuonEnergyMin(0.0), fMuonEnergyMax(0.0),
85 fElectronEnergyMin(0.0), fElectronEnergyMax(0.0),
86 fPhotonEnergyMin(0.0), fPhotonEnergyMax(0.0),
87 fMuonSpectrumMax(0.0), fElectronSpectrumMax(0.0), fPhotonSpectrumMax(0.0),
90 fCurrentDetectorStation(NULL), fSEvent(NULL)
111 CentralConfig::GetInstance()->
GetTopBranch(
"ParticleInjector");
223 fRandomEngine = &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector);
233 ERROR(
"No SEvent present. Use EventGenerator module to create "
234 "an event before running ParticleInjector.");
241 det::Detector::GetInstance().GetSDetector();
303 const Point position(x, y, z, cs);
305 const double sinZenith = sin(zenith);
306 const double pX = -sinZenith*cos(azimuth);
307 const double pY = -sinZenith*sin(azimuth);
308 const double pZ = -cos(zenith);
310 const Vector direction(pX, pY, pZ, cs);
323 position, direction, time, 1, energy);
342 while (index >= num);
363 while (index >= num);
403 INFO(
"Unknown particle type used for spectrum injection in ParticleInjector.");
420 while (index >= num);
446 if (fabs(theta) >= atan2(radius, height)) {
450 z = radius*cos(theta);
457 x = height*tan(theta)*cos(phi);
458 y = height*tan(theta)*sin(phi);
470 std::vector<double>& energy,
473 if (flux.size() != energy.size()) {
474 INFO(
"Flux and energy array sizes not equal!");
477 INFO(
"Non-positive maximum value for flux given.");
481 const unsigned int num = flux.size();
487 while (index >= num ||
490 return energy[index];
Branch GetTopBranch() const
double fElectronSpectrumMax
std::vector< double > fDiscreteElectronEnergy
bool fUseDiscreteSpectrum
TF1 * fContinuousAzimuthDistribution
bool HasStation(const int stationId) const
Check whether station exists.
Report success to RunController.
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
double fElectronEnergyMax
void MakeSimData()
Make station simulated data object.
static utl::Particle::Type spectrumParticles[5]
RandomEngineType & GetEngine()
Describes a particle for Simulation.
unsigned int fNumberOfParticles
fwk::VModule::ResultFlag Run(evt::Event &theEvent)
Run: invoked once per event.
#define INFO(message)
Macro for logging informational messages.
double fPhotonSpectrumMax
std::string fMuonSpectrumString
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
double fElectronEnergyMin
virtual ~ParticleInjector()
std::vector< double > fDiscreteAzimuth
std::string fContinuousZenithString
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
utl::RandomEngine * fRandomEngine
Class representing a document branch.
class to hold data at Station level
bool HasSimData() const
Check whether station simulated data exists.
utl::Particle::Type fParticleType
StationIterator StationsEnd() const
End of the collection of pointers to commissioned stations.
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger reference system centered on the tank.
double GetRadius() const
Radius of the tank (water only)
double GetHeight() const
Height of the tank (water only)
unsigned int fSingleTankID
StationIterator StationsBegin() const
Beginning of the collection of pointers to commissioned stations.
std::string fElectronSpectrumString
void MakeStation(const int stationId)
make a station with specifying Id, throw if invalid stationId
void AddParticle(const utl::Particle &particle)
bool fUseInjectAllParticles
void GetData(bool &b) const
Overloads of the GetData member template function.
std::vector< double > fDiscreteZenith
Station & GetStation(const int stationId)
retrieve station by id throw utl::NonExistentComponentException if n.a.
bool fUseDiscreteDirection
double GetDiscreteEnergy(std::vector< double > &flux, std::vector< double > &energy, double max)
std::vector< double > fDiscreteMuonFlux
A TimeInterval is used to represent time elapsed between two events.
ResultFlag
Flag returned by module methods to the RunController.
std::vector< double > fDiscretePhotonFlux
Detector description interface for SDetector-related data.
Report failure to RunController, causing RunController to terminate execution.
std::vector< double > fDiscreteMuonEnergy
void SetPosition(double &x, double &y, double &z)
std::vector< double > fDiscretePhotonEnergy
const sdet::Station * fCurrentDetectorStation
const Station & GetStation(const int stationId) const
Get station by Station Id.
std::string fPhotonSpectrumString
int GetId() const
Station ID.
#define ERROR(message)
Macro for logging error messages.
std::vector< double > fDiscreteParticleTime
TF1 * fContinuousZenithDistribution
sevt::SEvent & GetSEvent()
std::string fContinuousAzimuthString
std::vector< double > fDiscreteElectronFlux