GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EGConverter.h
Go to the documentation of this file.
1 #ifndef GW_EGCONVERTER_H
2 #define GW_EGCONVERTER_H
3 
4 #ifndef GW_HISTODB_H
5 #include "HistoDB.h"
6 #endif
7 
17 using namespace Gw;
18 
20 {
21 private:
22  std::ifstream fStreamIN; // stream used to read/write in a file
23 
25  struct HeaderEG
26  {
27  unsigned long magic_number;
28  unsigned long version; // expect 1 !!!
29  char spectrum_name[32]; // spectrum name
30  unsigned long fold;
31  char creation_date[20]; //creation date
32  char modification_date[20]; // modif date
33  unsigned long base_info[8]; // base info for dim 1-8
34  unsigned long range[8]; // range info for dim 1-8
35  unsigned long fip[32]; // information pointer
36  int anotation_pointer[8];
37  int calibration_pointer[8];
38  int efficiency_pointer[8];
39  unsigned long data_array_descriptor1[5];
40  // 32 bits : array layout (0 for histo/matrix)
41  // 32 bits : array type (5 for 32 fits signed )
42  // 32 bits : reserved for future
43  // 32 bits : reserved for future
44  // 32 bits : pointer
45  unsigned long data_array_descriptor2[5];
46  int base_address_string_space;
47  int string_free_space;
48  unsigned long top_string_space;
49  unsigned long base_address_count_space;
50  unsigned long count_free_space;
51  unsigned long top_count_space;
52  unsigned long unused[20]; // not used ...
53  };
54  HeaderEG fHeader;
55 
57  bool IsEG(const char *filename, Option_t *o = "") const;
58 
59  void PrintHeader() const;
61  void ReadHeader(char *, HeaderEG &);
63  void InitHeader(int, int, HeaderEG &, const char *, int);
64 
66 
72  bool OpenEG(const char *);
73  void CloseEG() { if ( fStreamIN.is_open() ) fStreamIN.close(); fStreamIN.clear(); }
74 
75 public:
76  EGConverter();
77  EGConverter(const char *name);
78  virtual ~EGConverter();
79 
80  virtual TH1 *Get(int);
81  virtual TH1 *Get(const char *);
82 
83  virtual bool Read(TH1 &);
84  virtual bool Write(const TH1 &);
85 
86  virtual bool Read(TH2 &);
87  virtual bool Write(const TH2 &);
88 
89  virtual bool Read(THStack &);
90  virtual bool Write(const THStack &);
91 
92  virtual HistoConverter *NewDB(const char *) const;
93 
94  // virtual void ls(Option_t *);
95  virtual void ls(Option_t *) const;
96 
97  virtual const char *GetType() const { return fType.Data(); }
98 };
99 
100 #endif
header file for the HistoDB facility
virtual const char * GetType() const
to know what type of HistoConverter system it is
Definition: EGConverter.h:97