Changeset 6976
- Timestamp:
- 04/22/05 18:28:07 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r6973 r6976 21 21 22 22 -*-*- END OF LINE -*-*- 23 24 2005/04/22 Thomas Bretz 25 26 * mbase/MStatusArray.[h,cc]: 27 - switch off adding histograms to gDirectory in newly 28 overwritten Read-function 29 30 * mhflux/MHCollectionArea.[h,cc]: 31 - implemented member function GetHistSel 32 - don't display full statistics 33 - fixed a possible crash in Paint 34 35 23 36 24 37 2005/04/22 Markus Meyer -
trunk/MagicSoft/Mars/mbase/MStatusArray.cc
r6948 r6976 29 29 // Helper class for MStatusDisplay 30 30 // 31 // If you want to read a MStatusArray (normally with name MStatusDisplay) 32 // it is recommended to do it like this: 33 // TFile f("myfile.root", "read"); 34 // MStatusArray arr; 35 // arr.Read(); 36 // 37 // If you want to use TFile::Get or TFile::GetObject you should switch off 38 // addding Histograms automatically to the current directory first: 39 // TFile f("myfile.root", "read"); 40 // TH1::AddDirectory(kFALSE); 41 // f.Get("MStatusDisplay"); 42 // 31 43 ////////////////////////////////////////////////////////////////////////////// 32 44 #include "MStatusArray.h" 33 45 46 #include <TH1.h> // TH1::AddDirectoryStatus(); 34 47 #include <TClass.h> 35 48 #include <TCanvas.h> … … 44 57 using namespace std; 45 58 59 // -------------------------------------------------------------------------- 60 // 61 // If o==NULL a new status display is created, otherwise the one with name o 62 // is searched in gROOT->GetListOfSpecials(). 63 // In this display the contents of the MStatusArray is displayed. 64 // 46 65 TObject *MStatusArray::DisplayIn(Option_t *o) const 47 66 { … … 63 82 } 64 83 84 // -------------------------------------------------------------------------- 85 // 86 // Display the contents of the given tab in the display given as argument. 87 // 65 88 void MStatusArray::DisplayIn(MStatusDisplay &d, const char *tab) const 66 89 { … … 224 247 // -------------------------------------------------------------------------- 225 248 // 249 // Switch off adding histograms to current directory before reading. 250 // Switch back 251 // 252 Int_t MStatusArray::Read(const char *name) 253 { 254 const Bool_t store = TH1::AddDirectoryStatus(); 255 TH1::AddDirectory(kFALSE); 256 const Int_t rc = TObjArray::Read(name?name:"MStatusDisplay"); 257 TH1::AddDirectory(store); 258 return rc; 259 } 260 261 // -------------------------------------------------------------------------- 262 // 226 263 // Print recursively all objects in this and sub-pads. If !option.IsNull() 227 264 // only objects in the corresponding pad are printed. -
trunk/MagicSoft/Mars/mbase/MStatusArray.h
r6948 r6976 30 30 31 31 void Print(Option_t *o="") const; 32 void Print(Option_t *wildcard, Option_t *option) const 33 { 34 Print(wildcard); 35 } 32 36 33 37 TObject *FindObject(const char *object, const char *base) const; … … 35 39 TObject *FindObject(const TObject *o) const { return 0; } 36 40 41 Int_t Read(const char *name=NULL); 42 37 43 ClassDef(MStatusArray, 0) // Helper class for status display 38 44 }; -
trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc
r6961 r6976 32 32 33 33 #include <TCanvas.h> 34 #include <TPaveStats.h> 34 35 35 36 #include "MLog.h" … … 274 275 void MHCollectionArea::Paint(Option_t *option) 275 276 { 276 TVirtualPad *pad = gPad; 277 TVirtualPad *pad; 278 279 TPaveStats *st=0; 280 for (int x=0; x<4; x++) 281 { 282 pad=gPad->GetPad(x+1); 283 if (!pad || !(st = (TPaveStats*)pad->GetPrimitive("stats"))) 284 continue; 285 286 if (st->GetOptStat()==11) 287 continue; 288 289 const Double_t y1 = st->GetY1NDC(); 290 const Double_t y2 = st->GetY2NDC(); 291 const Double_t x1 = st->GetX1NDC(); 292 const Double_t x2 = st->GetX2NDC(); 293 294 st->SetY1NDC((y2-y1)/3+y1); 295 st->SetX1NDC((x2-x1)/3+x1); 296 st->SetOptStat(11); 297 } 298 299 pad = gPad; 277 300 278 301 TH1 *h1=0, *h2=0; … … 288 311 h2=fHistSel.ProjectionY("ProjSelY", -1, 9999, "E"); 289 312 290 if (h1 ->GetMaximum()>0)313 if (h1 && h1->GetMaximum()>0) 291 314 { 292 315 gPad->SetLogx(); -
trunk/MagicSoft/Mars/mhflux/MHCollectionArea.h
r6954 r6976 53 53 TH2D &GetHistAll() { return fHistAll; } 54 54 const TH2D &GetHistAll() const { return fHistAll; } 55 const TH2D &GetHistSel() const { return fHistSel; } 55 56 const TH1D &GetHEnergy() const { return fHEnergy; } 56 57
Note:
See TracChangeset
for help on using the changeset viewer.