Changeset 8989 for trunk/MagicSoft/Mars/mhflux
- Timestamp:
- 07/01/08 15:04:01 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/mhflux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
r8780 r8989 18 18 ! Author(s): Thomas Bretz, 3/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 420 ! Copyright: MAGIC Software Development, 2000-2008 21 21 ! 22 22 ! … … 42 42 // + TArrayD fErrors; // errors of coefficients 43 43 // 44 // Version 4: 45 // ---------- 46 // + Double_t fErrorExcess; 47 // - Double_t fSignificanceExc; 48 // 44 49 // 45 50 ////////////////////////////////////////////////////////////////////////////// … … 68 73 { 69 74 fSignificance=0; 70 f SignificanceExc=0;75 fErrorExcess=0; 71 76 fEventsExcess=0; 72 77 fEventsSignal=0; … … 168 173 fEventsExcess = fEventsSignal-fEventsBackground; 169 174 fSignificance = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground); 170 f SignificanceExc = MMath::SignificanceLiMaExc(fEventsSignal, fEventsBackground);175 fErrorExcess = MMath::ErrorExc(fEventsSignal, fEventsBackground); 171 176 172 177 // !Finitite includes IsNaN 173 178 if (!TMath::Finite(fSignificance)) 174 179 fSignificance=0; 175 176 if (fEventsExcess<0)177 fEventsExcess=0;178 180 } 179 181 … … 282 284 const Int_t bin = hon.GetXaxis()->FindFixBin(fSigInt*0.999); 283 285 284 285 286 MAlphaFitter fit(*this); 286 287 fit.EnableBackgroundFit(); … … 290 291 // off-source in the off-source region and the on-data in the source-region 291 292 TH1D h(hof); 293 h.SetDirectory(0); 292 294 h.Add(&hon); 293 295 h.Scale(0.5); … … 342 344 { 343 345 TH1D h(hon); 346 h.SetDirectory(0); 344 347 h.Add(&hof, -1); // substracts also number of entries! 345 348 h.SetEntries(hon.GetEntries()); … … 354 357 fCoefficients = fit.GetCoefficients(); 355 358 fErrors = fit.GetErrors(); 356 357 359 358 360 // ---------------------------------------------------------------------------- … … 372 374 fScaleFactor = alpha; 373 375 fSignificance = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground/alpha, alpha); 374 f SignificanceExc = MMath::SignificanceLiMaExc(fEventsSignal, fEventsBackground/alpha, alpha);376 fErrorExcess = MMath::ErrorExc(fEventsSignal, fEventsBackground/alpha, alpha); 375 377 376 378 // !Finitite includes IsNaN 377 379 if (!TMath::Finite(fSignificance)) 378 380 fSignificance=0; 379 if (fEventsExcess<0)380 fEventsExcess=0;381 381 382 382 return kTRUE; … … 461 461 // Result 462 462 f.fSignificance = fSignificance; 463 f.f SignificanceExc = fSignificanceExc;463 f.fErrorExcess = fErrorExcess; 464 464 f.fEventsExcess = fEventsExcess; 465 465 f.fEventsSignal = fEventsSignal; … … 526 526 { 527 527 const TString name(Form("TempAlphaEnergy%06d", gRandom->Integer(1000000))); 528 TH1D *h = hon.ProjectionZ(name, -1, -1, bin, bin, "E");528 TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, bin, bin, "E"); 529 529 h->SetDirectory(0); 530 530 … … 537 537 { 538 538 const TString name(Form("TempAlphaTheta%06d", gRandom->Integer(1000000))); 539 TH1D *h = hon.ProjectionZ(name, bin, bin, -1, -1, "E");539 TH1D *h = hon.ProjectionZ(name, bin, bin, 0, hon.GetNbinsY()+1, "E"); 540 540 h->SetDirectory(0); 541 541 … … 563 563 { 564 564 const TString name(Form("TempAlpha%06d", gRandom->Integer(1000000))); 565 TH1D *h = hon.ProjectionZ(name, -1, -1, -1, -1, "E");565 TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E"); 566 566 h->SetDirectory(0); 567 567 … … 576 576 const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000))); 577 577 578 TH1D *h1 = hon.ProjectionZ(name1, -1, -1, bin, bin, "E");579 TH1D *h0 = hof.ProjectionZ(name0, -1, -1, bin, bin, "E");578 TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E"); 579 TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E"); 580 580 h1->SetDirectory(0); 581 581 h0->SetDirectory(0); … … 594 594 const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000))); 595 595 596 TH1D *h1 = hon.ProjectionZ(name1, bin, bin, -1, -1, "E");597 TH1D *h0 = hof.ProjectionZ(name0, bin, bin, -1, -1, "E");596 TH1D *h1 = hon.ProjectionZ(name1, bin, bin, 0, hon.GetNbinsY()+1, "E"); 597 TH1D *h0 = hof.ProjectionZ(name0, bin, bin, 0, hof.GetNbinsY()+1, "E"); 598 598 h1->SetDirectory(0); 599 599 h0->SetDirectory(0); … … 636 636 const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000))); 637 637 638 TH1D *h1 = hon.ProjectionZ(name1, -1, -1, -1, -1, "E");639 TH1D *h0 = hof.ProjectionZ(name0, -1, -1, -1, -1, "E");638 TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E"); 639 TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, 0, hof.GetNbinsY()+1, "E"); 640 640 h1->SetDirectory(0); 641 641 h0->SetDirectory(0); … … 654 654 const TString name0(Form("TempAlpha%06d_off", gRandom->Integer(1000000))); 655 655 656 TH1D *h1 = hon.ProjectionZ(name1, -1, -1, bin, bin, "E");657 TH1D *h0 = hof.ProjectionZ(name0, -1, -1, bin, bin, "E");656 TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E"); 657 TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E"); 658 658 h1->SetDirectory(0); 659 659 h0->SetDirectory(0); -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
r8780 r8989 56 56 // Result 57 57 Double_t fSignificance; // significance of an unknown signal (Li/Ma 17) 58 Double_t f SignificanceExc; // significance of a known excess (Li/Ma 5)58 Double_t fErrorExcess; // Simple error propagation 59 59 Double_t fEventsExcess; // calculated number of excess events (signal-bg) 60 60 Double_t fEventsSignal; // calculated number of signal events … … 179 179 180 180 Double_t GetSignificance() const { return fSignificance; } 181 Double_t Get SignificanceExc() const { return fSignificanceExc; }181 Double_t GetErrorExcess() const { return fErrorExcess; } 182 182 Double_t GetChiSqSignal() const { return fChiSqSignal; } 183 183 Double_t GetChiSqBg() const { return fChiSqBg; } … … 253 253 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 254 254 255 ClassDef(MAlphaFitter, 3)255 ClassDef(MAlphaFitter, 4) 256 256 }; 257 257
Note:
See TracChangeset
for help on using the changeset viewer.