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 | class MCalibrationPattern;
|
---|
13 |
|
---|
14 | class MExtractTimeAndChargeDigitalFilter : public MExtractTimeAndCharge
|
---|
15 | {
|
---|
16 | private:
|
---|
17 | static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 0)
|
---|
18 | static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to:14)
|
---|
19 | static const Byte_t fgLoGainFirst; //! Default for fLoGainFirst (now set to: 3)
|
---|
20 | static const Byte_t fgLoGainLast; //! Default for fLoGainLast (now set to:14)
|
---|
21 | static const Int_t fgBinningResolutionHiGain; //! Default for fBinningResolutionHiGain (now set to: 10)
|
---|
22 | static const Int_t fgBinningResolutionLoGain; //! Default for fBinningResolutionLoGain (now set to: 10)
|
---|
23 | static const Int_t fgSignalStartBinHiGain; //! Default for fSignalStartBinHiGain (now set to: 4)
|
---|
24 | static const Int_t fgSignalStartBinLoGain; //! Default for fSignalStartBinLoGain (now set to: 4)
|
---|
25 | static const TString fgNameWeightsFile; //! "cosmics_weights.dat"
|
---|
26 | static const Float_t fgOffsetLoGain; //! Default for fOffsetLoGain (now set to 1.7)
|
---|
27 |
|
---|
28 | MCalibrationPattern *fCalibPattern; //! Calibration DM pattern
|
---|
29 |
|
---|
30 | Int_t fBinningResolutionHiGain; // Number of weights per bin High-Gain
|
---|
31 | Int_t fBinningResolutionLoGain; // Number of weights per bin Low-Gain
|
---|
32 |
|
---|
33 | MArrayF fAmpWeightsHiGain; //! Amplitude weights High-Gain (from weights file)
|
---|
34 | MArrayF fTimeWeightsHiGain; //! Time weights High-Gain (from weights file)
|
---|
35 | MArrayF fAmpWeightsLoGain; //! Amplitude weights Low-Gain (from weights file)
|
---|
36 | MArrayF fTimeWeightsLoGain; //! Time weights Low-Gain (from weights file)
|
---|
37 |
|
---|
38 | MArrayF fPulseHiGain; //! Pulse Shape Hi-Gain (for chisq)
|
---|
39 | MArrayF fPulseLoGain; //! Pulse Shape Lo-Gain (for chisq)
|
---|
40 |
|
---|
41 | TString fNameWeightsFile; // Name of the weights file
|
---|
42 | Bool_t fAutomaticWeights; // Flag whether weight should be determined automatically
|
---|
43 | TString fNameWeightsFileSet; //! Flag if weights have alreayd been set
|
---|
44 |
|
---|
45 | // MExtractTimeAndChargeDigitalFilter
|
---|
46 | void CalcBinningResArrays();
|
---|
47 | Int_t GetAutomaticWeights();
|
---|
48 | Bool_t GetWeights();
|
---|
49 | Int_t ReadWeightsFile(TString filename, TString path="");
|
---|
50 | TString CompileWeightFileName(TString path, const TString &name) const;
|
---|
51 |
|
---|
52 |
|
---|
53 | // MExtractTimeAndCharge
|
---|
54 | Bool_t InitArrays(Int_t n);
|
---|
55 |
|
---|
56 | // MTask
|
---|
57 | Int_t PreProcess(MParList *pList);
|
---|
58 | Int_t Process();
|
---|
59 |
|
---|
60 | protected:
|
---|
61 | // MParContainer
|
---|
62 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
63 |
|
---|
64 | public:
|
---|
65 | MExtractTimeAndChargeDigitalFilter(const char *name=NULL, const char *title=NULL);
|
---|
66 | ~MExtractTimeAndChargeDigitalFilter() { }
|
---|
67 |
|
---|
68 | void SetNameWeightsFile(TString s="")
|
---|
69 | {
|
---|
70 | s.ReplaceAll("\015", ""); // This is a fix for TEnv files edited with windows editors
|
---|
71 | fNameWeightsFile = s;
|
---|
72 | fNameWeightsFileSet="";
|
---|
73 | }
|
---|
74 |
|
---|
75 | void EnableAutomaticWeights(Bool_t b=kTRUE) { fAutomaticWeights = b; }
|
---|
76 |
|
---|
77 | void SetBinningResolution(const Int_t rh=fgBinningResolutionHiGain, const Int_t rl=fgBinningResolutionLoGain)
|
---|
78 | {
|
---|
79 | fBinningResolutionHiGain = rh;
|
---|
80 | fBinningResolutionLoGain = rl;
|
---|
81 | }
|
---|
82 |
|
---|
83 | void SetWindowSize( Int_t windowh, Int_t windowl);
|
---|
84 | const char* GetNameWeightsFile() const { return fNameWeightsFile.Data(); }
|
---|
85 |
|
---|
86 | void Print(Option_t *o="") const; //*MENU*
|
---|
87 |
|
---|
88 | void FindTimeAndChargeHiGain2(const Float_t *firstused, Int_t num, Float_t &sum, Float_t &dsum,
|
---|
89 | Float_t &time, Float_t &dtime,
|
---|
90 | Byte_t sat, Int_t maxpos) const;
|
---|
91 |
|
---|
92 | void FindTimeAndChargeLoGain2(const Float_t *firstused, Int_t num, Float_t &sum, Float_t &dsum,
|
---|
93 | Float_t &time, Float_t &dtime,
|
---|
94 | Byte_t sat, Int_t maxpos) const;
|
---|
95 |
|
---|
96 | ClassDef(MExtractTimeAndChargeDigitalFilter, 2) // Hendrik's digital filter
|
---|
97 | };
|
---|
98 |
|
---|
99 | #endif
|
---|