Changeset 2274 for trunk/MagicSoft/Mars/mhist/MHCamera.cc
- Timestamp:
- 07/12/03 22:01:34 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2265 r2274 81 81 // Default Constructor. To be used by the root system ONLY. 82 82 // 83 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) , fOptStat(-1)83 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) 84 84 { 85 85 SetDirectory(NULL); … … 478 478 { 479 479 opt.ReplaceAll("hist", ""); 480 Int_t mode = gStyle->GetOptStat(); 481 TVirtualPad *save = gPad; 482 gPad=NULL; 483 gStyle->SetOptStat(fOptStat<0 ? mode : fOptStat); 484 gPad=save; 485 TH1D::Paint(o); 486 gPad=NULL; 487 gStyle->SetOptStat(mode); 488 gPad=save; 480 TH1D::Paint(opt); 489 481 return; 490 482 } … … 496 488 Bool_t iscol = isbox ? !opt.Contains("nocol") : 1; 497 489 498 THistPainter paint; 499 if (!TestBit(TH1::kNoStats)) 500 { 501 paint.SetHistogram(this); 502 paint.PaintStat(fOptStat<0?gStyle->GetOptStat():fOptStat, NULL); 490 GetPainter(); 491 if (fPainter) 492 { 493 if (!TestBit(TH1::kNoStats)) 494 { 495 fPainter->SetHistogram(this); 496 fPainter->PaintStat(gStyle->GetOptStat(), NULL); 497 } 498 499 // Paint primitives (pixels, color legend, photons, ...) 500 if (fPainter->InheritsFrom(THistPainter::Class())) 501 ((THistPainter*)fPainter)->PaintTitle(); 503 502 } 504 503 505 504 // Update Contents of the pixels and paint legend 506 505 Update(gPad->GetLogy(), isbox, iscol); 507 508 // Paint primitives (pixels, color legend, photons, ...)509 paint.PaintTitle();510 506 PaintAxisTitle(); 511 507 } … … 950 946 Int_t MHCamera::DistancetoPrimitive(Int_t px, Int_t py) 951 947 { 948 const Int_t kMaxDiff = 7; 949 950 TPaveStats *box = (TPaveStats*)gPad->GetPrimitive("stats"); 951 if (box) 952 { 953 const Double_t w = box->GetY2NDC()-box->GetY1NDC(); 954 box->SetX1NDC(gStyle->GetStatX()-gStyle->GetStatW()); 955 box->SetY1NDC(gStyle->GetStatY()-w); 956 box->SetX2NDC(gStyle->GetStatX()); 957 box->SetY2NDC(gStyle->GetStatY()); 958 } 959 952 960 if (TString(GetDrawOption()).Contains("hist", TString::kIgnoreCase)) 953 961 return TH1D::DistancetoPrimitive(px, py); … … 959 967 return 0; 960 968 } 961 return 999999; 969 970 if (!box) 971 return 999999; 972 973 const Int_t dist = box->DistancetoPrimitive(px, py); 974 if (dist > kMaxDiff) 975 return 999999; 976 977 gPad->SetSelected(box); 978 return dist; 962 979 } 963 980
Note:
See TracChangeset
for help on using the changeset viewer.