TankGPSSimulator.cc
Go to the documentation of this file.
1 #include "TankGPSSimulator.h"
2 
3 #include <det/Detector.h>
4 
5 #include <sdet/SDetector.h>
6 #include <sdet/Station.h>
7 
8 #include <evt/Event.h>
9 
10 #include <fwk/CentralConfig.h>
11 
12 #include <sevt/Header.h>
13 #include <sevt/SEvent.h>
14 #include <sevt/Station.h>
15 #include <sevt/StationSimData.h>
16 #include <sevt/StationGPSData.h>
17 
18 #include <utl/AugerUnits.h>
19 #include <utl/MathConstants.h>
20 #include <utl/Particle.h>
21 #include <utl/PhysicalConstants.h>
22 #include <utl/TimeStamp.h>
23 #include <utl/ErrorLogger.h>
24 
25 #include <cstddef>
26 #include <sstream>
27 
28 using namespace det;
29 using namespace sdet;
30 using namespace evt;
31 using namespace fwk;
32 using namespace sevt;
33 using namespace utl;
34 using namespace std;
35 
36 
37 namespace TankGPSSimulatorOG {
38 
40  TankGPSSimulator::Run(Event& event)
41  {
42  if (!event.HasSEvent()) {
43  ERROR("Non-existent SEvent.");
44  return eFailure;
45  }
46 
47  auto& sEvent = event.GetSEvent();
48 
49  for (auto& station : sEvent.StationsRange()) {
50 
51  if (!station.HasSimData())
52  continue;
53 
54  auto& sSim = station.GetSimData();
55 
56  for (auto& tt : sSim.TriggerTimesRange()) {
57 
58  auto& gps = sSim.GetGPSData(tt);
59 
60  const int offset = 0;
61  const int current100 = 100000000;
62  const int next100 = 100000000;
63  const int current40 = 40000000;
64  const int next40 = 40000000;
65  const int previousST = 0;
66  const int nextST = 0;
67  const int currentST = 0;
68  const int second = tt.GetGPSSecond();
69  const int tickFall = 0;
70  const int tick =
71  (unsigned int)(tt.GetGPSNanoSecond() /
72  (next100 > 0 ? (1e9 + nextST - currentST)/next100 : 10.));
73 
74  gps.SetSecond(second);
75  gps.SetCurrent100(current100);
76  gps.SetNext100(next100);
77  gps.SetCurrent40(current40);
78  gps.SetNext40(next40);
79  gps.SetPreviousST(previousST);
80  gps.SetNextST(nextST);
81  gps.SetCurrentST(currentST);
82  gps.SetOffset(offset);
83  gps.SetTick(tick);
84  gps.SetTickFall(tickFall);
85 
86  gps.SetCorrectedNanosecond(tt.GetGPSNanoSecond());
87  }
88  }
89 
90  return eSuccess;
91  }
92 
93 }
const double second
Definition: GalacticUnits.h:32
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
bool HasSEvent() const

, generated on Tue Sep 26 2023.