Changeset 3446 for trunk/MagicSoft/Mars/msignal
- Timestamp:
- 03/09/04 19:24:09 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractSignal.cc
r3397 r3446 109 109 return kFALSE; 110 110 111 fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1, 112 fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1 );111 fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1, (Float_t)fNumHiGainSamples, 112 fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1, (Float_t)fNumLoGainSamples); 113 113 114 114 fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam")); -
trunk/MagicSoft/Mars/msignal/MExtractSignal2.cc
r3397 r3446 77 77 } 78 78 79 void MExtractSignal2::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast, Byte_t windowsize)79 void MExtractSignal2::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t windowh, Byte_t lofirst, Byte_t lolast, Byte_t windowl) 80 80 { 81 81 … … 86 86 fLoGainFirst = lofirst; 87 87 88 89 fWindowSize = windowsize & ~1; 90 91 if (fWindowSize != windowsize) 92 *fLog << warn << "MExtractSignal2::SetRange - window size has to be even, set to: " << int(fWindowSize) << " samples " << endl; 88 fWindowSizeHiGain = windowh & ~1; 89 fWindowSizeLoGain = windowl & ~1; 90 91 if (fWindowSizeHiGain != windowh) 92 *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size has to be even, set to: " 93 << int(fWindowSizeHiGain) << " samples " << endl; 93 94 94 if (fWindowSize<2) 95 { 96 fWindowSize = 2; 97 *fLog << warn << "MExtractSignal2::SetRange - window size set to two samples" << endl; 98 } 99 100 if (fWindowSize > fNumHiGainSamples) 101 { 102 fWindowSize = fNumLoGainSamples & ~1; 103 *fLog << warn << "MExtractSignal2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl; 104 } 95 if (fWindowSizeLoGain != windowl) 96 *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size has to be even, set to: " 97 << int(fWindowSizeLoGain) << " samples " << endl; 105 98 106 if (fWindowSize > fNumLoGainSamples) 107 { 108 fWindowSize = fNumLoGainSamples & ~1; 109 *fLog << warn << "MExtractSignal2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl; 110 } 111 112 fWindowSizeSqrt = TMath::Sqrt((Float_t)fWindowSize); 99 if (fWindowSizeHiGain<2) 100 { 101 fWindowSizeHiGain = 2; 102 *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size set to two samples" << endl; 103 } 104 105 if (fWindowSizeLoGain<2) 106 { 107 fWindowSizeLoGain = 2; 108 *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size set to two samples" << endl; 109 } 110 111 if (fWindowSizeHiGain > fNumHiGainSamples) 112 { 113 fWindowSizeHiGain = fNumHiGainSamples & ~1; 114 *fLog << warn << "MExtractSignal2::SetRange - Hi Gain window size set to " 115 << int(fWindowSizeHiGain) << " samples " << endl; 116 } 117 118 if (fWindowSizeLoGain > fNumLoGainSamples) 119 { 120 fWindowSizeLoGain = fNumLoGainSamples & ~1; 121 *fLog << warn << "MExtractSignal2::SetRange - Lo Gain window size set to " 122 << int(fWindowSizeLoGain) << " samples " << endl; 123 } 124 125 fWindowSqrtHiGain = TMath::Sqrt((Float_t)fWindowSizeHiGain); 126 fWindowSqrtLoGain = TMath::Sqrt((Float_t)fWindowSizeLoGain); 113 127 114 128 } … … 141 155 return kFALSE; 142 156 143 fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1, 144 fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1 );157 fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainFirst+fNumHiGainSamples-1, (Float_t)fWindowSizeHiGain, 158 fLoGainFirst, fLoGainFirst+fNumLoGainSamples-1, (Float_t)fWindowSizeLoGain); 145 159 146 160 fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam")); … … 158 172 } 159 173 160 void MExtractSignal2::FindSignal(Byte_t *ptr, Byte_t size, Int_t &max, Int_t &sat) const174 void MExtractSignal2::FindSignal(Byte_t *ptr, Byte_t size, Byte_t window, Int_t &max, Int_t &sat) const 161 175 { 162 176 const Byte_t *end = ptr + size; … … 169 183 sat = 0; 170 184 Byte_t *p = ptr; 171 while (p<ptr+ fWindowSize)185 while (p<ptr+window) 172 186 { 173 187 sum += *p; … … 189 203 // 190 204 max=sum; 191 for (p=ptr; p+ fWindowSize<end; p++)192 { 193 sum += *(p+ fWindowSize) - *p;205 for (p=ptr; p+window<end; p++) 206 { 207 sum += *(p+window) - *p; 194 208 if (sum>max) 195 209 max = sum; … … 214 228 // 215 229 Int_t sumhi, sathi; 216 FindSignal(pixel.GetHiGainSamples()+fHiGainFirst, fNumHiGainSamples, sumhi, sathi);230 FindSignal(pixel.GetHiGainSamples()+fHiGainFirst, fNumHiGainSamples, fWindowSizeHiGain, sumhi, sathi); 217 231 218 232 Int_t sumlo=0; … … 220 234 if (pixel.HasLoGain()) 221 235 { 222 FindSignal(pixel.GetLoGainSamples()+fLoGainFirst, fNumLoGainSamples, sumlo, satlo);236 FindSignal(pixel.GetLoGainSamples()+fLoGainFirst, fNumLoGainSamples, fWindowSizeLoGain, sumlo, satlo); 223 237 if (satlo) 224 238 sat++; … … 239 253 // Set extracted signal with pedestal substracted 240 254 // 241 pix.SetExtractedSignal(sumhi - pedes*fWindowSize , pedrms*fWindowSizeSqrt,242 sumlo - pedes*fWindowSize , pedrms*fWindowSizeSqrt);255 pix.SetExtractedSignal(sumhi - pedes*fWindowSizeHiGain, pedrms*fWindowSqrtHiGain, 256 sumlo - pedes*fWindowSizeLoGain, pedrms*fWindowSqrtLoGain); 243 257 244 258 pix.SetGainSaturation(sathi, sathi, satlo); -
trunk/MagicSoft/Mars/msignal/MExtractSignal2.h
r3306 r3446 37 37 Byte_t fNumLoGainSamples; // Number of lo gain to be used 38 38 39 Byte_t fWindowSize; // Number of gains in window 40 Float_t fWindowSizeSqrt; // Sqaure root of number of gains in window 39 Byte_t fWindowSizeHiGain; // Number of Hi Gain slices in window 40 Float_t fWindowSqrtHiGain; // Sqaure root of number of Hi Gain slices in window 41 42 Byte_t fWindowSizeLoGain; // Number of Lo Gain slices in window 43 Float_t fWindowSqrtLoGain; // Sqaure root of number of Lo Gain slices in window 41 44 42 45 Byte_t fSaturationLimit; 43 46 44 void FindSignal(Byte_t *ptr, Byte_t size, Int_t &max, Int_t &sat) const;47 void FindSignal(Byte_t *ptr, Byte_t size, Byte_t window, Int_t &max, Int_t &sat) const; 45 48 46 49 Int_t PreProcess(MParList *pList); … … 50 53 MExtractSignal2(const char *name=NULL, const char *title=NULL); 51 54 52 void SetRange(Byte_t hifirst=fgFirst, Byte_t hilast=fgLast, Byte_t lofirst=fgFirst, Byte_t lolast=fgLast, Byte_t window_size=fgWindowSize); 55 void SetRange(Byte_t hifirst=fgFirst, Byte_t hilast=fgLast, Byte_t windowh=fgWindowSize, 56 Byte_t lofirst=fgFirst, Byte_t lolast=fgLast, Byte_t windowl=fgWindowSize); 53 57 void SetSaturationLimit(Byte_t lim) { fSaturationLimit = lim; } 54 58 -
trunk/MagicSoft/Mars/msignal/MExtractedSignalCam.h
r3306 r3446 24 24 Byte_t fLastUsedSliceLoGain; 25 25 26 Float_t fUsedWindowHiGain; 27 Float_t fUsedWindowLoGain; 28 26 29 public: 27 30 … … 36 39 Int_t GetSize() const; 37 40 38 Byte_t GetNumUsedFADCSlices() const { return fLastUsedSliceHiGain-fFirstUsedSliceHiGain+1; } 39 Byte_t GetNumUsedHiGainFADCSlices() const { return fLastUsedSliceHiGain-fFirstUsedSliceHiGain+1; } 40 Byte_t GetNumUsedLoGainFADCSlices() const { return fLastUsedSliceLoGain-fFirstUsedSliceLoGain+1; } 41 Float_t GetNumUsedHiGainFADCSlices() const { return fUsedWindowHiGain; } 42 Float_t GetNumUsedLoGainFADCSlices() const { return fUsedWindowLoGain; } 41 43 42 44 Byte_t GetFirstUsedSliceHiGain() const { return fFirstUsedSliceHiGain; } 43 Byte_t Get LastUsedSliceHiGain() const { return fLastUsedSliceHiGain; }45 Byte_t GetFirstUsedSliceLoGain() const { return fFirstUsedSliceLoGain; } 44 46 45 Byte_t Get FirstUsedSliceLoGain() const { return fFirstUsedSliceLoGain; }46 Byte_t GetLastUsedSliceLoGain() const{ return fLastUsedSliceLoGain; }47 Byte_t GetLastUsedSliceHiGain() const { return fLastUsedSliceHiGain; } 48 Byte_t GetLastUsedSliceLoGain() const { return fLastUsedSliceLoGain; } 47 49 48 void SetUsedFADCSlices(Byte_t firsth, Byte_t lasth, 49 Byte_t firstl, Byte_t lastl )50 void SetUsedFADCSlices(Byte_t firsth, Byte_t lasth, Float_t winh, 51 Byte_t firstl, Byte_t lastl, Float_t winl) 50 52 { 51 53 fFirstUsedSliceHiGain = firsth; 52 54 fLastUsedSliceHiGain = lasth; 55 fUsedWindowHiGain = winh; 53 56 fFirstUsedSliceLoGain = firstl; 54 57 fLastUsedSliceLoGain = lastl; 58 fUsedWindowLoGain = winl; 55 59 } 56 60
Note:
See TracChangeset
for help on using the changeset viewer.