Changeset 6976


Ignore:
Timestamp:
04/22/05 18:28:07 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r6973 r6976  
    2121
    2222                                                 -*-*- 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
    2336
    2437 2005/04/22 Markus Meyer
  • trunk/MagicSoft/Mars/mbase/MStatusArray.cc

    r6948 r6976  
    2929//  Helper class for MStatusDisplay
    3030//
     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//
    3143//////////////////////////////////////////////////////////////////////////////
    3244#include "MStatusArray.h"
    3345
     46#include <TH1.h>      // TH1::AddDirectoryStatus();
    3447#include <TClass.h>
    3548#include <TCanvas.h>
     
    4457using namespace std;
    4558
     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//
    4665TObject *MStatusArray::DisplayIn(Option_t *o) const
    4766{
     
    6382}
    6483
     84// --------------------------------------------------------------------------
     85//
     86// Display the contents of the given tab in the display given as argument.
     87//
    6588void MStatusArray::DisplayIn(MStatusDisplay &d, const char *tab) const
    6689{
     
    224247// --------------------------------------------------------------------------
    225248//
     249// Switch off adding histograms to current directory before reading.
     250// Switch back
     251//
     252Int_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//
    226263// Print recursively all objects in this and sub-pads. If !option.IsNull()
    227264// only objects in the corresponding pad are printed.
  • trunk/MagicSoft/Mars/mbase/MStatusArray.h

    r6948 r6976  
    3030
    3131    void Print(Option_t *o="") const;
     32    void Print(Option_t *wildcard, Option_t *option) const
     33    {
     34        Print(wildcard);
     35    }
    3236
    3337    TObject *FindObject(const char *object, const char *base) const;
     
    3539    TObject *FindObject(const TObject *o) const { return 0; }
    3640
     41    Int_t Read(const char *name=NULL);
     42
    3743    ClassDef(MStatusArray, 0) // Helper class for status display
    3844};
  • trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc

    r6961 r6976  
    3232
    3333#include <TCanvas.h>
     34#include <TPaveStats.h>
    3435
    3536#include "MLog.h"
     
    274275void MHCollectionArea::Paint(Option_t *option)
    275276{
    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;
    277300
    278301    TH1 *h1=0, *h2=0;
     
    288311        h2=fHistSel.ProjectionY("ProjSelY", -1, 9999, "E");
    289312
    290     if (h1->GetMaximum()>0)
     313    if (h1 && h1->GetMaximum()>0)
    291314    {
    292315        gPad->SetLogx();
  • trunk/MagicSoft/Mars/mhflux/MHCollectionArea.h

    r6954 r6976  
    5353    TH2D &GetHistAll()             { return fHistAll; }
    5454    const TH2D &GetHistAll() const { return fHistAll; }
     55    const TH2D &GetHistSel() const { return fHistSel; }
    5556    const TH1D &GetHEnergy() const { return fHEnergy; }
    5657
Note: See TracChangeset for help on using the changeset viewer.