Changeset 4884 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 09/07/04 13:42:42 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc
r4816 r4884 135 135 136 136 #include "MRawEvtData.h" 137 #include "MRawRunHeader.h" 137 138 #include "MRawEvtPixelIter.h" 138 139 … … 302 303 const Int_t nareas = fGeom->GetNumAreas(); 303 304 305 const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain(); 306 const Int_t logainsamples = fRunHeader->GetNumSamplesLoGain(); 307 304 308 if (fHiGainArray->GetEntries()==0) 305 309 { … … 308 312 { 309 313 (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix; 314 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)[i]; 315 pix.SetAbsTimeNbins(higainsamples); 316 pix.SetAbsTimeLast(higainsamples-0.5); 310 317 InitHists((*this)[i],(*fBadPixels)[i],i); 311 318 } … … 313 320 } 314 321 315 if (fLoGainArray->GetEntries()==0 )316 {322 if (fLoGainArray->GetEntries()==0 && fLoGain) 323 { 317 324 fLoGainArray->Expand(npixels); 318 325 319 326 for (Int_t i=0; i<npixels; i++) 320 {321 327 { 328 (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix; 322 329 MHGausEvents &lopix = (*this)(i); 323 330 // … … 334 341 } 335 342 } 343 ((MHCalibrationChargePix&)(*this)(i)).SetAbsTimeNbins(logainsamples); 344 ((MHCalibrationChargePix&)(*this)(i)).SetAbsTimeLast(logainsamples-0.5); 336 345 InitHists(lopix,(*fBadPixels)[i],i); 337 346 } … … 370 379 371 380 372 if (fAverageLoGainAreas->GetEntries()==0 )381 if (fAverageLoGainAreas->GetEntries()==0 && fLoGain) 373 382 { 374 383 fAverageLoGainAreas->Expand(nareas); … … 436 445 } 437 446 438 if (fAverageLoGainSectors->GetEntries()==0 )447 if (fAverageLoGainSectors->GetEntries()==0 && fLoGain) 439 448 { 440 449 fAverageLoGainSectors->Expand(nsectors); … … 532 541 fSumloarea .Reset(); 533 542 fTimehiarea .Reset(); 534 fTimeloarea 543 fTimeloarea .Reset(); 535 544 fSumhisector.Reset(); 536 545 fSumlosector.Reset(); … … 547 556 548 557 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i]; 549 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);550 558 551 559 if (histhi.IsExcluded()) … … 554 562 const MExtractedSignalPix &pix = (*signal)[i]; 555 563 556 const Float_t sumhi 557 const Float_t sumlo = pix.GetExtractedSignalLoGain();564 const Float_t sumhi = pix.GetExtractedSignalHiGain(); 565 const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated(); 558 566 559 567 if (!histhi.FillHistAndArray(sumhi)) 560 568 fHiGainOverFlow[i]++; 561 569 562 if (!histlo.FillHistAndArray(sumlo))563 fLoGainOverFlow[i]++;564 565 const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated();566 const Int_t satlo = (Int_t)pix.GetNumLoGainSaturated();567 568 570 histhi.SetSaturated(sathi); 569 histlo.SetSaturated(satlo);570 571 571 572 const Int_t aidx = (*fGeom)[i].GetAidx(); … … 573 574 574 575 fSumhiarea[aidx] += sumhi; 575 fSumloarea[aidx] += sumlo;576 576 fSathiarea[aidx] += sathi; 577 fSatloarea[aidx] += satlo;578 577 579 578 fSumhisector[sector] += sumhi; 580 fSumlosector[sector] += sumlo;581 579 fSathisector[sector] += sathi; 582 fSatlosector[sector] += satlo; 580 581 if (fLoGain) 582 { 583 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i); 584 const Float_t sumlo = pix.GetExtractedSignalLoGain(); 585 const Int_t satlo = (Int_t)pix.GetNumLoGainSaturated(); 586 587 if (!histlo.FillHistAndArray(sumlo)) 588 fLoGainOverFlow[i]++; 589 590 histlo.SetSaturated(satlo); 591 592 fSumloarea[aidx] += sumlo; 593 fSatloarea[aidx] += satlo; 594 fSumlosector[sector] += sumlo; 595 fSatlosector[sector] += satlo; 596 } 597 583 598 } 584 599 … … 590 605 591 606 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[pixid]; 592 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(pixid);593 607 594 608 if (histhi.IsExcluded()) … … 596 610 597 611 const Float_t timehi = (Float_t)pixel.GetIdxMaxHiGainSample(); 598 const Float_t timelo = (Float_t)pixel.GetIdxMaxLoGainSample(lofirst);599 612 600 613 histhi.FillAbsTime(timehi); 601 histlo.FillAbsTime(timelo);602 614 603 615 const Int_t aidx = (*fGeom)[pixid].GetAidx(); 604 616 const Int_t sector = (*fGeom)[pixid].GetSector(); 605 617 606 fTimehiarea[aidx] += timehi; 607 fTimeloarea[aidx] += timelo; 608 618 fTimehiarea [aidx] += timehi; 609 619 fTimehisector[sector] += timehi; 610 fTimelosector[sector] += timelo; 620 621 if (fLoGain) 622 { 623 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(pixid); 624 625 const Float_t timelo = (Float_t)pixel.GetIdxMaxLoGainSample(lofirst); 626 histlo.FillAbsTime(timelo); 627 628 fTimeloarea[aidx] += timelo; 629 fTimelosector[sector] += timelo; 630 } 611 631 } 612 632 … … 620 640 621 641 MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(j); 622 MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 623 624 hipix.FillHistAndArray(fSumhiarea[j]/npix); 625 lopix.FillHistAndArray(fSumloarea[j]/npix); 626 627 hipix.SetSaturated(fSathiarea[j]/npix); 628 lopix.SetSaturated(fSatloarea[j]/npix); 629 630 hipix.FillAbsTime(fTimehiarea[j]/npix); 631 lopix.FillAbsTime(fTimeloarea[j]/npix); 632 642 643 hipix.FillHistAndArray(fSumhiarea [j]/npix); 644 hipix.SetSaturated (fSathiarea [j]/npix); 645 hipix.FillAbsTime (fTimehiarea[j]/npix); 646 647 if (fLoGain) 648 { 649 MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 650 lopix.FillHistAndArray(fSumloarea [j]/npix); 651 lopix.SetSaturated (fSatloarea [j]/npix); 652 lopix.FillAbsTime (fTimeloarea[j]/npix); 653 } 633 654 } 634 655 … … 642 663 643 664 MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainSector(j); 644 MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 645 646 hipix.FillHistAndArray(fSumhisector[j]/npix); 647 lopix.FillHistAndArray(fSumlosector[j]/npix); 648 649 hipix.SetSaturated(fSathisector[j]/npix); 650 lopix.SetSaturated(fSatlosector[j]/npix); 651 652 hipix.FillAbsTime(fTimehisector[j]/npix); 653 lopix.FillAbsTime(fTimelosector[j]/npix); 654 665 666 hipix.FillHistAndArray(fSumhisector [j]/npix); 667 hipix.SetSaturated (fSathisector [j]/npix); 668 hipix.FillAbsTime (fTimehisector[j]/npix); 669 670 if (fLoGain) 671 { 672 MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 673 lopix.FillHistAndArray(fSumlosector [j]/npix); 674 lopix.SetSaturated (fSatlosector [j]/npix); 675 lopix.FillAbsTime (fTimelosector[j]/npix); 676 } 655 677 } 656 678 … … 708 730 } 709 731 710 for (Int_t i=0; i<fLoGainArray->GetSize(); i++) 711 { 712 713 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i); 714 MBadPixelsPix &bad = (*fBadPixels)[i]; 715 716 if (histlo.IsExcluded()) 717 continue; 718 719 if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries()) 720 { 721 *fLog << warn << "Saturated Lo Gain histogram in pixel: " << i << endl; 722 bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 723 histlo.CreateFourierSpectrum(); 732 if (fLoGain) 733 for (Int_t i=0; i<fLoGainArray->GetSize(); i++) 734 { 735 736 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i); 737 MBadPixelsPix &bad = (*fBadPixels)[i]; 738 739 if (histlo.IsExcluded()) 724 740 continue; 725 } 726 727 if (fLoGainOverFlow[i]) 728 { 729 *fLog << warn << GetDescriptor() 730 << ": Lo-Gain Histogram Overflow occurred " << fLoGainOverFlow[i] 731 << " times in pixel: " << i << " (without saturation!) " << endl; 732 bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow ); 733 } 734 735 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 736 737 if (pix.IsHiGainSaturation()) 738 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 739 } 740 741 742 if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries()) 743 { 744 *fLog << warn << "Saturated Lo Gain histogram in pixel: " << i << endl; 745 bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 746 histlo.CreateFourierSpectrum(); 747 continue; 748 } 749 750 if (fLoGainOverFlow[i] > 1) 751 { 752 *fLog << warn << GetDescriptor() 753 << ": Lo-Gain Histogram Overflow occurred " << fLoGainOverFlow[i] 754 << " times in pixel: " << i << " (without saturation!) " << endl; 755 bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow ); 756 } 757 758 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 759 760 if (pix.IsHiGainSaturation()) 761 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 762 } 763 741 764 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) 742 765 { … … 756 779 } 757 780 758 for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++) 759 { 760 761 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 762 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageArea(j); 763 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 764 765 if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries()) 766 { 767 *fLog << warn << "Saturated Lo Gain histogram in area idx: " << j << endl; 768 histlo.CreateFourierSpectrum(); 769 continue; 770 } 771 772 if (pix.IsHiGainSaturation()) 773 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 774 } 775 781 if (fLoGain) 782 for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++) 783 { 784 785 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 786 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageArea(j); 787 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 788 789 if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries()) 790 { 791 *fLog << warn << "Saturated Lo Gain histogram in area idx: " << j << endl; 792 histlo.CreateFourierSpectrum(); 793 continue; 794 } 795 796 if (pix.IsHiGainSaturation()) 797 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 798 } 799 776 800 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++) 777 801 { … … 791 815 } 792 816 793 for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++) 794 { 795 796 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 797 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(j); 798 MBadPixelsPix &bad = fCam->GetAverageBadSector(j); 799 800 if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries()) 801 { 802 *fLog << warn << "Saturated Lo Gain histogram in sector: " << j << endl; 803 bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 804 histlo.CreateFourierSpectrum(); 805 continue; 806 } 807 808 if (pix.IsHiGainSaturation()) 809 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 810 } 817 if (fLoGain) 818 for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++) 819 { 820 821 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 822 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(j); 823 MBadPixelsPix &bad = fCam->GetAverageBadSector(j); 824 825 if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries()) 826 { 827 *fLog << warn << "Saturated Lo Gain histogram in sector: " << j << endl; 828 bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation ); 829 histlo.CreateFourierSpectrum(); 830 continue; 831 } 832 833 if (pix.IsHiGainSaturation()) 834 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 835 } 811 836 812 837 // … … 819 844 // Perform the fitting for the Low Gain (done in MHCalibrationCam) 820 845 // 821 FitLoGainArrays((MCalibrationCam&)(*fCam),(*fBadPixels), 822 MBadPixelsPix::kLoGainNotFitted, 823 MBadPixelsPix::kLoGainOscillating); 846 if (fLoGain) 847 FitLoGainArrays((MCalibrationCam&)(*fCam),(*fBadPixels), 848 MBadPixelsPix::kLoGainNotFitted, 849 MBadPixelsPix::kLoGainOscillating); 824 850 825 851 return kTRUE; … … 963 989 964 990 MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(i); 965 MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(i);966 991 // 967 992 // Ask for Hi-Gain saturation 968 993 // 969 if (hipix.GetSaturated() > fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries()) 970 DrawDataCheckPixel(lopix,i ? gkLoGainOuterRefLines : gkLoGainInnerRefLines); 994 if (hipix.GetSaturated() > fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries() && fLoGain) 995 { 996 MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(i); 997 DrawDataCheckPixel(lopix,i ? gkLoGainOuterRefLines : gkLoGainInnerRefLines); 998 } 971 999 else 972 1000 DrawDataCheckPixel(hipix,i ? gkHiGainOuterRefLines : gkHiGainInnerRefLines); … … 1039 1067 1040 1068 gPad->SetTicks(); 1041 if (!pix.IsEmpty() && !pix.IsOnlyOverflow() )1069 if (!pix.IsEmpty() && !pix.IsOnlyOverflow() && !pix.IsOnlyUnderflow()) 1042 1070 gPad->SetLogy(); 1043 1071 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePix.cc
r4636 r4884 266 266 } 267 267 */ 268 if (!IsEmpty() && !IsOnlyOverflow() )269 268 if (!IsEmpty() && !IsOnlyOverflow() && !IsOnlyUnderflow()) 269 gPad->SetLogy(); 270 270 271 271 gPad->SetTicks();
Note:
See TracChangeset
for help on using the changeset viewer.