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

Last change on this file since 8339 was 8304, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 5.0 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;
13
14class MExtractTimeAndChargeSpline : public MExtractTimeAndCharge
15{
16private:
17 static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 2)
18 static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to: 14)
19 static const Int_t fgLoGainFirst; //! Default for fLoGainFirst (now set to: 2)
20 static const Byte_t fgLoGainLast; //! Default for fLoGainLast (now set to: 14)
21 static const Float_t fgResolution; //! Default for fResolution (now set to: 0.003)
22 static const Float_t fgRiseTimeHiGain; //! Default for fRiseTime (now set to: 1.5)
23 static const Float_t fgFallTimeHiGain; //! Default for fFallTime (now set to: 4.5)
24 static const Float_t fgLoGainStretch; //! Default for fLoGainStretch (now set to: 1.5)
25 static const Float_t fgOffsetLoGain; //! Default for fOffsetLoGain (now set to 1.7)
26// static const Float_t fgLoGainStartShift; //! Default for fLoGainStartShift (now set to -1.6)
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 fResolution; // The time resolution in FADC units
36
37 Float_t fRiseTimeHiGain; // The usual rise time of the pulse in the high-gain
38 Float_t fFallTimeHiGain; // The usual fall time of the pulse in the high-gain
39 Float_t fRiseTimeLoGain; // The usual rise time of the pulse in the low-gain
40 Float_t fFallTimeLoGain; // The usual fall time of the pulse in the low-gain
41
42 Float_t fLoGainStretch; // The stretch of the low-gain w.r.t. the high-gain pulse
43
44// Int_t fRandomIter; //! Counter used to randomize weights for noise calculation
45
46 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
47 Bool_t InitArrays(Int_t n);
48
49public:
50 enum ExtractionType_t { kAmplitude, kIntegral }; //! Possible time and charge extraction types
51
52private:
53 ExtractionType_t fExtractionType;
54
55public:
56 MExtractTimeAndChargeSpline(const char *name=NULL, const char *title=NULL);
57 ~MExtractTimeAndChargeSpline() {}
58
59 Float_t GetRiseTimeHiGain() const { return fRiseTimeHiGain; }
60 Float_t GetFallTimeHiGain() const { return fFallTimeHiGain; }
61
62 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Int_t lofirst=0, Byte_t lolast=0 );
63
64 void SetResolution(const Float_t f=fgResolution) { fResolution = f; }
65
66 void SetRiseTimeHiGain(const Float_t f=fgRiseTimeHiGain)
67 {
68 fRiseTimeHiGain = f;
69 fRiseTimeLoGain = f*fLoGainStretch;
70 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
71 fWindowSizeHiGain = TMath::Nint(fRiseTimeHiGain + fFallTimeHiGain);
72 }
73 void SetFallTimeHiGain(const Float_t f=fgFallTimeHiGain)
74 {
75 fFallTimeHiGain = f;
76 fFallTimeLoGain = f*fLoGainStretch;
77 fNumHiGainSamples = fRiseTimeHiGain + fFallTimeHiGain;
78 fNumLoGainSamples = fLoGainLast ? fRiseTimeLoGain + fFallTimeLoGain : 0.;
79 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
80 fWindowSizeLoGain = TMath::Nint(fRiseTimeLoGain + fFallTimeLoGain);
81 }
82
83 void SetLoGainStretch(const Float_t f=fgLoGainStretch) { fLoGainStretch = f; }
84
85 void SetChargeType(const ExtractionType_t typ=kIntegral);
86/*
87 void FindTimeAndChargeHiGain(Byte_t *first, Byte_t *logain, Float_t &sum, Float_t &dsum,
88 Float_t &time, Float_t &dtime,
89 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
90 void FindTimeAndChargeLoGain(Byte_t *first, Float_t &sum, Float_t &dsum,
91 Float_t &time, Float_t &dtime,
92 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
93*/
94 void FindTimeAndChargeHiGain2(const Float_t *firstused, Int_t num, Float_t &sum, Float_t &dsum,
95 Float_t &time, Float_t &dtime,
96 Byte_t sat, Int_t maxpos) const;
97
98 void FindTimeAndChargeLoGain2(const Float_t *firstused, Int_t num, Float_t &sum, Float_t &dsum,
99 Float_t &time, Float_t &dtime,
100 Byte_t sat, Int_t maxpos) const;
101
102 ClassDef(MExtractTimeAndChargeSpline, 4) // Task to Extract Arrival Times and Charges using a Cubic Spline
103};
104
105#endif
Note: See TracBrowser for help on using the repository browser.