Changeset 6168
- Timestamp:
- 02/01/05 15:19:07 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSlidingWindow.cc
r6122 r6168 70 70 using namespace std; 71 71 72 const Byte_t MExtractTimeAndChargeSlidingWindow::fgHiGainFirst = 2;72 const Byte_t MExtractTimeAndChargeSlidingWindow::fgHiGainFirst = 0; 73 73 const Byte_t MExtractTimeAndChargeSlidingWindow::fgHiGainLast = 16; 74 74 const Byte_t MExtractTimeAndChargeSlidingWindow::fgLoGainFirst = 2; … … 209 209 210 210 Float_t max = 0; // highest integral content of all windows 211 Int_t count = 0;212 211 sat = 0; 213 212 … … 222 221 // 223 222 Int_t ids = fHiGainFirst; 223 Float_t *sample = fHiGainSignal.GetArray(); 224 224 225 225 while (p<first+fWindowSizeHiGain) … … 228 228 const Float_t signal = (Float_t)*p - PedMean[(ids++ + abflag) & 0x1]; 229 229 sum += signal; 230 fHiGainSignal[count]= signal;230 *sample++ = signal; 231 231 232 232 if (*p > fMaxBinContent) … … 236 236 if (!sat) 237 237 sat = ids-2; 238 239 count++; 240 } 241 238 } 239 240 if (IsNoiseCalculation()) 241 return; 242 242 243 // 243 244 // Check for saturation in all other slices … … 253 254 } 254 255 255 if (IsNoiseCalculation())256 return;257 258 256 // 259 257 // Calculate the i-th sum as … … 261 259 // This is fast and accurate (because we are using int's) 262 260 // 263 count= 0;261 Int_t count = 0; 264 262 max = sum; 265 263 Int_t idx = 0; // idx of the first slice of the maximum window … … 269 267 270 268 const Float_t signal = (Float_t)*(p+fWindowSizeHiGain) - PedMean[(ids++ + abflag) & 0x1]; 271 sum += signal - fHiGainSignal[count];272 fHiGainSignal[count + fWindowSizeHiGain]= signal;269 sum += signal - *(sample-fWindowSizeHiGain); 270 *sample++ = signal; 273 271 274 272 if (sum>max) … … 280 278 } 281 279 282 if (fHiLoLast != 0) 283 { 284 285 // 286 // overlap bins 287 // 288 Byte_t *l = logain; 289 290 while (p < end && l < logain+fHiLoLast) 280 // 281 // overlap bins 282 // 283 Byte_t *l = logain; 284 while (l < logain+fHiLoLast) 285 { 286 287 const Float_t signal = (Float_t)*l - PedMean[(ids++ + abflag) & 0x1]; 288 sum += signal - *(sample-fWindowSizeHiGain); 289 *sample++ = signal; 290 291 if (*l > fMaxBinContent) 292 fMaxBinContent = *logain; 293 294 if (*l++ >= fSaturationLimit) 295 if (!sat) 296 sat = ids-2; 297 298 if (sum>max) 291 299 { 292 293 const Float_t signal = (Float_t)*l - PedMean[(ids++ + abflag) & 0x1]; 294 sum += signal - fHiGainSignal[count]; 295 fHiGainSignal[count + fWindowSizeHiGain] = signal; 296 297 if (*l > fMaxBinContent) 298 fMaxBinContent = *logain; 299 300 if (*l++ >= fSaturationLimit) 301 if (!sat) 302 sat = ids-2; 303 304 if (sum>max) 305 { 306 max = sum; 307 idx = count+1; 308 } 309 count++; 310 p++; 300 max = sum; 301 idx = count+1; 311 302 } 312 313 if (fHiLoLast > (Byte_t)fWindowSizeHiGain) 314 { 315 while (l < logain + fHiLoLast) 316 { 317 const Float_t signal = (Float_t)*l - PedMean[(ids++ + abflag) & 0x1]; 318 sum += signal - fHiGainSignal[count]; 319 fHiGainSignal[count+fWindowSizeHiGain] = signal; 320 321 if (*l++ >= fSaturationLimit) 322 if (!sat) 323 sat = ids-2; 324 325 if (sum>max) 326 { 327 max = sum; 328 idx = count+1; 329 } 330 count++; 331 } /* while (l < logain + fHiLoLast) */ 332 } /* if (fHiLoLast > fWindowSizeHiGain) */ 333 } /* if (fHiLoLast != 0) */ 303 count++; 304 } /* while (l<logain+fHiLoLast) */ 334 305 335 306 //
Note:
See TracChangeset
for help on using the changeset viewer.