Changeset 8985 for trunk/MagicSoft/Mars/mjobs
- Timestamp:
- 06/20/08 13:45:16 (17 years ago)
- Location:
- trunk/MagicSoft/Mars/mjobs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc ¶
r8978 r8985 870 870 */ 871 871 872 TString MJSpectrum::FormString(const TF1 &f, Byte_t type) 872 TString MJSpectrum::FormFloat(Double_t d) 873 { 874 TString s; 875 s += d; 876 return s.Strip(TString::kLeading); 877 } 878 879 TString MJSpectrum::FormFlux(const TF1 &f, const char *unit) 873 880 { 874 881 Double_t p0 = f.GetParameter(0); … … 881 888 MMath::Format(p1, e1); 882 889 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 904 TString MJSpectrum::FormString(const TF1 &f, Byte_t type) 905 { 884 906 switch (type) 885 907 { 886 908 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"); 896 910 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()); 899 912 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 ""; 904 916 } 905 917 -
TabularUnified trunk/MagicSoft/Mars/mjobs/MJSpectrum.h ¶
r8940 r8985 78 78 void SetEnergyEstimator(const MTask *task); 79 79 80 static TString FormFloat(Double_t d); 81 static TString FormFlux(const TF1 &f, const char *unit); 80 82 static TString FormString(const TF1 &f, Byte_t type=0); 81 83
Note:
See TracChangeset
for help on using the changeset viewer.