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

Last change on this file since 5513 was 5511, checked in by gaug, 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 ReInit(MParList *pList);
55
56 Bool_t InitArrays();
57
58 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
59
60public:
61
62 MExtractTimeAndChargeDigitalFilter(const char *name=NULL, const char *title=NULL);
63
64 Bool_t WriteWeightsFile(TString filename,
65 TH1F *shapehi, TH2F *autocorrhi,
66 TH1F *shapelo=NULL, TH2F *autocorrlo=NULL );
67
68 Bool_t ReadWeightsFile(TString filename);
69
70 void SetNameWeightsFile( TString s = fgNameWeightsFile ) { fNameWeightsFile = s; }
71
72 void SetBinningResolution(const Int_t rh=fgBinningResolutionHiGain, const Int_t rl=fgBinningResolutionLoGain) {
73 fBinningResolutionHiGain = rh & ~1;
74 fBinningResolutionHalfHiGain = fBinningResolutionHiGain/2;
75 fBinningResolutionLoGain = rl & ~1;
76 fBinningResolutionHalfLoGain = fBinningResolutionLoGain/2;
77 }
78
79 void SetSignalStartBin( const Int_t sh=fgSignalStartBinHiGain, const Int_t sl=fgSignalStartBinLoGain) {
80 fSignalStartBinHiGain = sh;
81 fSignalStartBinLoGain = sl;
82 }
83
84 void SetWindowSize( Int_t windowh=fgWindowSizeHiGain, Int_t windowl=fgWindowSizeLoGain);
85
86 const char* GetNameWeightsFile() const { return fNameWeightsFile.Data(); }
87
88 void Print(Option_t *o="") const;
89
90 Bool_t IsWeightsSet() const { return fWeightsSet; }
91
92 void FindTimeAndChargeHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Float_t &dsum,
93 Float_t &time, Float_t &dtime,
94 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
95 void FindTimeAndChargeLoGain(Byte_t *firstused, Float_t &sum, Float_t &dsum,
96 Float_t &time, Float_t &dtime,
97 Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
98
99 ClassDef(MExtractTimeAndChargeDigitalFilter, 1) // Hendrik's digital filter
100};
101
102#endif
Note: See TracBrowser for help on using the repository browser.