Changeset 8154 for trunk/MagicSoft/Mars/mextralgo/MExtralgoDigitalFilter.h
- Timestamp:
- 10/24/06 09:26:10 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mextralgo/MExtralgoDigitalFilter.h
r8072 r8154 2 2 #define MARS_MExtralgoDigitalFilter 3 3 4 #ifndef ROOT_T ROOT5 #include <T ROOT.h>4 #ifndef ROOT_TMatrix 5 #include <TMatrix.h> 6 6 #endif 7 7 … … 12 12 class TArrayF; 13 13 14 //#include <TMatrix.h> 15 14 16 class MExtralgoDigitalFilter 15 17 { 16 18 private: 17 19 // Input 18 Float_t *fVal;19 Int_t 20 const Float_t *fVal; 21 Int_t fNum; 20 22 21 23 Float_t const *fWeightsAmp; 22 24 Float_t const *fWeightsTime; 25 Float_t const *fPulseShape; 26 27 const TMatrix *fAinv; 23 28 24 29 const Int_t fWeightsPerBin; // Number of weights per data bin … … 30 35 Float_t fSignal; 31 36 Float_t fSignalDev; 37 38 Float_t GetChisq(const Int_t maxp, const Int_t frac, const Float_t sum) const; 39 40 inline Double_t ChiSq(const Double_t sum, const Int_t startv, const Int_t startw=0) const 41 { 42 // 43 // Slide with a window of size windowsize over the sample 44 // and multiply the entries with the corresponding weights 45 // 46 Double_t chisq = 0; 47 48 // Shift the start of the weight to the center of sample 0 49 Float_t const *w = fPulseShape + startw; 50 51 const Float_t *beg = fVal+startv; 52 for (Float_t const *pex=beg; pex<beg+fWindowSize; pex++) 53 { 54 const Double_t c = *w - *pex/sum; 55 chisq += c*c; 56 w += fWeightsPerBin; 57 } 58 return chisq; 59 } 32 60 33 61 // Weights: Weights to evaluate … … 45 73 Float_t const *w = weights + startw; 46 74 47 Float_t *constbeg = fVal+startv;75 const Float_t *beg = fVal+startv; 48 76 for (Float_t const *pex=beg; pex<beg+fWindowSize; pex++) 49 77 { … … 115 143 116 144 public: 117 MExtralgoDigitalFilter(Int_t res, Int_t windowsize, Float_t *wa, Float_t *wt )145 MExtralgoDigitalFilter(Int_t res, Int_t windowsize, Float_t *wa, Float_t *wt, Float_t *ps=0, TMatrix *ainv=0) 118 146 : fVal(0), fNum(0), fWeightsAmp(wa+res/2), fWeightsTime(wt+res/2), 119 f WeightsPerBin(res), fWindowSize(windowsize),147 fPulseShape(ps), fAinv(ainv), fWeightsPerBin(res), fWindowSize(windowsize), 120 148 fTime(0), fTimeDev(-1), fSignal(0), fSignalDev(-1) 121 149 { 122 150 } 123 151 124 void SetData(Int_t n, Float_t *val) { fNum=n; fVal=val; }152 void SetData(Int_t n, Float_t const *val) { fNum=n; fVal=val; } 125 153 126 154 Float_t GetTime() const { return fTime; } … … 134 162 135 163 Float_t ExtractNoise(Int_t iter) const; 136 void Extract( );164 void Extract(Int_t maxpos=-1); 137 165 138 static Bool_t CalculateWeights(TH1 &shape, const TH2 &autocorr, TArrayF &wa, TArrayF &wt, Int_t wpb=-1);139 static void CalculateWeights2(TH1F &shape, const TH2F&autocorr, TArrayF &wa, TArrayF &wt, Int_t wpb=-1);166 static Int_t CalculateWeights(TH1 &shape, const TH2 &autocorr, TArrayF &wa, TArrayF &wt, Int_t wpb=-1); 167 static Int_t CalculateWeights2(TH1 &shape, const TH2 &autocorr, TArrayF &wa, TArrayF &wt, Int_t wpb=-1); 140 168 }; 141 169
Note:
See TracChangeset
for help on using the changeset viewer.