| 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 SIMOFFSET_H
 | 
|---|
| 9 | #define SIMOFFSET_H
 | 
|---|
| 10 | 
 | 
|---|
| 11 | #include "toiprocessor.h"
 | 
|---|
| 12 | #include "tvector.h"
 | 
|---|
| 13 | 
 | 
|---|
| 14 | // ---- Calcul de ligne de base 
 | 
|---|
| 15 | //      Ajustement polynomial sur des echantillons moyennes
 | 
|---|
| 16 | //
 | 
|---|
| 17 | // Structure generale :
 | 
|---|
| 18 | // 
 | 
|---|
| 19 | //               -------------------------
 | 
|---|
| 20 | //    toi in --> |                       | ---> out  (toi = in_offset)
 | 
|---|
| 21 | //               | SimpleOffsetEstimator | ---> offset (toi) 
 | 
|---|
| 22 | //  bgal(opt)--> |                       | ---> Autres toi optionnel
 | 
|---|
| 23 | //               |                       |
 | 
|---|
| 24 | //               -------------------------
 | 
|---|
| 25 | 
 | 
|---|
| 26 | class SimpleOffsetEstimator : public TOIProcessor {
 | 
|---|
| 27 | public:
 | 
|---|
| 28 |            SimpleOffsetEstimator(int mwsz=256, int nptfit=5, int degpol=2);
 | 
|---|
| 29 |   virtual  ~SimpleOffsetEstimator();
 | 
|---|
| 30 | 
 | 
|---|
| 31 |   void     SetParams(int mwsz=256, int nptfit=5, int degpol=2);
 | 
|---|
| 32 |   virtual void  init();  
 | 
|---|
| 33 |   virtual void  run();
 | 
|---|
| 34 | 
 | 
|---|
| 35 |   virtual void  SetBGalCut(double bmin, double bmax);
 | 
|---|
| 36 | 
 | 
|---|
| 37 |   inline int_8  ProcessedSampleCount() const { return totnscount; }
 | 
|---|
| 38 | 
 | 
|---|
| 39 |   virtual void  PrintStatus(::ostream & os) ; // const plus tard
 | 
|---|
| 40 | 
 | 
|---|
| 41 |   inline  void  SavePolyNTuple(bool fg=false, string name="") { ntpoly = fg; ntpolyname=name; }
 | 
|---|
| 42 | protected:
 | 
|---|
| 43 |   virtual double ApplyPoly(double x);
 | 
|---|
| 44 |   virtual void   FitPoly(Vector& X0, Vector& Y, Vector& YErr);
 | 
|---|
| 45 | 
 | 
|---|
| 46 |   int_8 totnscount;   // Nombre total d'echantillon processe
 | 
|---|
| 47 |   int_8 totnbblock;   // Nombre total de blocs 
 | 
|---|
| 48 |   int mWSz;
 | 
|---|
| 49 |   int nPtFit;
 | 
|---|
| 50 |   int degPol;
 | 
|---|
| 51 |   //  Poly poly;   Pb SEGV lors de Poly.Fit
 | 
|---|
| 52 |   Vector poly;
 | 
|---|
| 53 |   int_4 npb_fitpoly;
 | 
|---|
| 54 |   bool ntpoly;
 | 
|---|
| 55 |   string ntpolyname;
 | 
|---|
| 56 |   double bmincut, bmaxcut;
 | 
|---|
| 57 |   bool bgalcut;
 | 
|---|
| 58 |   int_4 ns_flgcut;
 | 
|---|
| 59 |   int_4 ns_bgalcut;
 | 
|---|
| 60 | };
 | 
|---|
| 61 | 
 | 
|---|
| 62 | #endif
 | 
|---|