MolecularLayer.cc
Go to the documentation of this file.
1 
9 //
10 // Note that conversions from units convention used in the DB
11 // to Auger base units is performed in this class. In the future,
12 // the units should be explicitly assigned in the database (somehow)
13 //
14 
15 
16 #include <atm/MolecularLayer.h>
17 #include <utl/ErrorLogger.h>
18 #include <utl/AugerUnits.h>
19 #include <atm/AManagerRegister.h>
20 #include <det/Detector.h>
21 
22 #include <sstream>
23 
24 using namespace std;
25 using namespace atm;
26 using namespace utl;
27 
28 
29 MolecularLayer::MolecularLayer(const std::string& layerId) :
30  fIsValid(false),
31  //fHeight(0),
32  //fHeightError(0),
33  //fDepth(0),
34  //fDepthError(0),
35  //fPressure(0),
36  //fPressureError(0),
37  //fTemperature(0),
38  //fTemperatureError(0),
39  //fWindSpeed(0),
40  //fWindSpeedError(0),
41  //fHumidity(0),
42  //fHumidityError(0),
43  //fAirDensity(0),
44  //fAirDensityError(0),
45  fLayerIdString(layerId)
46 {
47 }
48 
49 
50 double
52  const
53 {
54  if (!fIsValid)
55  GetLayerData();
56  return fHeight;
57 }
58 
59 
60 double
62  const
63 {
64  if (!fIsValid)
65  GetLayerData();
66  return fHeightError;
67 }
68 
69 
70 double
72  const
73 {
74  if (!fIsValid)
75  GetLayerData();
76  return fDepth;
77 }
78 
79 
80 double
82  const
83 {
84  if (!fIsValid)
85  GetLayerData();
86  return fDepthError;
87 }
88 
89 
90 double
92  const
93 {
94  if (!fIsValid)
95  GetLayerData();
96  return fPressure;
97 }
98 
99 
100 double
102  const
103 {
104  if (!fIsValid)
105  GetLayerData();
106  return fPressureError;
107 }
108 
109 
110 double
112  const
113 {
114  if (!fIsValid)
115  GetLayerData();
116  return fTemperature;
117 }
118 
119 
120 double
122  const
123 {
124  if (!fIsValid)
125  GetLayerData();
126  return fTemperatureError;
127 }
128 
129 
130 double
132  const
133 {
134  if (!fIsValid)
135  GetLayerData();
136  return fWindSpeed;
137 }
138 
139 
140 double
142  const
143 {
144  if (!fIsValid)
145  GetLayerData();
146  return fWindSpeedError;
147 }
148 
149 
150 double
152  const
153 {
154  if (!fIsValid)
155  GetLayerData();
156  return fHumidity;
157 }
158 
159 
160 double
162  const
163 {
164  if (!fIsValid)
165  GetLayerData();
166  return fHumidityError;
167 }
168 
169 
170 double
172  const
173 {
174  if (!fIsValid)
175  GetLayerData();
176  return fAirDensity;
177 }
178 
179 
180 double
182  const
183 {
184  if (!fIsValid)
185  GetLayerData();
186  return fAirDensityError;
187 }
188 
189 
190 void
192  const
193 {
194  det::VManager::IndexMap indexMap;
195  indexMap["molecular_layer_id"] = fLayerIdString;
196  indexMap["transpose"] = "14";
197 
198  const det::VManager& manager =
199  det::Detector::GetInstance().GetAManagerRegister();
200 
201  const char* const component =
202  "height, height_err, depth, depth_err, pressure, pressure_err, "
203  "temperature, temperature_err, windspeed, windspeed_err, "
204  "humidity, humidity_err, air_density, air_density_err";
205  vector<double> requestedData;
206  const det::VManager::Status foundFlag =
207  manager.GetData(requestedData, "molecular_layer", component, indexMap);
208 
209  if (foundFlag == det::VManager::eNotFound ||
210  requestedData.size() != 14)
211  throw utl::DataNotFoundInDBException("molecular_layer", component, indexMap,
212  boost::lexical_cast<std::string>(det::Detector::GetInstance().GetTime()));
213 
214  fIsValid = true;
215  int i = 0;
216  fHeight = requestedData[i++] * meter;
217  fHeightError = requestedData[i++] * meter;
218  fDepth = requestedData[i++] * (g/cm2);
219  fDepthError = requestedData[i++] * (g/cm2);
220  fPressure = requestedData[i++] * 100*pascal;
221  fPressureError = requestedData[i++] * 100*pascal;
222  fTemperature = requestedData[i++] * kelvin;
223  fTemperatureError = requestedData[i++] * kelvin;
224  fWindSpeed = requestedData[i++] * (meter/second);
225  fWindSpeedError = requestedData[i++] * (meter/second);
226  fHumidity = requestedData[i++] * percent;
227  fHumidityError = requestedData[i++] * percent;
228  fAirDensity = requestedData[i++] * (kg/m3);
229  fAirDensityError = requestedData[i++] * (kg/m3);
230 }
231 
232 
233 // Configure (x)emacs for this file ...
234 // Local Variables:
235 // mode: c++
236 // compile-command: "make -C .. -k"
237 // End:
double GetPressureError() const
Error on pressure in the slice.
double GetHeightError() const
Error on height pertaining to quantities in this slice.
double GetTemperature() const
Temperature in the slice.
double GetAirDensity() const
Air density in the slice.
const double meter
Definition: GalacticUnits.h:29
constexpr double percent
Definition: AugerUnits.h:283
double GetHumidity() const
Humidity in the slice.
Interface for detector managers.
Definition: VManager.h:115
std::string fLayerIdString
double GetDepth() const
Depth of for this slice.
virtual Status GetData(double &returnData, const std::string &componentProperty, const std::string &componentName, const IndexMap &componentIndex) const =0
Exception to use in case requested data not found in the database with detailed printout.
constexpr double pascal
Definition: AugerUnits.h:212
constexpr double m3
Definition: AugerUnits.h:123
const double second
Definition: GalacticUnits.h:32
double GetAirDensityError() const
Error on air density in the slice.
double GetWindSpeedError() const
Error on wind speed in the slice.
double GetPressure() const
Pressure in the slice.
constexpr double g
Definition: AugerUnits.h:200
double GetWindSpeed() const
Wind speed in the slice.
double GetDepthError() const
Error on depth for this slice.
constexpr double kelvin
Definition: AugerUnits.h:259
double GetHeight() const
Measured height pertaining to quantities in this slice.
double GetTemperatureError() const
Error on temperature in the slice.
double GetHumidityError() const
Error on humidity in the slice.
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
void GetLayerData() const
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127
constexpr double kg
Definition: AugerUnits.h:199
constexpr double cm2
Definition: AugerUnits.h:118

, generated on Tue Sep 26 2023.