Changeset 7817 for trunk/MagicSoft/Mars
- Timestamp:
- 07/29/06 11:20:14 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7815 r7817 18 18 19 19 -*-*- END OF LINE -*-*- 20 2006/07/29 Thomas Bretz 21 22 * mhflux/MHEffectiveOnTime.cc: 23 - changed the fit such that initial values are calculated 24 automatically now instead of using build in values. This 25 makes the fit more indepedant of the underlaying rates. 26 With a test of ~350 sequences in the test database it could 27 be shown that the new fit gives the same result +/-1sek. 28 The highest deviation was +5s the lowest -10s. 29 - the number of the first bin used in the fit became a variable 30 - A limit of 15kHz was set for the rate 31 - sanity checkes for lambda==0 added (possible division by zero) 32 - increased class version number by one 33 - made functions derived from MH private 34 - to fit the resulting "gammas" use fFirstBin=1 and fNumEvents=120 35 36 37 20 38 2006/07/28 Daniela Dorner 21 39 -
trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
r7602 r7817 76 76 // 77 77 // 78 // Class version 2: 79 // ---------------- 80 // + UInt_t fFirstBin; 81 // + UInt_t fNumEvents; 82 // - Int_t fNumEvents; 83 // 84 // 78 85 // ========================================================================== 79 86 // Dear Colleagues, … … 286 293 MHEffectiveOnTime::MHEffectiveOnTime(const char *name, const char *title) 287 294 : fPointPos(0), fTime(0), fParam(0), fIsFinalized(kFALSE), 288 fNumEvents(200*60) /*, fNameProjDeltaT(Form("DeltaT_%p", this)),289 fNameProjTheta(Form("Theta_%p", this))*/295 fNumEvents(200*60), fFirstBin(3) 296 //fNumEvents(2*60), fFirstBin(1) 290 297 { 291 298 // … … 488 495 489 496 // 497 // Determine a good starting value for the slope 498 // 499 const TAxis &axe = *h->GetXaxis(); 500 const UInt_t ibin = axe.FindFixBin(yq[1]); 501 const Double_t x1 = axe.GetBinCenter(ibin<=fFirstBin?fFirstBin+1:ibin); 502 const Double_t x0 = axe.GetBinCenter(fFirstBin); 503 const Double_t y1 = h->GetBinContent(ibin)>1 ? TMath::Log(h->GetBinContent(ibin)) : 0; 504 const Double_t y0 = TMath::Log(h->GetBinContent(fFirstBin)); 505 506 // Estimated slope 507 const Float_t m = -(y1-y0)/(x1-x0); 508 509 // 490 510 // Setup exponential function for the fit: 491 511 // … … 495 515 TF1 func("Exp", " exp([1]-[0]*x)"); 496 516 497 func.SetParameter(0, 200); // Hz517 func.SetParameter(0, m); // Hz 498 518 func.SetParameter(1, log(h->GetBinContent(1))); // Hz 519 520 // We set a limit to make sure that almost empty histograms which 521 // are fitted dont't produce hang ups or crashes 522 func.SetParLimits(0, 0, 15000); // Hz 499 523 500 524 // options : N do not store the function, do not draw … … 503 527 // Q quiet mode 504 528 // L Use log-likelihood (better for low statistics) 505 h->Fit(&func, "NIQEL", "", h->GetBinLowEdge( 3)/*yq[0]*/, yq[1]);529 h->Fit(&func, "NIQEL", "", h->GetBinLowEdge(fFirstBin)/*yq[0]*/, yq[1]); 506 530 507 531 const Double_t chi2 = func.GetChisquare(); … … 524 548 const Double_t lambda = func.GetParameter(0); 525 549 const Double_t dldl = func.GetParError(0)*func.GetParError(0); 526 const Double_t teff = Nm / lambda;527 const Double_t dteff = teff * TMath::Sqrt(dldl/(lambda*lambda) + 1.0/Nm);550 const Double_t teff = lambda==0 ? 0 : Nm / lambda; 551 const Double_t dteff = lambda==0 ? 0 : teff * TMath::Sqrt(dldl/(lambda*lambda) + 1.0/Nm); 528 552 const Double_t dl = TMath::Sqrt(dldl); 529 553 … … 715 739 // histogram - if it fails try again when 1.6% more events available 716 740 // 717 const Int_t n = (Int_t)fH1DeltaT.GetEntries();741 const UInt_t n = (UInt_t)fH1DeltaT.GetEntries(); 718 742 if (n>=fNumEvents && n%(fNumEvents/60)==0) 719 743 FitTimeBin(); … … 993 1017 DrawRightAxis("\\lambda [s^{-1}]"); 994 1018 } 1019 1020 // -------------------------------------------------------------------------- 1021 // 1022 // The following resources are available: 1023 // 1024 // MHEffectiveOnTime.FistBin: 3 1025 // MHEffectiveOnTime.NuMEvents: 12000 1026 // 1027 Int_t MHEffectiveOnTime::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 1028 { 1029 Bool_t rc = kFALSE; 1030 if (IsEnvDefined(env, prefix, "FirstBin", print)) 1031 { 1032 rc = kTRUE; 1033 SetFirstBin(GetEnvValue(env, prefix, "FirstBin", (Int_t)fFirstBin)); 1034 } 1035 if (IsEnvDefined(env, prefix, "NumEvents", print)) 1036 { 1037 rc = kTRUE; 1038 SetNumEvents(GetEnvValue(env, prefix, "NumEvents", (Int_t)fNumEvents)); 1039 } 1040 return rc; 1041 }
Note:
See TracChangeset
for help on using the changeset viewer.