Ignore:
Timestamp:
06/18/08 21:39:50 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc

    r8977 r8978  
    4848#include "MLogManip.h"
    4949
     50#include "MMath.h"
    5051#include "MDirIter.h"
    5152
     
    292293
    293294    const Double_t ufl = vstime->GetBinContent(0);
     295    const Double_t ofl = vstime->GetBinContent(vstime->GetNbinsX()+1);
     296    const Double_t eff = vstime->Integral()+ufl+ofl;
    294297    if (ufl>0)
    295298    {
     
    301304        *fLog << warn << "WARNING - " << Form("%.1f%% (%.0fs)", 100*ufl/eff, ufl) << " of the eff. observation time is in the underflow bin." << endl;
    302305    }
    303 
    304     const Double_t ofl = vstime->GetBinContent(vstime->GetNbinsX()+1);
    305     const Double_t eff = vstime->Integral()+ufl+ofl;
    306306    if (ofl>0)
    307307        *fLog << warn << "WARNING - " << Form("%.1f%% (%.0fs)", 100*ofl/eff, ofl) << " of the eff. observation time is in the overflow bin." << endl;
     
    872872TString MJSpectrum::FormString(const TF1 &f, Byte_t type)
    873873{
    874     const Double_t p0 = f.GetParameter(0);
    875     const Double_t p1 = f.GetParameter(1);
    876 
    877     const Double_t e0 = f.GetParError(0);
    878     const Double_t e1 = f.GetParError(1);
    879 
    880     const Int_t    np  = TMath::Nint(TMath::Floor(TMath::Log10(p1)));
    881     const Double_t exp = TMath::Power(10, np);
    882 
    883     const Float_t fe0 = TMath::Log10(e0);
    884     const Float_t fe1 = TMath::Log10(e1);
    885 
    886     // calc number of (gueltige ziffern) digits to be displayed
    887     const char *f0  = fe0-TMath::Floor(fe0)>0.3 ? "3.1" : "1.0";
    888     const char *f1  = fe1-TMath::Floor(fe1)>0.3 ? "3.1" : "1.0";
     874    Double_t p0 = f.GetParameter(0);
     875    Double_t p1 = f.GetParameter(1);
     876
     877    Double_t e0 = f.GetParError(0);
     878    Double_t e1 = f.GetParError(1);
     879
     880    MMath::Format(p0, e0);
     881    MMath::Format(p1, e1);
    889882
    890883    TString str;
     
    893886    case 0:
    894887        {
    895             const TString fmt0 = Form("(%%%sf#pm%%%sf)\\bullet10^{%%d}",  f1, f1);
    896             const TString fmt1 = Form("(\\frac{E}{500GeV})^{%%%sf#pm%%%sf}", f0, f0);
    897 
    898             str  = Form(fmt0.Data(), p1/exp, e1/exp, np);
    899             str += Form(fmt1.Data(), p0, e0);
     888            const Int_t    i   = TMath::FloorNint(TMath::Log10(p1));
     889            const Double_t exp = TMath::Power(10, i);
     890
     891            str  = Form("(%f#pm%f)\\bullet10^{%d}",      p1/exp, e1/exp, i);
     892            str += Form("(\\frac{E}{500GeV})^{%f#pm%f}", p0, e0);
    900893            str += "\\frac{ph}{TeVm^{2}s}";
    901894        }
Note: See TracChangeset for help on using the changeset viewer.