Changeset 3007 for trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc
- Timestamp:
- 02/02/04 22:52:53 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc
r2980 r3007 50 50 using namespace std; 51 51 52 const Int_t MHCalibrationPixel::fChargeNbinsHiGain = 2100; 53 const Int_t MHCalibrationPixel::fChargeNbinsLoGain = 1010; 54 const Int_t MHCalibrationPixel::fAbsTimeNbins = 32; 55 const Int_t MHCalibrationPixel::fRelTimeNbins = 240; 56 const Int_t MHCalibrationPixel::fChargevsNbins = 5000; 57 const Axis_t MHCalibrationPixel::fAbsTimeFirst = - 0.25; 58 const Axis_t MHCalibrationPixel::fAbsTimeLast = 15.75; 59 const Axis_t MHCalibrationPixel::fRelTimeFirst = -11.; 60 const Axis_t MHCalibrationPixel::fRelTimeLast = 12.; 61 52 62 // -------------------------------------------------------------------------- 53 63 // … … 56 66 MHCalibrationPixel::MHCalibrationPixel(const char *name, const char *title) 57 67 : fPixId(-1), 58 fChargeNbinsHiGain(2100),59 fChargeNbinsLoGain(1010),60 fTimeNbins(32),61 fChargevsNbins(5000),62 fTimeFirst(-0.25),63 fTimeLast(15.75),64 68 fHivsLoGain(NULL), 65 69 fHPSD(NULL), 66 70 fChargeGausFit(NULL), 67 f TimeGausFit(NULL),71 fRelTimeGausFit(NULL), 68 72 fFitLegend(NULL) 69 73 { … … 92 96 fHChargeLoGain->Sumw2(); 93 97 94 fHTimeHiGain = new TH1F("HTimeHiGain","Distribution of Mean Arrival Hi Gain Times Pixel ", 95 fTimeNbins,fTimeFirst,fTimeLast); 96 fHTimeLoGain = new TH1F("HTimeLoGain","Distribution of Mean Arrival Lo Gain Times Pixel ", 97 fTimeNbins,fTimeFirst,fTimeLast); 98 99 fHTimeHiGain->SetXTitle("Mean Arrival Times [Hi Gain FADC slice nr]"); 100 fHTimeLoGain->SetXTitle("Mean Arrival Times [Lo Gain FADC slice nr]"); 101 102 fHTimeHiGain->SetYTitle("Nr. of events"); 103 fHTimeLoGain->SetYTitle("Nr. of events"); 98 // Absolute Times 99 fHAbsTimeHiGain = new TH1F("HAbsTimeHiGain","Distribution of Absolute Arrival Hi Gain Times Pixel ", 100 fAbsTimeNbins,fAbsTimeFirst,fAbsTimeLast); 101 fHAbsTimeLoGain = new TH1F("HAbsTimeLoGain","Distribution of Absolute Arrival Lo Gain Times Pixel ", 102 fAbsTimeNbins,fAbsTimeFirst,fAbsTimeLast); 103 104 fHAbsTimeHiGain->SetXTitle("Absolute Arrival Time [Hi Gain FADC slice nr]"); 105 fHAbsTimeLoGain->SetXTitle("Absolute Arrival Time [Lo Gain FADC slice nr]"); 106 107 fHAbsTimeHiGain->SetYTitle("Nr. of events"); 108 fHAbsTimeLoGain->SetYTitle("Nr. of events"); 109 110 // Relative Times 111 fHRelTimeHiGain = new TH1F("HRelTimeHiGain","Distribution of Relative Arrival Times High Gain Pixel ", 112 fRelTimeNbins,fRelTimeFirst,fRelTimeLast); 113 fHRelTimeLoGain = new TH1F("HRelTimeLoGain","Distribution of Relative Arrival Time Low Gain Pixel ", 114 fRelTimeNbins,fRelTimeFirst,fRelTimeLast); 115 116 fHRelTimeHiGain->SetXTitle("Relative Arrival Times [Hi Gain FADC slice nr]"); 117 fHRelTimeLoGain->SetXTitle("Relative Arrival Times [Lo Gain FADC slice nr]"); 118 119 fHRelTimeHiGain->SetYTitle("Nr. of events"); 120 fHRelTimeLoGain->SetYTitle("Nr. of events"); 104 121 105 122 // We define a reasonable number and later enlarge it if necessary … … 117 134 fHChargeHiGain->SetDirectory(NULL); 118 135 fHChargeLoGain->SetDirectory(NULL); 119 fHTimeHiGain->SetDirectory(NULL); 120 fHTimeLoGain->SetDirectory(NULL); 136 fHAbsTimeHiGain->SetDirectory(NULL); 137 fHAbsTimeLoGain->SetDirectory(NULL); 138 fHRelTimeHiGain->SetDirectory(NULL); 139 fHRelTimeLoGain->SetDirectory(NULL); 121 140 fHChargevsNHiGain->SetDirectory(NULL); 122 141 fHChargevsNLoGain->SetDirectory(NULL); … … 133 152 134 153 delete fHChargeHiGain; 135 delete fHTimeHiGain; 154 delete fHAbsTimeHiGain; 155 delete fHRelTimeHiGain; 136 156 delete fHChargevsNHiGain; 137 157 138 158 delete fHChargeLoGain; 139 delete fHTimeLoGain; 159 delete fHAbsTimeLoGain; 160 delete fHRelTimeLoGain; 140 161 delete fHChargevsNLoGain; 141 162 … … 145 166 if (fChargeGausFit) 146 167 delete fChargeGausFit; 147 if (f TimeGausFit)148 delete f TimeGausFit;168 if (fRelTimeGausFit) 169 delete fRelTimeGausFit; 149 170 if (fFitLegend) 150 171 delete fFitLegend; … … 168 189 fChargeNdf = -1; 169 190 170 fTimeChisquare = -1.; 171 fTimeProb = -1.; 172 fTimeNdf = -1; 173 fTimeMean = -1.; 174 fTimeSigma = -1.; 175 176 fTimeLowerFitRangeHiGain = 0; 177 fTimeUpperFitRangeHiGain = 0; 178 fTimeLowerFitRangeLoGain = 0; 179 fTimeUpperFitRangeLoGain = 0; 191 fRelTimeChisquare = -1.; 192 fRelTimeProb = -1.; 193 fRelTimeNdf = -1; 194 fRelTimeMean = -1.; 195 fRelTimeSigma = -1.; 196 197 fRelTimeLowerFitRangeHiGain = -99.; 198 fRelTimeUpperFitRangeHiGain = -99.; 199 fRelTimeLowerFitRangeLoGain = -99.; 200 fRelTimeUpperFitRangeLoGain = -99.; 201 202 fAbsTimeFirstHiGain = -1.; 203 fAbsTimeFirstLoGain = -1.; 204 fAbsTimeLastHiGain = -1.; 205 fAbsTimeLastLoGain = -1.; 206 180 207 181 208 fOffset = 0.; … … 184 211 if (fChargeGausFit) 185 212 delete fChargeGausFit; 186 if (f TimeGausFit)187 delete f TimeGausFit;213 if (fRelTimeGausFit) 214 delete fRelTimeGausFit; 188 215 if (fFitLegend) 189 216 delete fFitLegend; … … 193 220 delete fHPSD; 194 221 222 CLRBIT(fFlags,kUseLoGain); 223 CLRBIT(fFlags,kChargeFitOK); 224 CLRBIT(fFlags,kTimeFitOK); 225 195 226 return; 196 227 } … … 204 235 fHChargeHiGain->Reset(); 205 236 fHChargeLoGain->Reset(); 206 fHTimeHiGain->Reset(); 207 fHTimeLoGain->Reset(); 237 fHAbsTimeHiGain->Reset(); 238 fHAbsTimeLoGain->Reset(); 239 fHRelTimeHiGain->Reset(); 240 fHRelTimeLoGain->Reset(); 208 241 fHChargevsNHiGain->Reset(); 209 242 fHChargevsNLoGain->Reset(); … … 214 247 } 215 248 249 void MHCalibrationPixel::SetUseLoGain(Bool_t b) 250 { 251 if (b) 252 SETBIT(fFlags, kUseLoGain) ; 253 else 254 CLRBIT(fFlags, kUseLoGain); 255 } 216 256 217 257 … … 226 266 } 227 267 228 Bool_t MHCalibrationPixel::IsFitOK() const 229 { 230 return TESTBIT(fFlags,kFitOK); 268 Bool_t MHCalibrationPixel::IsChargeFitOK() const 269 { 270 return TESTBIT(fFlags,kChargeFitOK); 271 } 272 273 Bool_t MHCalibrationPixel::IsTimeFitOK() const 274 { 275 return TESTBIT(fFlags,kTimeFitOK); 231 276 } 232 277 … … 236 281 } 237 282 238 Bool_t MHCalibrationPixel::FillTimeLoGain(Float_t t) 239 { 240 return (fHTimeLoGain->Fill(t) > -1); 283 Bool_t MHCalibrationPixel::FillAbsTimeLoGain(Float_t t) 284 { 285 return (fHAbsTimeLoGain->Fill(t) > -1); 286 } 287 288 Bool_t MHCalibrationPixel::FillRelTimeLoGain(Float_t t) 289 { 290 return (fHRelTimeLoGain->Fill(t) > -1); 241 291 } 242 292 … … 251 301 } 252 302 253 Bool_t MHCalibrationPixel::FillTimeHiGain(Float_t t) 254 { 255 return (fHTimeHiGain->Fill(t) > -1); 303 Bool_t MHCalibrationPixel::FillAbsTimeHiGain(Float_t t) 304 { 305 return (fHAbsTimeHiGain->Fill(t) > -1); 306 } 307 308 Bool_t MHCalibrationPixel::FillRelTimeHiGain(Float_t t) 309 { 310 return (fHRelTimeHiGain->Fill(t) > -1); 256 311 } 257 312 … … 273 328 fHChargeHiGain->SetName(nameQHiGain.Data()); 274 329 275 TString nameTHiGain = TString(fHTimeHiGain->GetName()); 276 nameTHiGain += id; 277 fHTimeHiGain->SetName(nameTHiGain.Data()); 330 TString nameTAHiGain = TString(fHAbsTimeHiGain->GetName()); 331 nameTAHiGain += id; 332 fHAbsTimeHiGain->SetName(nameTAHiGain.Data()); 333 334 TString nameTRHiGain = TString(fHRelTimeHiGain->GetName()); 335 nameTRHiGain += id; 336 fHRelTimeHiGain->SetName(nameTRHiGain.Data()); 278 337 279 338 TString nameQvsNHiGain = TString(fHChargevsNHiGain->GetName()); … … 288 347 fHChargeHiGain->SetTitle(titleQHiGain.Data()); 289 348 290 TString titleTHiGain = TString(fHTimeHiGain->GetTitle()); 291 titleTHiGain += id; 292 fHTimeHiGain->SetTitle(titleTHiGain.Data()); 349 TString titleTAHiGain = TString(fHAbsTimeHiGain->GetTitle()); 350 titleTAHiGain += id; 351 fHAbsTimeHiGain->SetTitle(titleTAHiGain.Data()); 352 353 TString titleTRHiGain = TString(fHRelTimeHiGain->GetTitle()); 354 titleTRHiGain += id; 355 fHRelTimeHiGain->SetTitle(titleTRHiGain.Data()); 293 356 294 357 TString titleQvsNHiGain = TString(fHChargevsNHiGain->GetTitle()); … … 303 366 fHChargeLoGain->SetName(nameQLoGain.Data()); 304 367 305 TString nameTLoGain = TString(fHTimeLoGain->GetName()); 306 nameTLoGain += id; 307 fHTimeLoGain->SetName(nameTLoGain.Data()); 368 TString nameTALoGain = TString(fHAbsTimeLoGain->GetName()); 369 nameTALoGain += id; 370 fHAbsTimeLoGain->SetName(nameTALoGain.Data()); 371 372 TString nameTRLoGain = TString(fHRelTimeLoGain->GetName()); 373 nameTRLoGain += id; 374 fHRelTimeLoGain->SetName(nameTRLoGain.Data()); 308 375 309 376 TString nameQvsNLoGain = TString(fHChargevsNLoGain->GetName()); … … 318 385 fHChargeLoGain->SetTitle(titleQLoGain.Data()); 319 386 320 TString titleTLoGain = TString(fHTimeLoGain->GetTitle()); 321 titleTLoGain += id; 322 fHTimeLoGain->SetTitle(titleTLoGain.Data()); 387 TString titleTALoGain = TString(fHAbsTimeLoGain->GetTitle()); 388 titleTALoGain += id; 389 fHAbsTimeLoGain->SetTitle(titleTALoGain.Data()); 390 391 TString titleTRLoGain = TString(fHRelTimeLoGain->GetTitle()); 392 titleTRLoGain += id; 393 fHRelTimeLoGain->SetTitle(titleTRLoGain.Data()); 323 394 324 395 TString titleQvsNLoGain = TString(fHChargevsNLoGain->GetTitle()); … … 375 446 fFitLegend = new TPaveText(0.05,0.05,0.95,0.95); 376 447 377 if (Is FitOK())448 if (IsChargeFitOK()) 378 449 fFitLegend->SetFillColor(80); 379 450 else … … 403 474 t4->SetBit(kCanDelete); 404 475 405 if (Is FitOK())476 if (IsChargeFitOK()) 406 477 { 407 478 TText *t5 = fFitLegend->AddText("Result of the Fit: OK"); … … 459 530 TCanvas *c = MakeDefCanvas(this,600,900); 460 531 461 c->Divide(2, 4);532 c->Divide(2,5); 462 533 463 534 c->cd(1); … … 490 561 if (fChargeGausFit) 491 562 { 492 if (Is FitOK())563 if (IsChargeFitOK()) 493 564 fChargeGausFit->SetLineColor(kGreen); 494 565 else … … 516 587 if (fChargeGausFit) 517 588 { 518 if (Is FitOK())589 if (IsChargeFitOK()) 519 590 fChargeGausFit->SetLineColor(kGreen); 520 591 else … … 557 628 gPad->SetTicks(); 558 629 gPad->SetLogy(0); 559 fH TimeHiGain->Draw(opt);630 fHRelTimeHiGain->Draw(opt); 560 631 c->Modified(); 561 632 c->Update(); … … 567 638 gPad->SetTicks(); 568 639 gPad->SetLogy(0); 569 fH TimeLoGain->Draw(opt);640 fHRelTimeLoGain->Draw(opt); 570 641 c->Modified(); 571 642 c->Update(); 572 643 573 if (f TimeGausFit)644 if (fRelTimeGausFit) 574 645 { 575 if (f TimeChisquare > 20.)576 f TimeGausFit->SetLineColor(kRed);646 if (fRelTimeChisquare > 20.) 647 fRelTimeGausFit->SetLineColor(kRed); 577 648 else 578 f TimeGausFit->SetLineColor(kGreen);649 fRelTimeGausFit->SetLineColor(kGreen); 579 650 580 f TimeGausFit->Draw("same");651 fRelTimeGausFit->Draw("same"); 581 652 c->Modified(); 582 653 c->Update(); … … 585 656 else 586 657 { 587 if (f TimeGausFit)658 if (fRelTimeGausFit) 588 659 { 589 if (f TimeChisquare > 20.)590 f TimeGausFit->SetLineColor(kRed);660 if (fRelTimeChisquare > 20.) 661 fRelTimeGausFit->SetLineColor(kRed); 591 662 else 592 f TimeGausFit->SetLineColor(kGreen);663 fRelTimeGausFit->SetLineColor(kGreen); 593 664 594 f TimeGausFit->Draw("same");665 fRelTimeGausFit->Draw("same"); 595 666 c->Modified(); 596 667 c->Update(); … … 600 671 gPad->SetTicks(); 601 672 gPad->SetLogy(0); 602 fH TimeLoGain->Draw(opt);673 fHRelTimeLoGain->Draw(opt); 603 674 c->Modified(); 604 675 c->Update(); … … 610 681 c->cd(7); 611 682 gPad->SetTicks(); 683 fHAbsTimeHiGain->Draw(opt); 684 c->Modified(); 685 c->Update(); 686 687 c->cd(8); 688 gPad->SetTicks(); 689 fHAbsTimeLoGain->Draw(opt); 690 c->Modified(); 691 c->Update(); 692 693 694 c->cd(9); 695 gPad->SetTicks(); 612 696 fHChargevsNHiGain->Draw(opt); 613 697 c->Modified(); 614 698 c->Update(); 615 699 616 c->cd( 8);700 c->cd(10); 617 701 gPad->SetTicks(); 618 702 fHChargevsNLoGain->Draw(opt); … … 656 740 657 741 658 Bool_t MHCalibrationPixel::FitTime HiGain(Axis_t rmin, Axis_t rmax,Option_t *option)659 { 660 661 if (f TimeGausFit)742 Bool_t MHCalibrationPixel::FitTime(Option_t *option) 743 { 744 745 if (fRelTimeGausFit) 662 746 return kFALSE; 663 747 664 rmin = (rmin != 0.) ? rmin : (Axis_t)fTimeLowerFitRangeHiGain; 665 rmax = (rmax != 0.) ? rmax : (Axis_t)fTimeUpperFitRangeHiGain; 666 667 const Stat_t entries = fHTimeHiGain->Integral(); 668 const Double_t mu_guess = fHTimeHiGain->GetBinCenter(fHTimeHiGain->GetMaximumBin()); 748 // 749 // Get the fitting ranges 750 // 751 Axis_t rmin = fRelTimeLowerFitRangeHiGain; 752 if (TESTBIT(fFlags,kUseLoGain)) 753 rmin = fRelTimeLowerFitRangeLoGain; 754 755 Axis_t rmax = fRelTimeUpperFitRangeHiGain; 756 if (TESTBIT(fFlags,kUseLoGain)) 757 rmin = fRelTimeUpperFitRangeLoGain; 758 759 TH1F *hist = fHRelTimeHiGain; 760 if (TESTBIT(fFlags,kUseLoGain)) 761 hist = fHRelTimeLoGain; 762 763 const Stat_t entries = hist->Integral("width"); 764 const Double_t mu_guess = hist->GetBinCenter(hist->GetMaximumBin()); 669 765 const Double_t sigma_guess = (rmax - rmin)/2.; 670 const Double_t area_guess = entries/gkSq2Pi;671 672 TString name = TString("Gaus Time");766 const Double_t area_guess = 2.*entries/gkSq2Pi/sigma_guess; 767 768 TString name = TString("GausRelTime"); 673 769 name += fPixId; 674 f TimeGausFit = new TF1(name.Data(),"gaus",rmin,rmax);675 676 if (!f TimeGausFit)677 { 678 *fLog << warn << dbginf << "WARNING: Could not create fit function for Time fit" << endl;770 fRelTimeGausFit = new TF1(name.Data(),"gaus",rmin,rmax); 771 772 if (!fRelTimeGausFit) 773 { 774 *fLog << warn << dbginf << "WARNING: Could not create fit function for RelTime fit" << endl; 679 775 return kFALSE; 680 776 } 681 777 682 fTimeGausFit->SetParameters(area_guess,mu_guess,sigma_guess); 683 fTimeGausFit->SetParNames("Area","#mu","#sigma"); 684 fTimeGausFit->SetParLimits(0,0.,entries); 685 fTimeGausFit->SetParLimits(1,rmin,rmax); 686 fTimeGausFit->SetParLimits(2,0.,(rmax-rmin)); 687 fTimeGausFit->SetRange(rmin,rmax); 688 689 fHTimeHiGain->Fit(fTimeGausFit,option); 690 691 rmin = fTimeGausFit->GetParameter(1) - 3.*fTimeGausFit->GetParameter(2); 692 rmax = fTimeGausFit->GetParameter(1) + 3.*fTimeGausFit->GetParameter(2); 693 fTimeGausFit->SetRange(rmin,rmax); 694 695 fHTimeHiGain->Fit(fTimeGausFit,option); 696 697 fTimeChisquare = fTimeGausFit->GetChisquare(); 698 fTimeNdf = fTimeGausFit->GetNDF(); 699 fTimeProb = fTimeGausFit->GetProb(); 700 701 fTimeMean = fTimeGausFit->GetParameter(1); 702 fTimeSigma = fTimeGausFit->GetParameter(2); 703 704 if (TMath::IsNaN(fTimeMean) || TMath::IsNaN(fTimeSigma)) 705 return kFALSE; 706 707 if (TMath::IsNaN(fTimeChisquare) || fTimeChisquare > 20.) // Cannot use Probability because Ndf is sometimes < 1 708 return kFALSE; 778 fRelTimeGausFit->SetParameters(area_guess,mu_guess,sigma_guess); 779 fRelTimeGausFit->SetParNames("Area","#mu","#sigma"); 780 fRelTimeGausFit->SetParLimits(0,0.,5.*area_guess); 781 fRelTimeGausFit->SetParLimits(1,rmin,rmax); 782 fRelTimeGausFit->SetParLimits(2,0.,(rmax-rmin)); 783 fRelTimeGausFit->SetRange(rmin,rmax); 784 785 hist->Fit(fRelTimeGausFit,option); 786 787 // 788 // If the fit does not converge, try another one with smaller bounderies 789 // 790 if (fRelTimeGausFit->GetProb() < 0.001) 791 { 792 rmin = fRelTimeGausFit->GetParameter(1) - 2.*fRelTimeGausFit->GetParameter(2); 793 rmax = fRelTimeGausFit->GetParameter(1) + 2.*fRelTimeGausFit->GetParameter(2); 794 fRelTimeGausFit->SetRange(rmin,rmax); 795 hist->Fit(fRelTimeGausFit,option); 796 } 797 798 fRelTimeChisquare = fRelTimeGausFit->GetChisquare(); 799 fRelTimeNdf = fRelTimeGausFit->GetNDF(); 800 fRelTimeProb = fRelTimeGausFit->GetProb(); 801 802 fRelTimeMean = fRelTimeGausFit->GetParameter(1); 803 fRelTimeSigma = fRelTimeGausFit->GetParameter(2); 804 805 fRelTimeMeanErr = fRelTimeGausFit->GetParError(1); 806 807 if (TMath::IsNaN(fRelTimeMean) || TMath::IsNaN(fRelTimeSigma)) 808 { 809 CLRBIT(fFlags,kTimeFitOK); 810 return kFALSE; 811 } 812 813 if (TMath::IsNaN(fRelTimeChisquare) || (fRelTimeProb < gkProbLimit)) 814 { 815 CLRBIT(fFlags,kTimeFitOK); 816 return kFALSE; 817 } 818 819 SETBIT(fFlags,kTimeFitOK); 709 820 710 821 return kTRUE; … … 712 823 } 713 824 714 Bool_t MHCalibrationPixel::FitTimeLoGain(Axis_t rmin, Axis_t rmax, Option_t *option)715 {716 717 if (fTimeGausFit)718 return kFALSE;719 720 rmin = (rmin != 0.) ? rmin : (Axis_t)fTimeLowerFitRangeLoGain;721 rmax = (rmax != 0.) ? rmax : (Axis_t)fTimeUpperFitRangeLoGain;722 723 const Stat_t entries = fHTimeLoGain->Integral();724 const Double_t mu_guess = fHTimeLoGain->GetBinCenter(fHTimeLoGain->GetMaximumBin());725 const Double_t sigma_guess = (rmax - rmin)/2.;726 const Double_t area_guess = entries/gkSq2Pi;727 728 TString name = TString("GausTime");729 name += fPixId;730 fTimeGausFit = new TF1(name.Data(),"gaus",rmin,rmax);731 732 if (!fTimeGausFit)733 {734 *fLog << warn << dbginf << "WARNING: Could not create fit function for Time fit" << endl;735 return kFALSE;736 }737 738 fTimeGausFit->SetParameters(area_guess,mu_guess,sigma_guess);739 fTimeGausFit->SetParNames("Area","#mu","#sigma");740 fTimeGausFit->SetParLimits(0,0.,entries);741 fTimeGausFit->SetParLimits(1,rmin,rmax);742 fTimeGausFit->SetParLimits(2,0.,(rmax-rmin));743 fTimeGausFit->SetRange(rmin,rmax);744 745 fHTimeLoGain->Fit(fTimeGausFit,option);746 747 rmin = fTimeGausFit->GetParameter(1) - 3.*fTimeGausFit->GetParameter(2);748 rmax = fTimeGausFit->GetParameter(1) + 3.*fTimeGausFit->GetParameter(2);749 fTimeGausFit->SetRange(rmin,rmax);750 751 fHTimeLoGain->Fit(fTimeGausFit,option);752 753 fTimeChisquare = fTimeGausFit->GetChisquare();754 fTimeNdf = fTimeGausFit->GetNDF();755 fTimeProb = fTimeGausFit->GetProb();756 757 fTimeMean = fTimeGausFit->GetParameter(1);758 fTimeSigma = fTimeGausFit->GetParameter(2);759 760 if (fTimeChisquare > 20.) // Cannot use Probability because Ndf is sometimes < 1761 {762 *fLog << warn << "WARNING: Fit of the Arrival times failed ! " << endl;763 return kFALSE;764 }765 766 return kTRUE;767 768 }769 825 770 826 Bool_t MHCalibrationPixel::FitCharge(Option_t *option) … … 783 839 Axis_t rmax = fChargeLastHiGain; 784 840 if (TESTBIT(fFlags,kUseLoGain)) 785 rm in = fChargeFirstLoGain;841 rmax = fChargeLastLoGain; 786 842 787 843 TH1F *hist = fHChargeHiGain; … … 847 903 if (TMath::IsNaN(fChargeMean) || TMath::IsNaN(fChargeMeanErr)) 848 904 { 849 CLRBIT(fFlags,k FitOK);905 CLRBIT(fFlags,kChargeFitOK); 850 906 return kFALSE; 851 907 } … … 853 909 if ((fChargeProb < gkProbLimit) || (TMath::IsNaN(fChargeProb))) 854 910 { 855 CLRBIT(fFlags,k FitOK);911 CLRBIT(fFlags,kChargeFitOK); 856 912 return kFALSE; 857 913 } 858 914 859 SETBIT(fFlags,k FitOK);915 SETBIT(fFlags,kChargeFitOK); 860 916 return kTRUE; 861 917 } … … 880 936 fChargeLastLoGain = fHChargeLoGain->GetBinLowEdge(fHChargeLoGain->GetXaxis()->GetLast()) 881 937 +fHChargeLoGain->GetBinWidth(0); 938 939 CutEdges(fHRelTimeHiGain,nbins); 940 941 fRelTimeLowerFitRangeHiGain = fHRelTimeHiGain->GetBinLowEdge(fHRelTimeHiGain->GetXaxis()->GetFirst()); 942 fRelTimeUpperFitRangeHiGain = fHRelTimeHiGain->GetBinLowEdge(fHRelTimeHiGain->GetXaxis()->GetLast()) 943 +fHRelTimeHiGain->GetBinWidth(0); 944 945 CutEdges(fHRelTimeLoGain,nbins); 946 947 fRelTimeLowerFitRangeLoGain = fHRelTimeLoGain->GetBinLowEdge(fHRelTimeLoGain->GetXaxis()->GetFirst()); 948 fRelTimeUpperFitRangeLoGain = fHRelTimeLoGain->GetBinLowEdge(fHRelTimeLoGain->GetXaxis()->GetLast()) 949 +fHRelTimeLoGain->GetBinWidth(0); 950 951 CutEdges(fHAbsTimeHiGain,nbins); 952 953 fAbsTimeFirstHiGain = fHAbsTimeHiGain->GetBinLowEdge(fHAbsTimeHiGain->GetXaxis()->GetFirst()); 954 fAbsTimeLastHiGain = fHAbsTimeHiGain->GetBinLowEdge(fHAbsTimeHiGain->GetXaxis()->GetLast()) 955 +fHAbsTimeHiGain->GetBinWidth(0); 956 957 CutEdges(fHAbsTimeLoGain,nbins); 958 959 fAbsTimeFirstLoGain = fHAbsTimeLoGain->GetBinLowEdge(fHAbsTimeLoGain->GetXaxis()->GetFirst()); 960 fAbsTimeLastLoGain = fHAbsTimeLoGain->GetBinLowEdge(fHAbsTimeLoGain->GetXaxis()->GetLast()) 961 +fHAbsTimeLoGain->GetBinWidth(0); 882 962 883 963 CutEdges(fHChargevsNHiGain,0); … … 901 981 902 982 *fLog << all << "Results of the Time Slices Fit: " << endl; 903 *fLog << all << "Chisquare: " << f TimeChisquare<< endl;904 *fLog << all << "Ndf: " << f TimeNdf<< endl;905 *fLog << all << "Probability: " << f TimeProb<< endl;983 *fLog << all << "Chisquare: " << fRelTimeChisquare << endl; 984 *fLog << all << "Ndf: " << fRelTimeNdf << endl; 985 *fLog << all << "Probability: " << fRelTimeProb << endl; 906 986 *fLog << all << endl; 907 987
Note:
See TracChangeset
for help on using the changeset viewer.