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

Last change on this file since 7360 was 7202, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 5.4 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 return str.IsNull() ? kTRUE : kCONTINUE;
132}
133
134Double_t MReportStarguider::GetDevAbs() const
135{
136 return MAstro::GetDevAbs(fNominalZd, fDevZd/60, fDevAz/60)*60;
137 /*
138 // For the algorithm see also MReportDrive
139 const Double_t pzd = fNominalZd * TMath::DegToRad();
140 const Double_t azd = fDevZd/60 * TMath::DegToRad();
141 const Double_t aaz = fDevAz/60 * TMath::DegToRad();
142
143 const double el = TMath::Pi()/2-pzd;
144
145 const double dphi2 = aaz/2.;
146 const double cos2 = cos(dphi2)*cos(dphi2);
147 const double sin2 = sin(dphi2)*sin(dphi2);
148 const double d = cos(azd)*cos2 - cos(2*el)*sin2;
149
150 return acos(d)*TMath::RadToDeg()*60;
151 */
152}
153
154void MReportStarguider::Print(Option_t *o) const
155{
156 *fLog << GetDescriptor() << ":" << endl;
157 *fLog << " DevZd=" << fDevZd << " DevAz=" << fDevAz << endl;
158 *fLog << " NominalZd=" << fNominalZd << " NominalAz=" << fDevAz << " MJD=" << fMjd << endl;
159 *fLog << " CameraCenterX=" << fCameraCenterX << " CameraCenterY=" << fCameraCenterY << endl;
160 *fLog << " NumIdentifiedStars=" << fNumIdentifiedStars << endl;
161 *fLog << " NumIdentifiedStars=" << fNumIdentifiedStars << " SkyBrightness=" << fSkyBrightness << endl;
162}
Note: See TracBrowser for help on using the repository browser.