RDetector/Channel.cc
Go to the documentation of this file.
1 #include <det/Detector.h>
2 
3 #include <rdet/RDetector.h>
4 #include <rdet/Channel.h>
5 
6 #include <utl/ErrorLogger.h>
7 #include <utl/AugerException.h>
8 
9 #include <sstream>
10 
11 using namespace det;
12 using namespace rdet;
13 using namespace std;
14 using namespace utl;
15 
16 
17 Channel::Channel(const int sid, const int cid) :
18  fStationIdString(boost::lexical_cast<string>(sid)),
19  fChannelIdString(boost::lexical_cast<string>(cid)),
20  fChannelId(cid)
21 {
23 }
24 
25 
27 {
28  delete fAntenna;
29  //delete fGlobalResponse; // complex global response, tabulated in freq.
30 }
31 
32 
33 int
35  const
36 {
37  return GetChannelData(fChannelOk, "Channel_OK", "RChannel", "Channel Ok data");
38 }
39 
40 
41 double
43  const
44 {
45  return GetChannelData(fDesignLowerFreq, "DesignLowerFreq", "RChannel", "DesignLowerFreq");
46 }
47 
48 
49 double
51  const
52 {
53  return GetChannelData(fDesignUpperFreq, "DesignUpperFreq", "RChannel", "DesignUpperFreq");
54 }
55 
56 
57 double
59  const
60 {
61  return GetChannelData(fOrientationZenith, "OrientationZenith", "RChannel", "OrientationZenith");
62 }
63 
64 
65 double
67  const
68 {
69  return GetChannelData(fOrientationAzimuth, "OrientationAzimuth", "RChannel", "OrientationAzimuth");
70 }
71 
72 
73 double
75  const
76 {
77  return GetChannelData(fOrientationZeta, "OrientationZeta", "RChannel", "OrientationZeta");
78 }
79 
80 
81 const std::string&
83  const
84 {
85  return GetChannelData(fChannelType, "ChannelType", "RChannel", "ChannelType");
86 }
87 
88 
89 const std::string&
91  const
92 {
93  return GetChannelData(fADCType, "ADCType", "RADC", "ADCType");
94 }
95 
96 
97 int
99  const
100 {
101  return GetChannelData(fBitDepth, "BitDepth", "RADC", "BitDepth");
102 }
103 
104 
105 double
107  const
108 {
109  return GetChannelData(fSamplingFrequency, "SamplingFrequency", "RADC", "SamplingFrequency");
110 }
111 
112 
113 double
115  const
116 {
117  return GetChannelData(fMinVoltage, "MinVoltage", "RADC", "MinVoltage");
118 }
119 
120 
121 double
123  const
124 {
125  return GetChannelData(fMaxVoltage, "MaxVoltage", "RADC", "MaxVoltage");
126 }
127 
128 
129 const std::string&
131  const
132 {
133  return GetChannelData(fAntennaTypeName, "AntennaType", "RChannel", "AntennaType");
134 }
135 
136 
137 double
139  const
140 {
141  return GetChannelData(fDesignImpedance, "DesignImpedance", "RAntenna", "DesignImpedance");
142 }
143 
144 
145 double
147  const
148 {
149  return GetChannelData(fIntegratedHorizontalGain, "IntegratedHorizontalGain", "RAntenna", "IntegratedHorizontalGain");
150 }
151 
152 
153 double
155  const
156 {
157  return GetChannelData(fIntegratedVerticalGain, "IntegratedVerticalGain", "RAntenna", "IntegratedVerticalGain");
158 }
159 
160 
161 pair<complex<double>, complex<double>>
162 Channel::GetElectricFieldResponse(const double theta, const double phi, const double freq,
163  const std::string interpolationMode)
164  const
165 {
166  return fAntenna->GetElectricFieldResponse(theta, phi - GetOrientationAzimuth(), freq,
167  interpolationMode);
168  //fixme TH: antenna zeta angle is ignored, in fact a tilting of the antenna would require a resimulation of the antenna pattern
169 }
170 
171 
172 double
174  const
175 {
177 }
178 
179 
180 void
182  const
183 {
184  //fixme TH: Why is the ChannelOk flag set to invalid in a Channel Update, why nothing else? Is the ChannelOk flag actually used anywhere
185  fChannelOk.SetValid(false);
186 }
187 
188 
189 const Point&
191  const
192 {
193  if (!fPosition.IsValid()) {
194 
195  Validated<vector<double> > coords;
196  GetChannelData(coords, "Position", "RChannel", "Position");
197 
198  const int id = boost::lexical_cast<int>(fStationIdString);
199  CoordinateSystemPtr tCS =
200  Detector::GetInstance().GetRDetector().GetStation(id).GetLocalCoordinateSystem();
201  Point pt(coords.Get()[0], coords.Get()[1], coords.Get()[2], tCS);
202  fPosition.Set(pt);
203  }
204  return fPosition.Get();
205 }
206 
207 
208 void
209 Channel::NotFoundAndExit(const string& msg)
210  const
211 {
212  ostringstream err;
213  err << "Did not find requested component :" << msg << "\n"
214  "Requested station = " << fStationIdString << "\n"
215  "Requested channel = " << fChannelIdString;
216  ERROR(err);
217  throw NonExistentComponentException(err.str());
218 }
219 
220 
221 const ResponseMap&
223  const
224 {
225  if (!fResponseMap.IsValid()) {
227  GetChannelData(m, "ResponseMapEntry", "RResponseMapList", "ResponseMap");
229  }
230  return fResponseMap.Get();
231 }
232 
233 
234 const TabulatedFunction&
236  const
237 {
238  //fixme TH: need to implement interface to the CalibrationManager
239  static const TabulatedFunction foo;
240  const string err = "Channel::GetCalibrationFunction() not implemented!";
241  ERROR(err);
243  return foo;
244 }
int GetBitDepth() const
Get number of bits of ADC.
utl::Validated< double > fOrientationAzimuth
utl::Validated< double > fIntegratedHorizontalGain
utl::Validated< double > fSamplingFrequency
double GetOrientationZeta() const
Get zeta-tilt of Antenna for this Channel.
Point object.
Definition: Point.h:32
double GetDesignUpperFreq() const
Get design value of the freq-band.
const T & GetChannelData(utl::Validated< T > &requestedData, const std::string &property, const std::string &component, const std::string &errorMsg) const
int freq
Definition: dump1090.h:244
std::pair< std::complex< double >, std::complex< double > > GetElectricFieldResponse(const double theta, const double phi, const double freq, const std::string &interpolationMode)
Get GetElectricFieldResponse returns the response of the antenna for a certain incoming direction of ...
Definition: AntennaType.cc:190
Class to hold collection (x,y) points and provide interpolation between them.
double GetIntegratedEffectiveAntennaHeight(const double freq)
Get GetIntegratedEffectiveAntennaHeight returns the response of the antenna integrated over the full ...
Definition: AntennaType.cc:406
double GetDesignLowerFreq() const
Get design value of the freq-band.
double GetIntegratedHorizontalGain() const
Get IntegratedHorizontalGain of Antenna-Type.
const utl::Point & GetPosition() const
Get Position of this Antenna-Channel.
utl::Validated< double > fOrientationZenith
utl::Validated< int > fBitDepth
double GetMaxVoltage() const
Get voltage corresponding to max number of counts.
double GetDesignImpedance() const
Get DesignImpediance of Antenna-Type.
utl::Validated< double > fMaxVoltage
Base class for exceptions trying to access non-existing components.
double GetOrientationZenith() const
Get zenith-direction of Antenna for this Channel.
void Update() const
const utl::TabulatedFunction & GetCalibrationFunction() const
Get a TabulatedFunction with calibration factors for the frequency bins of the Channel, not yet implemented.
Interface to access antenna characteristics.
Definition: AntennaType.h:65
Wrapper class for initially unset data.
Definition: ResponseMap.h:17
utl::Validated< std::string > fChannelType
utl::Validated< double > fDesignLowerFreq
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
const std::string & GetChannelType() const
Get description of Channel Type.
double GetMinVoltage() const
Get voltage corresponding to 0 counts.
utl::Validated< std::string > fAntennaTypeName
utl::Validated< utl::ResponseMap > fResponseMap
void Set(const T &value)
Definition: Validated.h:72
const utl::ResponseMap & GetResponseMap() const
Get the ResponseMap of the Channel.
bool IsValid() const
Definition: Validated.h:64
utl::Validated< double > fDesignImpedance
A helper class which manages a list of system response identifiers (std::strings) and their correspon...
Definition: ResponseMap.h:28
void NotFoundAndExit(const std::string &msg) const
double GetIntegratedVerticalGain() const
Get IntegratedVerticalGain of Antenna-Type.
int GetOkFlag() const
Channel Ok flag (1 if the currently cached data are up to date, 0 if currently cached data are obsole...
utl::Validated< utl::Point > fPosition
std::string fStationIdString
utl::Validated< std::string > fADCType
utl::Validated< double > fDesignUpperFreq
AntennaType * fAntenna
utl::Validated< int > fChannelOk
utl::Validated< double > fOrientationZeta
const std::string & GetAntennaTypeName() const
Get description of Antenna-Type.
const std::string & GetADCType() const
Get description of ADC-Type.
void SetValid(const bool valid=true)
Definition: Validated.h:66
double GetSamplingFrequency() const
Get sampling Frequency of ADC (unit?)
utl::Validated< double > fIntegratedVerticalGain
std::pair< std::complex< double >, std::complex< double > > GetElectricFieldResponse(const double theta, const double phi, const double freq, std::string interpolationMode) const
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
constexpr double m
Definition: AugerUnits.h:121
double GetIntegratedEffectiveAntennaHeight(const double freq) const
std::string fChannelIdString
utl::Validated< double > fMinVoltage
double GetOrientationAzimuth() const
Get azimuth-direction of Antenna for this Channel.

, generated on Tue Sep 26 2023.