Changeset 5100 for trunk/MagicSoft/Mars/mhflux
- Timestamp:
- 09/17/04 15:07:15 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhflux
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
r5012 r5100 84 84 Bool_t MAlphaFitter::Fit(TH1D &h, Bool_t paint) 85 85 { 86 Double_t sigint=fSigInt;87 86 Double_t sigmax=fSigMax; 88 87 Double_t bgmin =fBgMin; 89 88 Double_t bgmax =fBgMax; 89 90 //*fLog << inf << "Fit: " << sigmax << " " << fSigInt << " " << bgmin << " " << bgmax << endl; 90 91 91 92 //TF1 fFunc("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90); … … 167 168 } 168 169 // ------------------------------------ 169 const Double_t s = fFunc->Integral(0, sigint)/alphaw; 170 fFunc->SetParameter(0, 0); 171 fFunc->SetParameter(2, 1); 172 const Double_t b = fFunc->Integral(0, sigint)/alphaw; 173 fSignificance = MMath::SignificanceLiMaSigned(s, b); 174 175 const Double_t uin = 1.25*sigint; 176 const Int_t bin = h.GetXaxis()->FindFixBin(uin); 170 171 //const Double_t s = fFunc->Integral(0, fSigInt)/alphaw; 172 fFunc->SetParameter(0, 0); 173 fFunc->SetParameter(2, 1); 174 //const Double_t b = fFunc->Integral(0, fSigInt)/alphaw; 175 //fSignificance = MMath::SignificanceLiMaSigned(s, b); 176 177 178 const Int_t bin = h.GetXaxis()->FindFixBin(fSigInt*0.999); 177 179 178 180 fIntegralMax = h.GetBinLowEdge(bin+1); … … 180 182 fEventsSignal = h.Integral(0, bin); 181 183 fEventsExcess = fEventsSignal-fEventsBackground; 182 //fSignificance = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground); 184 fSignificance = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground); 185 186 if (fEventsExcess<0) 187 fEventsExcess=0; 183 188 184 189 return kTRUE; … … 187 192 void MAlphaFitter::PaintResult(Float_t x, Float_t y, Float_t size) const 188 193 { 189 TLatex text(x, y, Form("\\sigma_{Li/Ma}=%.1f (\\alpha<%.1f\\circ)\\omega=%.1f\\circ E=%d (\\alpha<%.1f\\circ) (\\chi_{b}^{2}=%.1f \\chi_{s}^{2}=%.1f)",190 fSignificance, fSigInt,GetGausSigma(),194 TLatex text(x, y, Form("\\sigma_{Li/Ma}=%.1f \\omega=%.1f\\circ E=%d (\\alpha<%.1f\\circ) (\\chi_{b}^{2}=%.1f \\chi_{s}^{2}=%.1f)", 195 fSignificance, GetGausSigma(), 191 196 (int)fEventsExcess, fIntegralMax, 192 197 fChiSqBg, fChiSqSignal)); … … 196 201 text.Paint(); 197 202 } 203 204 void MAlphaFitter::Copy(TObject &o) const 205 { 206 MAlphaFitter &f = static_cast<MAlphaFitter&>(o); 207 208 f.fSigInt = fSigInt; 209 f.fSigMax = fSigMax; 210 f.fBgMin = fBgMin; 211 f.fBgMax = fBgMax; 212 f.fPolynomOrder = fPolynomOrder; 213 f.fCoefficients.Set(fCoefficients.GetSize()); 214 f.fCoefficients.Reset(); 215 216 TF1 *fcn = f.fFunc; 217 f.fFunc = new TF1(*fFunc); 218 gROOT->GetListOfFunctions()->Remove(f.fFunc); 219 delete fcn; 220 } 221 222 void MAlphaFitter::Print(Option_t *o) const 223 { 224 *fLog << inf << GetDescriptor() << ": Fitting..." << endl; 225 *fLog << " ...background from " << fBgMin << " to " << fBgMax << endl; 226 *fLog << " ...signal to " << fSigMax << " (integrate into bin at " << fSigInt << ")" << endl; 227 *fLog << " ...polynom order " << fPolynomOrder << endl; 228 } -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
r5080 r5100 19 19 { 20 20 private: 21 TF1 *fFunc;22 23 21 Float_t fSigInt; 24 22 Float_t fSigMax; … … 38 36 TArrayD fCoefficients; 39 37 38 TF1 *fFunc; 39 40 40 public: 41 41 // Implementing the function yourself is only about 5% faster 42 MAlphaFitter( ) : fFunc(new TF1("", "gaus(0) + pol1(3)", 0, 90)), fSigInt(10), fSigMax(75), fBgMin(45), fBgMax(85), fPolynomOrder(1), fCoefficients(3+fPolynomOrder+1)42 MAlphaFitter(const char *name=0, const char *title=0) : fSigInt(15), fSigMax(75), fBgMin(45), fBgMax(85), fPolynomOrder(2), fCoefficients(3+fPolynomOrder+1), fFunc(new TF1("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90)) 43 43 { 44 fName = name ? name : "MAlphaFitter"; 45 fTitle = title ? title : "Fit alpha"; 46 44 47 gROOT->GetListOfFunctions()->Remove(fFunc); 45 48 } … … 54 57 } 55 58 56 void Copy(TObject &o) const 57 { 58 MAlphaFitter &f = static_cast<MAlphaFitter&>(o); 59 60 f.fSigInt = fSigInt; 61 f.fSigMax = fSigMax; 62 f.fBgMin = fBgMin; 63 f.fBgMax = fBgMax; 64 f.fPolynomOrder = fPolynomOrder; 65 f.fCoefficients.Set(fCoefficients.GetSize()); 66 f.fCoefficients.Reset(); 67 68 TF1 *fcn = f.fFunc; 69 f.fFunc = new TF1(*fFunc); 70 gROOT->GetListOfFunctions()->Remove(f.fFunc); 71 delete fcn; 72 } 59 void Print(Option_t *o=0) const; 60 void Copy(TObject &o) const; 73 61 74 62 void SetSignalIntegralMax(Float_t s) { fSigInt = s; } -
trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
r5012 r5100 277 277 fit->Copy(fFit); 278 278 279 fFit.Print(); 280 279 281 return kTRUE; 280 282 } … … 540 542 // Store the final result in fFit 541 543 TH1D *h = fHAlpha.ProjectionZ("AlphaExc_px", -1, 9999, -1, 9999, "E"); 544 fFit.Print(); 542 545 Bool_t rc = fFit.Fit(*h); 543 546 delete h; -
trunk/MagicSoft/Mars/mhflux/MHAlpha.h
r5012 r5100 84 84 { 85 85 private: 86 MAlphaFitter fFit; // !SEEMS THAT STREAMER HAS SOME PROBLEMS... MAYBE IF FUNC IS USED AT THE SAME TIME FOR FITS (PAINT)86 MAlphaFitter fFit; // SEEMS THAT STREAMER HAS SOME PROBLEMS... MAYBE IF FUNC IS USED AT THE SAME TIME FOR FITS (PAINT) 87 87 88 88 TH3D fHAlpha; // Alpha vs. theta and energy -
trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc
r5080 r5100 740 740 741 741 //Gaus(Double_t x, Double_t mean=0, Double_t sigma=1, Bool_t norm=kFALSE); 742 return par[0]* (g0+g1);742 return par[0]*g0*g1; 743 743 } 744 744 … … 942 942 943 943 944 TF2 f2d("", FcnGauss2d, -1.5, 1.5, -1.5, 1.5, 6); 944 TF2 f2d("Gaus-2D", FcnGauss2d, -1.5, 1.5, -1.5, 1.5, 6); 945 f2d.SetLineWidth(1); 945 946 f2d.SetParName(0, "Max sigma"); 946 947 f2d.SetParName(1, "Mean_1 deg"); … … 954 955 f2d.SetParLimits(4, 0, 1); // sigma_2 955 956 f2d.SetParLimits(5, 0, 90); // phi 956 f2d.SetParameter(0, maxs); // A957 f2d.SetParameter(1, 0); // mu_1958 f2d.SetParameter(2, 0. 2);// sigma_1959 f2d.SetParameter(3, 0); // mu_2960 f2d.SetParameter(4, 0. 2);// sigma_2961 f2d.SetParameter(5, 0); // phi962 hist->Fit(&f2d, " IN0");963 //f2d.DrawClone("cont2same")->SetBit(kCanDelete);957 f2d.SetParameter(0, maxs); // A 958 f2d.SetParameter(1, 0); // mu_1 959 f2d.SetParameter(2, 0.5); // sigma_1 960 f2d.SetParameter(3, 0); // mu_2 961 f2d.SetParameter(4, 0.5); // sigma_2 962 f2d.SetParameter(5, 0); // phi 963 hist->Fit(&f2d, "NI0"); 964 f2d.DrawCopy("cont2same"); 964 965 965 966
Note:
See TracChangeset
for help on using the changeset viewer.