Changeset 8184 for trunk/MagicSoft/Cosy/tpoint/gui.C
- Timestamp:
- 11/01/06 08:15:48 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/tpoint/gui.C
r7760 r8184 15 15 #include <TText.h> 16 16 #include <TProfile.h> 17 #include <TPolyLine.h> 17 18 #include <TGraphErrors.h> 18 19 … … 232 233 } 233 234 234 void DrawMarker(TVirtualPad *pad, Double_t r0, Double_t phi0 , Double_t r1, Double_t phi1)235 void DrawMarker(TVirtualPad *pad, Double_t r0, Double_t phi0) 235 236 { 236 237 TView *view = pad->GetView(); … … 243 244 244 245 TMarker mark0; 245 //TMarker mark1; 246 mark0.SetMarkerStyle(kStar); 247 //mark1.SetMarkerStyle(kStar); 248 //mark1.SetMarkerColor(kRed); 246 mark0.SetMarkerStyle(kFullDotLarge); 247 mark0.SetMarkerColor(kBlue); 249 248 250 249 r0 /= 90; 251 //r1 /= 90;252 250 phi0 *= TMath::DegToRad(); 253 //phi1 *= TMath::DegToRad(); 254 255 Double_t x0[3] = { r0*cos(phi0), r0*sin(phi0), 0}; 256 //Double_t x1[3] = { r1*cos(phi1), r1*sin(phi1), 0}; 257 258 Double_t y0[3];//, y1[3]; 259 260 view->WCtoNDC(x0, y0); 261 //view->WCtoNDC(x1, y1); 262 263 mark0.DrawMarker(-y0[0], y0[1]); 264 //mark1.DrawMarker(y1[0], y1[1]); 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]); 265 257 } 266 258 … … 295 287 line.SetLineWidth(2); 296 288 line.SetLineColor(kBlue); 297 289 298 290 Double_t p0 = phi0<phi1?phi0:phi1; 299 291 Double_t p1 = phi0<phi1?phi1:phi0; 300 292 301 293 if (phi0>phi1) 302 294 { … … 305 297 r0 = d; 306 298 } 307 299 308 300 r0 /= 90; 309 301 r1 /= 90; 310 302 311 303 Double_t dr = r1-r0; 312 304 Double_t dp = p1-p0; 313 305 314 306 Double_t x0[3] = { r0*cos(p0*TMath::DegToRad()), r0*sin(p0*TMath::DegToRad()), 0}; 315 307 316 308 for (double i=p0+10; i<p1+10; i+=10) 317 309 { 318 310 if (i>p1) 319 311 i=p1; 320 312 321 313 Double_t r = dr/dp*(i-p0)+r0; 322 314 Double_t p = TMath::DegToRad()*i; 323 315 324 316 Double_t x1[3] = { r*cos(p), r*sin(p), 0}; 325 317 326 318 Double_t y0[3], y1[3]; 327 319 328 320 view->WCtoNDC(x0, y0); 329 321 view->WCtoNDC(x1, y1); 330 322 331 323 line.DrawLine(y0[0], y0[1], y1[0], y1[1]); 332 324 333 325 x0[0] = x1[0]; 334 326 x0[1] = x1[1]; … … 342 334 Double_t r1 = set.GetStarZd(); 343 335 Double_t phi1 = set.GetStarAz()-angle; 344 336 345 337 if (r0<0) 346 338 { … … 353 345 phi1 += 180; 354 346 } 355 347 356 348 phi0 = fmod(phi0+360, 360); 357 349 phi1 = fmod(phi1+360, 360); 358 350 359 351 if (phi1-phi0<-180) 360 352 phi1+=360; 361 353 362 354 if (scale<0 || scale>1000) 363 355 scale = -1; 364 356 365 357 if (scale>0) 366 358 { … … 371 363 phi0 += scale*d; 372 364 phi1 -= scale*d; 373 365 374 366 DrawPolLine(pad, r0, phi0, r1, phi1); 375 DrawMarker(pad, r0, phi0 , r1, phi1);367 DrawMarker(pad, r0, phi0); 376 368 } 377 369 else 378 DrawMarker(pad, r1, phi1, 0 ,0); 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 379 417 } 380 418 … … 679 717 gPad->SetGridx(); 680 718 gPad->SetGridy(); 681 g=(TGraph*)gmaz.DrawClone("A*"); 682 g->SetBit(kCanDelete); 683 g->GetHistogram()->SetXTitle("Mag"); 684 g->GetHistogram()->SetYTitle("\\Delta Az [\\circ]"); 685 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384); 686 line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384); 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 } 687 728 #endif 688 729 … … 726 767 gPad->SetGridx(); 727 768 gPad->SetGridy(); 728 g=(TGraph*)gmzd.DrawClone("A*"); 729 g->SetBit(kCanDelete); 730 g->GetHistogram()->SetXTitle("Mag"); 731 g->GetHistogram()->SetYTitle("\\Delta Zd [\\circ]"); 732 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384); 733 line.DrawLine(g->GetXaxis()->GetXmin(), -360./16384, g->GetXaxis()->GetXmax(), -360./16384); 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 } 734 778 #endif 735 779 … … 780 824 gPad->SetGridx(); 781 825 gPad->SetGridy(); 782 g=(TGraph*)grmag.DrawClone("AP"); 783 g->SetBit(kCanDelete); 784 g->GetHistogram()->SetXTitle("Mag"); 785 g->GetHistogram()->SetYTitle("\\Delta [\\circ]"); 786 line.DrawLine(g->GetXaxis()->GetXmin(), 360./16384, g->GetXaxis()->GetXmax(), 360./16384); 787 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 } 788 834 promag.SetLineWidth(2); 789 835 promag.SetLineColor(kBlue); … … 877 923 gPad->Modified(); 878 924 gPad->Update(); 925 DrawHorizon(gPad); 879 926 for (int i=0; i<fOriginal.GetSize(); i++) 880 927 DrawSet(gPad, *(Set*)fOriginal.At(i));//, 10./hres1.GetMean());
Note:
See TracChangeset
for help on using the changeset viewer.