Changeset 2586 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
12/01/03 20:03:32 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2585 r2586  
    8383     - changed output in PostProcess according to the style in MHillasCalc etc.
    8484     - changed nonsense derivement from MF to MFilter
     85
     86   * mhist/MHCamera.[h,cc]:
     87     - added DrawClone to get rid of the usage of gROOT->GetSelectedPad.
     88       this resulted in some trouble in the past. If it will make more
     89       trouble than before we can remove it again - please report problems.
    8590
    8691
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r2566 r2586  
    355355// Setup a drawing canvas. Add this object and all child objects
    356356// (hexagons, etc) to the current pad. If no pad exists a new one is
    357 // created.
     357// created. (To access the 'real' pad containing the camera you have
     358// to do a cd(1) in the current layer.
    358359//
    359360// To draw a camera into its own pad do something like:
     
    403404    //
    404405    pad->cd();
     406}
     407
     408// ------------------------------------------------------------------------
     409//
     410// This is TObject::DrawClone but completely ignores
     411// gROOT->GetSelectedPad(). tbretz had trouble with this in the past.
     412// If this makes trouble please write a bug report.
     413//
     414TObject *MHCamera::DrawClone(Option_t *option) const
     415{
     416   // Draw a clone of this object in the current pad
     417
     418   //TVirtualPad *pad = gROOT->GetSelectedPad();
     419   TVirtualPad *padsav = gPad;
     420   //if (pad) pad->cd();
     421
     422   TObject *newobj = Clone();
     423   if (!newobj)
     424       return 0;
     425
     426   /*
     427   if (pad) {
     428      if (strlen(option)) pad->GetListOfPrimitives()->Add(newobj,option);
     429      else                pad->GetListOfPrimitives()->Add(newobj,GetDrawOption());
     430      pad->Modified(kTRUE);
     431      pad->Update();
     432      if (padsav) padsav->cd();
     433      return newobj;
     434   }
     435   */
     436
     437   const TString opt(option);
     438   newobj->Draw(opt.IsNull() ? GetDrawOption() : option);
     439
     440   if (padsav)
     441       padsav->cd();
     442
     443   return newobj;
    405444}
    406445
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r2563 r2586  
    127127    virtual void     CntCamContent(const TArrayD &evt, Double_t threshold, Bool_t ispos=kTRUE);
    128128
    129     Stat_t GetBinContent(Int_t bin) const { return Profile(TH1D::GetBinContent(bin)); }
    130     Stat_t GetBinContent(Int_t binx, Int_t biny) const { return GetBinContent(binx); }
    131     Stat_t GetBinContent(Int_t binx, Int_t biny, Int_t binz) const { return GetBinContent(binx); }
    132     Stat_t GetBinError(Int_t bin) const { return Profile(TH1D::GetBinError(bin)); }
    133     Stat_t GetBinError(Int_t binx, Int_t biny) const { return GetBinError(binx); }
    134     Stat_t GetBinError(Int_t binx, Int_t biny, Int_t binz) const { return GetBinError(binx); }
     129    Stat_t   GetBinContent(Int_t bin) const { return Profile(TH1D::GetBinContent(bin)); }
     130    Stat_t   GetBinContent(Int_t binx, Int_t biny) const { return GetBinContent(binx); }
     131    Stat_t   GetBinContent(Int_t binx, Int_t biny, Int_t binz) const { return GetBinContent(binx); }
     132    Stat_t   GetBinError(Int_t bin) const { return Profile(TH1D::GetBinError(bin)); }
     133    Stat_t   GetBinError(Int_t binx, Int_t biny) const { return GetBinError(binx); }
     134    Stat_t   GetBinError(Int_t binx, Int_t biny, Int_t binz) const { return GetBinError(binx); }
    135135
    136136    Double_t GetMinimum(Bool_t all) const;
     
    140140    Double_t GetMaximum() const { return GetMaximum(0/*kTRUE*/); }
    141141
    142     void SetLevels(const TArrayF &arr);
    143 
    144     void  FillRandom(const char *fname, Int_t ntimes=5000) { TH1::FillRandom(fname, ntimes); }
    145     void  FillRandom(TH1 *h, Int_t ntimes=5000) { TH1::FillRandom(h, ntimes); }
    146     void  FillRandom();
    147 
    148     void  PrintInfo() const { Print(""); } // *MENU*
    149     void  Reset(Option_t *);
    150     void  Reset() { Reset(""); } // *MENU*
    151     TH1  *DrawCopy() const/* { gPad=NULL; return TH1D::DrawCopy(); }*/; // *MENU*
    152     TH1  *DrawCopy(Option_t *o) const { return TH1D::DrawCopy(o); }
    153 
    154     void  Print(Option_t *) const;
    155     void  Paint(Option_t *option="");
    156     void  Draw(Option_t *option="");
    157     void  SavePrimitive(ofstream &out, Option_t *);
    158     Int_t DistancetoPrimitive(Int_t px, Int_t py);
    159     char *GetObjectInfo(Int_t px, Int_t py) const;
    160     void  ExecuteEvent(Int_t event, Int_t px, Int_t py);
    161 
    162     void  SetPalette(Int_t ncolors, Int_t *colors);
    163 
    164     void  SetPrettyPalette(); // *MENU*
    165     void  SetDeepBlueSeaPalette(); // *MENU*
    166     void  SetInvDeepBlueSeaPalette(); // *MENU*
    167 
    168     void  SetAutoScale() { fMinimum = fMaximum = -1111; } // *MENU*
    169     void  DisplayAsHistogram() { SetDrawOption("histEP"); } // *MENU*
    170     void  DisplayAsCamera() { SetDrawOption(""); } // *MENU*
    171 
    172     void  SetFreezed(Bool_t f=kTRUE) { f ? SetBit(kFreezed) : ResetBit(kFreezed); } // *TOGGLE*
    173     Bool_t IsFreezed() const { return TestBit(kFreezed); }
     142    void     SetLevels(const TArrayF &arr);
     143
     144    void     FillRandom(const char *fname, Int_t ntimes=5000) { TH1::FillRandom(fname, ntimes); }
     145    void     FillRandom(TH1 *h, Int_t ntimes=5000) { TH1::FillRandom(h, ntimes); }
     146    void     FillRandom();
     147
     148    void     PrintInfo() const { Print(""); } // *MENU*
     149    void     Reset(Option_t *);
     150    void     Reset() { Reset(""); } // *MENU*
     151    TH1     *DrawCopy() const/* { gPad=NULL; return TH1D::DrawCopy(); }*/; // *MENU*
     152    TH1     *DrawCopy(Option_t *o) const { return TH1D::DrawCopy(o); }
     153
     154    void     Print(Option_t *) const;
     155    void     Paint(Option_t *option="");
     156    void     Draw(Option_t *option="");
     157    TObject *DrawClone(Option_t *option) const;
     158    void     SavePrimitive(ofstream &out, Option_t *);
     159    Int_t    DistancetoPrimitive(Int_t px, Int_t py);
     160    char    *GetObjectInfo(Int_t px, Int_t py) const;
     161    void     ExecuteEvent(Int_t event, Int_t px, Int_t py);
     162
     163    void     SetPalette(Int_t ncolors, Int_t *colors);
     164
     165    void     SetPrettyPalette(); // *MENU*
     166    void     SetDeepBlueSeaPalette(); // *MENU*
     167    void     SetInvDeepBlueSeaPalette(); // *MENU*
     168
     169    void     SetAutoScale() { fMinimum = fMaximum = -1111; } // *MENU*
     170    void     DisplayAsHistogram() { SetDrawOption("histEP"); } // *MENU*
     171    void     DisplayAsCamera() { SetDrawOption(""); } // *MENU*
     172
     173    void     SetFreezed(Bool_t f=kTRUE) { f ? SetBit(kFreezed) : ResetBit(kFreezed); } // *TOGGLE*
     174    Bool_t   IsFreezed() const { return TestBit(kFreezed); }
    174175    //void  SetOptStat(Int_t os=-1) { fOptStat = os; } // *MENU*
    175176
    176     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
    177 
    178     void  AddNotify(const MCamEvent &event) { fNotify->Add((TObject*)(&event)); }
    179 
    180     Stat_t GetMean(Int_t axis=-1) const;
    181     Stat_t GetRMS(Int_t axis=-1) const;
    182 
    183     UInt_t GetNumPixels() const;
     177    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
     178
     179    void     AddNotify(const MCamEvent &event) { fNotify->Add((TObject*)(&event)); }
     180
     181    Stat_t   GetMean(Int_t axis=-1) const;
     182    Stat_t   GetRMS(Int_t axis=-1) const;
     183
     184    UInt_t   GetNumPixels() const;
    184185
    185186    //void SetStatusBar(TGStatusBar *bar) { fStatusBar = bar; }
Note: See TracChangeset for help on using the changeset viewer.