Changeset 3007 for trunk/MagicSoft
- Timestamp:
- 02/02/04 22:52:53 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3006 r3007 9 9 * manalysis/MPedCalcPedRun.cc 10 10 - corrected formulae in Class descriptino 11 12 * mcalib/MCalibration.* 13 * mcalib/MHCalibration.* 14 * manalysis/MMcCalibrationUpdate.cc 15 - calculate relative times and absolute times. Fit only 16 the relative ones. 11 17 12 18 -
trunk/MagicSoft/Mars/macros/calibration.C
r2983 r3007 24 24 25 25 const TString pedfile = "/mnt/Data/rootdata/CrabNebula/2004_01_27/20040126_12149_P_Cab-On_E.root"; 26 const TString calfile = "/mnt/Data/rootdata/CrabNebula/2004_01_27/20040126_1252 *_C_Cab-On_E.root";26 const TString calfile = "/mnt/Data/rootdata/CrabNebula/2004_01_27/20040126_12525_C_Cab-On_E.root"; 27 27 28 28 //const TString pedfile = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/20031218_03522_P_Park_E.root"; … … 52 52 MGeomApply geomapl; 53 53 MExtractSignal sigcalc; 54 // 55 // We saw that the signal jumps between slices, 56 // thus set the extraction range as high as possible 57 // Sliding window will be implemented asap. 58 // 54 59 sigcalc.SetRange(1,14,1,14); 60 55 61 MPedCalcPedRun pedcalc; 56 62 pedcalc.SetUseHists(); … … 209 215 // faster results 210 216 // 211 timecalc.SetStepSize(0.5);217 // timecalc.SetStepSize(0.02); 212 218 213 219 // … … 246 252 // 247 253 MCalibrationBlindPix *bp = calcam.GetBlindPixel(); 248 254 // bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPolya); 249 255 // bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPoisson4); 250 256 … … 285 291 MHCamera disp3 (geomcam, "MCalibrationPix;SigmaCharge", "Sigma of Fitted Charges"); 286 292 MHCamera disp5 (geomcam, "MCalibrationPix;ChargeProb", "Probability of Fit"); 287 MHCamera disp6 (geomcam, "MCalibrationPix;Time", " Arrival Times");288 MHCamera disp7 (geomcam, "MCalibrationPix;SigmaTime", "Sigma of Arrival Times");289 MHCamera disp8 (geomcam, "MCalibrationPix;Time ChiSquare", "Chi Squareof Time Fit");293 MHCamera disp6 (geomcam, "MCalibrationPix;Time", "Rel. Arrival Times"); 294 MHCamera disp7 (geomcam, "MCalibrationPix;SigmaTime", "Sigma of Rel. Arrival Times"); 295 MHCamera disp8 (geomcam, "MCalibrationPix;TimeProb", "Probability of Time Fit"); 290 296 MHCamera disp9 (geomcam, "MCalibrationPix;Ped", "Pedestals"); 291 297 MHCamera disp10 (geomcam, "MCalibrationPix;PedRms", "Pedestal RMS"); … … 333 339 disp3.SetYTitle("\\sigma_{Charge} [FADC counts]"); 334 340 disp5.SetYTitle("P_{Charge} [1]"); 335 disp6.SetYTitle("Arr. Time [ Time Slice Nr.]");336 disp7.SetYTitle("\\sigma_{Time} [ Time Slices]");337 disp8.SetYTitle(" \\chi^{2}_{Time} [1]");341 disp6.SetYTitle("Arr. Time [ns]"); 342 disp7.SetYTitle("\\sigma_{Time} [ns]"); 343 disp8.SetYTitle("P_{Time} [1]"); 338 344 disp9.SetYTitle("Ped [FADC Counts ]"); 339 345 disp10.SetYTitle("RMS_{Ped} [FADC Counts ]"); … … 366 372 367 373 // Times 368 TCanvas &c3 = d3->AddTab("Fitted Times");374 TCanvas &c3 = d3->AddTab("Fitted Rel. Times"); 369 375 c3.Divide(3,3); 370 376 371 377 CamDraw(c3,disp6,calcam,1,3,1); 372 CamDraw(c3,disp7,calcam,2,3, 0);378 CamDraw(c3,disp7,calcam,2,3,1); 373 379 CamDraw(c3,disp8,calcam,3,3,0); 374 380 -
trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
r3004 r3007 222 222 223 223 calpix.SetBlindPixelMethodValid(); 224 calpix.SetFitValid(); 224 calpix.SetChargeFitValid(); 225 calpix.SetTimeFitValid(); 225 226 226 227 calpix.SetConversionHiLo(fConversionHiLo); -
trunk/MagicSoft/Mars/mcalib/MCalibrate.cc
r2949 r3007 169 169 const MCalibrationPix &pix = (*fCalibrations)[pixidx]; 170 170 171 if (!pix.Is FitValid())171 if (!pix.IsChargeFitValid()) 172 172 continue; 173 173 -
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
r2995 r3007 148 148 CLRBIT(fFlags, kUsePinDiodeFit); 149 149 150 fEvents = 0;151 fCosmics = 0;152 fNumHiGainSamples = 0;153 fNumLoGainSamples = 0;154 fConversionHiLo = 0;150 fEvents = 0; 151 fCosmics = 0; 152 fNumHiGainSamples = 0; 153 fNumLoGainSamples = 0; 154 fConversionHiLo = 0; 155 155 fNumExcludedPixels = 0; 156 156 157 157 fColor = kECT1; 158 158 } … … 287 287 MCalibrationPix &pix = (*fCalibrations)[i]; 288 288 pix.DefinePixId(i); 289 MHCalibrationPixel *hist = pix.GetHist(); 290 291 hist->SetTimeFitRangesHiGain(fSignals->GetFirstUsedSliceHiGain(), 292 fSignals->GetLastUsedSliceHiGain()); 293 hist->SetTimeFitRangesLoGain(fSignals->GetFirstUsedSliceLoGain(), 294 fSignals->GetLastUsedSliceLoGain()); 289 290 pix.SetAbsTimeBordersHiGain(fSignals->GetFirstUsedSliceHiGain(), 291 fSignals->GetLastUsedSliceHiGain()); 292 pix.SetAbsTimeBordersLoGain(fSignals->GetFirstUsedSliceLoGain(), 293 fSignals->GetLastUsedSliceLoGain()); 295 294 296 295 if (!TESTBIT(fFlags,kUseQualityChecks)) 297 296 pix.SetExcludeQualityCheck(); 298 297 299 298 } 300 299 301 300 // … … 431 430 fEvents++; 432 431 433 Int_t overflow = 0; 432 Int_t overflow = 0; 433 Float_t referencetime = 0.; 434 434 435 435 // 436 436 // Create a (second) loop to do fill the calibration histograms 437 // 438 437 // Search for: a signal in MExtractedSignalCam 438 // a time in MArrivalTime. 439 // Fill histograms with: 440 // charge 441 // charge vs. event nr. 442 // relative arrival time w.r.t. pixel 1 443 // 439 444 while (pixel.Next()) 440 445 { … … 452 457 const Float_t sumlo = sig.GetExtractedSignalLoGain(); 453 458 454 Float_t mtime = 0.; 459 Float_t abstime = 0.; 460 Float_t reltime = 0.; 455 461 456 462 if (TESTBIT(fFlags,kUseTimes)) 457 463 { 458 // 459 // first, have a look in MArrivalTime, 464 465 // 466 // Have a look in MArrivalTime, 460 467 // otherwise search the position of maximum bin 461 468 // in MRawEvtData 462 469 // 463 470 if (fArrivalTime) 464 mtime = (*fArrivalTime)[pixid]; 471 { 472 abstime = (*fArrivalTime)[pixid]; 473 reltime = abstime - (*fArrivalTime)[1]; 474 } 475 465 476 else 466 if (sig.IsLoGainUsed()) 467 mtime = (Double_t)pixel.GetIdxMaxLoGainSample(); 468 else 469 mtime = (Double_t)pixel.GetIdxMaxHiGainSample(); 477 { 478 if (pixid == 1) 479 referencetime = (Float_t)pixel.GetIdxMaxHiGainSample(); 480 481 if (sig.IsLoGainUsed()) 482 { 483 abstime = (Float_t)pixel.GetIdxMaxLoGainSample(); 484 reltime = abstime - referencetime; 485 } 486 else 487 { 488 abstime = (Float_t)pixel.GetIdxMaxHiGainSample(); 489 reltime = abstime - referencetime; 490 } 491 } 470 492 } 471 493 … … 481 503 if (TESTBIT(fFlags,kUseTimes)) 482 504 { 483 if (!blindpixel.FillTime( mtime))505 if (!blindpixel.FillTime(reltime)) 484 506 *fLog << warn << 485 "Overflow or Underflow occurred filling Blind Pixel time = " << mtime << endl;507 "Overflow or Underflow occurred filling Blind Pixel time = " << reltime << endl; 486 508 } 487 509 … … 499 521 if (TESTBIT(fFlags,kUseTimes)) 500 522 { 501 if (!pindiode.Fill Time(mtime))523 if (!pindiode.FillAbsTime(abstime)) 502 524 *fLog << warn << 503 "Overflow or Underflow occurred filling PINDiode: time = " << mtime << endl; 525 "Overflow or Underflow occurred filling PINDiode abs. time = " << abstime << endl; 526 if (!pindiode.FillRelTime(reltime)) 527 *fLog << warn << 528 "Overflow or Underflow occurred filling PINDiode rel. time = " << reltime << endl; 504 529 } 505 530 … … 528 553 if (TESTBIT(fFlags,kUseTimes)) 529 554 { 530 if (!pix.FillTimeLoGain(mtime)) 531 *fLog << warn << "Could not fill Lo Gain Time of pixel: " 532 << pixid << " time = " << mtime << endl; 555 if (!pix.FillAbsTimeLoGain(abstime)) 556 *fLog << warn << "Could not fill Lo Gain Abs. Time of pixel: " 557 << pixid << " time = " << abstime << endl; 558 if (!pix.FillRelTimeLoGain(reltime)) 559 *fLog << warn << "Could not fill Lo Gain Rel. Time of pixel: " 560 << pixid << " time = " << reltime << endl; 533 561 } 534 562 } /* if (sig.IsLoGainUsed()) */ … … 541 569 if (TESTBIT(fFlags,kUseTimes)) 542 570 { 543 if (!pix.FillTimeHiGain(mtime)) 544 *fLog << warn << "Could not fill Hi Gain Time of pixel: " 545 << pixid << " time = " << mtime << endl; 571 if (!pix.FillAbsTimeHiGain(abstime)) 572 *fLog << warn << "Could not fill Hi Gain Abs. Time of pixel: " 573 << pixid << " time = " << abstime << endl; 574 if (!pix.FillRelTimeHiGain(reltime)) 575 *fLog << warn << "Could not fill Hi Gain Rel. Time of pixel: " 576 << pixid << " time = " << reltime << endl; 546 577 } 547 578 } /* else (sig.IsLoGainUsed()) */ … … 606 637 MPedestalPix &ped = (*fPedestals)[fBlindPixelId]; 607 638 // 608 // retrieve the blind pixel histogram container639 // retrieve the histogram containers 609 640 // 610 641 MHCalibrationBlindPixel *hist = blindpixel.GetHist(); 642 MHPedestalPixel *pedhist = ped.GetHist(); 611 643 // 612 644 // Set the corresponding values 613 645 // 614 const Float_t peddiff = ped.GetMean() 615 - ped.GetPedestal()*fSignals->GetNumUsedFADCSlices(); 616 const Float_t pederr = ped.GetMeanErr(); 646 const Float_t nslices = (Float_t)fSignals->GetNumUsedFADCSlices(); 647 const Int_t nentries = pedhist->GetTotalEntries(); 648 649 const Float_t peddiff = ped.GetMean() - ped.GetPedestal()*nslices; 650 651 Float_t pederr = ped.GetMeanErr()*ped.GetMeanErr(); 652 pederr += ped.GetPedestalRms()*ped.GetPedestalRms()*nslices*nslices/nentries/nentries; 653 pederr = TMath::Sqrt(pederr); 654 617 655 const Float_t pedsigma = ped.GetSigma(); 618 656 const Float_t pedsigmaerr = ped.GetSigmaErr(); -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc
r2956 r3007 59 59 60 60 using namespace std; 61 62 const Int_t MCalibrationCam::gkBlindPixelId = 559; 63 const Int_t MCalibrationCam::gkPINDiodeId = 9999; 64 const Float_t MCalibrationCam::gkTimeSliceWidth = 3.3; 65 61 66 // -------------------------------------------------------------------------- 62 67 // … … 72 77 : fOffsets(NULL), 73 78 fSlopes(NULL), 74 fOffvsSlope(NULL), 75 fBlindPixelId(559), 76 fPINDiodeId(9999) 79 fOffvsSlope(NULL) 77 80 { 78 81 fName = name ? name : "MCalibrationCam"; … … 261 264 { 262 265 263 if (pix->Is FitValid() && !pix->IsExcluded())266 if (pix->IsChargeFitValid() && !pix->IsExcluded()) 264 267 { 265 268 … … 287 290 { 288 291 289 if (!pix->Is FitValid() && !pix->IsExcluded())292 if (!pix->IsChargeFitValid() && !pix->IsExcluded()) 290 293 { 291 294 … … 388 391 return kFALSE; 389 392 390 if ( (!(*this)[idx].Is FitValid()) || (*this)[idx].IsExcluded())391 return kFALSE; 392 393 if (idx == fBlindPixelId)394 return kFALSE; 395 396 if (idx == fPINDiodeId)393 if ( (!(*this)[idx].IsChargeFitValid()) || (*this)[idx].IsExcluded()) 394 return kFALSE; 395 396 if (idx == gkBlindPixelId) 397 return kFALSE; 398 399 if (idx == gkPINDiodeId) 397 400 return kFALSE; 398 401 … … 415 418 break; 416 419 case 5: 417 val = (*this)[idx].GetTime(); 420 if (!(*this)[idx].IsTimeFitValid()) 421 return kFALSE; 422 val = (*this)[idx].GetTime() * gkTimeSliceWidth; 418 423 break; 419 424 case 6: 420 val = (*this)[idx].GetSigmaTime(); 425 if (!(*this)[idx].IsTimeFitValid()) 426 return kFALSE; 427 val = (*this)[idx].GetSigmaTime() * gkTimeSliceWidth; 421 428 break; 422 429 case 7: 423 val = (*this)[idx].GetTimeChiSquare(); 430 if (!(*this)[idx].IsTimeFitValid()) 431 return kFALSE; 432 val = (*this)[idx].GetTimeProb(); 424 433 break; 425 434 case 8: … … 550 559 { 551 560 552 if (!fPINDiode->Is FitValid())561 if (!fPINDiode->IsChargeFitValid()) 553 562 return kFALSE; 554 563 -
trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h
r2958 r3007 21 21 private: 22 22 23 static const Int_t gkBlindPixelId; 24 static const Int_t gkPINDiodeId; 25 static const Float_t gkTimeSliceWidth; 26 27 23 28 Int_t fNumPixels; 24 29 TClonesArray *fPixels; //-> Array of MCalibrationPix with fit results … … 27 32 MCalibrationPINDiode *fPINDiode; //-> Pointer to the PIN Diode with fit results 28 33 29 30 34 TH1D* fOffsets; //! 31 35 TH1D* fSlopes; //! 32 36 33 37 TH2D* fOffvsSlope; //! 34 35 const Int_t fBlindPixelId;36 const Int_t fPINDiodeId;37 38 38 39 Float_t fMeanPhotInsidePlexiglass; // The mean number of photons in an INNER PIXEL inside the plexiglass … … 94 95 Bool_t IsNumPhotOutsidePlexiglassAvailable() const; 95 96 96 97 97 // Others 98 98 MCalibrationPix &operator[](Int_t i); -
trunk/MagicSoft/Mars/mcalib/MCalibrationPINDiode.cc
r2931 r3007 76 76 77 77 CLRBIT(fFlags, kExcluded); 78 CLRBIT(fFlags, kFitValid); 78 CLRBIT(fFlags, kChargeFitValid); 79 CLRBIT(fFlags, kChargeFitValid); 79 80 CLRBIT(fFlags, kFitted); 80 81 … … 129 130 // Set the Excluded Bit from outside 130 131 // 131 void MCalibrationPINDiode::SetFitValid(Bool_t b ) 132 { 133 b ? SETBIT(fFlags, kFitValid) : CLRBIT(fFlags, kFitValid); 132 void MCalibrationPINDiode::SetChargeFitValid(Bool_t b ) 133 { 134 b ? SETBIT(fFlags, kChargeFitValid) : CLRBIT(fFlags, kChargeFitValid); 135 } 136 137 // -------------------------------------------------------------------------- 138 // 139 // Set the Excluded Bit from outside 140 // 141 void MCalibrationPINDiode::SetTimeFitValid(Bool_t b ) 142 { 143 b ? SETBIT(fFlags, kTimeFitValid) : CLRBIT(fFlags, kTimeFitValid); 134 144 } 135 145 … … 148 158 } 149 159 150 Bool_t MCalibrationPINDiode::IsFitValid() const 151 { 152 return TESTBIT(fFlags, kFitValid); 160 Bool_t MCalibrationPINDiode::IsChargeFitValid() const 161 { 162 return TESTBIT(fFlags, kChargeFitValid); 163 } 164 165 Bool_t MCalibrationPINDiode::IsTimeFitValid() const 166 { 167 return TESTBIT(fFlags, kTimeFitValid); 153 168 } 154 169 … … 165 180 // or if the histogram is empty 166 181 // 167 if (fHist->Is FitOK() || fHist->IsEmpty())182 if (fHist->IsChargeFitOK() || fHist->IsEmpty()) 168 183 return kTRUE; 169 184 … … 195 210 196 211 if (CheckChargeFitValidity()) 197 SETBIT(fFlags,k FitValid);212 SETBIT(fFlags,kChargeFitValid); 198 213 else 199 214 { 200 CLRBIT(fFlags,k FitValid);215 CLRBIT(fFlags,kChargeFitValid); 201 216 return kFALSE; 202 217 } … … 242 257 } 243 258 244 if (!fHist->Is FitOK())259 if (!fHist->IsChargeFitOK()) 245 260 { 246 261 *fLog << warn << "WARNING: Probability of Fitted Charge too low in PINDiode " << endl; … … 267 282 { 268 283 269 if(!fHist->FitTime HiGain())284 if(!fHist->FitTime()) 270 285 { 271 286 *fLog << warn << "WARNING: Could not fit Hi Gain times of PIN Diode" << endl; … … 274 289 } 275 290 276 fTime = fHist->GetTimeMean(); 277 fSigmaTime = fHist->GetTimeSigma(); 278 fTimeChiSquare = fHist->GetTimeChiSquare(); 279 fTimeProb = fHist->GetTimeProb(); 291 fTime = fHist->GetRelTimeMean(); 292 fSigmaTime = fHist->GetRelTimeSigma(); 293 fTimeProb = fHist->GetRelTimeProb(); 280 294 281 295 if (CheckTimeFitValidity()) 282 SETBIT(fFlags,k FitValid);296 SETBIT(fFlags,kTimeFitValid); 283 297 else 284 CLRBIT(fFlags,k FitValid);298 CLRBIT(fFlags,kTimeFitValid); 285 299 286 300 return kTRUE; -
trunk/MagicSoft/Mars/mcalib/MCalibrationPINDiode.h
r2931 r3007 34 34 35 35 enum { kExcluded, kExcludeQualityCheck, 36 k FitValid, kFitted };36 kChargeFitValid, kTimeFitValid, kFitted }; 37 37 38 38 Bool_t CheckChargeFitValidity(); … … 69 69 70 70 Bool_t IsExcluded() const; 71 Bool_t IsFitValid() const; 71 Bool_t IsChargeFitValid() const; 72 Bool_t IsTimeFitValid() const; 72 73 Bool_t IsFitted() const; 73 74 … … 76 77 void SetExcluded(Bool_t b = kTRUE); 77 78 void SetExcludeQualityCheck(Bool_t b = kTRUE); 78 void SetFitValid(Bool_t b = kTRUE); 79 void SetChargeFitValid(Bool_t b = kTRUE); 80 void SetTimeFitValid(Bool_t b = kTRUE); 79 81 void SetFitted(Bool_t b = kTRUE); 80 82 81 83 // Fill histos 82 84 Bool_t FillCharge(Float_t q) { return fHist->FillChargeHiGain(q); } 83 Bool_t FillTime(Float_t t) { return fHist->FillTimeHiGain(t); } 85 Bool_t FillAbsTime(Float_t t) { return fHist->FillAbsTimeHiGain(t); } 86 Bool_t FillRelTime(Float_t t) { return fHist->FillRelTimeHiGain(t); } 84 87 Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); } 85 88 -
trunk/MagicSoft/Mars/mcalib/MCalibrationPix.cc
r2996 r3007 30 30 // (offset) value of one Pixel (PMT). // 31 31 // // 32 /////////////////////////////////////////////////////////////////////////////33 #include "MCalibrationPix.h"34 #include "MCalibrationConfig.h"35 36 #include "MLog.h"37 #include "MLogManip.h"38 39 ClassImp(MCalibrationPix);40 41 using namespace std;42 43 // --------------------------------------------------------------------------44 //45 // Default Constructor:46 //47 32 // The following values are initialized to meaningful values: 48 33 // … … 54 39 // Error F-Factor = 2.*0.02 = 0.04 55 40 // 41 ///////////////////////////////////////////////////////////////////////////// 42 #include "MCalibrationPix.h" 43 #include "MCalibrationConfig.h" 44 45 #include "MLog.h" 46 #include "MLogManip.h" 47 48 ClassImp(MCalibrationPix); 49 50 using namespace std; 51 52 const Float_t MCalibrationPix::gkElectronicPedRms = 1.5; 53 const Float_t MCalibrationPix::gkErrElectronicPedRms = 0.3; 54 const Float_t MCalibrationPix::gkFFactor = 1.32; 55 const Float_t MCalibrationPix::gkFFactorError = 0.04; 56 const Float_t MCalibrationPix::gkChargeLimit = 3.; 57 const Float_t MCalibrationPix::gkChargeErrLimit = 0.; 58 const Float_t MCalibrationPix::gkChargeRelErrLimit = 1.; 59 const Float_t MCalibrationPix::gkTimeLimit = 1.5; 60 const Float_t MCalibrationPix::gkTimeErrLimit = 3.; 61 62 // -------------------------------------------------------------------------- 63 // 64 // Default Constructor: 65 // 56 66 MCalibrationPix::MCalibrationPix(const char *name, const char *title) 57 67 : fPixId(-1), 58 fElectronicPedRms(1.5),59 fErrElectronicPedRms(0.3),60 fFactor(1.32),61 fFactorError(0.04),62 fChargeLimit(3.),63 fChargeErrLimit(0.),64 fChargeRelErrLimit(1.),65 68 fFlags(0) 66 69 { … … 101 104 CLRBIT(fFlags, kHiGainSaturation); 102 105 CLRBIT(fFlags, kExcluded); 103 CLRBIT(fFlags, kFitValid); 106 CLRBIT(fFlags, kChargeFitValid); 107 CLRBIT(fFlags, kTimeFitValid); 104 108 CLRBIT(fFlags, kFitted); 105 109 CLRBIT(fFlags, kBlindPixelMethodValid); … … 117 121 fErrPedRms = 0.; 118 122 fTime = -1.; 123 fErrTime = -1.; 119 124 fSigmaTime = -1.; 120 fTimeChiSquare = -1.; 125 fTimeProb = -1.; 126 fTimeFirstHiGain = 0 ; 127 fTimeLastHiGain = 0 ; 128 fTimeFirstLoGain = 0 ; 129 fTimeLastLoGain = 0 ; 130 121 131 fPheFFactorMethod = -1.; 122 132 fPheFFactorMethodError = -1.; … … 231 241 // Set the Excluded Bit from outside 232 242 // 233 void MCalibrationPix::SetFitValid(Bool_t b ) 234 { 235 b ? SETBIT(fFlags, kFitValid) : CLRBIT(fFlags, kFitValid); 243 void MCalibrationPix::SetChargeFitValid(Bool_t b ) 244 { 245 b ? SETBIT(fFlags, kChargeFitValid) : CLRBIT(fFlags, kChargeFitValid); 246 } 247 248 // -------------------------------------------------------------------------- 249 // 250 // Set the Excluded Bit from outside 251 // 252 void MCalibrationPix::SetTimeFitValid(Bool_t b ) 253 { 254 b ? SETBIT(fFlags, kTimeFitValid) : CLRBIT(fFlags, kTimeFitValid); 236 255 } 237 256 … … 271 290 b ? SETBIT(fFlags, kPINDiodeMethodValid) : CLRBIT(fFlags, kPINDiodeMethodValid); 272 291 } 292 293 void MCalibrationPix::SetAbsTimeBordersHiGain(Byte_t f, Byte_t l) 294 { 295 296 fTimeFirstHiGain = f; 297 fTimeLastHiGain = l; 298 299 } 300 301 void MCalibrationPix::SetAbsTimeBordersLoGain(Byte_t f, Byte_t l) 302 { 303 304 fTimeFirstLoGain = f; 305 fTimeLastLoGain = l; 306 307 } 308 273 309 274 310 … … 278 314 } 279 315 280 Bool_t MCalibrationPix::IsFitValid() const 281 { 282 return TESTBIT(fFlags, kFitValid); 316 Bool_t MCalibrationPix::IsChargeFitValid() const 317 { 318 return TESTBIT(fFlags, kChargeFitValid); 319 } 320 321 Bool_t MCalibrationPix::IsTimeFitValid() const 322 { 323 return TESTBIT(fFlags, kTimeFitValid); 283 324 } 284 325 … … 342 383 // or if the histogram is empty 343 384 // 344 if (fHist->Is FitOK() || fHist->IsEmpty())385 if (fHist->IsChargeFitOK() || fHist->IsEmpty()) 345 386 return kTRUE; 346 387 … … 386 427 387 428 if (CheckChargeFitValidity()) 388 SETBIT(fFlags,k FitValid);429 SETBIT(fFlags,kChargeFitValid); 389 430 else 390 431 { 391 CLRBIT(fFlags,k FitValid);432 CLRBIT(fFlags,kChargeFitValid); 392 433 return kFALSE; 393 434 } … … 408 449 const Float_t chargeSquareRelErrSquare = 4.*fErrCharge*fErrCharge / chargeSquare; 409 450 410 const Float_t fFactorRelErrSquare = fFactorError * fFactorError / (fFactor * fFactor);451 const Float_t fFactorRelErrSquare = gkFFactorError * gkFFactorError / (gkFFactor * gkFFactor); 411 452 // 412 453 // Now the absolute error squares … … 415 456 const Float_t sigmaSquareErrSquare = 4.*fErrSigmaCharge*fErrSigmaCharge * sigmaSquare; 416 457 417 const Float_t elecRmsSquare = fElectronicPedRms* fElectronicPedRms;418 const Float_t elecRmsSquareErrSquare = 4.* fErrElectronicPedRms*fErrElectronicPedRms * elecRmsSquare;458 const Float_t elecRmsSquare = gkElectronicPedRms* gkElectronicPedRms; 459 const Float_t elecRmsSquareErrSquare = 4.*gkErrElectronicPedRms*gkErrElectronicPedRms * elecRmsSquare; 419 460 420 461 Float_t pedRmsSquare = fPedRms* fPedRms; … … 477 518 // (independent on Hi Gain or Lo Gain) 478 519 // 479 fPheFFactorMethod = fFactor * chargeSquare / fRSigmaSquare;520 fPheFFactorMethod = gkFFactor * chargeSquare / fRSigmaSquare; 480 521 481 522 const Float_t pheFFactorRelErrSquare = fFactorRelErrSquare … … 497 538 * fConversionFFactorMethod * fConversionFFactorMethod; 498 539 499 if ( Is FitValid()&&540 if ( IsChargeFitValid() && 500 541 (fConversionFFactorMethod > 0.) && 501 542 (fConversionErrorFFactorMethod/fConversionFFactorMethod < 0.1) ) … … 525 566 if (TMath::IsNaN(fCharge) 526 567 || TMath::IsNaN(fErrCharge) 527 || TMath::IsNaN(fErrCharge)528 568 || TMath::IsNaN(fSigmaCharge) 529 569 || TMath::IsNaN(fErrSigmaCharge) … … 543 583 equivpedestal /= fConversionHiLo; 544 584 545 if (fCharge < fChargeLimit*equivpedestal)585 if (fCharge < gkChargeLimit*equivpedestal) 546 586 { 547 587 *fLog << warn << "WARNING: Fitted Charge is smaller than " 548 << fChargeLimit << " Pedestal RMS in Pixel " << fPixId << endl;549 return kFALSE; 550 } 551 552 if (fErrCharge < fChargeErrLimit)588 << gkChargeLimit << " Pedestal RMS in Pixel " << fPixId << endl; 589 return kFALSE; 590 } 591 592 if (fErrCharge < gkChargeErrLimit) 553 593 { 554 594 *fLog << warn << "WARNING: Error of Fitted Charge is smaller than " 555 << fChargeErrLimit << " in Pixel " << fPixId << endl;556 return kFALSE; 557 } 558 559 if (fCharge < fChargeRelErrLimit*fErrCharge)595 << gkChargeErrLimit << " in Pixel " << fPixId << endl; 596 return kFALSE; 597 } 598 599 if (fCharge < gkChargeRelErrLimit*fErrCharge) 560 600 { 561 601 *fLog << warn << "WARNING: Fitted Charge is smaller than " 562 << fChargeRelErrLimit << "* its error in Pixel " << fPixId << endl; 563 return kFALSE; 564 } 565 566 if (!fHist->IsFitOK()) 567 { 568 *fLog << warn << "WARNING: Probability of Fitted Charge too low in Pixel " << fPixId << endl; 602 << gkChargeRelErrLimit << "* its error in Pixel " << fPixId << endl; 603 return kFALSE; 604 } 605 606 if (!fHist->IsChargeFitOK()) 607 { 608 *fLog << warn << "WARNING: Probability of Fitted Charge too low in Pixel " 609 << fPixId << endl; 569 610 return kFALSE; 570 611 } … … 572 613 if (fSigmaCharge < equivpedestal) 573 614 { 574 *fLog << warn << "WARNING: Sigma of Fitted Charge smaller than Pedestal RMS in Pixel " << fPixId << endl; 615 *fLog << warn << "WARNING: Sigma of Fitted Charge smaller than Pedestal RMS in Pixel " 616 << fPixId << endl; 575 617 return kFALSE; 576 618 } … … 579 621 580 622 // 581 // The check returns kTRUE if: 582 // 583 // The mean arrival time is at least 1.0 slices from the used edge slices 623 // The check return kTRUE if: 624 // 625 // 0) No value is nan 626 // 1) Pixel has a fitted rel. time smaller than 3*FADC slices 627 // 2) Pixel has a fit error greater than 0. 628 // 4) Pixel has a fit Probability greater than 0.001 629 // 5) The absolute arrival time is at least 1.0 slices from the used edge slices 584 630 // 585 631 Bool_t MCalibrationPix::CheckTimeFitValidity() 586 632 { 587 633 634 if (TMath::IsNaN(fTime) 635 || TMath::IsNaN(fErrTime) 636 || TMath::IsNaN(fSigmaTime) 637 || TMath::IsNaN(fTimeProb)) 638 { 639 *fLog << warn << "WARNING: Some of the time fit values are NAN in Pixel " 640 << fPixId << endl; 641 return kFALSE; 642 } 643 588 644 if (TESTBIT(fFlags,kExcludeQualityCheck)) 589 645 return kTRUE; 590 646 591 Float_t lowerrange; 592 Float_t upperrange; 647 if (TMath::Abs(fTime) > gkTimeLimit) 648 { 649 *fLog << warn << "WARNING: Abs(Fitted Rel. Time) is greater than " 650 << gkTimeLimit << " in Pixel " << fPixId << endl; 651 return kFALSE; 652 } 653 654 if (fErrTime > gkTimeErrLimit) 655 { 656 *fLog << warn << "WARNING: Error of Fitted Time is smaller than " 657 << gkTimeErrLimit << " in Pixel " << fPixId << endl; 658 return kFALSE; 659 } 660 661 if (!fHist->IsTimeFitOK()) 662 { 663 *fLog << warn << "WARNING: Probability of Fitted Time too low in Pixel " 664 << fPixId << endl; 665 return kFALSE; 666 } 667 668 Float_t first; 669 Float_t last; 593 670 594 671 if (TESTBIT(fFlags,kHiGainSaturation)) 595 672 { 596 lowerrange = (Float_t)fHist->GetTimeLowerFitRangeLoGain()+1.; 597 upperrange = (Float_t)fHist->GetTimeUpperFitRangeLoGain()+1.; 673 first = (Float_t)fHist->GetAbsTimeFirstLoGain(); 674 last = (Float_t)fHist->GetAbsTimeLastLoGain(); 675 676 if (first < (Float_t)fTimeFirstLoGain+1) 677 { 678 *fLog << warn 679 << "WARNING: Some absolute times smaller than limit in Pixel " 680 << fPixId << " time: " << first << " Limit: " << fTimeFirstLoGain+1 << endl; 681 return kFALSE; 682 } 683 684 if ((Float_t)fTimeLastLoGain-1 > last) 685 { 686 *fLog << warn 687 << "WARNING: Some absolute times bigger than limit in Pixel " 688 << fPixId << " time: " << last << " Limit: " << fTimeLastLoGain-1 << endl; 689 return kFALSE; 690 } 691 598 692 } 599 693 else 600 694 { 601 lowerrange = (Float_t)fHist->GetTimeLowerFitRangeHiGain()+1.; 602 upperrange = (Float_t)fHist->GetTimeUpperFitRangeHiGain()+1.; 603 } 604 605 606 if (fTime < lowerrange) 607 { 608 *fLog << warn 609 << "WARNING: Mean Fitted Time inside or smaller than first used FADC slice in Pixel " 610 << fPixId << " time: " << fTime << " Range: " << lowerrange << endl; 611 return kFALSE; 612 } 613 614 if (fTime > upperrange) 615 { 616 *fLog << warn 617 << "WARNING: Mean Fitted Time inside or greater than last used FADC slice in Pixel " 618 << fPixId << " time: " << fTime << " Range: " << upperrange << endl; 619 return kFALSE; 620 } 695 first = (Float_t)fHist->GetAbsTimeFirstHiGain(); 696 last = (Float_t)fHist->GetAbsTimeLastHiGain(); 697 698 if (first > ((Float_t)fTimeFirstHiGain+1.)) 699 { 700 *fLog << warn 701 << "WARNING: Some absolute times smaller than limit in Pixel " 702 << fPixId << " time: " << first << " Limit: " << (Float_t)fTimeFirstHiGain+1. << endl; 703 // return kFALSE; 704 } 705 706 if (((Float_t)fTimeLastHiGain-1.) > last) 707 { 708 *fLog << warn 709 << "WARNING: Some absolute times bigger than limit in Pixel " 710 << fPixId << " time: " << last << " Limit: " << (Float_t)fTimeLastHiGain-1. << endl; 711 // return kFALSE; 712 } 713 714 } 715 716 621 717 622 718 return kTRUE; … … 662 758 // 1) Fit the arrival times 663 759 // 2) Retrieve the results 664 // 3) Note that because of the low number of bins, the NDf is sometimes 0, so665 // Root does not give a reasonable Probability, the Chisquare is more significant666 760 // 667 761 // This fit has to be done AFTER the Charges fit, … … 672 766 { 673 767 674 // 675 // Fit the Low Gain 676 // 677 if (TESTBIT(fFlags,kHiGainSaturation)) 678 { 679 if(!fHist->FitTimeLoGain()) 680 { 681 *fLog << warn << "WARNING: Could not fit Lo Gain times of pixel " << fPixId << endl; 682 // fHist->PrintTimeFitResult(); 683 return kFALSE; 684 } 685 } 686 687 // 688 // Fit the High Gain 689 // 768 if(!fHist->FitTime()) 769 { 770 *fLog << warn << "WARNING: Could not fit relative times of pixel " << fPixId << endl; 771 return kFALSE; 772 } 773 774 fTime = fHist->GetRelTimeMean(); 775 fErrTime = fHist->GetRelTimeMeanErr(); 776 fSigmaTime = fHist->GetRelTimeSigma(); 777 fTimeProb = fHist->GetRelTimeProb(); 778 779 if (CheckTimeFitValidity()) 780 SETBIT(fFlags,kTimeFitValid); 690 781 else 691 { 692 if(!fHist->FitTimeHiGain()) 693 { 694 *fLog << warn << "WARNING: Could not fit Hi Gain times of pixel " << fPixId << endl; 695 // fHist->PrintTimeFitResult(); 696 return kFALSE; 697 } 698 } 699 700 fTime = fHist->GetTimeMean(); 701 fSigmaTime = fHist->GetTimeSigma(); 702 fTimeChiSquare = fHist->GetTimeChiSquare(); 703 fTimeProb = fHist->GetTimeProb(); 704 705 if (CheckTimeFitValidity()) 706 SETBIT(fFlags,kFitValid); 707 else 708 CLRBIT(fFlags,kFitValid); 782 CLRBIT(fFlags,kTimeFitValid); 709 783 710 784 return kTRUE; -
trunk/MagicSoft/Mars/mcalib/MCalibrationPix.h
r2950 r3007 12 12 private: 13 13 14 static const Float_t gkElectronicPedRms; // The pure electronic component of the RMS 15 static const Float_t gkErrElectronicPedRms; // The error of the pure electronic component of the RMS 16 static const Float_t gkFFactor; // The laboratory F-factor 17 static const Float_t gkFFactorError; // The laboratory F-factor Error 18 static const Float_t gkChargeLimit; // The limit (in units of PedRMS) for acceptance of the fitted mean charge 19 static const Float_t gkChargeErrLimit; // The limit (in units of PedRMS) for acceptance of the fitted charge sigma 20 static const Float_t gkChargeRelErrLimit; // The limit (in units of Error of fitted charge) for acceptance of the fitted mean 21 static const Float_t gkTimeLimit; // The limit (in units of FADC slices) for acceptance of the fitted time 22 static const Float_t gkTimeErrLimit; // The limit (in units of FADC slices) for acceptance of the fitted time sigma 23 14 24 Int_t fPixId; // the pixel Id 15 16 const Float_t fElectronicPedRms; // The pure electronic component of the RMS17 const Float_t fErrElectronicPedRms; // The error of the pure electronic component of the RMS18 25 19 const Float_t fFactor; // The laboratory F-factor 20 const Float_t fFactorError; // The laboratory F-factor Error 21 22 const Float_t fChargeLimit; // The limit (in units of PedRMS) for acceptance of the fitted mean charge 23 const Float_t fChargeErrLimit; // The limit (in units of PedRMS) for acceptance of the fitted charge sigma 24 const Float_t fChargeRelErrLimit; // The limit (in units of Error of fitted charge) for acceptance of the fitted mean 25 Byte_t fFlags; // Flag for the set Bits 26 UInt_t fFlags; // Flag for the set Bits 26 27 27 28 Float_t fCharge; // The mean reduced charge after the fit … … 36 37 Float_t fErrPedRms; // The error of the pedestal RMS (from MPedestalPix) 37 38 38 Float_t fTime; // The mean arrival time after the fit 39 Float_t fTime; // The mean arrival time after the fit 40 Float_t fErrTime; // The mean arrival time error after the fit 39 41 Float_t fSigmaTime; // The error of the mean arrival time after the fit 40 Float_t fTimeChiSquare; // The Chi Square of the fit function41 42 Float_t fTimeProb; // The probability of the fit function 43 44 Byte_t fTimeFirstHiGain; // The first used FADC slice 45 Byte_t fTimeLastHiGain; // The last used FADC slice 46 47 Byte_t fTimeFirstLoGain; // The first used FADC slice 48 Byte_t fTimeLastLoGain; // The last used FADC slice 42 49 43 50 Float_t fPheFFactorMethod; // The number of Phe's calculated (F-factor method) … … 61 68 enum { kHiGainSaturation, 62 69 kExcluded, kExcludeQualityCheck, 63 kFitValid, kFitted, 70 kChargeFitValid, kTimeFitValid, 71 kFitted, 64 72 kBlindPixelMethodValid, kFFactorMethodValid, kPINDiodeMethodValid }; 65 73 … … 90 98 // Times 91 99 Float_t GetTime() const { return fTime; } 100 Float_t GetErrTime() const { return fErrTime; } 92 101 Float_t GetSigmaTime() const { return fSigmaTime; } 93 Float_t GetTimeChiSquare() const { return fTimeChiSquare; }94 102 Float_t GetTimeProb() const { return fTimeProb; } 95 103 … … 118 126 119 127 Bool_t IsExcluded() const; 120 Bool_t IsFitValid() const; 128 Bool_t IsChargeFitValid() const; 129 Bool_t IsTimeFitValid() const; 121 130 Bool_t IsFitted() const; 122 131 Bool_t IsBlindPixelMethodValid() const; … … 138 147 void SetExcluded(Bool_t b = kTRUE); 139 148 void SetExcludeQualityCheck(Bool_t b = kTRUE); 140 void SetFitValid(Bool_t b = kTRUE); 149 void SetChargeFitValid(Bool_t b = kTRUE); 150 void SetTimeFitValid(Bool_t b = kTRUE); 141 151 void SetFitted(Bool_t b = kTRUE); 142 152 void SetBlindPixelMethodValid(Bool_t b = kTRUE); 143 153 void SetFFactorMethodValid(Bool_t b = kTRUE); 144 154 void SetPINDiodeMethodValid(Bool_t b = kTRUE); 155 void SetAbsTimeBordersHiGain(Byte_t f, Byte_t l); 156 void SetAbsTimeBordersLoGain(Byte_t f, Byte_t l); 145 157 146 158 // Fill histos 147 Bool_t FillChargeHiGain(Float_t q) const { return fHist->FillChargeHiGain(q); } 148 Bool_t FillTimeHiGain(Float_t t) const { return fHist->FillTimeHiGain(t); } 159 Bool_t FillChargeHiGain(Float_t q) const { return fHist->FillChargeHiGain(q); } 160 Bool_t FillAbsTimeHiGain(Float_t t) const { return fHist->FillAbsTimeHiGain(t); } 161 Bool_t FillRelTimeHiGain(Float_t t) const { return fHist->FillRelTimeHiGain(t); } 149 162 Bool_t FillRChargevsTimeHiGain(Float_t rq, Int_t t) const { return fHist->FillChargevsNHiGain(rq,t); } 150 163 151 Bool_t FillChargeLoGain(Float_t q) const { return fHist->FillChargeLoGain(q); } 152 Bool_t FillTimeLoGain(Float_t t) const { return fHist->FillTimeLoGain(t); } 164 Bool_t FillChargeLoGain(Float_t q) const { return fHist->FillChargeLoGain(q); } 165 Bool_t FillAbsTimeLoGain(Float_t t) const { return fHist->FillAbsTimeLoGain(t); } 166 Bool_t FillRelTimeLoGain(Float_t t) const { return fHist->FillRelTimeLoGain(t); } 153 167 Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t) const { return fHist->FillChargevsNLoGain(rq,t); } 154 168 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationBlindPixel.cc
r2997 r3007 79 79 80 80 const Int_t MHCalibrationBlindPixel::fgBlindPixelChargeNbins = 1000; 81 const Int_t MHCalibrationBlindPixel::fgBlindPixelTimeNbins = 32;81 const Int_t MHCalibrationBlindPixel::fgBlindPixelTimeNbins = 22; 82 82 const Int_t MHCalibrationBlindPixel::fgBlindPixelChargevsNbins = 10000; 83 const Axis_t MHCalibrationBlindPixel::fgBlindPixelTimeFirst = - 0.25;84 const Axis_t MHCalibrationBlindPixel::fgBlindPixelTimeLast = 1 5.75;83 const Axis_t MHCalibrationBlindPixel::fgBlindPixelTimeFirst = -9.00; 84 const Axis_t MHCalibrationBlindPixel::fgBlindPixelTimeLast = 12.00; 85 85 const Double_t MHCalibrationBlindPixel::fgBlindPixelElectronicAmp = 0.008; 86 86 const Double_t MHCalibrationBlindPixel::fgBlindPixelElectronicAmpError = 0.002; -
trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc
r2931 r3007 93 93 if (fChargeGausFit) 94 94 delete fChargeGausFit; 95 if (f TimeGausFit)96 delete f TimeGausFit;95 if (fRelTimeGausFit) 96 delete fRelTimeGausFit; 97 97 if (fFitLegend) 98 98 delete fFitLegend; … … 110 110 fChargeProb = -1.; 111 111 fChargeNdf = -1; 112 fTimeChisquare = -1.; 113 fTimeProb = -1.; 114 fTimeNdf = -1; 115 fTimeMean = -1.; 116 fTimeSigma = -1.; 112 fRelTimeProb = -1.; 113 fRelTimeNdf = -1; 114 fRelTimeMean = -1.; 115 fRelTimeSigma = -1.; 117 116 118 f TimeLowerFitRangeHiGain = 0;119 f TimeUpperFitRangeHiGain = 0;120 f TimeLowerFitRangeLoGain = 0;121 f TimeUpperFitRangeLoGain = 0;117 fRelTimeLowerFitRangeHiGain = -99.; 118 fRelTimeUpperFitRangeHiGain = -99.; 119 fRelTimeLowerFitRangeLoGain = -99.; 120 fRelTimeUpperFitRangeLoGain = -99.; 122 121 123 122 if (fChargeGausFit) 124 123 delete fChargeGausFit; 125 if (f TimeGausFit)126 delete f TimeGausFit;124 if (fRelTimeGausFit) 125 delete fRelTimeGausFit; 127 126 if (fFitLegend) 128 127 delete fFitLegend; -
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 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.h
r2950 r3007 18 18 private: 19 19 20 static const Int_t fChargeNbinsHiGain; 21 static const Int_t fChargeNbinsLoGain; 22 static const Int_t fAbsTimeNbins; 23 static const Int_t fRelTimeNbins; 24 static const Int_t fChargevsNbins; 25 static const Axis_t fAbsTimeFirst; 26 static const Axis_t fAbsTimeLast; 27 static const Axis_t fRelTimeFirst; 28 static const Axis_t fRelTimeLast; 29 20 30 Int_t fPixId; // Pixel Nr 21 31 … … 23 33 TArrayF *fLoGains; //-> 24 34 25 const Int_t fChargeNbinsHiGain;26 const Int_t fChargeNbinsLoGain;27 const Int_t fTimeNbins;28 const Int_t fChargevsNbins;29 30 const Axis_t fTimeFirst;31 const Axis_t fTimeLast;32 33 35 TProfile* fHivsLoGain; 34 36 … … 39 41 40 42 TH1F* fHChargeHiGain; //-> Summed FADC slices High Gain 41 TH1F* fHTimeHiGain; //-> Mean arrival time in number of FADC sice 43 TH1F* fHAbsTimeHiGain; //-> Mean arrival time in number of FADC sice 44 TH1F* fHRelTimeHiGain; //-> Mean arrival time in number of FADC sice 42 45 TH1I* fHChargevsNHiGain; //-> Summed Charge vs. Event Nr. 43 46 44 47 TH1F* fHChargeLoGain; //-> Summed FADC slices Low Gain 45 TH1F* fHTimeLoGain; //-> Mean arrival time in number of FADC sice 48 TH1F* fHAbsTimeLoGain; //-> Mean arrival time in number of FADC sice 49 TH1F* fHRelTimeLoGain; //-> Mean arrival time in number of FADC sice 46 50 TH1I* fHChargevsNLoGain; //-> Summed Charge vs. Event Nr. 47 51 … … 49 53 50 54 TF1* fChargeGausFit; 51 TF1* f TimeGausFit;55 TF1* fRelTimeGausFit; 52 56 53 57 TPaveText *fFitLegend; … … 69 73 Double_t fChargeSigmaErr; 70 74 71 Double_t fTimeChisquare; 72 Double_t fTimeProb; 73 Int_t fTimeNdf; 75 Double_t fRelTimeChisquare; 76 Double_t fRelTimeProb; 77 Int_t fRelTimeNdf; 78 Double_t fRelTimeMean; 79 Double_t fRelTimeMeanErr; 80 Double_t fRelTimeSigma; 74 81 75 Double_t fTimeMean; 76 Double_t fTimeSigma; 82 Float_t fRelTimeLowerFitRangeHiGain; 83 Float_t fRelTimeUpperFitRangeHiGain; 84 Float_t fRelTimeLowerFitRangeLoGain; 85 Float_t fRelTimeUpperFitRangeLoGain; 77 86 78 Byte_t fTimeLowerFitRangeHiGain; 79 Byte_t fTimeUpperFitRangeHiGain; 80 Byte_t fTimeLowerFitRangeLoGain; 81 Byte_t fTimeUpperFitRangeLoGain; 87 Float_t fAbsTimeFirstHiGain; 88 Float_t fAbsTimeFirstLoGain; 89 Float_t fAbsTimeLastHiGain; 90 Float_t fAbsTimeLastLoGain; 91 92 Byte_t fFlags; 82 93 83 Byte_t fFlags; 84 85 enum { kUseLoGain, kFitOK }; 94 enum { kUseLoGain, kChargeFitOK, kTimeFitOK }; 86 95 87 96 virtual void DrawLegend(); … … 98 107 99 108 // Setters 100 void SetUseLoGain(Bool_t b = kTRUE) 101 { b ? SETBIT(fFlags, kUseLoGain) : SETBIT(fFlags, kUseLoGain); } 109 void SetUseLoGain(Bool_t b = kTRUE); 110 111 // Getters 112 const Double_t GetChargeMean() const { return fChargeMean; } 113 const Double_t GetChargeMeanErr() const { return fChargeMeanErr; } 114 const Double_t GetChargeSigma() const { return fChargeSigma; } 115 const Double_t GetChargeSigmaErr() const { return fChargeSigmaErr; } 116 const Double_t GetChargeChiSquare() const { return fChargeChisquare; } 117 const Double_t GetChargeProb() const { return fChargeProb; } 118 const Int_t GetChargeNdf() const { return fChargeNdf; } 102 119 103 void SetTimeFitRangesHiGain(Byte_t low, Byte_t up) { fTimeLowerFitRangeHiGain = low,104 fTimeUpperFitRangeHiGain = up ;}105 void SetTimeFitRangesLoGain(Byte_t low, Byte_t up) { fTimeLowerFitRangeLoGain = low,106 fTimeUpperFitRangeLoGain = up; }120 const Float_t GetAbsTimeFirstHiGain() const { return fAbsTimeFirstHiGain; } 121 const Float_t GetAbsTimeFirstLoGain() const { return fAbsTimeFirstLoGain; } 122 const Float_t GetAbsTimeLastHiGain() const { return fAbsTimeLastHiGain; } 123 const Float_t GetAbsTimeLastLoGain() const { return fAbsTimeLastLoGain; } 107 124 108 // Getters 109 const Double_t GetChargeMean() const { return fChargeMean; } 110 const Double_t GetChargeMeanErr() const { return fChargeMeanErr; } 111 const Double_t GetChargeSigma() const { return fChargeSigma; } 112 const Double_t GetChargeSigmaErr() const { return fChargeSigmaErr; } 113 const Double_t GetChargeChiSquare() const { return fChargeChisquare; } 114 const Double_t GetChargeProb() const { return fChargeProb; } 115 const Int_t GetChargeNdf() const { return fChargeNdf; } 125 const Double_t GetRelTimeMean() const { return fRelTimeMean; } 126 const Double_t GetRelTimeMeanErr() const { return fRelTimeMeanErr; } 127 const Double_t GetRelTimeSigma() const { return fRelTimeSigma; } 128 const Double_t GetRelTimeChiSquare() const { return fRelTimeChisquare;} 129 const Double_t GetRelTimeProb() const { return fRelTimeProb; } 130 const Int_t GetRelTimeNdf() const { return fRelTimeNdf; } 116 131 117 const Double_t GetTimeMean() const { return fTimeMean;}118 const Double_t GetTimeSigma() const { return fTimeSigma; }132 const TH1F *GetHCharge() { return fHChargeHiGain; } 133 const TH1F *GetHCharge() const { return fHChargeHiGain; } 119 134 120 const Byte_t GetTimeLowerFitRangeHiGain() const { return fTimeLowerFitRangeHiGain; } 121 const Byte_t GetTimeUpperFitRangeHiGain() const { return fTimeUpperFitRangeHiGain; } 122 const Byte_t GetTimeLowerFitRangeLoGain() const { return fTimeLowerFitRangeLoGain; } 123 const Byte_t GetTimeUpperFitRangeLoGain() const { return fTimeUpperFitRangeLoGain; } 135 const TH1F *GetHAbsTime() { return fHAbsTimeHiGain; } 136 const TH1F *GetHAbsTime() const { return fHAbsTimeHiGain; } 124 137 125 const Double_t GetTimeChiSquare() const { return fTimeChisquare; } 126 const Double_t GetTimeProb() const { return fTimeProb; } 127 const Int_t GetTimeNdf() const { return fTimeNdf; } 138 const TH1F *GetHRelTime() { return fHRelTimeHiGain; } 139 const TH1F *GetHRelTime() const { return fHRelTimeHiGain; } 128 140 129 const TH1 F *GetHCharge() { return fHChargeHiGain;}130 const TH1 F *GetHCharge() const { return fHChargeHiGain;}141 const TH1I *GetHChargevsN() { return fHChargevsNHiGain;} 142 const TH1I *GetHChargevsN() const { return fHChargevsNHiGain;} 131 143 132 const TH1F *GetHTime() { return fHTimeHiGain; } 133 const TH1F *GetHTime() const { return fHTimeHiGain; } 134 135 const TH1I *GetHChargevsN() { return fHChargevsNHiGain; } 136 const TH1I *GetHChargevsN() const { return fHChargevsNHiGain; } 137 138 Double_t GetOffset() { return fOffset; } 139 Double_t GetSlope() { return fSlope; } 144 Double_t GetOffset() const { return fOffset; } 145 Double_t GetSlope() const { return fSlope; } 140 146 141 147 Bool_t UseLoGain(); 142 148 143 Bool_t IsFitOK() const; 144 Bool_t IsUseLoGain() const; 145 Bool_t IsEmpty() const; 149 Bool_t IsChargeFitOK() const; 150 Bool_t IsTimeFitOK() const; 151 Bool_t IsUseLoGain() const; 152 Bool_t IsEmpty() const; 146 153 147 154 // Fill histos 148 155 Bool_t FillChargeLoGain(Float_t q); 149 Bool_t FillTimeLoGain(Float_t t); 156 Bool_t FillAbsTimeLoGain(Float_t t); 157 Bool_t FillRelTimeLoGain(Float_t t); 150 158 Bool_t FillChargevsNLoGain(Float_t q, Int_t n); 151 159 152 160 Bool_t FillChargeHiGain(Float_t q); 153 Bool_t FillTimeHiGain(Float_t t); 161 Bool_t FillAbsTimeHiGain(Float_t t); 162 Bool_t FillRelTimeHiGain(Float_t t); 154 163 Bool_t FillChargevsNHiGain(Float_t q, Int_t n); 155 164 … … 161 170 // Fits 162 171 Bool_t FitCharge(Option_t *option="RQ0"); 163 164 Bool_t FitTimeHiGain(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0"); 165 Bool_t FitTimeLoGain(Axis_t rmin=0, Axis_t rmax=0, Option_t *option="RQ0"); 172 Bool_t FitTime(Option_t *option="RQ0"); 166 173 167 174 void FitHiGainvsLoGain();
Note:
See TracChangeset
for help on using the changeset viewer.