803 cout <<
"Sorry, no input data loaded..." << endl;
811 cout <<
"-----------------------------------------------------------------------" << endl;
813 gStyle->SetOptStat(
"emro");
815 TH1F hres1(
"Res1",
" Residuals before correction ",
fOriginal.GetSize()/3, 0, 0.3);
816 TH1F hres2(
"Res2",
" Residuals after correction ",
fOriginal.GetSize()/3, 0, 0.3);
817 TH1F hres3(
"Res3",
" Residuals after backward correction ",
fOriginal.GetSize()/3, 0, 0.3);
819 TProfile proaz (
"ProAz",
" \\Delta profile vs. Az", 24, 0, 360);
820 TProfile prozd (
"ProZd",
" \\Delta profile vs. Zd", 30, 0, 90);
821 TProfile promag(
"ProMag",
" \\Delta profile vs. Mag", 10, 1, 10);
823 hres1.SetXTitle(
"\\Delta [\\circ]");
824 hres1.SetYTitle(
"Counts");
826 hres2.SetXTitle(
"\\Delta [\\circ]");
827 hres2.SetYTitle(
"Counts");
829 hres3.SetXTitle(
"\\Delta [\\circ]");
830 hres3.SetYTitle(
"Counts");
842 gdaz.SetTitle(
" \\Delta Az vs. Zd ");
843 gdzd.SetTitle(
" \\Delta Zd vs. Az ");
845 gaz.SetTitle(
" \\Delta Az vs. Az ");
846 gzd.SetTitle(
" \\Delta Zd vs. Zd ");
848 gmaz.SetTitle(
" \\Delta Az vs. Mag ");
849 gmzd.SetTitle(
" \\Delta Zd vs. Mag ");
851 graz.SetTitle(
" \\Delta vs. Az ");
852 grzd.SetTitle(
" \\Delta vs. Zd ");
853 grmag.SetTitle(
" \\Delta vs. Mag ");
856 minuit.SetObjectFit(
this);
857 minuit.SetPrintLevel(-1);
865 minuit.FixParameter(
i);
866 if (l->GetState()==kButtonDown)
874 cout <<
"Starting fit..." << endl;
875 cout <<
"For the fit an measurement error in the residual of ";
876 cout <<
"0.02deg (=1SE) is assumed." << endl;
880 ierflg = minuit.Migrad();
881 cout <<
"Migrad returns " << ierflg << endl;
883 ierflg = minuit.Migrad();
884 cout <<
"Migrad returns " << ierflg << endl << endl;
914 cout << endl <<
"Sets with Residual exceeding " <<
fLimit <<
"deg:" << endl;
915 cout <<
" StarAz StarEl RawAz RawEl Mag Residual Filename" << endl;
935 hres1.Fill(set1.GetResidual());
940 Double_t dz = fmod(set0.
GetDAz()+720, 360);
947 gdzd.SetPoint(
i, za.Az(), set0.
GetDZd());
948 gdaz.SetPoint(
i, za.Zd(), dz);
949 graz.SetPoint(
i, za.Az(), resi);
950 graz.SetPointError(
i, 0, err);
951 grzd.SetPoint(
i, za.Zd(), resi);
952 grzd.SetPointError(
i, 0, err);
955 cout <<
" " << orig <<
" <" <<
Form(
"%5.3f", resi) <<
"> " << orig.GetName() << endl;
961 gaz.SetPoint(
i, za.Az(), dz);
962 gzd.SetPoint(
i, za.Zd(), set0.
GetDZd());
966 grmag.SetPointError(
i, 0, err);
967 gmaz.SetPoint(
i, set0.
GetMag(), dz);
972 cout <<
"done." << endl << endl;
977 const Stat_t ov = hres2.GetBinContent(hres2.GetNbinsX()+1);
979 cout <<
"WARNING: " << ov <<
" overflows in residuals." << endl;
984 cout <<
" Number of calls to FCN: " << minuit.fNfcn << endl;
985 cout <<
"Minimum value found for FCN (Chi^2): " << minuit.fAmin << endl;
986 cout <<
" Fit-Probability: " << TMath::Prob(minuit.fAmin,
fOriginal.GetSize()-minuit.GetNumFreePars())*100 <<
"%" << endl;
987 cout <<
" Chi^2/NDF: " << minuit.fAmin/(
fOriginal.GetSize()-minuit.GetNumFreePars()) << endl;
998 cout <<
"Checking backward correction (raw-->star):" << endl;
1008 const Double_t res1 = set1.GetResidual();
1009 const Double_t diff = TMath::Abs(res0-res1);
1013 if (diff<hres2.GetMean()*0.66)
1016 cout <<
"DBack: " << setw(6) << set0.
GetStarZd() <<
" " << setw(7) << set0.
GetStarAz() <<
": ";
1017 cout <<
"ResB="<< setw(7) << res0*60 <<
" ResF=" << setw(7) << res1*60 <<
" |ResB-ResF|=" << setw(7) << diff*60 <<
" arcmin" << endl;
1019 cout <<
"OK." << endl;
1022 const Double_t max1 = TMath::Max(gaz.GetHistogram()->GetMaximum(), gdaz.GetHistogram()->GetMaximum());
1023 const Double_t max2 = TMath::Max(gzd.GetHistogram()->GetMaximum(), gdzd.GetHistogram()->GetMaximum());
1024 const Double_t max3 = TMath::Max(grzd.GetHistogram()->GetMaximum(), graz.GetHistogram()->GetMaximum());
1026 const Double_t min1 = TMath::Min(gaz.GetHistogram()->GetMinimum(), gdaz.GetHistogram()->GetMinimum());
1027 const Double_t min2 = TMath::Min(gzd.GetHistogram()->GetMinimum(), gdzd.GetHistogram()->GetMinimum());
1028 const Double_t min3 = TMath::Min(grzd.GetHistogram()->GetMinimum(), graz.GetHistogram()->GetMinimum());
1030 const Double_t absmax1 = 0.05;
1031 const Double_t absmax2 = 0.05;
1032 const Double_t absmax3 = 0.05;
1034 gaz.SetMaximum(absmax1);
1035 gzd.SetMaximum(absmax2);
1036 gdaz.SetMaximum(absmax1);
1037 gdzd.SetMaximum(absmax2);
1038 gmaz.SetMaximum(absmax1);
1039 gmzd.SetMaximum(absmax2);
1040 graz.SetMaximum(absmax3);
1041 grzd.SetMaximum(absmax3);
1042 grmag.SetMaximum(absmax3);
1043 gaz.SetMinimum(-absmax1);
1044 gzd.SetMinimum(-absmax2);
1045 gdaz.SetMinimum(-absmax1);
1046 gdzd.SetMinimum(-absmax2);
1047 gmaz.SetMinimum(-absmax1);
1048 gmzd.SetMinimum(-absmax2);
1051 grmag.SetMinimum(0);
1055 if (gROOT->FindObject(
"CanvGraphs"))
1056 c1 = dynamic_cast<TCanvas*>(gROOT->FindObject(
"CanvGraphs"));
1058 c1=
new TCanvas(
"CanvGraphs",
"Graphs");
1060 gROOT->SetSelectedPad(0);
1061 c1->SetSelectedPad(0);
1062 c1->SetBorderMode(0);
1063 c1->SetFrameBorderMode(0);
1066 c1->SetFillColor(
kWhite);
1067 #ifndef PRESENTATION 1068 c1->Divide(3,3,1e-10,1e-10);
1070 c1->Divide(2,2,1e-10,1e-10);
1072 c1->SetFillColor(
kWhite);
1077 line.SetLineColor(
kGreen);
1078 line.SetLineWidth(2);
1079 #ifndef PRESENTATION 1081 gPad->SetBorderMode(0);
1082 gPad->SetFrameBorderMode(0);
1085 g=(TGraph*)gaz.DrawClone(
"A*");
1086 g->SetBit(kCanDelete);
1087 g->GetHistogram()->SetXTitle(
"Az [\\circ]");
1088 g->GetHistogram()->SetYTitle(
"\\Delta Az [\\circ]");
1090 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1091 line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
1094 gPad->SetBorderMode(0);
1095 gPad->SetFrameBorderMode(0);
1098 g=(TGraph*)gdaz.DrawClone(
"A*");
1099 g->SetBit(kCanDelete);
1100 g->GetHistogram()->SetXTitle(
"Zd [\\circ]");
1101 g->GetHistogram()->SetYTitle(
"\\Delta Az [\\circ]");
1102 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1103 line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
1104 cout <<
"Mean dAz: " << g->GetMean(2) <<
" \xb1 " << g->GetRMS(2) << endl;
1107 gPad->SetBorderMode(0);
1108 gPad->SetFrameBorderMode(0);
1113 g=(TGraph*)gmaz.DrawClone(
"A*");
1114 g->SetBit(kCanDelete);
1115 g->GetHistogram()->SetXTitle(
"Mag");
1116 g->GetHistogram()->SetYTitle(
"\\Delta Az [\\circ]");
1117 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1118 line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
1122 #ifndef PRESENTATION 1127 gPad->SetBorderMode(0);
1128 gPad->SetFrameBorderMode(0);
1131 g=(TGraph*)gdzd.DrawClone(
"A*");
1132 g->SetBit(kCanDelete);
1133 g->GetHistogram()->SetXTitle(
"Az [\\circ]");
1134 g->GetHistogram()->SetYTitle(
"\\Delta Zd [\\circ]");
1135 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1136 line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
1137 cout <<
"Mean dZd: " << g->GetMean(2) <<
" \xb1 " << g->GetRMS(2) << endl;
1140 #ifndef PRESENTATION 1145 gPad->SetBorderMode(0);
1146 gPad->SetFrameBorderMode(0);
1149 g=(TGraph*)gzd.DrawClone(
"A*");
1150 g->SetBit(kCanDelete);
1151 g->GetHistogram()->SetXTitle(
"Zd [\\circ]");
1152 g->GetHistogram()->SetYTitle(
"\\Delta Zd [\\circ]");
1153 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1154 line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
1155 #ifndef PRESENTATION 1157 gPad->SetBorderMode(0);
1158 gPad->SetFrameBorderMode(0);
1163 g=(TGraph*)gmzd.DrawClone(
"A*");
1164 g->SetBit(kCanDelete);
1165 g->GetHistogram()->SetXTitle(
"Mag");
1166 g->GetHistogram()->SetYTitle(
"\\Delta Zd [\\circ]");
1167 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1168 line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384);
1172 #ifndef PRESENTATION 1177 gPad->SetBorderMode(0);
1178 gPad->SetFrameBorderMode(0);
1181 g=(TGraph*)graz.DrawClone(
"AP");
1182 g->SetBit(kCanDelete);
1183 g->GetHistogram()->SetXTitle(
"Az [\\circ]");
1184 g->GetHistogram()->SetYTitle(
"\\Delta [\\circ]");
1185 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1187 proaz.SetLineWidth(2);
1188 proaz.SetLineColor(
kBlue);
1189 proaz.SetMarkerColor(
kBlue);
1190 proaz.DrawCopy(
"pc hist same");
1192 #ifndef PRESENTATION 1197 gPad->SetBorderMode(0);
1198 gPad->SetFrameBorderMode(0);
1201 g=(TGraph*)grzd.DrawClone(
"AP");
1202 g->SetBit(kCanDelete);
1203 g->GetHistogram()->SetXTitle(
"Zd [\\circ]");
1204 g->GetHistogram()->SetYTitle(
"\\Delta [\\circ]");
1205 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1207 prozd.SetLineWidth(2);
1208 prozd.SetLineColor(
kBlue);
1209 prozd.SetMarkerColor(
kBlue);
1210 prozd.DrawCopy(
"pc hist same");
1212 #ifndef PRESENTATION 1214 gPad->SetBorderMode(0);
1215 gPad->SetFrameBorderMode(0);
1220 g=(TGraph*)grmag.DrawClone(
"AP");
1221 g->SetBit(kCanDelete);
1222 g->GetHistogram()->SetXTitle(
"Mag");
1223 g->GetHistogram()->SetYTitle(
"\\Delta [\\circ]");
1224 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384);
1226 promag.SetLineWidth(2);
1227 promag.SetLineColor(
kBlue);
1228 promag.SetMarkerColor(
kBlue);
1229 promag.DrawCopy(
"pc hist same");
1236 cout <<
fCoordinates.GetSize() <<
" data sets." << endl << endl;
1237 cout <<
"Total Spread of Residual:" << endl;
1238 cout <<
"-------------------------" << endl;
1239 cout <<
"before: " <<
Form(
"%6.4f", hres1.GetMean()) <<
" \xb1 " <<
Form(
"%6.4f", hres1.GetRMS()) <<
" deg \t";
1240 cout <<
"before: " <<
Form(
"%4.1f", hres1.GetMean()*3600) <<
" \xb1 " <<
Form(
"%.1f", hres1.GetRMS()*3600) <<
" arcsec" << endl;
1241 cout <<
"after: " <<
Form(
"%6.4f", hres2.GetMean()) <<
" \xb1 " <<
Form(
"%6.4f", hres2.GetRMS()) <<
" deg \t";
1242 cout <<
"after: " <<
Form(
"%4.1f", hres2.GetMean()*3600) <<
" \xb1 " <<
Form(
"%.1f", hres2.GetRMS()*3600) <<
" arcsec" << endl;
1243 cout <<
"backw: " <<
Form(
"%6.4f", hres3.GetMean()) <<
" \xb1 " <<
Form(
"%6.4f", hres3.GetRMS()) <<
" deg \t";
1244 cout <<
"backw: " <<
Form(
"%4.1f", hres3.GetMean()*3600) <<
" \xb1 " <<
Form(
"%.1f", hres3.GetRMS()*3600) <<
" arcsec" << endl;
1246 cout <<
"before: " <<
Form(
"%4.1f", hres1.GetMean()*16348/360) <<
" \xb1 " <<
Form(
"%.1f", hres1.GetRMS()*16384/360) <<
" SE \t\t";
1247 cout <<
"before: " <<
Form(
"%4.1f", hres1.GetMean()*60*60/23.4) <<
" \xb1 " <<
Form(
"%.1f", hres1.GetRMS()*60*60/23.4) <<
" pix" << endl;
1248 cout <<
"after: " <<
Form(
"%4.1f", hres2.GetMean()*16384/360) <<
" \xb1 " <<
Form(
"%.1f", hres2.GetRMS()*16384/360) <<
" SE \t\t";
1249 cout <<
"after: " <<
Form(
"%4.1f", hres2.GetMean()*60*60/23.4) <<
" \xb1 " <<
Form(
"%.1f", hres2.GetRMS()*60*60/23.4) <<
" pix" << endl;
1250 cout <<
"backw: " <<
Form(
"%4.1f", hres3.GetMean()*16384/360) <<
" \xb1 " <<
Form(
"%.1f", hres3.GetRMS()*16384/360) <<
" SE \t\t";
1251 cout <<
"backw: " <<
Form(
"%4.1f", hres3.GetMean()*60*60/23.4) <<
" \xb1 " <<
Form(
"%.1f", hres3.GetRMS()*60*60/23.4) <<
" pix" << endl;
1256 before = hres1.GetMean()*16384/360;
1257 after = hres2.GetMean()*16384/360;
1258 backw = hres3.GetMean()*16384/360;
1261 gStyle->SetOptStat(1110);
1262 gStyle->SetStatFormat(
"6.2g");
1264 if (gROOT->FindObject(
"CanvResiduals"))
1265 c1 = dynamic_cast<TCanvas*>(gROOT->FindObject(
"CanvResiduals"));
1267 c1=
new TCanvas(
"CanvResiduals",
"Residuals", 800, 800);
1269 gROOT->SetSelectedPad(0);
1270 c1->SetSelectedPad(0);
1272 c1->SetFillColor(
kWhite);
1274 c1->Divide(2, 2, 1e-10, 1e-10);
1277 gPad->SetBorderMode(0);
1278 gPad->SetFrameBorderMode(0);
1279 hres1.SetLineColor(
kRed);
1284 line.DrawLine(360./16384, gPad->GetUymin(), 360./16384, gPad->GetUymax());
1287 gPad->SetBorderMode(0);
1288 gPad->SetFrameBorderMode(0);
1289 hres2.SetLineColor(
kBlue);
1290 TH1 *h=hres2.DrawCopy();
1291 TF1 f(
"mygaus",
"(gaus)", 0, 1);
1294 f.SetParameter(0, h->GetBinContent(1));
1295 f.FixParameter(1, 0);
1296 f.SetParameter(2, h->GetRMS());
1297 h->Fit(
"mygaus",
"QR");
1298 hres3.SetLineColor(
kCyan);
1299 hres3.SetLineStyle(kDashed);
1300 hres3.DrawCopy(
"same");
1301 cout <<
"Gaus-Fit Sigma: " << f.GetParameter(2) <<
"\xb0" << endl;
1302 cout <<
"Fit-Probability: " << f.GetProb()*100 <<
"%" << endl;
1303 cout <<
" Chi^2/NDF: " << f.GetChisquare() <<
"/" << f.GetNDF() <<
" = " << f.GetChisquare()/f.GetNDF() << endl;
1305 line.DrawLine(360./16384, gPad->GetUymin(), 360./16384, gPad->GetUymax());
1308 gPad->SetBorderMode(0);
1309 gPad->SetFrameBorderMode(0);
1312 TH2F h2res1(
"Res2D1",
" Dataset positions on the sky ", 36, 0, 360, 8, 0, 90);
1313 h2res1.SetBit(TH1::kNoStats);
1314 h2res1.DrawCopy(
"surf1pol");
1322 text.SetTextAlign(22);
1323 text.DrawText( 0.00, 0.66,
"N");
1324 text.DrawText( 0.66, 0.00,
"E");
1325 text.DrawText( 0.00, -0.66,
"S");
1326 text.DrawText(-0.66, 0.00,
"W");
1329 gPad->SetBorderMode(0);
1330 gPad->SetFrameBorderMode(0);
1333 h2res1.SetTitle(
" Arb. Residuals after correction (scaled) ");
1334 h2res1.DrawCopy(
"surf1pol");
void GetParameters(Double_t *par, Int_t n=kNumPar) const
void DrawHorizon(TVirtualPad *pad, const char *fname="drive/horizon.dat") const
Double_t GetStarZd() const
static const Int_t GetNumPar()
Double_t GetResidual(Double_t *err=0) const
TObject * FindWidget(Int_t id) const
void SetParameters(const Double_t *par, Int_t n=kNumPar)
void GetMinuitParameters(TMinuit &m, Int_t n=-1)
void SetMinuitParameters(TMinuit &m, Int_t n=-1) const
void Adjust(const MPointing &bend)
static void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
Double_t GetStarAz() const
void DrawSet(TVirtualPad *pad, TPointStar &set, Float_t scale=-1, Float_t angle=0)
void PrintMinuitParameters(TMinuit &m, Int_t n=-1) const
void AdjustBack(const MPointing &bend)