4 #include <utl/config.h>
6 #include <det/Detector.h>
8 #include <sdet/SDetector.h>
9 #include <sdet/Station.h>
11 #include <evt/Event.h>
14 #include <fwk/CentralConfig.h>
15 #include <fwk/RandomEngineRegistry.h>
16 #include <io/CorsikaUtilities.h>
18 #include <sevt/SEvent.h>
19 #include <sevt/Header.h>
20 #include <sevt/Station.h>
21 #include <sevt/StationSimData.h>
23 #include <utl/AugerCoordinateSystem.h>
24 #include <utl/AugerUnits.h>
26 #include <utl/MathConstants.h>
27 #include <utl/Particle.h>
28 #include <utl/PhysicalConstants.h>
29 #include <utl/Point.h>
30 #include <utl/TimeStamp.h>
31 #include <utl/ErrorLogger.h>
32 #include <utl/Reader.h>
33 #include <utl/Vector.h>
34 #include <utl/GeometryUtilities.h>
35 #include <utl/MathConstants.h>
37 #include <CLHEP/Random/Randomize.h>
46 using namespace utl::GeometryUtilities;
48 using CLHEP::RandFlat;
49 using namespace LEInjectorOG;
52 LEInjector::LEInjector() :
55 fVerticalMuonMode(false),
65 CentralConfig::GetInstance()->
GetTopBranch(
"LEInjector");
72 INFO(
"Operating LE Injector in vertical muon mode!");
76 &RandomEngineRegistry::GetInstance().
77 Get(RandomEngineRegistry::eDetector).GetEngine();
82 msg <<
"Unable to open the requested file : " <<
fFileName;
93 INFO(
"LEInjector::Run");
95 ERROR(
"No Event. giving up");
100 SEvent& sEvent =
event.GetSEvent();
113 det::Detector::GetInstance().GetSDetector().GetStation(station);
123 unsigned primaryShowerId;
124 int primaryParticleId;
125 double primaryEnergy;
138 istringstream iss(line);
140 if (!(iss >> particleId
149 ERROR(
"Malformed line.");
153 }
while (particleId == 201 || particleId == 301 || particleId == 402);
161 primaryEnergy *=
GeV;
166 double pTheta = acos(-pz / pMomentum);
167 double pPhi = atan2(-py, -px);
182 const double sRadius = 1800*
mm + 13*
mm;
183 const double sHeight = 1500*mm + 10*mm + .6*mm + 5*mm + 50*
mm;
186 double scinLength = 1800*
mm;
188 double barWidth = 80*
mm;
189 double scinWidth = nScinBars*barWidth;
216 const double x = scinLength/2 * RandFlat::shoot(
fRandomEngine, -1, 1);
217 const double y = scinWidth/2 * RandFlat::shoot(
fRandomEngine, -1, 1);
219 const Point position =
Point(x, y, sHeight, stationCS);
220 const Vector momentum =
Vector(0, 0, -1*
GeV, stationCS, Vector::kCartesian);
231 const double EffTopArea =
kPi*
Sqr(sRadius)*cos(pTheta);
232 const double EffSideArea = 2*sRadius*sHeight*sin(pTheta);
233 const double ProbSeeTop = EffTopArea / (EffTopArea + EffSideArea);
238 if (rand1 <= ProbSeeTop) {
241 const double r = sRadius*
sqrt(rand2);
244 const double x = r * cos(phi);
245 const double y = r * sin(phi);
246 const double z = sHeight;
248 const Point position =
Point(x, y, z, stationCS);
249 const Vector momentum =
Vector(px, py, pz, stationCS, Vector::kCartesian);
266 const double phi = pPhi + asin(1-2*rand2);
268 const double z = sHeight*rand3;
269 const double x = sRadius * cos(phi);
270 const double y = sRadius * sin(phi);
272 const Point position =
Point(x, y, z, stationCS);
273 const Vector momentum =
Vector(px, py, pz, stationCS, Vector::kCartesian);
Branch GetTopBranch() const
constexpr T Sqr(const T &x)
bool HasStation(const int stationId) const
Check whether station exists.
Detector description interface for Station-related data.
Report success to RunController.
void MakeSimData()
Make station simulated data object.
Interface class to access to the SD part of an event.
Describes a particle for Simulation.
void ClearParticleList()
Clear the station particle list.
#define INFO(message)
Macro for logging informational messages.
Base class for exceptions trying to access non-existing components.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
std::ifstream * fInputStream
Base class to report exceptions in IO.
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!
class to hold data at Station level
bool HasSimData() const
Check whether station simulated data exists.
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger reference system centered on the tank.
void MakeStation(const int stationId)
make a station with specifying Id, throw if invalid stationId
void AddParticle(const utl::Particle &particle)
void GetData(bool &b) const
Overloads of the GetData member template function.
Station & GetStation(const int stationId)
retrieve station by id throw utl::NonExistentComponentException if n.a.
ResultFlag
Flag returned by module methods to the RunController.
int CorsikaToPDG(const int corsikaCode)
converters from CORSIKA to PDG particle codes
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
struct particle_info particle[80]
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
Report failure to RunController, causing RunController to terminate execution.
sevt::StationSimData & GetSimData()
Get simulated data at station level.
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
#define ERROR(message)
Macro for logging error messages.
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
utl::RandomEngine::RandomEngineType * fRandomEngine