source: trunk/MagicSoft/Mars/mpointing/MPointingPos.cc@ 7517

Last change on this file since 7517 was 7517, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 3.7 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): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MPointingPos
28//
29// In this container we store the corrected pointing position of the
30// telscope. The pointing coordinates are read into MReportDrive together
31// with its time.
32//
33// MPointingPosCalc afterwards calculates corrections and checks for the
34// cosistency of the coordinates. The result (the real coordinates)
35// are stored in this container. No further correction should be necessary
36// using MPointingPos.
37//
38// If you need the rotation angle of the starfield in the camera you can
39// get it from here.
40//
41/////////////////////////////////////////////////////////////////////////////
42#include "MPointingPos.h"
43
44#include "MLog.h"
45
46#include "MTime.h"
47#include "MAstro.h"
48#include "MObservatory.h"
49#include "MPointingDev.h"
50#include "MAstroSky2Local.h"
51
52ClassImp(MPointingPos);
53
54using namespace std;
55
56const TString MPointingPos::gsDefName = "MPointingPos";
57const TString MPointingPos::gsDefTitle = "Container storing the (corrected) telescope pointing position";
58
59// --------------------------------------------------------------------------
60//
61// Get the corresponding rotation angle of the sky coordinate system
62// seen with an Alt/Az telescope calculated from the stored local
63// (Zd/Az) coordinates.
64//
65// For more information see MAstro::RotationAngle
66//
67Double_t MPointingPos::RotationAngle(const MObservatory &o) const
68{
69 return o.RotationAngle(fZd*TMath::DegToRad(), fAz*TMath::DegToRad());
70}
71
72// --------------------------------------------------------------------------
73//
74// Get the corresponding rotation angle of the sky coordinate system
75// seen with an Alt/Az telescope calculated from the stored sky
76// (Ra/Dec) coordinates.
77//
78// For more information see MAstro::RotationAngle
79//
80Double_t MPointingPos::RotationAngle(const MObservatory &o, const MTime &t, const MPointingDev *dev) const
81{
82 return dev ?
83 MAstroSky2Local(t, o).RotationAngle(GetRaRad(), GetDecRad(), dev->GetDevZdRad(), dev->GetDevAzRad()):
84 MAstroSky2Local(t, o).RotationAngle(GetRaRad(), GetDecRad());
85}
86
87void MPointingPos::Print(Option_t *o) const
88{
89 TString opt(o);
90
91 if (opt.IsNull())
92 opt = "radeczdaz";
93
94 *fLog << GetDescriptor() << ":";
95
96 if (opt.Contains("ra", TString::kIgnoreCase))
97 *fLog << " Ra=" << MAstro::GetStringHor(fRa);
98 if (opt.Contains("ha", TString::kIgnoreCase))
99 *fLog << " Ha=" << MAstro::GetStringHor(fHa);
100 if (opt.Contains("dec", TString::kIgnoreCase))
101 *fLog << " Dec=" << MAstro::GetStringDeg(fDec);
102 if (opt.Contains("zd", TString::kIgnoreCase))
103 *fLog << " Zd=" << MAstro::GetStringDeg(fZd);
104 if (opt.Contains("az", TString::kIgnoreCase))
105 *fLog << " Az=" << MAstro::GetStringDeg(fAz);
106
107 if (fTitle!=gsDefTitle)
108 *fLog << " <" << fTitle << ">";
109
110 *fLog << endl;
111}
Note: See TracBrowser for help on using the repository browser.