source: trunk/MagicSoft/Cosy/main/MBending.h@ 6893

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