[2014] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 |
|
---|
| 3 | // ArchTOIPipe (C) CEA/DAPNIA/SPP IN2P3/LAL
|
---|
| 4 | // Eric Aubourg
|
---|
| 5 | // Christophe Magneville
|
---|
| 6 | // Reza Ansari
|
---|
| 7 |
|
---|
| 8 | #ifndef SIMCLEANER_H
|
---|
| 9 | #define SIMCLEANER_H
|
---|
| 10 |
|
---|
| 11 | #include "toiprocessor.h"
|
---|
| 12 | #include "tvector.h"
|
---|
[2048] | 13 | #include "ntuple.h"
|
---|
[2014] | 14 |
|
---|
| 15 | // ---- Calcul de ligne de base
|
---|
| 16 | // Ajustement polynomial sur des echantillons moyennes
|
---|
| 17 | //
|
---|
| 18 | // Structure generale :
|
---|
| 19 | //
|
---|
| 20 | // -------------------------
|
---|
| 21 | // toi in --> | | ---> out = i+flag updated
|
---|
| 22 | // | SimpleCleaner | ---> mean (opt)
|
---|
| 23 | // | | ---> sigma (opt)
|
---|
| 24 | // | |
|
---|
| 25 | // -------------------------
|
---|
| 26 |
|
---|
| 27 | class SimpleCleaner : public TOIProcessor {
|
---|
| 28 | public:
|
---|
| 29 | SimpleCleaner(int wsz=256, int nbw=5);
|
---|
| 30 | virtual ~SimpleCleaner();
|
---|
| 31 |
|
---|
| 32 | void SetMeanSigWindow(int wsz=256, int nbw=5);
|
---|
| 33 |
|
---|
[2048] | 34 | inline void FillMeanSigNTuple(bool fg = false)
|
---|
| 35 | { fg_meansignt = fg; }
|
---|
| 36 | inline NTuple& GetMeanSigNTuple() { return *meansignt; }
|
---|
| 37 |
|
---|
[2014] | 38 | inline void SetRange(double min=-9.e19, double max=+9.e19)
|
---|
| 39 | { range_min = min; range_max = max; }
|
---|
| 40 | inline void GetRange(double& min, double& max) const
|
---|
| 41 | { min = range_min; max = range_max; }
|
---|
| 42 | inline void SetCleanForMeanThrNSig(double ns=3.)
|
---|
| 43 | { nsigclean = ns; }
|
---|
| 44 | inline double GetCleanForMeanThrNSig()
|
---|
| 45 | { return(nsigclean); }
|
---|
| 46 | inline void SetFlaggingThrNSig(double ns1=4., double ns2=2., int npt2=3)
|
---|
| 47 | { nsig1 = ns1; nsig2 = ns2; min_npt2 = npt2; }
|
---|
| 48 | inline void GetFlaggingThrNSig(double& ns1, double& ns2, int& npt2)
|
---|
| 49 | { ns1 = nsig1; ns2 = nsig2; npt2 = npt2; }
|
---|
| 50 |
|
---|
| 51 | inline double GetGlMean() { return( (ns_glms > 0) ? gl_sum/ns_glms : 0.) ; }
|
---|
| 52 | inline double GetGlSigma2()
|
---|
| 53 | {
|
---|
| 54 | double m = GetGlMean();
|
---|
| 55 | return( (ns_glms > 0) ? gl_sum2/ns_glms-m*m : 0.) ;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | inline int_4 GetGLMSNbSample() { return ns_glms; }
|
---|
| 59 |
|
---|
| 60 | virtual void init();
|
---|
| 61 | virtual void run();
|
---|
| 62 |
|
---|
| 63 | inline int_8 ProcessedSampleCount() const { return totnscount; }
|
---|
| 64 |
|
---|
| 65 | virtual void PrintStatus(::ostream & os) ; // const plus tard
|
---|
| 66 |
|
---|
| 67 | protected:
|
---|
| 68 | int_8 totnscount; // Nombre total d'echantillon processe
|
---|
| 69 | int_8 totnbblock; // Nombre total de blocs
|
---|
| 70 | int mWSz; // Fentre Calcul mean-sigma : mNbW*mWSz
|
---|
| 71 | int mNbW; // " " " " "
|
---|
| 72 | double nsigclean; // Point a +- nsig4mean pas pris en compte pour calcul mean
|
---|
| 73 | double nsig1; // Point a +- nsig1 flagge
|
---|
| 74 | double nsig2; // >=min_npt2 Points a +- nsig2 flagges
|
---|
| 75 | int min_npt2; // Min NPoints a += nsig2
|
---|
| 76 | double range_min, range_max; // Range acceptable pour in
|
---|
| 77 | int_4 ns_outofrange; // Nb de points out of range
|
---|
| 78 | int_4 ns_flag1p; // Nb de points flagges avec nsig1 (> mean)
|
---|
| 79 | int_4 ns_flag2p; // Nb de points flagges avec nsig2 (> mean)
|
---|
| 80 | int_4 ns_flag1m; // Nb de points flagges avec nsig1 (< mean)
|
---|
| 81 | int_4 ns_flag2m; // Nb de points flagges avec nsig2 (< mean)
|
---|
| 82 | double gl_sum, gl_sum2; // Global Sum(x) - Sum(x^2)
|
---|
| 83 | int_4 ns_glms; // Nb d'echantillon pour Global Sum(x) - Sum(x^2)
|
---|
[2048] | 84 |
|
---|
| 85 | bool fg_meansignt;
|
---|
| 86 | NTuple* meansignt;
|
---|
[2014] | 87 | };
|
---|
| 88 |
|
---|
| 89 | #endif
|
---|