KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVNuclDataTable.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Wed Feb 9 11:06:42 2011
2 //Author: bonnet
3 
4 #include "KVNuclDataTable.h"
5 
6 using namespace NDT;
7 
10 
12 
13 
14 
15 
19 {
20  // Default constructor
21  init();
22 
23 }
24 
25 
26 
29 
30 KVNuclDataTable::KVNuclDataTable(KVString classname): kclassname(classname)
31 {
32  // Constructor with class name of the store objects
33  init();
34 
35 
36 }
37 
38 
39 
42 
44 {
45  // Destructor
46  if (nucMap) {
47  nucMap->DeleteAll();
48  delete nucMap;
49  }
50  if (tobj) delete tobj;
51 
52 }
53 
54 
55 
57 
59 {
60  nucMap = 0;
61  tobj = 0;
62 
63  current_idx = 0;
64  NbNuc = 0;
65  kcomments = "";
66  SetName("NuclDataTable");
67 
68 }
69 
70 
71 
74 
76 {
77 
78  //Add a new entry in the table
79  nucMap->Add(new NDT::key(zz, aa), new NDT::value(ntot));
80  NbNuc += 1;
81 
82 }
83 
84 
85 
88 
90 {
91  // Return NDT::value object pointer stored at map position (Z,A).
92  return (NDT::value*)nucMap->GetValue(Form("%d:%d", zz, aa));
93 }
94 
95 
96 
99 
101 {
102  // Returns kTRUE if there is a couple (Z,A) in the table.
103 
104  return (getNDTvalue(zz, aa) != 0);
105 }
106 
107 
108 
113 
115 {
116  // Returns the registered KVNuclData object associated to the couple (Z,A).
117  // Don't need to test its presence
118  //returns 0 if no such object is present
119 
120  NDT::value* val = getNDTvalue(zz, aa);
121  if (val) return (KVNuclData*)tobj->At(val->Index());
122  return 0;
123 
124 }
125 
126 
127 
132 
134 {
135 
136  // Returns the value of the registered KVNuclData object associated to the couple (Z,A).
137  // Don't need to test the presence of the object
138  // returns -555 if no such object is present
139 
140  KVNuclData* nd = 0;
141  if ((nd = GetData(zz, aa)))
142  return nd->GetValue();
143  else
144  return -555;
145 
146 }
147 
148 
149 
151 
153 {
154  KVNuclData* nd = 0;
155  if ((nd = GetData(zz, aa))) {
156  nd->SetValue(val);
157  }
158  else
159  Error("SetValue", "No existing entry for this nucleus: Z=%d, A=%d", zz, aa);
160 
161 }
162 
163 
164 
169 
171 {
172 
173  // Returns the unit of the registered KVNuclData object associated to the couple (Z,A).
174  // Don't need to test the presence of the object
175  // returns "NONE" if no such object is present
176 
177  KVNuclData* nd = 0;
178  if ((nd = GetData(zz, aa)))
179  return nd->GetUnit();
180  else
181  return "NONE";
182 
183 }
184 
185 
186 
192 
194 {
195 
196  // Returns bit of the registered KVNuclData object associated to the couple (Z,A).
197  // indicating if the value are measured (kTRUE) or not is from systematic (kFALSE)
198  // Don't need to test the presence of the object
199  // returns "NONE" if no such object is present
200 
201  KVNuclData* nd = 0;
202  if ((nd = GetData(zz, aa)))
203  return nd->IsMeasured();
204  else
205  return kFALSE;
206 
207 }
208 
209 
210 
212 
214 {
215 
216  return NbNuc;
217 
218 }
219 
220 
221 
223 
225 {
226 
227  return GetTitle();
228 
229 }
230 
231 
232 
234 
236 {
237 
238  return kcomments;
239 
240 }
241 
242 
243 
245 
247 {
248 
250  tobj = new TObjArray(ntot);
251 
252 }
253 
254 
255 
257 
259 {
260 
261  current_idx = idx;
262  tobj->Add((KVNuclData*)cl->New());
263 
264 }
265 
266 
267 
269 
271 {
272  TString line = "";
273  line += "Information concerning value status (measured or deduced)";
274  line += " IS NOT available, Methodes KVNuclDataTable::IsMeasured and";
275  line += " KVNuclData::IsMeasured will always return kFALSE";
276 
277  Warning("InfoOnMeasured", "%s", line.Data());
278 
279 
280 }
281 
282 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
const Bool_t kFALSE
bool Bool_t
double Double_t
char * Form(const char *fmt,...)
Abstract base class for nuclear data table.
KVString kcomments
Commentaire provenant de la lecture fichier.
TMap * nucMap
mapping (Z,A) -> nucleus index
void SetValue(Int_t zz, Int_t aa, Double_t val)
Int_t current_idx
current index
void InfoOnMeasured() const
KVString GetCommentsFromFile() const
Bool_t IsInTable(Int_t zz, Int_t aa) const
Returns kTRUE if there is a couple (Z,A) in the table.
Int_t GetNumberOfNuclei() const
Double_t GetValue(Int_t zz, Int_t aa) const
virtual ~KVNuclDataTable()
Destructor.
TObjArray * tobj
KVNumberList plageZ;.
KVNuclDataTable()
Default constructor.
TClass * cl
pointeur pour gerer les heritages de classes de KVNuclData
const Char_t * GetUnit(Int_t zz, Int_t aa) const
Int_t NbNuc
nbre de noyaux presents dans la table
KVNuclData * GetData(Int_t zz, Int_t aa) const
const Char_t * GetReadFileName() const
virtual NDT::value * getNDTvalue(Int_t zz, Int_t aa) const
Return NDT::value object pointer stored at map position (Z,A).
void CreateTable(Int_t ntot)
virtual void GiveIndexToNucleus(Int_t zz, Int_t aa, Int_t ntot)
Add a new entry in the table.
Bool_t IsMeasured(Int_t zz, Int_t aa) const
void CreateElement(Int_t idx)
Simple abstract class to store value related to nuclear data.
Definition: KVNuclData.h:17
void SetValue(Double_t val)
Definition: KVNuclData.cpp:97
Bool_t IsMeasured() const
Definition: KVNuclData.h:59
Double_t GetValue() const
Definition: KVNuclData.cpp:108
const Char_t * GetUnit() const
Definition: KVNuclData.h:50
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
int Index() const
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
void DeleteAll()
void Add(TObject *key, TObject *value)
TObject * GetValue(const char *keyname) const
virtual const char * GetTitle() const
virtual void SetName(const char *name)
void Add(TObject *obj)
TObject * At(Int_t idx) const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
const char * Data() const
TLine * line
Define key-value pair for nuclear data tables.