Ignore:
Timestamp:
03/21/02 16:25:12 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MH.cc

    r1215 r1265  
    117117{
    118118    //
     119    // Another strange behaviour: TAxis::Set deletes the axis title!
     120    //
     121    TAxis &x = *h->GetXaxis();
     122
     123    TString xtitle = x.GetTitle();
     124
     125    //
    119126    // This is a necessary workaround if one wants to set
    120127    // non-equidistant bins after the initialization
     
    127134    // in one of the two given histograms
    128135    //
    129     h->GetXaxis()->Set(binsx->GetNumBins(), binsx->GetEdges());
     136    x.Set(binsx->GetNumBins(), binsx->GetEdges());
     137    x.SetTitle(xtitle);
    130138}
    131139
    132140void MH::SetBinning(TH1 *h, const MBinning *binsx, const MBinning *binsy)
    133141{
     142    TAxis &x = *h->GetXaxis();
     143    TAxis &y = *h->GetYaxis();
     144
     145    //
     146    // Another strange behaviour: TAxis::Set deletes the axis title!
     147    //
     148    TString xtitle = x.GetTitle();
     149    TString ytitle = y.GetTitle();
     150
    134151    //
    135152    // This is a necessary workaround if one wants to set
     
    144161    // in one of the two given histograms
    145162    //
    146     h->GetXaxis()->Set(binsx->GetNumBins(), binsx->GetEdges());
    147     h->GetYaxis()->Set(binsy->GetNumBins(), binsy->GetEdges());
     163    x.Set(binsx->GetNumBins(), binsx->GetEdges());
     164    y.Set(binsy->GetNumBins(), binsy->GetEdges());
     165    x.SetTitle(xtitle);
     166    y.SetTitle(ytitle);
    148167}
    149168
    150169void MH::SetBinning(TH1 *h, const MBinning *binsx, const MBinning *binsy, const MBinning *binsz)
    151170{
     171    //
     172    // Another strange behaviour: TAxis::Set deletes the axis title!
     173    //
     174    TAxis &x = *h->GetXaxis();
     175    TAxis &y = *h->GetYaxis();
     176    TAxis &z = *h->GetZaxis();
     177
     178    TString xtitle = x.GetTitle();
     179    TString ytitle = y.GetTitle();
     180    TString ztitle = z.GetTitle();
     181
    152182    //
    153183    // This is a necessary workaround if one wants to set
     
    163193    // in one of the two given histograms
    164194    //
    165     h->GetXaxis()->Set(binsx->GetNumBins(), binsx->GetEdges());
    166     h->GetYaxis()->Set(binsy->GetNumBins(), binsy->GetEdges());
    167     h->GetZaxis()->Set(binsz->GetNumBins(), binsz->GetEdges());
     195    x.Set(binsx->GetNumBins(), binsx->GetEdges());
     196    y.Set(binsy->GetNumBins(), binsy->GetEdges());
     197    z.Set(binsz->GetNumBins(), binsz->GetEdges());
     198    x.SetTitle(xtitle);
     199    y.SetTitle(ytitle);
     200    z.SetTitle(ztitle);
    168201}
    169202
Note: See TracChangeset for help on using the changeset viewer.