KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVMassExcessTable.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Fri Feb 11 10:36:24 2011
2 //Author: bonnet
3 
4 #include "KVMassExcessTable.h"
5 #include "KVFileReader.h"
6 #include "TEnv.h"
7 #include "KVBase.h"
8 
10 
11 
12 
16 {
17  // Default constructor
18  init();
19 }
20 
21 
22 
25 
27 {
28  // Destructor
29 
30 }
31 
32 
33 
35 
37 {
38  SetName("MassExcess");
39 }
40 
41 
42 
44 
46 {
47 
48  TString dfile;
49  dfile.Form("%s.DataFile", GetName());
50  TString cl_path;
51  if (!KVBase::SearchKVFile(gEnv->GetValue(dfile.Data(), ""), cl_path, "data")) {
52  Error("Initialize", "No file found for %s", GetName());
53  return;
54  }
55  else {
56  // Info("Initialize","%s will be read",gEnv->GetValue(dfile.Data(),""));
57  }
58  SetTitle(gEnv->GetValue(dfile.Data(), ""));
59 
60  Int_t ntot = 0;
61  nucMap = new TMap(50, 2);
62  KVFileReader* fr = new KVFileReader();
63  fr->OpenFileToRead(cl_path.Data());
64 
65  //Premier passage
66  //Lecture du nombre de noyaux a enregistrer
67  while (fr->IsOK()) {
68 
69  fr->ReadLine(" ");
70  if (fr->GetCurrentLine().IsNull()) {
71  break;
72  }
73  else if (fr->GetNparRead() == 0) {
74  break;
75  }
76  else if (fr->GetReadPar(0).BeginsWith("//")) {
77 
78  kcomments += fr->GetCurrentLine();
79  kcomments += "\n";
80 
81  }
82  else {
83  Int_t zz = fr->GetIntReadPar(0);
84  Int_t aa = fr->GetIntReadPar(1);
85  GiveIndexToNucleus(zz, aa, ntot);
86  ntot += 1;
87  }
88  }
89 
90  if (!fr->PreparForReadingAgain()) return;
91 
92  //Info("Initialize","Set up map for %d nuclei", ntot);
93  CreateTable(ntot);
94 
95  KVNuclData* lf = 0;
96  ntot = 0;
97  while (fr->IsOK()) {
98  fr->ReadLine(" ");
99  if (fr->GetCurrentLine().IsNull()) {
100  break;
101  }
102  else if (fr->GetNparRead() == 0) {
103  break;
104  }
105  else if (fr->GetReadPar(0).BeginsWith("//")) { }
106  else {
107  CreateElement(ntot);
108  lf = GetCurrent();
109 
110  Double_t val = fr->GetDoubleReadPar(2);
111  lf->SetValue(val);
112 
113  if (fr->GetNparRead() > 3) {
114  Int_t meas = fr->GetReadPar(3).Atoi();
115  lf->SetMeasured(meas);
116  }
117  else {
118  if (ntot == 0)
119  InfoOnMeasured();
120  }
121  //lf->SetMeasured(kFALSE);
122 
123  ntot += 1;
124  }
125 
126  }
127 
128  //Info("Initialize","table initialised correctly for %d/%d nuclei", ntot,GetNumberOfNuclei());
129  fr->CloseFile();
130  delete fr;
131 
132 }
133 
134 
135 
137 
139 {
140 
141  return (KVMassExcess*)GetData(zz, aa);
142 
143 }
144 
145 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
double Double_t
R__EXTERN TEnv * gEnv
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Definition: KVBase.cpp:538
Handle reading columns of numeric data in text files.
Definition: KVFileReader.h:119
KVString GetCurrentLine()
Definition: KVFileReader.h:319
Bool_t PreparForReadingAgain()
Definition: KVFileReader.h:199
void CloseFile()
Definition: KVFileReader.h:236
ReadStatus ReadLine(const KVString &pattern="")
Definition: KVFileReader.h:242
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:333
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:337
Int_t GetNparRead() const
Definition: KVFileReader.h:324
Bool_t IsOK()
Definition: KVFileReader.h:230
KVString GetReadPar(Int_t pos) const
Definition: KVFileReader.h:341
Bool_t OpenFileToRead(const KVString &filename)
Definition: KVFileReader.h:209
Manage mass excess data for nuclei.
virtual ~KVMassExcessTable()
Destructor.
virtual void Initialize()
KVMassExcess * GetMassExcess(Int_t zz, Int_t aa) const
Simple class for store life time information of nucleus.
Definition: KVMassExcess.h:15
Abstract base class for nuclear data table.
KVString kcomments
Commentaire provenant de la lecture fichier.
TMap * nucMap
mapping (Z,A) -> nucleus index
void InfoOnMeasured() const
KVNuclData * GetCurrent() const
TObjArray* tobj_rangeA; //! array where range of A associated to each Z is stored via KVIntegerList.
KVNuclData * GetData(Int_t zz, Int_t aa) const
void CreateTable(Int_t ntot)
virtual void GiveIndexToNucleus(Int_t zz, Int_t aa, Int_t ntot)
Add a new entry in the table.
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
void SetMeasured(Bool_t measured)
Definition: KVNuclData.h:55
virtual const char * GetValue(const char *name, const char *dflt) const
virtual const char * GetName() const
virtual void SetTitle(const char *title="")
virtual void SetName(const char *name)
virtual void Error(const char *method, const char *msgfmt,...) const
Int_t Atoi() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
const char * Data() const
Bool_t IsNull() const
void Form(const char *fmt,...)