Changeset 8308
- Timestamp:
- 02/06/07 09:10:59 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8307 r8308 24 24 - included check for monitoring flag 25 25 26 * mextralgo/MExtralgoSpline.[h,cc]: 27 - implemented the possibility to determine the pulse width at 28 maxheight/2 29 26 30 27 31 -
trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.cc
r8165 r8308 126 126 x = x3; 127 127 128 return x<0 ? - 1: x+i;128 return x<0 ? -2 : x+i; 129 129 } 130 130 … … 132 132 // 133 133 // Search analytically downward for the value y of the spline, starting 134 // at x, until x==0. If y is not found - 1is returned.134 // at x, until x==0. If y is not found -2 is returned. 135 135 // 136 136 Double_t MExtralgoSpline::SearchY(Float_t x, Float_t y) const … … 142 142 Double_t rc = FindY(i, y, 0, x-i); 143 143 while (--i>=0 && rc<0) 144 rc = FindY(i, y); 145 146 return rc; 147 } 148 149 Double_t MExtralgoSpline::SearchYup(Float_t x, Float_t y) const 150 { 151 if (x<0) 152 x = 0.0001; 153 154 Int_t i = TMath::FloorNint(x); 155 Double_t rc = FindY(i, y, x-i, 1.); 156 while (i++<fNum-1 && rc<0) 144 157 rc = FindY(i, y); 145 158 … … 227 240 } 228 241 229 void MExtralgoSpline::Extract(Byte_t sat, Int_t maxbin )242 void MExtralgoSpline::Extract(Byte_t sat, Int_t maxbin, Bool_t width) 230 243 { 231 244 fSignal = 0; 232 245 fTime = 0; 246 fWidth = 0; 233 247 fSignalDev = -1; 234 248 fTimeDev = -1; 249 fWidthDev = -1; 235 250 236 251 if (fNum<2) … … 381 396 }*/ 382 397 383 Float_t maxpos , maxval;398 Float_t maxpos; 384 399 // FIXME: Check the default if no maximum found!!! 385 GetMaxAroundI(maxbin, maxpos, maxval);400 GetMaxAroundI(maxbin, maxpos, fHeight); 386 401 387 402 // --- End NEW --- … … 391 406 fTime = maxpos; 392 407 fTimeDev = 0; 393 fSignal = maxval;408 fSignal = fHeight; 394 409 fSignalDev = 0; // means: is valid 395 410 return; 396 411 } 397 412 398 // Search downwards for maxval/2 413 const Float_t h = fExtractionType==kIntegralAbs ? fHeightTm : fHeight*fHeightTm; 414 415 // Search downwards for fHeight/2 399 416 // By doing also a search upwards we could extract the pulse width 400 const Double_t x1 = SearchY(maxpos, maxval/2); 401 402 fTime = x1; 417 fTime = SearchY(maxpos, h); 403 418 fTimeDev = 0; 419 if (width) 420 { 421 fWidth = SearchYup(maxpos, h)-fTime; 422 fWidthDev = 0; 423 } 404 424 fSignal = CalcIntegral(maxpos); 405 425 fSignalDev = 0; // means: is valid -
trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.h
r8158 r8308 12 12 { 13 13 public: 14 enum ExtractionType_t { kAmplitude, kIntegral }; //! Possible time and charge extraction types14 enum ExtractionType_t { kAmplitude, kIntegralRel, kIntegralAbs }; //! Possible time and charge extraction types 15 15 16 16 private: … … 30 30 Float_t fFallTime; 31 31 32 Float_t fHeightTm; 33 32 34 // Float_t fResolution; 33 35 … … 35 37 Float_t fTime; 36 38 Float_t fTimeDev; 39 Float_t fWidth; 40 Float_t fWidthDev; 37 41 Float_t fSignal; 38 42 Float_t fSignalDev; 43 Float_t fHeight; 39 44 40 45 Double_t ReMul(const TComplex &c1, const TComplex &th) const; … … 89 94 Double_t FindY(Int_t i, Double_t y=0, Double_t min=0, Double_t max=1) const; 90 95 Double_t SearchY(Float_t maxpos, Float_t y) const; 96 Double_t SearchYup(Float_t maxpos, Float_t y) const; 91 97 /* 92 98 // Evaluate first solution for a possible maximum (x|first deriv==0) … … 230 236 rc1 = kTRUE; 231 237 } 232 if (i> fNum-2)238 if (i>=fNum-1) 233 239 { 234 240 xmax2 = fNum-1; … … 440 446 public: 441 447 MExtralgoSpline(const Float_t *val, Int_t n, Float_t *der1, Float_t *der2) 442 : fExtractionType(kIntegral ), fVal(val), fNum(n), fDer1(der1), fDer2(der2), fTime(0), fTimeDev(-1), fSignal(0), fSignalDev(-1)448 : fExtractionType(kIntegralRel), fVal(val), fNum(n), fDer1(der1), fDer2(der2), fHeightTm(0.5), fTime(0), fTimeDev(-1), fSignal(0), fSignalDev(-1) 443 449 { 444 450 InitDerivatives(); … … 447 453 void SetRiseFallTime(Float_t rise, Float_t fall) { fRiseTime=rise; fFallTime=fall; } 448 454 void SetExtractionType(ExtractionType_t typ) { fExtractionType = typ; } 449 // void SetResolution(Float_t res) { fResolution=res; } 455 void SetHeightTm(Float_t h) { fHeightTm = h; } 456 // void SetResolution(Float_t res) { fResolution=res; } 450 457 451 458 Float_t GetTime() const { return fTime; } 459 Float_t GetWidth() const { return fWidth; } 452 460 Float_t GetSignal() const { return fSignal; } 461 Float_t GetHeight() const { return fHeight; } 453 462 454 463 Float_t GetTimeDev() const { return fTimeDev; } 464 Float_t GetWidthDev() const { return fWidthDev; } 455 465 Float_t GetSignalDev() const { return fSignalDev; } 456 466 457 467 void GetSignal(Float_t &sig, Float_t &dsig) const { sig=fSignal; dsig=fSignalDev; } 468 void GetWidth(Float_t &sig, Float_t &dsig) const { sig=fWidth; dsig=fWidthDev; } 458 469 void GetTime(Float_t &sig, Float_t &dsig) const { sig=fTime; dsig=fTimeDev; } 459 470 460 471 Float_t ExtractNoise(/*Int_t iter*/); 461 void Extract(Byte_t sat, Int_t maxpos );472 void Extract(Byte_t sat, Int_t maxpos, Bool_t width=kFALSE); 462 473 }; 463 474
Note:
See TracChangeset
for help on using the changeset viewer.