Changeset 2640 for trunk/MagicSoft/Mars/manalysis/MExtractSignal.cc
- Timestamp:
- 12/11/03 13:58:40 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MExtractSignal.cc
r2631 r2640 57 57 // 58 58 MExtractSignal::MExtractSignal(const char *name, const char *title) 59 : fSaturationLimit(255), 60 fConversionHiLo(10.) 59 : fBefore(2), fAfter(4), fSaturationLimit(254), fConversionHiLo(10.) 61 60 { 62 61 … … 123 122 } 124 123 125 fNumHiGainSamples = fRunHeader->GetNumSamplesHiGain(); 126 fNumLoGainSamples = fRunHeader->GetNumSamplesLoGain(); 127 fSqrtHiGainSamples = TMath::Sqrt((float)fNumHiGainSamples); 128 fSqrtLoGainSamples = TMath::Sqrt((float)fNumLoGainSamples); 124 //fNumHiGainSamples = fRunHeader->GetNumSamplesHiGain(); 125 //fNumLoGainSamples = fRunHeader->GetNumSamplesLoGain(); 126 fNumHiGainSamples = fAfter+fBefore; 127 fNumLoGainSamples = fAfter+fBefore; 128 129 fSqrtHiGainSamples = TMath::Sqrt((float)fNumHiGainSamples); 130 fSqrtLoGainSamples = TMath::Sqrt((float)fNumLoGainSamples); 129 131 130 132 // … … 156 158 UShort_t satHi = 0; 157 159 UShort_t satLo = 0; 158 Float_t sum = 0.; 159 Float_t sumerr = 0.; 160 161 Byte_t *ptr = pixel.GetHiGainSamples(); 162 Byte_t *max = ptr + pixel.GetIdxMaxHiGainSample(); 163 Byte_t *end = ptr + fRawEvt->GetNumHiGainSamples(); 164 Byte_t *first; 165 Byte_t *last; 166 167 UInt_t sumHi = 0; 168 UInt_t sumLo = 0; 160 169 161 170 const Int_t pixid = pixel.GetPixelId(); … … 165 174 const Float_t pedes = ped.GetPedestal(); 166 175 const Float_t pedrms = ped.GetPedestalRms(); 176 177 if (max-3 < ptr) 178 { 179 first = ptr+3; 180 last = ptr+3+fAfter+fBefore; 181 } 182 else if (max+fAfter-1 > end) 183 { 184 first = end-fAfter-fBefore-1; 185 last = end-1; 186 } 187 else 188 { 189 first = max-fBefore; 190 last = max+fAfter; 191 } 192 193 for (ptr=first;ptr<last;ptr++) 194 { 195 sumHi += *ptr; 196 if (*ptr >= fSaturationLimit) 197 satHi++; 198 } 199 200 ptr = pixel.GetLoGainSamples(); 201 max = ptr+pixel.GetIdxMaxLoGainSample(); 202 end = ptr+fRawEvt->GetNumLoGainSamples(); 203 204 if (max-4 < ptr) 205 { 206 first = ptr+4; 207 last = ptr+4+fAfter+fBefore; 208 } 209 else if (max+fAfter > end) 210 { 211 first = end-fAfter-fBefore; 212 last = end; 213 } 214 else 215 { 216 first = max-fBefore; 217 last = max+fAfter; 218 } 219 220 for (ptr=first;ptr<last;ptr++) 221 { 222 sumLo += *ptr; 223 if (*ptr >= fSaturationLimit) 224 { 225 *fLog << err << dbginf 226 << "Warning: Saturation of Lo Gain reached in pixel: " 227 << pixid << " " << " sum = " << sumLo << endl; 228 satLo++; 229 } 230 } 167 231 168 232 // … … 171 235 // 172 236 173 UInt_t max = pixel.GetMaxHiGainSample(); 174 175 if (max <= fSaturationLimit) // take Hi Gain, no saturation 176 { 177 sum = (float)pixel.GetSumHiGainSamples() - pedes*fNumHiGainSamples; 178 sumerr = pedrms*fSqrtHiGainSamples; 179 } 180 else // Lo Gain 181 { 182 183 satHi++; 184 185 sum = (float)pixel.GetSumLoGainSamples() - pedes*fNumLoGainSamples ; 186 sum *= fConversionHiLo; 187 188 sumerr = pedrms*fSqrtLoGainSamples; 189 190 max = pixel.GetMaxLoGainSample(); 191 192 if (max > fSaturationLimit) 193 { 194 *fLog << err << dbginf 195 << "Warning: Saturation of Lo Gain reached in pixel: " 196 << pixid << " " << " sum = " << sum << endl; 197 satLo++; 198 } 199 200 } 201 202 pix.SetGainSaturation((satHi),(satHi),(satLo)); 203 pix.SetExtractedSignal(sum,sumerr); 237 pix.SetExtractedSignal((float)sumHi - pedes*(float)fNumHiGainSamples, 238 pedrms*fSqrtHiGainSamples, 239 ((float)sumLo - pedes*(float)fNumLoGainSamples)*fConversionHiLo, 240 pedrms*fSqrtLoGainSamples 241 ); 242 243 pix.SetGainSaturation((satHi),satHi,satLo); 204 244 205 245 } /* while (pixel.Next()) */ 206 246 247 248 fSignals->SetNumUsedFADCSlices(fNumHiGainSamples); 207 249 fSignals->SetReadyToSave(); 208 250
Note:
See TracChangeset
for help on using the changeset viewer.