source: trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.h@ 7170

Last change on this file since 7170 was 7099, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 5.9 KB
Line 
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
16class TH1F;
17class TH2F;
18class MPedestalPix;
19class MCalibrationPattern;
20
21class MExtractTimeAndChargeDigitalFilter : public MExtractTimeAndCharge
22{
23private:
24 static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 0)
25 static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to:14)
26 static const Byte_t fgLoGainFirst; //! Default for fLoGainFirst (now set to: 3)
27 static const Byte_t fgLoGainLast; //! Default for fLoGainLast (now set to:14)
28 static const Int_t fgWindowSizeHiGain; //! Default for fWindowSizeHiGain (now set to: 6)
29 static const Int_t fgWindowSizeLoGain; //! Default for fWindowSizeLoGain (now set to: 6)
30 static const Int_t fgBinningResolutionHiGain; //! Default for fBinningResolutionHiGain (now set to: 10)
31 static const Int_t fgBinningResolutionLoGain; //! Default for fBinningResolutionLoGain (now set to: 10)
32 static const Int_t fgSignalStartBinHiGain; //! Default for fSignalStartBinHiGain (now set to: 4)
33 static const Int_t fgSignalStartBinLoGain; //! Default for fSignalStartBinLoGain (now set to: 4)
34 static const TString fgNameWeightsFile; //! "cosmics_weights.dat"
35 static const Float_t fgOffsetLoGain; //! Default for fOffsetLoGain (now set to 1.7)
36 static const Float_t fgLoGainStartShift; //! Default for fLoGainStartShift (now set to -1.8)
37
38 MCalibrationPattern *fCalibPattern; //! Calibration DM pattern
39
40 MArrayF fHiGainSignal; //! Need fast access to the signals in a float way
41 MArrayF fLoGainSignal; //! Store them in separate arrays
42
43 MArrayI fArrBinningResHiGain; //! helping arrays to hold binningres * i
44 MArrayI fArrBinningResLoGain; //! helping arrays to hold binningres * i
45 MArrayI fArrBinningResHalfHiGain; //! helping arrays to hold binningres * i + binningreshalf
46 MArrayI fArrBinningResHalfLoGain; //! helping arrays to hold binningres * i + binningreshalf
47
48 Float_t fTimeShiftHiGain; // Time shift from when on to apply the filter
49 Float_t fTimeShiftLoGain; // Time shift from when on to apply the filter
50
51 Int_t fSignalStartBinHiGain; //! Start bin from when on to apply weights
52 Int_t fSignalStartBinLoGain; //! Start bin from when on to apply weights
53
54 Int_t fBinningResolutionHiGain; // Number of weights per bin High-Gain
55 Int_t fBinningResolutionHalfHiGain; // Half Number of weights per bin High-Gain
56 Int_t fBinningResolutionLoGain; // Number of weights per bin Low-Gain
57 Int_t fBinningResolutionHalfLoGain; // Half Number of weights per bin Low-Gain
58
59 MArrayF fAmpWeightsHiGain; //! Amplitude weights High-Gain (from weights file)
60 MArrayF fTimeWeightsHiGain; //! Time weights High-Gain (from weights file)
61 MArrayF fAmpWeightsLoGain; //! Amplitude weights Low-Gain (from weights file)
62 MArrayF fTimeWeightsLoGain; //! Time weights Low-Gain (from weights file)
63
64 TString fNameWeightsFile; // Name of the weights file
65 Bool_t fAutomaticWeights; // Flag whether weight should be determined automatically
66 TString fNameWeightsFileSet; //! Flag if weights have alreayd been set
67 Int_t fRandomIter; //! Counter used to randomize weights for noise calculation
68
69 // MExtractTimeAndChargeDigitalFilter
70 void CalcBinningResArrays();
71 Bool_t ReadAutomaticWeightsFile();
72
73 // MExtractTimeAndCharge
74 Bool_t InitArrays();
75
76 // MTask
77 Int_t PreProcess(MParList *pList);
78
79protected:
80 // MParContainer
81 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
82
83public:
84 MExtractTimeAndChargeDigitalFilter(const char *name=NULL, const char *title=NULL);
85 ~MExtractTimeAndChargeDigitalFilter() { }
86
87 Bool_t ReadWeightsFile(TString filename);
88
89 Bool_t WriteWeightsFile(TString filename,
90 TH1F *shapehi, TH2F *autocorrhi,
91 TH1F *shapelo=NULL, TH2F *autocorrlo=NULL );
92
93
94 void SetNameWeightsFile(TString s="") { fNameWeightsFile = s; fNameWeightsFileSet=""; }
95 void EnableAutomaticWeights(Bool_t b=kTRUE) { fAutomaticWeights = b; }
96
97 void SetBinningResolution(const Int_t rh=fgBinningResolutionHiGain, const Int_t rl=fgBinningResolutionLoGain) {
98 fBinningResolutionHiGain = rh & ~1;
99 fBinningResolutionHalfHiGain = fBinningResolutionHiGain/2;
100 fBinningResolutionLoGain = rl & ~1;
101 fBinningResolutionHalfLoGain = fBinningResolutionLoGain/2;
102 }
103
104 void SetSignalStartBin( const Int_t sh=fgSignalStartBinHiGain, const Int_t sl=fgSignalStartBinLoGain) {
105 fSignalStartBinHiGain = sh;
106 fSignalStartBinLoGain = sl;
107 }
108
109 void SetWindowSize( Int_t windowh=fgWindowSizeHiGain, Int_t windowl=fgWindowSizeLoGain);
110
111 const char* GetNameWeightsFile() const { return fNameWeightsFile.Data(); }
112
113 void Print(Option_t *o="") const; //*MENU*
114
115 void FindTimeAndChargeHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Float_t &dsum,
116 Float_t &time, Float_t &dtime,
117 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
118 void FindTimeAndChargeLoGain(Byte_t *firstused, Float_t &sum, Float_t &dsum,
119 Float_t &time, Float_t &dtime,
120 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
121
122 ClassDef(MExtractTimeAndChargeDigitalFilter, 2) // Hendrik's digital filter
123};
124
125#endif
Note: See TracBrowser for help on using the repository browser.