KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVMassExcessTable.cpp
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
14
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
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)
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
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.
KVString GetCurrentLine()
Bool_t PreparForReadingAgain()
ReadStatus ReadLine(const KVString &pattern="")
Double_t GetDoubleReadPar(Int_t pos) const
Int_t GetIntReadPar(Int_t pos) const
Int_t GetNparRead() const
Bool_t IsOK()
KVString GetReadPar(Int_t pos) const
Bool_t OpenFileToRead(const KVString &filename)
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.
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:18
void SetValue(Double_t val)
void SetMeasured(Bool_t measured)
Definition KVNuclData.h:56
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetTitle(const char *title="")
const char * GetName() const override
virtual void SetName(const char *name)
virtual void Error(const char *method, const char *msgfmt,...) const
Int_t Atoi() const
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Bool_t IsNull() const
void Form(const char *fmt,...)
void init()
ClassImp(TPyArg)