Skip to content
Snippets Groups Projects
Commit e91d019f authored by Pierre Morfouace's avatar Pierre Morfouace
Browse files

Adding Map amcro for s455

parent 362b1151
No related branches found
No related tags found
1 merge request!27Draft: [Epic] Preparation of the environement for the new GaseousDetectorScorers...
Pipeline #339157 passed
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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment