Changeset 7602 for trunk/MagicSoft
- Timestamp:
- 03/14/06 16:07:39 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7596 r7602 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2006/03/14 Thomas Bretz 22 23 * mhflux/MHEffectiveOnTime.cc: 24 - skip the fit not only if the integral is empty but 25 also if the first bin is empty 26 - changed upper limit to 95% according to a study from 27 David Paneque 28 - replaced the fit with the exponential used in the BCN Mars 29 version 30 - use the correct number of entries 31 - use a likelihood fit 32 - calculate the fit quality from the probability 33 - ignore the fit quality for the theta-plot 34 35 * mimage/MHNewImagePar.cc: 36 - fixed the handling of the "same" option in Draw/Paint 37 38 * mpointing/MPointingDev.h: 39 - fDx and fDy initialized in the constructor 40 41 * mbase/MTask.[h,cc]: 42 - removed the kDontCount option. Instead don't use the TStopwatch 43 counter anymore. By this the class to TStopwatch can be 44 suppressed completely if kDontTime is set. 45 46 * mbase/MContinue.cc, mbase/MTaskEnv.cc, mfbase/MF.cc, 47 mfbase/MFilterList.[h,cc]: 48 - pipe the accelerator flag to the filter or task 49 50 * mjobs/MJCut.cc: 51 - also accelerate the reading task 52 53 54 20 55 2006/03/13 21 56 -
trunk/MagicSoft/Mars/NEWS
r7598 r7602 3 3 *** Version <cvs> 4 4 5 - ganymed: In the second loop the MHNewImagePar histograms disapeared. 6 To display them just delete the pads displayed on top. 7 8 - ganymed: fixed a bug which could cause strange behaviour in wobble 9 mode if no starguider information was available due to an incorrect 10 initialization of the starguider calibration 5 11 6 12 -
trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
r7534 r7602 474 474 475 475 // FIXME: Do fit only if contents of bin has changed 476 if (Nm<=0 )476 if (Nm<=0 || h->GetBinContent(1)<=0) 477 477 return kFALSE; 478 478 … … 483 483 // within the range (yq[0], yq[1]) there must be no empty bin; 484 484 // choose pedestrian approach as long as GetQuantiles is not available 485 Double_t xq[2] = { 0.6, 0.9 9 };485 Double_t xq[2] = { 0.6, 0.95 }; // previously 0.99 486 486 Double_t yq[2]; 487 487 h->GetQuantiles(2, yq, xq); 488 488 489 // Nmdel = Nm * binwidth, with Nm = number of observed events 490 const Double_t Nmdel = h->Integral("width"); 491 492 // 493 // Setup Poisson function for the fit: 494 // lambda [Hz], N0 = ideal no of evts, del = bin width of dt 495 // 496 // parameter 0 = lambda 497 // parameter 1 = N0*del 498 // 499 TF1 func("Poisson", " [1]*[2] * [0] * exp(-[0] *x)"); 500 //func.SetParNames("lambda", "N0", "del"); 489 // 490 // Setup exponential function for the fit: 491 // 492 // parameter 0 = rate [Hz] 493 // parameter 1 = normalization 494 // 495 TF1 func("Exp", " exp([1]-[0]*x)"); 501 496 502 497 func.SetParameter(0, 200); // Hz 503 func.SetParameter(1, Nm); 504 func.FixParameter(2, Nmdel/Nm); 498 func.SetParameter(1, log(h->GetBinContent(1))); // Hz 505 499 506 500 // options : N do not store the function, do not draw … … 508 502 // R use the range specified in the function range 509 503 // Q quiet mode 510 h->Fit(&func, "NIQE", "", yq[0], yq[1]); 504 // L Use log-likelihood (better for low statistics) 505 h->Fit(&func, "NIQEL", "", h->GetBinLowEdge(3)/*yq[0]*/, yq[1]); 511 506 512 507 const Double_t chi2 = func.GetChisquare(); 508 const Double_t prob = func.GetProb(); 513 509 const Int_t NDF = func.GetNDF(); 514 510 515 511 // was fit successful ? 516 const Bool_t ok = NDF>0 && chi2<3*NDF;512 const Bool_t ok = prob>0.001; //NDF>0 && chi2<3*NDF; 517 513 518 514 if (paint) … … 523 519 } 524 520 521 // The effective on time is the "real rate" (slope of the exponential) 522 // divided by the total number of events (histogram integral including 523 // under- and overflows) 525 524 const Double_t lambda = func.GetParameter(0); 526 //const Double_t N0 = func.GetParameter(1); 527 const Double_t prob = func.GetProb(); 528 529 /* 530 *fLog << all << "Nm/lambda=" << Nm/lambda << " chi2/NDF="; 531 *fLog << (NDF ? chi2/NDF : 0.0) << " lambda="; 532 *fLog << lambda << " N0=" << N0 << endl; 533 */ 534 535 Double_t emat[2][2]; 536 gMinuit->mnemat((Double_t*)emat, 2); 537 538 const Double_t dldl = emat[0][0]; 539 //const Double_t dN0dN0 = emat[1][1]; 540 541 const Double_t teff = Nm/lambda; 542 const Double_t dteff = teff * TMath::Sqrt(dldl/(lambda*lambda) + 1.0/Nm); 543 const Double_t dl = TMath::Sqrt(dldl); 544 545 //const Double_t kappa = Nm/N0; 546 //const Double_t Rdead = 1.0 - kappa; 547 //const Double_t dRdead = kappa * TMath::Sqrt(dN0dN0/(N0*N0) + 1.0/Nm); 525 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); 528 const Double_t dl = TMath::Sqrt(dldl); 548 529 549 530 // the effective on time is Nm/lambda … … 563 544 // Chi2 564 545 res[6] = chi2; 565 566 // Rdead (from fit) is the fraction from real time lost by the dead time567 //fHRdead.SetBinContent(i, Rdead);568 //fHRdead.SetBinError (i,dRdead);569 546 570 547 return ok; … … 583 560 fHThetaNDF.Reset(); 584 561 562 // Use a random name to make sure the object is unique 585 563 const TString name = Form("CalcTheta%d", (UInt_t)gRandom->Uniform(999999999)); 586 564 … … 594 572 h = fH2DeltaT.ProjectionX(name, i, i, "E"); 595 573 596 Double_t res[7]; 597 if (!FitH(h, res)) 574 Double_t res[7] = {0, 0, 0, 0, 0, 0, 0}; 575 //if (!FitH(h, res)) 576 // continue; 577 FitH(h, res); 578 579 if (res[0]==0) 598 580 continue; 599 581
Note:
See TracChangeset
for help on using the changeset viewer.