LaserGenerator.cc
Go to the documentation of this file.
1 
10 #include "LaserGenerator.h"
11 
12 #include <fwk/CentralConfig.h>
13 #include <fwk/RandomEngineRegistry.h>
14 
15 #include <evt/Event.h>
16 #include <evt/ShowerSimData.h>
17 #include <evt/LaserData.h>
18 #include <evt/DefaultShowerGeometryProducer.h>
19 
20 #include <utl/AugerCoordinateSystem.h>
21 #include <utl/AugerUnits.h>
22 #include <utl/CoordinateSystem.h>
23 #include <utl/ErrorLogger.h>
24 #include <utl/RandomEngine.h>
25 #include <utl/Reader.h>
26 #include <utl/Point.h>
27 #include <utl/Particle.h>
28 #include <utl/UTMPoint.h>
29 #include <utl/Vector.h>
30 #include <utl/PhysicalConstants.h>
31 
32 #include <CLHEP/Random/RandGauss.h>
33 
34 #include <cstddef>
35 #include <iostream>
36 #include <string>
37 #include <sstream>
38 
39 using namespace LaserGeneratorNA;
40 using CLHEP::RandGauss;
41 
42 using namespace fwk;
43 using namespace evt;
44 using namespace utl;
45 using namespace std;
46 
47 
49  fTheta(0.),
50  fPhi(0.),
51  fEnergy(0.),
52  fEnergyRMS(0.),
53  fDoEnergySmearing(false),
54  fWavelength(0.),
55  fRandomEngine(0)
56 {
57 }
58 
60 {
61 }
62 
65 {
66  Branch topB = CentralConfig::GetInstance()->GetTopBranch("LaserGeneratorNA");
67 
68  topB.GetChild("theta").GetData(fTheta);
69  topB.GetChild("phi").GetData(fPhi);
70 
71  Branch laserB = topB.GetChild("laserEnergy");
72  laserB.GetChild("energyMean").GetData(fEnergy);
73  laserB.GetChild("energyRMS").GetData(fEnergyRMS);
74  laserB.GetChild("doSmearing").GetData(fDoEnergySmearing);
75 
76  topB.GetChild("wavelength").GetData(fWavelength);
77 
79  &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector);
80 
81  ostringstream info;
82  info << "Version: " << GetVersionInfo(VModule::eRevisionNumber) << "\n"
83  << " Parameters:\n"
84  << " theta: " << fTheta / degree << " degree\n"
85  << " phi: " << fPhi / degree << " degree\n"
86  << " energy: " << fEnergy / (1e-3 * joule) << " mJ\n"
87  << " energy RMS: " << fEnergyRMS / perCent << "%\n"
88  << " energy smearing: " << (fDoEnergySmearing ? "yes\n" : "no\n")
89  << " wavelength: " << fWavelength / nanometer << " nm\n";
90  INFO(info);
91 
92  return eSuccess;
93 }
94 
97 {
98  INFO("LaserGenerator");
99 
100  if (theEvent.HasSimShower()) {
101  ERROR("Shower sim data already exists. Cannot produce Laser simulation.");
102  return eFailure;
103  }
105 
106  evt::ShowerSimData& theShower = theEvent.GetSimShower();
107 
108  // NO primary particle --> LASER event
110 
113 
114  double energy = fEnergy;
115  if (fDoEnergySmearing) {
116  energy = RandGauss::shoot(&fRandomEngine->GetEngine(),
117  fEnergy,
118  fEnergyRMS * fEnergy);
119  ostringstream info;
120  info << "Laser energy: " << energy / (1e-3 * joule) << " mJ";
121  INFO(info);
122  }
123  theShower.SetEnergy(energy);
124 
125  if (!theShower.HasLaserData())
126  theShower.MakeLaserData();
127 
128  evt::LaserData& theLaser = theShower.GetLaserData();
129 
131  theLaser.SetPolarizationStatus(false);
132 
133  return eSuccess;
134 }
135 
138 {
139  return eSuccess;
140 }
141 
void SetLaserWavelength(const double laserwavelength)
Definition: LaserData.h:35
Branch GetTopBranch() const
Definition: Branch.cc:63
void SetPolarizationStatus(const bool PolarizationStatus)
Definition: LaserData.h:41
LaserData & GetLaserData()
Get the laser data.
constexpr double perCent
Definition: AugerUnits.h:282
const double degree
bool HasLaserData() const
Check initialization of the LaserData.
Report success to RunController.
Definition: VModule.h:62
RandomEngineType & GetEngine()
Definition: RandomEngine.h:32
void MakeLaserData()
Make the LaserData.
bool HasSimShower() const
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.
Definition: ErrorLogger.h:161
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
std::string GetVersionInfo(const VersionInfoType v) const
Retrieve different sorts of module version info.
Definition: VModule.cc:26
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
constexpr double nanometer
Definition: AugerUnits.h:102
Interface class to access Shower Simulated parameters.
Definition: ShowerSimData.h:49
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
Class representing a document branch.
Definition: Branch.h:107
ShowerSimData & GetSimShower()
void SetEnergy(const double theEnergy)
Set the energy of the shower primary particle.
Definition: ShowerSimData.h:91
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
fwk::VModule::ResultFlag Run(evt::Event &theEvent)
Run: invoked once per event.
constexpr double joule
Definition: AugerUnits.h:181
Data structure for Laser simulation and reconstruction.
Definition: LaserData.h:29
void SetPrimaryParticle(const int type)
Set the type of the shower primary particle.
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
void SetGroundParticleCoordinateSystemZenith(const double zenith)
Set the zenith angle of the shower. Room angle between z-axis and direction from where the shower is ...
utl::RandomEngine * fRandomEngine
void MakeSimShower(const evt::VShowerGeometryProducer &p)
Report failure to RunController, causing RunController to terminate execution.
Definition: VModule.h:64
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165

, generated on Tue Sep 26 2023.