- Timestamp:
- 07/25/05 10:35:31 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7216 r7217 20 20 21 21 -*-*- END OF LINE -*-*- 22 23 2005/07/25 Thomas Bretz 24 25 * mastro/MAstroSky2Local.[h,cc]: 26 - allow setting a pointing deviation when calculating the rotation angle 27 28 * mhflux/MHDisp.[h,cc]: 29 - added pot for a significance map 30 - changed alignment range from 0.33/0.47 to 0.325/0.475 31 - added fDeviation to calculation of Rotatio angle 32 - removed some obsolete code 33 34 * mpointing/MPointingPos.[h,cc]: 35 - added option to calculate Rotation angle using MPointingDev 36 37 38 22 39 2005/07/22 Daniela Dorner 23 40 -
trunk/MagicSoft/Mars/mastro/MAstroSky2Local.cc
r3568 r7217 129 129 // seen with an Alt/Az telescope. 130 130 // 131 // dzd and daz is a pointing offset, which is subtracted from the 132 // calculated local coordinates correspoding to time, observatory 133 // and ra/dec. 134 // 131 135 // For more information see MAstro::RotationAngle 132 136 // 133 Double_t MAstroSky2Local::RotationAngle(Double_t ra, Double_t dec ) const137 Double_t MAstroSky2Local::RotationAngle(Double_t ra, Double_t dec, Double_t dzd, Double_t daz) const 134 138 { 135 139 TVector3 v; … … 137 141 v *= *this; 138 142 139 return MAstro::RotationAngle(ZZ(), XZ(), v.Theta() , v.Phi());143 return MAstro::RotationAngle(ZZ(), XZ(), v.Theta()-dzd, v.Phi()-daz); 140 144 } -
trunk/MagicSoft/Mars/mastro/MAstroSky2Local.h
r3533 r7217 18 18 MAstroSky2Local(const MTime &t, const MObservatory &obs); 19 19 20 Double_t RotationAngle(Double_t ra, Double_t dec ) const;20 Double_t RotationAngle(Double_t ra, Double_t dec, Double_t dzd=0, Double_t daz=0) const; 21 21 22 22 ClassDef(MAstroSky2Local, 1) // Rotation Matrix to convert sky coordinates to ideal local coordinates -
trunk/MagicSoft/Mars/mhflux/MHDisp.cc
r7208 r7217 51 51 #include "MParameters.h" 52 52 53 #include "MHillasExt.h" 54 #include "MHillasSrc.h" 53 #include "MHillas.h" 55 54 #include "MSrcPosCam.h" 56 55 #include "MPointingPos.h" 56 #include "MPointingDev.h" 57 57 58 58 ClassImp(MHDisp); … … 65 65 // 66 66 MHDisp::MHDisp(const char *name, const char *title) 67 : f HilExt(0), fDisp(0), fSmearing(-1), fWobble(kFALSE)67 : fDisp(0), fDeviation(0), fSmearing(-1), fWobble(kFALSE) 68 68 { 69 69 // … … 106 106 } 107 107 108 fHilExt = (MHillasExt*)plist->FindObject("MHillasExt"); 109 if (!fHilExt) 110 { 111 *fLog << err << "MHillasExt not found... aborting." << endl; 112 return kFALSE; 113 } 114 115 fHilSrc = (MHillasSrc*)plist->FindObject("MHillasSrc"); 116 if (!fHilSrc) 117 { 118 *fLog << err << "MHillasSrc not found... aborting." << endl; 119 return kFALSE; 120 } 108 fDeviation = (MPointingDev*)plist->FindObject("MPointingDev"); 109 if (!fDeviation) 110 *fLog << warn << "MPointingDev not found... ignored." << endl; 121 111 122 112 MBinning binsx, binsy; … … 160 150 Double_t rho = 0; 161 151 if (fTime && fObservatory && fPointPos) 162 rho = fPointPos->RotationAngle(*fObservatory, *fTime );152 rho = fPointPos->RotationAngle(*fObservatory, *fTime, fDeviation); 163 153 164 154 // Vector of length disp in direction of shower … … 347 337 // 348 338 // Return the mean signal in h around (0,0) in a distance between 349 // 0.3 3 and 0.47deg339 // 0.325 and 0.475deg 350 340 // 351 341 Double_t MHDisp::GetOffSignal(TH1 &h) const … … 360 350 { 361 351 const Double_t d = TMath::Hypot(axex.GetBinCenter(x+1), axey.GetBinCenter(y+1)); 362 if (d>0.33 && d<0.47) 363 //if (d>0.4 && d<0.8) 352 if (d>0.325 && d<0.475) 364 353 { 365 354 sum += h.GetBinContent(x+1,y+1); … … 367 356 } 368 357 } 369 370 358 return sum/cnt; 371 359 } … … 415 403 if (rmax<TMath::Hypot(px, py)) 416 404 h2.SetBinContent(bin, 0); 405 else 406 if (h2.GetBinContent(bin)==0) 407 h2.SetBinContent(bin, 1e-10); 417 408 } 418 409 } … … 427 418 const TAxis &axey = *s.GetYaxis(); 428 419 429 for (int x=1; x<=axex.GetNbins(); x++) 430 for (int y=1; y<=axey.GetNbins(); y++) 431 { 432 const Int_t bin = s.GetBin(x,y); 433 434 const Double_t sig = h1.GetBinContent(bin); 435 const Double_t bg = h2.GetBinContent(bin); 436 437 const Double_t S = MMath::SignificanceLiMaSigned(sig, bg, TMath::Abs(scale)); 438 420 const Int_t n = TMath::Nint(0.2/axex.GetBinWidth(1)); 421 422 for (int x=1+n; x<=axex.GetNbins()-n; x++) 423 for (int y=1+n; y<=axey.GetNbins()-n; y++) 424 { 425 Double_t sig=0; 426 Double_t bg =0; 427 428 for (int dx=-n; dx<=n; dx++) 429 for (int dy=-n; dy<=n; dy++) 430 { 431 if (TMath::Hypot((float)dx, (float)dy)>n) 432 continue; 433 434 const Int_t bin = s.GetBin(x+dx,y+dy); 435 436 sig += h1.GetBinContent(bin); 437 bg += h2.GetBinContent(bin); 438 } 439 440 const Double_t S = sig>0 ? MMath::SignificanceLiMaSigned(sig, bg, TMath::Abs(scale)) : 0; 441 442 const Int_t bin = s.GetBin(x,y); 439 443 s.SetBinContent(bin, S); 440 444 } 441 445 } 442 446 447 void MHDisp::Profile1D(const char *name, const TH2 &h) const 448 { 449 if (!gPad) 450 return; 451 452 TH1D *hrc = dynamic_cast<TH1D*>(gPad->FindObject(name)); 453 if (!hrc) 454 return; 455 456 hrc->Reset(); 457 458 const Double_t max = h.GetMaximum(); 459 460 MBinning(50, -max*1.1, max*1.1).Apply(*hrc); 461 462 for (int x=1; x<=h.GetXaxis()->GetNbins(); x++) 463 for (int y=1; y<=h.GetXaxis()->GetNbins(); y++) 464 { 465 const Int_t bin = h.GetBin(x,y); 466 const Double_t sig = h.GetBinContent(bin); 467 if (sig!=0) 468 hrc->Fill(sig); 469 } 470 471 gPad->SetLogy(hrc->GetMaximum()>0); 472 473 if (!fHistOff || hrc->GetRMS()<0.1) 474 return; 475 476 // ---------- Fix mean ---------- 477 // TF1 *g = (TF1*)gROOT->GetFunction("gaus"); 478 // g->FixParameter(1, 0); 479 // hrc->Fit("gaus", "BQI"); 480 481 hrc->Fit("gaus", "QI"); 482 483 TF1 *f = hrc->GetFunction("gaus"); 484 if (f) 485 { 486 f->SetLineWidth(1); 487 f->SetLineColor(kBlue); 488 } 489 } 443 490 444 491 void MHDisp::Paint(Option_t *o) … … 460 507 h1->SetContour(99); 461 508 509 TH2 *hx=0; 510 462 511 Double_t scale = 1; 463 512 if (fHistOff) … … 467 516 TH2 *h=(TH2*)fHistOff->Project3D("yx_off"); 468 517 469 scale = -1;470 471 518 const Double_t h1off = GetOffSignal(*h1); 472 519 const Double_t hoff = GetOffSignal(fHistBg); … … 474 521 scale = hoff==0 ? -1 : -h1off/hoff; 475 522 476 const Bool_t sig = kFALSE; 477 478 if (!sig) 479 h1->Add(&fHistBg, scale); 480 else 481 MakeSignificance(*h1, *h1, fHistBg, scale); 523 hx = (TH2*)pad->GetPad(4)->FindObject("Alpha_yx_sig"); 524 if (hx) 525 { 526 hx->SetContour(99); 527 MakeSignificance(*hx, *h1, fHistBg, scale); 528 MakeDot(*hx); 529 MakeSymmetric(hx); 530 } 531 532 h1->Add(&fHistBg, scale); 482 533 483 534 MakeDot(*h1); 535 MakeSymmetric(h1); 484 536 485 537 delete h; 486 487 MakeSymmetric(h1);488 538 } 489 539 … … 515 565 func.SetParameter(0, h2->GetBinContent(1)); 516 566 func.FixParameter(1, 0); 517 func.SetParameter(2, 0.1 5);567 func.SetParameter(2, 0.12); 518 568 if (fHistOff) 519 569 func.FixParameter(3, 0); 520 func.SetParameter(4, h2->GetBinContent(15));570 func.SetParameter(4, 0);//h2->GetBinContent(20)); 521 571 h2->Fit(&func, "IQ", "", 0, 1.0); 522 572 523 573 h2->SetTitle(Form("P=(%.2f\\circ/%.2f\\circ) \\omega=%.2f\\circ f=%.2f", x0, y0, func.GetParameter(2), TMath::Abs(scale))); 524 574 } 575 576 pad->cd(5); 577 if (h1) 578 Profile1D("Exc", *h1); 579 580 pad->cd(6); 581 if (hx) 582 Profile1D("Sig", *hx); 525 583 } 526 584 … … 533 591 AppendPad(o); 534 592 535 TString name = Form("%s_1", pad->GetName()); 536 TPad *p = new TPad(name,name, 0.005, 0.005, 0.65, 0.995, col, 0, 0); 593 // ----- Pad number 4 ----- 594 TString name = Form("%s_4", pad->GetName()); 595 TPad *p = new TPad(name,name, 0.5025, 0.3355, 0.995, 0.995, col, 0, 0); 596 p->SetNumber(4); 597 p->Draw(); 598 p->cd(); 599 600 TH1 *h3 = fHist.Project3D("yx_sig"); 601 h3->SetTitle("Significance Map"); 602 h3->SetDirectory(NULL); 603 h3->SetXTitle(fHist.GetXaxis()->GetTitle()); 604 h3->SetYTitle(fHist.GetYaxis()->GetTitle()); 605 h3->SetMinimum(0); 606 h3->Draw("colz"); 607 h3->SetBit(kCanDelete); 608 609 if (fHistOff) 610 GetCatalog()->Draw("white mirror same *"); 611 612 // ----- Pad number 1 ----- 613 pad->cd(); 614 name = Form("%s_1", pad->GetName()); 615 p = new TPad(name,name, 0.005, 0.3355, 0.4975, 0.995, col, 0, 0); 537 616 p->SetNumber(1); 538 617 p->Draw(); 539 618 p->cd(); 540 619 541 TH1 *h3 = fHist.Project3D("yx_on");620 h3 = fHist.Project3D("yx_on"); 542 621 h3->SetTitle("Distribution of equivalent events"); 543 622 h3->SetDirectory(NULL); … … 551 630 GetCatalog()->Draw("white mirror same *"); 552 631 632 // ----- Pad number 2 ----- 553 633 pad->cd(); 554 634 name = Form("%s_2", pad->GetName()); 555 p = new TPad(name,name, 0. 66, 0.005, 0.995, 0.5, col, 0, 0);635 p = new TPad(name,name, 0.005, 0.005, 0.2485, 0.3315, col, 0, 0); 556 636 p->SetNumber(2); 557 637 p->Draw(); … … 559 639 h3->Draw("surf3"); 560 640 641 // ----- Pad number 3 ----- 561 642 pad->cd(); 562 643 name = Form("%s_3", pad->GetName()); 563 p = new TPad(name,name, 0. 66, 0.5, 0.995, 0.995, col, 0, 0);644 p = new TPad(name,name, 0.2525, 0.005, 0.4985, 0.3315, col, 0, 0); 564 645 p->SetNumber(3); 565 646 p->SetGrid(); … … 577 658 h->SetBit(kCanDelete); 578 659 h->Draw(); 660 661 // ----- Pad number 5 ----- 662 pad->cd(); 663 name = Form("%s_5", pad->GetName()); 664 p = new TPad(name,name, 0.5025, 0.005, 0.7485, 0.3315, col, 0, 0); 665 p->SetNumber(5); 666 p->SetGrid(); 667 p->Draw(); 668 p->cd(); 669 670 h3 = new TH1D("Exc", "Distribution of excess events", 10, -1, 1); 671 h3->SetDirectory(NULL); 672 h3->SetXTitle("N"); 673 h3->SetYTitle("Counts"); 674 h3->Draw(); 675 h3->SetBit(kCanDelete); 676 677 // ----- Pad number 6 ----- 678 pad->cd(); 679 name = Form("%s_6", pad->GetName()); 680 p = new TPad(name,name, 0.7525, 0.005, 0.9995, 0.3315, col, 0, 0); 681 p->SetNumber(6); 682 p->SetGrid(); 683 p->Draw(); 684 p->cd(); 685 686 h3 = new TH1D("Sig", "Distribution of significances", 10, -1, 1); 687 h3->SetDirectory(NULL); 688 h3->SetXTitle("N"); 689 h3->SetYTitle("Counts"); 690 h3->Draw(); 691 h3->SetBit(kCanDelete); 579 692 } 580 693 -
trunk/MagicSoft/Mars/mhflux/MHDisp.h
r7193 r7217 16 16 class MHillasSrc; 17 17 class MParameterD; 18 class MPointingDev; 18 19 19 20 class MHDisp : public MHFalseSource 20 21 { 21 22 private: 22 MHillasExt *fHilExt; //!23 MHillasSrc *fHilSrc; //!24 23 MParameterD *fDisp; //! 24 MPointingDev *fDeviation; //! 25 25 26 26 TH2D fHistBg; 27 28 27 TH2D fHistBg1; 29 28 TH2D fHistBg2; … … 39 38 Double_t DeltaPhiSrc(const TVector2 &v) const; 40 39 40 void Profile1D(const char *name, const TH2 &h) const; 41 41 void Profile(TH1 &h2, const TH2 &h1, Axis_t x0=0, Axis_t y0=0) const; 42 42 void MakeSignificance(TH2 &s, const TH2 &h1, const TH2 &h2, const Double_t scale=1) const; -
trunk/MagicSoft/Mars/mpointing/MPointingPos.cc
r3666 r7217 44 44 #include "MTime.h" 45 45 #include "MObservatory.h" 46 #include "MPointingDev.h" 46 47 #include "MAstroSky2Local.h" 47 48 … … 71 72 // For more information see MAstro::RotationAngle 72 73 // 73 Double_t MPointingPos::RotationAngle(const MObservatory &o, const MTime &t ) const74 Double_t MPointingPos::RotationAngle(const MObservatory &o, const MTime &t, const MPointingDev *dev) const 74 75 { 75 return MAstroSky2Local(t, o).RotationAngle(GetRaRad(), GetDecRad()); 76 return dev ? 77 MAstroSky2Local(t, o).RotationAngle(GetRaRad(), GetDecRad(), dev->GetDevZdRad(), dev->GetDevAzRad()): 78 MAstroSky2Local(t, o).RotationAngle(GetRaRad(), GetDecRad()); 76 79 } -
trunk/MagicSoft/Mars/mpointing/MPointingPos.h
r7205 r7217 13 13 class MTime; 14 14 class MObservatory; 15 class MPointingDev; 15 16 16 17 class MPointingPos : public MParContainer … … 54 55 55 56 Double_t RotationAngle(const MObservatory &o) const; 56 Double_t RotationAngle(const MObservatory &o, const MTime &t ) const;57 Double_t RotationAngle(const MObservatory &o, const MTime &t, const MPointingDev *dev=0) const; 57 58 Double_t RotationAngle(const MObservatory &o, const MTime *t) const 58 59 {
Note:
See TracChangeset
for help on using the changeset viewer.