Changeset 5006 for trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
- Timestamp:
- 09/14/04 16:54:56 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
r5002 r5006 46 46 #include "MMath.h" 47 47 48 #include "MLogManip.h" 49 48 50 ClassImp(MAlphaFitter); 49 51 … … 86 88 Double_t bgmin=fBgMin; 87 89 Double_t bgmax=fBgMax; 88 Byte_t polynom=fPolynom ;90 Byte_t polynom=fPolynomOrder; 89 91 90 92 // Implementing the function yourself is only about 5% faster 91 93 TF1 func("", Form("gaus(0) + pol%d(3)", polynom), 0, 90); 92 94 //TF1 func("", Form("[0]*(TMath::Gaus(x, [1], [2])+TMath::Gaus(x, -[1], [2]))+pol%d(3)", polynom), 0, 90); 93 TArrayD maxpar(func.GetNpar()); 95 96 if (fCoefficients.GetSize() != polynom+3) 97 { 98 fCoefficients.Set(polynom+3); 99 fCoefficients.Reset(); 100 } 101 else 102 func.SetParameters(fCoefficients.GetArray()); 94 103 95 104 func.FixParameter(1, 0); … … 154 163 h.Fit(&func, "NQI", "", 0, sigmax); 155 164 156 fChiSqSignal 157 f SigmaGaus = func.GetParameter(2);165 fChiSqSignal = func.GetChisquare()/func.GetNDF(); 166 fCoefficients.Set(func.GetNpar(), func.GetParameters()); 158 167 159 168 //const Bool_t ok = NDF>0 && chi2<2.5*NDF; … … 167 176 } 168 177 // ------------------------------------ 169 const Double_t s= func.Integral(0, sigint)/alphaw;178 //const Double_t s = func.Integral(0, sigint)/alphaw; 170 179 func.SetParameter(0, 0); 171 180 func.SetParameter(2, 1); 172 const Double_t b= func.Integral(0, sigint)/alphaw;173 174 fSignificance = MMath::SignificanceLiMaSigned(s, b);181 //const Double_t b = func.Integral(0, sigint)/alphaw; 182 183 //fSignificance = MMath::SignificanceLiMaSigned(s, b); 175 184 //exc = s-b; 176 185 177 186 const Double_t uin = 1.25*sigint; 178 187 const Int_t bin = h.GetXaxis()->FindFixBin(uin); 179 fIntegralMax = h.GetBinLowEdge(bin+1); 180 fExcessEvents = h.Integral(0, bin)-func.Integral(0, fIntegralMax)/alphaw; 188 189 fIntegralMax = h.GetBinLowEdge(bin+1); 190 fEventsBackground = func.Integral(0, fIntegralMax)/alphaw; 191 fEventsSignal = h.Integral(0, bin); 192 fEventsExcess = fEventsSignal-fEventsBackground; 193 fSignificance = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground); 181 194 182 195 return kTRUE; … … 186 199 { 187 200 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)", 188 fSignificance, fSigInt, fSigmaGaus,189 (int)fE xcessEvents, fIntegralMax,201 fSignificance, fSigInt, GetGausSigma(), 202 (int)fEventsExcess, fIntegralMax, 190 203 fChiSqBg, fChiSqSignal)); 191 204
Note:
See TracChangeset
for help on using the changeset viewer.