1 | #ifndef MARS_MExtractTimeAndChargeDigitalFilter
|
---|
2 | #define MARS_MExtractTimeAndChargeDigitalFilter
|
---|
3 |
|
---|
4 | #ifndef MARS_MExtractTimeAndCharge
|
---|
5 | #include "MExtractTimeAndCharge.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef MARS_MArrayF
|
---|
9 | #include "MArrayF.h"
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | #ifndef MARS_MArrayI
|
---|
13 | #include "MArrayI.h"
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | class TH1F;
|
---|
17 | class TH2F;
|
---|
18 | class MPedestalPix;
|
---|
19 | class MExtractTimeAndChargeDigitalFilter : public MExtractTimeAndCharge
|
---|
20 | {
|
---|
21 | private:
|
---|
22 |
|
---|
23 | static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 0)
|
---|
24 | static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to:14)
|
---|
25 | static const Byte_t fgLoGainFirst; //! Default for fLoGainFirst (now set to: 3)
|
---|
26 | static const Byte_t fgLoGainLast; //! Default for fLoGainLast (now set to:14)
|
---|
27 | static const Int_t fgWindowSizeHiGain; //! Default for fWindowSizeHiGain (now set to: 6)
|
---|
28 | static const Int_t fgWindowSizeLoGain; //! Default for fWindowSizeLoGain (now set to: 6)
|
---|
29 | static const Int_t fgBinningResolutionHiGain; //! Default for fBinningResolutionHiGain (now set to: 10)
|
---|
30 | static const Int_t fgBinningResolutionLoGain; //! Default for fBinningResolutionLoGain (now set to: 10)
|
---|
31 | static const Int_t fgSignalStartBinHiGain; //! Default for fSignalStartBinHiGain (now set to: 4)
|
---|
32 | static const Int_t fgSignalStartBinLoGain; //! Default for fSignalStartBinLoGain (now set to: 4)
|
---|
33 | static const TString fgNameWeightsFile; //! "cosmics_weights.dat"
|
---|
34 | static const Float_t fgOffsetLoGain; //! Default for fOffsetLoGain (now set to 1.8)
|
---|
35 |
|
---|
36 | MArrayF fHiGainSignal; //! Need fast access to the signals in a float way
|
---|
37 | MArrayF fLoGainSignal; //! Store them in separate arrays
|
---|
38 |
|
---|
39 | MArrayI fArrBinningResHiGain; //! helping arrays to hold binningres * i
|
---|
40 | MArrayI fArrBinningResLoGain; //! helping arrays to hold binningres * i
|
---|
41 | MArrayI fArrBinningResHalfHiGain; //! helping arrays to hold binningres * i + binningreshalf
|
---|
42 | MArrayI fArrBinningResHalfLoGain; //! helping arrays to hold binningres * i + binningreshalf
|
---|
43 |
|
---|
44 | Float_t fTimeShiftHiGain; // Time shift from when on to apply the filter
|
---|
45 | Float_t fTimeShiftLoGain; // Time shift from when on to apply the filter
|
---|
46 |
|
---|
47 | Int_t fSignalStartBinHiGain; //! Start bin from when on to apply weights
|
---|
48 | Int_t fSignalStartBinLoGain; //! Start bin from when on to apply weights
|
---|
49 |
|
---|
50 | Int_t fBinningResolutionHiGain; // Number of weights per bin High-Gain
|
---|
51 | Int_t fBinningResolutionHalfHiGain; // Half Number of weights per bin High-Gain
|
---|
52 | Int_t fBinningResolutionLoGain; // Number of weights per bin Low-Gain
|
---|
53 | Int_t fBinningResolutionHalfLoGain; // Half Number of weights per bin Low-Gain
|
---|
54 |
|
---|
55 | MArrayF fAmpWeightsHiGain; //! Amplitude weights High-Gain (from weights file)
|
---|
56 | MArrayF fTimeWeightsHiGain; //! Time weights High-Gain (from weights file)
|
---|
57 | MArrayF fAmpWeightsLoGain; //! Amplitude weights Low-Gain (from weights file)
|
---|
58 | MArrayF fTimeWeightsLoGain; //! Time weights Low-Gain (from weights file)
|
---|
59 |
|
---|
60 | TString fNameWeightsFile; // Name of the weights file
|
---|
61 | Bool_t fWeightsSet; //! Flag if weights have alreayd been set
|
---|
62 | Int_t fRandomIter; //! Counter used to randomize weights for noise calculation
|
---|
63 |
|
---|
64 | Bool_t InitArrays();
|
---|
65 |
|
---|
66 | void CalcBinningResArrays();
|
---|
67 |
|
---|
68 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
69 |
|
---|
70 | public:
|
---|
71 |
|
---|
72 | MExtractTimeAndChargeDigitalFilter(const char *name=NULL, const char *title=NULL);
|
---|
73 | ~MExtractTimeAndChargeDigitalFilter() { }
|
---|
74 |
|
---|
75 | Bool_t WriteWeightsFile(TString filename,
|
---|
76 | TH1F *shapehi, TH2F *autocorrhi,
|
---|
77 | TH1F *shapelo=NULL, TH2F *autocorrlo=NULL );
|
---|
78 |
|
---|
79 | Bool_t ReadWeightsFile(TString filename);
|
---|
80 |
|
---|
81 | void SetNameWeightsFile( TString s = fgNameWeightsFile ) { fNameWeightsFile = s; }
|
---|
82 |
|
---|
83 | void SetBinningResolution(const Int_t rh=fgBinningResolutionHiGain, const Int_t rl=fgBinningResolutionLoGain) {
|
---|
84 | fBinningResolutionHiGain = rh & ~1;
|
---|
85 | fBinningResolutionHalfHiGain = fBinningResolutionHiGain/2;
|
---|
86 | fBinningResolutionLoGain = rl & ~1;
|
---|
87 | fBinningResolutionHalfLoGain = fBinningResolutionLoGain/2;
|
---|
88 | }
|
---|
89 |
|
---|
90 | void SetSignalStartBin( const Int_t sh=fgSignalStartBinHiGain, const Int_t sl=fgSignalStartBinLoGain) {
|
---|
91 | fSignalStartBinHiGain = sh;
|
---|
92 | fSignalStartBinLoGain = sl;
|
---|
93 | }
|
---|
94 |
|
---|
95 | void SetWindowSize( Int_t windowh=fgWindowSizeHiGain, Int_t windowl=fgWindowSizeLoGain);
|
---|
96 |
|
---|
97 | const char* GetNameWeightsFile() const { return fNameWeightsFile.Data(); }
|
---|
98 |
|
---|
99 | void Print(Option_t *o="") const;
|
---|
100 |
|
---|
101 | Bool_t IsWeightsSet() const { return fWeightsSet; }
|
---|
102 |
|
---|
103 | void FindTimeAndChargeHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Float_t &dsum,
|
---|
104 | Float_t &time, Float_t &dtime,
|
---|
105 | Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
|
---|
106 | void FindTimeAndChargeLoGain(Byte_t *firstused, Float_t &sum, Float_t &dsum,
|
---|
107 | Float_t &time, Float_t &dtime,
|
---|
108 | Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
|
---|
109 |
|
---|
110 | ClassDef(MExtractTimeAndChargeDigitalFilter, 2) // Hendrik's digital filter
|
---|
111 | };
|
---|
112 |
|
---|
113 | #endif
|
---|