Changeset 3264 for trunk/MagicSoft/Mars
- Timestamp:
- 02/23/04 06:02:14 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3263 r3264 41 41 * mcalib/MCalibrationChargeCalc.[h,cc] 42 42 * mcalib/MCalibrationChargeCam.[h,cc] 43 * mcalib/MCalibrationChargePix.[h,cc] 43 44 * mcalib/MCalibrationChargePINDiode.[h,cc] 44 45 * mcalib/MCalibrationCalc.[h,cc] -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3247 r3264 16 16 ! 17 17 ! 18 ! Author(s): Markus Gaug 0 9/2003<mailto:markus@ifae.es>18 ! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 31 31 // MExtractedSignalCam. The pedestals by an MPedestalCam. 32 32 // 33 // The output container MCalibrationCam holds one entry of type MCalibration Pix33 // The output container MCalibrationCam holds one entry of type MCalibrationChargePix 34 34 // for every pixel. It is filled in the following way: 35 35 // … … 39 39 // 40 40 // ReInit: MCalibrationCam::InitSize(NumPixels) is called which allocates 41 // memory in a TClonesArray of type MCalibration Pix41 // memory in a TClonesArray of type MCalibrationChargePix 42 42 // Initialize number of used FADC slices 43 43 // Optionally exclude pixels from calibration 44 44 // 45 // Process: Every MCalibration Pix holds a histogram class,45 // Process: Every MCalibrationChargePix holds a histogram class, 46 46 // MHCalibrationPixel which itself hold histograms of type: 47 47 // HCharge(npix) (distribution of summed FADC time slice … … 97 97 #include "MCalibrationChargeCam.h" 98 98 #include "MCalibrationChargePINDiode.h" 99 #include "MCalibration Pix.h"99 #include "MCalibrationChargePix.h" 100 100 101 101 #include "MExtractedSignalCam.h" … … 142 142 SETBIT(fFlags, kUseQualityChecks); 143 143 SETBIT(fFlags, kHiLoGainCalibration); 144 145 CLRBIT(fFlags, kHiGainOverFlow);146 CLRBIT(fFlags, kLoGainOverFlow);147 144 148 145 fNumBlindPixelSinglePhe = 0; … … 270 267 { 271 268 272 MCalibration Pix &pix = (*fCam)[i];269 MCalibrationChargePix &pix = (*fCam)[i]; 273 270 pix.DefinePixId(i); 274 271 … … 278 275 fSignals->GetLastUsedSliceLoGain()); 279 276 280 if (!TESTBIT(fFlags,kUseQualityChecks))281 pix.SetExcludeQualityCheck();282 277 283 278 // Exclude the blind pixel and the PIN Diode from normal pixel calibration: … … 330 325 // Exclude pixel 331 326 // 332 MCalibration Pix &pix = (*fCam)[pixel];327 MCalibrationChargePix &pix = (*fCam)[pixel]; 333 328 pix.SetExcluded(); 334 329 … … 412 407 hist->Fill(i,*ptr++); 413 408 414 pixel.Reset();415 416 while (pixel.Next())417 {418 419 const UInt_t pixid = pixel.GetPixelId();420 421 MCalibrationPix &pix = (*fCam)[pixid];422 MExtractedSignalPix &sig = (*fSignals) [pixid];423 424 const Float_t sumhi = sig.GetExtractedSignalHiGain();425 const Float_t sumlo = sig.GetExtractedSignalLoGain();426 427 Float_t abstime = 0.;428 429 if (sig.IsLoGainUsed())430 abstime = (Float_t)pixel.GetIdxMaxLoGainSample();431 else432 abstime = (Float_t)pixel.GetIdxMaxHiGainSample();433 434 if (pix.IsExcluded())435 continue;436 437 pix.FillGraphs(sumhi,sumlo);438 439 if (sig.IsLoGainUsed())440 {441 442 if (!pix.FillChargeLoGain(sumlo))443 *fLog << warn << "Could not fill Lo Gain Charge of pixel: " << pixid444 << " signal = " << sumlo << endl;445 446 if (!pix.FillAbsTimeLoGain(abstime))447 *fLog << warn << "Could not fill Lo Gain Abs. Time of pixel: "448 << pixid << " time = " << abstime << endl;449 }450 else451 {452 if (!pix.FillChargeHiGain(sumhi))453 *fLog << warn << "Could not fill Hi Gain Charge of pixel: " << pixid454 << " signal = " << sumhi << endl;455 456 if (!pix.FillAbsTimeHiGain(abstime))457 *fLog << warn << "Could not fill Hi Gain Abs. Time of pixel: "458 << pixid << " time = " << abstime << endl;459 }460 461 } /* while (pixel.Next()) */462 463 409 return kTRUE; 464 410 } … … 467 413 { 468 414 *fLog << inf << GetDescriptor() << ": Cut Histogram Edges" << endl; 469 470 //471 // Cut edges to make fits and viewing of the hists easier472 //473 fCam->CutEdges();474 415 475 416 // … … 550 491 { 551 492 552 MCalibration Pix &pix = (*fCam)[pixid];493 MCalibrationChargePix &pix = (*fCam)[pixid]; 553 494 554 495 // … … 563 504 const Float_t ped = (*fPedestals)[pixid].GetPedestal(); 564 505 const Float_t prms = (*fPedestals)[pixid].GetPedestalRms(); 506 const Int_t num = fPedestals->GetTotalEntries(); 565 507 566 508 // 567 509 // set them in the calibration camera 568 510 // 569 pix.SetPedestal(ped,prms,(Float_t)fNumHiGainSamples,(Float_t)fNumLoGainSamples); 570 571 // 572 // perform the Gauss fits to the charges 573 // 574 pix.FitCharge(); 575 576 // 577 // check also for oscillations 578 // 579 pix.CheckOscillations(); 580 581 // 582 // calculate the F-Factor method 583 // 511 if (pix.IsHiGainSaturation()) 512 { 513 pix.SetPedestal(ped * (Float_t)fNumLoGainSamples, 514 prms * TMath::Sqrt((Float_t)fNumLoGainSamples), 515 prms * (Float_t)fNumLoGainSamples / num); 516 pix.SetNumLoGainSamples((Float_t)fNumLoGainSamples); 517 pix.ApplyLoGainConversion(); 518 } 519 else 520 { 521 pix.SetPedestal(ped * (Float_t)fNumHiGainSamples, 522 prms * TMath::Sqrt((Float_t)fNumHiGainSamples), 523 prms * (Float_t)fNumHiGainSamples / num); 524 } 525 526 if (!pix.CheckChargeValidity() || !pix.CheckTimeValidity()) 527 continue; 528 529 if (!pix.CalcReducedSigma()) 530 continue; 531 584 532 pix.CalcFFactorMethod(); 533 585 534 } 586 535 … … 597 546 *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Calibration! " << endl; 598 547 599 if (!fPINDiode->C alcFluxOutsidePlexiglass())548 if (!fPINDiode->CheckChargeFitValidity() || !fPINDiode->CheckTimeFitValidity()) 600 549 { 601 *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, will skip PIN Diode Calibration" << endl;550 *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, charge fit not valid " << endl; 602 551 fCam->SetPINDiodeMethodValid(kFALSE); 603 552 } 604 553 else 605 { 606 fCam->SetPINDiodeMethodValid(kTRUE); 554 { 555 if (!fPINDiode->CalcFluxOutsidePlexiglass()) 556 { 557 *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, will skip PIN Diode Calibration " << endl; 558 fCam->SetPINDiodeMethodValid(kFALSE); 559 } 560 else 561 { 562 fCam->SetPINDiodeMethodValid(kTRUE); 563 } 607 564 } 608 609 565 fCam->SetReadyToSave(); 610 566 … … 613 569 614 570 571 572 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r3247 r3264 67 67 enum { kUseBlindPixelFit, 68 68 kUseQualityChecks, 69 kHiLoGainCalibration, 70 kHiGainOverFlow, 71 kLoGainOverFlow }; 69 kHiLoGainCalibration }; 72 70 71 Int_t PreProcess(MParList *pList); 73 72 Bool_t ReInit(MParList *pList); 74 Int_t PreProcess(MParList *pList); 75 Int_t Process(); 76 Int_t PostProcess(); 73 Int_t Process(); 74 Int_t PostProcess(); 77 75 78 76 public: … … 91 89 92 90 // Setters 93 void SetConversionHiLo ( const Float_t conv ) { fConversionHiLo = conv; }94 91 void SetBlindPixelSinglePheCut ( const Int_t cut=fgBlindPixelSinglePheCut) 95 92 { fBlindPixelSinglePheCut = cut; } -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc
r3247 r3264 126 126 #include "MGeomPix.h" 127 127 128 #include "MCalibration Pix.h"128 #include "MCalibrationChargePix.h" 129 129 #include "MCalibrationBlindPix.h" 130 130 #include "MCalibrationChargePINDiode.h" 131 131 132 #include "MHCalibrationPixel.h"133 132 134 133 ClassImp(MCalibrationChargeCam); … … 174 173 fTitle = title ? title : "Storage container for the Calibration Information in the camera"; 175 174 176 fPixels = new TClonesArray("MCalibration Pix",1);175 fPixels = new TClonesArray("MCalibrationChargePix",1); 177 176 fBlindPixel = new MCalibrationBlindPix(); 178 177 … … 252 251 // Get i-th pixel (pixel number) 253 252 // 254 MCalibration Pix &MCalibrationChargeCam::operator[](UInt_t i)255 { 256 return *static_cast<MCalibration Pix*>(fPixels->UncheckedAt(i));253 MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i) 254 { 255 return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i)); 257 256 } 258 257 … … 261 260 // Get i-th pixel (pixel number) 262 261 // 263 const MCalibration Pix &MCalibrationChargeCam::operator[](UInt_t i) const264 { 265 return *static_cast<MCalibration Pix*>(fPixels->UncheckedAt(i));262 const MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i) const 263 { 264 return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i)); 266 265 } 267 266 … … 329 328 330 329 TIter Next(fPixels); 331 MCalibration Pix *pix;332 while ((pix=(MCalibration Pix*)Next()))330 MCalibrationChargePix *pix; 331 while ((pix=(MCalibrationChargePix*)Next())) 333 332 { 334 333 335 if (pix->IsChargeValid() && !pix->IsExcluded() && !pix->IsOscillating() && pix->IsFitted())334 if (pix->IsChargeValid() && !pix->IsExcluded() && !pix->IsOscillating()) 336 335 { 337 336 338 337 *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " 339 << pix->GetPedRms() << " Reduced Charge: " << pix->Get Charge() << " +- "338 << pix->GetPedRms() << " Reduced Charge: " << pix->GetMeanCharge() << " +- " 340 339 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() 341 340 << " Nr Phe's: " << pix->GetPheFFactorMethod() << endl; … … 352 351 353 352 TIter Next2(fPixels); 354 while ((pix=(MCalibration Pix*)Next2()))353 while ((pix=(MCalibrationChargePix*)Next2())) 355 354 { 356 355 357 if (!pix->Is ChargeValid() && !pix->IsExcluded() && !pix->IsFitted())356 if (!pix->IsExcluded() && !pix->IsChargeValid()) 358 357 { 359 358 360 359 *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " 361 << pix->GetPedRms() << " Reduced Charge: " << pix->GetCharge() << " +- "360 << pix->GetPedRms() << " Reduced Charge: " << pix->GetMeanCharge() << " +- " 362 361 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() << endl; 363 362 id++; … … 373 372 374 373 TIter Next3(fPixels); 375 while ((pix=(MCalibration Pix*)Next3()))374 while ((pix=(MCalibrationChargePix*)Next3())) 376 375 { 377 378 if ( pix->IsOscillating()&& !pix->IsExcluded())376 377 if ( pix->IsOscillating() && !pix->IsExcluded()) 379 378 { 380 379 381 380 *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " 382 << pix->GetPedRms() << " Reduced Charge: " << pix->Get Charge() << " +- "381 << pix->GetPedRms() << " Reduced Charge: " << pix->GetMeanCharge() << " +- " 383 382 << pix->GetSigmaCharge() << " Reduced Sigma: " << pix->GetRSigmaCharge() << endl; 384 383 id++; … … 392 391 *fLog << all << endl; 393 392 393 id = 0; 394 394 395 TIter Next4(fPixels); 395 while ((pix=(MCalibrationPix*)Next4())) 396 if (pix->IsExcluded()) 397 *fLog << all << pix->GetPixId() << endl; 398 399 *fLog << all << fNumExcludedPixels << " excluded pixels " << endl; 400 } 401 402 // -------------------------------------------------------------------------- 403 // 404 // Return true if pixel is inside bounds of the TClonesArray fPixels 405 // 406 Bool_t MCalibrationChargeCam::IsPixelUsed(Int_t idx) const 407 { 408 if (!CheckBounds(idx)) 409 return kFALSE; 410 411 return kTRUE; 412 } 413 414 // -------------------------------------------------------------------------- 415 // 416 // Return true if pixel has already been fitted once (independent of the result) 417 // 418 Bool_t MCalibrationChargeCam::IsPixelFitted(Int_t idx) const 419 { 420 421 if (!CheckBounds(idx)) 422 return kFALSE; 423 424 return (*this)[idx].IsFitted(); 425 } 396 while ((pix=(MCalibrationChargePix*)Next4())) 397 { 398 if (pix->IsExcluded()) 399 { 400 *fLog << all << pix->GetPixId() << endl; 401 id++; 402 } 403 } 404 *fLog << all << id << " Excluded pixels " << endl; 405 } 406 426 407 427 408 // -------------------------------------------------------------------------- … … 435 416 436 417 fBlindPixel->GetHist()->CutAllEdges(); 437 438 TIter Next(fPixels);439 MCalibrationPix *pix;440 while ((pix=(MCalibrationPix*)Next()))441 {442 pix->GetHist()->CutAllEdges();443 }444 418 445 419 return; … … 495 469 // 28: Pixels where the fit did not succeed --> results obtained only from the histograms 496 470 // 29: Pixels with succeeded fit, but apparently wrong results 497 // 30: Pixels with un-expected behavior in the fourier spectrum (e.g. oscillations) 471 // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations) 472 // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a 473 // 32: Number of probable pickup events in the Hi Gain 474 // 33: Number of probable pickup events in the Lo Gain 498 475 // 499 476 // Other classifications of pixels: 500 477 // ================================ 501 478 // 502 // 3 1: Pixels with saturated Hi-Gain479 // 34: Pixels with saturated Hi-Gain 503 480 // 504 481 // Classification of validity of the calibrations: 505 482 // =============================================== 506 483 // 507 // 3 2: Pixels with valid calibration by the F-Factor-Method508 // 3 3: Pixels with valid calibration by the Blind Pixel-Method509 // 3 4: Pixels with valid calibration by the PIN Diode-Method484 // 35: Pixels with valid calibration by the F-Factor-Method 485 // 36: Pixels with valid calibration by the Blind Pixel-Method 486 // 37: Pixels with valid calibration by the PIN Diode-Method 510 487 // 511 488 // Used Pedestals: 512 489 // =============== 513 490 // 514 // 3 5: Mean Pedestal over the entire range of signal extraction515 // 3 6: Error on the Mean Pedestal over the entire range of signal extraction516 // 37: Pedestal RMS over the entire range of signal extraction517 // 38: Error on the Pedestal RMS over the entire range of signal extraction491 // 38: Mean Pedestal over the entire range of signal extraction 492 // 39: Error on the Mean Pedestal over the entire range of signal extraction 493 // 40: Pedestal RMS over the entire range of signal extraction 494 // 41: Error on the Pedestal RMS over the entire range of signal extraction 518 495 // 519 496 // Calculated absolute arrival times (very low precision!): 520 497 // ======================================================== 521 498 // 522 // 39: Absolute Arrival time of the signal 523 // 40: Error on the Absolute Arrival time of the signal 524 // 41: RMS of the Absolute Arrival time of the signal 525 // 42: Error on the RMS of the Absolute Arrival time of the signal 499 // 42: Absolute Arrival time of the signal 500 // 43: RMS of the Absolute Arrival time of the signal 526 501 // 527 502 Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const … … 541 516 if ((*this)[idx].IsExcluded()) 542 517 return kFALSE; 543 val = (*this)[idx].Get Charge();518 val = (*this)[idx].GetMeanCharge(); 544 519 break; 545 520 case 1: 546 521 if ((*this)[idx].IsExcluded()) 547 522 return kFALSE; 548 val = (*this)[idx].Get ChargeErr();523 val = (*this)[idx].GetMeanChargeErr(); 549 524 break; 550 525 case 2: … … 576 551 if ((*this)[idx].IsExcluded()) 577 552 return kFALSE; 578 val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].Get Charge();553 val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge(); 579 554 break; 580 555 case 8: … … 585 560 / ((*this)[idx].GetRSigmaCharge() * (*this)[idx].GetRSigmaCharge() ); 586 561 // relative error Charge square 587 val += (*this)[idx].Get ChargeErr() * (*this)[idx].GetChargeErr()588 / ((*this)[idx].Get Charge() * (*this)[idx].GetCharge() );562 val += (*this)[idx].GetMeanChargeErr() * (*this)[idx].GetMeanChargeErr() 563 / ((*this)[idx].GetMeanCharge() * (*this)[idx].GetMeanCharge() ); 589 564 // calculate relative error out of squares 590 565 val = TMath::Sqrt(val) ; 591 566 // multiply with value to get absolute error 592 val *= (*this)[idx].GetRSigmaCharge() / (*this)[idx].Get Charge();567 val *= (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge(); 593 568 break; 594 569 case 9: … … 709 684 if ((*this)[idx].IsExcluded()) 710 685 return kFALSE; 711 if ((*this)[idx].Is Oscillating())686 if ((*this)[idx].IsHiGainOscillating()) 712 687 val = 1; 713 688 else … … 715 690 break; 716 691 case 31: 692 if ((*this)[idx].IsExcluded()) 693 return kFALSE; 694 if ((*this)[idx].IsLoGainOscillating()) 695 val = 1; 696 else 697 return kFALSE; 698 break; 699 case 32: 700 if ((*this)[idx].IsExcluded()) 701 return kFALSE; 702 val = (*this)[idx].GetHiGainNumPickup(); 703 break; 704 case 33: 705 if ((*this)[idx].IsExcluded()) 706 return kFALSE; 707 val = (*this)[idx].GetLoGainNumPickup(); 708 break; 709 case 34: 717 710 if ((*this)[idx].IsExcluded()) 718 711 return kFALSE; … … 722 715 return kFALSE; 723 716 break; 724 case 3 2:717 case 35: 725 718 if ((*this)[idx].IsExcluded()) 726 719 return kFALSE; … … 730 723 return kFALSE; 731 724 break; 732 case 3 3:725 case 36: 733 726 if ((*this)[idx].IsExcluded()) 734 727 return kFALSE; … … 738 731 return kFALSE; 739 732 break; 740 case 3 4:733 case 37: 741 734 if ((*this)[idx].IsExcluded()) 742 735 return kFALSE; … … 746 739 return kFALSE; 747 740 break; 748 case 3 5:741 case 38: 749 742 if ((*this)[idx].IsExcluded()) 750 743 return kFALSE; 751 744 val = (*this)[idx].GetPed(); 752 745 break; 753 case 36: 754 if ((*this)[idx].IsExcluded()) 755 return kFALSE; 756 val = 1.; 757 // val = (*this)[idx].GetPedError(); 758 break; 759 case 37: 746 case 39: 747 if ((*this)[idx].IsExcluded()) 748 return kFALSE; 749 val = (*this)[idx].GetPedErr(); 750 break; 751 case 40: 760 752 if ((*this)[idx].IsExcluded()) 761 753 return kFALSE; 762 754 val = (*this)[idx].GetPedRms(); 763 755 break; 764 case 38: 765 if ((*this)[idx].IsExcluded()) 766 return kFALSE; 767 val = 1.; 768 // val = (*this)[idx].GetPedRmsError(); 769 break; 770 case 39: 756 case 41: 757 if ((*this)[idx].IsExcluded()) 758 return kFALSE; 759 val = (*this)[idx].GetPedErr()/2.; 760 break; 761 case 42: 771 762 if ((*this)[idx].IsExcluded()) 772 763 return kFALSE; 773 764 val = (*this)[idx].GetAbsTimeMean(); 774 765 break; 775 case 40: 776 if ((*this)[idx].IsExcluded()) 777 return kFALSE; 778 val = (*this)[idx].GetAbsTimeMeanErr(); 779 break; 780 case 41: 766 case 43: 781 767 if ((*this)[idx].IsExcluded()) 782 768 return kFALSE; 783 769 val = (*this)[idx].GetAbsTimeRms(); 784 break;785 case 42:786 if ((*this)[idx].IsExcluded())787 return kFALSE;788 val = (*this)[idx].GetAbsTimeMeanErr()/TMath::Sqrt(2.);789 770 break; 790 771 default: … … 893 874 894 875 TIter Next(fPixels); 895 MCalibration Pix *pix;896 while ((pix=(MCalibration Pix*)Next()))876 MCalibrationChargePix *pix; 877 while ((pix=(MCalibrationChargePix*)Next())) 897 878 { 898 879 … … 902 883 const Int_t idx = pix->GetPixId(); 903 884 904 const Float_t charge = pix->Get Charge();885 const Float_t charge = pix->GetMeanCharge(); 905 886 const Float_t area = (*fGeomCam)[idx].GetA(); 906 const Float_t chargeerr = pix->Get ChargeErr();887 const Float_t chargeerr = pix->GetMeanChargeErr(); 907 888 908 889 const Float_t nphot = fMeanFluxInsidePlexiglass*area; … … 937 918 938 919 TIter Next(fPixels); 939 MCalibration Pix *pix;940 while ((pix=(MCalibration Pix*)Next()))920 MCalibrationChargePix *pix; 921 while ((pix=(MCalibrationChargePix*)Next())) 941 922 { 942 923 … … 946 927 const Int_t idx = pix->GetPixId(); 947 928 948 const Float_t charge = pix->Get Charge();929 const Float_t charge = pix->GetMeanCharge(); 949 930 const Float_t area = (*fGeomCam)[idx].GetA(); 950 const Float_t chargeerr = pix->Get ChargeErr();931 const Float_t chargeerr = pix->GetMeanChargeErr(); 951 932 952 933 const Float_t nphot = flux * area; … … 980 961 { 981 962 982 if (ipx < 0 || !IsPixelFitted(ipx))983 return kFALSE;984 963 985 964 if (!IsFluxInsidePlexiglassAvailable()) … … 997 976 Bool_t MCalibrationChargeCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) 998 977 { 999 1000 if (ipx < 0 || !IsPixelFitted(ipx))1001 return kFALSE;1002 978 1003 979 Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod(); … … 1024 1000 Bool_t MCalibrationChargeCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) 1025 1001 { 1026 1027 if (ipx < 0 || !IsPixelFitted(ipx))1028 return kFALSE;1029 1002 1030 1003 mean = (*this)[ipx].GetMeanConversionPINDiodeMethod(); … … 1048 1021 Bool_t MCalibrationChargeCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) 1049 1022 { 1050 1051 if (ipx < 0 || !IsPixelFitted(ipx))1052 return kFALSE;1053 1054 1023 return kFALSE; 1055 1024 -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.h
r3247 r3264 13 13 class TClonesArray; 14 14 15 class MCalibrationPix;16 15 class MCalibrationBlindPix; 17 16 class MCalibrationChargePINDiode; 17 class MCalibrationChargePix; 18 18 class MCalibrationChargeCam : public MParContainer, public MCamEvent 19 19 { … … 103 103 Bool_t GetConversionFactorCombined( Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma ); 104 104 105 Bool_t IsPixelUsed(Int_t idx) const;106 Bool_t IsPixelFitted(Int_t idx) const;107 108 105 Bool_t IsBlindPixelMethodValid() const; 109 106 Bool_t IsPINDiodeMethodValid() const; … … 112 109 113 110 // Others 114 MCalibration Pix &operator[](UInt_t i);115 const MCalibration Pix &operator[](UInt_t i) const;111 MCalibrationChargePix &operator[](UInt_t i); 112 const MCalibrationChargePix &operator[](UInt_t i) const; 116 113 117 114 void CutEdges(); -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargePINDiode.h
r3247 r3264 80 80 kFluxOutsidePlexiglassAvailable }; 81 81 82 Bool_t CheckChargeFitValidity();83 Bool_t CheckTimeFitValidity();84 85 82 public: 86 83 … … 91 88 92 89 // Setters 93 void SetColor( const PulserColor_t color ) 90 void SetColor( const PulserColor_t color ) { fColor = color; } 94 91 95 92 void SetMeanCharge ( const Float_t f ) { fMeanCharge = f; } … … 146 143 Bool_t IsMeanTimeInLastBin() const; 147 144 145 Bool_t CheckChargeFitValidity(); 146 Bool_t CheckTimeFitValidity(); 148 147 Bool_t CalcFluxOutsidePlexiglass(); 149 148 … … 153 152 #endif /* MARS_MCalibrationChargePINDiode */ 154 153 154 155 156 157 158 159 160 161 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeHiGainPix.cc
r3257 r3264 49 49 using namespace std; 50 50 51 const Int_t MHCalibrationChargeHiGainPix::fgChargeNbins = 200 ;51 const Int_t MHCalibrationChargeHiGainPix::fgChargeNbins = 2000; 52 52 const Axis_t MHCalibrationChargeHiGainPix::fgChargeFirst = -0.5; 53 const Axis_t MHCalibrationChargeHiGainPix::fgChargeLast = 199 .5;54 const Int_t MHCalibrationChargeHiGainPix::fgAbsTimeNbins = 30;53 const Axis_t MHCalibrationChargeHiGainPix::fgChargeLast = 1999.5; 54 const Int_t MHCalibrationChargeHiGainPix::fgAbsTimeNbins = 20; 55 55 const Axis_t MHCalibrationChargeHiGainPix::fgAbsTimeFirst = -0.5; 56 const Axis_t MHCalibrationChargeHiGainPix::fgAbsTimeLast = 29.5;56 const Axis_t MHCalibrationChargeHiGainPix::fgAbsTimeLast = 19.5; 57 57 // -------------------------------------------------------------------------- 58 58 // … … 60 60 // 61 61 MHCalibrationChargeHiGainPix::MHCalibrationChargeHiGainPix(const char *name, const char *title) 62 : fPix(NULL)63 62 { 64 63 65 64 fName = name ? name : "MHCalibrationChargeHiGainPix"; 66 fTitle = title ? title : "Fill the FADC sums of the HiGainPix events and perform the fits ";65 fTitle = title ? title : "Fill the FADC sums of the HiGainPix events and perform the fits Pixel "; 67 66 68 67 SetChargeNbins(); … … 73 72 SetAbsTimeFirst(); 74 73 SetAbsTimeLast(); 75 76 74 } 77 75 … … 97 95 98 96 97 void MHCalibrationChargeHiGainPix::ChangeHistId(Int_t id) 98 { 99 100 fPixId = id; 101 102 fHGausHist.SetName(Form("%s%d", fHGausHist.GetName(), id)); 103 fHGausHist.SetTitle(Form("%s%d", fHGausHist.GetTitle(), id)); 104 105 fHAbsTime.SetName(Form("%s%d", fHAbsTime.GetName(), id)); 106 fHAbsTime.SetTitle(Form("%s%d", fHAbsTime.GetTitle(), id)); 107 108 fName = Form("%s%d", fName.Data(), id); 109 fTitle = Form("%s%d", fTitle.Data(), id); 110 } 111 112 113 void MHCalibrationChargeHiGainPix::Draw(const Option_t *opt) 114 { 115 116 TString option(opt); 117 option.ToLower(); 118 119 Int_t win = 1; 120 121 TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this,600, 600); 122 123 pad->SetTicks(); 124 pad->SetBorderMode(0); 125 126 127 pad->Divide(1,win); 128 pad->cd(1); 129 130 if (!IsEmpty()) 131 pad->SetLogy(); 132 133 MHGausEvents::Draw(opt); 134 135 } 99 136 100 137 101 138 102 103 104 105 106 107 108 109 110 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeHiGainPix.h
r3257 r3264 7 7 #endif 8 8 9 class MCalibrationChargePix;9 class TH1F; 10 10 class MHCalibrationChargeHiGainPix : public MHCalibrationChargePix 11 11 { 12 12 private: 13 14 MCalibrationChargePix *fPix; //! Storage container of the results15 13 16 14 static const Int_t fgChargeNbins; … … 38 36 void SetAbsTimeLast (const Axis_t last =fgAbsTimeLast) { fAbsTimeLast = last; } 39 37 40 void SetPix (MCalibrationChargePix *pix ) { fPix = pix; } 38 void ChangeHistId(Int_t i); 39 40 // Draw 41 void Draw(Option_t *opt=""); 41 42 42 43 ClassDef(MHCalibrationChargeHiGainPix, 1) // Histogram class for a Calibration Pixel with extracted Hi Gain … … 47 48 48 49 50 51 52 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeLoGainPix.cc
r3257 r3264 52 52 const Axis_t MHCalibrationChargeLoGainPix::fgChargeFirst = -0.5; 53 53 const Axis_t MHCalibrationChargeLoGainPix::fgChargeLast = 199.5; 54 const Int_t MHCalibrationChargeLoGainPix::fgAbsTimeNbins = 30;54 const Int_t MHCalibrationChargeLoGainPix::fgAbsTimeNbins = 15; 55 55 const Axis_t MHCalibrationChargeLoGainPix::fgAbsTimeFirst = -0.5; 56 const Axis_t MHCalibrationChargeLoGainPix::fgAbsTimeLast = 29.5;56 const Axis_t MHCalibrationChargeLoGainPix::fgAbsTimeLast = 14.5; 57 57 // -------------------------------------------------------------------------- 58 58 // … … 60 60 // 61 61 MHCalibrationChargeLoGainPix::MHCalibrationChargeLoGainPix(const char *name, const char *title) 62 : fPix(NULL)63 62 { 64 65 63 fName = name ? name : "MHCalibrationChargeLoGainPix"; 66 fTitle = title ? title : "Fill the FADC sums of the Low Gain events and perform the fits ";64 fTitle = title ? title : "Fill the FADC sums of the Low Gain events and perform the fits Pixel "; 67 65 68 66 SetChargeNbins(); … … 73 71 SetAbsTimeFirst(); 74 72 SetAbsTimeLast(); 75 76 73 } 77 74 … … 98 95 99 96 97 void MHCalibrationChargeLoGainPix::ChangeHistId(Int_t id) 98 { 99 100 fPixId = id; 101 102 fHGausHist.SetName(Form("%s%d", fHGausHist.GetName(), id)); 103 fHGausHist.SetTitle(Form("%s%d", fHGausHist.GetTitle(), id)); 104 105 fHAbsTime.SetName(Form("%s%d", fHAbsTime.GetName(), id)); 106 fHAbsTime.SetTitle(Form("%s%d", fHAbsTime.GetTitle(), id)); 107 108 fName = Form("%s%d", fName.Data(), id); 109 fTitle = Form("%s%d", fTitle.Data(), id); 110 } 100 111 101 112 113 114 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeLoGainPix.h
r3257 r3264 7 7 #endif 8 8 9 class MCalibrationChargePix;10 9 class MHCalibrationChargeLoGainPix : public MHCalibrationChargePix 11 10 { 12 11 private: 13 14 MCalibrationChargePix *fPix; //! Storage container of the results15 12 16 13 static const Int_t fgChargeNbins; … … 38 35 void SetAbsTimeLast (const Axis_t last =fgAbsTimeLast) { fAbsTimeLast = last; } 39 36 40 void SetPix (MCalibrationChargePix *pix ) { fPix = pix; }37 void ChangeHistId(Int_t i); 41 38 42 39 ClassDef(MHCalibrationChargeLoGainPix, 1) // Histogram class for a Calibration Pixel with extracted Low Gain … … 47 44 48 45 46 47 48 49 50 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc
r3256 r3264 22 22 ! 23 23 \* ======================================================================== */ 24 25 24 ////////////////////////////////////////////////////////////////////////////// 26 25 // … … 58 57 const Axis_t MHCalibrationChargePix::fgAbsTimeLast = 14.5; 59 58 59 const Float_t MHCalibrationChargePix::fgPickupLimit = 5.; 60 60 const Int_t MHCalibrationChargePix::fgPulserFrequency = 200; 61 61 // -------------------------------------------------------------------------- … … 77 77 SetAbsTimeFirst(); 78 78 SetAbsTimeLast(); 79 80 SetPickupLimit(); 79 81 80 82 fHAbsTime.UseCurrentStyle(); … … 104 106 } 105 107 106 107 108 108 109 void MHCalibrationChargePix::Clear(Option_t *o) 109 110 { 110 111 111 fPixId = -1; 112 fPixId = -1; 113 fSaturated = 0; 114 fPickup = 0.; 112 115 113 116 MHGausEvents::Clear(); … … 174 177 175 178 if (option.Contains("time")) 176 win++; 179 { 180 option.ReplaceAll("events",""); 181 win++; 182 } 177 183 178 184 pad->SetTicks(); … … 193 199 } 194 200 201 Bool_t MHCalibrationChargePix::RepeatFit(const Option_t *option) 202 { 203 204 // 205 // Get new fitting ranges 206 // 207 Axis_t rmin = GetMean() - fPickupLimit * GetSigma(); 208 Axis_t rmax = GetMean() + fPickupLimit * GetSigma(); 209 210 GetFGausFit()->SetRange(rmin,rmax); 211 212 GetHGausHist()->Fit(GetFGausFit(),option); 213 214 SetMean ( GetFGausFit()->GetParameter(1) ); 215 SetMeanErr ( GetFGausFit()->GetParameter(2) ); 216 SetSigma ( GetFGausFit()->GetParError(1) ); 217 SetSigmaErr ( GetFGausFit()->GetParError(2) ); 218 SetProb ( GetFGausFit()->GetProb() ); 219 220 // 221 // The fit result is accepted under condition: 222 // 1) The results are not nan's 223 // 2) The NDF is not smaller than fNDFLimit (5) 224 // 3) The Probability is greater than fProbLimit (default 0.001 == 99.9%) 225 // 226 if ( TMath::IsNaN ( GetMean() ) 227 || TMath::IsNaN ( GetMeanErr() ) 228 || TMath::IsNaN ( GetProb() ) 229 || TMath::IsNaN ( GetSigma() ) 230 || TMath::IsNaN ( GetSigmaErr() ) 231 || GetFGausFit()->GetNDF() < fNDFLimit 232 || GetProb() < fProbLimit ) 233 return kFALSE; 234 235 SetGausFitOK(kTRUE); 236 return kTRUE; 237 238 } 239 195 240 void MHCalibrationChargePix::BypassFit() 196 241 { … … 200 245 // with the fit, we take the histogram values 201 246 // 202 SetMean(fHGausHist.GetMean()); 203 SetMeanErr(fHGausHist.GetRMS()/fHGausHist.GetEntries()); 204 SetSigma(fHGausHist.GetRMS()); 205 SetSigmaErr(fHGausHist.GetRMS()/fHGausHist.GetEntries()/2.); 206 } 207 247 SetMean ( fHGausHist.GetMean() ); 248 SetMeanErr ( fHGausHist.GetRMS() / fHGausHist.GetEntries() ); 249 SetSigma ( fHGausHist.GetRMS() ); 250 SetSigmaErr ( fHGausHist.GetRMS() / fHGausHist.GetEntries() / 2. ); 251 } 252 253 void MHCalibrationChargePix::CountPickup() 254 { 255 fPickup = GetHGausHist()->Integral(GetHGausHist()->GetXaxis()->FindBin(GetMean()+fPickupLimit*GetSigma()), 256 GetHGausHist()->GetXaxis()->GetLast(), 257 "width"); 258 } 259 260 261 262 263 264 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.h
r3260 r3264 20 20 static const Axis_t fgAbsTimeLast; 21 21 22 static const Float_t fgPickupLimit; 23 22 24 protected: 23 25 … … 36 38 Axis_t fAbsTimeLast; 37 39 38 Bool_t fSaturated; 40 Float_t fPickupLimit; // The limit in number of sigmas from the fitted mean above which events are considered as pickup 41 42 Int_t fSaturated; 43 Float_t fPickup; 39 44 40 45 public: … … 46 51 virtual void Reset(); 47 52 virtual void Init(); 53 virtual void ChangeHistId(Int_t i); 48 54 49 55 // Setters … … 56 62 virtual void SetAbsTimeLast( const Axis_t last =fgAbsTimeLast) { fAbsTimeLast = last; } 57 63 64 virtual void SetPickupLimit( const Float_t lim =fgPickupLimit) { fPickupLimit = lim; } 65 58 66 void SetPulserFrequency(Float_t f=fgPulserFrequency); 59 67 60 void SetSaturated( const Bool_t b) { fSaturated = b; }68 void SetSaturated (const Int_t i) { fSaturated += i; } 61 69 62 70 // Getters … … 69 77 const Float_t GetAbsTimeRms() const; 70 78 71 const Bool_t IsSaturated() const { return fSaturated; } 79 const Int_t GetSaturated() const { return fSaturated; } 80 const Float_t GetPickup() const { return fPickup; } 72 81 73 void ChangeHistId(Int_t i);74 75 82 // Fill histos 76 83 Bool_t FillAbsTime(const Float_t t); 77 84 78 85 // Fits 79 void BypassFit(); 86 void BypassFit(); 87 Bool_t RepeatFit(const Option_t *option="RQ0"); 80 88 81 89 // Draws 82 90 virtual void Draw(Option_t *opt=""); 83 91 92 // Miscelleaneous 93 void CountPickup(); 94 84 95 ClassDef(MHCalibrationChargePix, 1) // Base class for charge calibrated pixel 85 96 }; -
trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc
r3198 r3264 91 91 using namespace std; 92 92 93 const Float_t MHGausEvents::fgProbLimit = 0.0 1;93 const Float_t MHGausEvents::fgProbLimit = 0.005; 94 94 const Int_t MHGausEvents::fgNDFLimit = 2; 95 const Int_t MHGausEvents::fgPowerProbabilityBins = 2 5;96 const Int_t MHGausEvents::fgBinsAfterStripping = 25;95 const Int_t MHGausEvents::fgPowerProbabilityBins = 20; 96 const Int_t MHGausEvents::fgBinsAfterStripping = 40; 97 97 // -------------------------------------------------------------------------- 98 98 // … … 423 423 const Stat_t entries = fHGausHist.Integral("width"); 424 424 const Double_t mu_guess = fHGausHist.GetBinCenter(fHGausHist.GetMaximumBin()); 425 const Double_t sigma_guess = (rmax-rmin)/2.;425 const Double_t sigma_guess = fHGausHist.GetRMS(); 426 426 const Double_t area_guess = entries/TMath::Sqrt(TMath::TwoPi())/sigma_guess; 427 427 … … 436 436 fFGausFit->SetParameters(area_guess,mu_guess,sigma_guess); 437 437 fFGausFit->SetParNames("Area","#mu","#sigma"); 438 fFGausFit->SetParLimits(0,0., entries);438 fFGausFit->SetParLimits(0,0.,area_guess*1.5); 439 439 fFGausFit->SetParLimits(1,rmin,rmax); 440 440 fFGausFit->SetParLimits(2,0.,rmax-rmin); … … 442 442 443 443 fHGausHist.Fit(fFGausFit,option); 444 444 445 445 446 fMean = fFGausFit->GetParameter(1); 446 447 fSigma = fFGausFit->GetParameter(2); 447 448 fMeanErr = fFGausFit->GetParError(1); 448 449 fSigmaErr = fFGausFit->GetParError(2); 449 450 450 fProb = fFGausFit->GetProb(); 451 451 // … … 455 455 // 3) The Probability is greater than fProbLimit (default 0.001 == 99.9%) 456 456 // 457 if ( 457 if ( TMath::IsNaN(fMean) 458 458 || TMath::IsNaN(fMeanErr) 459 459 || TMath::IsNaN(fProb) … … 578 578 579 579 if (!IsEmpty()) 580 pad->SetLogy();580 gPad->SetLogy(); 581 581 582 582 fHGausHist.Draw(opt); … … 587 587 fFGausFit->Draw("same"); 588 588 } 589 590 589 switch (win) 591 590 { -
trunk/MagicSoft/Mars/mcalib/MHGausEvents.h
r3263 r3264 25 25 const static Int_t fgBinsAfterStripping; // Default number of bins for the Gauss Histogram after stripping off the zeros at both end 26 26 27 Float_t fProbLimit; // Probability limit for judgement if fit is OK28 Int_t fNDFLimit; // NDF limit for judgement if fit is OK29 27 Int_t fPowerProbabilityBins; // number of bins for the projected power spectrum 30 28 Int_t fBinsAfterStripping; // number of bins for the Gauss Histogram after stripping off the zeros at both end … … 59 57 TArrayF fEvents; // Array which holds the entries of GausHist 60 58 59 Float_t fProbLimit; // Probability limit for judgement if fit is OK 60 Int_t fNDFLimit; // NDF limit for judgement if fit is OK 61 61 62 // Setters 62 void SetPowerProbabilityBins (const Int_t nbins=fgPowerProbabilityBins) {fPowerProbabilityBins = nbins; }63 void SetBinsAfterStripping (const Int_t nbins=fgBinsAfterStripping) { fBinsAfterStripping= nbins; }63 void SetPowerProbabilityBins ( const Int_t nbins=fgPowerProbabilityBins ) { fPowerProbabilityBins = nbins; } 64 void SetBinsAfterStripping ( const Int_t nbins=fgBinsAfterStripping ) { fBinsAfterStripping = nbins; } 64 65 65 66 void DrawEvents(); // Draw a graph of the array fEvents … … 77 78 void SetEventFrequency(const Float_t f=0) { fEventFrequency = f; } 78 79 79 void SetMean (const Double_t d ) { fMean = d; }80 void SetMeanErr (const Double_t d ) { fMeanErr = d; }81 void SetSigma (const Double_t d ) { fSigma = d; }80 void SetMean ( const Double_t d ) { fMean = d; } 81 void SetMeanErr ( const Double_t d ) { fMeanErr = d; } 82 void SetSigma ( const Double_t d ) { fSigma = d; } 82 83 void SetSigmaErr( const Double_t d ) { fSigmaErr = d; } 84 void SetProb ( const Double_t d ) { fProb = d; } 83 85 84 86 void SetProbLimit( const Float_t lim=fgProbLimit ) { fProbLimit = lim; }
Note:
See TracChangeset
for help on using the changeset viewer.