| 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 |
|
|---|
| 16 | class TH1F;
|
|---|
| 17 | class TH2F;
|
|---|
| 18 | class MPedestalPix;
|
|---|
| 19 | class MExtractTimeAndChargeDigitalFilter : public MExtractTimeAndCharge
|
|---|
| 20 | {
|
|---|
| 21 | private:
|
|---|
| 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.7)
|
|---|
| 35 | static const Float_t fgLoGainStartShift; //! Default for fLoGainStartShift (now set to -1.8)
|
|---|
| 36 |
|
|---|
| 37 | MArrayF fHiGainSignal; //! Need fast access to the signals in a float way
|
|---|
| 38 | MArrayF fLoGainSignal; //! Store them in separate arrays
|
|---|
| 39 |
|
|---|
| 40 | MArrayI fArrBinningResHiGain; //! helping arrays to hold binningres * i
|
|---|
| 41 | MArrayI fArrBinningResLoGain; //! helping arrays to hold binningres * i
|
|---|
| 42 | MArrayI fArrBinningResHalfHiGain; //! helping arrays to hold binningres * i + binningreshalf
|
|---|
| 43 | MArrayI fArrBinningResHalfLoGain; //! helping arrays to hold binningres * i + binningreshalf
|
|---|
| 44 |
|
|---|
| 45 | Float_t fTimeShiftHiGain; // Time shift from when on to apply the filter
|
|---|
| 46 | Float_t fTimeShiftLoGain; // Time shift from when on to apply the filter
|
|---|
| 47 |
|
|---|
| 48 | Int_t fSignalStartBinHiGain; //! Start bin from when on to apply weights
|
|---|
| 49 | Int_t fSignalStartBinLoGain; //! Start bin from when on to apply weights
|
|---|
| 50 |
|
|---|
| 51 | Int_t fBinningResolutionHiGain; // Number of weights per bin High-Gain
|
|---|
| 52 | Int_t fBinningResolutionHalfHiGain; // Half Number of weights per bin High-Gain
|
|---|
| 53 | Int_t fBinningResolutionLoGain; // Number of weights per bin Low-Gain
|
|---|
| 54 | Int_t fBinningResolutionHalfLoGain; // Half Number of weights per bin Low-Gain
|
|---|
| 55 |
|
|---|
| 56 | MArrayF fAmpWeightsHiGain; //! Amplitude weights High-Gain (from weights file)
|
|---|
| 57 | MArrayF fTimeWeightsHiGain; //! Time weights High-Gain (from weights file)
|
|---|
| 58 | MArrayF fAmpWeightsLoGain; //! Amplitude weights Low-Gain (from weights file)
|
|---|
| 59 | MArrayF fTimeWeightsLoGain; //! Time weights Low-Gain (from weights file)
|
|---|
| 60 |
|
|---|
| 61 | TString fNameWeightsFile; // Name of the weights file
|
|---|
| 62 | Bool_t fWeightsSet; //! Flag if weights have alreayd been set
|
|---|
| 63 | Int_t fRandomIter; //! Counter used to randomize weights for noise calculation
|
|---|
| 64 |
|
|---|
| 65 | Bool_t InitArrays();
|
|---|
| 66 |
|
|---|
| 67 | void CalcBinningResArrays();
|
|---|
| 68 |
|
|---|
| 69 | protected:
|
|---|
| 70 |
|
|---|
| 71 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
|---|
| 72 |
|
|---|
| 73 | public:
|
|---|
| 74 |
|
|---|
| 75 | MExtractTimeAndChargeDigitalFilter(const char *name=NULL, const char *title=NULL);
|
|---|
| 76 | ~MExtractTimeAndChargeDigitalFilter() { }
|
|---|
| 77 |
|
|---|
| 78 | Bool_t WriteWeightsFile(TString filename,
|
|---|
| 79 | TH1F *shapehi, TH2F *autocorrhi,
|
|---|
| 80 | TH1F *shapelo=NULL, TH2F *autocorrlo=NULL );
|
|---|
| 81 |
|
|---|
| 82 | Bool_t ReadWeightsFile(TString filename);
|
|---|
| 83 |
|
|---|
| 84 | void SetNameWeightsFile( TString s = fgNameWeightsFile ) { fNameWeightsFile = s; }
|
|---|
| 85 |
|
|---|
| 86 | void SetBinningResolution(const Int_t rh=fgBinningResolutionHiGain, const Int_t rl=fgBinningResolutionLoGain) {
|
|---|
| 87 | fBinningResolutionHiGain = rh & ~1;
|
|---|
| 88 | fBinningResolutionHalfHiGain = fBinningResolutionHiGain/2;
|
|---|
| 89 | fBinningResolutionLoGain = rl & ~1;
|
|---|
| 90 | fBinningResolutionHalfLoGain = fBinningResolutionLoGain/2;
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | void SetSignalStartBin( const Int_t sh=fgSignalStartBinHiGain, const Int_t sl=fgSignalStartBinLoGain) {
|
|---|
| 94 | fSignalStartBinHiGain = sh;
|
|---|
| 95 | fSignalStartBinLoGain = sl;
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | void SetWindowSize( Int_t windowh=fgWindowSizeHiGain, Int_t windowl=fgWindowSizeLoGain);
|
|---|
| 99 |
|
|---|
| 100 | const char* GetNameWeightsFile() const { return fNameWeightsFile.Data(); }
|
|---|
| 101 |
|
|---|
| 102 | void Print(Option_t *o="") const;
|
|---|
| 103 |
|
|---|
| 104 | Bool_t IsWeightsSet() const { return fWeightsSet; }
|
|---|
| 105 |
|
|---|
| 106 | void FindTimeAndChargeHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Float_t &dsum,
|
|---|
| 107 | Float_t &time, Float_t &dtime,
|
|---|
| 108 | Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
|
|---|
| 109 | void FindTimeAndChargeLoGain(Byte_t *firstused, Float_t &sum, Float_t &dsum,
|
|---|
| 110 | Float_t &time, Float_t &dtime,
|
|---|
| 111 | Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
|
|---|
| 112 |
|
|---|
| 113 | ClassDef(MExtractTimeAndChargeDigitalFilter, 2) // Hendrik's digital filter
|
|---|
| 114 | };
|
|---|
| 115 |
|
|---|
| 116 | #endif
|
|---|