RdBeamTimeOptimizer/RdWaveModel.cc
Go to the documentation of this file.
1 #include "RdWaveModel.h"
2 //#include "revt+points.h"
3 #include <utl/ErrorLogger.h>
4 
5 #include <evt/Event.h>
6 #include <revt/REvent.h>
7 #include <revt/Header.h>
8 #include <revt/Station.h>
9 #include <revt/StationRecData.h>
10 
11 #include <det/Detector.h>
12 #include <rdet/RDetector.h>
13 
14 #include <utl/Trace.h>
15 #include <utl/TraceAlgorithm.h>
16 #include <utl/ErrorLogger.h>
17 #include <utl/Reader.h>
18 #include <utl/config.h>
19 #include <utl/AugerUnits.h>
20 
21 #include <utl/PhysicalConstants.h>
22 
23 #include <fwk/CoordinateSystemRegistry.h>
24 #include <cmath>
25 
26 using namespace std;
27 
28 using namespace std;
29 using namespace utl;
30 using namespace fwk;
31 using namespace revt;
32 
33 namespace RdBeamTimeOptimizer {
34 
35  RdWaveModel::RdWaveModel() { }
36  RdWaveModel::~RdWaveModel() { }
37 
38  static inline double norm (utl::Vector x) {
39  return sqrt(x*x);
40  }
41 
42  void RdWaveModel::setOrigin (utl::Point origin) {
43  this->origin = origin;
44  }
45 
46  double RdWaveModel::delay(utl::Point /*skyPos*/,
47  utl::Point /*antennaPos*/) const {
48  cerr << "Abstract method RdWaveModel::delay not meant to be called\n";
49  return NAN;
50  }
51  void RdWaveModel::setSkyPos(utl::Point skyPos) {
52  this -> skyPos = skyPos;
53  }
54  double RdWaveModel::delay (utl::Point antennaPos) const {
55  return delay (skyPos, antennaPos);
56  }
57 
59  utl::Point antennaPos) const {
60  const utl::Vector diff = skyPos - antennaPos;
61  return (norm(diff) - norm(skyPos-origin)) / kSpeedOfLight;
62  }
63  void RdSphericalWaveModel::setSkyPos(utl::Point skyPos) {
64  this -> skyPos = skyPos;
65  skyVecNorm = norm(skyPos - origin);
66  }
67  double RdSphericalWaveModel::delay (utl::Point antennaPos) const {
68  const utl::Vector diff = antennaPos - skyPos;
69  return (norm(diff) - skyVecNorm) / kSpeedOfLight;
70  }
71 
73  utl::Point antennaPos) const {
74  const utl::Vector rho = skyPos - origin;
75  const utl::Vector x = antennaPos - origin;
76  return -(rho * x) / norm (rho) / kSpeedOfLight;
77  }
78 
79  double RdWaveModel::coneAngle(utl::Vector /*skyVec*/,
80  const utl::CoordinateSystemPtr /*cs*/) {
81  return 0.0;
82  }
83 
84  double RdWaveModel::curvature(utl::Vector /*skyVec*/,
85  const utl::CoordinateSystemPtr /*cs*/) {
86  return 0.0;
87  }
88 
89  double RdSphericalWaveModel::curvature(utl::Vector skyVec,
90  const utl::CoordinateSystemPtr cs) {
91  return 1.0 / skyVec.GetR(cs);
92  }
93 
94  // From here on only module code for testing ...
95 #ifdef RDDELAYS_AS_MODULE
96 
99  INFO("RdWaveModel::Init()");
100  return eSuccess;
101  }
102 
103 
105  RdWaveModel::Run(evt::Event& event) {
106  INFO("RdWaveModel::Run()");
107 
108  if(!event.HasREvent())
109  {
110  WARNING("RdWaveModel::No radio event found!");
111  return eContinueLoop;
112  }
113 
114  REvent& rEvent = event.GetREvent();
115 
116  stringstream fMessage;
117  fMessage << "Radio event found with "
118  << rEvent.GetNumberOfStations()
119  << " stations!";
120  INFO(fMessage.str());
121 
122  const Header& rHeader = rEvent.GetHeader();
123  fMessage.str("");
124  fMessage << "Found header with ID "
125  << rHeader.GetId()
126  << " and timestamp: "
127  << rHeader.GetTime();
128  INFO(fMessage.str());
129 
130  setOrigin (revt::signalBarycenter (rEvent));
131 
132  return eSuccess;
133  }
134 
136  RdWaveModel::Finish() {
137  INFO("RdWaveModel::Finish()");
138  return eSuccess;
139  }
140 
141 #endif
142 }
Module for fitting time shifts of station traces which give maximal beam signal.
Point object.
Definition: Point.h:32
Interface class to access to the Radio part of an event.
Definition: REvent.h:42
double GetR(const CoordinateSystemPtr &coordinateSystem) const
radius r in spherical coordinates coordinates (distance to origin)
Definition: BasicVector.h:257
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void Init()
Initialise the registry.
bool HasREvent() const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
static int delay
Definition: XbAlgo.cc:20
Header & GetHeader()
access to REvent Header
Definition: REvent.h:239
int GetNumberOfStations() const
Get total number of stations in the event.
Definition: REvent.h:206
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
constexpr double kSpeedOfLight
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
double norm(utl::Vector x)
Header file holding the RD Event Trigger class definition (based on SD)
Definition: REvent/Header.h:14
Vector object.
Definition: Vector.h:30
int GetId() const
Definition: REvent/Header.h:21

, generated on Tue Sep 26 2023.