RDetector/Station.h
Go to the documentation of this file.
1 #ifndef _rdet_Station_h_
2 #define _rdet_Station_h_
3 
4 #include <vector>
5 #include <list>
6 #include <map>
7 #include <string>
8 #include <sstream>
9 
10 #include <boost/lexical_cast.hpp>
11 #include <boost/iterator/indirect_iterator.hpp>
12 
13 #include <det/VManager.h>
14 #include <det/Detector.h>
15 
16 #include <utl/AugerException.h>
17 #include <utl/CoordinateSystemPtr.h>
18 #include <utl/ReferenceEllipsoid.h>
19 #include <utl/Validated.h>
20 #include <utl/Point.h>
21 #include <utl/TimeStamp.h>
22 #include <utl/TimeRange.h>
23 #include <utl/TabulatedFunction.h>
24 #include <utl/ShadowPtr.h>
25 
26 
27 namespace utl {
28  class Point;
29  class TimeStamp;
30 }
31 
32 namespace revt {
33  class Channel;
34 }
35 
36 namespace rdet {
37  class Channel;
38  class RDetector;
39 
40 
50  class Station {
51 
52  private:
53  typedef std::vector<const Channel*> InternalChannelVector;
54  typedef InternalChannelVector::const_iterator InternalChannelIterator;
55 
56  public:
57 
59  std::vector<int> GetListOfChannelIds() const { return fListOfChannelIds; }
60 
61  int GetInternalChannelId(const int channelId) const { return fChannelIdToInternalChannelId.at(channelId); }
62 
63  bool HasChannel(const int channelId) const { return fChannelIdToInternalChannelId.count(channelId); }
64 
66  void SetListOfChannelIds();
67 
69  int GetNChannels() const { return fListOfChannelIds.size(); }
70 
72  std::string GetName() const;
73 
75  int GetId() const { return fId; }
76 
78  typedef boost::indirect_iterator<InternalChannelIterator, const Channel&> ChannelIterator;
79 
82  { return ChannelIterator(fChannelVector.begin()); }
83 
86  { return ChannelIterator(fChannelVector.end()); }
87 
89 
90 
91  const utl::TimeStamp& GetCommissionTime() const
92  { return GetCommissionTimeRange().GetStartTime(); }
93 
96  { return GetCommissionTimeRange().GetStopTime(); }
97 
100 
102  // const utl::Point& GetPosition() const;
103  // temporary solution for detector creeping (bug #307)
104  utl::Point GetPosition() const;
105 
108 
110  bool IsInGrid(const int level = 0) const;
111 
112  bool IsInEngineeringArray() const { return fId < 71; }
113 
114  // defines if a station is generated from simulation and is event based
115  bool IsVirtual() const;
116 
117  // ------------------
118  // Dynamic quantities
119  // ------------------
120 
122  bool IsInAcquisition() const;
123 
124  // ---------------------
125  // Station subcomponents
126  // ---------------------
128  const Channel& GetChannel(const int id) const;
129 
131  const Channel& GetChannel(const revt::Channel& channel) const;
132 
133  private:
134  Station(const int);
135  ~Station();
136 
137  Station(const Station&);
138  Station operator=(const Station&);
139 
140  void Update() const;
141 
142  // Helper method to do the redundant work of preparing requests for station data,
143  // sending it to the manager and reporting any errors.
144  // The errorMsg argument is used to construct some hopefully meaningful error message if the
145  // requested component is not found. It should have a description in some human language
146  // of what was not located.
147 
148  template <typename T>
150  GetDefaultData(T& returnData, const std::string& componentProperty) const;
151 
152  template <typename T>
154  GetStationData(T& requestedData,
155  const std::string& property,
156  const std::string& component,
157  const std::string& errorMsg,
158  const bool throwOnFailure = true) const;
159 
160  void NotFoundAndThrow(const std::string& msg) const;
161 
162  int fId;
163 
164  // station id held as a string as that is what is passed through the detector manager interface
165  std::string fStationIdString;
166 
168 
169  // Quantities filled by lazy evaluation
170  // ------------------------------------
176 
178 
182 
183  std::vector<int> fListOfChannelIds;
184  std::map<int, int> fChannelIdToInternalChannelId;
185 
187 
188  friend class RDetector;
189 
190  };
191 
192 }
193 
194 
195 #endif
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger reference system centered on the station.
Point object.
Definition: Point.h:32
bool IsInAcquisition() const
Station in data acquisition.
Detector description interface for Station-related data.
ChannelIterator ChannelsEnd() const
End of the collection of pointers to Channels.
Time interval defined by two TimeStamps.
Definition: TimeRange.h:23
void NotFoundAndThrow(const std::string &msg) const
Station operator=(const Station &)
const TimeStamp & GetStopTime() const
Definition: TimeRange.h:36
det::VManager::Status GetStationData(T &requestedData, const std::string &property, const std::string &component, const std::string &errorMsg, const bool throwOnFailure=true) const
Station(const int)
int GetInternalChannelId(const int channelId) const
Detector description interface for Channel-related data.
InternalChannelVector fChannelVector
utl::Validated< int > fFirstChannelId
bool IsVirtual() const
det::VManager::Status GetDefaultData(T &returnData, const std::string &componentProperty) const
std::vector< int > fListOfChannelIds
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
std::string fStationIdString
Detector description interface for RDetector-related data.
Definition: RDetector.h:46
utl::CoordinateSystemPtr fReferenceSystem
utl::Validated< utl::Point > fPosition
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
InternalChannelVector::const_iterator InternalChannelIterator
const utl::TimeStamp & GetCommissionTime() const
Station commission time.
int GetNChannels() const
Number of channels in station.
utl::Validated< std::string > fName
const TimeStamp & GetStartTime() const
Definition: TimeRange.h:35
#define OFFLINE_MAKE_CONST_ITERATOR_RANGE(_ConstIterator_, _NamePrefix_)
Definition: IteratorRange.h:28
int GetId() const
Station ID.
utl::Validated< int > fLastChannelId
bool HasChannel(const int channelId) const
std::vector< const Channel * > InternalChannelVector
utl::Validated< int > fIsInAcquisition
std::vector< int > GetListOfChannelIds() const
returns a list with the commissioned channels ids of the station
void Update() const
boost::indirect_iterator< InternalChannelIterator, const Channel & > ChannelIterator
ChannelIterator returns a pointer to a Channel.
const Channel & GetChannel(const int id) const
Get specified Channel by id.
bool IsInEngineeringArray() const
utl::Validated< utl::TimeRange > fCommissionTimeRange
void SetListOfChannelIds()
set list of channel ids of the station
Class that holds the data associated to an individual radio channel.
std::map< int, int > fChannelIdToInternalChannelId
const utl::TimeStamp & GetDecommissionTime() const
Station decommission time.
EllipsoidID
ID&#39;s of known reference ellipsoid&#39;s.
utl::Validated< int > fInGrid
utl::ReferenceEllipsoid::EllipsoidID fEllipsoid
utl::Point GetPosition() const
Tank position in Site Cartesian Coordinates.
ChannelIterator ChannelsBegin() const
Beginning of the collection of pointers to Channels.
bool IsInGrid(const int level=0) const
Tells whether the station is in the regular triangular grid.
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127
utl::Validated< int > fNChannels
const utl::TimeRange & GetCommissionTimeRange() const
Station commission time range.
std::string GetName() const
Station name.

, generated on Tue Sep 26 2023.