RDetector.h
Go to the documentation of this file.
1 #ifndef _rdet_RDetector_h_
2 #define _rdet_RDetector_h_
3 
4 #include <string>
5 #include <vector>
6 #include <map>
7 #include <set>
8 
9 #include <boost/iterator/transform_iterator.hpp>
10 
11 #include <rdet/Station.h>
12 
13 #include <utl/TimeStamp.h>
14 #include <utl/Validated.h>
15 #include <utl/AugerException.h>
16 
17 
18 namespace det {
19  class Detector;
20 }
21 
22 namespace utl {
23  class NonExistentComponentException;
24  class TabulatedFunctionComplexLgAmpPhase;
25 }
26 
27 namespace revt {
28  class Station;
29 }
30 
31 namespace rdet {
32 
33  class Station;
34 
35 
46  class RDetector {
47 
48  private:
49  typedef std::map<int, const rdet::Station*> InternalStationMap;
50  typedef InternalStationMap::const_iterator InternalStationIterator;
51 
53  const rdet::Station& operator()(const InternalStationMap::value_type& pair) const
54  { return *pair.second; }
55  };
56 
57  public:
59  typedef boost::transform_iterator<InternalStationFunctor,
62 
65  { return StationIterator(fFullStationMap.begin()); }
66 
69  { return StationIterator(fFullStationMap.end()); }
70 
72 
73 
74  const Station& GetStation(const int stationId) const;
75 
77  const Station& GetStation(const revt::Station& station) const;
78 
80  const std::vector<int>& GetFullStationList() const;
81 
83  const utl::TabulatedFunctionComplexLgAmpPhase& GetHardwareResponseProfile(const std::string& identifier) const;
84 
86  const std::vector<double>& GetBeaconFrequencies() const;
87 
89  double GetBeaconReferencePhase(const int stationId, const double beaconFreq) const;
90 
91  unsigned long long int GetBadStationReason(const int stationId) const;
92 
93  double GetTemperature(const std::string& site) const;
94 
95  // Returns fAddStationListFromSManager
96  bool AddStationListFromSManager() const;
97 
98  // Helper method to do the redundant work of preparing requests for detector data,
99  // sending it to the manager and reporting any errors.
100  // The indexMap is not used here, but kept for the interface
101  template<typename T>
102  void
103  GetDetectorData(T*& requestedData,
104  const std::string& property,
105  const std::string& component,
106  const std::string& errorMsg,
107  const det::VManager::IndexMap& indexMap = det::VManager::IndexMap())
108  const
109  {
110  if (!requestedData) {
111  requestedData = new T;
112 
113  const det::VManager& manager = det::Detector::GetInstance().GetRManagerRegister();
114  const det::VManager::Status foundFlag =
115  manager.GetData(*requestedData, property, component, indexMap);
116 
117  if (foundFlag == det::VManager::eNotFound) {
118  std::ostringstream err;
119  err << "Did not find requested component: " << errorMsg;
120  ERROR(err);
121  throw utl::NonExistentComponentException(err.str());
122  }
123  }
124  }
125 
127  int GetRdSdStationIdLink() const { return fRdSdStationIdLink; }
128 
129  private:
130  RDetector() { }
131 
132  ~RDetector();
133 
134  RDetector(const RDetector& rdetector);
135 
136  RDetector& operator=(const RDetector& rdetector);
137 
138  void Update();
139 
140  const std::string fRDetectorName = "AERA";
141 
142  // List of all stations available in the external sources
143  // (external sources are, for example, the XML file with
144  // station list or perhaps some MySQL database)
146 
147  // If true, station ids from the SManager are added to fFullStationList
149 
152 
153  typedef std::map<std::string, const utl::TabulatedFunctionComplexLgAmpPhase*> HardwareResponseProfileMap;
155 
156  mutable std::vector<double>* fBeaconFreq = nullptr;
157  mutable double* fBeaconReferencePhase = nullptr;
158 
159  friend class det::Detector;
160 
164  int fRdSdStationIdLink = 30000;
165  };
166 
167 }
168 
169 
170 #endif
boost::transform_iterator< InternalStationFunctor, InternalStationIterator, const Station & > StationIterator
StationIterator returns a pointer to a station.
Definition: RDetector.h:61
double GetTemperature(const std::string &site) const
Definition: RDetector.cc:250
double GetBeaconReferencePhase(const int stationId, const double beaconFreq) const
Get beacon reference phases for one station.
Definition: RDetector.cc:197
InternalStationMap fFullStationMap
internal map of station id and station object
Definition: RDetector.h:151
Detector description interface for Station-related data.
const rdet::Station & operator()(const InternalStationMap::value_type &pair) const
Definition: RDetector.h:53
StationIterator StationsEnd() const
End of the collection of pointers to commissioned stations.
Definition: RDetector.h:68
StationIterator StationsBegin() const
Beginning of the collection of pointers to commissioned stations.
Definition: RDetector.h:64
RDetector & operator=(const RDetector &rdetector)
const std::vector< int > & GetFullStationList() const
Get list of ID&#39;s for all stations available in the database or configuration file.
Definition: RDetector.cc:84
Base class for exceptions trying to access non-existing components.
InternalStationMap::const_iterator InternalStationIterator
Definition: RDetector.h:50
Interface for detector managers.
Definition: VManager.h:115
unsigned long long int GetBadStationReason(const int stationId) const
Definition: RDetector.cc:217
utl::Validated< std::vector< int > > fFullStationList
Definition: RDetector.h:145
HardwareResponseProfileMap fHardwareResponseProfileMap
Definition: RDetector.h:154
Wrapper class for initially unset data.
Definition: ResponseMap.h:17
const std::vector< double > & GetBeaconFrequencies() const
Get vector of Beacon Frequencies for given detector-time from Manager.
Definition: RDetector.cc:183
Detector description interface for RDetector-related data.
Definition: RDetector.h:46
virtual Status GetData(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
int GetRdSdStationIdLink() const
Get Rd - Sd Station Id link.
Definition: RDetector.h:127
const utl::TabulatedFunctionComplexLgAmpPhase & GetHardwareResponseProfile(const std::string &identifier) const
Get the response (TabulatedFunctionComplexLgAmpPhase) which corresponds to a hardware profile identif...
Definition: RDetector.cc:164
utl::Validated< bool > fAddStationListFromSManager
Definition: RDetector.h:148
std::vector< double > * fBeaconFreq
Definition: RDetector.h:156
Top of the hierarchy of the detector description interface.
Definition: Detector.h:81
std::map< int, const rdet::Station * > InternalStationMap
Definition: RDetector.h:49
#define OFFLINE_MAKE_CONST_ITERATOR_RANGE(_ConstIterator_, _NamePrefix_)
Definition: IteratorRange.h:28
double * fBeaconReferencePhase
Definition: RDetector.h:157
void GetDetectorData(T *&requestedData, const std::string &property, const std::string &component, const std::string &errorMsg, const det::VManager::IndexMap &indexMap=det::VManager::IndexMap()) const
Definition: RDetector.h:103
bool AddStationListFromSManager() const
Definition: RDetector.cc:265
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
const Station & GetStation(const int stationId) const
Get station by Station Id.
Definition: RDetector.cc:141
int fRdSdStationIdLink
Definition: RDetector.h:164
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127
const std::string fRDetectorName
Definition: RDetector.h:140
Definition: XbArray.h:7
std::map< std::string, const utl::TabulatedFunctionComplexLgAmpPhase * > HardwareResponseProfileMap
Definition: RDetector.h:153

, generated on Tue Sep 26 2023.