| 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 MCalibrationPattern;
|
|---|
| 20 |
|
|---|
| 21 | class MExtractTimeAndChargeDigitalFilter : public MExtractTimeAndCharge
|
|---|
| 22 | {
|
|---|
| 23 | private:
|
|---|
| 24 | static const Byte_t fgHiGainFirst; //! Default for fHiGainFirst (now set to: 0)
|
|---|
| 25 | static const Byte_t fgHiGainLast; //! Default for fHiGainLast (now set to:14)
|
|---|
| 26 | static const Byte_t fgLoGainFirst; //! Default for fLoGainFirst (now set to: 3)
|
|---|
| 27 | static const Byte_t fgLoGainLast; //! Default for fLoGainLast (now set to:14)
|
|---|
| 28 | // static const Int_t fgWindowSizeHiGain; //! Default for fWindowSizeHiGain (now set to: 6)
|
|---|
| 29 | // static const Int_t fgWindowSizeLoGain; //! Default for fWindowSizeLoGain (now set to: 6)
|
|---|
| 30 | static const Int_t fgBinningResolutionHiGain; //! Default for fBinningResolutionHiGain (now set to: 10)
|
|---|
| 31 | static const Int_t fgBinningResolutionLoGain; //! Default for fBinningResolutionLoGain (now set to: 10)
|
|---|
| 32 | static const Int_t fgSignalStartBinHiGain; //! Default for fSignalStartBinHiGain (now set to: 4)
|
|---|
| 33 | static const Int_t fgSignalStartBinLoGain; //! Default for fSignalStartBinLoGain (now set to: 4)
|
|---|
| 34 | static const TString fgNameWeightsFile; //! "cosmics_weights.dat"
|
|---|
| 35 | static const Float_t fgOffsetLoGain; //! Default for fOffsetLoGain (now set to 1.7)
|
|---|
| 36 | // static const Float_t fgLoGainStartShift; //! Default for fLoGainStartShift (now set to -1.8)
|
|---|
| 37 |
|
|---|
| 38 | MCalibrationPattern *fCalibPattern; //! Calibration DM pattern
|
|---|
| 39 |
|
|---|
| 40 | // MArrayF fHiGainSignal; //! Need fast access to the signals in a float way
|
|---|
| 41 | // MArrayF fLoGainSignal; //! Store them in separate arrays
|
|---|
| 42 |
|
|---|
| 43 | // Int_t fSignalStartBinHiGain; //! Start bin from when on to apply weights
|
|---|
| 44 | // Int_t fSignalStartBinLoGain; //! Start bin from when on to apply weights
|
|---|
| 45 |
|
|---|
| 46 | Int_t fBinningResolutionHiGain; // Number of weights per bin High-Gain
|
|---|
| 47 | Int_t fBinningResolutionLoGain; // Number of weights per bin Low-Gain
|
|---|
| 48 |
|
|---|
| 49 | MArrayF fAmpWeightsHiGain; //! Amplitude weights High-Gain (from weights file)
|
|---|
| 50 | MArrayF fTimeWeightsHiGain; //! Time weights High-Gain (from weights file)
|
|---|
| 51 | MArrayF fAmpWeightsLoGain; //! Amplitude weights Low-Gain (from weights file)
|
|---|
| 52 | MArrayF fTimeWeightsLoGain; //! Time weights Low-Gain (from weights file)
|
|---|
| 53 |
|
|---|
| 54 | MArrayF fPulseHiGain; //!
|
|---|
| 55 | MArrayF fPulseLoGain; //!
|
|---|
| 56 |
|
|---|
| 57 | TString fNameWeightsFile; // Name of the weights file
|
|---|
| 58 | Bool_t fAutomaticWeights; // Flag whether weight should be determined automatically
|
|---|
| 59 | TString fNameWeightsFileSet; //! Flag if weights have alreayd been set
|
|---|
| 60 | Int_t fRandomIter; //! Counter used to randomize weights for noise calculation
|
|---|
| 61 |
|
|---|
| 62 | // MExtractTimeAndChargeDigitalFilter
|
|---|
| 63 | void CalcBinningResArrays();
|
|---|
| 64 | Int_t GetAutomaticWeights();
|
|---|
| 65 | Bool_t GetWeights();
|
|---|
| 66 | Int_t ReadWeightsFile(TString filename, TString path="");
|
|---|
| 67 | TString CompileWeightFileName(TString path, const TString &name) const;
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 | // MExtractTimeAndCharge
|
|---|
| 71 | Bool_t InitArrays();
|
|---|
| 72 |
|
|---|
| 73 | // MTask
|
|---|
| 74 | Int_t PreProcess(MParList *pList);
|
|---|
| 75 | Int_t Process();
|
|---|
| 76 |
|
|---|
| 77 | protected:
|
|---|
| 78 | // MParContainer
|
|---|
| 79 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
|---|
| 80 |
|
|---|
| 81 | public:
|
|---|
| 82 | MExtractTimeAndChargeDigitalFilter(const char *name=NULL, const char *title=NULL);
|
|---|
| 83 | ~MExtractTimeAndChargeDigitalFilter() { }
|
|---|
| 84 | /*
|
|---|
| 85 | Bool_t WriteWeightsFile(TString filename,
|
|---|
| 86 | TH1F *shapehi, TH2F *autocorrhi,
|
|---|
| 87 | TH1F *shapelo=NULL, TH2F *autocorrlo=NULL );
|
|---|
| 88 |
|
|---|
| 89 | */
|
|---|
| 90 | void SetNameWeightsFile(TString s="")
|
|---|
| 91 | {
|
|---|
| 92 | s.ReplaceAll("\015", ""); // This is a fix for TEnv files edited with windows editors
|
|---|
| 93 | fNameWeightsFile = s;
|
|---|
| 94 | fNameWeightsFileSet="";
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | void EnableAutomaticWeights(Bool_t b=kTRUE) { fAutomaticWeights = b; }
|
|---|
| 98 |
|
|---|
| 99 | void SetBinningResolution(const Int_t rh=fgBinningResolutionHiGain, const Int_t rl=fgBinningResolutionLoGain)
|
|---|
| 100 | {
|
|---|
| 101 | fBinningResolutionHiGain = rh & ~1;
|
|---|
| 102 | fBinningResolutionLoGain = rl & ~1;
|
|---|
| 103 | }
|
|---|
| 104 | /*
|
|---|
| 105 | void SetSignalStartBin( const Int_t sh=fgSignalStartBinHiGain, const Int_t sl=fgSignalStartBinLoGain)
|
|---|
| 106 | {
|
|---|
| 107 | fSignalStartBinHiGain = sh;
|
|---|
| 108 | fSignalStartBinLoGain = sl;
|
|---|
| 109 | }
|
|---|
| 110 |
|
|---|
| 111 | */
|
|---|
| 112 | void SetWindowSize( Int_t windowh, Int_t windowl);
|
|---|
| 113 | const char* GetNameWeightsFile() const { return fNameWeightsFile.Data(); }
|
|---|
| 114 |
|
|---|
| 115 | void Print(Option_t *o="") const; //*MENU*
|
|---|
| 116 | /*
|
|---|
| 117 | void FindTimeAndChargeHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Float_t &dsum,
|
|---|
| 118 | Float_t &time, Float_t &dtime,
|
|---|
| 119 | Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
|
|---|
| 120 | void FindTimeAndChargeLoGain(Byte_t *firstused, Float_t &sum, Float_t &dsum,
|
|---|
| 121 | Float_t &time, Float_t &dtime,
|
|---|
| 122 | Byte_t &sat, const MPedestalPix &ped, const Bool_t abflag);
|
|---|
| 123 | */
|
|---|
| 124 | void FindTimeAndChargeHiGain2(const Float_t *firstused, Int_t num, Float_t &sum, Float_t &dsum,
|
|---|
| 125 | Float_t &time, Float_t &dtime,
|
|---|
| 126 | Byte_t sat, Int_t maxpos);
|
|---|
| 127 |
|
|---|
| 128 | void FindTimeAndChargeLoGain2(const Float_t *firstused, Int_t num, Float_t &sum, Float_t &dsum,
|
|---|
| 129 | Float_t &time, Float_t &dtime,
|
|---|
| 130 | Byte_t sat, Int_t maxpos);
|
|---|
| 131 |
|
|---|
| 132 | ClassDef(MExtractTimeAndChargeDigitalFilter, 2) // Hendrik's digital filter
|
|---|
| 133 | };
|
|---|
| 134 |
|
|---|
| 135 | #endif
|
|---|