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 |
|
---|
10 | class TMinuit;
|
---|
11 |
|
---|
12 | class MBending
|
---|
13 | {
|
---|
14 | private:
|
---|
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 |
|
---|
56 | public:
|
---|
57 | MBending() { fError.Set(fNumPar); Init(); Clear(); }
|
---|
58 | MBending(const char *name) { fError.Set(fNumPar); Init(); Clear(); Load(name); }
|
---|
59 | virtual ~MBending() { delete fName; delete fCoeff; delete fDescr; }
|
---|
60 |
|
---|
61 | void Load(const char *name);
|
---|
62 | void Save(const char *name);
|
---|
63 |
|
---|
64 | void Reset();
|
---|
65 |
|
---|
66 | ZdAz Correct(const ZdAz &zdaz) const;
|
---|
67 | AltAz Correct(const AltAz &aaz) const;
|
---|
68 |
|
---|
69 | ZdAz CorrectBack(const ZdAz &zdaz) const;
|
---|
70 | AltAz CorrectBack(const AltAz &aaz) const;
|
---|
71 |
|
---|
72 | ZdAz operator()(const ZdAz &zdaz) const { return Correct(zdaz); }
|
---|
73 | AltAz operator()(const AltAz &aaz) const { return Correct(aaz); }
|
---|
74 |
|
---|
75 | ZdAz operator()(const ZdAz &zdaz, void (*fcn)(ZdAz &zdaz, Double_t *par)) const
|
---|
76 | {
|
---|
77 | Double_t par[fNumPar];
|
---|
78 | GetParameters(par);
|
---|
79 | ZdAz za = zdaz;
|
---|
80 | fcn(za, par);
|
---|
81 | return za;
|
---|
82 | }
|
---|
83 |
|
---|
84 | AltAz operator()(const AltAz &aaz, void (*fcn)(AltAz &aaz, Double_t *par)) const
|
---|
85 | {
|
---|
86 | Double_t par[fNumPar];
|
---|
87 | GetParameters(par);
|
---|
88 | AltAz aa = aaz;
|
---|
89 | fcn(aa, par);
|
---|
90 | return aa;
|
---|
91 | }
|
---|
92 |
|
---|
93 | AltAz AddOffsets(const AltAz &aa) const;
|
---|
94 | ZdAz AddOffsets(const ZdAz &zdaz) const
|
---|
95 | {
|
---|
96 | AltAz p(TMath::Pi()/2-zdaz.Zd(), zdaz.Az());
|
---|
97 | AltAz c = AddOffsets(p);
|
---|
98 | return ZdAz(TMath::Pi()/2-c.Alt(), c.Az());
|
---|
99 | }
|
---|
100 |
|
---|
101 | AltAz SubtractOffsets(const AltAz &aa) const;
|
---|
102 | ZdAz SubtractOffsets(const ZdAz &zdaz) const
|
---|
103 | {
|
---|
104 | AltAz p(TMath::Pi()/2-zdaz.Zd(), zdaz.Az());
|
---|
105 | AltAz c = SubtractOffsets(p);
|
---|
106 | return ZdAz(TMath::Pi()/2-c.Alt(), c.Az());
|
---|
107 | }
|
---|
108 |
|
---|
109 | void SetParameters(const Double_t *par, Int_t n=fNumPar);
|
---|
110 | void GetParameters(Double_t *par, Int_t n=fNumPar) const;
|
---|
111 |
|
---|
112 | void SetParameters(const TArrayD &par)
|
---|
113 | {
|
---|
114 | SetParameters(par.GetArray(), par.GetSize());
|
---|
115 | }
|
---|
116 | void GetParameters(TArrayD &par) const
|
---|
117 | {
|
---|
118 | par.Set(fNumPar);
|
---|
119 | GetParameters(par.GetArray());
|
---|
120 | }
|
---|
121 | void GetError(TArrayD &par) const
|
---|
122 | {
|
---|
123 | par = fError;
|
---|
124 | for (int i=0; i<fNumPar; i++)
|
---|
125 | par[i] *= kRad2Deg;
|
---|
126 | }
|
---|
127 |
|
---|
128 | void SetMinuitParameters(TMinuit &m, Int_t n=-1) const;
|
---|
129 | void GetMinuitParameters(TMinuit &m, Int_t n=-1);
|
---|
130 | void PrintMinuitParameters(TMinuit &m, Int_t n=-1) const;
|
---|
131 |
|
---|
132 | const TString &GetName(int i) const { return fName[i]; }
|
---|
133 | const TString &GetDescription(int i) const { return fDescr[i]; }
|
---|
134 |
|
---|
135 | /*
|
---|
136 | Double_t GetIe() const { return fIe; }
|
---|
137 | Double_t GetIa() const { return fIa; }
|
---|
138 | Double_t GetCa() const { return fCa; }
|
---|
139 | Double_t GetAn() const { return fAn; }
|
---|
140 | Double_t GetAw() const { return fAw; }
|
---|
141 | Double_t GetNrx() const { return fNrx; }
|
---|
142 | Double_t GetNry() const { return fNry; }
|
---|
143 | Double_t GetCrx() const { return fNrx; }
|
---|
144 | Double_t GetCry() const { return fNry; }
|
---|
145 | Double_t GetEces() const { return fEces; }
|
---|
146 | Double_t GetEcec() const { return fEcec; }
|
---|
147 | Double_t GetAces() const { return fAces; }
|
---|
148 | Double_t GetAcec() const { return fAcec; }
|
---|
149 | Double_t GetNpae() const { return fNpae; }
|
---|
150 | */
|
---|
151 |
|
---|
152 | static const Int_t GetNumPar() { return fNumPar; }
|
---|
153 | ClassDef(MBending, 1)
|
---|
154 | };
|
---|
155 |
|
---|
156 | #endif
|
---|