| 1 | #include <fstream>
|
|---|
| 2 | #include <iostream>
|
|---|
| 3 | #include <iomanip>
|
|---|
| 4 |
|
|---|
| 5 | #include <TError.h>
|
|---|
| 6 |
|
|---|
| 7 | #include <TGFrame.h>
|
|---|
| 8 | #include <TGLabel.h>
|
|---|
| 9 | #include <TGButton.h>
|
|---|
| 10 | #include <TGFileDialog.h>
|
|---|
| 11 |
|
|---|
| 12 | #include <TF1.h>
|
|---|
| 13 | #include <TH1.h>
|
|---|
| 14 | #include <TH2.h>
|
|---|
| 15 | #include <TText.h>
|
|---|
| 16 | #include <TProfile.h>
|
|---|
| 17 | #include <TPolyLine.h>
|
|---|
| 18 | #include <TGraphErrors.h>
|
|---|
| 19 |
|
|---|
| 20 | #include <TList.h>
|
|---|
| 21 | #include <TStyle.h>
|
|---|
| 22 | #include <TMinuit.h>
|
|---|
| 23 |
|
|---|
| 24 | #include <TView.h>
|
|---|
| 25 | #include <TLine.h>
|
|---|
| 26 | #include <TMarker.h>
|
|---|
| 27 | #include <TCanvas.h>
|
|---|
| 28 |
|
|---|
| 29 | //#include "coord.h"
|
|---|
| 30 |
|
|---|
| 31 | #include "MGList.h"
|
|---|
| 32 | #include "MPointing.h"
|
|---|
| 33 |
|
|---|
| 34 | using namespace std;
|
|---|
| 35 |
|
|---|
| 36 | //#define PRESENTATION
|
|---|
| 37 |
|
|---|
| 38 | class Set : public TObject
|
|---|
| 39 | {
|
|---|
| 40 | friend ifstream &operator>>(ifstream &fin, Set &set);
|
|---|
| 41 | private:
|
|---|
| 42 | Double_t fStarAz;
|
|---|
| 43 | Double_t fStarEl;
|
|---|
| 44 |
|
|---|
| 45 | Double_t fRawAz;
|
|---|
| 46 | Double_t fRawEl;
|
|---|
| 47 |
|
|---|
| 48 | Double_t fMag;
|
|---|
| 49 | public:
|
|---|
| 50 | Set(Double_t sel=0, Double_t saz=0, Double_t rel=0, Double_t raz=0) :
|
|---|
| 51 | fStarAz(saz*TMath::DegToRad()),
|
|---|
| 52 | fStarEl(sel*TMath::DegToRad()),
|
|---|
| 53 | fRawAz(raz*TMath::DegToRad()),
|
|---|
| 54 | fRawEl(rel*TMath::DegToRad()), fMag(-25)
|
|---|
| 55 | {
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | Double_t GetMag() const { return fMag; }
|
|---|
| 59 | Double_t GetResidual(Double_t *err=0) const
|
|---|
| 60 | {
|
|---|
| 61 | /*
|
|---|
| 62 | TVector3 v1, v2;
|
|---|
| 63 | v1.SetMagThetaPhi(1, TMath::Pi()/2-fRawEl, fRawAz);
|
|---|
| 64 | v2.SetMagThetaPhi(1, TMath::Pi()/2-fStarEl, fStarAz);
|
|---|
| 65 |
|
|---|
| 66 | return v1.Angle(v2)*TMath::RadToDeg();
|
|---|
| 67 | */
|
|---|
| 68 |
|
|---|
| 69 | const Double_t del = fRawEl-fStarEl;
|
|---|
| 70 | const Double_t daz = fRawAz-fStarAz;
|
|---|
| 71 |
|
|---|
| 72 | /*
|
|---|
| 73 | const Double_t dphi2 = daz/2.;
|
|---|
| 74 | const Double_t cos2 = cos(dphi2)*cos(dphi2);
|
|---|
| 75 | const Double_t sin2 = sin(dphi2)*sin(dphi2);
|
|---|
| 76 | const Double_t d = cos(del)*cos2 - cos(fRawEl+fStarEl)*sin2;
|
|---|
| 77 | */
|
|---|
| 78 | const Double_t d = cos(del) - cos(fRawEl)*cos(fStarEl)*(1.-cos(daz));
|
|---|
| 79 |
|
|---|
| 80 | if (err)
|
|---|
| 81 | {
|
|---|
| 82 | // Error of one pixel in the CCD
|
|---|
| 83 | const Double_t e1 = 32./3600*TMath::DegToRad() * 0.5;
|
|---|
| 84 |
|
|---|
| 85 | // Error of one SE unit
|
|---|
| 86 | const Double_t e2 = 360./16384*TMath::DegToRad() * 0.5;
|
|---|
| 87 |
|
|---|
| 88 | const Double_t e11 = sin(del)+cos(fRawEl)*sin(fStarEl)*(1-cos(daz));
|
|---|
| 89 | const Double_t e12 = cos(fRawEl)*cos(fStarEl)*sin(daz);
|
|---|
| 90 |
|
|---|
| 91 | const Double_t e21 = -sin(del)+sin(fRawEl)*cos(fStarEl)*(1-cos(daz));
|
|---|
| 92 | const Double_t e22 = -cos(fRawEl)*cos(fStarEl)*sin(daz);
|
|---|
| 93 |
|
|---|
| 94 | const Double_t err1 = sqrt(1-d*d);
|
|---|
| 95 | const Double_t err2 = (e11*e11 + e12*e12)*e1*e1;
|
|---|
| 96 | const Double_t err3 = (e21*e21 + e22*e22)*e2*e2;
|
|---|
| 97 |
|
|---|
| 98 | *err = sqrt(err2+err3)/err1 * TMath::RadToDeg();
|
|---|
| 99 | }
|
|---|
| 100 |
|
|---|
| 101 | const Double_t dist = acos(d);
|
|---|
| 102 | return dist * TMath::RadToDeg();
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | void operator=(Set &set)
|
|---|
| 106 | {
|
|---|
| 107 | fStarAz = set.fStarAz;
|
|---|
| 108 | fStarEl = set.fStarEl;
|
|---|
| 109 | fRawAz = set.fRawAz;
|
|---|
| 110 | fRawEl = set.fRawEl;
|
|---|
| 111 | fMag = set.fMag;
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | Double_t GetDEl() const { return (fRawEl-fStarEl)*TMath::RadToDeg(); }
|
|---|
| 115 | Double_t GetDZd() const { return -GetDEl(); }
|
|---|
| 116 | Double_t GetDAz() const { return (fRawAz-fStarAz)*TMath::RadToDeg(); }
|
|---|
| 117 | Double_t GetStarEl() const { return fStarEl*TMath::RadToDeg(); }
|
|---|
| 118 | Double_t GetStarZd() const { return 90.-fStarEl*TMath::RadToDeg(); }
|
|---|
| 119 | Double_t GetStarAz() const { return fStarAz*TMath::RadToDeg(); }
|
|---|
| 120 | Double_t GetRawEl() const { return fRawEl*TMath::RadToDeg(); }
|
|---|
| 121 | Double_t GetRawAz() const { return fRawAz*TMath::RadToDeg(); }
|
|---|
| 122 | Double_t GetRawZd() const { return 90.-fRawEl*TMath::RadToDeg(); }
|
|---|
| 123 |
|
|---|
| 124 | ZdAz GetStarZdAz() const { return ZdAz(TMath::Pi()/2-fStarEl, fStarAz); }
|
|---|
| 125 | AltAz GetStarAltAz() const { return AltAz(fStarEl, fStarAz); }
|
|---|
| 126 |
|
|---|
| 127 | ZdAz GetRawZdAz() const { return ZdAz(TMath::Pi()/2-fRawEl, fRawAz); }
|
|---|
| 128 | AltAz GetRawAltAz() const { return AltAz(fRawEl, fRawAz); }
|
|---|
| 129 |
|
|---|
| 130 | void AdjustEl(Double_t del) { fStarEl += del*TMath::DegToRad(); }
|
|---|
| 131 | void AdjustAz(Double_t daz) { fStarAz += daz*TMath::DegToRad(); }
|
|---|
| 132 |
|
|---|
| 133 | void Adjust(const MPointing &bend)
|
|---|
| 134 | {
|
|---|
| 135 | AltAz p = bend(GetStarAltAz());
|
|---|
| 136 | fStarEl = p.Alt();
|
|---|
| 137 | fStarAz = p.Az();
|
|---|
| 138 | }
|
|---|
| 139 | void AdjustBack(const MPointing &bend)
|
|---|
| 140 | {
|
|---|
| 141 | AltAz p = bend.CorrectBack(GetRawAltAz());
|
|---|
| 142 | fRawEl = p.Alt();
|
|---|
| 143 | fRawAz = p.Az();
|
|---|
| 144 | }
|
|---|
| 145 | ClassDef(Set, 0)
|
|---|
| 146 | };
|
|---|
| 147 |
|
|---|
| 148 | ClassImp(Set);
|
|---|
| 149 |
|
|---|
| 150 | ifstream &operator>>(ifstream &fin, Set &set)
|
|---|
| 151 | {
|
|---|
| 152 | TString str;
|
|---|
| 153 | do
|
|---|
| 154 | {
|
|---|
| 155 | str.ReadLine(fin);
|
|---|
| 156 | if (!fin)
|
|---|
| 157 | return fin;
|
|---|
| 158 | } while (str[0]=='#');
|
|---|
| 159 |
|
|---|
| 160 | Float_t v[4], mag;
|
|---|
| 161 | Int_t n = sscanf(str.Data(), "%f %f %f %f %*f %*f %*f %*f %*f %*f %f", v, v+1, v+2, v+3, &mag);
|
|---|
| 162 | if (n<4)
|
|---|
| 163 | {
|
|---|
| 164 | cout << "Read: ERROR - Not enough numbers" << endl;
|
|---|
| 165 | return fin;
|
|---|
| 166 | }
|
|---|
| 167 | set.fMag = n<5 ? -25 : mag;
|
|---|
| 168 |
|
|---|
| 169 | set.fStarAz = v[0]*TMath::DegToRad();
|
|---|
| 170 | set.fStarEl = v[1]*TMath::DegToRad();
|
|---|
| 171 |
|
|---|
| 172 | set.fRawAz = v[2]*TMath::DegToRad();
|
|---|
| 173 | set.fRawEl = v[3]*TMath::DegToRad();
|
|---|
| 174 |
|
|---|
| 175 | if (fin)
|
|---|
| 176 | {
|
|---|
| 177 | Double_t res, err;
|
|---|
| 178 | res = set.GetResidual(&err);
|
|---|
| 179 | cout << "Read: " << v[0] << " " << v[1] << " : " << v[2] << " " << v[3] << " : " << v[2]-v[0] << " " << v[3]-v[1] << " : " << res << " " << err << " " << err/res << endl;
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 | return fin;
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| 185 | class MFit : public TGMainFrame
|
|---|
| 186 | {
|
|---|
| 187 | private:
|
|---|
| 188 | enum {
|
|---|
| 189 | kTbFit = 19, //MPointing::GetNumPar(), // FIXME!!!
|
|---|
| 190 | kTbLoad,
|
|---|
| 191 | kTbSave,
|
|---|
| 192 | kTbLoadStars,
|
|---|
| 193 | kTbReset,
|
|---|
| 194 | kTbResetStars
|
|---|
| 195 | };
|
|---|
| 196 |
|
|---|
| 197 | MGList *fList;
|
|---|
| 198 |
|
|---|
| 199 | TList fOriginal;
|
|---|
| 200 | TList fCoordinates;
|
|---|
| 201 | TList fLabel;
|
|---|
| 202 |
|
|---|
| 203 | MPointing fBending;
|
|---|
| 204 |
|
|---|
| 205 | FontStruct_t fFont;
|
|---|
| 206 |
|
|---|
| 207 | void Fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
|
|---|
| 208 | {
|
|---|
| 209 | f = 0;
|
|---|
| 210 |
|
|---|
| 211 | MPointing bend;
|
|---|
| 212 | bend.SetParameters(par); // Set Parameters [deg] to MPointing
|
|---|
| 213 |
|
|---|
| 214 | for (int i=0; i<fCoordinates.GetSize(); i++)
|
|---|
| 215 | {
|
|---|
| 216 | Set set = *(Set*)fCoordinates.At(i);
|
|---|
| 217 |
|
|---|
| 218 | set.Adjust(bend);
|
|---|
| 219 |
|
|---|
| 220 | Double_t err = 0.01; // [deg] = 0.25SE
|
|---|
| 221 | Double_t res = set.GetResidual(); //(&err);
|
|---|
| 222 | res /= err;
|
|---|
| 223 |
|
|---|
| 224 | f += res*res;
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|
| 227 | f /= fCoordinates.GetSize();
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | static void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
|
|---|
| 231 | {
|
|---|
| 232 | ((MFit*)gMinuit->GetObjectFit())->Fcn(npar, gin, f, par, iflag);
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 | void DrawMarker(TVirtualPad *pad, Double_t r0, Double_t phi0)
|
|---|
| 236 | {
|
|---|
| 237 | TView *view = pad->GetView();
|
|---|
| 238 |
|
|---|
| 239 | if (!view)
|
|---|
| 240 | {
|
|---|
| 241 | cout << "No View!" << endl;
|
|---|
| 242 | return;
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 | TMarker mark0;
|
|---|
| 246 | mark0.SetMarkerStyle(kFullDotLarge);
|
|---|
| 247 | mark0.SetMarkerColor(kBlue);
|
|---|
| 248 |
|
|---|
| 249 | r0 /= 90;
|
|---|
| 250 | phi0 *= TMath::DegToRad();
|
|---|
| 251 |
|
|---|
| 252 | Double_t x[6] = { r0*cos(phi0), r0*sin(phi0), 0, 0, 0, 0};
|
|---|
| 253 |
|
|---|
| 254 | view->WCtoNDC(x, x+3);
|
|---|
| 255 |
|
|---|
| 256 | mark0.DrawMarker(-x[3], x[4]);
|
|---|
| 257 | }
|
|---|
| 258 |
|
|---|
| 259 | void DrawPolLine(TVirtualPad *pad, Double_t r0, Double_t phi0, Double_t r1, Double_t phi1)
|
|---|
| 260 | {
|
|---|
| 261 | TView *view = pad->GetView();
|
|---|
| 262 |
|
|---|
| 263 | if (!view)
|
|---|
| 264 | {
|
|---|
| 265 | cout << "No View!" << endl;
|
|---|
| 266 | return;
|
|---|
| 267 | }
|
|---|
| 268 | /*
|
|---|
| 269 | if (r0<0)
|
|---|
| 270 | {
|
|---|
| 271 | r0 = -r0;
|
|---|
| 272 | phi0 += 180;
|
|---|
| 273 | }
|
|---|
| 274 | if (r1<0)
|
|---|
| 275 | {
|
|---|
| 276 | r1 = -r1;
|
|---|
| 277 | phi1 += 180;
|
|---|
| 278 | }
|
|---|
| 279 |
|
|---|
| 280 | phi0 = fmod(phi0+360, 360);
|
|---|
| 281 | phi1 = fmod(phi1+360, 360);
|
|---|
| 282 |
|
|---|
| 283 | if (phi1-phi0<-180)
|
|---|
| 284 | phi1+=360;
|
|---|
| 285 | */
|
|---|
| 286 | TLine line;
|
|---|
| 287 | line.SetLineWidth(2);
|
|---|
| 288 | line.SetLineColor(kBlue);
|
|---|
| 289 |
|
|---|
| 290 | Double_t p0 = phi0<phi1?phi0:phi1;
|
|---|
| 291 | Double_t p1 = phi0<phi1?phi1:phi0;
|
|---|
| 292 |
|
|---|
| 293 | if (phi0>phi1)
|
|---|
| 294 | {
|
|---|
| 295 | Double_t d = r1;
|
|---|
| 296 | r1 = r0;
|
|---|
| 297 | r0 = d;
|
|---|
| 298 | }
|
|---|
| 299 |
|
|---|
| 300 | r0 /= 90;
|
|---|
| 301 | r1 /= 90;
|
|---|
| 302 |
|
|---|
| 303 | Double_t dr = r1-r0;
|
|---|
| 304 | Double_t dp = p1-p0;
|
|---|
| 305 |
|
|---|
| 306 | Double_t x0[3] = { r0*cos(p0*TMath::DegToRad()), r0*sin(p0*TMath::DegToRad()), 0};
|
|---|
| 307 |
|
|---|
| 308 | for (double i=p0+10; i<p1+10; i+=10)
|
|---|
| 309 | {
|
|---|
| 310 | if (i>p1)
|
|---|
| 311 | i=p1;
|
|---|
| 312 |
|
|---|
| 313 | Double_t r = dr/dp*(i-p0)+r0;
|
|---|
| 314 | Double_t p = TMath::DegToRad()*i;
|
|---|
| 315 |
|
|---|
| 316 | Double_t x1[3] = { r*cos(p), r*sin(p), 0};
|
|---|
| 317 |
|
|---|
| 318 | Double_t y0[3], y1[3];
|
|---|
| 319 |
|
|---|
| 320 | view->WCtoNDC(x0, y0);
|
|---|
| 321 | view->WCtoNDC(x1, y1);
|
|---|
| 322 |
|
|---|
| 323 | line.DrawLine(y0[0], y0[1], y1[0], y1[1]);
|
|---|
| 324 |
|
|---|
| 325 | x0[0] = x1[0];
|
|---|
| 326 | x0[1] = x1[1];
|
|---|
| 327 | }
|
|---|
| 328 | }
|
|---|
| 329 |
|
|---|
| 330 | void DrawSet(TVirtualPad *pad, Set &set, Float_t scale=-1, Float_t angle=0)
|
|---|
| 331 | {
|
|---|
| 332 | Double_t r0 = set.GetRawZd();
|
|---|
| 333 | Double_t phi0 = set.GetRawAz()-angle;
|
|---|
| 334 | Double_t r1 = set.GetStarZd();
|
|---|
| 335 | Double_t phi1 = set.GetStarAz()-angle;
|
|---|
| 336 |
|
|---|
| 337 | if (r0<0)
|
|---|
| 338 | {
|
|---|
| 339 | r0 = -r0;
|
|---|
| 340 | phi0 += 180;
|
|---|
| 341 | }
|
|---|
| 342 | if (r1<0)
|
|---|
| 343 | {
|
|---|
| 344 | r1 = -r1;
|
|---|
| 345 | phi1 += 180;
|
|---|
| 346 | }
|
|---|
| 347 |
|
|---|
| 348 | phi0 = fmod(phi0+360, 360);
|
|---|
| 349 | phi1 = fmod(phi1+360, 360);
|
|---|
| 350 |
|
|---|
| 351 | if (phi1-phi0<-180)
|
|---|
| 352 | phi1+=360;
|
|---|
| 353 |
|
|---|
| 354 | if (scale<0 || scale>1000)
|
|---|
| 355 | scale = -1;
|
|---|
| 356 |
|
|---|
| 357 | if (scale>0)
|
|---|
| 358 | {
|
|---|
| 359 | Double_t d = r1-r0;
|
|---|
| 360 | r0 += scale*d;
|
|---|
| 361 | r1 -= scale*d;
|
|---|
| 362 | d = phi1-phi0;
|
|---|
| 363 | phi0 += scale*d;
|
|---|
| 364 | phi1 -= scale*d;
|
|---|
| 365 |
|
|---|
| 366 | DrawPolLine(pad, r0, phi0, r1, phi1);
|
|---|
| 367 | DrawMarker(pad, r0, phi0);
|
|---|
| 368 | }
|
|---|
| 369 | else
|
|---|
| 370 | DrawMarker(pad, r1, phi1);
|
|---|
| 371 | }
|
|---|
| 372 |
|
|---|
| 373 | void DrawHorizon(TVirtualPad *pad, const char *fname="horizon.dat") const
|
|---|
| 374 | {
|
|---|
| 375 | TView *view = pad->GetView();
|
|---|
| 376 |
|
|---|
| 377 | if (!view)
|
|---|
| 378 | {
|
|---|
| 379 | cout << "No View!" << endl;
|
|---|
| 380 | return;
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | ifstream fin("horizon.dat");
|
|---|
| 384 | if (!fin)
|
|---|
| 385 | {
|
|---|
| 386 | cout << "ERROR - horizon.dat not found." << endl;
|
|---|
| 387 | return;
|
|---|
| 388 | }
|
|---|
| 389 |
|
|---|
| 390 | TPolyLine poly;
|
|---|
| 391 | poly.SetLineWidth(2);
|
|---|
| 392 | poly.SetLineColor(12);
|
|---|
| 393 | poly.SetLineStyle(8);
|
|---|
| 394 |
|
|---|
| 395 | while (1)
|
|---|
| 396 | {
|
|---|
| 397 | TString line;
|
|---|
| 398 | line.ReadLine(fin);
|
|---|
| 399 | if (!fin)
|
|---|
| 400 | break;
|
|---|
| 401 |
|
|---|
| 402 | Float_t az, alt;
|
|---|
| 403 | sscanf(line.Data(), "%f %f", &az, &alt);
|
|---|
| 404 |
|
|---|
| 405 | Float_t zd = 90-alt;
|
|---|
| 406 |
|
|---|
| 407 | az *= TMath::DegToRad();
|
|---|
| 408 | zd /= 90;
|
|---|
| 409 |
|
|---|
| 410 | Double_t x[6] = { zd*cos(az), zd*sin(az), 0, 0, 0, 0};
|
|---|
| 411 | view->WCtoNDC(x, x+3);
|
|---|
| 412 | poly.SetNextPoint(-x[3], x[4]);
|
|---|
| 413 | }
|
|---|
| 414 |
|
|---|
| 415 | poly.DrawClone()->SetBit(kCanDelete);
|
|---|
| 416 |
|
|---|
| 417 | }
|
|---|
| 418 |
|
|---|
| 419 | void Fit(Double_t &before, Double_t &after, Double_t &backw)
|
|---|
| 420 | {
|
|---|
| 421 | if (fOriginal.GetSize()==0)
|
|---|
| 422 | {
|
|---|
| 423 | cout << "Sorry, no input data loaded..." << endl;
|
|---|
| 424 | return;
|
|---|
| 425 | }
|
|---|
| 426 |
|
|---|
| 427 | fCoordinates.Delete();
|
|---|
| 428 | for (int i=0; i<fOriginal.GetSize(); i++)
|
|---|
| 429 | fCoordinates.Add(new Set(*(Set*)fOriginal.At(i)));
|
|---|
| 430 |
|
|---|
| 431 | cout << "-----------------------------------------------------------------------" << endl;
|
|---|
| 432 |
|
|---|
| 433 | gStyle->SetOptStat("emro");
|
|---|
| 434 |
|
|---|
| 435 | TH1F hres1("Res1", " Residuals before correction ", fOriginal.GetSize()/3, 0, 0.3);
|
|---|
| 436 | TH1F hres2("Res2", " Residuals after correction ", fOriginal.GetSize()/3, 0, 0.3);
|
|---|
| 437 | TH1F hres3("Res3", " Residuals after backward correction ", fOriginal.GetSize()/3, 0, 0.3);
|
|---|
| 438 |
|
|---|
| 439 | TProfile proaz ("ProAz", " \\Delta profile vs. Az", 48, -180, 180);
|
|---|
| 440 | TProfile prozd ("ProZd", " \\Delta profile vs. Zd", 60, 0, 90);
|
|---|
| 441 | TProfile promag("ProMag", " \\Delta profile vs. Mag", 40, 1, 4);
|
|---|
| 442 |
|
|---|
| 443 | hres1.SetXTitle("\\Delta [\\circ]");
|
|---|
| 444 | hres1.SetYTitle("Counts");
|
|---|
| 445 |
|
|---|
| 446 | hres2.SetXTitle("\\Delta [\\circ]");
|
|---|
| 447 | hres2.SetYTitle("Counts");
|
|---|
| 448 |
|
|---|
| 449 | hres3.SetXTitle("\\Delta [\\circ]");
|
|---|
| 450 | hres3.SetYTitle("Counts");
|
|---|
| 451 |
|
|---|
| 452 | TGraph gdaz;
|
|---|
| 453 | TGraph gdzd;
|
|---|
| 454 | TGraph gaz;
|
|---|
| 455 | TGraph gzd;
|
|---|
| 456 | TGraphErrors graz;
|
|---|
| 457 | TGraphErrors grzd;
|
|---|
| 458 | TGraphErrors grmag;
|
|---|
| 459 | TGraph gmaz;
|
|---|
| 460 | TGraph gmzd;
|
|---|
| 461 |
|
|---|
| 462 | gdaz.SetTitle(" \\Delta Az vs. Zd ");
|
|---|
| 463 | gdzd.SetTitle(" \\Delta Zd vs. Az ");
|
|---|
| 464 |
|
|---|
| 465 | gaz.SetTitle(" \\Delta Az vs. Az ");
|
|---|
| 466 | gzd.SetTitle(" \\Delta Zd vs. Zd ");
|
|---|
| 467 |
|
|---|
| 468 | gmaz.SetTitle(" \\Delta Az vs. Mag ");
|
|---|
| 469 | gmzd.SetTitle(" \\Delta Zd vs. Mag ");
|
|---|
| 470 |
|
|---|
| 471 | graz.SetTitle(" \\Delta vs. Az ");
|
|---|
| 472 | grzd.SetTitle(" \\Delta vs. Zd ");
|
|---|
| 473 | grmag.SetTitle(" \\Delta vs. Mag ");
|
|---|
| 474 |
|
|---|
| 475 | TMinuit minuit(MPointing::GetNumPar()); //initialize TMinuit with a maximum of 5 params
|
|---|
| 476 | minuit.SetObjectFit(this);
|
|---|
| 477 | minuit.SetPrintLevel(-1);
|
|---|
| 478 | minuit.SetFCN(fcn);
|
|---|
| 479 |
|
|---|
| 480 | fBending.SetMinuitParameters(minuit, MPointing::GetNumPar()); // Init Parameters [deg]
|
|---|
| 481 |
|
|---|
| 482 | for (int i=0; i<MPointing::GetNumPar(); i++)
|
|---|
| 483 | {
|
|---|
| 484 | TGButton *l = (TGButton*)fList->FindWidget(i);
|
|---|
| 485 | minuit.FixParameter(i);
|
|---|
| 486 | if (l->GetState()==kButtonDown)
|
|---|
| 487 | minuit.Release(i);
|
|---|
| 488 | }
|
|---|
| 489 |
|
|---|
| 490 | //minuit.Command("SHOW PARAMETERS");
|
|---|
| 491 | //minuit.Command("SHOW LIMITS");
|
|---|
| 492 |
|
|---|
| 493 | cout << endl;
|
|---|
| 494 | cout << "Starting fit..." << endl;
|
|---|
| 495 | cout << "For the fit an measurement error in the residual of ";
|
|---|
| 496 | cout << "0.02deg (=1SE) is assumed." << endl;
|
|---|
| 497 | cout << endl;
|
|---|
| 498 |
|
|---|
| 499 | Int_t ierflg = 0;
|
|---|
| 500 | ierflg = minuit.Migrad();
|
|---|
| 501 | cout << "Migrad returns " << ierflg << endl;
|
|---|
| 502 | // minuit.Release(2);
|
|---|
| 503 | ierflg = minuit.Migrad();
|
|---|
| 504 | cout << "Migrad returns " << ierflg << endl << endl;
|
|---|
| 505 |
|
|---|
| 506 | //
|
|---|
| 507 | // Get Fit Results
|
|---|
| 508 | //
|
|---|
| 509 | fBending.GetMinuitParameters(minuit);
|
|---|
| 510 | fBending.PrintMinuitParameters(minuit);
|
|---|
| 511 | //fBending.Save("bending_magic.txt");
|
|---|
| 512 |
|
|---|
| 513 |
|
|---|
| 514 | //
|
|---|
| 515 | // Make a copy of all list entries
|
|---|
| 516 | //
|
|---|
| 517 | TList list;
|
|---|
| 518 | list.SetOwner();
|
|---|
| 519 | for (int i=0; i<fCoordinates.GetSize(); i++)
|
|---|
| 520 | list.Add(new Set(*(Set*)fCoordinates.At(i)));
|
|---|
| 521 |
|
|---|
| 522 | //
|
|---|
| 523 | // Correct for Offsets only
|
|---|
| 524 | //
|
|---|
| 525 | TArrayD par;
|
|---|
| 526 | fBending.GetParameters(par);
|
|---|
| 527 | for (int i=2; i<MPointing::GetNumPar(); i++)
|
|---|
| 528 | par[i]=0;
|
|---|
| 529 |
|
|---|
| 530 | MPointing b2;
|
|---|
| 531 | b2.SetParameters(par);
|
|---|
| 532 |
|
|---|
| 533 | //
|
|---|
| 534 | // Calculate correction and residuals
|
|---|
| 535 | //
|
|---|
| 536 | for (int i=0; i<fCoordinates.GetSize(); i++)
|
|---|
| 537 | {
|
|---|
| 538 | Set &set0 = *(Set*)fCoordinates.At(i);
|
|---|
| 539 |
|
|---|
| 540 | ZdAz za(set0.GetStarZdAz());
|
|---|
| 541 | za *=kRad2Deg;
|
|---|
| 542 |
|
|---|
| 543 | //
|
|---|
| 544 | // Correct for offsets only
|
|---|
| 545 | //
|
|---|
| 546 | Set set1(set0);
|
|---|
| 547 | set1.Adjust(b2);
|
|---|
| 548 |
|
|---|
| 549 | hres1.Fill(set1.GetResidual());
|
|---|
| 550 |
|
|---|
| 551 | set0.Adjust(fBending);
|
|---|
| 552 | hres2.Fill(set0.GetResidual());
|
|---|
| 553 |
|
|---|
| 554 | Double_t dz = fmod(set0.GetDAz()+720, 360);
|
|---|
| 555 | if (dz>180)
|
|---|
| 556 | dz -= 360;
|
|---|
| 557 |
|
|---|
| 558 | Double_t err;
|
|---|
| 559 |
|
|---|
| 560 | gdzd.SetPoint(i, za.Az(), set0.GetDZd());
|
|---|
| 561 | gdaz.SetPoint(i, za.Zd(), dz);
|
|---|
| 562 | graz.SetPoint(i, za.Az(), set0.GetResidual(&err));
|
|---|
| 563 | graz.SetPointError(i, 0, err);
|
|---|
| 564 | grzd.SetPoint(i, za.Zd(), set0.GetResidual(&err));
|
|---|
| 565 | grzd.SetPointError(i, 0, err);
|
|---|
| 566 |
|
|---|
| 567 | proaz.Fill(za.Az(), set0.GetResidual(&err));
|
|---|
| 568 | prozd.Fill(za.Zd(), set0.GetResidual(&err));
|
|---|
| 569 | promag.Fill(set0.GetMag(), set0.GetResidual(&err));
|
|---|
| 570 |
|
|---|
| 571 | gaz.SetPoint( i, za.Az(), dz);
|
|---|
| 572 | gzd.SetPoint( i, za.Zd(), set0.GetDZd());
|
|---|
| 573 | if (set0.GetMag()>=-20)
|
|---|
| 574 | {
|
|---|
| 575 | grmag.SetPoint(i, set0.GetMag(), set0.GetResidual(&err));
|
|---|
| 576 | grmag.SetPointError(i, 0, err);
|
|---|
| 577 | gmaz.SetPoint( i, set0.GetMag(), dz);
|
|---|
| 578 | gmzd.SetPoint( i, set0.GetMag(), set0.GetDZd());
|
|---|
| 579 | }
|
|---|
| 580 | }
|
|---|
| 581 |
|
|---|
| 582 | //
|
|---|
| 583 | // Check for overflows
|
|---|
| 584 | //
|
|---|
| 585 | const Stat_t ov = hres2.GetBinContent(hres2.GetNbinsX()+1);
|
|---|
| 586 | if (ov>0)
|
|---|
| 587 | cout << "WARNING: " << ov << " overflows in residuals." << endl;
|
|---|
| 588 |
|
|---|
| 589 |
|
|---|
| 590 |
|
|---|
| 591 | cout << dec << endl;
|
|---|
| 592 | cout << " Number of calls to FCN: " << minuit.fNfcn << endl;
|
|---|
| 593 | cout << "Minimum value found for FCN (Chi^2?): " << minuit.fAmin << endl;
|
|---|
| 594 | cout << " Fit-Probability(?): " << TMath::Prob(minuit.fAmin/*fOriginal.GetSize()*/, fOriginal.GetSize()-minuit.GetNumFreePars())*100 << "%" << endl;
|
|---|
| 595 | cout << " Chi^2/NDF: " << minuit.fAmin/(fOriginal.GetSize()-minuit.GetNumFreePars()) << endl;
|
|---|
| 596 | //cout << "Prob(?): " << TMath::Prob(fChisquare,ndf);
|
|---|
| 597 |
|
|---|
| 598 |
|
|---|
| 599 |
|
|---|
| 600 | //
|
|---|
| 601 | // Print all data sets for which the backward correction is
|
|---|
| 602 | // twice times worse than the residual gotten from the
|
|---|
| 603 | // bending correction itself
|
|---|
| 604 | //
|
|---|
| 605 | cout << endl;
|
|---|
| 606 | cout << "Checking backward correction (raw-->star):" << endl;
|
|---|
| 607 | for (int i=0; i<fCoordinates.GetSize(); i++)
|
|---|
| 608 | {
|
|---|
| 609 | Set set0(*(Set*)list.At(i));
|
|---|
| 610 | Set &set1 = *(Set*)list.At(i);
|
|---|
| 611 |
|
|---|
| 612 | set0.AdjustBack(fBending);
|
|---|
| 613 | set1.Adjust(fBending);
|
|---|
| 614 |
|
|---|
| 615 | const Double_t res0 = set0.GetResidual();
|
|---|
| 616 | const Double_t res1 = set1.GetResidual();
|
|---|
| 617 | const Double_t diff = TMath::Abs(res0-res1);
|
|---|
| 618 |
|
|---|
| 619 | hres3.Fill(res0);
|
|---|
| 620 |
|
|---|
| 621 | if (diff<hres2.GetMean()*0.66)
|
|---|
| 622 | continue;
|
|---|
| 623 |
|
|---|
| 624 | cout << "DBack: " << setw(6) << set0.GetStarZd() << " " << setw(7) << set0.GetStarAz() << ": ";
|
|---|
| 625 | cout << "ResB="<< setw(7) << res0*60 << " ResF=" << setw(7) << res1*60 << " |ResB-ResF|=" << setw(7) << diff*60 << " arcmin" << endl;
|
|---|
| 626 | }
|
|---|
| 627 | cout << "OK." << endl;
|
|---|
| 628 | cout << endl;
|
|---|
| 629 |
|
|---|
| 630 | const Double_t max1 = TMath::Max(gaz.GetHistogram()->GetMaximum(), gdaz.GetHistogram()->GetMaximum());
|
|---|
| 631 | const Double_t max2 = TMath::Max(gzd.GetHistogram()->GetMaximum(), gdzd.GetHistogram()->GetMaximum());
|
|---|
| 632 | const Double_t max3 = TMath::Max(grzd.GetHistogram()->GetMaximum(), graz.GetHistogram()->GetMaximum());
|
|---|
| 633 |
|
|---|
| 634 | const Double_t min1 = TMath::Min(gaz.GetHistogram()->GetMinimum(), gdaz.GetHistogram()->GetMinimum());
|
|---|
| 635 | const Double_t min2 = TMath::Min(gzd.GetHistogram()->GetMinimum(), gdzd.GetHistogram()->GetMinimum());
|
|---|
| 636 | const Double_t min3 = TMath::Min(grzd.GetHistogram()->GetMinimum(), graz.GetHistogram()->GetMinimum());
|
|---|
| 637 |
|
|---|
| 638 | const Double_t absmax1 = TMath::Max(max1, TMath::Abs(min1));
|
|---|
| 639 | const Double_t absmax2 = TMath::Max(max2, TMath::Abs(min2));
|
|---|
| 640 | const Double_t absmax3 = TMath::Max(max3, TMath::Abs(min3));
|
|---|
| 641 |
|
|---|
| 642 | gaz.SetMaximum(absmax1);
|
|---|
| 643 | gzd.SetMaximum(absmax2);
|
|---|
| 644 | gdaz.SetMaximum(absmax1);
|
|---|
| 645 | gdzd.SetMaximum(absmax2);
|
|---|
| 646 | gmaz.SetMaximum(absmax1);
|
|---|
| 647 | gmzd.SetMaximum(absmax2);
|
|---|
| 648 | graz.SetMaximum(absmax3);
|
|---|
| 649 | grzd.SetMaximum(absmax3);
|
|---|
| 650 | grmag.SetMaximum(absmax3);
|
|---|
| 651 | gaz.SetMinimum(-absmax1);
|
|---|
| 652 | gzd.SetMinimum(-absmax2);
|
|---|
| 653 | gdaz.SetMinimum(-absmax1);
|
|---|
| 654 | gdzd.SetMinimum(-absmax2);
|
|---|
| 655 | gmaz.SetMinimum(-absmax1);
|
|---|
| 656 | gmzd.SetMinimum(-absmax2);
|
|---|
| 657 | graz.SetMinimum(0);
|
|---|
| 658 | grzd.SetMinimum(0);
|
|---|
| 659 | grmag.SetMinimum(0);
|
|---|
| 660 |
|
|---|
| 661 | TCanvas *c1;
|
|---|
| 662 |
|
|---|
| 663 | if (gROOT->FindObject("CanvGraphs"))
|
|---|
| 664 | c1 = dynamic_cast<TCanvas*>(gROOT->FindObject("CanvGraphs"));
|
|---|
| 665 | else
|
|---|
| 666 | c1=new TCanvas("CanvGraphs", "Graphs");
|
|---|
| 667 |
|
|---|
| 668 | gROOT->SetSelectedPad(0);
|
|---|
| 669 | c1->SetSelectedPad(0);
|
|---|
| 670 | c1->SetBorderMode(0);
|
|---|
| 671 | c1->SetFrameBorderMode(0);
|
|---|
| 672 | c1->Clear();
|
|---|
| 673 |
|
|---|
| 674 | c1->SetFillColor(kWhite);
|
|---|
| 675 | #ifndef PRESENTATION
|
|---|
| 676 | c1->Divide(3,3,1e-10,1e-10);
|
|---|
| 677 | #else
|
|---|
| 678 | c1->Divide(2,2,1e-10,1e-10);
|
|---|
| 679 | #endif
|
|---|
| 680 | c1->SetFillColor(kWhite);
|
|---|
| 681 |
|
|---|
| 682 | TGraph *g=0;
|
|---|
| 683 |
|
|---|
| 684 | TLine line;
|
|---|
| 685 | line.SetLineColor(kGreen);
|
|---|
| 686 | line.SetLineWidth(2);
|
|---|
| 687 | #ifndef PRESENTATION
|
|---|
| 688 | c1->cd(1);
|
|---|
| 689 | gPad->SetBorderMode(0);
|
|---|
| 690 | gPad->SetFrameBorderMode(0);
|
|---|
| 691 | gPad->SetGridx();
|
|---|
| 692 | gPad->SetGridy();
|
|---|
| 693 | g=(TGraph*)gaz.DrawClone("A*");
|
|---|
| 694 | g->SetBit(kCanDelete);
|
|---|
| 695 | g->GetHistogram()->SetXTitle("Az [\\circ]");
|
|---|
| 696 | g->GetHistogram()->SetYTitle("\\Delta Az [\\circ]");
|
|---|
| 697 |
|
|---|
| 698 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 699 | line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
|
|---|
| 700 |
|
|---|
| 701 | c1->cd(2);
|
|---|
| 702 | gPad->SetBorderMode(0);
|
|---|
| 703 | gPad->SetFrameBorderMode(0);
|
|---|
| 704 | gPad->SetGridx();
|
|---|
| 705 | gPad->SetGridy();
|
|---|
| 706 | g=(TGraph*)gdaz.DrawClone("A*");
|
|---|
| 707 | g->SetBit(kCanDelete);
|
|---|
| 708 | g->GetHistogram()->SetXTitle("Zd [\\circ]");
|
|---|
| 709 | g->GetHistogram()->SetYTitle("\\Delta Az [\\circ]");
|
|---|
| 710 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 711 | line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
|
|---|
| 712 | cout << "Mean dAz: " << g->GetMean(2) << " \xb1 " << g->GetRMS(2) << endl;
|
|---|
| 713 |
|
|---|
| 714 | c1->cd(3);
|
|---|
| 715 | gPad->SetBorderMode(0);
|
|---|
| 716 | gPad->SetFrameBorderMode(0);
|
|---|
| 717 | gPad->SetGridx();
|
|---|
| 718 | gPad->SetGridy();
|
|---|
| 719 | if (gmaz.GetN()>0)
|
|---|
| 720 | {
|
|---|
| 721 | g=(TGraph*)gmaz.DrawClone("A*");
|
|---|
| 722 | g->SetBit(kCanDelete);
|
|---|
| 723 | g->GetHistogram()->SetXTitle("Mag");
|
|---|
| 724 | g->GetHistogram()->SetYTitle("\\Delta Az [\\circ]");
|
|---|
| 725 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 726 | line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
|
|---|
| 727 | }
|
|---|
| 728 | #endif
|
|---|
| 729 |
|
|---|
| 730 | #ifndef PRESENTATION
|
|---|
| 731 | c1->cd(4);
|
|---|
| 732 | #else
|
|---|
| 733 | c1->cd(1);
|
|---|
| 734 | #endif
|
|---|
| 735 | gPad->SetBorderMode(0);
|
|---|
| 736 | gPad->SetFrameBorderMode(0);
|
|---|
| 737 | gPad->SetGridx();
|
|---|
| 738 | gPad->SetGridy();
|
|---|
| 739 | g=(TGraph*)gdzd.DrawClone("A*");
|
|---|
| 740 | g->SetBit(kCanDelete);
|
|---|
| 741 | g->GetHistogram()->SetXTitle("Az [\\circ]");
|
|---|
| 742 | g->GetHistogram()->SetYTitle("\\Delta Zd [\\circ]");
|
|---|
| 743 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 744 | line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
|
|---|
| 745 | cout << "Mean dZd: " << g->GetMean(2) << " \xb1 " << g->GetRMS(2) << endl;
|
|---|
| 746 | cout << endl;
|
|---|
| 747 |
|
|---|
| 748 | #ifndef PRESENTATION
|
|---|
| 749 | c1->cd(5);
|
|---|
| 750 | #else
|
|---|
| 751 | c1->cd(2);
|
|---|
| 752 | #endif
|
|---|
| 753 | gPad->SetBorderMode(0);
|
|---|
| 754 | gPad->SetFrameBorderMode(0);
|
|---|
| 755 | gPad->SetGridx();
|
|---|
| 756 | gPad->SetGridy();
|
|---|
| 757 | g=(TGraph*)gzd.DrawClone("A*");
|
|---|
| 758 | g->SetBit(kCanDelete);
|
|---|
| 759 | g->GetHistogram()->SetXTitle("Zd [\\circ]");
|
|---|
| 760 | g->GetHistogram()->SetYTitle("\\Delta Zd [\\circ]");
|
|---|
| 761 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 762 | line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
|
|---|
| 763 | #ifndef PRESENTATION
|
|---|
| 764 | c1->cd(6);
|
|---|
| 765 | gPad->SetBorderMode(0);
|
|---|
| 766 | gPad->SetFrameBorderMode(0);
|
|---|
| 767 | gPad->SetGridx();
|
|---|
| 768 | gPad->SetGridy();
|
|---|
| 769 | if (gmzd.GetN()>0)
|
|---|
| 770 | {
|
|---|
| 771 | g=(TGraph*)gmzd.DrawClone("A*");
|
|---|
| 772 | g->SetBit(kCanDelete);
|
|---|
| 773 | g->GetHistogram()->SetXTitle("Mag");
|
|---|
| 774 | g->GetHistogram()->SetYTitle("\\Delta Zd [\\circ]");
|
|---|
| 775 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 776 | line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
|
|---|
| 777 | }
|
|---|
| 778 | #endif
|
|---|
| 779 |
|
|---|
| 780 | #ifndef PRESENTATION
|
|---|
| 781 | c1->cd(7);
|
|---|
| 782 | #else
|
|---|
| 783 | c1->cd(3);
|
|---|
| 784 | #endif
|
|---|
| 785 | gPad->SetBorderMode(0);
|
|---|
| 786 | gPad->SetFrameBorderMode(0);
|
|---|
| 787 | gPad->SetGridx();
|
|---|
| 788 | gPad->SetGridy();
|
|---|
| 789 | g=(TGraph*)graz.DrawClone("AP");
|
|---|
| 790 | g->SetBit(kCanDelete);
|
|---|
| 791 | g->GetHistogram()->SetXTitle("Az [\\circ]");
|
|---|
| 792 | g->GetHistogram()->SetYTitle("\\Delta [\\circ]");
|
|---|
| 793 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 794 |
|
|---|
| 795 | proaz.SetLineWidth(2);
|
|---|
| 796 | proaz.SetLineColor(kBlue);
|
|---|
| 797 | proaz.SetMarkerColor(kBlue);
|
|---|
| 798 | proaz.DrawCopy("pc hist same");
|
|---|
| 799 |
|
|---|
| 800 | #ifndef PRESENTATION
|
|---|
| 801 | c1->cd(8);
|
|---|
| 802 | #else
|
|---|
| 803 | c1->cd(4);
|
|---|
| 804 | #endif
|
|---|
| 805 | gPad->SetBorderMode(0);
|
|---|
| 806 | gPad->SetFrameBorderMode(0);
|
|---|
| 807 | gPad->SetGridx();
|
|---|
| 808 | gPad->SetGridy();
|
|---|
| 809 | g=(TGraph*)grzd.DrawClone("AP");
|
|---|
| 810 | g->SetBit(kCanDelete);
|
|---|
| 811 | g->GetHistogram()->SetXTitle("Zd [\\circ]");
|
|---|
| 812 | g->GetHistogram()->SetYTitle("\\Delta [\\circ]");
|
|---|
| 813 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 814 |
|
|---|
| 815 | prozd.SetLineWidth(2);
|
|---|
| 816 | prozd.SetLineColor(kBlue);
|
|---|
| 817 | prozd.SetMarkerColor(kBlue);
|
|---|
| 818 | prozd.DrawCopy("pc hist same");
|
|---|
| 819 |
|
|---|
| 820 | #ifndef PRESENTATION
|
|---|
| 821 | c1->cd(9);
|
|---|
| 822 | gPad->SetBorderMode(0);
|
|---|
| 823 | gPad->SetFrameBorderMode(0);
|
|---|
| 824 | gPad->SetGridx();
|
|---|
| 825 | gPad->SetGridy();
|
|---|
| 826 | if (grmag.GetN()>0)
|
|---|
| 827 | {
|
|---|
| 828 | g=(TGraph*)grmag.DrawClone("AP");
|
|---|
| 829 | g->SetBit(kCanDelete);
|
|---|
| 830 | g->GetHistogram()->SetXTitle("Mag");
|
|---|
| 831 | g->GetHistogram()->SetYTitle("\\Delta [\\circ]");
|
|---|
| 832 | line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
|
|---|
| 833 | }
|
|---|
| 834 | promag.SetLineWidth(2);
|
|---|
| 835 | promag.SetLineColor(kBlue);
|
|---|
| 836 | promag.SetMarkerColor(kBlue);
|
|---|
| 837 | promag.DrawCopy("pc hist same");
|
|---|
| 838 | #endif
|
|---|
| 839 |
|
|---|
| 840 | //
|
|---|
| 841 | // Print out the residual before and after correction in several
|
|---|
| 842 | // units
|
|---|
| 843 | //
|
|---|
| 844 | cout << fCoordinates.GetSize() << " data sets." << endl << endl;
|
|---|
| 845 | cout << "Total Spread of Residual:" << endl;
|
|---|
| 846 | cout << "-------------------------" << endl;
|
|---|
| 847 | cout << "before: " << Form("%6.4f", hres1.GetMean()) << " \xb1 " << Form("%6.4f", hres1.GetRMS()) << " deg \t";
|
|---|
| 848 | cout << "before: " << Form("%4.1f", hres1.GetMean()*60) << " \xb1 " << Form("%.1f", hres1.GetRMS()*60) << " arcmin" << endl;
|
|---|
| 849 | cout << "after: " << Form("%6.4f", hres2.GetMean()) << " \xb1 " << Form("%6.4f", hres2.GetRMS()) << " deg \t";
|
|---|
| 850 | cout << "after: " << Form("%4.1f", hres2.GetMean()*60) << " \xb1 " << Form("%.1f", hres2.GetRMS()*60) << " arcmin" << endl;
|
|---|
| 851 | cout << "backw: " << Form("%6.4f", hres3.GetMean()) << " \xb1 " << Form("%6.4f", hres3.GetRMS()) << " deg \t";
|
|---|
| 852 | cout << "backw: " << Form("%4.1f", hres3.GetMean()*60) << " \xb1 " << Form("%.1f", hres3.GetRMS()*60) << " arcmin" << endl;
|
|---|
| 853 | cout << endl;
|
|---|
| 854 | cout << "before: " << Form("%4.1f", hres1.GetMean()*16348/360) << " \xb1 " << Form("%.1f", hres1.GetRMS()*16384/360) << " SE \t\t";
|
|---|
| 855 | cout << "before: " << Form("%4.1f", hres1.GetMean()*60*60/23.4) << " \xb1 " << Form("%.1f", hres1.GetRMS()*60*60/23.4) << " pix" << endl;
|
|---|
| 856 | cout << "after: " << Form("%4.1f", hres2.GetMean()*16384/360) << " \xb1 " << Form("%.1f", hres2.GetRMS()*16384/360) << " SE \t\t";
|
|---|
| 857 | cout << "after: " << Form("%4.1f", hres2.GetMean()*60*60/23.4) << " \xb1 " << Form("%.1f", hres2.GetRMS()*60*60/23.4) << " pix" << endl;
|
|---|
| 858 | cout << "backw: " << Form("%4.1f", hres3.GetMean()*16384/360) << " \xb1 " << Form("%.1f", hres3.GetRMS()*16384/360) << " SE \t\t";
|
|---|
| 859 | cout << "backw: " << Form("%4.1f", hres3.GetMean()*60*60/23.4) << " \xb1 " << Form("%.1f", hres3.GetRMS()*60*60/23.4) << " pix" << endl;
|
|---|
| 860 | cout << endl;
|
|---|
| 861 | cout << endl; // ±
|
|---|
| 862 |
|
|---|
| 863 |
|
|---|
| 864 | before = hres1.GetMean()*16384/360;
|
|---|
| 865 | after = hres2.GetMean()*16384/360;
|
|---|
| 866 | backw = hres3.GetMean()*16384/360;
|
|---|
| 867 |
|
|---|
| 868 |
|
|---|
| 869 | gStyle->SetOptStat(1110);
|
|---|
| 870 | gStyle->SetStatFormat("6.2g");
|
|---|
| 871 |
|
|---|
| 872 | if (gROOT->FindObject("CanvResiduals"))
|
|---|
| 873 | c1 = dynamic_cast<TCanvas*>(gROOT->FindObject("CanvResiduals"));
|
|---|
| 874 | else
|
|---|
| 875 | c1=new TCanvas("CanvResiduals", "Residuals", 800, 800);
|
|---|
| 876 |
|
|---|
| 877 | gROOT->SetSelectedPad(0);
|
|---|
| 878 | c1->SetSelectedPad(0);
|
|---|
| 879 | c1->Clear();
|
|---|
| 880 | c1->SetFillColor(kWhite);
|
|---|
| 881 |
|
|---|
| 882 | c1->Divide(2, 2, 1e-10, 1e-10);
|
|---|
| 883 |
|
|---|
| 884 | c1->cd(2);
|
|---|
| 885 | gPad->SetBorderMode(0);
|
|---|
| 886 | gPad->SetFrameBorderMode(0);
|
|---|
| 887 | hres1.SetLineColor(kRed);
|
|---|
| 888 | hres1.DrawCopy();
|
|---|
| 889 |
|
|---|
| 890 | gPad->Update();
|
|---|
| 891 |
|
|---|
| 892 | line.DrawLine(360./16384, gPad->GetUymin(), 360./16384, gPad->GetUymax());
|
|---|
| 893 |
|
|---|
| 894 | c1->cd(4);
|
|---|
| 895 | gPad->SetBorderMode(0);
|
|---|
| 896 | gPad->SetFrameBorderMode(0);
|
|---|
| 897 | hres2.SetLineColor(kBlue);
|
|---|
| 898 | TH1 *h=hres2.DrawCopy();
|
|---|
| 899 | TF1 f("mygaus", "(gaus)", 0, 1);
|
|---|
| 900 | f.SetLineColor(kMagenta/*6*/);
|
|---|
| 901 | f.SetLineWidth(1);
|
|---|
| 902 | f.SetParameter(0, h->GetBinContent(1));
|
|---|
| 903 | f.FixParameter(1, 0);
|
|---|
| 904 | f.SetParameter(2, h->GetRMS());
|
|---|
| 905 | h->Fit("mygaus", "QR");
|
|---|
| 906 | hres3.SetLineColor(kCyan);
|
|---|
| 907 | hres3.SetLineStyle(kDashed);
|
|---|
| 908 | hres3.DrawCopy("same");
|
|---|
| 909 | cout << "Gaus-Fit Sigma: " << f.GetParameter(2) << "\xb0" << endl;
|
|---|
| 910 | cout << "Fit-Probability: " << f.GetProb()*100 << "%" << endl;
|
|---|
| 911 | cout << " Chi^2/NDF: " << f.GetChisquare() << "/" << f.GetNDF() << " = " << f.GetChisquare()/f.GetNDF() << endl;
|
|---|
| 912 | gPad->Update();
|
|---|
| 913 | line.DrawLine(360./16384, gPad->GetUymin(), 360./16384, gPad->GetUymax());
|
|---|
| 914 |
|
|---|
| 915 | c1->cd(1);
|
|---|
| 916 | gPad->SetBorderMode(0);
|
|---|
| 917 | gPad->SetFrameBorderMode(0);
|
|---|
| 918 | gPad->SetTheta(90);
|
|---|
| 919 | gPad->SetPhi(90);
|
|---|
| 920 | TH2F h2res1("Res2D1", " Dataset positions on the sky ", 36, 0, 360, 8, 0, 90);
|
|---|
| 921 | h2res1.SetBit(TH1::kNoStats);
|
|---|
| 922 | h2res1.DrawCopy("surf1pol");
|
|---|
| 923 | gPad->Modified();
|
|---|
| 924 | gPad->Update();
|
|---|
| 925 | DrawHorizon(gPad);
|
|---|
| 926 | for (int i=0; i<fOriginal.GetSize(); i++)
|
|---|
| 927 | DrawSet(gPad, *(Set*)fOriginal.At(i));//, 10./hres1.GetMean());
|
|---|
| 928 |
|
|---|
| 929 | TText text;
|
|---|
| 930 | text.SetTextAlign(22);
|
|---|
| 931 | text.DrawText( 0.00, 0.66, "N");
|
|---|
| 932 | text.DrawText( 0.66, 0.00, "E");
|
|---|
| 933 | text.DrawText( 0.00, -0.66, "S");
|
|---|
| 934 | text.DrawText(-0.66, 0.00, "W");
|
|---|
| 935 |
|
|---|
| 936 | c1->cd(3);
|
|---|
| 937 | gPad->SetBorderMode(0);
|
|---|
| 938 | gPad->SetFrameBorderMode(0);
|
|---|
| 939 | gPad->SetTheta(90);
|
|---|
| 940 | gPad->SetPhi(90);
|
|---|
| 941 | h2res1.SetTitle(" Arb. Residuals after correction (scaled) ");
|
|---|
| 942 | h2res1.DrawCopy("surf1pol");
|
|---|
| 943 | gPad->Modified();
|
|---|
| 944 | gPad->Update();
|
|---|
| 945 | // for (int i=0; i<fCoordinates.GetSize(); i++)
|
|---|
| 946 | // DrawSet(gPad, *(Set*)fCoordinates.At(i), 10./hres2.GetMean(), par[0]);
|
|---|
| 947 |
|
|---|
| 948 | RaiseWindow();
|
|---|
| 949 | }
|
|---|
| 950 |
|
|---|
| 951 | void LoadStars(TString fname="tpoint.txt")
|
|---|
| 952 | {
|
|---|
| 953 | const Int_t size = fOriginal.GetSize();
|
|---|
| 954 |
|
|---|
| 955 | ifstream fin(fname);
|
|---|
| 956 |
|
|---|
| 957 | while (fin && fin.get()!='\n');
|
|---|
| 958 | while (fin && fin.get()!='\n');
|
|---|
| 959 | while (fin && fin.get()!='\n');
|
|---|
| 960 | if (!fin)
|
|---|
| 961 | {
|
|---|
| 962 | cout << "File '" << fname << "' not found!" << endl;
|
|---|
| 963 | return;
|
|---|
| 964 | }
|
|---|
| 965 |
|
|---|
| 966 | while (1)
|
|---|
| 967 | {
|
|---|
| 968 | Set set;
|
|---|
| 969 |
|
|---|
| 970 | fin >> set; // Read data from file [deg], it is stored in [rad]
|
|---|
| 971 | if (!fin)
|
|---|
| 972 | break;
|
|---|
| 973 |
|
|---|
| 974 | fOriginal.Add(new Set(set));
|
|---|
| 975 | }
|
|---|
| 976 |
|
|---|
| 977 | cout << "Found " << fOriginal.GetSize()-size << " sets of coordinates ";
|
|---|
| 978 | cout << "(Total=" << fOriginal.GetSize() << ")" << endl;
|
|---|
| 979 | }
|
|---|
| 980 |
|
|---|
| 981 | // --------------------------------------------------------------------------
|
|---|
| 982 | //
|
|---|
| 983 | // Opens an open dialog
|
|---|
| 984 | //
|
|---|
| 985 | TString OpenDialog(EFileDialogMode mode=kFDOpen)
|
|---|
| 986 | {
|
|---|
| 987 | static const char *gOpenTypes[] =
|
|---|
| 988 | {
|
|---|
| 989 | "TPoint files", "*.txt",
|
|---|
| 990 | "All files", "*",
|
|---|
| 991 | NULL, NULL
|
|---|
| 992 | };
|
|---|
| 993 |
|
|---|
| 994 | static TString dir("tpoint/");
|
|---|
| 995 |
|
|---|
| 996 | TGFileInfo fi; // fFileName and fIniDir deleted in ~TGFileInfo
|
|---|
| 997 |
|
|---|
| 998 | fi.fFileTypes = (const char**)gOpenTypes;
|
|---|
| 999 | fi.fIniDir = StrDup(dir);
|
|---|
| 1000 |
|
|---|
| 1001 | new TGFileDialog(fClient->GetRoot(), this, mode, &fi);
|
|---|
| 1002 |
|
|---|
| 1003 | if (!fi.fFilename)
|
|---|
| 1004 | return 0;
|
|---|
| 1005 |
|
|---|
| 1006 | dir = fi.fIniDir;
|
|---|
| 1007 |
|
|---|
| 1008 | return fi.fFilename;
|
|---|
| 1009 | }
|
|---|
| 1010 |
|
|---|
| 1011 | Bool_t ProcessMessage(Long_t msg, Long_t mp1, Long_t mp2)
|
|---|
| 1012 | {
|
|---|
| 1013 | // cout << "Msg: " << hex << GET_MSG(msg) << endl;
|
|---|
| 1014 | // cout << "SubMsg: " << hex << GET_SUBMSG(msg) << dec << endl;
|
|---|
| 1015 | switch (GET_MSG(msg))
|
|---|
| 1016 | {
|
|---|
| 1017 | case kC_COMMAND:
|
|---|
| 1018 | switch (GET_SUBMSG(msg))
|
|---|
| 1019 | {
|
|---|
| 1020 | case kCM_BUTTON:
|
|---|
| 1021 | switch (mp1)
|
|---|
| 1022 | {
|
|---|
| 1023 | case kTbFit:
|
|---|
| 1024 | {
|
|---|
| 1025 | Double_t before=0;
|
|---|
| 1026 | Double_t after=0;
|
|---|
| 1027 | Double_t backw=0;
|
|---|
| 1028 | Fit(before, after, backw);
|
|---|
| 1029 | DisplayBending();
|
|---|
| 1030 | DisplayResult(before, after, backw);
|
|---|
| 1031 | }
|
|---|
| 1032 | return kTRUE;
|
|---|
| 1033 | case kTbLoad:
|
|---|
| 1034 | fBending.Load(OpenDialog());
|
|---|
| 1035 | DisplayBending();
|
|---|
| 1036 | return kTRUE;
|
|---|
| 1037 | case kTbSave:
|
|---|
| 1038 | fBending.Save(OpenDialog(kFDSave));
|
|---|
| 1039 | return kTRUE;
|
|---|
| 1040 | case kTbLoadStars:
|
|---|
| 1041 | LoadStars(OpenDialog());
|
|---|
| 1042 | DisplayData();
|
|---|
| 1043 | return kTRUE;
|
|---|
| 1044 | case kTbReset:
|
|---|
| 1045 | fBending.Clear();
|
|---|
| 1046 | DisplayBending();
|
|---|
| 1047 | return kTRUE;
|
|---|
| 1048 | case kTbResetStars:
|
|---|
| 1049 | fOriginal.Delete();
|
|---|
| 1050 | DisplayData();
|
|---|
| 1051 | return kTRUE;
|
|---|
| 1052 | }
|
|---|
| 1053 | return kTRUE;
|
|---|
| 1054 | }
|
|---|
| 1055 | return kTRUE;
|
|---|
| 1056 | }
|
|---|
| 1057 | return kTRUE;
|
|---|
| 1058 | }
|
|---|
| 1059 |
|
|---|
| 1060 | void AddTextButton(TGCompositeFrame *f, TString txt, Int_t id=-1, TGLayoutHints *h=0)
|
|---|
| 1061 | {
|
|---|
| 1062 | TGButton *but = new TGTextButton(f, txt, id);
|
|---|
| 1063 | but->Associate(this);
|
|---|
| 1064 | f->AddFrame(but, h);
|
|---|
| 1065 | fList->Add(but);
|
|---|
| 1066 |
|
|---|
| 1067 | }
|
|---|
| 1068 |
|
|---|
| 1069 | void AddCheckButton(TGCompositeFrame *f, TString txt, Int_t id=-1, TGLayoutHints *h=0)
|
|---|
| 1070 | {
|
|---|
| 1071 | TGButton *but = new TGCheckButton(f, txt, id);
|
|---|
| 1072 | but->Associate(this);
|
|---|
| 1073 | f->AddFrame(but, h);
|
|---|
| 1074 | fList->Add(but);
|
|---|
| 1075 | }
|
|---|
| 1076 |
|
|---|
| 1077 | TGLabel *AddLabel(TGCompositeFrame *f, TString txt, TGLayoutHints *h=0)
|
|---|
| 1078 | {
|
|---|
| 1079 | TGLabel *l = new TGLabel(f, txt/*, TGLabel::GetDefaultGC()(), fFont*/);
|
|---|
| 1080 | f->AddFrame(l, h);
|
|---|
| 1081 | fList->Add(l);
|
|---|
| 1082 | fLabel.Add(l);
|
|---|
| 1083 | return l;
|
|---|
| 1084 | }
|
|---|
| 1085 |
|
|---|
| 1086 | void DisplayBending()
|
|---|
| 1087 | {
|
|---|
| 1088 | TArrayD par, err;
|
|---|
| 1089 | fBending.GetParameters(par);
|
|---|
| 1090 | fBending.GetError(err);
|
|---|
| 1091 |
|
|---|
| 1092 | TGLabel *l;
|
|---|
| 1093 |
|
|---|
| 1094 | for (int i=0; i<MPointing::GetNumPar(); i++)
|
|---|
| 1095 | {
|
|---|
| 1096 | l = (TGLabel*)fLabel.At(i);
|
|---|
| 1097 | l->SetText(Form("%.4f\xb0", par[i]));
|
|---|
| 1098 |
|
|---|
| 1099 | l = (TGLabel*)fLabel.At(MPointing::GetNumPar()+i);
|
|---|
| 1100 | l->SetText(Form("\xb1 %8.4f\xb0", err[i]));
|
|---|
| 1101 | }
|
|---|
| 1102 | }
|
|---|
| 1103 |
|
|---|
| 1104 | void DisplayData()
|
|---|
| 1105 | {
|
|---|
| 1106 | TGLabel *l = (TGLabel*)fLabel.At(3*MPointing::GetNumPar());
|
|---|
| 1107 | l->SetText(Form("%d data sets loaded.", fOriginal.GetSize()));
|
|---|
| 1108 | }
|
|---|
| 1109 |
|
|---|
| 1110 | void DisplayResult(Double_t before, Double_t after, Double_t backw)
|
|---|
| 1111 | {
|
|---|
| 1112 | TGLabel *l1 = (TGLabel*)fLabel.At(3*MPointing::GetNumPar()+1);
|
|---|
| 1113 | l1->SetText(Form("Before: %.1f +- %.1f SE", before, 0));
|
|---|
| 1114 |
|
|---|
| 1115 | TGLabel *l2 = (TGLabel*)fLabel.At(3*MPointing::GetNumPar()+2);
|
|---|
| 1116 | l2->SetText(Form("After: %.1f +- %.1f SE", after, 0));
|
|---|
| 1117 |
|
|---|
| 1118 | TGLabel *l3 = (TGLabel*)fLabel.At(3*MPointing::GetNumPar()+3);
|
|---|
| 1119 | l3->SetText(Form("Backw: %.1f +- %.1f SE", backw, 0));
|
|---|
| 1120 | }
|
|---|
| 1121 |
|
|---|
| 1122 | public:
|
|---|
| 1123 | ~MFit()
|
|---|
| 1124 | {
|
|---|
| 1125 | if (fFont)
|
|---|
| 1126 | gVirtualX->DeleteFont(fFont);
|
|---|
| 1127 | }
|
|---|
| 1128 | MFit() : TGMainFrame(gClient->GetRoot(), 750, 370, kHorizontalFrame)
|
|---|
| 1129 | {
|
|---|
| 1130 | fCoordinates.SetOwner();
|
|---|
| 1131 | fOriginal.SetOwner();
|
|---|
| 1132 |
|
|---|
| 1133 | fList = new MGList;
|
|---|
| 1134 | fList->SetOwner();
|
|---|
| 1135 |
|
|---|
| 1136 | fFont = gVirtualX->LoadQueryFont("7x13bold");
|
|---|
| 1137 |
|
|---|
| 1138 | TGLayoutHints *hints0 = new TGLayoutHints(kLHintsExpandY, 7, 5, 5, 6);
|
|---|
| 1139 | TGLayoutHints *hints1 = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY, 5, 7, 5, 6);
|
|---|
| 1140 | TGLayoutHints *hints2 = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 5, 5, 5, 5);
|
|---|
| 1141 | fList->Add(hints0);
|
|---|
| 1142 | fList->Add(hints1);
|
|---|
| 1143 | fList->Add(hints2);
|
|---|
| 1144 |
|
|---|
| 1145 | TGGroupFrame *grp1 = new TGGroupFrame(this, "Control", kVerticalFrame);
|
|---|
| 1146 | AddFrame(grp1, hints0);
|
|---|
| 1147 | fList->Add(grp1);
|
|---|
| 1148 |
|
|---|
| 1149 | TGGroupFrame *grp2 = new TGGroupFrame(this, "Parameters", kHorizontalFrame);
|
|---|
| 1150 | AddFrame(grp2, hints1);
|
|---|
| 1151 | fList->Add(grp2);
|
|---|
| 1152 |
|
|---|
| 1153 |
|
|---|
| 1154 |
|
|---|
| 1155 | TGLayoutHints *hints4 = new TGLayoutHints(kLHintsExpandX, 5, 5, 5);
|
|---|
| 1156 | TGLayoutHints *hints5 = new TGLayoutHints(kLHintsExpandX, 5, 5, 15);
|
|---|
| 1157 | AddTextButton(grp1, "Load Pointing Model", kTbLoad, hints5);
|
|---|
| 1158 | AddTextButton(grp1, "Save Pointing Model", kTbSave, hints4);
|
|---|
| 1159 | AddTextButton(grp1, "Fit Parameters", kTbFit, hints5);
|
|---|
| 1160 | AddTextButton(grp1, "Reset Parameters", kTbReset, hints4);
|
|---|
| 1161 | AddTextButton(grp1, "Load Stars", kTbLoadStars, hints5);
|
|---|
| 1162 | AddTextButton(grp1, "Reset Stars", kTbResetStars, hints4);
|
|---|
| 1163 | fList->Add(hints4);
|
|---|
| 1164 | fList->Add(hints5);
|
|---|
| 1165 |
|
|---|
| 1166 |
|
|---|
| 1167 | TGHorizontalFrame *comp = new TGHorizontalFrame(grp2, 1, 1);
|
|---|
| 1168 | grp2->AddFrame(comp);
|
|---|
| 1169 | fList->Add(comp);
|
|---|
| 1170 |
|
|---|
| 1171 | TGLayoutHints *hints3 = new TGLayoutHints(kLHintsLeft|kLHintsTop, 0, 20, 5, 0);
|
|---|
| 1172 | fList->Add(hints3);
|
|---|
| 1173 |
|
|---|
| 1174 | TGLabel *l;
|
|---|
| 1175 |
|
|---|
| 1176 | TGVerticalFrame *vframe = new TGVerticalFrame(comp, 1, 1);
|
|---|
| 1177 | comp->AddFrame(vframe, hints3);
|
|---|
| 1178 | fList->Add(vframe);
|
|---|
| 1179 |
|
|---|
| 1180 | for (int i=0; i<MPointing::GetNumPar(); i++)
|
|---|
| 1181 | AddCheckButton(vframe, fBending.GetVarName(i), i);
|
|---|
| 1182 |
|
|---|
| 1183 | vframe = new TGVerticalFrame(comp, 1, 1);
|
|---|
| 1184 | comp->AddFrame(vframe, hints3);
|
|---|
| 1185 | fList->Add(vframe);
|
|---|
| 1186 |
|
|---|
| 1187 | l = new TGLabel(vframe, "+000.0000");
|
|---|
| 1188 | l->SetTextJustify(kTextRight);
|
|---|
| 1189 | fList->Add(l);
|
|---|
| 1190 | fLabel.Add(l);
|
|---|
| 1191 |
|
|---|
| 1192 | TGButton *but = (TGButton*)fList->FindWidget(0);
|
|---|
| 1193 |
|
|---|
| 1194 | TGLayoutHints *h = new TGLayoutHints(kLHintsCenterY, 0, 0, but->GetHeight()-l->GetHeight());
|
|---|
| 1195 | fList->Add(h);
|
|---|
| 1196 |
|
|---|
| 1197 | vframe->AddFrame(l,h);
|
|---|
| 1198 |
|
|---|
| 1199 | for (int i=1; i<MPointing::GetNumPar(); i++)
|
|---|
| 1200 | AddLabel(vframe, "+000.0000", h)->SetTextJustify(kTextRight);
|
|---|
| 1201 |
|
|---|
| 1202 | vframe = new TGVerticalFrame(comp, 1, 1);
|
|---|
| 1203 | comp->AddFrame(vframe, hints3);
|
|---|
| 1204 | fList->Add(vframe);
|
|---|
| 1205 |
|
|---|
| 1206 | for (int i=0; i<MPointing::GetNumPar(); i++)
|
|---|
| 1207 | AddLabel(vframe, "\xb1 00.0000\xb0", h)->SetTextJustify(kTextRight);
|
|---|
| 1208 |
|
|---|
| 1209 | vframe = new TGVerticalFrame(comp, 1, 1);
|
|---|
| 1210 | comp->AddFrame(vframe, hints3);
|
|---|
| 1211 | fList->Add(vframe);
|
|---|
| 1212 |
|
|---|
| 1213 | for (int i=0; i<MPointing::GetNumPar(); i++)
|
|---|
| 1214 | AddLabel(vframe, fBending.GetDescription(i), h);
|
|---|
| 1215 |
|
|---|
| 1216 | l = new TGLabel(grp1, "0000000 Data Sets loaded.");
|
|---|
| 1217 | grp1->AddFrame(l, hints5);
|
|---|
| 1218 | fList->Add(l);
|
|---|
| 1219 | fLabel.Add(l);
|
|---|
| 1220 |
|
|---|
| 1221 | l = new TGLabel(grp1, "");
|
|---|
| 1222 | l->SetTextJustify(kTextLeft);
|
|---|
| 1223 | grp1->AddFrame(l, hints5);
|
|---|
| 1224 | fList->Add(l);
|
|---|
| 1225 | fLabel.Add(l);
|
|---|
| 1226 |
|
|---|
| 1227 | l = new TGLabel(grp1, "");
|
|---|
| 1228 | l->SetTextJustify(kTextLeft);
|
|---|
| 1229 | grp1->AddFrame(l, hints5);
|
|---|
| 1230 | fList->Add(l);
|
|---|
| 1231 | fLabel.Add(l);
|
|---|
| 1232 |
|
|---|
| 1233 | l = new TGLabel(grp1, "");
|
|---|
| 1234 | l->SetTextJustify(kTextLeft);
|
|---|
| 1235 | grp1->AddFrame(l, hints5);
|
|---|
| 1236 | fList->Add(l);
|
|---|
| 1237 | fLabel.Add(l);
|
|---|
| 1238 |
|
|---|
| 1239 |
|
|---|
| 1240 | ((TGCheckButton*)fList->FindWidget(0))->SetState(kButtonDown);
|
|---|
| 1241 | ((TGCheckButton*)fList->FindWidget(1))->SetState(kButtonDown);
|
|---|
| 1242 | ((TGCheckButton*)fList->FindWidget(6))->SetState(kButtonDown);
|
|---|
| 1243 | ((TGCheckButton*)fList->FindWidget(10))->SetState(kButtonDown);
|
|---|
| 1244 | ((TGCheckButton*)fList->FindWidget(12))->SetState(kButtonDown);
|
|---|
| 1245 | ((TGCheckButton*)fList->FindWidget(17))->SetState(kButtonDown);
|
|---|
| 1246 |
|
|---|
| 1247 | SetWindowName("TPoint Fitting Window");
|
|---|
| 1248 | SetIconName("TPoint++");
|
|---|
| 1249 |
|
|---|
| 1250 | Layout();
|
|---|
| 1251 |
|
|---|
| 1252 | MapSubwindows();
|
|---|
| 1253 | MapWindow();
|
|---|
| 1254 |
|
|---|
| 1255 | DisplayBending();
|
|---|
| 1256 | DisplayData();
|
|---|
| 1257 | }
|
|---|
| 1258 | ClassDef(MFit, 0)
|
|---|
| 1259 | };
|
|---|
| 1260 |
|
|---|
| 1261 | ClassImp(MFit);
|
|---|
| 1262 |
|
|---|
| 1263 | void gui()
|
|---|
| 1264 | {
|
|---|
| 1265 | gErrorIgnoreLevel = kError;
|
|---|
| 1266 | new MFit;
|
|---|
| 1267 | // TF1 f1("f1", "[0]/cos((90-x)*3.1415/180)", 0, 90)
|
|---|
| 1268 | }
|
|---|