source: Sophya/trunk/SophyaLib/NTools/ntuple.h@ 297

Last change on this file since 297 was 297, checked in by ansari, 26 years ago

NTuple: Compatibilite NTupleInterface - Reza 15/5/99

File size: 2.0 KB
Line 
1// Class NTuple
2// CMV+Reza Juillet 97
3// CEA-DAPNIA LAL-IN2P3/CNRS
4
5#ifndef NTUPLE_H_SEEN
6#define NTUPLE_H_SEEN
7
8#include <iostream.h>
9#include <string>
10#include <vector>
11
12#if defined(__KCC__)
13using std::string ;
14#include <vector.h>
15#endif
16
17#include "ppersist.h"
18#include "dvlist.h"
19
20
21class NTuple : public PPersist {
22public:
23 enum {classId = ClassId_NTuple };
24
25 NTuple(int nvar, char** noms, int blk=512);
26 NTuple();
27 NTuple(char* flnm);
28 virtual ~NTuple();
29
30 void Fill(r_4* x);
31
32 inline int_4 NEntry() { return(mNEnt); }
33 inline int_4 NVar() { return(mNVar); }
34
35 float GetVal(int n, int k) const;
36 inline float GetVal(int n, char* nom) const
37 { return(GetVal(n, IndexNom(nom)) ); }
38 int IndexNom(const char* nom) const ;
39 char* NomIndex(int k) const;
40 string VarList_C(const char* nomx=NULL) const;
41
42 r_4* GetVec(int n, r_4* ret=NULL) const ;
43 r_8* GetVecD(int n, r_8* ret=NULL) const ;
44
45 void GetMinMax(int k, float& min, float& max) const ;
46 inline void GetMinMax(const char* nom, float& min, float& max) const
47 { GetMinMax(IndexNom(nom), min, max); }
48
49 void Print(int num, int nmax=1) const ;
50 void Show(ostream& os) const;
51 inline void Show() const { Show(cout); }
52
53 DVList& Info();
54
55 int_4 ClassId() const { return classId; }
56 static PPersist* Create() { return new NTuple;}
57
58 virtual void WriteSelf(POutPersist&) const;
59 virtual void ReadSelf(PInPersist&);
60
61
62private:
63 void Clean();
64
65 int_4 mNVar, mNEnt, mBlk, mNBlk;
66 r_4* mVar;
67 r_8* mVarD;
68 char* mNames;
69
70 vector<r_4*> mPtr;
71
72 DVList* mInfo; // Infos (variables) attachees au NTuple
73
74};
75
76inline ostream& operator << (ostream& s, NTuple const & nt)
77 { nt.Show(s); return(s); }
78
79#ifdef __MWERKS__
80__MSL_FIX_ITERATORS__(r_4*);
81#endif
82
83#endif
84
Note: See TracBrowser for help on using the repository browser.