- Timestamp:
- 01/07/05 18:21:20 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc
r5589 r5726 51 51 // In case of odd numbers, the window will be modified. 52 52 // 53 //54 53 // Call: SetOffsetFromWindow() to adjust the positionning of the extraction 55 54 // window w.r.t. the peak search window. An fOffsetFromWindow of 0 means that … … 251 250 252 251 return kTRUE; 253 254 252 } 255 253 … … 262 260 // saturated slices. 263 261 // 264 void MExtractFixedWindowPeakSearch::FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &max, Int_t &sat) const 262 void MExtractFixedWindowPeakSearch::FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &max, 263 Int_t &sat, Byte_t &satpos) const 265 264 { 266 265 … … 268 267 269 268 sat = 0; 269 satpos = 0; 270 270 271 startslice = 0; 271 272 Int_t sum=0; … … 281 282 sum += *p; 282 283 if (*p++ >= fSaturationLimit) 283 sat++; 284 { 285 if (sat == 0) 286 satpos = p-ptr; 287 sat++; 288 } 284 289 } 285 290 … … 289 294 while (p<end) 290 295 if (*p++ >= fSaturationLimit) 291 sat++; 292 296 { 297 if (sat == 0) 298 satpos = p-ptr; 299 sat++; 300 } 301 293 302 // 294 303 // Calculate the i-th sum of n as … … 395 404 396 405 Int_t sat; 406 Byte_t satpos; 407 ULong_t gsatpos = 0; 408 397 409 Int_t maxsumhi = -1000000; 410 Int_t numsat = 0; 398 411 Byte_t startslice; 399 412 Byte_t hiGainFirst = 0; … … 406 419 sat = 0; 407 420 408 FindPeak(pixel.GetHiGainSamples()+fHiGainFirst, fPeakSearchWindowSize, startslice, sumhi, sat );409 410 if (sumhi > maxsumhi && sat == 0 421 FindPeak(pixel.GetHiGainSamples()+fHiGainFirst, fPeakSearchWindowSize, startslice, sumhi, sat, satpos); 422 423 if (sumhi > maxsumhi && sat == 0) 411 424 { 412 425 maxsumhi = sumhi; … … 416 429 hiGainFirst = fHiGainFirst; 417 430 } 418 } 419 420 421 loGainFirst = ( hiGainFirst+fLoGainPeakShift > fLoGainFirst ) ? 422 hiGainFirst+fLoGainPeakShift : fLoGainFirst; 431 else if (sat) 432 { 433 numsat++; 434 gsatpos += satpos; 435 } 436 } 437 438 // Check necessary for calibration events 439 if (numsat > fSignals->GetSize()*0.9) 440 hiGainFirst = gsatpos/numsat - 1; 441 442 loGainFirst = ( hiGainFirst+fLoGainPeakShift > fLoGainFirst ) 443 ? hiGainFirst+fLoGainPeakShift 444 : fLoGainFirst; 423 445 424 446 // Make sure we will not integrate beyond the hi gain limit: … … 434 456 fSignals->Clear(); 435 457 436 sat = 0;437 458 while (pixel.Next()) 438 459 { … … 448 469 Byte_t satlo=0; 449 470 if (pixel.HasLoGain()) 450 { 451 FindSignalLoGain(pixel.GetLoGainSamples()+loGainFirst, sumlo, satlo); 452 if (satlo) 453 sat++; 454 } 471 FindSignalLoGain(pixel.GetLoGainSamples()+loGainFirst, sumlo, satlo); 455 472 456 473 // -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h
r5469 r5726 29 29 void FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const; 30 30 31 void FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &signal, Int_t &sat ) const;31 void FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &signal, Int_t &sat, Byte_t &satpos) const; 32 32 33 33 Bool_t ReInit(MParList *pList); … … 37 37 public: 38 38 39 MExtractFixedWindowPeakSearch(const char *name=NULL, const char *title=NULL); 39 MExtractFixedWindowPeakSearch(const char *name=NULL, const char *title=NULL); 40 41 Byte_t GetHiGainWindowSize() const { return fHiGainWindowSize; } 42 Byte_t GetLoGainWindowSize() const { return fLoGainWindowSize; } 40 43 41 Byte_t GetHiGainWindowSize() const { return fHiGainWindowSize; } 42 Byte_t GetLoGainWindowSize() const { return fLoGainWindowSize; } 44 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 45 void SetWindows(Byte_t windowh=fgHiGainWindowSize, Byte_t windowl=fgLoGainWindowSize, 46 Byte_t peaksearchwindow=fgPeakSearchWindowSize); 47 void SetOffsetFromWindow(Byte_t offset=fgOffsetFromWindow) { fOffsetFromWindow = offset; } 48 49 void SetLoGainPeakShift(Byte_t shift=fgLoGainPeakShift) { fLoGainPeakShift = shift; } 50 51 void Print(Option_t *o="") const; 43 52 44 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 45 void SetWindows(Byte_t windowh=fgHiGainWindowSize, Byte_t windowl=fgLoGainWindowSize, 46 Byte_t peaksearchwindow=fgPeakSearchWindowSize); 47 void SetOffsetFromWindow(Byte_t offset=fgOffsetFromWindow) { fOffsetFromWindow = offset; } 48 49 void SetLoGainPeakShift(Byte_t shift=fgLoGainPeakShift) { fLoGainPeakShift = shift; } 50 51 void Print(Option_t *o="") const; 52 53 ClassDef(MExtractFixedWindowPeakSearch, 1) // Signal Extractor for fixed size trigger-corrected extraction window 53 ClassDef(MExtractFixedWindowPeakSearch, 1) // Signal Extractor for fixed size trigger-corrected extraction window 54 54 }; 55 55
Note:
See TracChangeset
for help on using the changeset viewer.