Ignore:
Timestamp:
04/28/03 17:05:50 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r2015 r2032  
    665665    gPad->Update();
    666666
    667     /*
    668      const Double_t maxbin1 = hist1.GetBinContent(hist1.GetMaximumBin());
    669      const Double_t maxbin2 = hist2.GetBinContent(hist2.GetMaximumBin());
    670      const Double_t minbin1 = hist1.GetBinContent(hist1.GetMinimumBin());
    671      const Double_t minbin2 = hist2.GetBinContent(hist2.GetMinimumBin());
    672 
    673      const Double_t max = TMath::Max(maxbin1, maxbin2);
    674      const Double_t min = TMath::Min(minbin1, minbin2);
    675 
    676      hist1.SetMaximum(max>0?max*1.05:max*0.95);
    677      hist1.SetMinimum(max>0?min*0.95:min*1.05);
    678      */
     667    if (hist1.GetEntries()>0 && hist2.GetEntries()>0)
     668    {
     669        const Double_t maxbin1 = hist1.GetBinContent(hist1.GetMaximumBin());
     670        const Double_t maxbin2 = hist2.GetBinContent(hist2.GetMaximumBin());
     671        const Double_t minbin1 = hist1.GetBinContent(hist1.GetMinimumBin());
     672        const Double_t minbin2 = hist2.GetBinContent(hist2.GetMinimumBin());
     673
     674        const Double_t max = TMath::Max(maxbin1, maxbin2);
     675        const Double_t min = TMath::Min(minbin1, minbin2);
     676
     677        if (max!=min)
     678        {
     679            hist1.SetMaximum(max>0?max*1.05:max*0.95);
     680            hist1.SetMinimum(max>0?min*0.95:min*1.05);
     681        }
     682    }
    679683
    680684    TPaveText *t = (TPaveText*)gPad->FindObject("title");
Note: See TracChangeset for help on using the changeset viewer.