Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
TGraphErrors* GetYield(string);
void Draw(TString isotope, TGraphErrors* ge);
TH2F* h2;
vector<int> vZ;
vector<int> vA;
vector<int> vN;
vector<string> yield_file;
int NumberOfZ=0;
int NumberOfN=0;
////////////////////////////////////////////
void MapAll()
{
gROOT->SetStyle("pierre_style");
h2 = new TH2F("h2","h2",500,20,60,500,0,30);
h2->GetXaxis()->SetTitle("Z");
h2->GetYaxis()->SetTitle("Y(Z) (%)");
h2->GetXaxis()->CenterTitle();
h2->GetYaxis()->CenterTitle();
string filename = "list1.dat";
ifstream ifile;
ifile.open(filename.c_str());
int Z=0;
int Zprev=0;
int A;
NPL::Particle* iso;
while(ifile>>Z>>A){
//ifile >> Z >> A;
iso = new NPL::Particle(Z,A);
string isoname = iso->GetName();
isoname.resize(5);
string yield_filename = "dat/yield_" + isoname + ".dat";
yield_file.push_back(yield_filename);
cout << yield_filename << endl;
if(Z!=Zprev){
Zprev = Z;
NumberOfZ++;
}
vZ.push_back(Z);
vA.push_back(A);
vN.push_back(A-Z);
}
NumberOfN = vN[vN.size()-1] - vN[0] + 1;
cout << "***** " << NumberOfZ << " different element to be plotted !" << endl;
cout << "***** " << NumberOfN << " number of neutrons" << endl;
cout << "size " << vZ.size() << " " << NumberOfZ*NumberOfN << endl;
TCanvas* c1 = new TCanvas("Map1","Map1",2400,1500);
c1->Divide(NumberOfN,NumberOfZ,0,0);
c1->Modified();
int Nmin = vN[0];
int Zmin = vZ[0];
int Zmax = vZ[vZ.size()-1];
int Nmax = vN[vN.size()-1];
for(int i=0; i<vZ.size(); i++){
int DeltaN = vN[i] - Nmin;
int DeltaZ = abs(vZ[i] - Zmax);
int indice = DeltaN + NumberOfN*DeltaZ;
cout << vZ[i] << " " << vN[i] << " " << indice << endl;
c1->cd(indice+1);
Draw("test",GetYield(yield_file[i]));
}
ifile.close();
vZ.clear();
vA.clear();
vN.clear();
yield_file.clear();
NumberOfN=0;
NumberOfZ=0;
filename = "list2.dat";
ifile.open(filename.c_str());
Z=0;
Zprev=0;
A=0;
while(ifile>>Z>>A){
//ifile >> Z >> A;
iso = new NPL::Particle(Z,A);
string isoname = iso->GetName();
isoname.resize(5);
string yield_filename = "dat/yield_" + isoname + ".dat";
yield_file.push_back(yield_filename);
cout << yield_filename << endl;
if(Z!=Zprev){
Zprev = Z;
NumberOfZ++;
}
vZ.push_back(Z);
vA.push_back(A);
vN.push_back(A-Z);
}
NumberOfN = vN[vN.size()-1] - vN[0] + 1;
cout << "***** " << NumberOfZ << " different element to be plotted !" << endl;
cout << "***** " << NumberOfN << " number of neutrons" << endl;
cout << "size " << vZ.size() << " " << NumberOfZ*NumberOfN << endl;
TCanvas* c2 = new TCanvas("Map2","Map2",2400,1500);
c2->Divide(NumberOfN,NumberOfZ,0,0);
c2->Modified();
Nmin = vN[0];
Zmin = vZ[0];
Zmax = vZ[vZ.size()-1];
Nmax = vN[vN.size()-1];
for(int i=0; i<vZ.size(); i++){
int DeltaN = vN[i] - Nmin;
int DeltaZ = abs(vZ[i] - Zmax);
int indice = DeltaN + NumberOfN*DeltaZ;
cout << vZ[i] << " " << vN[i] << " " << indice << endl;
c2->cd(indice+1);
Draw("test",GetYield(yield_file[i]));
}
ifile.close();
}
////////////////////////////////////////////
void Draw(TString isotope, TGraphErrors* ge){
TLatex* iso = new TLatex(48,25,isotope);
//h2->GetXaxis()->SetRangeUser(25,55);
h2->Draw();
//iso->Draw();
ge->SetFillColor(kAzure+2);
ge->Draw("plfsame");
}
////////////////////////////////////////////
TGraphErrors* GetYield(string filename)
{
ifstream ifile;
ifile.open(filename.c_str());
int Z;
double yield;
double yield_err;
TGraphErrors* g = new TGraphErrors();
int i=0;
while(!ifile.eof()){
ifile >> Z >> yield >> yield_err;
//cout << Z << " " << yield << " " << yield_err << endl;
if(yield>0 && yield_err>0){
g->SetPoint(i,Z,yield);
g->SetPointError(i,0,yield_err);
i++;
}
}
g->SetMarkerStyle(8);
ifile.close();
return g;
}