GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaseENSDF.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef GW_BASEENSDF_H
24 #define GW_BASEENSDF_H
25 
26 #include <vector>
27 #include <iostream>
28 #include <string>
29 #include <fstream>
30 
31 namespace Gw {
32 
53 class BaseENSDF
54 {
55 private:
56  std::ifstream Input;
57 
58 protected:
59  static std::string BLANK;
60  static const int RSIZE = 81; // a record size is 81 bytes (80 data + \n)
61 
62  // structure that describes a dataset
63  class DataSetKey {
64  public:
65  std::string Nuclide;
66  std::string Dsid;
67  std::string Dsref;
68  std::string Pub;
69  std::string Date;
71  std::pair<int,int> Position;
72 
73  DataSetKey() { Clear() ; }
74  DataSetKey(const DataSetKey &) ;
75  ~DataSetKey() { Clear() ; }
76 
77  void Clear();
78  void Print(std::ostream &) const ;
79  };
80  std::vector<DataSetKey> fDataSets;
81 
82  std::string Dsid(const char *) const;
83  std::string Dsref(const char *) const;
84  std::string Pub(const char *) const;
85  std::string Date(const char *) const;
86  std::string Nuclide(const char *) const;
87 
88 public:
89  BaseENSDF();
90  virtual ~BaseENSDF();
91 
93 
96  virtual bool Open(const char *);
97  virtual void Close();
98  virtual bool IsOpen() { return Input.is_open(); }
99 
101 
106  static char *BlankRecord() { return new char[RSIZE] ; }
107 
109 
115  virtual bool NextRecord(unsigned int, char *);
116 
118 
122  virtual bool FirstRecord(unsigned int which, char *record);
123 
125 
130  virtual unsigned int IsDataSet(const char *nuclide, const char *dsid = "ADOPTED LEVELS, GAMMAS") const;
131 
133 
147  bool IsRecord(const char *, const char *) const;
148 
150  float GetCC(const char *);
151  float GetDCC(const char *);
152 
154 
158  float GetRI(const char *, std::string &);
159  float GetDRI(const char *);
160 
162 
166  float GetTI(const char *, std::string &);
167  float GetDTI(const char *);
168 
170 
181  float GetPrecision(std::string);
182 
184 
194  float GetE(const char *, std::string &);
195  float GetDE(const char *);
196 
198 
209  float GetT(const char *, float &, std::string &);
210  float GetDT(const char *);
211 
213 
215  // std::string GetM(const char *);
216 
218 
220  float GetMR(const char *);
221  float GetDMR(const char *);
222 
224 
229  std::string GetJPI(const char *);
230 
231  virtual void ls(std::ostream &) const ;
232 };
233 
234 } // namespace
235 #endif
std::string Nuclide(const char *) const
Definition: BaseENSDF.cpp:96
float GetDE(const char *)
Definition: BaseENSDF.cpp:572
std::string GetJPI(const char *)
to get the spin-parity field JPI: J
Definition: BaseENSDF.cpp:698
std::vector< DataSetKey > fDataSets
Definition: BaseENSDF.h:80
float GetDTI(const char *)
Definition: BaseENSDF.cpp:480
float GetDT(const char *)
Definition: BaseENSDF.cpp:652
float GetMR(const char *)
to get the multipolarity of a gamma level
Definition: BaseENSDF.cpp:357
float GetDCC(const char *)
Definition: BaseENSDF.cpp:328
float GetRI(const char *, std::string &)
to get the relative intensity field of a gamma record
Definition: BaseENSDF.cpp:405
virtual bool IsOpen()
Definition: BaseENSDF.h:98
virtual void Close()
Definition: BaseENSDF.cpp:295
std::string Dsref(const char *) const
Definition: BaseENSDF.cpp:106
bool IsRecord(const char *, const char *) const
check record's type.
Definition: BaseENSDF.cpp:72
void Print(std::ostream &) const
Definition: BaseENSDF.cpp:60
General interface to ENSDF files.
Definition: BaseENSDF.h:53
float GetDMR(const char *)
Definition: BaseENSDF.cpp:373
std::string Pub(const char *) const
Definition: BaseENSDF.cpp:111
virtual ~BaseENSDF()
Definition: BaseENSDF.cpp:70
virtual void ls(std::ostream &) const
Definition: BaseENSDF.cpp:300
static std::string BLANK
Definition: BaseENSDF.h:59
float GetT(const char *, float &, std::string &)
to get the T (half-life) field of a record.
Definition: BaseENSDF.cpp:616
float GetE(const char *, std::string &)
to get the energy field of a record
Definition: BaseENSDF.cpp:509
virtual bool NextRecord(unsigned int, char *)
to get dataset's records
Definition: BaseENSDF.cpp:133
std::string Dsid(const char *) const
Definition: BaseENSDF.cpp:101
std::string Date(const char *) const
Definition: BaseENSDF.cpp:117
float GetCC(const char *)
on a gamma record, to get the total conversion coefficient... check the record before with IsRecord!!...
Definition: BaseENSDF.cpp:313
static const int RSIZE
Definition: BaseENSDF.h:60
float GetPrecision(std::string)
extract the precision for a given ENSDF data
Definition: BaseENSDF.cpp:544
virtual bool Open(const char *)
Definition: BaseENSDF.cpp:178
virtual unsigned int IsDataSet(const char *nuclide, const char *dsid="ADOPTED LEVELS, GAMMAS") const
look for a given data set
Definition: BaseENSDF.cpp:123
std::pair< int, int > Position
Definition: BaseENSDF.h:71
static char * BlankRecord()
returns a proper empty record. It is the charge of the user to delete it
Definition: BaseENSDF.h:106
float GetDRI(const char *)
Definition: BaseENSDF.cpp:428
float GetTI(const char *, std::string &)
to get the relative total transition intensity field of a gamma record
Definition: BaseENSDF.cpp:457
virtual bool FirstRecord(unsigned int which, char *record)
to init the records reading
Definition: BaseENSDF.cpp:157