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

Last change on this file since 5570 was 5570, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 4.8 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
12class TH1F;
13class TH2F;
14class MPedestalPix;
15class MExtractTimeAndChargeDigitalFilter : public MExtractTimeAndCharge
16{
17private:
18
19 static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 0)
20 static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to:14)
21 static const Byte_t fgLoGainFirst; //! Default for fLoGainFirst (now set to: 3)
22 static const Byte_t fgLoGainLast; //! Default for fLoGainLast (now set to:14)
23 static const Int_t fgWindowSizeHiGain; //! Default for fWindowSizeHiGain (now set to: 6)
24 static const Int_t fgWindowSizeLoGain; //! Default for fWindowSizeLoGain (now set to: 6)
25 static const Int_t fgBinningResolutionHiGain; //! Default for fBinningResolutionHiGain (now set to: 10)
26 static const Int_t fgBinningResolutionLoGain; //! Default for fBinningResolutionLoGain (now set to: 10)
27 static const Int_t fgSignalStartBinHiGain; //! Default for fSignalStartBinHiGain (now set to: 4)
28 static const Int_t fgSignalStartBinLoGain; //! Default for fSignalStartBinLoGain (now set to: 4)
29 static const TString fgNameWeightsFile; //! "cosmics_weights.dat"
30
31 MArrayF fHiGainSignal; //! Need fast access to the signals in a float way
32 MArrayF fLoGainSignal; //! Store them in separate arrays
33
34 Float_t fTimeShiftHiGain; // Time shift from when on to apply the filter
35 Float_t fTimeShiftLoGain; // Time shift from when on to apply the filter
36
37 Int_t fSignalStartBinHiGain; //! Start bin from when on to apply weights
38 Int_t fSignalStartBinLoGain; //! Start bin from when on to apply weights
39
40 Int_t fBinningResolutionHiGain; // Number of weights per bin High-Gain
41 Int_t fBinningResolutionHalfHiGain; // Half Number of weights per bin High-Gain
42 Int_t fBinningResolutionLoGain; // Number of weights per bin Low-Gain
43 Int_t fBinningResolutionHalfLoGain; // Half Number of weights per bin Low-Gain
44
45 MArrayF fAmpWeightsHiGain; //! Amplitude weights High-Gain (from weights file)
46 MArrayF fTimeWeightsHiGain; //! Time weights High-Gain (from weights file)
47 MArrayF fAmpWeightsLoGain; //! Amplitude weights Low-Gain (from weights file)
48 MArrayF fTimeWeightsLoGain; //! Time weights Low-Gain (from weights file)
49
50 TString fNameWeightsFile; //! Name of the weights file
51 Bool_t fWeightsSet; //! Flag if weights have alreayd been set
52 UInt_t fRandomIter; //! Counter used to randomize weights for noise calculation
53
54 Bool_t InitArrays();
55
56 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
57
58public:
59
60 MExtractTimeAndChargeDigitalFilter(const char *name=NULL, const char *title=NULL);
61 ~MExtractTimeAndChargeDigitalFilter() { }
62
63 Bool_t WriteWeightsFile(TString filename,
64 TH1F *shapehi, TH2F *autocorrhi,
65 TH1F *shapelo=NULL, TH2F *autocorrlo=NULL );
66
67 Bool_t ReadWeightsFile(TString filename);
68
69 void SetNameWeightsFile( TString s = fgNameWeightsFile ) { fNameWeightsFile = s; }
70
71 void SetBinningResolution(const Int_t rh=fgBinningResolutionHiGain, const Int_t rl=fgBinningResolutionLoGain) {
72 fBinningResolutionHiGain = rh & ~1;
73 fBinningResolutionHalfHiGain = fBinningResolutionHiGain/2;
74 fBinningResolutionLoGain = rl & ~1;
75 fBinningResolutionHalfLoGain = fBinningResolutionLoGain/2;
76 }
77
78 void SetSignalStartBin( const Int_t sh=fgSignalStartBinHiGain, const Int_t sl=fgSignalStartBinLoGain) {
79 fSignalStartBinHiGain = sh;
80 fSignalStartBinLoGain = sl;
81 }
82
83 void SetWindowSize( Int_t windowh=fgWindowSizeHiGain, Int_t windowl=fgWindowSizeLoGain);
84
85 const char* GetNameWeightsFile() const { return fNameWeightsFile.Data(); }
86
87 void Print(Option_t *o="") const;
88
89 Bool_t IsWeightsSet() const { return fWeightsSet; }
90
91 void FindTimeAndChargeHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Float_t &dsum,
92 Float_t &time, Float_t &dtime,
93 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
94 void FindTimeAndChargeLoGain(Byte_t *firstused, Float_t &sum, Float_t &dsum,
95 Float_t &time, Float_t &dtime,
96 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
97
98 ClassDef(MExtractTimeAndChargeDigitalFilter, 1) // Hendrik's digital filter
99};
100
101#endif
Note: See TracBrowser for help on using the repository browser.