7 #include <det/Detector.h>
8 #include <rdet/RDetector.h>
9 #include <rdet/Station.h>
10 #include <rdet/Channel.h>
11 #include <sdet/SDetector.h>
12 #include <sdet/Station.h>
13 #include <fwk/CentralConfig.h>
14 #include <utl/TimeStamp.h>
15 #include <utl/UTCDateTime.h>
16 #include <cppunit/extensions/HelperMacros.h>
17 #include <tst/Verify.h>
18 #include <utl/Point.h>
19 #include <utl/ReferenceEllipsoid.h>
20 #include <fwk/CoordinateSystemRegistry.h>
21 #include <fwk/LocalCoordinateSystem.h>
26 #include <TPaveText.h>
36 #define ASSERT_CLOSE(x, y, eps) CPPUNIT_ASSERT(Verify<CloseTo>(x, y, eps))
37 #define ASSERT_EQUAL(x, y) CPPUNIT_ASSERT(Verify<Equal>(x, y))
42 CPPUNIT_TEST(testStationListManager);
43 CPPUNIT_TEST(testRModel);
44 CPPUNIT_TEST(testAntennaType);
45 CPPUNIT_TEST_SUITE_END();
61 Detector::GetInstance();
69 cout <<
"Test of the AntennaTypes of RDetector" << endl;
71 Detector& detector = Detector::GetInstance();
75 const rdet::RDetector& rDetector = det::Detector::GetInstance().GetRDetector();
77 std::pair<std::complex<double>, std::complex<double>> cEffectiveAntennaHeight;
79 cout <<
"test channel 1" << endl;
81 for(
unsigned int i = 0; i < 100; i+=5)
83 cEffectiveAntennaHeight =
85 cout << double(i) * megahertz / (
giga *
hertz) <<
" GHz \t-> e_theta_amp : "
86 <<
abs(cEffectiveAntennaHeight.first) /
meter <<
" m, e_theta_phase : "
87 << arg(cEffectiveAntennaHeight.first) /
degree <<
" degrees" << endl;
89 cEffectiveAntennaHeight =
91 CPPUNIT_ASSERT(Verify<Equal>(
abs(cEffectiveAntennaHeight.first) > 0,
true));
93 cout <<
"test channel 2" << endl;
95 for(
unsigned int i = 0; i < 100; i+=5)
97 cEffectiveAntennaHeight =
99 cout << double(i) * megahertz / (
giga *
hertz) <<
" GHz \t-> e_theta_amp : "
100 <<
abs(cEffectiveAntennaHeight.first) /
meter <<
" m, e_theta_phase : "
101 << arg(cEffectiveAntennaHeight.first) /
degree <<
" degrees" << endl;
103 cEffectiveAntennaHeight =
105 CPPUNIT_ASSERT(Verify<Equal>(
abs(cEffectiveAntennaHeight.first) > 0,
true));
112 Detector& detector = Detector::GetInstance();
119 cout <<
"Name of rdet::Station with Id 1: "
137 TH2F *histo =
new TH2F(
"histo",
"Antennas Position", 1000, -27100., -25600., 1000, -6000., -4600.);
138 TFile antennasposition(
"antennasposition.root",
"recreate");
139 TCanvas* RSPlot =
new TCanvas(
"RSPlot",
"RSPlot");
150 std::string StationName = rdIt->GetName();
152 histo->Fill(Position.
GetX(localcoor), Position.
GetY(localcoor));
154 cout <<
" Station Name: " << StationName << endl;
155 cout <<
" Position (x,y,z) meters: "
156 << Position.
GetX(localcoor) <<
", " << Position.
GetY(localcoor) <<
", " << Position.
GetZ(localcoor) << endl;
157 cout <<
" Station Spher. coo. (theta, phi): "
158 << Position.
GetTheta(localcoor) <<
", " << Position.
GetPhi(localcoor) <<endl;
159 cout <<
" Radius r (cylind. coo.) from origin (m): " << Position.
GetRho(localcoor) << endl;
160 cout <<
" Radius R (spheri. coo.) from origin (m): " << Position.
GetR(localcoor) << endl;
173 std::stringstream StationText(
"");
174 StationText <<
" " << rdIt->GetId() <<
" " << StationName;
175 TText* RStext =
new TText(Position.
GetX(referenceCS), Position.
GetY(referenceCS), StationText.str().c_str());
176 RStext->SetTextAlign(20);
177 RStext->SetTextAngle(35);
178 RStext->SetTextSize(.04);
182 histo->SetStats(
false);
183 histo->SetMarkerStyle(2);
184 histo->SetFillColor(kWhite);
185 histo->SetMarkerSize(1.);
188 RSPlot->SaveAs(
"RSPlot.png");
195 Detector& detector = Detector::GetInstance();
203 cout <<
"Lower Design Freq. of rdet::Channel of Station id=" << RStation.
GetId()
204 <<
" and Channel=" << RChannel.
GetId()
210 cout <<
"Lower Design Freq. of rdet::Channel of Station id=" << RStation.
GetId()
211 <<
" and Channel=" << RChannel2.
GetId()
213 <<
" GetOrientationAzimuth/degree: "
215 <<
" GetOrientationZeta/degree: "
217 <<
" GetPosition/m: "
223 std::string RHRME(
"");
224 cout <<
"Got ResponseMap for Station id=" << RStation.
GetId()
225 <<
" and Channel=" << RChannel2.
GetId()
229 cout <<
"\n ResponseID: " << rMapIter->first
230 <<
"\n ResponseWeight: " << rMapIter->second
233 RHRME = rMapIter->first;
236 cout <<
"Testiing HardwareProfile: " << RHRME << endl;
238 cout <<
"\nNumber of Points: "
240 <<
"\n3rd x-value in MHz: "
241 << tComplexLgAmpPhase.
GetX(2)
242 <<
" Log of Amplitude: "
246 <<
"\nLog of Amplitude at 25 MHz: "
248 <<
", Phase/degree: "
250 <<
"\nLog of Amplitude at 30 MHz: "
252 <<
", Phase/degree: "
boost::transform_iterator< InternalStationFunctor, InternalStationIterator, const Station & > StationIterator
StationIterator returns a pointer to a station.
const_iterator End() const
Get an iterator to the end of the ResponseMap.
void Update(const utl::TimeStamp &time, const bool invData=true, const bool invComp=true, const bool forceRadio=false)
Update detector: deletes currently constructed stations and sets new time.
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger reference system centered on the station.
double GetOrientationZeta() const
Get zeta-tilt of Antenna for this Channel.
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
Detector description interface for Station-related data.
int GetId() const
return ID of the Channel
double GetR(const CoordinateSystemPtr &coordinateSystem) const
radius r in spherical coordinates coordinates (distance to origin)
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
double GetPhase() const
Get the phase in radians, can be bigger than 2*pi.
StationIterator StationsEnd() const
End of the collection of pointers to commissioned stations.
StationIterator StationsBegin() const
Beginning of the collection of pointers to commissioned stations.
double GetDesignLowerFreq() const
Get design value of the freq-band.
const utl::Point & GetPosition() const
Get Position of this Antenna-Channel.
const utl::ComplexLgAmpPhase & GetY(const unsigned int idx) const
Interpolate the Y value with a polyDegree polynomial.
Detector description interface for Channel-related data.
CPPUNIT_TEST_SUITE_REGISTRATION(testAiresShowerFile)
A TimeStamp holds GPS second and nanosecond for some event.
Detector description interface for RDetector-related data.
std::map< std::string, double >::const_iterator const_iterator
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
const utl::TabulatedFunctionComplexLgAmpPhase & GetHardwareResponseProfile(const std::string &identifier) const
Get the response (TabulatedFunctionComplexLgAmpPhase) which corresponds to a hardware profile identif...
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Class to hold collection (x,y) points and provide interpolation between them, where y are complex num...
const utl::ResponseMap & GetResponseMap() const
Get the ResponseMap of the Channel.
double abs(const SVector< n, T > &v)
Top of the hierarchy of the detector description interface.
void testStationListManager()
constexpr double megahertz
int GetId() const
Station ID.
A helper class which manages a list of system response identifiers (std::strings) and their correspon...
utl::ComplexLgAmpPhase Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
double GetLgAmplitude() const
Get log10(amplitude)
double GetRho(const CoordinateSystemPtr &coordinateSystem) const
radius r in cylindrical coordinates (distance to z axis)
unsigned int GetNPoints() const
const Channel & GetChannel(const int id) const
Get specified Channel by id.
double GetY(const CoordinateSystemPtr &coordinateSystem) const
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
const double & GetX(const unsigned int idx) const
utl::CoordinateSystemPtr GetReferenceCoordinateSystem() const
Get the reference coordinate system used for analysis (usually PampaAmarilla for Auger) ...
const_iterator Begin() const
Get an iterator to the first element of the ResponseMap.
const rdet::RDetector & GetRDetector() const
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
std::pair< std::complex< double >, std::complex< double > > GetElectricFieldResponse(const double theta, const double phi, const double freq, std::string interpolationMode) const
const Station & GetStation(const int stationId) const
Get station by Station Id.
TimeStamp GetTimeStamp() const
double GetOrientationAzimuth() const
Get azimuth-direction of Antenna for this Channel.
std::string GetName() const
Station name.