source: trunk/MagicSoft/Mars/mastro/MObservatory.cc@ 3571

Last change on this file since 3571 was 3568, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.1 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Robert Wagner 10/2002 <mailto:magicsoft@rwagner.de>
19! Author(s): Thomas Bretz 2/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
20!
21! Copyright: MAGIC Software Development, 2002-2004
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// MObservatory
29//
30// BE EXTREMLY CARFEFULL CHANGING THIS CLASS! THE TRACKING SYSTEM IS BASED
31// ON IT!
32//
33/////////////////////////////////////////////////////////////////////////////
34#include "MObservatory.h"
35
36#include <TVector3.h>
37
38#include "MTime.h"
39#include "MAstro.h"
40
41#include "MLog.h"
42#include "MLogManip.h"
43
44ClassImp(MObservatory);
45
46using namespace std;
47
48void MObservatory::Init(const char *name, const char *title)
49{
50 fName = name ? name : "MObservatory";
51 fTitle = title ? title : "Storage container for coordinates of an observatory";
52}
53
54MObservatory::MObservatory(const char *name, const char *title)
55{
56 Init(name, title);
57
58 SetLocation(kMagic1);
59}
60
61MObservatory::MObservatory(LocationName_t key, const char *name, const char *title)
62{
63 Init(name, title);
64
65 SetLocation(key);
66}
67
68// --------------------------------------------------------------------------
69//
70// BE EXTREMLY CARFEFULL CHANGING THIS CLASS! THE TRACKING SYSTEM IS BASED
71// ON IT!
72//
73void MObservatory::SetLocation(LocationName_t name)
74{
75 switch (name)
76 {
77 // BE EXTREMLY CARFEFULL CHANGING THIS CLASS! THE TRACKING SYSTEM
78 // IS BASED ON IT!
79 case kMagic1:
80 // Values taken from the GPS Receiver (avg 20h)
81 // on 26/11/2003 at 17h30 in the counting house
82 fLatitude = MAstro::Dms2Rad(28, 45, 42.576, '+');
83 fLongitude = MAstro::Dms2Rad(17, 53, 26.460, '-');
84 fHeight = 2196.5; // m
85 fObservatoryName = "Observatorio del Roque de los Muchachos (Magic1)";
86 break;
87
88 case kWuerzburgCity:
89 fLatitude = MAstro::Dms2Rad(51, 38, 48.0);
90 fLongitude = MAstro::Dms2Rad( 9, 56, 36.0);
91 fHeight = 300;
92 fObservatoryName = "Wuerzburg City";
93 break;
94 }
95
96 fSinLatitude = TMath::Sin(fLatitude);
97 fCosLatitude = TMath::Cos(fLatitude);
98}
99
100void MObservatory::Print(Option_t *) const
101{
102 *fLog << all;
103 *fLog << underline << fObservatoryName << ":" << endl;
104 *fLog << "Latitude: " << TMath::Abs(fLatitude*kRad2Deg) << " deg " << (fLatitude > 0 ? "W" : "E") << endl;
105 *fLog << "Longitude: " << TMath::Abs(fLongitude*kRad2Deg) << " deg " << (fLongitude < 0 ? "N" : "S") << endl;
106 *fLog << "Height: " << fHeight << "m" << endl;
107}
108
109// --------------------------------------------------------------------------
110//
111// Get the corresponding rotation angle of the sky coordinate system
112// seen with an Alt/Az telescope.
113//
114// For more information see MAstro::RotationAngle
115//
116void MObservatory::RotationAngle(Double_t theta, Double_t phi, Double_t &sin, Double_t &cos) const
117{
118 MAstro::RotationAngle(fSinLatitude, fCosLatitude, theta, phi, sin, cos);
119}
120
121// --------------------------------------------------------------------------
122//
123// Get the corresponding rotation angle of the sky coordinate system
124// seen with an Alt/Az telescope.
125//
126// For more information see MAstro::RotationAngle
127//
128Double_t MObservatory::RotationAngle(Double_t theta, Double_t phi) const
129{
130 return MAstro::RotationAngle(fSinLatitude, fCosLatitude, theta, phi);
131}
Note: See TracBrowser for help on using the repository browser.