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

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