[763] | 1 | #ifndef HISPROF_SEEN
|
---|
| 2 | #define HISPROF_SEEN
|
---|
| 3 |
|
---|
| 4 | #include <stdio.h>
|
---|
| 5 | #include "peida.h"
|
---|
| 6 | #include "tvector.h"
|
---|
| 7 | #include "ppersist.h"
|
---|
| 8 | #include "histos.h"
|
---|
| 9 |
|
---|
| 10 | namespace SOPHYA {
|
---|
| 11 |
|
---|
[926] | 12 | //! 1 dimension profile histograms
|
---|
[763] | 13 | class HProf : public Histo {
|
---|
| 14 | friend class ObjFileIO<HProf>;
|
---|
| 15 | public:
|
---|
| 16 |
|
---|
| 17 | // CREATOR / DESTRUCTOR
|
---|
| 18 | HProf();
|
---|
[1092] | 19 | HProf(r_8 xMin, r_8 xMax, int_4 nBin=100, r_8 yMin=1., r_8 yMax=-1.);
|
---|
| 20 | HProf(r_4 xMin, r_4 xMax, int_4 nBin=100, r_4 yMin=1., r_4 yMax=-1.);
|
---|
[763] | 21 | HProf(const HProf& H);
|
---|
| 22 | virtual ~HProf();
|
---|
| 23 |
|
---|
| 24 | // UPDATING or SETTING
|
---|
[1135] | 25 | virtual void UpdateHisto(bool force=false) const;
|
---|
| 26 |
|
---|
[1056] | 27 | void SetErrOpt(bool spread = true);
|
---|
| 28 | void Zero();
|
---|
[1092] | 29 | void Add(r_8 x, r_8 y, r_8 w = 1.);
|
---|
| 30 | void AddBin(int_4 numBin, r_8 y, r_8 w = 1.);
|
---|
[763] | 31 |
|
---|
| 32 | // Acces a l information
|
---|
[914] | 33 | //! Retourne l'histogramme de profil.
|
---|
[943] | 34 | inline Histo GetHisto()
|
---|
[1089] | 35 | {UpdateHisto(); return (Histo) *this;}
|
---|
[914] | 36 | //! Retourne le contenu de la moyenne dans le vecteur v
|
---|
[1056] | 37 | inline void GetValue(TVector<r_8>& v)
|
---|
[1089] | 38 | {UpdateHisto(); Histo::GetValue(v);}
|
---|
[914] | 39 | //! Retourne le contenu au carre de la dispersion/erreur dans le vecteur v
|
---|
[943] | 40 | inline void GetError2(TVector<r_8>& v)
|
---|
[1089] | 41 | {UpdateHisto(); Histo::GetError2(v);}
|
---|
[1056] | 42 | //! Retourne le contenu au carre de la dispersion/erreur dans le vecteur v
|
---|
| 43 | inline void GetError(TVector<r_8>& v)
|
---|
[1089] | 44 | {UpdateHisto(); Histo::GetError(v);}
|
---|
[914] | 45 | //! Retourne le contenu du bin i
|
---|
[1092] | 46 | inline r_8 operator()(int_4 i) const
|
---|
| 47 | {UpdateHisto(); return mData[i];}
|
---|
[914] | 48 | //! Retourne le carre de la dispersion/erreur du bin i
|
---|
[1092] | 49 | inline r_8 Error2(int_4 i) const
|
---|
| 50 | {UpdateHisto(); return mErr2[i];}
|
---|
[914] | 51 | //! Retourne la dispersion/erreur du bin i
|
---|
[1092] | 52 | inline r_8 Error(int_4 i) const
|
---|
[1089] | 53 | {UpdateHisto();
|
---|
[1092] | 54 | return (mErr2[i]>0.) ? sqrt(mErr2[i]) : 0.;}
|
---|
[763] | 55 |
|
---|
| 56 | // Operators
|
---|
| 57 | HProf& operator = (const HProf& h);
|
---|
| 58 | HProf& operator += (const HProf& a);
|
---|
| 59 |
|
---|
[1058] | 60 | // Info, statistique et calculs sur les histogrammes
|
---|
[1092] | 61 | virtual void HRebin(int_4 nbinew);
|
---|
[1058] | 62 |
|
---|
[914] | 63 | //! Print, voir detail dans Histo::Print
|
---|
[1092] | 64 | inline void Print(int_4 dyn=100,r_8 hmin=1.,r_8 hmax=-1.
|
---|
| 65 | ,int_4 pflag=0,int_4 il=1,int_4 ih=-1)
|
---|
[1089] | 66 | {UpdateHisto(); Histo::Print(dyn,hmin,hmax,pflag,il,ih);}
|
---|
[763] | 67 |
|
---|
| 68 | protected:
|
---|
| 69 | void Delete();
|
---|
[1089] | 70 | void updatehisto() const;
|
---|
[763] | 71 |
|
---|
[1092] | 72 | r_8* SumY; //!< somme
|
---|
| 73 | r_8* SumY2; //!< somme des carres
|
---|
| 74 | r_8* SumW; //!< somme des poids
|
---|
| 75 | mutable bool Ok; //!< true if update fait
|
---|
| 76 | r_8 YMin; //!< limite minimum Y pour somme
|
---|
| 77 | r_8 YMax; //!< limite maximum Y pour somme
|
---|
| 78 | uint_2 Opt; //!< options pour les erreurs
|
---|
[763] | 79 | };
|
---|
| 80 |
|
---|
| 81 |
|
---|
[958] | 82 | /*! \ingroup HiStats \fn operator<<(POuttPersist&, HProf)
|
---|
| 83 | \brief Persistance management */
|
---|
[763] | 84 | inline POutPersist& operator << (POutPersist& os, HProf & obj)
|
---|
| 85 | { ObjFileIO<HProf> fio(&obj); fio.Write(os); return(os); }
|
---|
[958] | 86 | /*! \ingroup HiStats \fn operator>>(PInPersist&, HProf)
|
---|
| 87 | \brief Persistance management */
|
---|
[763] | 88 | inline PInPersist& operator >> (PInPersist& is, HProf & obj)
|
---|
| 89 | { ObjFileIO<HProf> fio(&obj); fio.Read(is); return(is); }
|
---|
| 90 | // Classe pour la gestion de persistance
|
---|
| 91 | // ObjFileIO<HProf>
|
---|
| 92 |
|
---|
[1053] | 93 | /*! \ingroup HiStats \fn operator+(const HProf&, const HProf&)
|
---|
| 94 | \brief Operateur H = H1 + H2
|
---|
| 95 | \warning Meme commentaire que pour l'operateur +=
|
---|
| 96 | */
|
---|
| 97 | inline HProf operator + (const HProf& a, const HProf& b)
|
---|
| 98 | {
|
---|
| 99 | if (b.NBins()!=a.NBins()) THROW(sizeMismatchErr);
|
---|
| 100 | HProf c(a);
|
---|
| 101 | return (c += b);
|
---|
| 102 | }
|
---|
[763] | 103 |
|
---|
| 104 | } // Fin du namespace
|
---|
| 105 |
|
---|
| 106 | #endif // HISPROF_SEEN
|
---|