source: trunk/MagicSoft/Mars/mreport/MReportStarguider.cc@ 7487

Last change on this file since 7487 was 7487, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 5.8 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): Benjamin Riegel, 01/2005 <mailto:riegel@astro.uni-wuerzburg.de>
19! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
20!
21! Copyright: MAGIC Software Development, 2000-2005
22!
23!
24\* ======================================================================== */
25
26//////////////////////////////////////////////////////////////////////////////
27//
28// MReportStarguider
29//
30// This is the class interpreting and storing the STARG-REPORT information.
31//
32// This is the place to get the azimuth-/zenith mispointing of the telescope
33// given by the starguider-camera.
34//
35//
36// Starguider reports are available since 2004/11/17.
37// The nomnial pointing position is available since 2005/03/22
38// The sky brightness and the number of identified stars since 2005/03/17
39//
40//
41// Class Version 1:
42// ----------------
43// + Double_t fDevAz; // [arcmin] azimuth mispointing
44// + Double_t fDevZd; // [arcmin] zenith mispointing
45//
46//
47// Class Version 2:
48// ----------------
49// + Double_t fNominalZd; // [deg] Nominal zenith distance
50// + Double_t fNominalAz; // [deg] Nominal azimuth
51//
52// + Float_t fCameraCenterX; // [CCD pix] PMT Camera center found
53// + Float_t fCameraCenterY; // [CCD pix] PMT Camera center found
54//
55// + UInt_t fNumIdentifiedStars; // Number of stars identified by starguider algorithm
56//
57// + Double_t fSkyBrightness; // [au] Sky Brightness as calcualted from the CCD image
58// + Double_t fMjd; // Modified Julian Date matching the nominal position
59//
60//////////////////////////////////////////////////////////////////////////////
61#include "MReportStarguider.h"
62
63#include "MLogManip.h"
64
65#include "MAstro.h"
66
67ClassImp(MReportStarguider);
68
69using namespace std;
70
71// --------------------------------------------------------------------------
72//
73// Default constructor. Initialize identifier to "STARG-REPORT"
74//
75MReportStarguider::MReportStarguider() : MReport("STARG-REPORT"),
76 fDevAz(0), fDevZd(0), fNominalZd(0), fNominalAz(0),
77 fCameraCenterX(0), fCameraCenterY(0), fNumIdentifiedStars(0),
78 fSkyBrightness(0)
79{
80 fName = "MReportStarguider";
81 fTitle = "Class for STARG-REPORT information (telescope mispointing)";
82}
83
84// --------------------------------------------------------------------------
85//
86// Interprete the body of the STARG-REPORT string
87//
88Int_t MReportStarguider::InterpreteBody(TString &str, Int_t ver)
89{
90 Int_t len;
91 Int_t n=sscanf(str.Data(), "%lf %lf %n", &fDevZd, &fDevAz, &len);
92 if (n!=2)
93 {
94 *fLog << warn << "WARNING - Not enough arguments." << endl;
95 return kCONTINUE;
96 }
97
98 str.Remove(0, len);
99 str = str.Strip(TString::kBoth);
100
101 if (ver<200503170)
102 {
103 // Fix a problem with the units
104 fDevAz *= 60./TMath::RadToDeg();
105 fDevZd *= 60./TMath::RadToDeg();
106 return str.IsNull() ? kTRUE : kCONTINUE;
107 }
108
109 MAstro::String2Angle(str, fNominalZd); // Nom Zd
110 MAstro::String2Angle(str, fNominalAz); // Nom Az
111
112 if (ver<200503220)
113 {
114 // Until a fix in the software the written position was nonsense
115 fNominalZd = 0;
116 fNominalAz = 0;
117 }
118
119 n=sscanf(str.Data(), "%f %f %d %lf %lf %n",
120 &fCameraCenterX, &fCameraCenterY, &fNumIdentifiedStars,
121 &fSkyBrightness, &fMjd, &len);
122 if (n!=5)
123 {
124 *fLog << warn << "WARNING - Not enough arguments." << endl;
125 return kCONTINUE;
126 }
127
128 str.Remove(0, len);
129 str = str.Strip(TString::kBoth);
130
131 // Seems that hasn't yet been implemented
132 if (ver>=200508290 && ver<200509300)
133 {
134 // For the momment this are only placeholders....
135 Float_t dx, dy;
136 n=sscanf(str.Data(), "%f %f %n", &dx, &dy, &len);
137 if (n!=2)
138 {
139 *fLog << warn << "WARNING - Not enough arguments." << endl;
140 return kCONTINUE;
141 }
142
143 str.Remove(0, len);
144 str = str.Strip(TString::kBoth);
145 }
146
147 return str.IsNull() ? kTRUE : kCONTINUE;
148
149}
150
151Double_t MReportStarguider::GetDevAbs() const
152{
153 return MAstro::GetDevAbs(fNominalZd, fDevZd/60, fDevAz/60)*60;
154 /*
155 // For the algorithm see also MReportDrive
156 const Double_t pzd = fNominalZd * TMath::DegToRad();
157 const Double_t azd = fDevZd/60 * TMath::DegToRad();
158 const Double_t aaz = fDevAz/60 * TMath::DegToRad();
159
160 const double el = TMath::Pi()/2-pzd;
161
162 const double dphi2 = aaz/2.;
163 const double cos2 = cos(dphi2)*cos(dphi2);
164 const double sin2 = sin(dphi2)*sin(dphi2);
165 const double d = cos(azd)*cos2 - cos(2*el)*sin2;
166
167 return acos(d)*TMath::RadToDeg()*60;
168 */
169}
170
171void MReportStarguider::Print(Option_t *o) const
172{
173 *fLog << GetDescriptor() << ":" << endl;
174 *fLog << " DevZd=" << fDevZd << " DevAz=" << fDevAz << endl;
175 *fLog << " NominalZd=" << fNominalZd << " NominalAz=" << fDevAz << " MJD=" << fMjd << endl;
176 *fLog << " CameraCenterX=" << fCameraCenterX << " CameraCenterY=" << fCameraCenterY << endl;
177 *fLog << " NumIdentifiedStars=" << fNumIdentifiedStars << endl;
178 *fLog << " NumIdentifiedStars=" << fNumIdentifiedStars << " SkyBrightness=" << fSkyBrightness << endl;
179}
Note: See TracBrowser for help on using the repository browser.