source: trunk/MagicSoft/Mars/mpointing/MPointing.h@ 4829

Last change on this file since 4829 was 4804, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 5.5 KB
Line 
1#ifndef MARS_MPointing
2#define MARS_MPointing
3
4#ifndef ROOT_TArrayD
5#include <TArrayD.h>
6#endif
7
8#ifndef MARS_MParContainer
9#include "MParContainer.h"
10#endif
11
12// ---------------------------------------------------
13// FIXME: Replace coord.h completely with this!
14#ifndef __MARS__
15#include "coord.h"
16#else
17#include <TVector2.h>
18class AltAz : public TVector2
19{
20public:
21 AltAz(Double_t alt, Double_t az) : TVector2(alt, az)
22 {
23 }
24 Double_t Alt() const { return fX; }
25 Double_t Az() const { return fY; }
26};
27
28class ZdAz : public TVector2
29{
30public:
31 ZdAz(Double_t zd, Double_t az) : TVector2(zd, az)
32 {
33 }
34 Double_t Zd() const { return fX; }
35 Double_t Az() const { return fY; }
36};
37#endif
38// ---------------------------------------------------
39
40class TMinuit;
41
42class MPointing : public MParContainer
43{
44private:
45 static const Int_t fNumPar;
46
47 Double_t fIe ; // [rad] Index Error in Elevation
48 Double_t fIa ; // [rad] Index Error in Azimuth
49 Double_t fFlop ; // [rad] Vertical Sag
50 Double_t fNpae ; // [rad] Az-El Nonperpendicularity
51 Double_t fCa ; // [rad] Left-Right Collimation Error
52 Double_t fAn ; // [rad] Azimuth Axis Misalignment (N-S)
53 Double_t fAw ; // [rad] Azimuth Axis Misalignment (E-W)
54 Double_t fTf ; // [rad] Tube fluxture (sin)
55 Double_t fTx ; // [rad] Tube fluxture (tan)
56 Double_t fNrx ; // [rad] Nasmyth rotator displacement, horizontal
57 Double_t fNry ; // [rad] Nasmyth rotator displacement, vertical
58 Double_t fCrx ; // [rad] Alt/Az Coude Displacement (N-S)
59 Double_t fCry ; // [rad] Alt/Az Coude Displacement (E-W)
60 Double_t fEces ; // [rad] Elevation Centering Error (sin)
61 Double_t fAces ; // [rad] Azimuth Centering Error (sin)
62 Double_t fEcec ; // [rad] Elevation Centering Error (cos)
63 Double_t fAcec ; // [rad] Azimuth Centering Error (cos)
64 Double_t fMagic1; // [rad] Magic Term (what is it?)
65 Double_t fMagic2; // [rad] Magic Term (what is it?)
66
67 Double_t **fCoeff; //!
68 TString *fNames; //!
69 TString *fDescr; //!
70
71 TArrayD fError;
72
73 void Init(const char *name=0, const char *title=0);
74
75 void Clear(Option_t *o="")
76 {
77 for (int i=0; i<fNumPar; i++)
78 {
79 *fCoeff[i] = 0;
80 fError[i] = 0;
81 }
82 }
83
84 static Double_t Sign(Double_t val, Double_t alt);
85 AltAz CalcAnAw(const AltAz &p, Int_t sign) const;
86
87public:
88 MPointing() { fError.Set(fNumPar); Init(); Clear(); }
89 MPointing(const char *name) { fError.Set(fNumPar); Init(); Clear(); Load(name); }
90 virtual ~MPointing() { delete fNames; delete fCoeff; delete fDescr; }
91
92 void Load(const char *name);
93 void Save(const char *name);
94
95 void Reset();
96
97 ZdAz Correct(const ZdAz &zdaz) const;
98 AltAz Correct(const AltAz &aaz) const;
99
100 ZdAz CorrectBack(const ZdAz &zdaz) const;
101 AltAz CorrectBack(const AltAz &aaz) const;
102
103 ZdAz operator()(const ZdAz &zdaz) const { return Correct(zdaz); }
104 AltAz operator()(const AltAz &aaz) const { return Correct(aaz); }
105
106 ZdAz operator()(const ZdAz &zdaz, void (*fcn)(ZdAz &zdaz, Double_t *par)) const
107 {
108 Double_t par[fNumPar];
109 GetParameters(par);
110 ZdAz za = zdaz;
111 fcn(za, par);
112 return za;
113 }
114
115 AltAz operator()(const AltAz &aaz, void (*fcn)(AltAz &aaz, Double_t *par)) const
116 {
117 Double_t par[fNumPar];
118 GetParameters(par);
119 AltAz aa = aaz;
120 fcn(aa, par);
121 return aa;
122 }
123
124 AltAz AddOffsets(const AltAz &aa) const;
125 ZdAz AddOffsets(const ZdAz &zdaz) const
126 {
127 AltAz p(TMath::Pi()/2-zdaz.Zd(), zdaz.Az());
128 AltAz c = AddOffsets(p);
129 return ZdAz(TMath::Pi()/2-c.Alt(), c.Az());
130 }
131
132 AltAz SubtractOffsets(const AltAz &aa) const;
133 ZdAz SubtractOffsets(const ZdAz &zdaz) const
134 {
135 AltAz p(TMath::Pi()/2-zdaz.Zd(), zdaz.Az());
136 AltAz c = SubtractOffsets(p);
137 return ZdAz(TMath::Pi()/2-c.Alt(), c.Az());
138 }
139
140 void SetParameters(const Double_t *par, Int_t n=fNumPar);
141 void GetParameters(Double_t *par, Int_t n=fNumPar) const;
142
143 void SetParameters(const TArrayD &par)
144 {
145 SetParameters(par.GetArray(), par.GetSize());
146 }
147 void GetParameters(TArrayD &par) const
148 {
149 par.Set(fNumPar);
150 GetParameters(par.GetArray());
151 }
152 void GetError(TArrayD &par) const
153 {
154 par = fError;
155 for (int i=0; i<fNumPar; i++)
156 par[i] *= TMath::RadToDeg();
157 }
158
159 void SetMinuitParameters(TMinuit &m, Int_t n=-1) const;
160 void GetMinuitParameters(TMinuit &m, Int_t n=-1);
161 void PrintMinuitParameters(TMinuit &m, Int_t n=-1) const;
162
163 const TString &GetVarName(int i) const { return fNames[i]; }
164 const TString &GetDescription(int i) const { return fDescr[i]; }
165
166 /*
167 Double_t GetIe() const { return fIe; }
168 Double_t GetIa() const { return fIa; }
169 Double_t GetCa() const { return fCa; }
170 Double_t GetAn() const { return fAn; }
171 Double_t GetAw() const { return fAw; }
172 Double_t GetNrx() const { return fNrx; }
173 Double_t GetNry() const { return fNry; }
174 Double_t GetCrx() const { return fNrx; }
175 Double_t GetCry() const { return fNry; }
176 Double_t GetEces() const { return fEces; }
177 Double_t GetEcec() const { return fEcec; }
178 Double_t GetAces() const { return fAces; }
179 Double_t GetAcec() const { return fAcec; }
180 Double_t GetNpae() const { return fNpae; }
181 */
182
183 static const Int_t GetNumPar() { return fNumPar; }
184
185 ClassDef(MPointing, 1) // Pointing Model for MAGIC
186};
187
188#endif
Note: See TracBrowser for help on using the repository browser.