Changeset 2274 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 07/12/03 22:01:34 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 2 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 -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r2265 r2274 35 35 TList *fNotify; //! 36 36 37 Int_t fOptStat;37 //Int_t fOptStat; 38 38 39 39 //TGStatusBar *fStatusBar; … … 55 55 }; 56 56 57 Bool_t IsUsed(Int_t idx) const { return TESTBIT(const_cast<TArrayC&>(fUsed)[idx], kIsUsed); }58 57 void SetUsed(Int_t idx) { SETBIT(fUsed[idx], kIsUsed); } 59 58 void ResetUsed(Int_t idx) { CLRBIT(fUsed[idx], kIsUsed); } … … 73 72 MHCamera(const MGeomCam &geom, const char *name="", const char *title=""); 74 73 ~MHCamera(); 74 75 Bool_t IsUsed(Int_t idx) const { return TESTBIT(const_cast<TArrayC&>(fUsed)[idx], kIsUsed); } 75 76 76 77 //void AddPixContent(Int_t idx) const { AddBinContent(idx+1); } … … 135 136 136 137 void SetAutoScale(); // *MENU* 137 void SetOptStat(Int_t os=-1); // *MENU*138 //void SetOptStat(Int_t os=-1); // *MENU* 138 139 139 140 void SetPix(const Int_t pixnum, const Int_t color, Float_t min, Float_t max); // New function added by M.Lopez in 31-01-03 … … 150 151 151 152 inline void MHCamera::SetAutoScale() { fMinimum = fMaximum = -1111; } 152 inline void MHCamera::SetOptStat(Int_t os) { fOptStat = os; }153 //inline void MHCamera::SetOptStat(Int_t os) { fOptStat = os; } 153 154 154 155 #endif
Note:
See TracChangeset
for help on using the changeset viewer.