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

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