RdZHAireSSimPreparator.h
Go to the documentation of this file.
1 #ifndef _RdZHAireSSimPreparator_RdZHAireSSimPreparator_h_
2 #define _RdZHAireSSimPreparator_RdZHAireSSimPreparator_h_
3 
4 #include <fwk/VModule.h>
5 #include <utl/CoordinateSystem.h>
6 #include <utl/TimeStamp.h>
7 #include <utl/GeometryUtilities.h>
8 #include <utl/Math.h>
9 #include <string>
10 #include <vector>
11 #include <fstream>
12 
13 
14 namespace utl {
15  class RandomEngine;
16 }
17 
18 namespace evt {
19  class Event;
20  class ShowerRecData;
21  class Header;
22 }
23 
24 namespace revt {
25  class Header;
26 }
27 
28 struct Set {
30  std::string fPrimary;
31 };
32 
33 
34 namespace RdZHAireSSimPreparator {
35 
36  enum EPrimary {
39  };
40 
41 
43 
44  public:
47  fwk::VModule::ResultFlag Init() override;
48  fwk::VModule::ResultFlag Run(evt::Event& event) override;
50 
52  static
53  double
54  AugerAzimuthToZHAireS(const double augerAzimuth, double kMagneticFieldDeclination)
55  {
56  //const double kMagneticFieldDeclination = fMagDeclination*degree;
57  return utl::NormalizeAngleMinusPiPi(augerAzimuth - 90*utl::deg + kMagneticFieldDeclination);
58  }
59 
60  static
61  void
62  Rotatez(const double theta, const double vi[], double vf[])
63  {
64  const double costet = cos(theta);
65  const double sintet = sin(theta);
66  vf[0] = vi[0]*costet - vi[1]*sintet;
67  vf[1] = vi[0]*sintet + vi[1]*costet;
68  vf[2] = vi[2];
69  }
70 
71  private:
72  std::string GetEventNumber(const std::string& eventid); // extract the SD event Number from the AUGER ID
73  std::string AddZero(const int runID, const int numberofdigit); // Return runNumber as 000042
74 
75  //int fgsRunNumber; // static because the module might be called N-Time
76  int fStartRunNumber = 0;
77  float fMaxDistance = 0;
78  std::string fPrim; // could not implement .xsd correctly to include this
79  std::string fWorkingDir;
80  double fBIntensity = 0;
81  double fMagInclination = 0;
82  double fMagDeclination = 0;
83 
84  // from reas
85  std::string fEventHeader;
86 
88 
89  bool fNewZhaires = false;
90 
100 
101  // from reas
102  bool fUseCoreDist = false;
103  bool fModelMagField = false;
104  double fMagFieldDec = 0;
105  double fMagFieldX = 0;
106  double fMagFieldY = 0;
107 
108  double fThinEnergy = 0;
109  double fThinWFactor = 0;
110 
111  std::string fUseGeometry;
112  std::string fUseEnergy;
113 
114  // copied from Modules/FdSimulation/ProfileSimulatorOG/ProfileSimulator.cc
115  double PowerLaw(const double min, const double max, const double index) const;
116 
117  // Randomly choose SD station with full crown around it and draw
118  // core around this station with GenerateCoreAroundStation()
120 
121  // draw core in inner hexagon around this station (core for which this station is closest)
122  void GenerateCoreAroundStation(const utl::Point& center, const std::vector<utl::Point>& crownStations, utl::Point& core);
123 
124  void CreateFiles(const utl::Vector& axis,
125  const float energy,
126  const utl::Point& core,
127  const utl::TimeStamp time,
128  const std::string& eventId,
129  const int rEventId,
130  const int runId,
131  const std::string& runNumber,
132  const std::string& primaryType);
133 
134  // TEST LOG
135  std::ofstream fLogfile;
136 
137  std::vector<Set> fSimulationSets;
138 
139  REGISTER_MODULE("RdZHAireSSimPreparator", RdZHAireSSimPreparator);
140 
141  };
142 
143 }
144 
145 
146 #endif
std::string AddZero(const int runID, const int numberofdigit)
double NormalizeAngleMinusPiPi(const double x)
Normalize angle to lie between -pi and pi (-180 and 180 deg)
Point object.
Definition: Point.h:32
void CreateFiles(const utl::Vector &axis, const float energy, const utl::Point &core, const utl::TimeStamp time, const std::string &eventId, const int rEventId, const int runId, const std::string &runNumber, const std::string &primaryType)
REGISTER_MODULE("RdZHAireSSimPreparator", RdZHAireSSimPreparator)
static void Rotatez(const double theta, const double vi[], double vf[])
fwk::VModule::ResultFlag Init() override
Initialize: invoked at beginning of run (NOT beginning of event)
fwk::VModule::ResultFlag Finish() override
Finish: invoked at end of the run (NOT end of the event)
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
constexpr double deg
Definition: AugerUnits.h:140
#define max(a, b)
fwk::VModule::ResultFlag Run(evt::Event &event) override
Run: invoked once per event.
Wraps the random number engine used to generate distributions.
Definition: RandomEngine.h:27
static double AugerAzimuthToZHAireS(const double augerAzimuth, double kMagneticFieldDeclination)
Returns the azimuth rotated from Auger to Aires standard.
Module interface.
Definition: VModule.h:53
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
void GenerateCoreAroundStation(const utl::Point &center, const std::vector< utl::Point > &crownStations, utl::Point &core)
Vector object.
Definition: Vector.h:30
std::string fPrimary
double PowerLaw(const double min, const double max, const double index) const
static double kMagneticFieldDeclination
std::string GetEventNumber(const std::string &eventid)

, generated on Tue Sep 26 2023.