Ignore:
Timestamp:
06/20/08 13:45:16 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mjobs
Files:
2 edited

Legend:

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

    r8978 r8985  
    870870*/
    871871
    872 TString MJSpectrum::FormString(const TF1 &f, Byte_t type)
     872TString MJSpectrum::FormFloat(Double_t d)
     873{
     874    TString s;
     875    s += d;
     876    return s.Strip(TString::kLeading);
     877}
     878
     879TString MJSpectrum::FormFlux(const TF1 &f, const char *unit)
    873880{
    874881    Double_t p0 = f.GetParameter(0);
     
    881888    MMath::Format(p1, e1);
    882889
    883     TString str;
     890    const Int_t    i   = TMath::FloorNint(TMath::Log10(p1));
     891    const Double_t exp = TMath::Power(10, i);
     892
     893    TString str = Form("(%s #pm %s)·10^{%d} ",
     894                       FormFloat(p1/exp).Data(), FormFloat(e1/exp).Data(), i);
     895
     896    str += Form("#left(#frac{E}{%s}#right)^{%s #pm %s}", unit,
     897                FormFloat(p0).Data(), FormFloat(e0).Data());
     898
     899    str += " TeV^{-1} m^{-2} s^{-1}";
     900
     901    return str;
     902}
     903
     904TString MJSpectrum::FormString(const TF1 &f, Byte_t type)
     905{
    884906    switch (type)
    885907    {
    886908    case 0:
    887         {
    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);
    893             str += "\\frac{ph}{TeVm^{2}s}";
    894         }
    895         break;
     909        return FormFlux(f, "500GeV");
    896910    case 1:
    897         str = Form("\\chi^{2}/NDF=%.2f/%d", f.GetChisquare(),f.GetNDF());
    898         break;
     911        return Form("\\chi^{2}/NDF=%.2f/%d", f.GetChisquare(),f.GetNDF());
    899912    case 2:
    900         str = Form("P=%.0f%%", 100*TMath::Prob(f.GetChisquare(),  f.GetNDF()));
    901         break;
    902     }
    903     return str;
     913        return Form("P=%.0f%%", 100*TMath::Prob(f.GetChisquare(),  f.GetNDF()));
     914    }
     915    return "";
    904916}
    905917
  • trunk/MagicSoft/Mars/mjobs/MJSpectrum.h

    r8940 r8985  
    7878    void SetEnergyEstimator(const MTask *task);
    7979
     80    static TString FormFloat(Double_t d);
     81    static TString FormFlux(const TF1 &f, const char *unit);
    8082    static TString FormString(const TF1 &f, Byte_t type=0);
    8183
Note: See TracChangeset for help on using the changeset viewer.