Changeset 3056
- Timestamp:
- 02/08/04 20:52:18 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3055 r3056 33 33 - check for oscillations for all pixels (and you will not trust 34 34 your eyes when you look at the results :-(((( 35 36 * mcalib/MCalibrationCalc.[h,cc] 37 - remove ArrivalTime -> go to separate class 38 - remove BlidnPixel and PI Didoe overflow, now handled directly 39 inside the corr. classes. 40 - remove SkipTimeFits -> go the arrival time class 35 41 36 42 -
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h
r3029 r3056 31 31 class MCalibrationCam; 32 32 class MExtractedSignalCam; 33 class MArrivalTime;34 33 35 34 class MTime; … … 39 38 private: 40 39 41 static const Int_t fBlindPixelId;// ID of the blind pixel42 static const Int_t fPINDiodeId;// ID of the PIN Diode40 static const UInt_t fBlindPixelId; // ID of the blind pixel 41 static const UInt_t fPINDiodeId; // ID of the PIN Diode 43 42 static const Byte_t fgSaturationLimit; // Saturation of Hi Gain 44 43 static const Byte_t fgBlindPixelFirst; // First FADC slice blind pixel … … 52 51 MRawRunHeader *fRunHeader; // RunHeader information 53 52 54 MArrivalTime *fArrivalTime; // Calculated Arrival Times55 56 53 MTime *fEvtTime; // Time of the event 57 54 … … 69 66 UInt_t fNumExcludedPixels; 70 67 71 enum { kUse Times, kUseBlindPixelFit, kUsePinDiodeFit,68 enum { kUseBlindPixelFit, kUsePinDiodeFit, 72 69 kUseCosmicsRejection, kUseQualityChecks, 73 70 kHiLoGainCalibration, 74 kBlindPixelOverFlow, kPINDiodeOverFlow,75 71 kHiGainOverFlow, kLoGainOverFlow }; 76 72 … … 96 92 void Clear(const Option_t *o=""); 97 93 98 // Skipping parts of the work99 void SkipTime(Bool_t b=kTRUE)100 {b ? CLRBIT(fFlags, kUseTimes) : SETBIT(fFlags, kUseTimes);}101 94 void SkipBlindPixelFit(Bool_t b=kTRUE) 102 95 {b ? CLRBIT(fFlags, kUseBlindPixelFit) : SETBIT(fFlags, kUseBlindPixelFit);} -
trunk/MagicSoft/Mars/mcalib/MCalibrationPINDiode.cc
r3007 r3056 88 88 fPed = -1.; 89 89 fPedRms = -1.; 90 fTime = -1.;91 fSigmaTime = -1.;92 fTimeChiSquare = -1.;93 94 90 } 95 91 … … 271 267 } 272 268 273 274 // --------------------------------------------------------------------------275 //276 // 1) Fit the arrival times277 // 2) Retrieve the results278 // 3) Note that because of the low number of bins, the NDf is sometimes 0, so279 // Root does not give a reasonable Probability, the Chisquare is more significant280 //281 Bool_t MCalibrationPINDiode::FitTime()282 {283 284 if(!fHist->FitTime())285 {286 *fLog << warn << "WARNING: Could not fit Hi Gain times of PIN Diode" << endl;287 fHist->PrintTimeFitResult();288 return kFALSE;289 }290 291 fTime = fHist->GetRelTimeMean();292 fSigmaTime = fHist->GetRelTimeSigma();293 fTimeProb = fHist->GetRelTimeProb();294 295 if (CheckTimeFitValidity())296 SETBIT(fFlags,kTimeFitValid);297 else298 CLRBIT(fFlags,kTimeFitValid);299 300 return kTRUE;301 }302 303 269 // 304 270 // The check returns kTRUE if: -
trunk/MagicSoft/Mars/mcalib/MCalibrationPINDiode.h
r3007 r3056 26 26 Float_t fChargeProb; // The probability of the fit function 27 27 28 Float_t fTime; // The mean arrival time after the fit29 Float_t fSigmaTime; // The error of the mean arrival time after the fit30 Float_t fTimeChiSquare; // The Chi Square of the fit function31 Float_t fTimeProb; // The probability of the fit function32 33 28 Byte_t fFlags; // Flag for the set Bits 34 29 … … 58 53 Float_t GetRSigmaSquare() const { return fRSigmaSquare; } 59 54 60 // Times61 Float_t GetTime() const { return fTime; }62 Float_t GetSigmaTime() const { return fSigmaTime; }63 Float_t GetTimeChiSquare() const { return fTimeChiSquare; }64 Float_t GetTimeProb() const { return fTimeProb; }65 55 66 56 // Pedestals … … 84 74 Bool_t FillCharge(Float_t q) { return fHist->FillChargeHiGain(q); } 85 75 Bool_t FillAbsTime(Float_t t) { return fHist->FillAbsTimeHiGain(t); } 86 Bool_t FillRelTime(Float_t t) { return fHist->FillRelTimeHiGain(t); }87 Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); }88 76 77 Bool_t FillGraphs(Float_t qhi,Float_t qlo) const { return fHist->FillGraphs(qhi,qlo); } 78 89 79 // Fits 90 80 Bool_t FitCharge(); 91 Bool_t FitTime();92 81 93 82 // Draws -
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 -
trunk/MagicSoft/Mars/mcalib/MCalibrationPix.h
r3027 r3056 40 40 Float_t fErrPedRms; // The error of the pedestal RMS (from MPedestalPix) 41 41 42 Float_t fMeanTimeOffset; // The mean relative arrival time offset after the fit43 Float_t fMeanTimeOffsetError; // The mean relative arrival time offset error after the fit44 Float_t fTimingPrecision; // The error of the mean arrival time after the fit45 Float_t fTimeProb; // The probability of the fit function46 47 42 Float_t fAbsTimeMean; 48 43 Float_t fAbsTimeMeanErr; … … 84 79 kExcluded, kExcludeQualityCheck, 85 80 kChargeFitValid, kTimeFitValid, 86 kFitted, 81 kFitted, kOscillating, 87 82 kBlindPixelMethodValid, kFFactorMethodValid, kPINDiodeMethodValid }; 88 83 … … 91 86 Bool_t CheckChargeFitValidity(); 92 87 Bool_t CheckTimeFitValidity(); 93 Bool_t CheckOscillations();94 95 88 Bool_t CalcFFactorMethod(); 96 89 … … 114 107 Float_t GetErrRSigmaCharge() const { return fErrRSigmaCharge; } 115 108 116 // Times117 Float_t GetMeanTimeOffset() const { return fMeanTimeOffset; }118 Float_t GetMeanTimeOffsetError() const { return fMeanTimeOffsetError; }119 Float_t GetTimingPrecision() const { return fTimingPrecision; }120 Float_t GetTimingPrecisionError() const;121 Float_t GetTimeProb() const { return fTimeProb; }122 109 123 110 Float_t GetAbsTimeMean() const { return fAbsTimeMean; } … … 149 136 Float_t GetPedRms() const { return fPedRms; } 150 137 151 Float_t GetTotalFFactor(); 152 Float_t GetTotalFFactorError(); 138 Float_t GetTotalFFactorFFactorMethod(); 139 Float_t GetTotalFFactorErrorFFactorMethod(); 140 141 Float_t GetTotalFFactorBlindPixelMethod(); 142 Float_t GetTotalFFactorErrorBlindPixelMethod(); 143 144 Float_t GetTotalFFactorPINDiodeMethod(); 145 Float_t GetTotalFFactorErrorPINDiodeMethod(); 153 146 154 147 Bool_t IsExcluded() const; 148 Bool_t IsExcludeQualityCheck() const; 149 Bool_t IsHiGainSaturation() const; 155 150 Bool_t IsChargeFitValid() const; 156 Bool_t IsTimeFitValid() const;157 151 Bool_t IsFitted() const; 152 Bool_t IsOscillating(); 158 153 Bool_t IsBlindPixelMethodValid() const; 159 154 Bool_t IsPINDiodeMethodValid() const; … … 175 170 void SetExcludeQualityCheck(Bool_t b = kTRUE); 176 171 void SetChargeFitValid(Bool_t b = kTRUE); 177 void SetTimeFitValid(Bool_t b = kTRUE);178 172 void SetFitted(Bool_t b = kTRUE); 173 void SetOscillating(Bool_t b = kTRUE); 179 174 void SetBlindPixelMethodValid(Bool_t b = kTRUE); 180 175 void SetFFactorMethodValid(Bool_t b = kTRUE); … … 184 179 185 180 // Fill histos 186 Bool_t FillChargeHiGain(Float_t q) const { return fHist->FillChargeHiGain(q); } 187 Bool_t FillAbsTimeHiGain(Float_t t) const { return fHist->FillAbsTimeHiGain(t); } 188 Bool_t FillRelTimeHiGain(Float_t t) const { return fHist->FillRelTimeHiGain(t); } 189 Bool_t FillRChargevsTimeHiGain(Float_t rq, Int_t t) const { return fHist->FillChargevsNHiGain(rq,t); } 190 191 Bool_t FillChargeLoGain(Float_t q) const { return fHist->FillChargeLoGain(q); } 192 Bool_t FillAbsTimeLoGain(Float_t t) const { return fHist->FillAbsTimeLoGain(t); } 193 Bool_t FillRelTimeLoGain(Float_t t) const { return fHist->FillRelTimeLoGain(t); } 194 Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) const { return fHist->FillChargevsNLoGain(rq,t); } 195 196 Bool_t FillChargesInGraph(Float_t qhi,Float_t qlo) const { return fHist->FillPointInGraph(qhi,qlo); } 181 Bool_t FillChargeHiGain(Float_t q) const { return fHist->FillChargeHiGain(q); } 182 Bool_t FillAbsTimeHiGain(Float_t t) const { return fHist->FillAbsTimeHiGain(t); } 183 184 Bool_t FillChargeLoGain(Float_t q) const { return fHist->FillChargeLoGain(q); } 185 Bool_t FillAbsTimeLoGain(Float_t t) const { return fHist->FillAbsTimeLoGain(t); } 186 187 Bool_t FillGraphs(Float_t qhi,Float_t qlo) const { return fHist->FillGraphs(qhi,qlo); } 197 188 198 189 void DefinePixId(Int_t i); … … 200 191 // Fits 201 192 Bool_t FitCharge(); 202 Bool_t FitTime();203 193 204 194 // Draws … … 207 197 208 198 // Miscellaneous 209 void ApplyLoGainConversion(); 199 void ApplyLoGainConversion(); 200 void CheckOscillations(); 210 201 211 202 ClassDef(MCalibrationPix, 1) // Storage Container for Calibration information of one pixel -
trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc
r3007 r3056 48 48 MHCalibrationPINDiode::MHCalibrationPINDiode(const char *name, const char *title) 49 49 : fChargeNbins(1000), 50 fTimeNbins(64), 51 fChargevsNbins(10000), 52 fTimeFirst(-0.25), 53 fTimeLast(31.75) 50 fChargevsNbins(10000) 54 51 { 55 52 … … 68 65 fHPINDiodeCharge->SetDirectory(NULL); 69 66 70 fHPINDiodeTime = new TH1F("HPINDiodeTime","Distribution of Mean Arrival Times PINDiode",71 fTimeNbins,fTimeFirst,fTimeLast);72 fHPINDiodeTime->SetXTitle("Mean Arrival Times [FADC slice nr]");73 fHPINDiodeTime->SetYTitle("Nr. of events");74 fHPINDiodeTime->Sumw2();75 fHPINDiodeTime->SetDirectory(NULL);76 77 67 fHPINDiodeChargevsN = new TH1I("HPINDiodeChargevsN","Sum of Hi Gain Charges vs. Event Number Pixel ", 78 68 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5); … … 88 78 89 79 delete fHPINDiodeCharge; 90 delete fHPINDiodeTime;91 80 delete fHPINDiodeChargevsN; 92 81 93 82 if (fChargeGausFit) 94 83 delete fChargeGausFit; 95 if (fRelTimeGausFit)96 delete fRelTimeGausFit;97 84 if (fFitLegend) 98 85 delete fFitLegend; … … 110 97 fChargeProb = -1.; 111 98 fChargeNdf = -1; 112 fRelTimeProb = -1.;113 fRelTimeNdf = -1;114 fRelTimeMean = -1.;115 fRelTimeSigma = -1.;116 117 fRelTimeLowerFitRangeHiGain = -99.;118 fRelTimeUpperFitRangeHiGain = -99.;119 fRelTimeLowerFitRangeLoGain = -99.;120 fRelTimeUpperFitRangeLoGain = -99.;121 99 122 100 if (fChargeGausFit) 123 101 delete fChargeGausFit; 124 if (fRelTimeGausFit)125 delete fRelTimeGausFit;126 102 if (fFitLegend) 127 103 delete fFitLegend; … … 137 113 138 114 fHPINDiodeCharge->Reset(); 139 fHPINDiodeTime->Reset();140 115 fHPINDiodeChargevsN->Reset(); 141 116 } … … 145 120 { 146 121 return (fHPINDiodeCharge->Fill(q) > -1); 147 }148 149 Bool_t MHCalibrationPINDiode::FillTime(Float_t t)150 {151 return (fHPINDiodeTime->Fill(t) > -1);152 122 } 153 123 … … 160 130 { 161 131 162 Int_t nbins = 30;132 Int_t nbins = 20; 163 133 164 134 CutEdges(fHPINDiodeCharge,nbins); -
trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.h
r2931 r3056 17 17 TH1F* fHPINDiodeCharge; // Histogram containing the summed 32 PINDiode slices 18 18 TH1F* fHPINDiodeErrCharge; // Variance of summed FADC slices 19 TH1F* fHPINDiodeTime; // Histogram with time evolution of summed charges20 19 21 20 TH1I* fHPINDiodeChargevsN; // Summed Charge vs. Event Nr. 22 21 23 22 const Int_t fChargeNbins; 24 const Int_t fTimeNbins;25 23 const Int_t fChargevsNbins; 26 24 … … 38 36 // Fill histos 39 37 Bool_t FillCharge(Float_t q); 40 Bool_t FillTime(Float_t t);41 38 Bool_t FillChargevsN(Float_t q, Int_t n); 42 39 43 40 // Fits -- not yet implemented 44 41 Bool_t FitCharge(Option_t *option="RQ0") { return kTRUE; } 45 Bool_t FitTime(Option_t *option="RQ0") { return kTRUE; }46 42 47 43 // Others -
trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc
r3051 r3056 42 42 #include <TPaveText.h> 43 43 #include <TText.h> 44 #include <TGraph.h> 45 46 #include "MFFT.h" 44 47 45 48 #include "MLog.h" … … 52 55 const Int_t MHCalibrationPixel::fChargeNbinsHiGain = 2100; 53 56 const Int_t MHCalibrationPixel::fChargeNbinsLoGain = 1010; 54 const Int_t MHCalibrationPixel::fChargevsNbins = 5000; 55 const Int_t MHCalibrationPixel::fAbsTimeNbins = 32; 57 const Int_t MHCalibrationPixel::fAbsTimeNbins = 16; 56 58 const Axis_t MHCalibrationPixel::fAbsTimeFirst = - 0.25; 57 59 const Axis_t MHCalibrationPixel::fAbsTimeLast = 15.75; 58 const Int_t MHCalibrationPixel::fRelTimeNbins = 900;59 const Axis_t MHCalibrationPixel::fRelTimeFirst = -13.;60 const Axis_t MHCalibrationPixel::fRelTimeLast = 13.;61 60 const Float_t MHCalibrationPixel::fProbLimit = 0.001; 62 61 const Int_t MHCalibrationPixel::fNDFLimit = 5; 63 62 63 const Axis_t MHCalibrationPixel::fNyquistFreq = 1.0; 64 const Axis_t MHCalibrationPixel::fMinFreq = 0.; 65 const Int_t MHCalibrationPixel::fPSDNbins = 30; 66 64 67 // -------------------------------------------------------------------------- 65 68 // … … 69 72 : fPixId(-1), 70 73 fHivsLoGain(NULL), 74 fPSDHiGain(NULL), 75 fPSDLoGain(NULL), 76 fChargeGausFit(NULL), 71 77 fHPSD(NULL), 72 fChargeGausFit(NULL), 73 fRelTimeGausFit(NULL), 74 fFitLegend(NULL) 78 fPSDExpFit(NULL), 79 fChargeXaxis(NULL), 80 fPSDXaxis(NULL), 81 fFitLegend(NULL), 82 fCurrentSize(1024) 75 83 { 76 84 77 85 fName = name ? name : "MHCalibrationPixel"; 78 fTitle = title ? title : "Fill the accumulated charges and timesof all events and perform fits";86 fTitle = title ? title : "Fill the accumulated charges of all events and perform fits"; 79 87 80 88 fChargeFirstHiGain = -100.5; … … 110 118 fHAbsTimeLoGain->SetYTitle("Nr. of events"); 111 119 112 // Relative Times113 fHRelTimeHiGain = new TH1F("HRelTimeHiGain","Distribution of Relative Arrival Times High Gain Pixel ",114 fRelTimeNbins,fRelTimeFirst,fRelTimeLast);115 fHRelTimeLoGain = new TH1F("HRelTimeLoGain","Distribution of Relative Arrival Time Low Gain Pixel ",116 fRelTimeNbins,fRelTimeFirst,fRelTimeLast);117 118 fHRelTimeHiGain->SetXTitle("Relative Arrival Times [Hi Gain FADC slice nr]");119 fHRelTimeLoGain->SetXTitle("Relative Arrival Times [Lo Gain FADC slice nr]");120 121 fHRelTimeHiGain->SetYTitle("Nr. of events");122 fHRelTimeLoGain->SetYTitle("Nr. of events");123 124 // We define a reasonable number and later enlarge it if necessary125 fHChargevsNHiGain = new TH1I("HChargevsNHiGain","Sum of Hi Gain Charges vs. Event Number Pixel ",126 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5);127 fHChargevsNLoGain = new TH1I("HChargevsNLoGain","Sum of Lo Gain Charges vs. Event Number Pixel ",128 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5);129 130 fHChargevsNHiGain->SetXTitle("Event Nr.");131 fHChargevsNLoGain->SetXTitle("Event Nr.");132 133 fHChargevsNHiGain->SetYTitle("Sum of Hi Gain FADC slices");134 fHChargevsNLoGain->SetYTitle("Sum of Lo Gain FADC slices");135 120 136 121 fHChargeHiGain->SetDirectory(NULL); … … 138 123 fHAbsTimeHiGain->SetDirectory(NULL); 139 124 fHAbsTimeLoGain->SetDirectory(NULL); 140 fHRelTimeHiGain->SetDirectory(NULL); 141 fHRelTimeLoGain->SetDirectory(NULL); 142 fHChargevsNHiGain->SetDirectory(NULL); 143 fHChargevsNLoGain->SetDirectory(NULL); 144 145 fHiGains = new TArrayF(); 146 fLoGains = new TArrayF(); 125 126 fHiGains = new TArrayF(fCurrentSize); 127 fLoGains = new TArrayF(fCurrentSize); 147 128 148 129 Clear(); … … 155 136 delete fHChargeHiGain; 156 137 delete fHAbsTimeHiGain; 157 delete fHRelTimeHiGain;158 delete fHChargevsNHiGain;159 138 160 139 delete fHChargeLoGain; 161 140 delete fHAbsTimeLoGain; 162 delete fHRelTimeLoGain;163 delete fHChargevsNLoGain;164 141 165 142 delete fHiGains; … … 168 145 if (fChargeGausFit) 169 146 delete fChargeGausFit; 170 if (fRelTimeGausFit) 171 delete fRelTimeGausFit; 147 if (fPSDExpFit) 148 delete fPSDExpFit; 149 if (fHPSD) 150 delete fHPSD; 172 151 if (fFitLegend) 173 152 delete fFitLegend; 174 153 if (fHivsLoGain) 175 154 delete fHivsLoGain; 155 if (fChargeXaxis) 156 delete fChargeXaxis; 157 if (fPSDXaxis) 158 delete fPSDXaxis; 176 159 } 177 160 … … 181 164 182 165 fTotalEntries = 0; 166 fCurrentSize = 1024; 183 167 184 168 fChargeFirstHiGain = -100.5; … … 191 175 fChargeNdf = -1; 192 176 193 fRelTimeChisquare = -1.;194 fRelTimeProb = -1.;195 fRelTimeNdf = -1;196 fRelTimeMean = -1.;197 fRelTimeSigma = -1.;198 199 fRelTimeLowerFitRangeHiGain = -99.;200 fRelTimeUpperFitRangeHiGain = -99.;201 fRelTimeLowerFitRangeLoGain = -99.;202 fRelTimeUpperFitRangeLoGain = -99.;203 204 177 fAbsTimeFirstHiGain = -1.; 205 178 fAbsTimeFirstLoGain = -1.; … … 216 189 if (fChargeGausFit) 217 190 delete fChargeGausFit; 218 if (fRelTimeGausFit) 219 delete fRelTimeGausFit; 191 if (fPSDExpFit) 192 delete fPSDExpFit; 193 if (fHPSD) 194 delete fHPSD; 220 195 if (fFitLegend) 221 196 delete fFitLegend; 222 197 if (fHivsLoGain) 223 198 delete fHivsLoGain; 224 if (fHPSD) 225 delete fHPSD; 199 if (fChargeXaxis) 200 delete fChargeXaxis; 201 if (fPSDXaxis) 202 delete fPSDXaxis; 203 if (fPSDHiGain) 204 delete fPSDHiGain; 205 if (fPSDLoGain) 206 delete fPSDLoGain; 226 207 227 208 CLRBIT(fFlags,kUseLoGain); 228 209 CLRBIT(fFlags,kChargeFitOK); 229 CLRBIT(fFlags,k TimeFitOK);210 CLRBIT(fFlags,kOscillating); 230 211 231 212 return; … … 240 221 fHChargeHiGain->Reset(); 241 222 fHChargeLoGain->Reset(); 223 242 224 fHAbsTimeHiGain->Reset(); 243 225 fHAbsTimeLoGain->Reset(); 244 fHRelTimeHiGain->Reset(); 245 fHRelTimeLoGain->Reset(); 246 fHChargevsNHiGain->Reset(); 247 fHChargevsNLoGain->Reset(); 248 249 fHiGains->Reset(); 250 fLoGains->Reset(); 226 227 fHiGains->Set(1024); 228 fLoGains->Set(1024); 229 230 fHiGains->Reset(0.); 231 fLoGains->Reset(0.); 251 232 252 233 } … … 261 242 262 243 244 Bool_t MHCalibrationPixel::CheckOscillations() 245 { 246 247 if (fPSDExpFit) 248 return IsOscillating(); 249 250 MFFT fourier; 251 252 fPSDLoGain = fourier.PowerSpectrumDensity(fLoGains); 253 fPSDHiGain = fourier.PowerSpectrumDensity(fHiGains); 254 255 Int_t entries; 256 TArrayF *array; 257 258 if (IsUseLoGain()) 259 { 260 fHPSD = new TH1F(Form("%s%d","HPSD",fPixId), 261 Form("%s%s","Power Spectrum Density Projection ","LoGain"), 262 fPSDNbins,fMinFreq,fNyquistFreq); 263 264 array = fPSDLoGain; 265 } 266 else 267 { 268 269 fHPSD = new TH1F(Form("%s%d","HPSD",fPixId), 270 Form("%s%s","Power Spectrum Density Projection ","HiGain"), 271 fPSDNbins,fMinFreq,fNyquistFreq); 272 273 array = fPSDLoGain; 274 } 275 276 entries = array->GetSize(); 277 278 for (Int_t i=0;i<entries;i++) 279 fHPSD->Fill(array->At(i)); 280 281 // 282 // First guesses for the fit (should be as close to reality as possible, 283 // 284 const Double_t area_guess = entries*10.; 285 286 fPSDExpFit = new TF1(Form("%s%d","PSDExpFit",fPixId),"[0]*exp(-[1]*x)",0.,1.); 287 288 fPSDExpFit->SetParameters(entries,10.); 289 fPSDExpFit->SetParNames("Area","slope"); 290 fPSDExpFit->SetParLimits(0,0.,3.*area_guess); 291 fPSDExpFit->SetParLimits(1,5.,20.); 292 fPSDExpFit->SetRange(fMinFreq,fNyquistFreq); 293 294 fHPSD->Fit(fPSDExpFit,"RQL0"); 295 296 fPSDProb = fPSDExpFit->GetProb(); 297 298 if (fPSDProb < gkProbLimit) 299 { 300 SETBIT(fFlags,kOscillating); 301 return kTRUE; 302 } 303 304 CLRBIT(fFlags,kOscillating); 305 306 return kFALSE; 307 } 308 309 void MHCalibrationPixel::CreatePSDXaxis(Int_t n) 310 { 311 312 if (fPSDXaxis) 313 return; 314 315 fPSDXaxis = new TArrayF(n); 316 317 for (Int_t i=0;i<n;i++) 318 fPSDXaxis->AddAt((Float_t)i,i); 319 } 320 321 void MHCalibrationPixel::CreateChargeXaxis(Int_t n) 322 { 323 324 if (!fChargeXaxis) 325 { 326 fChargeXaxis = new TArrayF(n); 327 for (Int_t i=0;i<n;i++) 328 fChargeXaxis->AddAt((Float_t)i,i); 329 return; 330 } 331 332 if (fChargeXaxis->GetSize() == n) 333 return; 334 335 const Int_t diff = fChargeXaxis->GetSize()-n; 336 fChargeXaxis->Set(n); 337 if (diff < 0) 338 for (Int_t i=n;i<n+diff;i++) 339 fChargeXaxis->AddAt((Float_t)i,i); 340 } 341 342 void MHCalibrationPixel::CutArrayBorder(TArrayF *array) 343 { 344 345 Int_t i; 346 347 for (i=array->GetSize()-1;i>=0;i--) 348 if (array->At(i) != 0) 349 { 350 array->Set(i+1); 351 break; 352 } 353 } 354 355 356 263 357 Bool_t MHCalibrationPixel::IsEmpty() const 264 358 { … … 276 370 } 277 371 278 Bool_t MHCalibrationPixel::IsTimeFitOK() const 279 { 280 return TESTBIT(fFlags,kTimeFitOK); 372 Bool_t MHCalibrationPixel::IsOscillating() 373 { 374 375 if (fPSDExpFit) 376 return TESTBIT(fFlags,kOscillating); 377 378 return CheckOscillations(); 379 281 380 } 282 381 … … 291 390 } 292 391 293 Bool_t MHCalibrationPixel::FillRelTimeLoGain(Float_t t)294 {295 return (fHRelTimeLoGain->Fill(t) > -1);296 }297 298 Bool_t MHCalibrationPixel::FillChargevsNLoGain(Float_t q, Int_t n)299 {300 return (fHChargevsNLoGain->Fill(n,q) > -1);301 }302 303 392 Bool_t MHCalibrationPixel::FillChargeHiGain(Float_t q) 304 393 { … … 309 398 { 310 399 return (fHAbsTimeHiGain->Fill(t) > -1); 311 }312 313 Bool_t MHCalibrationPixel::FillRelTimeHiGain(Float_t t)314 {315 return (fHRelTimeHiGain->Fill(t) > -1);316 }317 318 Bool_t MHCalibrationPixel::FillChargevsNHiGain(Float_t q, Int_t n)319 {320 return (fHChargevsNHiGain->Fill(n,q) > -1);321 400 } 322 401 … … 333 412 fHChargeHiGain->SetName( Form("%s%d",fHChargeHiGain->GetName(), id)); 334 413 fHAbsTimeHiGain->SetName( Form("%s%d",fHAbsTimeHiGain->GetName(), id)); 335 fHRelTimeHiGain->SetName( Form("%s%d",fHRelTimeHiGain->GetName(), id));336 fHChargevsNHiGain->SetName(Form("%s%d",fHChargevsNHiGain->GetName(),id));337 414 338 415 // … … 341 418 fHChargeHiGain->SetTitle( Form("%s%d",fHChargeHiGain->GetTitle(), id)); 342 419 fHAbsTimeHiGain->SetTitle( Form("%s%d",fHAbsTimeHiGain->GetTitle(), id)); 343 fHRelTimeHiGain->SetTitle( Form("%s%d",fHRelTimeHiGain->GetTitle(), id));344 fHChargevsNHiGain->SetTitle( Form("%s%d",fHChargevsNHiGain->GetTitle(),id));345 420 346 421 // … … 349 424 fHChargeLoGain->SetName( Form("%s%d",fHChargeLoGain->GetName(),id)); 350 425 fHAbsTimeLoGain->SetName( Form("%s%d",fHAbsTimeLoGain->GetName(),id)); 351 fHRelTimeLoGain->SetName( Form("%s%d",fHRelTimeLoGain->GetName(),id));352 fHChargevsNLoGain->SetName( Form("%s%d",fHChargevsNLoGain->GetName(),id));353 426 354 427 // … … 357 430 fHChargeLoGain->SetTitle( Form("%s%d",fHChargeLoGain->GetTitle(),id)); 358 431 fHAbsTimeLoGain->SetTitle( Form("%s%d",fHAbsTimeLoGain->GetTitle(),id)); 359 fHRelTimeLoGain->SetTitle( Form("%s%d",fHRelTimeLoGain->GetTitle(),id));360 fHChargevsNLoGain->SetTitle( Form("%s%d",fHChargevsNLoGain->GetTitle(),id));361 432 362 433 fPixId = id; 363 434 } 364 435 365 }366 367 368 Bool_t MHCalibrationPixel::SetupFill(const MParList *plist)369 {370 371 Reset();372 373 return kTRUE;374 436 } 375 437 … … 390 452 } 391 453 392 Bool_t MHCalibrationPixel::FillPointInGraph(Float_t qhi,Float_t qlo) 393 { 394 395 fHiGains->Set(++fTotalEntries); 396 fLoGains->Set(fTotalEntries); 397 398 fHiGains->AddAt(qhi,fTotalEntries-1); 399 fLoGains->AddAt(qlo,fTotalEntries-1); 454 Bool_t MHCalibrationPixel::FillGraphs(Float_t qhi,Float_t qlo) 455 { 456 457 if (fTotalEntries >= fCurrentSize) 458 { 459 fCurrentSize *= 2; 460 461 fHiGains->Set(fCurrentSize); 462 fLoGains->Set(fCurrentSize); 463 } 464 465 fHiGains->AddAt(qhi,fTotalEntries); 466 fLoGains->AddAt(qlo,fTotalEntries); 467 468 fTotalEntries++; 400 469 401 470 return kTRUE; … … 508 577 fHChargeHiGain->Draw(opt); 509 578 510 c->Modified();511 c->Update();512 513 579 if (IsUseLoGain()) 514 580 { … … 528 594 } 529 595 530 c->Modified();531 c->Update();532 533 596 c->cd(3); 534 597 gROOT->SetSelectedPad(NULL); … … 536 599 if (fHivsLoGain) 537 600 fHivsLoGain->Draw("prof"); 538 gPad->Modified(); 539 gPad->Update(); 540 601 541 602 c->cd(4); 542 603 DrawLegend(); 543 544 604 } 545 605 else … … 558 618 559 619 fHChargeLoGain->Draw(opt); 560 c->Modified(); 561 c->Update(); 562 620 563 621 c->cd(3); 564 622 DrawLegend(); … … 570 628 if (fHivsLoGain) 571 629 fHivsLoGain->Draw("prof"); 572 gPad->Modified();573 gPad->Update();574 630 } 631 632 c->cd(5); 633 gPad->SetTicks(); 634 fHAbsTimeHiGain->Draw(opt); 635 636 c->cd(6); 637 gPad->SetTicks(); 638 fHAbsTimeLoGain->Draw(opt); 639 640 CutArrayBorder(fHiGains); 641 CreateChargeXaxis(fHiGains->GetSize()); 642 643 c->cd(7); 644 gPad->SetTicks(); 645 TGraph *gr1 = new TGraph(fChargeXaxis->GetSize(), 646 fChargeXaxis->GetArray(), 647 fHiGains->GetArray()); 648 gr1->SetTitle("Evolution of HiGain charges with event number"); 649 gr1->SetBit(kCanDelete); 650 gr1->Draw("AL"); 651 652 CutArrayBorder(fLoGains); 653 CreateChargeXaxis(fHiGains->GetSize()); 654 655 c->cd(8); 656 gPad->SetTicks(); 657 TGraph *gr2 = new TGraph(fChargeXaxis->GetSize(), 658 fChargeXaxis->GetArray(), 659 fLoGains->GetArray()); 660 gr2->SetTitle("Evolution of HiGain charges with event number"); 661 gr2->SetBit(kCanDelete); 662 gr2->Draw("AL"); 575 663 576 664 c->Modified(); 577 665 c->Update(); 578 666 579 c->cd(5); 580 gStyle->SetOptStat(1111111); 581 582 gPad->SetTicks(); 583 gPad->SetLogy(0); 584 fHRelTimeHiGain->Draw(opt); 667 c->cd(9); 668 669 TArrayF *array; 670 671 if(IsUseLoGain()) 672 { 673 if (!fPSDLoGain) 674 return; 675 array = fPSDLoGain; 676 } 677 else 678 { 679 if (!fPSDHiGain) 680 return; 681 array = fPSDHiGain; 682 } 683 684 if (!fPSDXaxis) 685 CreatePSDXaxis(array->GetSize()); 686 687 TGraph *gr3 = new TGraph(fPSDXaxis->GetSize(),fPSDXaxis->GetArray(),array->GetArray()); 688 gr3->SetTitle("Power Spectrum Density"); 689 gr3->SetBit(kCanDelete); 690 gr3->Draw("AL"); 691 585 692 c->Modified(); 586 693 c->Update(); 587 694 588 if (IsUseLoGain()) 589 { 590 591 c->cd(6); 592 gPad->SetTicks(); 593 gPad->SetLogy(0); 594 fHRelTimeLoGain->Draw(opt); 595 c->Modified(); 596 c->Update(); 597 598 if (fRelTimeGausFit) 599 { 600 fRelTimeGausFit->SetLineColor(IsTimeFitOK() ? kGreen : kRed); 601 fRelTimeGausFit->Draw("same"); 602 } 603 604 c->Modified(); 605 c->Update(); 606 } 607 else 608 { 609 if (fRelTimeGausFit) 610 { 611 fRelTimeGausFit->SetLineColor(IsTimeFitOK() ? kGreen : kRed); 612 fRelTimeGausFit->Draw("same"); 613 } 614 615 c->Modified(); 616 c->Update(); 617 618 c->cd(6); 619 gPad->SetTicks(); 620 gPad->SetLogy(0); 621 fHRelTimeLoGain->Draw(opt); 622 c->Modified(); 623 c->Update(); 624 625 } 626 c->Modified(); 627 c->Update(); 628 629 c->cd(7); 630 gPad->SetTicks(); 631 fHAbsTimeHiGain->Draw(opt); 632 c->Modified(); 633 c->Update(); 634 635 c->cd(8); 636 gPad->SetTicks(); 637 fHAbsTimeLoGain->Draw(opt); 638 c->Modified(); 639 c->Update(); 640 641 642 c->cd(9); 643 gPad->SetTicks(); 644 fHChargevsNHiGain->Draw(opt); 645 c->Modified(); 646 c->Update(); 647 648 c->cd(10); 649 gPad->SetTicks(); 650 fHChargevsNLoGain->Draw(opt); 651 c->Modified(); 652 c->Update(); 653 654 return; 695 c->cd(10); 696 697 gStyle->SetOptStat(111111); 698 gPad->SetTicks(); 699 700 if (fHPSD->Integral() > 0) 701 gPad->SetLogy(); 702 703 fHPSD->Draw(opt); 704 705 if (fPSDExpFit) 706 { 707 fPSDExpFit->SetLineColor(IsOscillating() ? kRed : kGreen); 708 fPSDExpFit->Draw("same"); 709 } 710 711 c->Modified(); 712 c->Update(); 713 714 return; 655 715 } 656 716 … … 684 744 } 685 745 686 687 Bool_t MHCalibrationPixel::FitTime(Option_t *option)688 {689 690 if (fRelTimeGausFit)691 return kFALSE;692 693 //694 // From the absolute time, we only take the mean and RMS695 //696 fAbsTimeMean = (Float_t)fHAbsTimeHiGain->GetMean();697 fAbsTimeRms = (Float_t)fHAbsTimeHiGain->GetRMS();698 fAbsTimeMeanErr = (Float_t)fAbsTimeRms / TMath::Sqrt(fHAbsTimeHiGain->GetEntries());699 700 if (TESTBIT(fFlags,kUseLoGain))701 {702 fAbsTimeMean = fHAbsTimeLoGain->GetMean();703 fAbsTimeRms = fHAbsTimeLoGain->GetRMS();704 fAbsTimeMeanErr = fAbsTimeRms / TMath::Sqrt(fHAbsTimeLoGain->GetEntries());705 }706 707 //708 // Get the fitting ranges709 //710 Axis_t rmin = fRelTimeLowerFitRangeHiGain;711 Axis_t rmax = fRelTimeUpperFitRangeHiGain;712 TH1F *hist = fHRelTimeHiGain;713 714 if (TESTBIT(fFlags,kUseLoGain))715 {716 rmin = fRelTimeLowerFitRangeLoGain;717 rmax = fRelTimeUpperFitRangeLoGain;718 hist = fHRelTimeLoGain;719 }720 721 const Stat_t entries = hist->Integral("width");722 const Double_t mu_guess = hist->GetBinCenter(hist->GetMaximumBin());723 const Double_t sigma_guess = (rmax - rmin)/2.;724 const Double_t area_guess = 2.*entries/gkSq2Pi/sigma_guess;725 726 TString name = TString("GausRelTime");727 name += fPixId;728 fRelTimeGausFit = new TF1(name.Data(),"gaus",rmin,rmax);729 730 if (!fRelTimeGausFit)731 {732 *fLog << warn << dbginf << "WARNING: Could not create fit function for RelTime fit" << endl;733 return kFALSE;734 }735 736 fRelTimeGausFit->SetParameters(area_guess,mu_guess,sigma_guess);737 fRelTimeGausFit->SetParNames("Area","#mu","#sigma");738 fRelTimeGausFit->SetParLimits(0,0.,5.*area_guess);739 fRelTimeGausFit->SetParLimits(1,rmin,rmax);740 fRelTimeGausFit->SetParLimits(2,0.,(rmax-rmin));741 fRelTimeGausFit->SetRange(rmin,rmax);742 743 hist->Fit(fRelTimeGausFit,option);744 745 //746 // If the fit does not converge, try another one with smaller bounderies747 //748 if (fRelTimeGausFit->GetProb() < 0.001)749 {750 rmin = fRelTimeGausFit->GetParameter(1) - 1.5*fRelTimeGausFit->GetParameter(2);751 rmax = fRelTimeGausFit->GetParameter(1) + 1.5*fRelTimeGausFit->GetParameter(2);752 fRelTimeGausFit->SetRange(rmin,rmax);753 hist->Fit(fRelTimeGausFit,option);754 }755 756 fRelTimeChisquare = fRelTimeGausFit->GetChisquare();757 fRelTimeNdf = fRelTimeGausFit->GetNDF();758 fRelTimeProb = fRelTimeGausFit->GetProb();759 760 fRelTimeMean = fRelTimeGausFit->GetParameter(1);761 fRelTimeSigma = fRelTimeGausFit->GetParameter(2);762 763 fRelTimeMeanErr = fRelTimeGausFit->GetParError(1);764 765 if (TMath::IsNaN(fRelTimeMean) || TMath::IsNaN(fRelTimeSigma))766 {767 CLRBIT(fFlags,kTimeFitOK);768 return kFALSE;769 }770 771 if (TMath::IsNaN(fRelTimeChisquare) || (fRelTimeProb < fProbLimit))772 {773 CLRBIT(fFlags,kTimeFitOK);774 return kFALSE;775 }776 777 SETBIT(fFlags,kTimeFitOK);778 779 return kTRUE;780 781 }782 746 783 747 … … 850 814 851 815 // 816 // From the absolute time, we only take the mean and RMS 817 // 818 fAbsTimeMean = (Float_t)fHAbsTimeHiGain->GetMean(); 819 fAbsTimeRms = (Float_t)fHAbsTimeHiGain->GetRMS(); 820 fAbsTimeMeanErr = (Float_t)fAbsTimeRms / TMath::Sqrt(fHAbsTimeHiGain->GetEntries()); 821 822 if (TESTBIT(fFlags,kUseLoGain)) 823 { 824 fAbsTimeMean = fHAbsTimeLoGain->GetMean(); 825 fAbsTimeRms = fHAbsTimeLoGain->GetRMS(); 826 fAbsTimeMeanErr = fAbsTimeRms / TMath::Sqrt(fHAbsTimeLoGain->GetEntries()); 827 } 828 829 // 852 830 // The fit result is accepted under condition: 853 831 // 1) The results are not nan's … … 880 858 881 859 882 883 884 860 void MHCalibrationPixel::CutAllEdges() 885 861 { 886 862 887 Int_t nbins = 50;863 Int_t nbins = 30; 888 864 889 865 CutEdges(fHChargeHiGain,nbins); … … 899 875 +fHChargeLoGain->GetBinWidth(0); 900 876 901 CutEdges(fHRelTimeHiGain,0);902 903 fRelTimeLowerFitRangeHiGain = fHRelTimeHiGain->GetBinLowEdge(fHRelTimeHiGain->GetXaxis()->GetFirst());904 fRelTimeUpperFitRangeHiGain = fHRelTimeHiGain->GetBinLowEdge(fHRelTimeHiGain->GetXaxis()->GetLast())905 +fHRelTimeHiGain->GetBinWidth(0);906 907 CutEdges(fHRelTimeLoGain,0);908 909 fRelTimeLowerFitRangeLoGain = fHRelTimeLoGain->GetBinLowEdge(fHRelTimeLoGain->GetXaxis()->GetFirst());910 fRelTimeUpperFitRangeLoGain = fHRelTimeLoGain->GetBinLowEdge(fHRelTimeLoGain->GetXaxis()->GetLast())911 +fHRelTimeLoGain->GetBinWidth(0);912 877 913 878 CutEdges(fHAbsTimeHiGain,0); … … 923 888 +fHAbsTimeLoGain->GetBinWidth(0); 924 889 925 CutEdges(fHChargevsNHiGain,0);926 CutEdges(fHChargevsNLoGain,0);927 890 928 891 } … … 939 902 } 940 903 941 void MHCalibrationPixel::PrintTimeFitResult()942 {943 944 *fLog << all << "Results of the Time Slices Fit: " << endl;945 *fLog << all << "Chisquare: " << fRelTimeChisquare << endl;946 *fLog << all << "Ndf: " << fRelTimeNdf << endl;947 *fLog << all << "Probability: " << fRelTimeProb << endl;948 *fLog << all << endl;949 950 }
Note:
See TracChangeset
for help on using the changeset viewer.