Changeset 3056 for trunk/MagicSoft/Mars/mcalib/MCalibrationPix.cc
- Timestamp:
- 02/08/04 20:52:18 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationPix.cc
r3028 r3056 106 106 CLRBIT(fFlags, kHiGainSaturation); 107 107 CLRBIT(fFlags, kExcluded); 108 CLRBIT(fFlags, kExcludeQualityCheck); 108 109 CLRBIT(fFlags, kChargeFitValid); 109 CLRBIT(fFlags, kTimeFitValid);110 110 CLRBIT(fFlags, kFitted); 111 CLRBIT(fFlags, kOscillating); 111 112 CLRBIT(fFlags, kBlindPixelMethodValid); 112 113 CLRBIT(fFlags, kFFactorMethodValid); … … 128 129 fNumLoGainSamples = -1.; 129 130 130 fMeanTimeOffset = -1.;131 fMeanTimeOffsetError = -1.;132 fTimingPrecision = -1.;133 fTimeProb = -1.;134 131 fTimeFirstHiGain = 0 ; 135 132 fTimeLastHiGain = 0 ; … … 270 267 // Set the Excluded Bit from outside 271 268 // 272 void MCalibrationPix::Set TimeFitValid(Bool_t b )273 { 274 b ? SETBIT(fFlags, k TimeFitValid) : CLRBIT(fFlags, kTimeFitValid);275 } 276 269 void MCalibrationPix::SetFitted(Bool_t b ) 270 { 271 b ? SETBIT(fFlags, kFitted) : CLRBIT(fFlags, kFitted); 272 } 273 277 274 // -------------------------------------------------------------------------- 278 275 // 279 276 // Set the Excluded Bit from outside 280 277 // 281 void MCalibrationPix::Set Fitted(Bool_t b )282 { 283 b ? SETBIT(fFlags, k Fitted) : CLRBIT(fFlags, kFitted);278 void MCalibrationPix::SetOscillating(Bool_t b ) 279 { 280 b ? SETBIT(fFlags, kOscillating) : CLRBIT(fFlags, kOscillating); 284 281 } 285 282 … … 348 345 349 346 350 Float_t MCalibrationPix::GetTotalFFactor ()347 Float_t MCalibrationPix::GetTotalFFactorFFactorMethod() 351 348 { 352 349 if (!fFactorCalculated) … … 356 353 } 357 354 358 Float_t MCalibrationPix::GetTotalFFactorError ()355 Float_t MCalibrationPix::GetTotalFFactorErrorFFactorMethod() 359 356 { 360 357 … … 373 370 374 371 372 Float_t MCalibrationPix::GetTotalFFactorBlindPixelMethod() 373 { 374 return 1.; 375 } 376 377 Float_t MCalibrationPix::GetTotalFFactorErrorBlindPixelMethod() 378 { 379 380 return 1.; 381 } 382 383 Float_t MCalibrationPix::GetTotalFFactorPINDiodeMethod() 384 { 385 return 1.; 386 } 387 388 Float_t MCalibrationPix::GetTotalFFactorErrorPINDiodeMethod() 389 { 390 391 return 1.; 392 } 393 394 395 375 396 Float_t MCalibrationPix::GetMeanConversionFFactorMethod() 376 397 { … … 401 422 return fSigmaConversionFFactorMethod; 402 423 403 }404 405 406 Float_t MCalibrationPix::GetTimingPrecisionError() const407 {408 return fMeanTimeOffsetError/2.;409 424 } 410 425 … … 415 430 } 416 431 432 Bool_t MCalibrationPix::IsExcludeQualityCheck() const 433 { 434 return TESTBIT(fFlags,kExcludeQualityCheck); 435 } 436 437 Bool_t MCalibrationPix::IsHiGainSaturation() const 438 { 439 return TESTBIT(fFlags,kHiGainSaturation); 440 } 441 417 442 Bool_t MCalibrationPix::IsChargeFitValid() const 418 443 { … … 420 445 } 421 446 422 Bool_t MCalibrationPix::IsTimeFitValid() const423 {424 return TESTBIT(fFlags, kTimeFitValid);425 }426 427 447 Bool_t MCalibrationPix::IsFitted() const 428 448 { 429 449 return TESTBIT(fFlags, kFitted); 450 } 451 452 Bool_t MCalibrationPix::IsOscillating() 453 { 454 455 if (TESTBIT(fFlags, kOscillating)) 456 return kTRUE; 457 458 if (fHist->CheckOscillations()) 459 { 460 SETBIT(fFlags,kOscillating); 461 return kTRUE; 462 } 463 464 return kFALSE; 430 465 } 431 466 … … 530 565 fChargeProb = fHist->GetChargeProb(); 531 566 567 568 fAbsTimeMean = fHist->GetAbsTimeMean(); 569 fAbsTimeMeanErr = fHist->GetAbsTimeMeanErr(); 570 fAbsTimeRms = fHist->GetAbsTimeRms(); 571 572 if (CheckTimeFitValidity()) 573 SETBIT(fFlags,kTimeFitValid); 574 else 575 CLRBIT(fFlags,kTimeFitValid); 576 532 577 // 533 578 // Calculate the conversion factors 534 579 // 535 if ( TESTBIT(fFlags,kHiGainSaturation))580 if (IsHiGainSaturation()) 536 581 ApplyLoGainConversion(); 537 582 … … 585 630 Float_t pedRmsSquareErrSquare = 4.*fErrPedRms*fErrPedRms * pedRmsSquare; 586 631 587 if (! TESTBIT(fFlags,kHiGainSaturation))632 if (!IsHiGainSaturation()) 588 633 { /* HiGain */ 589 634 … … 683 728 fFactorCalculated = kTRUE; 684 729 685 fSigmaConversionFFactorMethod = GetTotalFFactor ()*TMath::Sqrt(fMeanConversionFFactorMethod);730 fSigmaConversionFFactorMethod = GetTotalFFactorFFactorMethod()*TMath::Sqrt(fMeanConversionFFactorMethod); 686 731 687 732 return kTRUE; … … 706 751 { 707 752 708 if (! TESTBIT(fFlags,kFitted))753 if (!IsFitted()) 709 754 return kFALSE; 710 755 711 if ( TESTBIT(fFlags,kExcludeQualityCheck))756 if (IsExcludeQualityCheck()) 712 757 return kTRUE; 713 758 714 759 Float_t pedestal; 715 760 716 if (! TESTBIT(fFlags,kHiGainSaturation)) /* higain */761 if (!IsHiGainSaturation()) /* higain */ 717 762 pedestal = GetPedRms()*TMath::Sqrt(fNumHiGainSamples); 718 else 763 else /* logain */ 719 764 pedestal = GetPedRms()*TMath::Sqrt(fNumLoGainSamples); 720 765 … … 769 814 { 770 815 771 if (TMath::IsNaN(fMeanTimeOffset) 772 || TMath::IsNaN(fMeanTimeOffsetError) 773 || TMath::IsNaN(fTimingPrecision) 774 || TMath::IsNaN(fTimeProb)) 775 { 776 *fLog << warn << "WARNING: Some of the time fit values are NAN in Pixel " 777 << fPixId << endl; 778 return kFALSE; 779 } 780 781 if (TESTBIT(fFlags,kExcludeQualityCheck)) 816 817 if (IsExcludeQualityCheck()) 782 818 return kTRUE; 783 819 784 if (TMath::Abs(fMeanTimeOffset) > gkTimeLimit) 785 { 786 *fLog << warn << "WARNING: Abs(Fitted Rel. Time) " << TMath::Abs(fMeanTimeOffset) 787 << " is greater than " << gkTimeLimit << " in Pixel " << fPixId << endl; 788 return kFALSE; 789 } 790 791 if (fMeanTimeOffsetError > gkTimeErrLimit) 792 { 793 *fLog << warn << "WARNING: Error of Fitted Time " << fMeanTimeOffsetError 794 << " is smaller than " << gkTimeErrLimit << " in Pixel " << fPixId << endl; 795 return kFALSE; 796 } 797 798 if (!fHist->IsTimeFitOK()) 799 { 800 *fLog << warn << "WARNING: Probability of Fitted Time too low in Pixel " 801 << fPixId << endl; 802 return kFALSE; 803 } 804 805 if (TESTBIT(fFlags,kHiGainSaturation)) 820 if (IsHiGainSaturation()) 806 821 { 807 822 … … 854 869 855 870 856 // 857 // The check returns kTRUE if: 858 // 859 // 860 // 861 Bool_t MCalibrationPix::CheckOscillations() 862 { 863 return kTRUE; 871 void MCalibrationPix::CheckOscillations() 872 { 873 fHist->CheckOscillations(); 864 874 } 865 875 … … 882 892 } 883 893 884 885 886 // --------------------------------------------------------------------------887 //888 // 1) Fit the arrival times889 // 2) Retrieve the results890 //891 // This fit has to be done AFTER the Charges fit,892 // otherwise only the Hi Gain will be fitted, even if there are no entries893 //894 //895 Bool_t MCalibrationPix::FitTime()896 {897 898 899 if(!fHist->FitTime())900 {901 *fLog << warn << "WARNING: Could not fit relative times of pixel " << fPixId << endl;902 return kFALSE;903 }904 905 fMeanTimeOffset = fHist->GetRelTimeMean();906 fMeanTimeOffsetError = fHist->GetRelTimeMeanErr();907 fTimingPrecision = fHist->GetRelTimeSigma();908 fTimeProb = fHist->GetRelTimeProb();909 910 fAbsTimeMean = fHist->GetAbsTimeMean();911 fAbsTimeMeanErr = fHist->GetAbsTimeMeanErr();912 fAbsTimeRms = fHist->GetAbsTimeRms();913 914 if (CheckTimeFitValidity())915 SETBIT(fFlags,kTimeFitValid);916 else917 CLRBIT(fFlags,kTimeFitValid);918 919 return kTRUE;920 }921
Note:
See TracChangeset
for help on using the changeset viewer.