Changeset 5143 for trunk/MagicSoft/Mars/mhflux
- Timestamp:
- 09/28/04 12:25:50 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhflux
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
r5012 r5143 304 304 // within the range (yq[0], yq[1]) there must be no empty bin; 305 305 // choose pedestrian approach as long as GetQuantiles is not available 306 Double_t xq[2] = { 0. 05, 0.95};306 Double_t xq[2] = { 0.6, 0.99 }; 307 307 Double_t yq[2]; 308 308 h->GetQuantiles(2, yq, xq); … … 321 321 //func.SetParNames("lambda", "N0", "del"); 322 322 323 func.SetParameter(0, 100); // Hz323 func.SetParameter(0, 200); // Hz 324 324 func.SetParameter(1, Nm); 325 325 func.FixParameter(2, Nmdel/Nm); … … 335 335 336 336 // was fit successful ? 337 const Bool_t ok = NDF>0 && chi2< 2.5*NDF;337 const Bool_t ok = NDF>0 && chi2<3*NDF; 338 338 339 339 if (paint) … … 343 343 func.Paint("same"); 344 344 } 345 346 if (!ok)347 return kFALSE;348 345 349 346 const Double_t lambda = func.GetParameter(0); … … 385 382 res[5] = NDF; 386 383 384 // Chi2 385 res[6] = chi2; 386 387 387 // Rdead (from fit) is the fraction from real time lost by the dead time 388 388 //fHRdead.SetBinContent(i, Rdead); 389 389 //fHRdead.SetBinError (i,dRdead); 390 390 391 return kTRUE;391 return ok; 392 392 } 393 393 … … 415 415 h = fH2DeltaT.ProjectionX(name, i, i, "E"); 416 416 417 Double_t res[ 6];417 Double_t res[7]; 418 418 if (!FitH(h, res)) 419 419 continue; … … 457 457 // Fit histogram 458 458 // 459 Double_t res[ 6];459 Double_t res[7]; 460 460 if (!FitH(&fH1DeltaT, res)) 461 461 return; … … 551 551 552 552 // 553 // If we reached the event number limit for the time-bins fit the histogram 554 // 555 if (fH1DeltaT.GetEntries()>=fNumEvents) 553 // If we reached the event number limit for the time-bins fit the 554 // histogram - if it fails try again when 1.6% more events available 555 // 556 const Int_t n = (Int_t)fH1DeltaT.GetEntries(); 557 if (n>=fNumEvents && n%(fNumEvents/60)==0) 556 558 FitTimeBin(); 557 559 … … 592 594 void MHEffectiveOnTime::PaintText(Double_t *res) const 593 595 { 594 TLatex text(0.2 5, 0.94, Form("T_{eff}=%.1fs\\pm%.1fs \\labda=%.1f\\pm%.1f p=%.1f%% NDF=%d",595 res[0], res[1], res[3], res[4], res[2], res[5]));596 TLatex text(0.27, 0.94, Form("T_{eff}=%.1fs\\pm%.1fs \\lambda=%.1f\\pm%.1fHz p=%.1f%% \\chi^{2}/%d=%.1f", 597 res[0], res[1], res[3], res[4], res[2], (int)res[5], res[6]/res[5])); 596 598 text.SetBit(TLatex::kTextNDC); 597 599 text.SetTextSize(0.04); … … 613 615 return; 614 616 615 TLatex text(0.4 5, 0.94, Form("\\bar{p} = %.1f%% (n=%d)", sum/n,n));617 TLatex text(0.47, 0.94, Form("\\bar{p} = %.1f%%", sum/n)); 616 618 text.SetBit(TLatex::kTextNDC); 617 619 text.SetTextSize(0.04); … … 692 694 if ((h = (TH1D*)gPad->FindObject(fNameProjDeltaT))) 693 695 { 694 Double_t res[ 6];696 Double_t res[7]; 695 697 FitH(h, res, kTRUE); 696 698 PaintText(res); -
trunk/MagicSoft/Mars/mhflux/MHFalseSource.cc
r5100 r5143 290 290 // for the current pointing position and add a offset in the 291 291 // Fill function! 292 fRa = fPointPos ->GetRa();293 fDec = fPointPos ->GetDec();292 fRa = fPointPos ? fPointPos->GetRa() : 0; 293 fDec = fPointPos ? fPointPos->GetDec() : 90; 294 294 295 295 return kTRUE; … … 592 592 stars->ReadBSC("bsc5.dat"); 593 593 594 *fLog << err << "FIXME - The catalog will never be deleted, because this crashes!" << endl; 595 596 // stars->SetBit(kCanDelete); 597 594 stars->SetBit(kCanDelete); 598 595 return stars; 599 596 } … … 612 609 pad->Divide(1, 2, 0, 0.03); 613 610 614 *fLog << err << "FIXME - Plotting the catalog is broken!" << endl;615 616 611 TObject *catalog = GetCatalog(); 617 612 618 613 // Initialize upper part 619 614 pad->cd(1); 615 // Make sure that the catalog is deleted only once 616 gROOT->GetListOfCleanups()->Add(gPad); 620 617 gPad->SetBorderMode(0); 621 618 gPad->Divide(3, 1); … … 662 659 // Initialize lower part 663 660 pad->cd(2); 661 // Make sure that the catalog is deleted only once 662 gROOT->GetListOfCleanups()->Add(gPad); 664 663 gPad->SetBorderMode(0); 665 664 gPad->Divide(3, 1); … … 673 672 h1->SetXTitle(fHist.GetZaxis()->GetTitle()); 674 673 h1->SetYTitle("Counts"); 675 h1->Draw( opt);674 h1->Draw(); 676 675 h1->SetBit(kCanDelete); 677 676 … … 942 941 943 942 944 TF2 f2d("Gaus-2D", FcnGauss2d, -1.5, 1.5, -1.5, 1.5, 6); 943 const Double_t maxr = 0.9*TMath::Abs(fHist.GetBinCenter(1)); 944 TF2 f2d("Gaus-2D", FcnGauss2d, -maxr, maxr, -maxr, maxr, 6); 945 945 f2d.SetLineWidth(1); 946 946 f2d.SetParName(0, "Max sigma"); … … 950 950 f2d.SetParName(4, "Sigma_2 deg"); 951 951 f2d.SetParName(5, "Phi deg"); 952 f2d.SetParLimits(1, - 1, 1);// mu_1953 f2d.SetParLimits(3, - 1, 1);// mu_2954 f2d.SetParLimits(2, 0, 1);// sigma_1955 f2d.SetParLimits(4, 0, 1);// sigma_2956 f2d.SetParLimits(5, 0, 90);// phi957 f2d.SetParameter(0, maxs); // A958 f2d.SetParameter(1, 0);// mu_1959 f2d.SetParameter(2, 0. 5);// sigma_1960 f2d.SetParameter(3, 0);// mu_2961 f2d.SetParameter(4, 0. 5);// sigma_2962 f2d. SetParameter(5, 0);// phi963 hist->Fit(&f2d, "NI0 ");952 f2d.SetParLimits(1, -maxr/2, maxr/2); // mu_1 953 f2d.SetParLimits(3, -maxr/2, maxr/2); // mu_2 954 f2d.SetParLimits(2, 0, maxr); // sigma_1 955 f2d.SetParLimits(4, 0, maxr); // sigma_2 956 f2d.SetParLimits(5, 0, 45); // phi 957 f2d.SetParameter(0, maxs); // A 958 f2d.SetParameter(1, hist->GetXaxis()->GetBinCenter(maxx)); // mu_1 959 f2d.SetParameter(2, 0.1); // sigma_1 960 f2d.SetParameter(3, hist->GetYaxis()->GetBinCenter(maxy)); // mu_2 961 f2d.SetParameter(4, 0.1); // sigma_2 962 f2d.FixParameter(5, 0); // phi 963 hist->Fit(&f2d, "NI0R"); 964 964 f2d.DrawCopy("cont2same"); 965 965
Note:
See TracChangeset
for help on using the changeset viewer.