source: trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.h@ 7729

Last change on this file since 7729 was 7491, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 4.8 KB
Line 
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
12class MPedestalPix;
13class MExtractTimeAndChargeSpline : public MExtractTimeAndCharge
14{
15
16private:
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 static const Float_t fgLoGainStartShift; //! Default for fLoGainStartShift (now set to -1.6)
28
29 MArrayF fHiGainSignal; //! Need fast access to the signals in a float way
30 MArrayF fLoGainSignal; //! Store them in separate arrays
31 MArrayF fHiGainFirstDeriv; //! High-gain discretized first derivatives
32 MArrayF fLoGainFirstDeriv; //! Low-gain discretized first derivatives
33 MArrayF fHiGainSecondDeriv; //! High-gain discretized second derivatives
34 MArrayF fLoGainSecondDeriv; //! Low-gain discretized second derivatives
35
36 Float_t fAbMax; //! Current maximum of the spline
37 Float_t fAbMaxPos; //! Current position of the maximum of the spline
38 Float_t fHalfMax; //! Current half maximum of the spline
39
40 Float_t fResolution; // The time resolution in FADC units
41
42 Float_t fRiseTimeHiGain; // The usual rise time of the pulse in the high-gain
43 Float_t fFallTimeHiGain; // The usual fall time of the pulse in the high-gain
44 Float_t fRiseTimeLoGain; // The usual rise time of the pulse in the low-gain
45 Float_t fFallTimeLoGain; // The usual fall time of the pulse in the low-gain
46
47 Float_t fLoGainStretch; // The stretch of the low-gain w.r.t. the high-gain pulse
48
49 Int_t fRandomIter; //! Counter used to randomize weights for noise calculation
50
51 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
52
53 Bool_t InitArrays();
54
55 Float_t CalcIntegralHiGain(Float_t start, Float_t range) const;
56 Float_t CalcIntegralLoGain(Float_t start, Float_t range) const;
57
58public:
59 enum ExtractionType_t { kAmplitude, kIntegral }; //! Possible time and charge extraction types
60
61private:
62
63 ExtractionType_t fExtractionType;
64
65public:
66
67 MExtractTimeAndChargeSpline(const char *name=NULL, const char *title=NULL);
68 ~MExtractTimeAndChargeSpline() {}
69
70 Float_t GetRiseTimeHiGain() const { return fRiseTimeHiGain; }
71 Float_t GetFallTimeHiGain() const { return fFallTimeHiGain; }
72
73 void SetRange ( Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0 );
74 void SetResolution ( const Float_t f=fgResolution ) { fResolution = f; }
75 void SetRiseTimeHiGain( const Float_t f=fgRiseTimeHiGain )
76 {
77 fRiseTimeHiGain = f;
78 fRiseTimeLoGain = f*fLoGainStretch;
79 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
80 fWindowSizeHiGain = TMath::Nint(fRiseTimeHiGain + fFallTimeHiGain);
81 }
82 void SetFallTimeHiGain( const Float_t f=fgFallTimeHiGain )
83 {
84 fFallTimeHiGain = f;
85 fFallTimeLoGain = f*fLoGainStretch;
86 fNumHiGainSamples = fRiseTimeHiGain + fFallTimeHiGain;
87 fNumLoGainSamples = fLoGainLast ? fRiseTimeLoGain + fFallTimeLoGain : 0.;
88 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
89 fWindowSizeLoGain = TMath::Nint(fRiseTimeLoGain + fFallTimeLoGain);
90 }
91
92 void SetLoGainStretch ( const Float_t f=fgLoGainStretch ) { fLoGainStretch = f; }
93
94 void SetChargeType ( const ExtractionType_t typ=kIntegral);
95
96 void FindTimeAndChargeHiGain(Byte_t *first, Byte_t *logain, Float_t &sum, Float_t &dsum,
97 Float_t &time, Float_t &dtime,
98 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
99 void FindTimeAndChargeLoGain(Byte_t *first, 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
103 ClassDef(MExtractTimeAndChargeSpline, 4) // Task to Extract Arrival Times and Charges using a Cubic Spline
104};
105
106#endif
107
108
109
Note: See TracBrowser for help on using the repository browser.