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

Last change on this file since 6922 was 6922, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 4.6 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// Class Version 1:
37// ----------------
38// + Double_t fDevAz; // [arcmin] azimuth mispointing
39// + Double_t fDevZd; // [arcmin] zenith mispointing
40//
41//
42// Class Version 2:
43// ----------------
44// + Double_t fNominalZd; // [deg] Nominal zenith distance
45// + Double_t fNominalAz; // [deg] Nominal azimuth
46//
47// + Float_t fCameraCenterX; // [CCD pix] PMT Camera center found
48// + Float_t fCameraCenterY; // [CCD pix] PMT Camera center found
49//
50// + UInt_t fNumIdentifiedStars; // Number of stars identified by starguider algorithm
51//
52// + Double_t fSkyBrightness; // [au] Sky Brightness as calcualted from the CCD image
53// + Double_t fMjd; // Modified Julian Date matching the nominal position
54//
55//////////////////////////////////////////////////////////////////////////////
56#include "MReportStarguider.h"
57
58#include "MLogManip.h"
59
60#include "MAstro.h"
61
62ClassImp(MReportStarguider);
63
64using namespace std;
65
66// --------------------------------------------------------------------------
67//
68// Default constructor. Initialize identifier to "STARG-REPORT"
69//
70MReportStarguider::MReportStarguider() : MReport("STARG-REPORT"),
71 fDevAz(0), fDevZd(0), fNominalZd(0), fNominalAz(0),
72 fCameraCenterX(0), fCameraCenterY(0), fNumIdentifiedStars(0),
73 fSkyBrightness(0)
74{
75 fName = "MReportStarguider";
76 fTitle = "Class for STARG-REPORT information (telescope mispointing)";
77}
78
79// --------------------------------------------------------------------------
80//
81// Interprete the body of the STARG-REPORT string
82//
83Int_t MReportStarguider::InterpreteBody(TString &str, Int_t ver)
84{
85 Int_t len;
86 Int_t n=sscanf(str.Data(), "%lf %lf %n", &fDevAz, &fDevZd, &len);
87 if (n!=2)
88 {
89 *fLog << warn << "WARNING - Not enough arguments." << endl;
90 return kCONTINUE;
91 }
92
93 str.Remove(0, len);
94 str = str.Strip(TString::kBoth);
95
96 if (ver < 200503170)
97 {
98 // Fix a problem with the units
99 fDevAz *= 60./TMath::RadToDeg();
100 fDevZd *= 60./TMath::RadToDeg();
101 return str.IsNull() ? kTRUE : kCONTINUE;
102 }
103
104 MAstro::String2Angle(str, fNominalZd); // Nom Zd
105 MAstro::String2Angle(str, fNominalAz); // Nom Az
106
107 if (ver < 999999999)
108 {
109 // Until a fix in the software the written position was nonsense
110 fNominalZd = 0;
111 fNominalAz = 0;
112 }
113
114 n=sscanf(str.Data(), "%f %f %d %lf %lf %n",
115 &fCameraCenterX, &fCameraCenterY, &fNumIdentifiedStars,
116 &fSkyBrightness, &fMjd, &len);
117 if (n!=5)
118 {
119 *fLog << warn << "WARNING - Not enough arguments." << endl;
120 return kCONTINUE;
121 }
122
123 str.Remove(0, len);
124 str = str.Strip(TString::kBoth);
125
126 return str.IsNull() ? kTRUE : kCONTINUE;
127}
128
129
130void MReportStarguider::Print(Option_t *o) const
131{
132 *fLog << GetDescriptor() << ":" << endl;
133 *fLog << " DevZd=" << fDevZd << " DevAz=" << fDevAz << endl;
134 *fLog << " NominalZd=" << fNominalZd << " NominalAz=" << fDevAz << " MJD=" << fMjd << endl;
135 *fLog << " CameraCenterX=" << fCameraCenterX << " CameraCenterY=" << fCameraCenterY << endl;
136 *fLog << " NumIdentifiedStars=" << fNumIdentifiedStars << endl;
137 *fLog << " NumIdentifiedStars=" << fNumIdentifiedStars << " SkyBrightness=" << fSkyBrightness << endl;
138}
Note: See TracBrowser for help on using the repository browser.