1 | #ifndef MARS_MExtractTimeAndChargeSpline
|
---|
2 | #define MARS_MExtractTimeAndChargeSpline
|
---|
3 |
|
---|
4 | #ifndef MARS_MExtractTimeAndCharge
|
---|
5 | #include "MExtractTimeAndCharge.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef MARS_MArrayF
|
---|
9 | #include "MArrayF.h"
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | class MPedestalPix;
|
---|
13 | class MExtractTimeAndChargeSpline : public MExtractTimeAndCharge
|
---|
14 | {
|
---|
15 |
|
---|
16 | private:
|
---|
17 |
|
---|
18 | static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 2)
|
---|
19 | static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to: 14)
|
---|
20 | static const Byte_t fgLoGainFirst; //! Default for fLoGainFirst (now set to: 2)
|
---|
21 | static const Byte_t fgLoGainLast; //! Default for fLoGainLast (now set to: 14)
|
---|
22 | static const Float_t fgResolution; //! Default for fResolution (now set to: 0.003)
|
---|
23 | static const Float_t fgRiseTimeHiGain; //! Default for fRiseTime (now set to: 1.5)
|
---|
24 | static const Float_t fgFallTimeHiGain; //! Default for fFallTime (now set to: 4.5)
|
---|
25 | static const Float_t fgLoGainStretch; //! Default for fLoGainStretch (now set to: 1.5)
|
---|
26 | static const Float_t fgOffsetLoGain; //! Default for fOffsetLoGain (now set to 1.7)
|
---|
27 |
|
---|
28 | MArrayF fHiGainSignal; //! Need fast access to the signals in a float way
|
---|
29 | MArrayF fLoGainSignal; //! Store them in separate arrays
|
---|
30 | MArrayF fHiGainFirstDeriv; //! High-gain discretized first derivatives
|
---|
31 | MArrayF fLoGainFirstDeriv; //! Low-gain discretized first derivatives
|
---|
32 | MArrayF fHiGainSecondDeriv; //! High-gain discretized second derivatives
|
---|
33 | MArrayF fLoGainSecondDeriv; //! Low-gain discretized second derivatives
|
---|
34 |
|
---|
35 | Float_t fAbMax; //! Current maximum of the spline
|
---|
36 | Float_t fAbMaxPos; //! Current position of the maximum of the spline
|
---|
37 | Float_t fHalfMax; //! Current half maximum of the spline
|
---|
38 |
|
---|
39 | Float_t fResolution; // The time resolution in FADC units
|
---|
40 |
|
---|
41 | Float_t fRiseTimeHiGain; // The usual rise time of the pulse in the high-gain
|
---|
42 | Float_t fFallTimeHiGain; // The usual fall time of the pulse in the high-gain
|
---|
43 | Float_t fRiseTimeLoGain; //! The usual rise time of the pulse in the low-gain
|
---|
44 | Float_t fFallTimeLoGain; //! The usual fall time of the pulse in the low-gain
|
---|
45 |
|
---|
46 | Float_t fLoGainStretch; // The stretch of the low-gain w.r.t. the high-gain pulse
|
---|
47 |
|
---|
48 | Int_t fRandomIter; // Counter used to randomize weights for noise calculation
|
---|
49 |
|
---|
50 | Byte_t fFlags; // Bit-field to hold the time extraction types
|
---|
51 |
|
---|
52 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
53 |
|
---|
54 | Bool_t InitArrays();
|
---|
55 |
|
---|
56 | void CalcIntegralHiGain(Float_t &sum, Float_t start, Float_t last);
|
---|
57 | void CalcIntegralLoGain(Float_t &sum, Float_t start, Float_t last);
|
---|
58 |
|
---|
59 | public:
|
---|
60 |
|
---|
61 | enum ExtractionType_t { kMaximum, kHalfMaximum,
|
---|
62 | kAmplitude, kIntegral }; //! Possible time and charge extraction types
|
---|
63 |
|
---|
64 | private:
|
---|
65 |
|
---|
66 | Bool_t IsExtractionType ( ExtractionType_t typ ) { return TESTBIT(fFlags, typ); }
|
---|
67 |
|
---|
68 | public:
|
---|
69 |
|
---|
70 | MExtractTimeAndChargeSpline(const char *name=NULL, const char *title=NULL);
|
---|
71 | ~MExtractTimeAndChargeSpline() {}
|
---|
72 |
|
---|
73 | Float_t GetRiseTimeHiGain() const { return fRiseTimeHiGain; }
|
---|
74 | Float_t GetFallTimeHiGain() const { return fFallTimeHiGain; }
|
---|
75 |
|
---|
76 | void SetRange ( Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0 );
|
---|
77 | void SetResolution ( const Float_t f=fgResolution ) { fResolution = f; }
|
---|
78 | void SetRiseTimeHiGain( const Float_t f=fgRiseTimeHiGain )
|
---|
79 | {
|
---|
80 | fRiseTimeHiGain = f;
|
---|
81 | fRiseTimeLoGain = f*fLoGainStretch;
|
---|
82 | fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
|
---|
83 | fWindowSizeHiGain = (Int_t)(fRiseTimeHiGain + fFallTimeHiGain);
|
---|
84 | }
|
---|
85 | void SetFallTimeHiGain( const Float_t f=fgFallTimeHiGain )
|
---|
86 | {
|
---|
87 | fFallTimeHiGain = f;
|
---|
88 | fFallTimeLoGain = f*fLoGainStretch;
|
---|
89 | fNumHiGainSamples = fRiseTimeHiGain + fFallTimeHiGain;
|
---|
90 | fNumLoGainSamples = fLoGainLast ? fRiseTimeLoGain + fFallTimeLoGain : 0.;
|
---|
91 | fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
|
---|
92 | fWindowSizeLoGain = (Int_t)(fRiseTimeLoGain + fFallTimeLoGain);
|
---|
93 | }
|
---|
94 |
|
---|
95 | void SetLoGainStretch ( const Float_t f=fgLoGainStretch ) { fLoGainStretch = f; }
|
---|
96 |
|
---|
97 | void SetChargeType ( const ExtractionType_t typ=kAmplitude);
|
---|
98 |
|
---|
99 | void FindTimeAndChargeHiGain(Byte_t *first, Byte_t *logain, Float_t &sum, Float_t &dsum,
|
---|
100 | Float_t &time, Float_t &dtime,
|
---|
101 | Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
|
---|
102 | void FindTimeAndChargeLoGain(Byte_t *first, Float_t &sum, Float_t &dsum,
|
---|
103 | Float_t &time, Float_t &dtime,
|
---|
104 | Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
|
---|
105 |
|
---|
106 | ClassDef(MExtractTimeAndChargeSpline, 2) // Task to Extract Arrival Times and Charges using a Fast Cubic Spline
|
---|
107 | };
|
---|
108 |
|
---|
109 | #endif
|
---|
110 |
|
---|
111 |
|
---|
112 |
|
---|