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

Last change on this file since 2500 was 2407, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.2 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
56public:
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 void SetParameters(const Double_t *par, Int_t n=fNumPar);
94 void GetParameters(Double_t *par, Int_t n=fNumPar) const;
95
96 void SetParameters(const TArrayD &par)
97 {
98 SetParameters(par.GetArray(), par.GetSize());
99 }
100 void GetParameters(TArrayD &par) const
101 {
102 par.Set(fNumPar);
103 GetParameters(par.GetArray());
104 }
105 void GetError(TArrayD &par) const
106 {
107 par = fError;
108 for (int i=0; i<fNumPar; i++)
109 par[i] *= kRad2Deg;
110 }
111
112 void SetMinuitParameters(TMinuit &m, Int_t n=-1) const;
113 void GetMinuitParameters(TMinuit &m, Int_t n=-1);
114 void PrintMinuitParameters(TMinuit &m, Int_t n=-1) const;
115
116 const TString &GetName(int i) const { return fName[i]; }
117 const TString &GetDescription(int i) const { return fDescr[i]; }
118
119 /*
120 Double_t GetIe() const { return fIe; }
121 Double_t GetIa() const { return fIa; }
122 Double_t GetCa() const { return fCa; }
123 Double_t GetAn() const { return fAn; }
124 Double_t GetAw() const { return fAw; }
125 Double_t GetNrx() const { return fNrx; }
126 Double_t GetNry() const { return fNry; }
127 Double_t GetCrx() const { return fNrx; }
128 Double_t GetCry() const { return fNry; }
129 Double_t GetEces() const { return fEces; }
130 Double_t GetEcec() const { return fEcec; }
131 Double_t GetAces() const { return fAces; }
132 Double_t GetAcec() const { return fAcec; }
133 Double_t GetNpae() const { return fNpae; }
134 */
135
136 static const Int_t GetNumPar() { return fNumPar; }
137 ClassDef(MBending, 1)
138};
139
140#endif
Note: See TracBrowser for help on using the repository browser.