source: trunk/MagicSoft/Mars/mextralgo/MExtralgoSpline.h@ 7992

Last change on this file since 7992 was 7942, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.0 KB
Line 
1#ifndef MARS_MExtralgoSpline
2#define MARS_MExtralgoSpline
3
4#ifndef ROOT_TROOT
5#include <TROOT.h>
6#endif
7
8class MExtralgoSpline
9{
10public:
11 enum ExtractionType_t { kAmplitude, kIntegral }; //! Possible time and charge extraction types
12
13private:
14 ExtractionType_t fExtractionType;
15
16private:
17 //Bool_t fIsOwner; // Owner of derivatives....
18
19 // Input
20 Float_t *fVal;
21 Int_t fNum;
22
23 Float_t *fDer1;
24 Float_t *fDer2;
25
26 Float_t fRiseTime;
27 Float_t fFallTime;
28
29 Float_t fResolution;
30
31 // Result
32 Float_t fTime;
33 Float_t fTimeDev;
34 Float_t fSignal;
35 Float_t fSignalDev;
36
37 inline Float_t Eval(Float_t val, Float_t a, Float_t deriv) const
38 {
39 return a*val + (a*a*a-a)*deriv;
40 }
41
42 inline Float_t Eval(const Float_t x, const Int_t i) const
43 {
44 const Float_t b = x-i;
45 return Eval(fVal[i], 1-b, fDer2[i]) + Eval(fVal[i+1], b, fDer2[i+1]);
46 }
47
48 void InitDerivatives() const;
49 Float_t CalcIntegral(Float_t start, Float_t range) const;
50
51public:
52 MExtralgoSpline(Float_t *val, Int_t n, Float_t *der1, Float_t *der2)
53 : fExtractionType(kIntegral), fVal(val), fNum(n), fDer1(der1), fDer2(der2), fTime(0), fTimeDev(-1), fSignal(0), fSignalDev(-1)
54 {
55 InitDerivatives();
56 }
57
58 void SetRiseFallTime(Float_t rise, Float_t fall) { fRiseTime=rise; fFallTime=fall; }
59 void SetExtrationType(ExtractionType_t typ) { fExtractionType = typ; }
60 void SetResolution(Float_t res) { fResolution=res; }
61
62 Float_t GetTime() const { return fTime; }
63 Float_t GetSignal() const { return fSignal; }
64
65 Float_t GetTimeDev() const { return fTimeDev; }
66 Float_t GetSignalDev() const { return fSignalDev; }
67
68 void GetSignal(Float_t &sig, Float_t &dsig) const { sig=fSignal; dsig=fSignalDev; }
69 void GetTime(Float_t &sig, Float_t &dsig) const { sig=fTime; dsig=fTimeDev; }
70
71 Float_t ExtractNoise(Int_t iter);
72 void Extract(Byte_t sat, Int_t maxpos);
73};
74
75#endif
Note: See TracBrowser for help on using the repository browser.