Changeset 7876 for trunk/MagicSoft/Mars
- Timestamp:
- 08/16/06 16:11:32 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7875 r7876 18 18 19 19 -*-*- END OF LINE -*-*- 20 2006/08/16 Thomas Bretz 21 22 * manalysis/MMcCalibrationUpdate.cc, 23 mhcalib/MHCalibrationRelTimeCam.cc: 24 - replaced IsLoGainUsed by IsHiGainSaturated 25 26 * mcalib/MCalibrateData.cc: 27 - changed the algorithm which takes either the hi- or the lo-gain 28 such that it gives more reliable results in case of saturation 29 and/or problems with the extraction and if no reliable 30 result is possible the pixel is set unsuitable 31 32 * mcalib/MCalibrateRelTimes.cc: 33 - removed the usage of MSignalPix::SetLoGainUsed 34 - set the pixel to unsuitable if the arrival time could not 35 be extracted 36 37 * mfilter/MFCosmics.cc, mhcalib/MHCalibrationChargeCam.cc: 38 - replaced GetNumHiGainSaturated()>0 by IsHiGainSaturated() 39 40 * mhist/MHCamera.cc: 41 - removed obsolete MMath::GaussProb from GetMedianDev 42 43 * msignal/MArrivalTimeCam.cc: 44 - replaced IsValid by IsArrivalTimeValid 45 - replaces Is[Hi,Lo]GainValid by 46 Is[Hi,Lo]GainValid && !Is[Hi,Lo]GainSaturated in 47 GetPixelContent 48 - added a check for saturation in case of getting the delay 49 - do not restrict the range of the returned delays anymore 50 51 * msignal/MArrivalTimePix.[h,cc]: 52 - improved GetArrivalTime to take the hi-gain saturation 53 better into account 54 - added a new function IsArrivalTimeValid 55 - removed obsolete function IsValid and IsLoGainUsed 56 57 * msignal/MExtractTimeAndChargeSpline.cc: 58 - added a check to not set fMaxBinContent in case the extraction 59 would happen in the first or last slice similar to the 60 digital filter. This became necessary because otherwise the 61 spline extractor sometimes extracts nonsens values 62 63 * msignal/MExtractedSignalCam.cc: 64 - replaced IsValid by more accurate functions 65 - take saturation in GetPixelContent into account 66 67 * msignal/MExtractedSignalPix.[h,cc]: 68 - removed obsolete function IsValid and IsLoGainUsed 69 - added functions Is[Hi,Lo]GainSaturated 70 71 * msignal/MSignalCam.cc: 72 - removed cases 10 and 11 in GetPixelContent 73 74 * msignal/MSignalPix.[h,cc]: 75 - removed obsolete LoGainUsed references 76 77 78 20 79 2006/08/15 Daniela Dorner 21 80 -
trunk/MagicSoft/Mars/NEWS
r7870 r7876 38 38 - callisto fixed a bug which gave weird results if hi- and lo-gain 39 39 could not be extracted properly 40 41 - callisto: improves handling of extracted signal if lo- and/or 42 hi-gain could not be extracted properly. If no appropriate 43 calibration of either the signal or the arrival time is possible 44 the pixel is now markes as unsuitable instead of estimated. 45 46 - callisto: Fixed a problem in the spline extraction which gave 47 weird results if the signal was extracted from the first (and 48 highest) slice 40 49 41 50 - callisto: Fixed a bug regarding the use of the QE which doesn't -
trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
r7188 r7876 378 378 // Fill the MCerPhotPed object 379 379 // 380 // This has to be done on an event by event basis because the (calibrated) pedestal381 // fluctuations depend on whether, for each pixel, we are using the high gain or the382 // low gain branch.380 // This has to be done on an event by event basis because the (calibrated) 381 // pedestal fluctuations depend on whether, for each pixel, we are using 382 // the high gain or the low gain branch. 383 383 // 384 384 Int_t MMcCalibrationUpdate::Process() … … 390 390 MExtractedSignalPix &sigpix = (*fSignalCam)[i]; 391 391 392 const Bool_t uselo = sigpix.IsHiGainSaturated(); 393 392 394 // 393 395 // ped mean and rms per pixel, in ADC counts, according to signal 394 396 // calculation (hi or low gain and number of integrated slices): 395 396 const Float_t pedestmean = sigpix.IsLoGainUsed()?397 // 398 const Float_t pedestmean = uselo ? 397 399 fSignalCam->GetNumUsedLoGainFADCSlices()*fHeaderFadc->GetPedestal(i) : 398 400 fSignalCam->GetNumUsedHiGainFADCSlices()*fHeaderFadc->GetPedestal(i); … … 405 407 // counts for the RMS per slice: 406 408 // 407 const Double_t used = (Double_t)(sigpix.IsLoGainUsed()?408 409 fSignalCam->GetNumUsedHiGainFADCSlices());410 411 const Float_t rms0 = sigpix.IsLoGainUsed()?409 const Double_t used = uselo ? 410 fSignalCam->GetNumUsedLoGainFADCSlices() : 411 fSignalCam->GetNumUsedHiGainFADCSlices(); 412 413 const Float_t rms0 = uselo ? 412 414 fHeaderFadc->GetPedestalRmsLow(i) : 413 415 fHeaderFadc->GetPedestalRmsHigh(i); … … 419 421 // in number of photons: 420 422 // 421 MPedPhotPix &pedpix = (*fPedPhotCam)[i]; 422 423 MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i]; 424 MCalibrationQEPix &qepix = (MCalibrationQEPix&)(*fQECam)[i]; 425 426 Float_t qe = qepix.GetAverageQE(); 427 428 429 Float_t conv = (fSignalType == MCalibrateData::kPhot? 430 calpix.GetMeanConvFADC2Phe() / qe : 431 calpix.GetMeanConvFADC2Phe()); 432 433 Float_t hi2lo = calpix.GetConversionHiLo(); 434 435 if (sigpix.IsLoGainUsed()) 436 pedpix.Set(conv*hi2lo*pedestmean, conv*hi2lo*pedestrms); 437 else 438 pedpix.Set(conv*pedestmean, conv*pedestrms); 423 const MCalibrationChargePix &calpix = (MCalibrationChargePix&)(*fCalCam)[i]; 424 const MCalibrationQEPix &qepix = (MCalibrationQEPix&)(*fQECam)[i]; 425 426 const Float_t conv = fSignalType == MCalibrateData::kPhot ? 427 calpix.GetMeanConvFADC2Phe() / qepix.GetAverageQE() : 428 calpix.GetMeanConvFADC2Phe(); 429 430 const Float_t hi2lo = uselo ? calpix.GetConversionHiLo() : 1; 431 432 (*fPedPhotCam)[i].Set(conv*hi2lo*pedestmean, conv*hi2lo*pedestrms); 439 433 440 434 } -
trunk/MagicSoft/Mars/mcalib/MCalibrateData.cc
r7829 r7876 742 742 for (UInt_t pixidx=0; pixidx<npix; pixidx++) 743 743 { 744 MBadPixelsPix &bpix = (*fBadPixels)[pixidx]; 744 745 745 if (data)746 if (data) 746 747 { 747 748 const MExtractedSignalPix &sig = (*fSignals)[pixidx]; … … 749 750 Float_t signal = 0.; 750 751 Float_t signalErr = 0.; 751 752 if (sig.IsLoGainUsed()) 752 Bool_t ok = kFALSE; 753 754 // If hi-gain is not saturated and has successfully been 755 // extracted use the hi-gain arrival time 756 if (!sig.IsHiGainSaturated() && sig.IsHiGainValid()) 753 757 { 754 if (fHiLoConv[pixidx] < 0.5) 755 { 756 signal = sig.GetExtractedSignalHiGain()*1.5; 757 signalErr = sig.GetExtractedSignalHiGain()*0.5; 758 } 759 else 760 { 761 const Float_t siglo = sig.GetExtractedSignalLoGain(); 762 763 if (siglo > 0.1) // low-gain signal has been extracted successfully 764 { 765 signal = siglo*fHiLoConv [pixidx]; 766 signalErr = siglo*fHiLoConvErr[pixidx]; 767 } 768 else // low-gain signal has not been extracted successfully, get a rough estimate from the high-gain 769 { 770 signal = sig.GetExtractedSignalHiGain()*1.5; 771 signalErr = sig.GetExtractedSignalHiGain()*0.5; 772 } 773 } 758 signal = sig.GetExtractedSignalHiGain(); 759 ok = kTRUE; 774 760 } 775 761 else 776 762 { 777 if (sig.GetExtractedSignalHiGain() <= 9999.) 778 signal = sig.GetExtractedSignalHiGain(); 763 // Use lo-gain if it can be used 764 if (sig.IsLoGainValid() && fHiLoConv[pixidx]>0.5) 765 { 766 signal = sig.GetExtractedSignalLoGain()*fHiLoConv[pixidx]; 767 signalErr = sig.GetExtractedSignalLoGain()*fHiLoConvErr[pixidx]; 768 ok = kTRUE; 769 } 779 770 } 771 772 // In this cases the signal extraction has failed. 773 if (!ok) 774 bpix.SetUnsuitable(MBadPixelsPix::kUnsuitableEvt); 780 775 781 776 const Float_t nphot = signal * fCalibConsts [pixidx]; … … 784 779 fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr); 785 780 786 if (! (*fBadPixels)[pixidx].IsUnsuitable())781 if (!bpix.IsUnsuitable()) 787 782 { 788 783 if (sig.GetNumHiGainSaturated() > 0) … … 812 807 const Float_t mean = (*pedestal)[pixidx].GetPedestal() *pedmeancalib; 813 808 const Float_t rms = (*pedestal)[pixidx].GetPedestalRms()*pedrmscalib; 814 809 815 810 (*pedphot)[pixidx].Set(mean, rms); 816 811 pedphot->SetReadyToSave(); -
trunk/MagicSoft/Mars/mcalib/MCalibrateRelTimes.cc
r7843 r7876 132 132 133 133 (*fArrivalTime)[idx].SetArrivalTime(signal-offset); 134 (*fArrivalTime)[idx].SetLoGainUsed(sig.IsLoGainUsed());135 134 136 // FIXME: This is just a workaround to set pixels to bad for which137 // the extraction of hi- and lo-gain failed, should be moved to138 // the extraction139 if ( !sig.IsLoGainValid() && !sig.IsHiGainValid())135 // FIXME: Is this necessary or explicitly done by the signal- 136 // extractor (may depend on the fact whether independent 137 // extractor are or can be used for signal and arrival time) 138 if (fBadPixels && !sig.IsArrivalTimeValid()) 140 139 (*fBadPixels)[idx].SetUnsuitable(MBadPixelsPix::kUnsuitableEvt); 141 140 } -
trunk/MagicSoft/Mars/mfilter/MFCosmics.cc
r7126 r7876 125 125 } 126 126 127 128 127 memset(fCut, 0, sizeof(fCut)); 129 128 130 129 return kTRUE; 131 130 } … … 193 192 // this case the extracted hi-gain might be empty. 194 193 // 195 if (sig. GetNumHiGainSaturated()>0)194 if (sig.IsHiGainSaturated()) 196 195 continue; 197 196 -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc
r7288 r7876 719 719 720 720 const Float_t sumhi = pix.GetExtractedSignalHiGain(); 721 const Bool_t sathi = pix. GetNumHiGainSaturated()>0;721 const Bool_t sathi = pix.IsHiGainSaturated(); 722 722 723 723 if (IsOscillations()) -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc
r7126 r7876 332 332 333 333 const MArrivalTimePix &refpix = (*arrtime)[fReferencePixel]; 334 const Float_t reftime = refpix.Is LoGainUsed()334 const Float_t reftime = refpix.IsHiGainSaturated() 335 335 ? refpix.GetArrivalTimeLoGain() : refpix.GetArrivalTimeHiGain(); 336 336 … … 347 347 const Int_t sector = (*fGeom)[i].GetSector(); 348 348 349 if (pix.Is LoGainUsed() && IsLoGain())349 if (pix.IsHiGainSaturated() && IsLoGain()) 350 350 { 351 351 const Float_t time = pix.GetArrivalTimeLoGain(); -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r7867 r7876 84 84 85 85 #include "MArrayD.h" 86 #include "MMath.h" // MMath::GaussProb87 86 88 87 #define kItemsLegend 48 // see SetPalette(1,0) … … 352 351 353 352 // return MedianDev of the profile data 354 return MMath::MedianDev(arr.GetSize(), arr.GetArray()) /MMath::GaussProb(1.0);353 return MMath::MedianDev(arr.GetSize(), arr.GetArray()); 355 354 } 356 355 -
trunk/MagicSoft/Mars/msignal/MArrivalTimeCam.cc
r7842 r7876 128 128 idx++; 129 129 130 if (!pix->Is Valid())130 if (!pix->IsArrivalTimeValid()) 131 131 continue; 132 132 … … 147 147 case 0: 148 148 val = pix.GetArrivalTimeHiGain(); 149 return pix.IsHiGainValid() ;149 return pix.IsHiGainValid() && !pix.IsHiGainSaturated(); 150 150 151 151 case 1: … … 155 155 case 2: 156 156 val = pix.GetArrivalTimeLoGain(); 157 return pix.IsLoGainValid() ;157 return pix.IsLoGainValid() && !pix.IsLoGainSaturated(); 158 158 159 159 case 3: … … 164 164 case 6: 165 165 val = pix.GetArrivalTime(); 166 return pix.Is Valid();166 return pix.IsArrivalTimeValid(); 167 167 168 168 // This is for the case the signal has been 169 169 // extracted from lo- and hi-gain 170 170 case 7: 171 // Lo- and hi-gain must be successfully extracted 171 172 if (!pix.IsLoGainValid() || !pix.IsHiGainValid()) 173 return kFALSE; 174 175 // Lo- and hi-gain must not be saturated 176 if (pix.IsLoGainSaturated() || pix.IsHiGainSaturated()) 172 177 return kFALSE; 173 178 174 179 val = pix.GetArrivalTimeLoGain()-pix.GetArrivalTimeHiGain(); 175 180 176 if (pix.GetArrivalTimeHiGain()<3 || pix.GetArrivalTimeHiGain()>12 ||177 pix.GetArrivalTimeLoGain()<3 || pix.GetArrivalTimeLoGain()>12)178 return kFALSE;181 // if (pix.GetArrivalTimeHiGain()<3 || pix.GetArrivalTimeHiGain()>12 || 182 // pix.GetArrivalTimeLoGain()<3 || pix.GetArrivalTimeLoGain()>12) 183 // return kFALSE; 179 184 180 185 val = pix.GetArrivalTimeLoGain()-pix.GetArrivalTimeHiGain(); -
trunk/MagicSoft/Mars/msignal/MArrivalTimePix.cc
r7810 r7876 90 90 } 91 91 92 Bool_t MArrivalTimePix::IsValid() const92 Float_t MArrivalTimePix::GetArrivalTime() const 93 93 { 94 return (!IsLoGainUsed() && fArrivalTimeHiGainError >= 0) || (IsLoGainUsed() && fArrivalTimeLoGainError >= 0); 94 // If hi-gain is not saturated and has successfully been 95 // extracted use the hi-gain arrival time 96 if (!IsHiGainSaturated() && IsHiGainValid()) 97 return GetArrivalTimeHiGain(); 98 99 // If hi-gain could not be used ans the lo-gain could 100 // not be extracted return 101 if (!IsLoGainValid()) 102 return 0; 103 104 // in all other cases use the lo-gain arrival time 105 return GetArrivalTimeLoGain(); 106 } 107 108 Bool_t MArrivalTimePix::IsArrivalTimeValid() const 109 { 110 // If hi-gain is not saturated and has successfully been 111 // extracted use the hi-gain arrival time 112 if (!IsHiGainSaturated() && IsHiGainValid()) 113 return kTRUE; 114 115 // If hi-gain could not be used ans the lo-gain could 116 // not be extracted return kFALSE (no valid arrival time) 117 if (!IsLoGainValid()) 118 return kFALSE; 119 120 // in all other cases use the lo-gain arrival time 121 return kTRUE; 95 122 } 96 123 -
trunk/MagicSoft/Mars/msignal/MArrivalTimePix.h
r7843 r7876 47 47 Float_t GetArrivalTimeLoGainError() const { return fArrivalTimeLoGainError; } 48 48 49 Float_t GetArrivalTime() const { return IsLoGainUsed() ? fArrivalTimeLoGain : fArrivalTimeHiGain; } 49 Float_t GetArrivalTime() const; 50 Bool_t IsArrivalTimeValid() const; 50 51 51 52 Byte_t GetNumHiGainSaturated() const { return fNumHiGainSaturated; } 52 53 Byte_t GetNumLoGainSaturated() const { return fNumLoGainSaturated; } 53 54 54 Bool_t IsLoGainUsed() const { return fNumHiGainSaturated > 0; } 55 Bool_t IsLoGainValid() const { return fArrivalTimeLoGainError>=0 && fNumLoGainSaturated==0; } 56 Bool_t IsHiGainValid() const { return fArrivalTimeHiGainError>=0 && fNumHiGainSaturated==0; } 57 Bool_t IsValid() const; 55 Bool_t IsHiGainSaturated() const { return fNumHiGainSaturated>0; } 56 Bool_t IsLoGainSaturated() const { return fNumLoGainSaturated>0; } 57 58 Bool_t IsLoGainValid() const { return fArrivalTimeLoGainError>=0; } 59 Bool_t IsHiGainValid() const { return fArrivalTimeHiGainError>=0; } 58 60 59 61 ClassDef(MArrivalTimePix, 1) // Storage Container for ArrivalTime information of one pixel -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc
r7844 r7876 399 399 { 400 400 maxpos = ids-fHiGainFirst-1; 401 fMaxBinContent = *p; 401 // range-fWindowSizeHiGain+1 == fHiLoLast isn't it? 402 if (maxpos > 1 && maxpos < (range - fWindowSizeHiGain + 1)) 403 fMaxBinContent = *p; 402 404 } 403 405 … … 420 422 if (*logain > fMaxBinContent) 421 423 { 422 maxpos = ids-fHiGainFirst-1; 423 fMaxBinContent = *logain; 424 maxpos = ids-fHiGainFirst-1; 425 // range-fWindowSizeHiGain+1 == fHiLoLast isn't it? 426 //if (maxpos > 1 && maxpos < (range - fWindowSizeHiGain + 1)) 427 // fMaxBinContent = *logain; 424 428 } 425 429 … … 1088 1092 // between every two FADC slices, instead of numerically 1089 1093 } 1094 1090 1095 sum *= step; // Transform sum in integral 1091 1096 return sum; … … 1105 1110 1106 1111 // The order is important. In some cases (limlo-/limup-check) it can 1107 // happen tha nmax<0. In this case we start at 01112 // happen that max<0. In this case we start at 0 1108 1113 if (start > max) 1109 1114 start = max; -
trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.cc
r7864 r7876 144 144 idx++; 145 145 146 if (!pix->Is Valid())146 if (!pix->IsLoGainValid() && ! pix->IsHiGainValid()) 147 147 continue; 148 148 … … 163 163 case 0: 164 164 val = pix.GetExtractedSignalHiGain(); 165 return pix.IsHiGainValid() ;165 return pix.IsHiGainValid() && !pix.IsHiGainSaturated(); 166 166 167 167 case 1: … … 171 171 case 2: 172 172 val = pix.GetExtractedSignalLoGain(); 173 return pix.IsLoGainValid() ;173 return pix.IsLoGainValid() && !pix.IsLoGainSaturated(); 174 174 175 175 case 3: … … 180 180 // extracted from lo- and hi-gain 181 181 case 4: 182 // Lo- and hi-gain must be successfully extracted 182 183 if (!pix.IsLoGainValid() || !pix.IsHiGainValid()) 183 184 return kFALSE; 184 185 186 // Lo- and hi-gain must not be saturated 187 if (pix.IsLoGainSaturated() || pix.IsHiGainSaturated()) 188 return kFALSE; 189 190 // Both signals must have a positive value 185 191 if (pix.GetExtractedSignalLoGain()<=0 || pix.GetExtractedSignalHiGain()<=0) 186 192 return kFALSE; -
trunk/MagicSoft/Mars/msignal/MExtractedSignalPix.cc
r7829 r7876 47 47 48 48 static const Float_t gkSignalInitializer = -99999.9; 49 49 50 // ------------------------------------------------------------------------ 50 51 // … … 95 96 } 96 97 97 Bool_t MExtractedSignalPix::IsValid() const98 {99 return (!IsLoGainUsed() && fExtractedSignalHiGainError >= 0) || (IsLoGainUsed() && fExtractedSignalLoGainError >= 0);100 }101 102 98 void MExtractedSignalPix::SetGainSaturation(Byte_t higain, Byte_t logain) 103 99 { -
trunk/MagicSoft/Mars/msignal/MExtractedSignalPix.h
r7842 r7876 39 39 Byte_t GetNumLoGainSaturated() const { return fNumLoGainSaturated; } 40 40 41 Bool_t IsLoGainUsed() const { return fNumHiGainSaturated>0; } 42 Bool_t IsLoGainValid() const { return fExtractedSignalLoGainError>=0 && fNumLoGainSaturated==0; } 43 Bool_t IsHiGainValid() const { return fExtractedSignalHiGainError>=0 && fNumHiGainSaturated==0; } 44 Bool_t IsValid() const; 41 Bool_t IsHiGainSaturated() const { return fNumHiGainSaturated>0; } 42 Bool_t IsLoGainSaturated() const { return fNumLoGainSaturated>0; } 43 44 Bool_t IsLoGainValid() const { return fExtractedSignalLoGainError>=0; } 45 Bool_t IsHiGainValid() const { return fExtractedSignalHiGainError>=0; } 45 46 46 47 ClassDef(MExtractedSignalPix, 3) // Storage Container for Extracted Signal information of one pixel -
trunk/MagicSoft/Mars/msignal/MSignalCam.cc
r7832 r7876 656 656 break; 657 657 658 /* 658 659 case 10: // lo gain time 659 660 if (pix->IsPixelUnmapped() || !pix->IsLoGainUsed() || … … 672 673 val = pix->GetArrivalTime(); 673 674 return kTRUE; 675 */ 674 676 675 677 default: -
trunk/MagicSoft/Mars/msignal/MSignalPix.cc
r7829 r7876 93 93 fPhot = 0; 94 94 fErrPhot = 0; 95 fLoGainUsed = kFALSE;96 95 } 97 96 -
trunk/MagicSoft/Mars/msignal/MSignalPix.h
r7829 r7876 20 20 Float_t fArrivalTime; // Calibrated Arrival Time 21 21 22 Bool_t fLoGainUsed; //! Is lo gain used23 24 22 public: 25 23 MSignalPix(Float_t phot=0, Float_t errphot=0); … … 34 32 pix.fPhot = fPhot; 35 33 pix.fErrPhot = fErrPhot; 36 pix.fLoGainUsed = fLoGainUsed;37 34 } 38 35 … … 60 57 void SetArrivalTime(Float_t tm) { MMath::ReducePrecision(tm); fArrivalTime = tm; } 61 58 62 void SetLoGainUsed(Bool_t b=kTRUE) { fLoGainUsed=b; }63 Bool_t IsLoGainUsed() const { return fLoGainUsed; }64 65 59 void AddNumPhotons(Float_t f) { fPhot += f; } 66 60 void Scale(Float_t f) { fPhot /= f; }
Note:
See TracChangeset
for help on using the changeset viewer.