KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVNDTManager.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Thu Feb 24 11:24:52 2011
2 //Author: bonnet
3 
4 #include "KVNDTManager.h"
5 #include "KVNuclDataTable.h"
6 #include "KVNuclData.h"
7 #include "KVString.h"
8 #include "KVBase.h"
9 #include "Riostream.h"
10 #include "TObjArray.h"
11 
13 
15 
16 
19 
21 {
22  // Default constructor
23  SetOwner(kTRUE);
24  init();
25 }
26 
27 
28 
31 
33 {
34  // Destructor
35 }
36 
37 
38 
44 
46 {
47  // Initialize Nuclear Data Table Manager
48  // We automatically instantiate a data table of each class which is
49  // declared as a "KVNuclDataTable" plugin
50  // If a new class is added to the .kvrootrc, there is no need to alter the code.
51 
52  Arange = 0;
53  Zrange = 0;
54 
55  KVString plugins = KVBase::GetListOfPlugins("KVNuclDataTable");
56  plugins.Begin(" ");
57  while (!plugins.End()) {
58  Add((KVNuclDataTable*)TClass::GetClass(plugins.Next())->New());
59  }
60 
61  Execute("Initialize", "");
62 
63 }
64 
65 
66 
68 
70 {
71 
72  return (KVNuclDataTable*)FindObject(name);
73 
74 }
75 
76 
77 
79 
80 Bool_t KVNDTManager::IsInTable(Int_t zz, Int_t aa, const Char_t* name) const
81 {
82  KVNuclDataTable* tab = 0;
83  return ((tab = GetTable(name)) && tab->IsInTable(zz, aa));
84 
85 }
86 
87 
88 
90 
91 Double_t KVNDTManager::GetValue(Int_t zz, Int_t aa, const Char_t* name) const
92 {
93 
94  KVNuclDataTable* tab = 0;
95  if ((tab = GetTable(name))) return tab->GetValue(zz, aa);
96  return -666;
97 
98 }
99 
100 
101 
103 
104 void KVNDTManager::SetValue(Int_t zz, Int_t aa, const Char_t* name, Double_t val)
105 {
106  KVNuclDataTable* tab = 0;
107  if ((tab = GetTable(name))) {
108  tab->SetValue(zz, aa, val);
109  }
110  else
111  Error("SetValue", "No table found with name %s", name);
112 
113 }
114 
115 
116 
118 
119 KVNuclData* KVNDTManager::GetData(Int_t zz, Int_t aa, const Char_t* name) const
120 {
121 
122  KVNuclDataTable* tab = 0;
123  if ((tab = GetTable(name))) return tab->GetData(zz, aa);
124  return 0;
125 
126 }
127 
128 
129 
131 
133 {
134 
135  KVNuclDataTable* tab = 0;
136  if ((tab = GetTable(name))) return tab->IsMeasured(zz, aa);
137  return kFALSE;
138 
139 }
140 
141 
142 
144 
145 const Char_t* KVNDTManager::GetUnit(Int_t zz, Int_t aa, const Char_t* name) const
146 {
147 
148  KVNuclDataTable* tab = 0;
149  if ((tab = GetTable(name))) return tab->GetUnit(zz, aa);
150  return "";
151 
152 
153 }
154 
155 
156 
157 
158 
160 
162 {
163  printf("--------\n");
164  Info("Print", "%d Available nuclear data tables", GetEntries());
165  for (Int_t ii = 0; ii < GetEntries(); ii += 1) {
166  printf("name=%s file=%s number of nuclei stored=%d\n",
167  ((KVNuclDataTable*)At(ii))->GetName(),
168  ((KVNuclDataTable*)At(ii))->GetTitle(),
169  ((KVNuclDataTable*)At(ii))->GetNumberOfNuclei()
170  );
171  }
172  printf("--------\n");
173 
174 }
175 
176 
int Int_t
KVNDTManager * gNDTManager
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
const Bool_t kFALSE
bool Bool_t
double Double_t
const Bool_t kTRUE
static const Char_t * GetListOfPlugins(const Char_t *base)
Definition: KVBase.cpp:1260
Nuclear Data Table manager.
Definition: KVNDTManager.h:21
Bool_t IsInTable(Int_t zz, Int_t aa, const Char_t *name) const
void PrintTables() const
Double_t GetValue(Int_t zz, Int_t aa, const Char_t *name) const
const Char_t * GetUnit(Int_t zz, Int_t aa, const Char_t *name) const
KVNuclData * GetData(Int_t zz, Int_t aa, const Char_t *name) const
Bool_t IsMeasured(Int_t zz, Int_t aa, const Char_t *name) const
KVNuclDataTable * GetTable(const Char_t *name) const
TObjArray * Arange
Definition: KVNDTManager.h:25
virtual ~KVNDTManager()
Destructor.
void SetValue(Int_t zz, Int_t aa, const Char_t *name, Double_t val)
TObjArray * Zrange
Definition: KVNDTManager.h:26
Abstract base class for nuclear data table.
void SetValue(Int_t zz, Int_t aa, Double_t val)
Bool_t IsInTable(Int_t zz, Int_t aa) const
Returns kTRUE if there is a couple (Z,A) in the table.
Double_t GetValue(Int_t zz, Int_t aa) const
const Char_t * GetUnit(Int_t zz, Int_t aa) const
KVNuclData * GetData(Int_t zz, Int_t aa) const
Bool_t IsMeasured(Int_t zz, Int_t aa) const
Simple abstract class to store value related to nuclear data.
Definition: KVNuclData.h:17
virtual TObject * At(Int_t idx) const
virtual void Execute(const char *method, const char *params, Int_t *error=0)
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
void Begin(TString delim) const
Definition: KVString.cpp:565
Bool_t End() const
Definition: KVString.cpp:634
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:695
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
virtual const char * GetName() const
virtual Int_t GetEntries() const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual const char * GetTitle() const
virtual void Info(const char *method, const char *msgfmt,...) const