From 6e9231c21462d4f01b83d2762c757d5071eb366e Mon Sep 17 00:00:00 2001
From: Baptiste LENIAU <baptiste.leniau@subatech.in2p3.fr>
Date: Thu, 8 Oct 2015 14:57:40 +0000
Subject: [PATCH] save trunk as version 4.1

git-svn-id: svn+ssh://svn.in2p3.fr/class@793 0e7d625b-0364-4367-a6be-d5be4a48d228
---
 gui/tags/version4.1/CLASSGui.cxx         |   52 +
 gui/tags/version4.1/CLASSPlotElement.cxx |   30 +
 gui/tags/version4.1/CLASSPlotElement.hxx |   55 +
 gui/tags/version4.1/CLASSRead.cxx        | 2388 ++++++++++++++++++++++
 gui/tags/version4.1/CLASSRead.hxx        |  135 ++
 gui/tags/version4.1/CLASSWin.cxx         | 1435 +++++++++++++
 gui/tags/version4.1/CLASSWin.hxx         |  257 +++
 gui/tags/version4.1/Makefile             |   71 +
 8 files changed, 4423 insertions(+)
 create mode 100755 gui/tags/version4.1/CLASSGui.cxx
 create mode 100644 gui/tags/version4.1/CLASSPlotElement.cxx
 create mode 100644 gui/tags/version4.1/CLASSPlotElement.hxx
 create mode 100755 gui/tags/version4.1/CLASSRead.cxx
 create mode 100755 gui/tags/version4.1/CLASSRead.hxx
 create mode 100755 gui/tags/version4.1/CLASSWin.cxx
 create mode 100755 gui/tags/version4.1/CLASSWin.hxx
 create mode 100755 gui/tags/version4.1/Makefile

diff --git a/gui/tags/version4.1/CLASSGui.cxx b/gui/tags/version4.1/CLASSGui.cxx
new file mode 100755
index 000000000..e942c3fe5
--- /dev/null
+++ b/gui/tags/version4.1/CLASSGui.cxx
@@ -0,0 +1,52 @@
+#include "CLASSWin.hxx"
+
+
+
+#include <TApplication.h>
+#include <string>
+#include <stdlib.h>
+
+using namespace std;
+
+int main(int argc, char** argv)
+{
+	if(argc<2)
+	{
+		cerr << endl << "Usage: CLASGui FileName1 FileName2 ... " << endl;
+		exit(0);
+	}
+
+	vector<string> VFileName;
+	int NumberOfFile = argc-1
+	;
+	for(int i = 0;i<NumberOfFile;i++)
+		VFileName.push_back(string(argv[i+1]));
+	
+	CLASSRead* DataRead = new CLASSRead(VFileName[0]);
+	if(VFileName.size() ==  0)
+	{
+		cerr << endl << "Usage: CLASGui FileName1 FileName2 ... " << endl;
+		exit(0);
+	}
+	for (int i = 1; i < (int)VFileName.size(); i++)
+	{
+		cout << "File " <<   i << endl;
+		DataRead->AddFile(VFileName[i]);
+	}
+	DataRead->ReadName();
+	DataRead->ReadZAI();
+	DataRead->ReadTime();
+	cout << "Bienvenue dans le GUI" <<  endl;
+
+	
+	argc = 1; //avoid to change directory by root TApplication...
+	TApplication theApp("App", &argc, argv);
+	MainWin *win = new MainWin(DataRead,VFileName);
+
+	
+	theApp.Run();
+	return 0;
+}
+
+
+//g++ -O3 `root-config --cflags` -o Inventory Inventory.cxx  `root-config --glibs` 
diff --git a/gui/tags/version4.1/CLASSPlotElement.cxx b/gui/tags/version4.1/CLASSPlotElement.cxx
new file mode 100644
index 000000000..704d1fc9e
--- /dev/null
+++ b/gui/tags/version4.1/CLASSPlotElement.cxx
@@ -0,0 +1,30 @@
+#include "CLASSPlotElement.hxx"
+
+
+using namespace std;
+	// for gcc3.2.3 only
+
+
+CLASSPlotElement::CLASSPlotElement(int treeId, int facilityId, int facylitynumber, int IVNumber, ZAI zai)
+{
+	
+	fTreeId = treeId;
+	fFacilityId = facilityId;
+	fFacylityNumber = facylitynumber;
+	fIVNumber = IVNumber;
+	fZAI = zai;
+	
+}
+
+
+CLASSPlotElement::CLASSPlotElement(int treeId, int facilityId, int facylitynumber, int IVNumber, int Z, int A, int I)
+{
+	
+	fTreeId = treeId;
+	fFacilityId = facilityId;
+	fFacylityNumber = facylitynumber;
+	fIVNumber = IVNumber;
+	fZAI = ZAI(Z,A,I);
+	
+}
+
diff --git a/gui/tags/version4.1/CLASSPlotElement.hxx b/gui/tags/version4.1/CLASSPlotElement.hxx
new file mode 100644
index 000000000..2d05c8ba5
--- /dev/null
+++ b/gui/tags/version4.1/CLASSPlotElement.hxx
@@ -0,0 +1,55 @@
+#ifndef _CLASSPlotElement_
+#define _CLASSPlotElement_
+
+#include "ZAI.hxx"
+
+
+#include <vector>
+#include <iostream>
+
+using namespace std;
+	//________________________________________________________________________
+	//
+	//		CLASSPlotElement
+	//@{
+	//@}
+	//________________________________________________________________________
+class CLASSPlotElement
+{
+	public :
+	
+	CLASSPlotElement(int treeId, int facilityId, int facylitynumber, int IVNumber, ZAI zai);
+	CLASSPlotElement(int treeId, int facilityId, int facylitynumber, int IVNumber, int Z, int A, int I);
+	
+	virtual ~CLASSPlotElement(){}		//@- destructor
+	
+	int fTreeId;		// Tree Id
+	int fFacilityId;	// FacilityType
+				// 0 General
+				// 1 reactor
+				// 2 Stock
+				// 3 Pool
+				// 4 FabricationPlant
+
+	int fIVNumber;	// Id of IsotopicVector
+			// 0 Incycle
+			// 1 CumulativeIN
+			// 2 CulumativeOUT
+
+	int fFacylityNumber;	// Id of Facility
+				// For General :
+				// 0 TOTAL
+				// 1 INCYCLE
+				// 2 WASTE
+				// 3 OUTINCOME
+				// 4 REACTOR
+				// 5 COOLING
+				// 6 STOCK
+				// 7 FUELFABRICATION
+	ZAI fZAI;		 // ZAI Neeeded
+	
+};
+
+
+
+#endif
diff --git a/gui/tags/version4.1/CLASSRead.cxx b/gui/tags/version4.1/CLASSRead.cxx
new file mode 100755
index 000000000..0b95444fb
--- /dev/null
+++ b/gui/tags/version4.1/CLASSRead.cxx
@@ -0,0 +1,2388 @@
+#include "CLASSRead.hxx"
+
+#include <TApplication.h>
+#include <TGTableLayout.h>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <fstream>
+#include <vector>
+#include <cmath>
+#include <map>
+
+
+#include "TFile.h"
+#include "TBranch.h"
+#include "TTree.h"
+#include <TCanvas.h>
+#include "TH2F.h"
+#include "TGraph.h"
+#include "TString.h"
+
+
+using namespace std;
+// for gcc3.2.3 only
+char* operator+( std::streampos&, char* );
+//end of gcc3.2.3
+
+
+
+//________________________________________________________________________
+string ReadNucleusName[] = {
+	"n","H","He","Li","Be","B","C","N","O","F","Ne",			// List of nucleus used
+	"Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca",
+	"Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn",
+	"Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr",
+	"Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn",
+	"Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Nd",
+	"Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb",
+	"Lu","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg",
+	"Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th",
+	"Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm", //100
+	"Md","No","Lr","Rf","Db","Sg","Bh","Hs","Mt","X",
+	"-","-","-","-","-","-","-","-","-","-",				// add nucleus for DRAGON lattice code
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-", //200
+	"H_nat","He_nat","Li_nat","Be_nat","B_nat","C_nat","N_nat","O_nat","F_nat","Ne_nat",
+	"Na_nat","Mg_nat","Al_nat","Si_nat","P_nat","S_nat","Cl_nat","Ar_nat","K_nat","Ca_nat",
+	"Sc_nat","Ti_nat","V_nat","Cr_nat","Mn_nat","Fe_nat","Co_nat","Ni_nat","Cu_nat","Zn_nat",
+	"Ga_nat","Ge_nat","As_nat","Se_nat","Br_nat","Kr_nat","Rb_nat","Sr_nat","Y_nat","Zr_nat",
+	"Nb_nat","Mo_nat","Tc_nat","Ru_nat","Rh_nat","Pd_nat","Ag_nat","Cd_nat","In_nat","Sn_nat",
+	"Sb_nat","Te_nat","I_nat","Xe_nat","Cs_nat","Ba_nat","La_nat","Ce_nat","Pr_nat","Nd_nat",
+	"Pm_nat","Sm_nat","Eu_nat","Gd_nat","Tb_nat","Dy_nat","Ho_nat","Er_nat","Tm_nat","Yb_nat",
+	"Lu_nat","Hf_nat","Ta_nat","W_nat","Re_nat","Os_nat","Ir_nat","Pt_nat","Au_nat","Hg_nat",
+	"Tl_nat","Pb_nat","Bi_nat","Po_nat","At_nat","Rn_nat","Fr_nat","Ra_nat","Ac_nat","Th_nat",
+	"Pa_nat","U_nat","Np_nat","Pu_nat","Am_nat","Cm_nat","Bk_nat","Cf_nat","Es_nat","Fm_nat"
+};
+
+int CurveColor(int graph_num)
+{
+	int ColorTable[] = {1,kBlue,kRed,kGreen+1,kMagenta,kCyan+2,kOrange-3,kRed+2,kBlue-2,
+		kSpring+9,kGreen+3,kAzure+8,kMagenta+2,kYellow+2,kBlue-9,kOrange+2};
+	return ColorTable[graph_num%16];
+
+}
+
+string itoa(int num)
+{
+	ostringstream os(ostringstream::out);
+	os << setprecision(3) << num;
+	return os.str();
+}
+
+
+//________________________________________________________________________
+//________________________________________________________________________
+//________________________________________________________________________
+//________________________________________________________________________
+CLASSRead::CLASSRead(TString filename)
+{
+	TFile *FileIn;
+	FileIn = TFile::Open(filename);
+	fFileIn.push_back(FileIn);
+
+	for( int i  = 0; i < fFileIn.back()->GetNkeys(); i++)
+	{
+		//cout << "KeyNum " << i << endl;
+		fData.push_back( (TTree*)gDirectory->Get(fFileIn.back()->GetListOfKeys()->At(fFileIn.back()->GetNkeys()-1)->GetName() ) );
+	}
+
+	fCNucleiInv = 0;
+	fLegendInv = 0;
+	fGraphInvSumOfSelected = 0;
+	fLegendInvSumOfSelected = 0;
+
+	fCNucleiTox = 0;
+	fLegendTox = 0;
+	fGraphToxSumOfSelected = 0;
+	fLegendToxSumOfSelected = 0;
+
+	fCNucleiHeat = 0;
+	fLegendHeat = 0;
+	fGraphHeatSumOfSelected = 0;
+	fLegendHeatSumOfSelected = 0;
+
+	
+	fCPower = 0;
+	fGraphPower = 0;
+	fLegendPower = 0;
+
+	fNumberGraphPowerIterator = 0;
+
+	cDecayData.SetFastCalculation(false);
+}
+
+//________________________________________________________________________
+CLASSRead::~CLASSRead()
+{
+	for(int i = fData.size()-1; i != 0; i--)
+		delete fData[i];
+	for(int i = fFileIn.size()-1; i != 0; i--)
+		delete fFileIn[i];
+}
+
+
+//________________________________________________________________________
+//________________________________________________________________________
+//________________________________________________________________________
+void CLASSRead::AddFile(TString filename)
+{
+
+	TFile *FileIn;
+	FileIn = TFile::Open(filename);
+	fFileIn.push_back(FileIn);
+	for( int i  = 0; i < fFileIn.back()->GetNkeys(); i++)
+	{
+		fData.push_back( (TTree*)gDirectory->Get(fFileIn.back()->GetListOfKeys()->At(i)->GetName() ) );
+	}
+}
+
+//________________________________________________________________________
+void CLASSRead::ReadName()
+{
+
+	for (int j = 0; j < (int)fData.size() ; j++)
+	{
+		vector<TString>	ReactorName;
+		vector<TString>	PoolName;
+		vector<TString>	FabricationName;
+		vector<TString>	StockName;
+
+		Int_t nBranches = fData[j]->GetNbranches();
+		int place_reactor = 0;
+		int place_pool = 0;
+		int place_fabrication = 0;
+		int place_stock = 0;
+		for(Int_t i = 0;i<nBranches;i++)
+		{
+			string Name;
+			Name = fData[j]->GetListOfBranches()->At(i)->GetName();
+			string TypeName = Name;
+			TypeName = TypeName.substr(0,2);
+
+			if(TypeName == "R_")
+			{
+				ReactorName.push_back(Name.substr(2,Name.size()-1));
+
+			}
+			else if(TypeName == "P_")
+			{
+				PoolName.push_back(Name.substr(2,Name.size()-1));
+
+			}
+			else if(TypeName == "S_")
+			{
+				StockName.push_back(Name.substr(2,Name.size()-1));
+
+			}
+			else if(TypeName == "F_")
+			{
+				FabricationName.push_back(Name.substr(2,Name.size()-1));
+				
+			}
+		}
+		fReactorName.push_back(ReactorName);
+		fPoolName.push_back(PoolName);
+		fFabricationName.push_back(FabricationName);
+		fStockName.push_back(StockName);
+	}
+
+
+}
+
+//________________________________________________________________________
+void CLASSRead::ReadZAI()
+{
+
+	IsotopicVector IVTot;
+	for (int i = 0; i < (int)fData.size() ; i++)
+	{
+		IsotopicVector *IVIn = 0;
+		fData[i]->SetBranchStatus("TOTAL.",1);
+		fData[i]->SetBranchAddress("TOTAL.", &IVIn);
+
+		Long64_t nentries = fData[i]->GetEntries();
+
+		for(int j = 0; j < nentries; j++)
+		{
+			fData[i]->GetEntry(j);
+			IVTot += (*IVIn);
+		}
+		fData[i]->ResetBranchAddresses();
+	}
+	fZAIvector = IVTot.GetZAIList();
+
+}
+
+
+//________________________________________________________________________
+void CLASSRead::ReadTime()
+{
+	
+	vector< vector<cSecond> > FullTimeVector;
+
+	for (int i = 0; i < (int)fData.size() ; i++)
+	{
+		vector<cSecond> TimeVector;
+		cSecond timeStep;
+		fData[i]->SetBranchStatus("AbsTime",1);
+		fData[i]->SetBranchAddress("AbsTime", &timeStep);
+		
+		Long64_t nentries = fData[i]->GetEntries();
+		
+		for(int j = 0; j < nentries; j++)
+		{
+			fData[i]->GetEntry(j);
+			TimeVector.push_back(timeStep);
+		}
+		FullTimeVector.push_back(TimeVector);
+		fData[i]->ResetBranchAddresses();
+	}
+	fTimeVector = FullTimeVector;
+	
+}
+
+
+//________________________________________________________________________
+//________________________________________________________________________
+//________________________________________________________________________
+//________________________________________________________________________
+void CLASSRead::PlotInv(vector<CLASSPlotElement> toplot, bool DecayChain, int StartingStep, cSecond FinalTime, int StepNUmber, bool LinBin, string opt)
+{
+
+	if(fLegendInv)
+	{
+		for(int i = 0; i < (int)fGraphInv.size(); i++) delete fLegendInv[i];
+		delete [] fLegendInv;
+	}
+	
+	for(int i = 0; i < (int)fGraphInv.size();i++) delete fGraphInv[i];
+	fGraphInv.clear();
+	
+	if(fLegendInvSumOfSelected)
+		delete fLegendInvSumOfSelected;
+	if(fGraphInvSumOfSelected)
+		delete fGraphInvSumOfSelected;
+
+
+	
+	if(fCNucleiInv && gROOT->FindObject("c_NucleiInv"))
+	{
+		delete fCNucleiInv;
+		fCNucleiInv = 0;
+	}
+	
+	fCNucleiInv = new TCanvas("c_NucleiInv","NucleiInv",50,110,400,300);
+	if(!LinBin)
+	{
+		fCNucleiInv->SetLogx();
+		fCNucleiInv->SetLogy();
+	}
+
+	fLegendInv = new TLatex*[toplot.size()];
+	for (int i = 0; i < (int)toplot.size(); i++)
+		fLegendInv[i] = 0;
+
+	vector<CLASSPlotElement> toplotTTree[fData.size()];
+
+
+
+	Xmin = +1.e36;
+	Xmax =  -1.e36;
+	Ymin = 1.e36;
+	Ymax = -1.e36;
+
+	bool SumOfSelected = false;
+
+	if(toplot[0].fTreeId ==  -1 )
+	{
+		SumOfSelected = true;
+		toplot.erase(toplot.begin());
+	}
+
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		toplotTTree[toplot[i].fTreeId].push_back(toplot[i]);
+	}
+
+	string out = opt;
+	for (int i = 0; i < (int)fData.size(); i++)
+	{
+		
+		if(i ==  1) out += " same";
+		if(toplotTTree[i].size() != 0)
+		{
+			if(!DecayChain)
+				BuildTGraph(toplotTTree[i], 0, out);
+			else
+				BuildTGraphUsingDecayChain(toplotTTree[i], 0, StartingStep, FinalTime, StepNUmber, LinBin, out);
+		}
+
+	}
+	fCNucleiInv->cd();
+
+	double X_Sum[fGraphInv[0]->GetN()];
+	double Y_Sum[fGraphInv[0]->GetN()];
+
+	if(SumOfSelected)
+	{
+		for (int i = 0; i < (int)fGraphInv.size(); i++)
+		{
+
+			for(int j = 0; j < fGraphInv[i]->GetN(); j++)
+			{
+				double x;
+				double y;
+				fGraphInv[i]->GetPoint(j, x, y);
+				if(i ==  0)
+					X_Sum[j] = x;
+				if(i ==  0)
+					Y_Sum[j] = y;
+				else
+					Y_Sum[j] += y;
+			}
+		}
+
+
+		for (int i  = 0; i < fGraphInv[0]->GetN(); i++)
+		{
+			if(X_Sum[i] > Xmax) Xmax = X_Sum[i];
+			if(X_Sum[i] < Xmin) Xmin = X_Sum[i];
+			if(Y_Sum[i] > Ymax) Ymax = Y_Sum[i];
+			if(Y_Sum[i] < Ymin) Ymin = Y_Sum[i];
+		}
+	}
+
+	if(!LinBin)
+	{
+		Xmin = 1;
+		Ymin = 1;
+	}
+
+
+	TH1F*	  fhr = fCNucleiInv->DrawFrame(Xmin,Ymin*0.95,Xmax,Ymax*1.05);
+	string Xtitle = "Time [year]";
+	string Ytitle = "Mass [kg]";
+	fhr->SetXTitle(Xtitle.c_str());
+	fhr->SetYTitle(Ytitle.c_str());
+	fhr->GetXaxis()->CenterTitle();
+	fhr->GetYaxis()->CenterTitle();
+	fhr->GetYaxis()->SetTitleOffset(1.25);
+
+
+	if(SumOfSelected)
+	{
+		fGraphInvSumOfSelected = new TGraph(fGraphInv[0]->GetN(), X_Sum, Y_Sum );
+		fGraphInvSumOfSelected->SetName("Sum_Of_Selected");
+		fGraphInvSumOfSelected->SetTitle("Sum Of Selected");
+		fGraphInvSumOfSelected->SetLineColor(CurveColor(fGraphInv.size()));
+		fGraphInvSumOfSelected->SetMarkerColor(CurveColor(fGraphInv.size()));
+		fGraphInvSumOfSelected->SetMarkerStyle(10);
+		fGraphInvSumOfSelected->Draw(out.c_str());
+		fGraphInvSumOfSelected->SetLineColor(CurveColor(fGraphInv.size()));
+		fGraphInvSumOfSelected->SetMarkerColor(CurveColor(fGraphInv.size()));
+
+		double x;
+		double y;
+		double x_0;
+		double y_0;
+		fGraphInvSumOfSelected->GetPoint(1, x_0, y_0);
+		fGraphInvSumOfSelected->GetPoint(fGraphInvSumOfSelected->GetN()-1, x, y);
+
+		fLegendInvSumOfSelected = new TLatex(x_0+0.6*(x-x_0),y_0+1.05*(y-y_0),"Sum_Of_Selected");
+		fLegendInvSumOfSelected->SetTextSize(0.05);
+		fLegendInvSumOfSelected->SetTextFont(132);
+		fLegendInvSumOfSelected->SetTextColor(CurveColor(fGraphInv.size()));
+		fLegendInvSumOfSelected->Draw();
+
+
+	}
+
+
+
+	for (int i = 0; i < (int)fGraphInv.size(); i++)
+	{
+		if( i != 0 || SumOfSelected) out += " same";
+
+		fGraphInv[i]->SetName(GetTittleOutName(toplot[i]).c_str());
+		fGraphInv[i]->SetTitle(GetTittleOutName(toplot[i]).c_str());
+		fGraphInv[i]->SetLineColor(CurveColor(i));
+		fGraphInv[i]->SetMarkerColor(CurveColor(i));
+		fGraphInv[i]->SetMarkerStyle(10);
+		fGraphInv[i]->Draw(out.c_str());
+		fGraphInv[i]->SetLineColor(CurveColor(i));
+		fGraphInv[i]->SetMarkerColor(CurveColor(i));
+
+		double x;
+		double y;
+		double x_0;
+		double y_0;
+		fGraphInv[i]->GetPoint(1, x_0, y_0);
+		
+		fGraphInv[i]->GetPoint(fGraphInv[i]->GetN()-1, x, y);
+
+		fLegendInv[i] = new TLatex(x_0+0.6*(x-x_0),y_0+1.05*(y-y_0),GetLegendOutName(toplot[i]).c_str());
+		fLegendInv[i]->SetTextSize(0.05);
+		fLegendInv[i]->SetTextFont(132);
+		fLegendInv[i]->SetTextColor(CurveColor(i));
+		fLegendInv[i]->Draw();
+	}
+
+	fCNucleiInv->Update();
+
+
+}
+
+//________________________________________________________________________
+void CLASSRead::PlotTox(vector<CLASSPlotElement> toplot, bool DecayChain, int StartingStep, cSecond FinalTime, int StepNUmber, bool LinBin, string opt)
+{
+
+	if(fLegendTox)
+	{
+		for(int i = 0; i < (int)fGraphTox.size();i++) delete fLegendTox[i];
+		delete [] fLegendTox;
+	}
+	
+	for(int i = 0; i < (int)fGraphTox.size();i++) delete fGraphTox[i];
+	fGraphTox.clear();
+	
+	if(fLegendToxSumOfSelected)
+		delete fLegendToxSumOfSelected;
+	if(fGraphToxSumOfSelected)
+		delete fGraphToxSumOfSelected;
+	
+
+	if(fCNucleiTox && gROOT->FindObject("c_NucleiTox"))
+	{	delete fCNucleiTox;
+		fCNucleiTox = 0;
+	}
+	fCNucleiTox = new TCanvas("c_NucleiTox","NucleiTox",50,110,400,300);
+	if(!LinBin)
+	{
+		fCNucleiTox->SetLogx();
+		fCNucleiTox->SetLogy();
+	}
+	
+	fLegendTox = new TLatex*[toplot.size()];
+	for (int i = 0; i < (int)toplot.size(); i++)
+		fLegendTox[i] = 0;
+	
+	vector<CLASSPlotElement> toplotTTree[fData.size()];
+
+	
+	Xmin = +1.e36;
+	Xmax =  -1.e36;
+	Ymin = 1.e36;
+	Ymax = -1.e36;
+	
+	bool SumOfSelected = false;
+	
+	if(toplot[0].fTreeId ==  -1 )
+	{
+		SumOfSelected = true;
+		toplot.erase(toplot.begin());
+	}
+	
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		toplotTTree[toplot[i].fTreeId].push_back(toplot[i]);
+	}
+	
+	string out = opt;
+	for (int i = 0; i < (int)fData.size(); i++)
+	{
+		if(i ==  1) out += " same";
+		if(toplotTTree[i].size() != 0)
+		{
+			if(!DecayChain)
+				BuildTGraph(toplotTTree[i], 1, out);
+			
+			else
+				BuildTGraphUsingDecayChain(toplotTTree[i], 1, StartingStep, FinalTime, StepNUmber, LinBin, out);
+		}
+	}
+	fCNucleiTox->cd();
+	
+	double X_Sum[fGraphTox[0]->GetN()];
+	double Y_Sum[fGraphTox[0]->GetN()];
+	
+	if(SumOfSelected)
+	{
+		for (int i = 0; i < (int)fGraphTox.size(); i++)
+		{
+			
+			for(int j = 0; j < fGraphTox[i]->GetN(); j++)
+			{
+				double x;
+				double y;
+				fGraphTox[i]->GetPoint(j, x, y);
+				if(i ==  0)
+					X_Sum[j] = x;
+				if(i ==  0)
+					Y_Sum[j] = y;
+				else
+					Y_Sum[j] += y;
+			}
+		}
+		
+		
+		for (int i  = 0; i < fGraphTox[0]->GetN(); i++)
+		{
+			if(X_Sum[i] > Xmax) Xmax = X_Sum[i];
+			if(X_Sum[i] < Xmin) Xmin = X_Sum[i];
+			if(Y_Sum[i] > Ymax) Ymax = Y_Sum[i];
+			if(Y_Sum[i] < Ymin) Ymin = Y_Sum[i];
+		}
+	}
+	
+	if(!LinBin)
+	{
+		Xmin = 1;
+		Ymin = 1;
+	}
+	
+	
+	TH1F*	  fhr = fCNucleiTox->DrawFrame(Xmin,Ymin*0.95,Xmax,Ymax*1.05);
+	string Xtitle = "Time [year]";
+	string Ytitle = "Radio-Toxicity [Sv]";
+	fhr->SetXTitle(Xtitle.c_str());
+	fhr->SetYTitle(Ytitle.c_str());
+	fhr->GetXaxis()->CenterTitle();
+	fhr->GetYaxis()->CenterTitle();
+	fhr->GetYaxis()->SetTitleOffset(1.25);
+	
+	
+	if(SumOfSelected)
+	{
+		fGraphToxSumOfSelected = new TGraph(fGraphTox[0]->GetN(), X_Sum, Y_Sum );
+		fGraphToxSumOfSelected->SetName("Sum_Of_Selected");
+		fGraphToxSumOfSelected->SetTitle("Sum Of Selected");
+		fGraphToxSumOfSelected->SetLineColor(CurveColor(fGraphTox.size()));
+		fGraphToxSumOfSelected->SetMarkerColor(CurveColor(fGraphTox.size()));
+		fGraphToxSumOfSelected->SetMarkerStyle(10);
+		fGraphToxSumOfSelected->Draw(out.c_str());
+		fGraphToxSumOfSelected->SetLineColor(CurveColor(fGraphTox.size()));
+		fGraphToxSumOfSelected->SetMarkerColor(CurveColor(fGraphTox.size()));
+		
+		double x;
+		double y;
+		double x_0;
+		double y_0;
+		fGraphToxSumOfSelected->GetPoint(1, x_0, y_0);
+		fGraphToxSumOfSelected->GetPoint(fGraphToxSumOfSelected->GetN()-1, x, y);
+		
+		fLegendToxSumOfSelected = new TLatex(x_0+0.6*(x-x_0),y_0+1.05*(y-y_0),"Sum_Of_Selected");
+		fLegendToxSumOfSelected->SetTextSize(0.05);
+		fLegendToxSumOfSelected->SetTextFont(132);
+		fLegendToxSumOfSelected->SetTextColor(CurveColor(fGraphTox.size()));
+		fLegendToxSumOfSelected->Draw();
+		
+		
+	}
+	
+	
+	for (int i = 0; i < (int)fGraphTox.size(); i++)
+	{
+		if( i != 0 || SumOfSelected) out += " same";
+		
+		fGraphTox[i]->SetName(GetTittleOutName(toplot[i]).c_str());
+		fGraphTox[i]->SetTitle(GetTittleOutName(toplot[i]).c_str());
+		fGraphTox[i]->SetLineColor(CurveColor(i));
+		fGraphTox[i]->SetMarkerColor(CurveColor(i));
+		fGraphTox[i]->SetMarkerStyle(10);
+		fGraphTox[i]->Draw(out.c_str());
+		fGraphTox[i]->SetLineColor(CurveColor(i));
+		fGraphTox[i]->SetMarkerColor(CurveColor(i));
+		
+		double x;
+		double y;
+		double x_0;
+		double y_0;
+		fGraphTox[i]->GetPoint(1, x_0, y_0);
+		
+		fGraphTox[i]->GetPoint(fGraphTox[i]->GetN()-1, x, y);
+		
+		fLegendTox[i] = new TLatex(x_0+0.6*(x-x_0),y_0+1.05*(y-y_0),GetLegendOutName(toplot[i]).c_str());
+		fLegendTox[i]->SetTextSize(0.05);
+		fLegendTox[i]->SetTextFont(132);
+		fLegendTox[i]->SetTextColor(CurveColor(i));
+		fLegendTox[i]->Draw();
+	}
+	
+	fCNucleiTox->Update();
+	
+	
+	
+	
+}
+
+//________________________________________________________________________
+void CLASSRead::PlotHeat(vector<CLASSPlotElement> toplot, bool DecayChain, int StartingStep, cSecond FinalTime, int StepNUmber, bool LinBin, string opt)
+{
+
+	
+	if(fLegendHeat)
+	{
+		for(int i = 0; i < (int)fGraphHeat.size();i++) delete fLegendHeat[i];
+		delete [] fLegendHeat;
+	}
+	for(int i = 0; i < (int)fGraphHeat.size();i++) delete fGraphHeat[i];
+	fGraphHeat.clear();
+	if(fLegendHeatSumOfSelected)
+		delete fLegendHeatSumOfSelected;
+	if(fGraphHeatSumOfSelected)
+		delete fGraphHeatSumOfSelected;
+	
+
+	if(fCNucleiHeat && gROOT->FindObject("c_NucleiHeat"))
+	{	delete fCNucleiHeat;
+		fCNucleiHeat = 0;
+	}
+	fCNucleiHeat = new TCanvas("c_NucleiHeat","NucleiHeat",50,110,400,300);
+	if(!LinBin)
+	{
+		fCNucleiHeat->SetLogx();
+		fCNucleiHeat->SetLogy();
+	}
+	
+	fLegendHeat = new TLatex*[toplot.size()];
+	for (int i = 0; i < (int)toplot.size(); i++)
+		fLegendHeat[i] = 0;
+	
+	vector<CLASSPlotElement> toplotTTree[fData.size()];
+	
+	
+	
+	Xmin = +1.e36;
+	Xmax =  -1.e36;
+	Ymin = 1.e36;
+	Ymax = -1.e36;
+	
+	bool SumOfSelected = false;
+	
+	if(toplot[0].fTreeId ==  -1 )
+	{
+		SumOfSelected = true;
+		toplot.erase(toplot.begin());
+	}
+	
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		toplotTTree[toplot[i].fTreeId].push_back(toplot[i]);
+	}
+	
+	string out = opt;
+	for (int i = 0; i < (int)fData.size(); i++)
+	{
+		if(i ==  1) out += " same";
+		if(toplotTTree[i].size() != 0)
+		{
+			if(!DecayChain)
+				BuildTGraph(toplotTTree[i], 2, out);
+			else
+				BuildTGraphUsingDecayChain(toplotTTree[i], 2, StartingStep, FinalTime, StepNUmber, LinBin, out);
+		}
+	}
+	fCNucleiHeat->cd();
+	
+	double X_Sum[fGraphHeat[0]->GetN()];
+	double Y_Sum[fGraphHeat[0]->GetN()];
+	
+	if(SumOfSelected)
+	{
+		for (int i = 0; i < (int)fGraphHeat.size(); i++)
+		{
+			
+			for(int j = 0; j < fGraphHeat[i]->GetN(); j++)
+			{
+				double x;
+				double y;
+				fGraphHeat[i]->GetPoint(j, x, y);
+				if(i ==  0)
+					X_Sum[j] = x;
+				if(i ==  0)
+					Y_Sum[j] = y;
+				else
+					Y_Sum[j] += y;
+			}
+		}
+		
+		
+		for (int i  = 0; i < fGraphHeat[0]->GetN(); i++)
+		{
+			if(X_Sum[i] > Xmax) Xmax = X_Sum[i];
+			if(X_Sum[i] < Xmin) Xmin = X_Sum[i];
+			if(Y_Sum[i] > Ymax) Ymax = Y_Sum[i];
+			if(Y_Sum[i] < Ymin) Ymin = Y_Sum[i];
+		}
+	}
+	
+	if(!LinBin)
+	{
+		Xmin = 1;
+		Ymin = 1;
+	}
+	
+	TH1F*	  fhr = fCNucleiHeat->DrawFrame(Xmin,Ymin*0.95,Xmax,Ymax*1.05);
+	string Xtitle = "Time [year]";
+	string Ytitle = "Decay Heat [W]";
+	fhr->SetXTitle(Xtitle.c_str());
+	fhr->SetYTitle(Ytitle.c_str());
+	fhr->GetXaxis()->CenterTitle();
+	fhr->GetYaxis()->CenterTitle();
+	fhr->GetYaxis()->SetTitleOffset(1.25);
+	
+	
+	if(SumOfSelected)
+	{
+		fGraphHeatSumOfSelected = new TGraph(fGraphHeat[0]->GetN(), X_Sum, Y_Sum );
+		fGraphHeatSumOfSelected->SetName("Sum_Of_Selected");
+		fGraphHeatSumOfSelected->SetTitle("Sum Of Selected");
+		fGraphHeatSumOfSelected->SetLineColor(CurveColor(fGraphHeat.size()));
+		fGraphHeatSumOfSelected->SetMarkerColor(CurveColor(fGraphHeat.size()));
+		fGraphHeatSumOfSelected->SetMarkerStyle(10);
+		fGraphHeatSumOfSelected->Draw(out.c_str());
+		fGraphHeatSumOfSelected->SetLineColor(CurveColor(fGraphHeat.size()));
+		fGraphHeatSumOfSelected->SetMarkerColor(CurveColor(fGraphHeat.size()));
+		
+		double x;
+		double y;
+		double x_0;
+		double y_0;
+		fGraphHeatSumOfSelected->GetPoint(1, x_0, y_0);
+		fGraphHeatSumOfSelected->GetPoint(fGraphHeatSumOfSelected->GetN()-1, x, y);
+		
+		fLegendHeatSumOfSelected = new TLatex(x_0+0.6*(x-x_0),y_0+1.05*(y-y_0),"Sum_Of_Selected");
+		fLegendHeatSumOfSelected->SetTextSize(0.05);
+		fLegendHeatSumOfSelected->SetTextFont(132);
+		fLegendHeatSumOfSelected->SetTextColor(CurveColor(fGraphHeat.size()));
+		fLegendHeatSumOfSelected->Draw();
+		
+		
+	}
+	
+	
+	for (int i = 0; i < (int)fGraphHeat.size(); i++)
+	{
+		if( i != 0 || SumOfSelected) out += " same";
+		
+		fGraphHeat[i]->SetName(GetTittleOutName(toplot[i]).c_str());
+		fGraphHeat[i]->SetTitle(GetTittleOutName(toplot[i]).c_str());
+		fGraphHeat[i]->SetLineColor(CurveColor(i));
+		fGraphHeat[i]->SetMarkerColor(CurveColor(i));
+		fGraphHeat[i]->SetMarkerStyle(10);
+		fGraphHeat[i]->Draw(out.c_str());
+		fGraphHeat[i]->SetLineColor(CurveColor(i));
+		fGraphHeat[i]->SetMarkerColor(CurveColor(i));
+		
+		double x;
+		double y;
+		double x_0;
+		double y_0;
+		fGraphHeat[i]->GetPoint(1, x_0, y_0);
+		
+		fGraphHeat[i]->GetPoint(fGraphHeat[i]->GetN()-1, x, y);
+		
+		fLegendHeat[i] = new TLatex(x_0+0.6*(x-x_0),y_0+1.05*(y-y_0),GetLegendOutName(toplot[i]).c_str());
+		fLegendHeat[i]->SetTextSize(0.05);
+		fLegendHeat[i]->SetTextFont(132);
+		fLegendHeat[i]->SetTextColor(CurveColor(i));
+		fLegendHeat[i]->Draw();
+	}
+	
+	fCNucleiHeat->Update();
+	
+	
+	
+	
+}
+
+
+//________________________________________________________________________
+void CLASSRead::BuildTGraph(vector<CLASSPlotElement> toplot, int PlotId, string opt)
+{
+
+	TGraph** Graph;
+	int NumberGraphIterator = 0;
+
+	
+	fData[toplot[0].fTreeId]->SetBranchStatus("*", 0);
+	fData[toplot[0].fTreeId]->SetBranchStatus("AbsTime", 1);
+
+
+
+	string out = opt;
+	Long64_t nentries = fData[toplot[0].fTreeId]->GetEntries();
+
+	Long64_t Time = 0;
+	fData[toplot[0].fTreeId]->SetBranchAddress("AbsTime", &Time);
+
+	Reactor* reactor[fReactorName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fReactorName[toplot[0].fTreeId].size(); i++ )
+		reactor[i] = 0;
+
+	Pool* pool[fPoolName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fPoolName[toplot[0].fTreeId].size(); i++ )
+		pool[i] = 0;
+
+	FabricationPlant* fabricationplant[fFabricationName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fFabricationName[toplot[0].fTreeId].size(); i++ )
+		fabricationplant[i] = 0;
+
+	Storage* stock[fStockName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fStockName[toplot[0].fTreeId].size(); i++ )
+		stock[i] = 0;
+
+	IsotopicVector* IV[8];
+	for(int i = 0; i < 8; i++ )
+		IV[i] = 0;
+
+	vector< double > vTime;
+	vector< double > vQuantity[toplot.size()];
+
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+
+		string InBranchName = GetBranchInName(toplot[i]);
+
+		string ActiveInBranchName = InBranchName + "*";
+		fData[toplot[0].fTreeId]->SetBranchStatus(ActiveInBranchName.c_str(),1);
+
+		if(toplot[i].fFacilityId ==  0)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &IV[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  1)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &reactor[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  2)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &stock[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  3)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &pool[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  4)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &fabricationplant[toplot[i].fFacylityNumber]);
+	}
+
+
+	for (Long64_t  j = 0; j < nentries; j++)
+	{
+		fData[toplot[0].fTreeId]->GetEntry(j);
+
+		vTime.push_back(Time/3600./24./365.25);
+
+		if(Xmin>vTime.back()) Xmin = vTime.back();
+		if(Xmax<vTime.back()) Xmax = vTime.back();
+
+		for (int i = 0; i < (int)toplot.size(); i++)
+		{
+
+			if(toplot[i].fFacilityId ==  0)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+				double ZAIQuantity = IV[toplot[i].fFacylityNumber]->GetZAIIsotopicQuantity(Z,A,I);
+			
+				if(PlotId ==  0)
+					ZAIQuantity *=  cZAIMass.GetMass(Z,A)/AVOGADRO*1e-3;
+				else if(PlotId ==  1)
+					ZAIQuantity *=  cZAITox.GetRadioTox(Z,A,I);
+				else if(PlotId ==  2)
+					ZAIQuantity *=  cZAIHeat.GetHeat(Z,A,I);
+				else
+				{
+					cout << "Bad PlotId" << endl;
+					return;
+				}
+
+				
+				vQuantity[i].push_back(ZAIQuantity);
+
+
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+			else if(toplot[i].fFacilityId ==  1)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+
+				double ZAIQuantity = 0;
+
+				if( toplot[i].fIVNumber ==  0 )
+					ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I);
+				else if( toplot[i].fIVNumber ==  1 )
+					ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I);
+				else if( toplot[i].fIVNumber ==  2 )
+					ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I);
+				else
+				{
+					cout << "Bad IVNumber" << endl;
+					return;
+				}
+
+				if(PlotId ==  0)
+					ZAIQuantity *=  cZAIMass.GetMass(Z,A)/AVOGADRO*1e-3;
+				else if(PlotId ==  1)
+					ZAIQuantity *=  cZAITox.GetRadioTox(Z,A,I);
+				else if(PlotId ==  2)
+					ZAIQuantity *=  cZAIHeat.GetHeat(Z,A,I);
+				else
+				{
+					cout << "Bad PlotId" << endl;
+					return;
+				}
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+			else if(toplot[i].fFacilityId ==  2)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+
+				double ZAIQuantity = 0;
+
+				if( toplot[i].fIVNumber ==  0 )
+					ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I);
+				else if( toplot[i].fIVNumber ==  1 )
+					ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I);
+				else if( toplot[i].fIVNumber ==  2 )
+					ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I);
+				else
+				{
+					cout << "Bad IVNumber" << endl;
+					return;
+				}
+				
+				if(PlotId ==  0)
+					ZAIQuantity *=  cZAIMass.GetMass(Z,A)/AVOGADRO*1e-3;
+				else if(PlotId ==  1)
+					ZAIQuantity *=  cZAITox.GetRadioTox(Z,A,I);
+				else if(PlotId ==  2)
+					ZAIQuantity *=  cZAIHeat.GetHeat(Z,A,I);
+				else
+				{
+					cout << "Bad PlotId" << endl;
+					return;
+				}
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+			else if(toplot[i].fFacilityId ==  3)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+
+				double ZAIQuantity = 0;
+
+				if( toplot[i].fIVNumber ==  0 )
+					ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I);
+				else if( toplot[i].fIVNumber ==  1 )
+					ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I);
+				else if( toplot[i].fIVNumber ==  2 )
+					ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I);
+				else
+				{
+					cout << "Bad IVNumber" << endl;
+					return;
+				}
+				
+				if(PlotId ==  0)
+					ZAIQuantity *=  cZAIMass.GetMass(Z,A)/AVOGADRO*1e-3;
+				else if(PlotId ==  1)
+					ZAIQuantity *=  cZAITox.GetRadioTox(Z,A,I);
+				else if(PlotId ==  2)
+					ZAIQuantity *=  cZAIHeat.GetHeat(Z,A,I);
+				else
+				{
+					cout << "Bad PlotId" << endl;
+					return;
+				}
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+			else if(toplot[i].fFacilityId ==  4)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+
+				double ZAIQuantity = 0;
+
+				if( toplot[i].fIVNumber ==  0 )
+					ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I);
+				else if( toplot[i].fIVNumber ==  1 )
+					ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I);
+				else if( toplot[i].fIVNumber ==  2 )
+					ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I);
+				else
+				{
+					cout << "Bad IVNumber" << endl;
+					return;
+				}
+				
+				if(PlotId ==  0)
+					ZAIQuantity *=  cZAIMass.GetMass(Z,A)/AVOGADRO*1e-3;
+				else if(PlotId ==  1)
+					ZAIQuantity *=  cZAITox.GetRadioTox(Z,A,I);
+				else if(PlotId ==  2)
+					ZAIQuantity *=  cZAIHeat.GetHeat(Z,A,I);
+				else
+				{
+					cout << "Bad PlotId" << endl;
+					return;
+				}
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+		}
+
+
+	}
+	
+
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		
+		if(PlotId ==  0)
+			fGraphInv.push_back(new TGraph(vTime.size(), &vTime[0], &(vQuantity[i])[0]));
+		
+		else if(PlotId ==  1)
+			fGraphTox.push_back(new TGraph(vTime.size(), &vTime[0], &(vQuantity[i])[0]));
+		
+		else if(PlotId ==  2)
+			fGraphHeat.push_back(new TGraph(vTime.size(), &vTime[0], &(vQuantity[i])[0]));
+		
+		else
+		{
+			cout << "Bad PlotId" << endl;
+			return;
+		}
+		
+	}
+	
+	fData[toplot[0].fTreeId]->ResetBranchAddresses();
+	{
+		for(int i = 0; i< (int)fReactorName[toplot[0].fTreeId].size(); i++) delete reactor[i];
+		
+		for(int i = 0; i< (int)fPoolName[toplot[0].fTreeId].size(); i++) delete pool[i];
+		
+		for(int i = 0; i< (int)fFabricationName[toplot[0].fTreeId].size(); i++) delete fabricationplant[i];
+		
+		for(int i = 0; i< (int)fStockName[toplot[0].fTreeId].size(); i++) delete stock[i];
+		for(int i = 0; i< 8; i++) delete IV[i];
+	}
+
+
+	
+
+}
+
+void CLASSRead::BuildTGraphUsingDecayChain(vector<CLASSPlotElement> toplot, int PlotId, int StartingStep, cSecond FinalTime, int StepNUmber, bool LinBin, string opt)
+{
+	
+	fData[toplot[0].fTreeId]->SetBranchStatus("*", 0);
+	fData[toplot[0].fTreeId]->SetBranchStatus("AbsTime", 1);
+	
+
+	
+	string out = opt;
+	Long64_t nentries = fData[toplot[0].fTreeId]->GetEntries();
+	
+	Long64_t Time = 0;
+	fData[toplot[0].fTreeId]->SetBranchAddress("AbsTime", &Time);
+	
+	Reactor* reactor[fReactorName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fReactorName[toplot[0].fTreeId].size(); i++ )
+		reactor[i] = 0;
+	
+	Pool* pool[fPoolName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fPoolName[toplot[0].fTreeId].size(); i++ )
+		pool[i] = 0;
+	
+	FabricationPlant* fabricationplant[fFabricationName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fFabricationName[toplot[0].fTreeId].size(); i++ )
+		fabricationplant[i] = 0;
+	
+	Storage* stock[fStockName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fStockName[toplot[0].fTreeId].size(); i++ )
+		stock[i] = 0;
+	
+	IsotopicVector* IV[8];
+	for(int i = 0; i < 8; i++ )
+		IV[i] = 0;
+	
+	vector< double > vTime;
+	vector< IsotopicVector > vIV[toplot.size()];
+	vector< double > vQuantity[toplot.size()];
+
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		
+		string InBranchName = GetBranchInName(toplot[i]);
+		
+		string ActiveInBranchName = InBranchName + "*";
+		fData[toplot[0].fTreeId]->SetBranchStatus(ActiveInBranchName.c_str(),1);
+		
+		if(toplot[i].fFacilityId ==  0)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &IV[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  1)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &reactor[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  2)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &stock[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  3)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &pool[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  4)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &fabricationplant[toplot[i].fFacylityNumber]);
+	}
+	
+	
+	
+	
+	
+	fData[toplot[0].fTreeId]->GetEntry(StartingStep);
+	vTime.push_back(1);
+	
+	Xmin = vTime[0];
+	Xmax = vTime[0] + FinalTime/cYear;
+
+	
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		
+		if(toplot[i].fFacilityId ==  0)
+		{
+			int Z = toplot[i].fZAI.Z();
+			int A = toplot[i].fZAI.A();
+			int I = toplot[i].fZAI.I();
+			IsotopicVector ZAIQuantity = IV[toplot[i].fFacylityNumber]->GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			
+			vIV[i].push_back(ZAIQuantity);
+			
+		}
+		else if(toplot[i].fFacilityId ==  1)
+		{
+			int Z = toplot[i].fZAI.Z();
+			int A = toplot[i].fZAI.A();
+			int I = toplot[i].fZAI.I();
+			
+			IsotopicVector ZAIQuantity;
+			
+			if( toplot[i].fIVNumber ==  0 )
+				ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else if( toplot[i].fIVNumber ==  1 )
+				ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else if( toplot[i].fIVNumber ==  2 )
+				ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else
+			{
+				cout << "Bad IVNumber" << endl;
+				return;
+			}
+			
+			vIV[i].push_back(ZAIQuantity);
+			
+		}
+		else if(toplot[i].fFacilityId ==  2)
+		{
+			int Z = toplot[i].fZAI.Z();
+			int A = toplot[i].fZAI.A();
+			int I = toplot[i].fZAI.I();
+			
+			IsotopicVector ZAIQuantity;
+			
+			if( toplot[i].fIVNumber ==  0 )
+				ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else if( toplot[i].fIVNumber ==  1 )
+				ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else if( toplot[i].fIVNumber ==  2 )
+				ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else
+			{
+				cout << "Bad IVNumber" << endl;
+				return;
+			}
+			
+			vIV[i].push_back(ZAIQuantity);
+			
+		}
+		else if(toplot[i].fFacilityId ==  3)
+		{
+			int Z = toplot[i].fZAI.Z();
+			int A = toplot[i].fZAI.A();
+			int I = toplot[i].fZAI.I();
+			
+			IsotopicVector ZAIQuantity;
+			
+			if( toplot[i].fIVNumber ==  0 )
+				ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else if( toplot[i].fIVNumber ==  1 )
+				ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else if( toplot[i].fIVNumber ==  2 )
+				ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else
+			{
+				cout << "Bad IVNumber" << endl;
+				return;
+			}
+		
+			vIV[i].push_back(ZAIQuantity);
+			
+		}
+		else if(toplot[i].fFacilityId ==  4)
+		{
+			int Z = toplot[i].fZAI.Z();
+			int A = toplot[i].fZAI.A();
+			int I = toplot[i].fZAI.I();
+			
+			IsotopicVector ZAIQuantity;
+			
+			if( toplot[i].fIVNumber ==  0 )
+				ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else if( toplot[i].fIVNumber ==  1 )
+				ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else if( toplot[i].fIVNumber ==  2 )
+				ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I) * ZAI(Z,A,I);
+			else
+			{
+				cout << "Bad IVNumber" << endl;
+				return;
+			}
+			
+			
+			vIV[i].push_back(ZAIQuantity);
+			
+		}
+	}
+	
+	
+	vector<double> vTimeStep;
+	
+	if(LinBin)
+	{
+	   for(int i = 0; i < StepNUmber; i++)
+	   {
+		   vTime.push_back( (FinalTime/StepNUmber + vTime.back()*cYear)/cYear );
+		   vTimeStep.push_back( FinalTime/StepNUmber );
+	   }
+	}
+	else
+	{
+		
+		double dt = 1./double(StepNUmber) * log( FinalTime/cYear /vTime[0]);
+		
+		for(int k = 1 ; k <= StepNUmber; k++)
+		{
+			vTime.push_back( exp( dt*double(k) ) * vTime[0] );
+			
+			vTimeStep.push_back( (vTime[vTime.size()-1] - vTime[vTime.size()-2])*cYear );
+		}
+	}
+	
+	
+		
+	for(int i = 0; i < StepNUmber; i++)
+		for(int j = 0; j < (int)toplot.size(); j++)
+			vIV[j].push_back( cDecayData.GetDecay( vIV[j].back(), vTimeStep[i]  ) );
+	
+	for(int i = 0; i < (int)vTime.size(); i++)
+	{
+		for(int j = 0; j < (int)toplot.size(); j++)
+		{
+
+			int Z = toplot[j].fZAI.Z();
+			int A = toplot[j].fZAI.A();
+			int I = toplot[j].fZAI.I();
+
+			double ZAIQuantity = 0;
+			
+			if(PlotId ==  0)
+				ZAIQuantity = vIV[j][i].GetZAIIsotopicQuantity(Z,A,I) * cZAIMass.GetMass(Z,A)/AVOGADRO*1e-3;
+			else if(PlotId ==  1)
+				ZAIQuantity = cZAITox.GetRadioTox( vIV[j][i] );
+			else if(PlotId ==  2)
+				ZAIQuantity = cZAIHeat.GetHeat( vIV[j][i] );
+			else
+			{
+				cout << "Bad PlotId" << endl;
+				return;
+			}
+			
+			
+			if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+			if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			
+			vQuantity[j].push_back(ZAIQuantity);
+		}
+	}
+	
+	if(!LinBin)
+	{
+		Xmin = 1;
+		Ymin = 1;
+	}
+	
+	
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		
+		if(PlotId ==  0)
+			fGraphInv.push_back(new TGraph(vTime.size(), &vTime[0], &(vQuantity[i])[0]));
+		
+		else if(PlotId ==  1)
+			fGraphTox.push_back(new TGraph(vTime.size(), &vTime[0], &(vQuantity[i])[0]));
+		
+		else if(PlotId ==  2)
+			fGraphHeat.push_back(new TGraph(vTime.size(), &vTime[0], &(vQuantity[i])[0]));
+		
+		else
+		{
+			cout << "Bad PlotId" << endl;
+			return;
+		}
+		
+	}
+	
+	fData[toplot[0].fTreeId]->ResetBranchAddresses();
+	{
+		for(int i = 0; i< (int)fReactorName[toplot[0].fTreeId].size(); i++) delete reactor[i];
+		
+		for(int i = 0; i< (int)fPoolName[toplot[0].fTreeId].size(); i++) delete pool[i];
+		
+		for(int i = 0; i< (int)fFabricationName[toplot[0].fTreeId].size(); i++) delete fabricationplant[i];
+		
+		for(int i = 0; i< (int)fStockName[toplot[0].fTreeId].size(); i++) delete stock[i];
+		for(int i = 0; i< 8; i++) delete IV[i];
+	}
+	
+
+}
+
+
+//________________________________________________________________________
+//________________________________________________________________________
+void CLASSRead::PlotPower(vector<CLASSPlotElement> toplot, string opt)
+{
+	if(fGraphPower)
+	{
+		for(int i = 0; i < fNumberGraphPowerIterator;i++) delete fGraphPower[i];
+		delete [] fGraphPower;
+	}
+
+
+	if(fLegendPower)
+	{
+		for(int i = 0; i < fNumberGraphPowerIterator;i++) delete fLegendPower[i];
+		delete [] fLegendPower;
+	}
+
+	if(fCPower && gROOT->FindObject("fCPower"))
+	{	delete fCPower;
+		fCPower = 0;
+	}
+
+
+	fCPower = new TCanvas("fCPower","Power",50,110,400,300);
+	fGraphPower = new TGraph*[fData.size()];
+	fLegendPower = new TLatex*[fData.size()];
+
+
+	for (int i = 0; i < (int)fData.size(); i++)
+	{
+		fGraphPower[i] = 0;
+		fLegendPower[i] = 0;
+	}
+
+	vector<CLASSPlotElement> toplotTTree[fData.size()];
+
+	fNumberGraphPowerIterator = 0;
+	Xmin = +1.e36;
+	Xmax =  -1.e36;
+	Ymin = 1.e36;
+	Ymax = -1.e36;
+
+
+
+
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		toplotTTree[toplot[i].fTreeId].push_back(toplot[i]);
+	}
+
+	string out = opt;
+	for (int i = 0; i < (int)fData.size(); i++)
+	{
+
+		if(i != 0) out += " same";
+		if(toplotTTree[i].size() != 0)
+			PlotTTreePower(toplotTTree[i], out);
+
+
+	}
+
+	fCPower->cd();
+
+	TH1F*	  fhrPower =  fCPower->DrawFrame(Xmin,Ymin*0.95,Xmax,Ymax*1.05);
+	string Xtitle = "Time [year]";
+	string Ytitle = "Total Thermal Power [GW]";
+	fhrPower->SetXTitle(Xtitle.c_str());
+	fhrPower->SetYTitle(Ytitle.c_str());
+	fhrPower->GetXaxis()->CenterTitle();
+	fhrPower->GetYaxis()->CenterTitle();
+	fhrPower->GetYaxis()->SetTitleOffset(1.25);
+
+	for (int i = 0; i < (int)fNumberGraphPowerIterator; i++)
+	{
+		fCPower->cd();
+		if( i != 0 ) out += " same";
+
+		fGraphPower[i]->SetName(GetTittleOutName(toplot[i]).c_str());
+		fGraphPower[i]->SetTitle(GetTittleOutName(toplot[i]).c_str());
+		fGraphPower[i]->SetLineColor(CurveColor(i));
+		fGraphPower[i]->SetMarkerColor(CurveColor(i));
+		fGraphPower[i]->SetMarkerStyle(10);
+		fGraphPower[i]->Draw(out.c_str());
+
+		fCPower->cd();
+
+		double x;
+		double y;
+		double x_0;
+		double y_0;
+		fGraphPower[i]->GetPoint(1, x_0, y_0);
+		
+		fGraphPower[i]->GetPoint(fGraphPower[i]->GetN()-1, x, y);
+				
+		fLegendPower[i] = new TLatex(x_0+0.6*(x-x_0),y_0+1.05*(y-y_0),GetLegendOutName(toplot[i]).c_str());
+		fLegendPower[i]->SetTextSize(0.05);
+		fLegendPower[i]->SetTextFont(132);
+		fLegendPower[i]->SetTextColor(CurveColor(i));
+		fLegendPower[i]->Draw();
+	}
+	fCPower->Update();
+	
+	
+	
+}
+
+//________________________________________________________________________
+void CLASSRead::PlotTTreePower(vector<CLASSPlotElement> toplot, string opt)
+{
+
+	fData[toplot[0].fTreeId]->SetBranchStatus("*", 0);
+	fData[toplot[0].fTreeId]->SetBranchStatus("AbsTime", 1);
+	fData[toplot[0].fTreeId]->SetBranchStatus("ParcPower", 1);
+
+
+	string out = opt;
+	Long64_t nentries = fData[toplot[0].fTreeId]->GetEntries();
+
+
+	Long64_t Time = 0;
+	fData[toplot[0].fTreeId]->SetBranchAddress("AbsTime", &Time);
+	
+	double Power = 0;
+	fData[toplot[0].fTreeId]->SetBranchAddress("ParcPower", &Power);
+
+
+	double  vTime[nentries];
+	double  vPower[nentries];
+
+
+
+	for (Long64_t  j = 0; j < nentries; j++)
+	{
+		fData[toplot[0].fTreeId]->GetEntry(j);
+
+		vTime[j] = Time/3600./24./365.25;
+		vPower[j] = Power/1.e9;
+
+		if(Xmin>vTime[j]) Xmin = vTime[j];
+		if(Xmax<vTime[j]) Xmax = vTime[j];
+
+		if(Ymin>vPower[j]) Ymin = vPower[j];
+		if(Ymax<vPower[j]) Ymax = vPower[j];
+	}
+
+
+	fGraphPower[fNumberGraphPowerIterator] = new TGraph(nentries, vTime, vPower);
+
+	fData[toplot[0].fTreeId]->ResetBranchAddresses();
+
+
+	fNumberGraphPowerIterator++;
+
+}
+
+
+//________________________________________________________________________
+//________________________________________________________________________
+//________________________________________________________________________
+//________________________________________________________________________
+void CLASSRead::Write(string filename, string fileformat, string PadName)
+{
+	if(fileformat ==  "ASCII")
+		ASCIIWrite(filename,PadName);
+
+}
+void CLASSRead::ASCIIWrite(string filename, string PadName)
+{
+
+	ofstream outfile;
+	outfile.open(filename.c_str());
+	if(!outfile)
+	{
+		cout << "Could not open : " << filename << " !" << endl;
+		exit(-1);
+	}
+
+	cout << "WARNING!! not working if using many CLASS.root file with different timestep!!!" << endl;
+
+	if ( (int)fGraphInv.size() != 0 && PadName == "c_NucleiInv")
+	{
+		double* X = fGraphInv[0]->GetX();
+		
+		outfile << "time";
+		for(int i =  0; i < fGraphInv[0]->GetN(); i++)
+			outfile << "\t" << X[i];
+		
+		outfile << endl;
+		
+		
+		if (fGraphInvSumOfSelected) {
+			
+			outfile << fGraphInvSumOfSelected->GetTitle();
+			double* Y = fGraphInvSumOfSelected->GetY();
+			for(int j =  0; j < fGraphInvSumOfSelected->GetN(); j++)
+				outfile << "\t" << Y[j];
+			outfile << endl;
+		}
+		
+		
+		for(int i = 0; i < (int)fGraphInv.size(); i++)
+		{
+			outfile << fGraphInv[i]->GetTitle();
+			double* Y = fGraphInv[i]->GetY();
+			for(int j =  0; j < fGraphInv[i]->GetN(); j++)
+				outfile << "\t" << Y[j];
+			outfile << endl;
+		}
+		
+	}
+	
+	
+	if ( (int)fGraphTox.size() != 0 && PadName == "c_NucleiTox")
+	{
+		double* X = fGraphTox[0]->GetX();
+		
+		outfile << "time";
+		for(int i =  0; i < fGraphTox[0]->GetN(); i++)
+			outfile << "\t" << X[i];
+		
+		outfile << endl;
+		
+		
+		if (fGraphToxSumOfSelected) {
+			
+			outfile << fGraphToxSumOfSelected->GetTitle();
+			double* Y = fGraphToxSumOfSelected->GetY();
+			for(int j =  0; j < fGraphToxSumOfSelected->GetN(); j++)
+				outfile << "\t" << Y[j];
+			outfile << endl;
+		}
+		
+		
+		for(int i = 0; i < (int)fGraphTox.size(); i++)
+		{
+			outfile << fGraphTox[i]->GetTitle();
+			double* Y = fGraphTox[i]->GetY();
+			for(int j =  0; j < fGraphTox[i]->GetN(); j++)
+				outfile << "\t" << Y[j];
+			outfile << endl;
+		}
+		
+	}
+	
+	if ( (int)fGraphHeat.size() != 0 && PadName == "c_NucleiHeat")
+	{
+		double* X = fGraphHeat[0]->GetX();
+		
+		outfile << "time";
+		for(int i =  0; i < fGraphHeat[0]->GetN(); i++)
+			outfile << "\t" << X[i];
+		
+		outfile << endl;
+		
+		
+		if (fGraphHeatSumOfSelected) {
+			
+			outfile << fGraphHeatSumOfSelected->GetTitle();
+			double* Y = fGraphHeatSumOfSelected->GetY();
+			for(int j =  0; j < fGraphHeatSumOfSelected->GetN(); j++)
+				outfile << "\t" << Y[j];
+			outfile << endl;
+		}
+		
+		
+		for(int i = 0; i < (int)fGraphHeat.size(); i++)
+		{
+			outfile << fGraphHeat[i]->GetTitle();
+			double* Y = fGraphHeat[i]->GetY();
+			for(int j =  0; j < fGraphHeat[i]->GetN(); j++)
+				outfile << "\t" << Y[j];
+			outfile << endl;
+		}
+		
+	}
+	
+}
+
+
+
+//________________________________________________________________________
+//________________________________________________________________________
+//________________________________________________________________________
+void CLASSRead::ConvertxmlTTreeMass(vector<CLASSPlotElement> toplot, string filename)
+{
+
+
+
+	fData[toplot[0].fTreeId]->SetBranchStatus("*", 0);
+	fData[toplot[0].fTreeId]->SetBranchStatus("AbsTime", 1);
+
+
+
+	Long64_t nentries = fData[toplot[0].fTreeId]->GetEntries();
+
+
+	Long64_t Time = 0;
+	fData[toplot[0].fTreeId]->SetBranchAddress("AbsTime", &Time);
+
+	Reactor* reactor[fReactorName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fReactorName[toplot[0].fTreeId].size(); i++ )
+		reactor[i] = 0;
+
+	Pool* pool[fPoolName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fPoolName[toplot[0].fTreeId].size(); i++ )
+		pool[i] = 0;
+
+	FabricationPlant* fabricationplant[fFabricationName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fFabricationName[toplot[0].fTreeId].size(); i++ )
+		fabricationplant[i] = 0;
+
+	Storage* stock[fStockName[toplot[0].fTreeId].size()];
+	for(int i = 0; i < (int)fStockName[toplot[0].fTreeId].size(); i++ )
+		stock[i] = 0;
+
+	IsotopicVector* IV[8];
+	for(int i = 0; i < 8; i++ )
+		IV[i] = 0;
+
+	vector< double > vTime;
+	vector< double > vQuantity[toplot.size()];
+
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+
+		string InBranchName = GetBranchInName(toplot[i]);
+
+		string ActiveInBranchName = InBranchName + "*";
+		fData[toplot[0].fTreeId]->SetBranchStatus(ActiveInBranchName.c_str(),1);
+
+		if(toplot[i].fFacilityId ==  0)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &IV[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  1)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &reactor[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  2)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &stock[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  3)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &pool[toplot[i].fFacylityNumber]);
+		else if(toplot[i].fFacilityId ==  4)
+			fData[toplot[i].fTreeId]->SetBranchAddress(InBranchName.c_str(), &fabricationplant[toplot[i].fFacylityNumber]);
+	}
+
+
+	for (Long64_t  j = 0; j < nentries; j++)
+	{
+		fData[toplot[0].fTreeId]->GetEntry(j);
+
+		vTime.push_back(Time/3600./24./365.25);
+
+		if(Xmin>vTime.back()) Xmin = vTime.back();
+		if(Xmax<vTime.back()) Xmax = vTime.back();
+
+		for (int i = 0; i < (int)toplot.size(); i++)
+		{
+
+			if(toplot[i].fFacilityId ==  0)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+				double ZAIQuantity = IV[toplot[i].fFacylityNumber]->GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+			else if(toplot[i].fFacilityId ==  1)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+
+				double ZAIQuantity = 0;
+
+				if( toplot[i].fIVNumber ==  0 )
+					ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else if( toplot[i].fIVNumber ==  1 )
+					ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else if( toplot[i].fIVNumber ==  2 )
+					ZAIQuantity = reactor[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else
+				{
+					cout << "Bad IVNumber" << endl;
+					break;
+				}
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+			else if(toplot[i].fFacilityId ==  2)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+
+				double ZAIQuantity = 0;
+
+				if( toplot[i].fIVNumber ==  0 )
+					ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else if( toplot[i].fIVNumber ==  1 )
+					ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else if( toplot[i].fIVNumber ==  2 )
+					ZAIQuantity = stock[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else
+				{
+					cout << "Bad IVNumber" << endl;
+					break;
+				}
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+			else if(toplot[i].fFacilityId ==  3)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+
+				double ZAIQuantity = 0;
+
+				if( toplot[i].fIVNumber ==  0 )
+					ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else if( toplot[i].fIVNumber ==  1 )
+					ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else if( toplot[i].fIVNumber ==  2 )
+					ZAIQuantity = pool[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else
+				{
+					cout << "Bad IVNumber" << endl;
+					break;
+				}
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+			else if(toplot[i].fFacilityId ==  4)
+			{
+				int Z = toplot[i].fZAI.Z();
+				int A = toplot[i].fZAI.A();
+				int I = toplot[i].fZAI.I();
+
+				double ZAIQuantity = 0;
+
+				if( toplot[i].fIVNumber ==  0 )
+					ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetInsideIV().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else if( toplot[i].fIVNumber ==  1 )
+					ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetCumulativeIVIn().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else if( toplot[i].fIVNumber ==  2 )
+					ZAIQuantity = fabricationplant[toplot[i].fFacylityNumber]->GetCumulativeIVOut().GetZAIIsotopicQuantity(Z,A,I)*A/6.02e23*1e-3;
+				else
+				{
+					cout << "Bad IVNumber" << endl;
+					break;
+				}
+
+				vQuantity[i].push_back(ZAIQuantity);
+
+				if(Ymin>ZAIQuantity) Ymin = ZAIQuantity;
+				if(Ymax<ZAIQuantity) Ymax = ZAIQuantity;
+
+			}
+		}
+
+
+	}
+
+
+
+
+
+
+
+	// Beginning of the document XML
+	ofstream f (filename.c_str());
+	cout << f.is_open();
+	if (!f.is_open())
+		cout << "Impossible d'ouvrir le fichier en ecriture !" << endl;
+	else
+	{
+		f << "<?xml version = \"1.0\" encoding = \"UTF-8\" ?>" << endl;
+		f << "<file filename = \"" <<  filename << "\" created = \" \"" << endl;
+		f << "<unit time = \"years\"  Masse = \"kg\" power = \"MW\" />" << endl;
+                f << "<material matid = \" \">" << endl;
+		f << "\t<time>" << endl;
+
+
+		//Print all information about time(always the same for 0 to 20 yeaur) and the module involved
+
+
+		for (int i  = 0; i < (int)vTime.size(); i++) {
+
+			f << "\t\t<timestamp tid = \"" << i  << "\"  time = \"" <<  vTime[i] << "\" />" << endl;
+		}
+		f << "\t</time>" << endl;
+
+
+		f << "\t\t<Massehistory>" << endl;
+
+
+
+
+		//Print information about the masse(kg) of isotope in facility chossen
+
+
+
+		for (int i  = 0; i < (int)vTime.size(); i++)
+		{
+
+			f << "\t\t\t<compositiondata tid = \"" <<  i  << "\">" << endl;
+			f << "\t\t\t\t<composition>" << endl;
+
+
+
+			for (int j  = 0; j< (int)toplot.size(); j++)
+                        {
+
+				string name;
+				switch (toplot[j].fFacilityId)
+				{
+					case 0:
+						switch (toplot[j].fFacylityNumber)
+					{
+						case 0:
+							name = "TOTAL.";
+
+
+							break;
+
+						case 1:
+							name = "INCYCLE.";
+
+
+							break;
+
+						case 2:
+							name = "WASTE.";
+
+
+							break;
+
+						case 3:
+							name = "OUTINCOME.";
+
+
+
+							break;
+
+						case 4:
+							name = "REACTOR.";
+
+
+
+							break;
+
+						case 5:
+							name = "COOLING.";
+
+
+
+							break;
+
+						case 6:
+							name = "STOCK.";
+
+
+
+							break;
+
+						case 7:
+							name = "FUELFABRICATION.";
+
+
+
+							break;
+
+						default:
+							break;
+					}
+						break;
+
+					case 1:
+						name = "Reactor" + itoa(toplot[j].fFacylityNumber) + ".";
+
+
+
+						break;
+
+					case 2:
+						name = "Storage" + itoa(toplot[j].fFacylityNumber) + ".";
+
+
+
+						break;
+
+					case 3:
+						name = "Pool" + itoa(toplot[j].fFacylityNumber) + ".";
+
+
+
+
+						break;
+
+					case 4:
+						name = "FabricationPlant" + itoa(toplot[j].fFacylityNumber) + ".";
+
+
+
+						break;
+
+
+					default:
+						break;
+				}
+
+
+				f << "\t\t\t\t\t<isotope zamid = \"" <<  itoa(toplot[j].fZAI.Z()) << itoa(toplot[j].fZAI.A()) << "\">" << endl;
+				f << "\t\t\t\t\t\t<facility " <<  name  << ">" << "<masse>" << vQuantity[j][i] << "</masse>" << "</facility>" << endl;
+
+
+				f << "\t\t\t\t\t</isotope>" << endl;
+
+			}
+
+			f << "\t\t\t\t</composition>" << endl;
+			f << "\t\t\t</compositiondata>" << endl;
+
+		}
+
+		f  << "\t\t</Massehistory>" << endl;
+		f  << "</material>" << endl;
+		//------------------------------------------------------------------End of document XML
+
+		f.close();
+		cout << "  Your conversion is successful" << endl;
+	};
+
+
+	fData[toplot[0].fTreeId]->ResetBranchAddresses();
+	{
+		for(int i = 0; i< (int)fReactorName[toplot[0].fTreeId].size(); i++) delete reactor[i];
+
+		for(int i = 0; i< (int)fPoolName[toplot[0].fTreeId].size(); i++) delete pool[i];
+
+		for(int i = 0; i< (int)fFabricationName[toplot[0].fTreeId].size(); i++) delete fabricationplant[i];
+
+		for(int i = 0; i< (int)fStockName[toplot[0].fTreeId].size(); i++) delete stock[i];
+		for(int i = 0; i< 8; i++) delete IV[i];
+	}
+	
+	
+	
+	
+}
+
+//________________________________________________________________________
+void CLASSRead::ConvertXmlMass(vector<CLASSPlotElement> toplot, string filename)
+{
+	
+	vector<CLASSPlotElement> toplotTTree[fData.size()];
+	
+	
+	
+	for (int i = 0; i < (int)toplot.size(); i++)
+	{
+		toplotTTree[toplot[i].fTreeId].push_back(toplot[i]);
+	}
+	
+	for (int i = 0; i < (int)fData.size(); i++)
+	{
+		if(toplotTTree[i].size() != 0)
+			ConvertxmlTTreeMass(toplotTTree[i], filename);
+		
+	}
+}
+//________________________________________________________________________
+
+//________________________________________________________________________
+
+//________________________________________________________________________
+string CLASSRead::GetBranchInName(CLASSPlotElement toplot)
+{
+	string name;
+	switch (toplot.fFacilityId)
+	{
+		case 0:
+			switch (toplot.fFacylityNumber)
+		{
+			case 0:
+				name = "TOTAL.";
+				return name;
+				break;
+				break;
+
+			case 1:
+				name = "INCYCLE.";
+				return name;
+				break;
+
+			case 2:
+				name = "WASTE.";
+				return name;
+				break;
+
+			case 3:
+				name = "OUTINCOME.";
+				return name;
+				break;
+
+			case 4:
+				name = "REACTOR.";
+				return name;
+				break;
+
+			case 5:
+				name = "COOLING.";
+				return name;
+				break;
+
+			case 6:
+				name = "STOCK.";
+				return name;
+				break;
+
+			case 7:
+				name = "FUELFABRICATION.";
+				return name;
+				break;
+
+			default:
+				break;
+		}
+			break;
+
+		case 1:
+			name = "R_" + fReactorName[toplot.fTreeId][toplot.fFacylityNumber];
+			return name;
+			break;
+
+		case 2:
+			name = "S_" + fStockName[toplot.fTreeId][toplot.fFacylityNumber];
+			return name;
+			break;
+
+		case 3:
+			name = "P_" + fPoolName[toplot.fTreeId][toplot.fFacylityNumber];
+			return name;
+
+			break;
+
+		case 4:
+			name = "F_" + fFabricationName[toplot.fTreeId][toplot.fFacylityNumber];
+			return name;
+			break;
+
+
+		default:
+			break;
+	}
+
+	return name;
+}
+
+
+string CLASSRead::GetLegendOutName(CLASSPlotElement toplot)
+{
+	string name;
+
+	switch (toplot.fFacilityId)
+	{
+		case -2:
+			name = "P_{" + itoa(toplot.fTreeId) + "} POWER ";
+			return name;
+			break;
+
+		case 0:
+			switch (toplot.fFacylityNumber)
+		{
+
+
+
+			case 0:
+				name = "P_{" + itoa(toplot.fTreeId) + "} TOT ^{" + itoa(toplot.fZAI.A()) + "}"  + ReadNucleusName[toplot.fZAI.Z()];
+				for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+				return name;
+				break;
+
+			case 1:
+				name = "P_{" + itoa(toplot.fTreeId) + "} INcl ^{" + itoa(toplot.fZAI.A()) + "}"  + ReadNucleusName[toplot.fZAI.Z()];
+				for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+				return name;
+				break;
+
+			case 2:
+				name = "P_{" + itoa(toplot.fTreeId) + "} Wst ^{" + itoa(toplot.fZAI.A()) + "}"  + ReadNucleusName[toplot.fZAI.Z()];
+				for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+				return name;
+				break;
+
+			case 3:
+				name = "P_{" + itoa(toplot.fTreeId) + "} OUTINCOME ^{" + itoa(toplot.fZAI.A()) + "}"  + ReadNucleusName[toplot.fZAI.Z()];
+				for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+				break;
+
+			case 4:
+				name = "P_{" + itoa(toplot.fTreeId) + "} R_{tot} ^{" + itoa(toplot.fZAI.A()) + "}"  + ReadNucleusName[toplot.fZAI.Z()];
+				for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+				break;
+
+			case 5:
+				name = "P_{" + itoa(toplot.fTreeId) + "} Pl_{tot} ^{" + itoa(toplot.fZAI.A()) + "}"  + ReadNucleusName[toplot.fZAI.Z()];
+				for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+				return name;
+				break;
+
+			case 6:
+				name = "P_{" + itoa(toplot.fTreeId) + "} Stk_{tot} ^{" + itoa(toplot.fZAI.A()) + "}" + ReadNucleusName[toplot.fZAI.Z()];
+				for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+				break;
+
+			case 7:
+				name = "P_{" + itoa(toplot.fTreeId) + "} FP_{tot} ^{" + itoa(toplot.fZAI.A()) + "}"  + ReadNucleusName[toplot.fZAI.Z()];
+				for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+				return name;
+				break;
+
+			default:
+				break;
+		}
+			break;
+
+		case 1:
+			name = "P_{" + itoa(toplot.fTreeId) + "} " + fReactorName[toplot.fTreeId][toplot.fFacylityNumber] + " ^{" + itoa(toplot.fZAI.A()) + "}" + ReadNucleusName[toplot.fZAI.Z()];
+			for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+			break;
+
+		case 2:
+			name = "P_{" + itoa(toplot.fTreeId) + "} " + fStockName[toplot.fTreeId][toplot.fFacylityNumber] + " ^{" + itoa(toplot.fZAI.A()) + "}" + ReadNucleusName[toplot.fZAI.Z()];
+			for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+			break;
+
+		case 3:
+			name = "P_{" + itoa(toplot.fTreeId) + "} " + fPoolName[toplot.fTreeId][toplot.fFacylityNumber] + " ^{" + itoa(toplot.fZAI.A()) + "}" + ReadNucleusName[toplot.fZAI.Z()];
+			for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+
+			break;
+
+		case 4:
+			name = "P_{" + itoa(toplot.fTreeId) + "} " + fFabricationName[toplot.fTreeId][toplot.fFacylityNumber] + " ^{" + itoa(toplot.fZAI.A()) + "}" + ReadNucleusName[toplot.fZAI.Z()];
+			for (int i = 0; i < toplot.fZAI.I(); i++) name+=  "*";
+			break;
+
+
+		default:
+			break;
+	}
+
+	switch (toplot.fIVNumber)
+	{
+
+		case 0:
+			name+=  " Inside";
+			return name;
+			break;
+
+		case 1:
+			name+=  " CumuIN";
+			return name;
+			break;
+
+		case 2:
+			name+=  " CumuOUT";
+			return name;
+			break;
+
+		default:
+			break;
+
+	}
+
+
+
+	return name;
+
+}
+
+string CLASSRead::GetTittleOutName(CLASSPlotElement toplot)
+{
+	string name;
+
+	switch (toplot.fFacilityId)
+	{
+		case 0:
+			switch (toplot.fFacylityNumber)
+		{
+			case 0:
+				name = "PARC "+ itoa(toplot.fTreeId) + " TOTAL " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+				return name;
+				break;
+				break;
+
+			case 1:
+				name = "PARC "+ itoa(toplot.fTreeId) +  " INCYCLE " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+				return name;
+				break;
+
+			case 2:
+				name = "PARC "+ itoa(toplot.fTreeId) +  " WASTE " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+				return name;
+				break;
+
+			case 3:
+				name = "PARC "+ itoa(toplot.fTreeId) +  " OUTINCOME " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+				return name;
+				break;
+
+			case 4:
+				name = "PARC "+ itoa(toplot.fTreeId) +  " REACTOR " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+				return name;
+				break;
+
+			case 5:
+				name = "PARC "+ itoa(toplot.fTreeId) +  " COOLING " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+				return name;
+				break;
+
+			case 6:
+				name = "PARC "+ itoa(toplot.fTreeId) +  " STOCK " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+				return name;
+				break;
+
+			case 7:
+				name = "PARC "+ itoa(toplot.fTreeId) +  " FUELFABRICATION " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+				return name;
+				break;
+
+			default:
+				break;
+		}
+			break;
+
+		case 1:
+			name = "PARC "+ itoa(toplot.fTreeId) +  " " + fReactorName[toplot.fTreeId][toplot.fFacylityNumber] + " " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+			return name;
+			break;
+
+		case 2:
+			name = "PARC "+ itoa(toplot.fTreeId) +  " " + fStockName[toplot.fTreeId][toplot.fFacylityNumber] + " " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+			return name;
+			break;
+
+		case 3:
+			name = "PARC "+ itoa(toplot.fTreeId) +  " " + fPoolName[toplot.fTreeId][toplot.fFacylityNumber] + " " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+			return name;
+
+			break;
+
+		case 4:
+			name = "PARC "+ itoa(toplot.fTreeId) +  " " + fFabricationName[toplot.fTreeId][toplot.fFacylityNumber] + " " + itoa(toplot.fZAI.Z()) + " " + itoa(toplot.fZAI.A()) + " " + itoa(toplot.fZAI.I());
+			return name;
+			break;
+			
+			
+		default:
+			break;
+	}
+	return name;
+	
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gui/tags/version4.1/CLASSRead.hxx b/gui/tags/version4.1/CLASSRead.hxx
new file mode 100755
index 000000000..332d4a07f
--- /dev/null
+++ b/gui/tags/version4.1/CLASSRead.hxx
@@ -0,0 +1,135 @@
+#ifndef _CLASSRead
+#define _CLASSRead_
+
+#include <TROOT.h>
+#include <TTree.h>
+#include <TString.h>
+#include <TCanvas.h>
+#include <TGraph.h>
+#include <TLatex.h>
+
+#include <vector>
+#include <iostream>
+
+#include "ZAI.hxx"
+#include "CLASSPlotElement.hxx"
+#include "CLASSHeaders.hxx"
+
+using namespace std;
+
+	//________________________________________________________________________
+	//
+	//		CLASSRead
+	//@{
+	//	CLASSRead is a class that allows to retrieve results in Binary or Ascii Data
+	// 	files written by CLASS. By default binary files are read.
+	//
+	// Thank to Francisco, Guerin, Louard, Shi for their participation to the XML ouput implementation
+	// @author BLG
+	// @author BAM
+	// @version 1.0
+	// @version 0.1
+	//
+	//@}
+	//________________________________________________________________________
+class CLASSRead
+{
+public :
+	
+	CLASSRead(TString filemname);
+	~CLASSRead();		//@- destructor
+	
+	vector< vector< TString > >	GetReactorName()	{return fReactorName;}
+	vector< vector< TString > >	GetPoolName()		{return fPoolName;}
+	vector< vector< TString > >	GetFabricationName()	{return fFabricationName;}
+	vector< vector< TString > >	GetStockName()		{return fStockName;}
+	vector< ZAI >		GetZAIvector()		{return fZAIvector;}
+	vector< TTree* >	GetData()		{return fData;}
+	
+	string GetBranchInName(CLASSPlotElement toplot);
+	string GetLegendOutName(CLASSPlotElement toplot);
+	string GetTittleOutName(CLASSPlotElement toplot);
+	
+	
+	vector< vector<cSecond> > GetTimeVector() {return fTimeVector;}
+
+	
+	void ReadName();
+	void ReadZAI();
+	void ReadTime();
+
+	void BuildTGraph(vector<CLASSPlotElement> toplot, int PlotId = 0, string opt = "L");
+	void BuildTGraphUsingDecayChain(vector<CLASSPlotElement> toplot, int PlotId, int StartingStep, cSecond FinalTime, int StepNUmber, bool LinBin, string opt);
+
+	
+	void PlotInv(vector<CLASSPlotElement> toplot, bool DecayChain = false, int StartingStep = 0, cSecond FinalTime = 0, int StepNUmber = 0, bool LinBin = true , string opt = "L");
+	
+	void PlotTox(vector<CLASSPlotElement> toplot, bool DecayChain = false, int StartingStep = 0, cSecond FinalTime = 0, int StepNUmber = 0, bool LinBin = true , string opt = "L");
+	void PlotHeat(vector<CLASSPlotElement> toplot, bool DecayChain = false, int StartingStep = 0, cSecond FinalTime = 0, int StepNUmber = 0, bool LinBin = true , string opt = "L");
+	
+	void PlotPower(vector<CLASSPlotElement> toplot, string opt = "L");
+	void PlotTTreePower(vector<CLASSPlotElement> toplot, string opt = "L");
+
+	void ConvertxmlTTreeMass(vector<CLASSPlotElement> toplot, string filename);
+	void ConvertXmlMass(vector<CLASSPlotElement> toplot, string opt);           
+	void ConvertxmlTTreePower(vector<CLASSPlotElement> toplotPower, string opt);
+	void ConvertXmlPower(vector<CLASSPlotElement> toplotPower, string opt );
+
+	void Write(string filename, string fileformat, string PadName);
+	void ASCIIWrite(string filename , string PadName);
+
+
+	void AddFile(TString filemname);
+	TCanvas* fCNucleiInv;
+	TCanvas* fCNucleiTox;
+	TCanvas* fCNucleiHeat;
+	TCanvas* fCPower;
+	
+	
+private :
+		
+	
+	vector< vector< TString > > fReactorName;
+	vector< vector< TString > > fPoolName;
+	vector< vector< TString > > fFabricationName;
+	vector< vector< TString > > fStockName;
+	vector< ZAI >	fZAIvector;
+	
+	
+	vector< TTree* > fData;
+	vector<TFile* >	 fFileIn;
+
+	vector<TGraph*> fGraphInv;
+	TGraph* fGraphInvSumOfSelected;
+	TLatex** fLegendInv;
+	TLatex* fLegendInvSumOfSelected;
+
+	vector<TGraph*> fGraphTox;
+	TGraph* fGraphToxSumOfSelected;
+	TLatex** fLegendTox;
+	TLatex* fLegendToxSumOfSelected;
+	
+	vector<TGraph*> fGraphHeat;
+	TGraph* fGraphHeatSumOfSelected;
+	TLatex** fLegendHeat;
+	TLatex* fLegendHeatSumOfSelected;
+	
+	
+	TGraph**  fGraphPower;
+	TLatex** fLegendPower;
+	int fNumberGraphPowerIterator;
+
+	vector< vector<cSecond> > fTimeVector;
+
+	
+	double Xmin;
+	double Xmax;
+	double Ymin;
+	double Ymax;
+
+	
+};
+
+
+
+#endif
diff --git a/gui/tags/version4.1/CLASSWin.cxx b/gui/tags/version4.1/CLASSWin.cxx
new file mode 100755
index 000000000..95843eb70
--- /dev/null
+++ b/gui/tags/version4.1/CLASSWin.cxx
@@ -0,0 +1,1435 @@
+#include "CLASSWin.hxx"
+
+//#include "Convert.hxx"
+
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+#include <fstream>
+#include <cstdlib>
+#include <unistd.h>
+#include <cmath>
+
+
+#include <TApplication.h>
+#include <TGTableLayout.h>
+#include <TGResourcePool.h>
+#include <TLine.h>
+#include "StringLine.hxx"
+
+// For all class not defined in file.hxx see http://root.cern.ch/root/html/
+// For example : for TGraphErrors see http://root.cern.ch/root/html/TGraphErrors.html
+
+
+using namespace std;
+// for gcc3.2.3 only
+char* operator+( std::streampos&, char* );
+//end of gcc3.2.3
+
+string NucleusName[] = {
+	"n","H","He","Li","Be","B","C","N","O","F","Ne",			// List of nucleus used
+	"Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca",
+	"Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn",
+	"Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr",
+	"Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn",
+	"Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Nd",
+	"Pm","Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb",
+	"Lu","Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg",
+	"Tl","Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th",
+	"Pa","U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm", //100
+	"Md","No","Lr","Rf","Db","Sg","Bh","Hs","Mt","X",
+	"-","-","-","-","-","-","-","-","-","-",				// add nucleus for DRAGON lattice code
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-",
+	"-","-","-","-","-","-","-","-","-","-", //200
+	"H_nat","He_nat","Li_nat","Be_nat","B_nat","C_nat","N_nat","O_nat","F_nat","Ne_nat",
+	"Na_nat","Mg_nat","Al_nat","Si_nat","P_nat","S_nat","Cl_nat","Ar_nat","K_nat","Ca_nat",
+	"Sc_nat","Ti_nat","V_nat","Cr_nat","Mn_nat","Fe_nat","Co_nat","Ni_nat","Cu_nat","Zn_nat",
+	"Ga_nat","Ge_nat","As_nat","Se_nat","Br_nat","Kr_nat","Rb_nat","Sr_nat","Y_nat","Zr_nat",
+	"Nb_nat","Mo_nat","Tc_nat","Ru_nat","Rh_nat","Pd_nat","Ag_nat","Cd_nat","In_nat","Sn_nat",
+	"Sb_nat","Te_nat","I_nat","Xe_nat","Cs_nat","Ba_nat","La_nat","Ce_nat","Pr_nat","Nd_nat",
+	"Pm_nat","Sm_nat","Eu_nat","Gd_nat","Tb_nat","Dy_nat","Ho_nat","Er_nat","Tm_nat","Yb_nat",
+	"Lu_nat","Hf_nat","Ta_nat","W_nat","Re_nat","Os_nat","Ir_nat","Pt_nat","Au_nat","Hg_nat",
+	"Tl_nat","Pb_nat","Bi_nat","Po_nat","At_nat","Rn_nat","Fr_nat","Ra_nat","Ac_nat","Th_nat",
+	"Pa_nat","U_nat","Np_nat","Pu_nat","Am_nat","Cm_nat","Bk_nat","Cf_nat","Es_nat","Fm_nat"
+};
+
+const double densalmost0 = 1.0e-20;
+const double Xlogmin = 1.0/365.25/24./3600.; // minimum time = 1s after core exit
+const double Ylogmin = 1.0e-16;
+const int WIDE = 0;
+
+MainWin::MainWin(CLASSRead * DATA,vector<string> VFileName)
+{
+	fDATA = DATA;
+	fSaveFileFormat = "ASCII";
+	Start( VFileName);
+}
+
+
+MainWin::~MainWin()
+{
+	delete fDATA;
+}
+
+
+//_____________________________________________________________________________________________
+void MainWin::Start(vector<string> VFileName)
+{
+	
+	fToxNstep = 50;		// default number of time step for spent fuel radiotoxicity calculations
+	fToxTimeFirst = 1.0;	// default first time for spent fuel radiotoxicity calculations
+	fToxTimeLast = 1.0E08;	// default last time for spent fuel radiotoxicity calculations
+	fMotherIsVisible = false;
+	fIsByMother = false;
+	fIsLinear = false;
+	//
+	// Set the line width for all graph: for PPT presentation a value of 2 is probably better
+	//
+	fGraphLineWidth = 1;  //default = 1
+	//
+	// Set the marker size for all graph: for PPT presentation a value of 1 is probably better
+	//
+	fGraphMarkerSize = 0.5;   //default = 0.5
+	
+	//const TGFont *fontS = gClient->GetFont("-*-helvetica-medium-r-*-*-8-*-*-*-*-*-*");
+	const TGFont *fontS = gClient->GetFont("-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*");
+	if (!fontS)
+		fontS = gClient->GetResourcePool()->GetDefaultFont();
+	fLabelFontS = fontS->GetFontStruct();
+	
+	//	const TGFont *fontB = gClient->GetFont("-*-helvetica-medium-r-*-*-10*-*-*-*-*-*-*");
+	const TGFont *fontB = gClient->GetFont("-*-helvetica-medium-r-*-*-12*-*-*-*-*-*-*");
+	if (!fontB)
+		fontB = gClient->GetResourcePool()->GetDefaultFont();
+	fLabelFontB = fontB->GetFontStruct();
+	
+	
+	/*****************************/
+	//Compteur d'objet selectionné
+	/*****************************/
+	fNselectedNucleus = 0;	// number of nucleus selected
+	
+	fNumberOfParc = fDATA->GetData().size();			//@@@nombre de parcs
+	fNumberOfTOT = 9; //Reacteur + Stock + Pooling + Fabrication + Power
+	fNumberOfReactor = new int[fNumberOfParc];
+	fNumberOfStock = new int[fNumberOfParc];
+	fNumberOfPool = new int[fNumberOfParc];
+	fNumberOfFab = new int[fNumberOfParc];
+	
+	for(int i = 0; i < fNumberOfParc; i++)
+	{
+		fNumberOfReactor[i] = fDATA->GetReactorName()[i].size();
+		fNumberOfStock[i] = fDATA->GetStockName()[i].size();
+		fNumberOfPool[i] = fDATA->GetPoolName()[i].size();
+		fNumberOfFab[i] = fDATA->GetFabricationName()[i].size();
+	}
+	
+	// Canvas Style
+	gStyle->SetOptStat(000);
+	gStyle->SetFrameFillColor(10);
+	gStyle->SetFrameFillStyle(6);
+	gStyle->SetFrameBorderMode(0);
+	gStyle->SetFrameBorderSize(0);
+	gStyle->SetCanvasBorderMode(0);
+	gStyle->SetCanvasBorderSize(0);
+	gStyle->SetCanvasColor(10);
+	gStyle->SetPadColor(10);
+	gStyle->SetPadBorderMode(0);
+	gStyle->SetPadBorderSize(0);
+	gStyle->SetTitleFont(22);
+	gStyle->SetLabelFont(22,"xyz");
+	gStyle->SetHistLineWidth(1);
+	
+	
+	//first define Layaout (left, rigth, top, bottom margins)
+	TGLayoutHints* fL5555 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX , 5, 5, 5, 5);
+	TGLayoutHints* fL2222 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,2, 2, 2, 2);
+	TGLayoutHints* fL2200 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,2, 2, 0, 0);
+	TGLayoutHints* fL55100 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,5, 5, 0, 0);
+	//
+	// the Main frame where all will be insert
+	//
+	
+	fGeneF0 = new TGVerticalFrame(this, 100, 150);
+	AddFrame(fGeneF0, fL5555);
+	SetHeight(150);
+	SetWidth(60);
+	int MAXPATHLEN = 256;
+	char cDir[MAXPATHLEN];
+	getcwd(cDir, MAXPATHLEN);
+	stringstream tmp;
+	tmp.str("");
+	tmp << "CLASSGui " ;
+	for(int i = 0;i<int(VFileName.size());i++)
+		tmp  << VFileName[i] << " " ;
+	
+	this->SetWindowName(tmp.str().c_str());
+	
+	
+	/***************** LES Differents Parcs  ***********************/
+	
+	fParcTab = new TGTab(fGeneF0,100,150);
+	fGeneF0->AddFrame(fParcTab,fL2222);
+	fParcTab->Associate(this);
+	
+	fParcTabFoil = new TGCompositeFrame*[fNumberOfParc];
+	for(int i = 0; i < fNumberOfParc; i++)
+	{
+		fParcTabFoil[i] = new TGCompositeFrame;
+		stringstream ParcName;
+		ParcName << "Park " << i;
+		fParcTabFoil[i] = fParcTab->AddTab(ParcName.str().c_str());
+	}
+	
+	
+	/*************Les differentes Facilities Tab****/
+	fFacilitiesTab = new TGTab*[fNumberOfParc];
+	
+	for(int i = 0; i < fNumberOfParc; i++)
+	{
+		fFacilitiesTab[i] = new TGTab(fParcTabFoil[i],100,150);
+		fParcTabFoil[i]->AddFrame(fFacilitiesTab[i],fL2222);
+		fFacilitiesTab[i]->Associate(this);
+		
+	}
+	
+	fFacilitiesTabFoil = new TGCompositeFrame**[fNumberOfParc];
+	//1 jeu de facility tab par Parc
+	for(int i = 0; i < fNumberOfParc; i++)
+	{
+		
+		fFacilitiesTabFoil[i] = new TGCompositeFrame*[5];
+		
+		fFacilitiesTabFoil[i][0] = new TGCompositeFrame;
+		fFacilitiesTabFoil[i][0] = fFacilitiesTab[i]->AddTab("Total");
+		fFacilitiesTabFoil[i][1] = new TGCompositeFrame;
+		fFacilitiesTabFoil[i][1] = fFacilitiesTab[i]->AddTab("Reactor(s)");
+		fFacilitiesTabFoil[i][2] = new TGCompositeFrame;
+		fFacilitiesTabFoil[i][2] = fFacilitiesTab[i]->AddTab("Stock(s)");
+		fFacilitiesTabFoil[i][3] = new TGCompositeFrame;
+		fFacilitiesTabFoil[i][3] = fFacilitiesTab[i]->AddTab("Pool(s)");
+		fFacilitiesTabFoil[i][4] = new TGCompositeFrame;
+		fFacilitiesTabFoil[i][4] = fFacilitiesTab[i]->AddTab("Fabrication Plant(s)");
+	}
+	
+	//1 jeu d'ItemTab par facility tab
+	
+	fItemTab = new TGTab**[fNumberOfParc];
+	
+	for(int i = 0; i < fNumberOfParc; i++)
+	{
+		fItemTab[i] = new TGTab*[5];
+		for(int j = 0; j < 5; j++)
+		{
+			fItemTab[i][j] = new TGTab(fFacilitiesTabFoil[i][j],100,150);//@@ hxx non défini
+			fFacilitiesTabFoil[i][j]->AddFrame(fItemTab[i][j]);
+			fItemTab[i][j]->Associate(this);
+			//construire les foils en fonction du nombre de item possible par foil
+			
+		}
+		
+	}
+	
+	for(int j = 0; j < 5; j++)
+		FillItemTab(j);
+	
+	/***************** What you wana plot ***********************/
+	
+	//Configuration Table
+	fPlotConfigTab = new TGTab(fGeneF0,100,150);
+	fGeneF0->AddFrame(fPlotConfigTab,fL2222);
+	fPlotConfigTab->Associate(this);
+	
+	fPlotConfigFoil = new TGCompositeFrame*[2];
+	
+	fPlotConfigFoil[0] = new TGCompositeFrame;
+	fPlotConfigFoil[0] = fPlotConfigTab->AddTab("Inventory");
+	
+	fPlotConfigFoil[1] = new TGCompositeFrame;
+	fPlotConfigFoil[1] = fPlotConfigTab->AddTab("DecayHeat / Radiotox.");
+	
+	
+	//In inventory
+	fInventoryFrame = new TGGroupFrame(fPlotConfigFoil[0],"", kHorizontalFrame );
+	fPlotConfigFoil[0]->AddFrame(fInventoryFrame,fL5555);
+	
+	fCheckIVPlot = new TGCheckButton*[3];
+	fCheckIVPlot[0] = new TGCheckButton(fInventoryFrame,"Inside",M_CHECK_INSIDE);
+	fCheckIVPlot[0]->SetFont(fLabelFontS);
+	fInventoryFrame->AddFrame(fCheckIVPlot[0],fL2222);
+	fCheckIVPlot[0]->Associate(this);
+	fCheckIVPlot[0]->SetState(kButtonDown);
+	
+	fCheckIVPlot[1] = new TGCheckButton(fInventoryFrame,"Cumul In",M_CHECK_CUMIN);
+	fCheckIVPlot[1]->SetFont(fLabelFontS);
+	fInventoryFrame->AddFrame(fCheckIVPlot[1],fL2222);
+	fCheckIVPlot[1]->Associate(this);
+	
+	fCheckIVPlot[2] = new TGCheckButton(fInventoryFrame,"Cumul out",M_CHECK_CUMOUT);
+	fCheckIVPlot[2]->SetFont(fLabelFontS);
+	fInventoryFrame->AddFrame(fCheckIVPlot[2],fL2222);
+	fCheckIVPlot[2]->Associate(this);
+	
+	//Radio/Heat frame
+	//Radio Or Decay subframe
+	fDecayOrRadioFrame = new  TGGroupFrame(fPlotConfigFoil[1],"Radio-toxicity / decay heat" );
+	fPlotConfigFoil[1]->AddFrame(fDecayOrRadioFrame,fL5555);
+	
+	fButtonHeat = new TGRadioButton(fDecayOrRadioFrame,"Decay Heat",M_RADIO_DECAY_HEAT);
+	fButtonRadiotox = new TGRadioButton(fDecayOrRadioFrame,"Radio-toxicity",M_RADIO_RADIOTOX);
+	
+	fButtonHeat->SetState(kButtonDown);
+	fButtonRadiotox->SetState(kButtonUp);
+	
+	fButtonHeat->Associate(this);
+	fButtonRadiotox->Associate(this);
+	
+	fDecayOrRadioFrame->AddFrame(fButtonHeat);
+	fDecayOrRadioFrame->AddFrame(fButtonRadiotox);
+	
+	
+	//By mother sub frame
+	fByMotherFrame = new  TGGroupFrame(fGeneF0,"Decay chain (by mother)" );
+	fGeneF0->AddFrame(fByMotherFrame,fL2222);
+	
+	fByMotherMore = new TGPictureButton(fGeneF0 ,gClient->GetPicture("arrow_down.xpm"),M_BUTTON_MOTHER_MORE);
+	fByMotherMore->Resize(350,25);
+	fByMotherMore->Associate(this);
+	fGeneF0->AddFrame(fByMotherMore,fL2222);
+	
+	//the button
+	fByMotherButton = new TGCheckButton(fByMotherFrame,"By Mother",M_CHECK_BY_MOTHER);
+	fButtonHeat->SetState(kButtonUp);
+	fByMotherButton->Associate(this);
+	fByMotherFrame->AddFrame(fByMotherButton);
+	
+	
+	//the time choosed for the end of the scenario
+	fScenarTimeFrame = new TGGroupFrame(fByMotherFrame,"Final scenario time (year)" );
+	((TGGroupFrame*)fScenarTimeFrame)->SetTextFont(fLabelFontS);
+	fByMotherFrame->AddFrame(fScenarTimeFrame,fL2222);
+	fScenarTimeCBox = new TGComboBox(fScenarTimeFrame,M_CB_SCENAR_Time);
+	fScenarTimeFrame->AddFrame(fScenarTimeCBox,fL2222);
+	fScenarTimeCBox->Resize(80,17);
+	
+	int NumOfTimeStep = fDATA->GetTimeVector()[0].size();
+	for(int step = 0; step<NumOfTimeStep; step++)
+	{
+		stringstream tmp;
+		tmp.str("");
+		tmp << "Dir#" <<  step  << " @ " << fDATA->GetTimeVector()[0][step]/cYear;
+		fScenarTimeCBox->AddEntry(tmp.str().c_str(),step);
+	}
+	
+	fScenarTimeCBox->Associate(this);
+	fTimeStep = NumOfTimeStep-1;
+	fScenarTimeCBox->Select(fTimeStep);
+	
+	// Parameters for the geological time
+	fTimeParametersFrame = new TGGroupFrame(fByMotherFrame,"Evol. Period [year]: first, last, n_step)", kHorizontalFrame );
+	((TGGroupFrame*)fTimeParametersFrame)->SetTextFont(fLabelFontS);
+	fByMotherFrame->AddFrame(fTimeParametersFrame,fL2222);
+	
+	TGTextBuffer *TBtoxfirst = new TGTextBuffer(100);
+	TGTextBuffer *TBtoxlast = new TGTextBuffer(100);
+	TGTextBuffer *TBtoxnstep = new TGTextBuffer(100);
+	
+	TBtoxfirst->AddText(0, StringLine::convert<string>(fToxTimeFirst).c_str());
+	TBtoxlast->AddText(0, StringLine::convert<string>(fToxTimeLast).c_str());
+	TBtoxnstep->AddText(0, StringLine::convert<string>(fToxNstep).c_str());
+	
+	TEtoxfirst = new TGTextEntry(fTimeParametersFrame,TBtoxfirst , M_TE_toxfirst);// box to enter the first time
+	TEtoxlast = new TGTextEntry(fTimeParametersFrame,TBtoxlast , M_TE_toxlast);// box to enter the last time
+	TEtoxnstep = new TGTextEntry(fTimeParametersFrame,TBtoxnstep , M_TE_toxnstep);// box to enter the number of step time
+	
+	fCheckLinear = new TGCheckButton(fTimeParametersFrame,"Linear Binning",M_CHECK_LINEAR_Tox);
+	
+	TEtoxfirst->Resize(TEtoxfirst->GetDefaultWidth(),17);
+	TEtoxlast->Resize(TEtoxlast->GetDefaultWidth(),17);
+	TEtoxnstep->Resize(TEtoxnstep->GetDefaultWidth(),17);
+	
+	fTimeParametersFrame->AddFrame(TEtoxfirst, fL2222);
+	fTimeParametersFrame->AddFrame(TEtoxlast, fL2222);
+	fTimeParametersFrame->AddFrame(TEtoxnstep, fL2222);
+	fTimeParametersFrame->AddFrame(fCheckLinear,fL2222);
+	
+	fCheckLinear->SetFont(fLabelFontS);
+	fCheckLinear->SetState(kButtonUp);
+	
+	TEtoxfirst->Associate(this);
+	TEtoxlast->Associate(this);
+	TEtoxnstep->Associate(this);
+	fCheckLinear->Associate(this);
+	
+	//
+	//	The Miscellaneous part (AM check box, ...)
+	//
+	fMiscFrame = new TGGroupFrame(fGeneF0,"Miscellaneous", kVerticalFrame );
+	((TGGroupFrame*)fMiscFrame)->SetTextFont(fLabelFontB);
+	fGeneF0->AddFrame(fMiscFrame,fL2222);
+	
+	fMiscHzFrame = new TGHorizontalFrame(fMiscFrame,400, 50 );
+	fMiscFrame->AddFrame(fMiscHzFrame,fL2222);
+	
+	//misc check buttons
+	fCheckAMNuc = new TGCheckButton(fMiscHzFrame,"MA",M_CHECK_AM_NUC);
+	fCheckFPNuc = new TGCheckButton(fMiscHzFrame,"FP",M_CHECK_FP_NUC);
+	fCheckSumOfSelected = new TGCheckButton(fMiscHzFrame,"Sum of Selected");
+	
+	fCheckFPNuc->SetFont(fLabelFontS);
+	fCheckAMNuc->SetFont(fLabelFontS);
+	fCheckSumOfSelected->SetFont(fLabelFontS);
+	
+	fMiscHzFrame->AddFrame(fCheckAMNuc,fL2222);
+	fMiscHzFrame->AddFrame(fCheckFPNuc,fL2222);
+	fMiscHzFrame->AddFrame(fCheckSumOfSelected,fL2222);
+	
+	fCheckFPNuc->Associate(this);
+	fCheckAMNuc->Associate(this);
+	fCheckSumOfSelected->Associate(this);
+	
+	//1 jeu de NucleusTab pour tous
+	
+	//
+	//	The Nucleus Tab
+	//
+	fTabNuc = new TGTab(fGeneF0,200,150);
+	fGeneF0->AddFrame(fTabNuc,fL2222);
+	fTabNuc->Associate(this);
+	FillNucTab();
+	
+	// The Plot, Save, Macro and Quit buttons
+	//
+	fPlotSaveQuitFrame = new TGHorizontalFrame(fGeneF0, 100, 50 );
+	fGeneF0->AddFrame(fPlotSaveQuitFrame,fL5555);
+	fButtonPlot = new TGTextButton(fPlotSaveQuitFrame,"&Plot (All)",M_BUTTON_PLOT);
+	fButtonSave = new TGTextButton(fPlotSaveQuitFrame,"&Save Data",M_BUTTON_SAVE);
+	fButtonQuit = new TGTextButton(fPlotSaveQuitFrame,"&Quit",M_BUTTON_QUIT);
+	fPlotSaveQuitFrame->AddFrame(fButtonPlot, fL2222);
+	fPlotSaveQuitFrame->AddFrame(fButtonSave, fL2222);
+	fPlotSaveQuitFrame->AddFrame(fButtonQuit, fL2222);
+	fPlotSaveQuitFrame->Resize(150, fButtonPlot->GetDefaultHeight());
+	fButtonPlot->Associate(this);
+	fButtonSave->Associate(this);
+	fButtonQuit->Associate(this);
+	
+	MapSubwindows();						// Map all sub windows that are part of the composite frame
+	MapWindow();
+	Resize(GetDefaultSize()); 					// fit to the exact size
+	Move(410,30);
+	fMainWidth = fGeneF0->GetWidth();
+	fGeneF0->HideFrame(fByMotherFrame);
+	//Resize(550,670); 					// fit to the exact size
+	Resize(GetDefaultSize());
+	fMainWidth = fGeneF0->GetWidth();
+	
+}
+//_____________________________________________________________________________________________
+bool MainWin::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
+{
+	SubWin *nsw = 0;
+	string EnterTextP;
+	switch (GET_MSG(msg))
+	{
+		case kC_COMMAND:
+			switch (GET_SUBMSG(msg))
+		{
+			case kCM_BUTTON:
+				switch (parm1)
+			{
+				case M_BUTTON_QUIT:
+					CloseWindow();
+					break;
+				case M_BUTTON_PLOT:
+					Plot();
+					break;
+				case M_BUTTON_SAVE:
+					if(!gPad)
+					{
+						cout << "Please Plot something to save before" << endl;
+						break;
+					}
+					
+					nsw = new SubWin("SaveAs", fClient->GetRoot(), this, 200, 200);
+					if (fSaveFileFormat ==  "XML")
+						Conversionxml();
+					else
+						if(fSaveFileName != "" /*&& fSaveFileFormat != ""*/)
+						{	//si plusieur canvas ouvert sauver l'actif exemple :
+							string PadName = gPad->GetName();
+							//if(PadName == "c_Nuclei")
+								fDATA->Write(fSaveFileName, fSaveFileFormat, PadName);
+						}
+					break;
+					
+				case M_BUTTON_MOTHER_MORE:
+					if(!fMotherIsVisible)
+					{
+						fByMotherMore->SetPicture(gClient->GetPicture("arrow_up.xpm"));
+						fByMotherMore->Resize(350,10);
+						MapSubwindows();
+						MapWindow();
+						Resize(fMainWidth,0);
+						fGeneF0->ShowFrame(fByMotherFrame);
+						fMotherIsVisible = true;
+					}
+					else
+					{
+						fByMotherMore->SetPicture(gClient->GetPicture("arrow_down.xpm"));
+						fByMotherMore->Resize(350,25);
+						MapSubwindows();
+						MapWindow();
+						fGeneF0->HideFrame(fByMotherFrame);
+						Resize(fMainWidth,0);
+						fMotherIsVisible = false;
+					}
+					
+					
+			}
+				
+			case kCM_CHECKBUTTON:
+				switch (parm1)
+			{
+				case M_CHECK_INSIDE:
+					fButtonHeat->SetState(kButtonUp);
+					fButtonRadiotox->SetState(kButtonUp);
+					break;
+					
+				case M_CHECK_CUMIN:
+					fButtonHeat->SetState(kButtonUp);
+					fButtonRadiotox->SetState(kButtonUp);
+					break;
+					
+				case M_CHECK_CUMOUT:
+					fButtonHeat->SetState(kButtonUp);
+					fButtonRadiotox->SetState(kButtonUp);
+					break;
+					
+				case M_CHECK_BY_MOTHER:
+					
+					if(fByMotherButton->GetState() == kButtonDown )
+						fIsByMother = true;
+					else
+						fIsByMother = false;
+					break;
+					
+				case M_CHECK_LINEAR_Tox:
+					if(fCheckLinear->GetState() == kButtonDown)
+						fIsLinear = true;
+					else
+						fIsLinear = false;
+					
+					break;
+
+				case M_CHECK_AM_NUC:
+					if(fCheckAMNuc->GetState() == kButtonDown)
+					{	for( int l = 0; l < (int)fDATA->GetZAIvector().size(); l++ )
+						{
+							if(fDATA->GetZAIvector()[l].Z() > 90 && fDATA->GetZAIvector()[l].Z() != 92 && fDATA->GetZAIvector()[l].Z() != 94)
+								fCheckArrayNuc[l]->SetState(kButtonDown);
+						}
+					}
+					else
+					{
+						for( int l = 0; l < (int)fDATA->GetZAIvector().size(); l++ )
+						{
+							if(fDATA->GetZAIvector()[l].Z() > 90 && fDATA->GetZAIvector()[l].Z() != 92 && fDATA->GetZAIvector()[l].Z() != 94)
+								fCheckArrayNuc[l]->SetState(kButtonUp);
+						}
+					}	
+					break;
+
+				case M_CHECK_FP_NUC:
+					if(fCheckFPNuc->GetState() == kButtonDown)
+					{	for( int l = 0; l < (int)fDATA->GetZAIvector().size(); l++ )
+						{
+							if( fDATA->GetZAIvector()[l].A() > 50 && fDATA->GetZAIvector()[l].A()< 180 )
+								fCheckArrayNuc[l]->SetState(kButtonDown);
+						}
+					}
+					else
+					{
+						for( int l = 0; l < (int)fDATA->GetZAIvector().size(); l++ )
+						{
+							if( fDATA->GetZAIvector()[l].A() > 50 && fDATA->GetZAIvector()[l].A()< 180 )
+								fCheckArrayNuc[l]->SetState(kButtonUp);
+						}
+					}	
+					break;
+			}
+			case kCM_RADIOBUTTON:
+				switch (parm1)
+			{
+				case M_RADIO_DECAY_HEAT:
+					fButtonHeat->SetState(kButtonDown);
+					fButtonRadiotox->SetState(kButtonUp);
+					for(int i = 0 ; i<3 ; i++ )
+						fCheckIVPlot[i]->SetState(kButtonUp);
+					break;
+					
+				case M_RADIO_RADIOTOX:
+					fButtonHeat->SetState(kButtonUp);
+					fButtonRadiotox->SetState(kButtonDown);
+					for(int i = 0 ; i<3 ; i++ )
+						fCheckIVPlot[i]->SetState(kButtonUp);
+					break;
+					
+			}
+		}
+		case kC_TEXTENTRY:
+			switch (GET_SUBMSG(msg))
+		{
+			case kTE_TEXTCHANGED:
+				switch (parm1)
+			{
+				case M_TE_toxfirst:   	// get first time
+					EnterTextP = TEtoxfirst->GetBuffer()->GetString();
+					fToxTimeFirst = StringLine::convert<double>(EnterTextP);		// change string in double
+					if(fToxTimeFirst<= 0)
+					{
+						fToxTimeFirst = Xlogmin;
+						TEtoxfirst->SetText(StringLine::convert<string>(fToxTimeFirst).c_str());
+					}
+					break;
+					
+				case M_TE_toxlast:   	// get last time
+					
+					EnterTextP = TEtoxlast->GetBuffer()->GetString();
+					fToxTimeLast = StringLine::convert<double>(EnterTextP);
+					break;
+					
+				case M_TE_toxnstep:   	// get number of time steps
+					
+					EnterTextP = TEtoxnstep->GetBuffer()->GetString();
+					fToxNstep = StringLine::convert<int>(EnterTextP);
+					break;
+					
+			}
+			case kCM_COMBOBOX:
+				switch (parm1)
+			{
+				case M_CB_SCENAR_Time:
+					fTimeStep = fScenarTimeCBox->GetSelected();
+					break;
+			}
+				break;
+		}
+			break;
+	}
+	
+	return kTRUE;
+}
+
+//_____________________________________________________________________________________________
+void MainWin::CloseWindow()
+{
+	gApplication->Terminate(0);
+}
+//_____________________________________________________________________________________________
+void MainWin::Plot()
+{
+	int Nnucleus = fDATA->GetZAIvector().size();
+	
+	vector<CLASSPlotElement> toplot;
+	vector<CLASSPlotElement> toplotPower;
+	
+	if(fCheckSumOfSelected->GetState() == kButtonDown)
+	{
+		toplot.push_back( CLASSPlotElement(-1, -1, -1, -1,-1,-1,-1) );
+	}
+	//Power
+	for(int i = 0; i < fNumberOfParc; i++)
+	{
+		if(fCheckArrayTotal[i][fNumberOfTOT-1]->GetState() == kButtonDown)
+			toplotPower.push_back( CLASSPlotElement(i, -2, -2, -2,-2,-2,-2) );
+		
+	}
+	
+	if(toplotPower.size() != 0)
+		fDATA->PlotPower(toplotPower);
+	
+	
+	for(int i = 0; i < fNumberOfParc; i++)
+	{
+		
+		for(int j = 0; j < fNumberOfTOT-1; j++) //fNumberOfTOT -1 ?? ->All except power
+		{
+			if(fCheckArrayTotal[i][j]->GetState() == kButtonDown)
+				for(int k = 0; k < Nnucleus; k++)
+				{
+					if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+						toplot.push_back( CLASSPlotElement(i, 0, j,0, fDATA->GetZAIvector()[k]));
+				}
+		}
+		
+		for(int j = 0; j < fNumberOfReactor[i]; j++)
+		{
+			if(fCheckArrayReactor[i][j]->GetState() == kButtonDown)
+			{
+				if(fButtonRadiotox->GetState() == kButtonDown || fButtonHeat->GetState() == kButtonDown)
+				{
+					for(int k = 0; k < Nnucleus; k++)
+					{
+						if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+							toplot.push_back( CLASSPlotElement(i,1,j,0, fDATA->GetZAIvector()[k]));
+					}
+				}
+				else
+				{
+					for(int l = 0;l<3;l++)
+						if (fCheckIVPlot[l]->GetState() == kButtonDown)
+							for(int k = 0; k < Nnucleus; k++)
+							{
+								if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+									toplot.push_back( CLASSPlotElement(i,1,j,l, fDATA->GetZAIvector()[k]));
+							}
+				}
+			}
+		}
+		
+		for(int j = 0; j < fNumberOfStock[i]; j++)
+		{	
+			if(fCheckArrayStock[i][j]->GetState() == kButtonDown)
+			{
+				if(fButtonRadiotox->GetState() == kButtonDown || fButtonHeat->GetState() == kButtonDown)
+				{
+					for(int k = 0; k < Nnucleus; k++)
+					{
+						if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+							toplot.push_back( CLASSPlotElement(i,2,j,0, fDATA->GetZAIvector()[k]));
+					}
+				}
+				else
+				{
+					for(int l = 0;l<3;l++)
+						if (fCheckIVPlot[l]->GetState() == kButtonDown)
+							for(int k = 0; k < Nnucleus; k++)
+							{
+								if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+									toplot.push_back( CLASSPlotElement(i,2,j,l, fDATA->GetZAIvector()[k]));
+							}
+				}
+			}
+		}
+		
+		for(int j = 0; j < fNumberOfPool[i]; j++)
+		{
+			if(fCheckArrayPool[i][j]->GetState() == kButtonDown)
+			{
+				if(fButtonRadiotox->GetState() == kButtonDown || fButtonHeat->GetState() == kButtonDown)
+				{
+					for(int k = 0; k < Nnucleus; k++)
+					{
+						if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+							toplot.push_back( CLASSPlotElement(i,3,j,0, fDATA->GetZAIvector()[k]));
+					}
+				}
+				else
+				{
+					for(int l = 0;l<3;l++)
+						if (fCheckIVPlot[l]->GetState() == kButtonDown)
+							for(int k = 0; k < Nnucleus; k++)
+							{
+								if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+									toplot.push_back( CLASSPlotElement(i,3,j,l, fDATA->GetZAIvector()[k]));
+							}
+				}
+			}
+		}
+		
+		for(int j = 0; j < fNumberOfFab[i]; j++)
+		{
+			if(fCheckArrayFab[i][j]->GetState() == kButtonDown)
+			{
+				if(fButtonRadiotox->GetState() == kButtonDown || fButtonHeat->GetState() == kButtonDown)
+				{
+					for(int k = 0; k < Nnucleus; k++)
+					{
+						if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+							toplot.push_back( CLASSPlotElement(i,4,j,0, fDATA->GetZAIvector()[k]));
+					}
+				}
+				else
+				{
+					for(int l = 0;l<3;l++)
+						if (fCheckIVPlot[l]->GetState() == kButtonDown)
+							for(int k = 0; k < Nnucleus; k++)
+							{
+								if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+									toplot.push_back( CLASSPlotElement(i,4,j,l, fDATA->GetZAIvector()[k]));
+							}
+				}
+			}
+		}
+	}
+	
+	
+	int StartingStep = fTimeStep;
+	cSecond FinalTime  = (cSecond) fToxTimeLast * cYear;
+	int NStep = fToxNstep;
+	bool IsLinear = fIsLinear;
+	if(!fIsByMother)
+	{
+		StartingStep  = 0;
+		FinalTime = 0;
+		NStep = 0;
+		IsLinear = true;
+	}
+	
+	
+	if(toplot.size() != 0)
+	{
+		for(int i = 0 ; i<3 ; i++ )
+		{
+			if(fCheckIVPlot[i]->GetState() == kButtonDown)
+			{	fDATA->PlotInv(toplot,fIsByMother,StartingStep,FinalTime,NStep,IsLinear);
+				break;
+			}
+		}
+		
+		if(fButtonRadiotox->GetState() == kButtonDown)
+			fDATA->PlotTox(toplot,fIsByMother,StartingStep,FinalTime,NStep,IsLinear);
+		
+		if(fButtonHeat->GetState() == kButtonDown)
+			fDATA->PlotHeat(toplot,fIsByMother,StartingStep,FinalTime,NStep,IsLinear);
+		
+	}
+
+	
+}
+void MainWin::Conversionxml()
+{
+	int Nnucleus = fDATA->GetZAIvector().size();
+	
+	vector<CLASSPlotElement> toplot;
+	vector<CLASSPlotElement> toplotPower;
+	
+	for(int i = 0; i < fNumberOfParc; i++)
+	{
+		
+		for(int j = 0; j < fNumberOfTOT-1; j++) //fNumberOfTOT -1 ?? ->All except power
+		{
+			if(fCheckArrayTotal[i][j]->GetState() == kButtonDown)
+				for(int k = 0; k < Nnucleus; k++)
+				{
+					if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+						toplot.push_back( CLASSPlotElement(i, 0, j,0, fDATA->GetZAIvector()[k]));
+				}
+		}
+		
+		for(int j = 0; j < fNumberOfReactor[i]; j++)
+		{
+			if(fCheckArrayReactor[i][j]->GetState() == kButtonDown)
+			{
+				for(int l  = 0;l<3;l++)
+					if (fCheckIVPlot[l]->GetState() == kButtonDown)
+						for(int k = 0; k < Nnucleus; k++)
+						{
+							if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+								toplot.push_back( CLASSPlotElement(i, 1, j,l, fDATA->GetZAIvector()[k]));
+						}
+			}
+		}
+		
+		for(int j = 0; j < fNumberOfStock[i]; j++)
+		{
+			if(fCheckArrayStock[i][j]->GetState() == kButtonDown)
+				for(int l  = 0;l<3;l++)
+					if (fCheckIVPlot[l]->GetState() == kButtonDown)
+						for(int k = 0; k < Nnucleus; k++)
+						{
+							if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+								toplot.push_back( CLASSPlotElement(i, 2, j,l, fDATA->GetZAIvector()[k]));
+						}
+		}
+		
+		for(int j = 0; j < fNumberOfPool[i]; j++)
+		{
+			if(fCheckArrayPool[i][j]->GetState() == kButtonDown)
+				for(int l  = 0;l<3;l++)
+					if (fCheckIVPlot[l]->GetState() == kButtonDown)
+						for(int k = 0; k < Nnucleus; k++)
+						{
+							if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+								toplot.push_back( CLASSPlotElement(i, 3, j,l, fDATA->GetZAIvector()[k]));
+						}
+		}
+		
+		for(int j = 0; j < fNumberOfFab[i]; j++)
+		{
+			if(fCheckArrayFab[i][j]->GetState() == kButtonDown)
+				for(int l  = 0;l<3;l++)
+					if (fCheckIVPlot[l]->GetState() == kButtonDown)
+						for(int k = 0; k < Nnucleus; k++)
+						{
+							if(fCheckArrayNuc[k]->GetState() == kButtonDown)
+								toplot.push_back( CLASSPlotElement(i, 4, j,l, fDATA->GetZAIvector()[k]));
+						}
+		}
+	}
+	
+	if(toplot.size() != 0)
+		fDATA->ConvertXmlMass(toplot, fSaveFileName);
+	
+}
+
+//_____________________________________________________________________________________________
+void MainWin::FillNucTab()		// fill the Inventory Tab foil
+{
+	static bool first = true;
+	
+	int NCheck = fDATA->GetZAIvector().size();
+	//number of lines and columns per foil
+	int Nline = 14-WIDE;
+	int Ncol = 8+WIDE;
+	//number of FP tab
+	static int NFP_tab = 0;
+	static int NTab = 0;
+	static int NACT_tab = 0;
+	static int NGAZ_tab = 0;
+	
+	if(first)
+	{
+		NTab = NCheck/(Nline*Ncol)+1;
+	}
+	//Are we resorting nuclei ?
+	if(!first)
+	{
+		for(int l = 0; l < NTab ; l++)
+			fTabFoilNuc[l]->Cleanup();
+		delete [] fCheckArrayNuc;
+	}
+	// the foils
+	if(first) fTabFoilNuc = new TGCompositeFrame*[NTab];
+	string *TabName = new string[NTab];
+	for(int i = 0; i < NTab; i++)
+	{
+		stringstream tmp;
+		tmp.str("");
+		tmp << "Nuclei " << i;
+		TabName[i] = tmp.str();
+	}
+	
+	// the Check buttons
+	fCheckArrayNuc = new TGCheckButton*[NCheck];
+	
+	if( first )
+		for(int l = 0; l < NTab ; l++)
+		{
+			fTabFoilNuc[l] = fTabNuc->AddTab(TabName[l].c_str());
+			fTabFoilNuc[l]->SetLayoutManager(new TGMatrixLayout(fTabFoilNuc[l], Nline, 0, 5));
+		}
+	
+	//
+	// Fill the Miscellaneous TAB
+	//
+	FillNucFoil( NCheck, Ncol, Nline );
+	//
+	// Remap after resorting
+	//
+	for(int l = 0; l < NTab; l++)
+	{
+		fTabFoilNuc[l]->MapSubwindows();
+		fTabFoilNuc[l]->Layout();
+	}
+	//select the second foil then the first foil to avoid "save char in back ground storage"
+	first = false;
+	
+}
+
+//_____________________________________________________________________________________________
+void MainWin::FillNucFoil(int n_item, int Ncol,int Nline)
+{
+	int current_foil = 0;
+	int current_item = 0;
+	for( int l = n_item-1; l >= 0; l-- )
+	{
+		
+		stringstream name;
+		int Atmp = fDATA->GetZAIvector()[l].A();
+		if(Atmp != 0)
+		{
+			
+			if(fDATA->GetZAIvector()[l].Z() ==  -3)
+			{
+				name << Atmp << "TMP"; //@@@@
+				
+			}
+			else if(fDATA->GetZAIvector()[l].Z() ==  -2)
+			{
+				name << Atmp << "PF"; //@@@@
+				
+			}
+			else if(fDATA->GetZAIvector()[l].Z() ==  -1)
+			{
+				name << Atmp << "ERR"; //@@@@
+				
+			}
+			else
+				name << Atmp << NucleusName[fDATA->GetZAIvector()[l].Z()]; //@@@@
+			
+			if( fDATA->GetZAIvector()[0].I() > 0 )
+				name << "*";
+			
+			
+			fCheckArrayNuc[l] = new TGCheckButton( fTabFoilNuc[current_foil], name.str().c_str(), l + M_CHECK_PLOTALL+1 );
+			fCheckArrayNuc[l]->SetFont( fLabelFontS );
+			
+			fTabFoilNuc[current_foil]->AddFrame( fCheckArrayNuc[l] );
+			fCheckArrayNuc[l]->Associate( this );
+			
+			current_item++;
+			
+			if( current_item >= Ncol * Nline )
+			{
+				current_item = 0;
+				current_foil++;
+			}
+		}
+	}
+	
+	current_foil++;
+	
+}
+//_____________________________________________________________________________________________
+void MainWin::FillItemTab(int current)
+{
+	if (current == 0)
+		FillTotalTab();
+	if (current == 1)
+		FillReactorTab();
+	if (current == 2)
+		FillStockTab();
+	if (current == 3)
+		FillPoolTab();
+	if (current == 4)
+		FillFabricationTab();
+	
+	if(current>5 || current<0)
+	{cout << "BUG" << endl; exit(0);}
+	
+	
+}
+
+//_____________________________________________________________________________________________
+void MainWin::FillTotalTab()
+{
+	fCheckArrayTotal = new TGCheckButton**[fNumberOfParc];
+	for(int i = 0;i<	fNumberOfParc;i++)
+		fCheckArrayTotal[i] =  new TGCheckButton*[fNumberOfTOT];
+	double count = 0;
+	for(int p = 0; p<fNumberOfParc; p++)
+	{
+		for(int i = 0; i < fNumberOfTOT; i++)
+		{
+			string name;
+			if(i == 0) name = "TOTAL";
+			if(i == 1) name = "INCYCLE";
+			if(i == 2) name = "WASTE";
+			if(i == 3) name = "OUTINCOME";
+			if(i == 4) name = "REACTOR";
+			if(i == 5) name = "COOLING";
+			if(i == 6) name = "STOCK";
+			if(i == 7) name = "FUELFABRICATION";
+			if(i == 8) name = "POWER";
+			
+			fCheckArrayTotal[p][i] = new TGCheckButton(fFacilitiesTabFoil[p][0],name.c_str());
+			fCheckArrayTotal[p][i]->SetFont(fLabelFontS);
+			fFacilitiesTabFoil[p][0]->AddFrame(fCheckArrayTotal[p][i]);
+			fCheckArrayTotal[p][i]->Associate(this);
+			count++;
+		}
+		
+		fFacilitiesTabFoil[p][0]->MapSubwindows();
+		fFacilitiesTabFoil[p][0]->Layout();
+	}
+}
+//_____________________________________________________________________________________________
+void MainWin::FillReactorTab()
+{
+	int Nline = 7-WIDE;
+	int Ncol = 6+WIDE;
+	
+	fTabFoilReactor =  new TGCompositeFrame**[fNumberOfParc];
+	fCheckArrayReactor =  new TGCheckButton**[fNumberOfParc];
+	int *NTab = new int[fNumberOfParc];
+	
+	for (int i = 0 ; i<fNumberOfParc;i++)
+	{
+		
+		NTab[i] = fNumberOfReactor[i]/(Nline*Ncol)+1;
+		fTabFoilReactor[i] =  new TGCompositeFrame*[NTab[i]];
+		fCheckArrayReactor[i] =  new TGCheckButton*[fNumberOfReactor[i]];
+		
+		
+	}
+	
+	for (int p = 0;p<fNumberOfParc;p++)
+	{
+		string TabName[NTab[p]];
+		
+		for(int l = 0; l<NTab[p] ; l++)
+		{
+			stringstream tmp;
+			tmp << "Reactor " << l;
+			TabName[l] = tmp.str();
+			//cout << l << " " << TabName[l] << endl;
+			
+			fTabFoilReactor[p][l] = fItemTab[p][1]->AddTab(TabName[l].c_str());
+			fTabFoilReactor[p][l]->SetLayoutManager(new TGMatrixLayout(fTabFoilReactor[p][l], Nline, 0, 5));
+		}
+		
+	}
+	
+	for (int p = 0;p<fNumberOfParc;p++)
+	{
+		
+		int current_foil = 0;
+		int current_item = 0;
+		int current_item_in_the_foil = 0;
+		for(int n = 0;n<fNumberOfReactor[p];n++)
+		{
+			
+			fCheckArrayReactor[p][current_item] =  new TGCheckButton(fTabFoilReactor[p][current_foil],fDATA->GetReactorName()[p][n]);
+			fCheckArrayReactor[p][current_item]->SetFont(fLabelFontS);
+			
+			fTabFoilReactor[p][current_foil]->AddFrame(fCheckArrayReactor[p][current_item]);
+			fCheckArrayReactor[p][current_item]->Associate(this);
+			
+			current_item_in_the_foil++;
+			current_item++;
+			if(current_item_in_the_foil>= Ncol*Nline)
+			{
+				current_item_in_the_foil = 0;
+				current_foil++;
+			}
+			
+			
+		}
+		
+	}
+}
+//_____________________________________________________________________________________________
+void MainWin::FillStockTab()
+{
+	int Nline = 7-WIDE;
+	int Ncol = 6+WIDE;
+	
+	fTabFoilStock =  new TGCompositeFrame**[fNumberOfParc];
+	fCheckArrayStock =  new TGCheckButton**[fNumberOfParc];
+	int *NTab = new int[fNumberOfParc];
+	
+	for (int i = 0 ; i<fNumberOfParc;i++)
+	{
+		NTab[i] = fNumberOfStock[i]/(Nline*Ncol)+1;
+		fTabFoilStock[i] =  new TGCompositeFrame*[NTab[i]];
+		fCheckArrayStock[i] =  new TGCheckButton*[fNumberOfStock[i]];
+		
+	}
+	
+	for (int p = 0;p<fNumberOfParc;p++)
+	{
+		string TabName[NTab[p]];
+		for(int l = 0; l<NTab[p] ; l++)
+		{
+			stringstream tmp;
+			tmp.str("");
+			tmp << "Stock " << l;
+			TabName[l] = tmp.str();
+			fTabFoilStock[p][l] = fItemTab[p][2]->AddTab(TabName[l].c_str());
+			fTabFoilStock[p][l]->SetLayoutManager(new TGMatrixLayout(fTabFoilStock[p][l], Nline, 0, 5));
+		}
+		
+	}
+	
+	for (int p = 0;p<fNumberOfParc;p++)
+	{
+		
+		int current_foil = 0;
+		int current_item = 0;
+		int current_item_in_the_foil = 0;
+		for(int n = 0;n<fNumberOfStock[p];n++)
+		{
+			
+			fCheckArrayStock[p][current_item] =  new TGCheckButton(fTabFoilStock[p][current_foil],fDATA->GetStockName()[p][n]);
+			fCheckArrayStock[p][current_item]->SetFont(fLabelFontS);
+			
+			fTabFoilStock[p][current_foil]->AddFrame(fCheckArrayStock[p][current_item]);
+			fCheckArrayStock[p][current_item]->Associate(this);
+			
+			current_item_in_the_foil++;
+			current_item++;
+			if(current_item_in_the_foil>= Ncol*Nline)
+			{
+				current_item_in_the_foil = 0;
+				current_foil++;
+			}
+			
+			
+		}
+	}
+	
+}
+//_____________________________________________________________________________________________
+void MainWin::FillPoolTab()
+{
+	int Nline = 7-WIDE;
+	int Ncol = 6+WIDE;
+	
+	fTabFoilPool =  new TGCompositeFrame**[fNumberOfParc];
+	fCheckArrayPool =  new TGCheckButton**[fNumberOfParc];
+	int *NTab = new int[fNumberOfParc];
+	
+	for (int i = 0 ; i<fNumberOfParc;i++)
+	{
+		NTab[i] = fNumberOfPool[i]/(Nline*Ncol)+1;
+		fTabFoilPool[i] =  new TGCompositeFrame*[NTab[i]];
+		fCheckArrayPool[i] =  new TGCheckButton*[fNumberOfPool[i]];
+		
+	}
+	
+	for (int p = 0;p<fNumberOfParc;p++)
+	{
+		
+		string TabName[NTab[p]];
+		for(int l = 0; l<NTab[p] ; l++)
+		{
+			stringstream tmp;
+			tmp.str("");
+			tmp << "Pool " << l;
+			TabName[l] = tmp.str();
+			fTabFoilPool[p][l] = fItemTab[p][3]->AddTab(TabName[l].c_str());
+			fTabFoilPool[p][l]->SetLayoutManager(new TGMatrixLayout(fTabFoilPool[p][l], Nline, 0, 5));
+		}
+		
+	}
+	
+	for (int p = 0;p<fNumberOfParc;p++)
+	{
+		
+		int current_foil = 0;
+		int current_item = 0;
+		int current_item_in_the_foil = 0;
+		for(int n = 0;n<fNumberOfPool[p];n++)
+		{
+			
+			fCheckArrayPool[p][current_item] =  new TGCheckButton(fTabFoilPool[p][current_foil],fDATA->GetPoolName()[p][n]);
+			fCheckArrayPool[p][current_item]->SetFont(fLabelFontS);
+			
+			fTabFoilPool[p][current_foil]->AddFrame(fCheckArrayPool[p][current_item]);
+			fCheckArrayPool[p][current_item]->Associate(this);
+			
+			current_item_in_the_foil++;
+			current_item++;
+			if(current_item_in_the_foil>= Ncol*Nline)
+			{
+				current_item_in_the_foil = 0;
+				current_foil++;
+			}
+			
+			
+		}
+	}
+		
+}
+//_____________________________________________________________________________________________
+void MainWin::FillFabricationTab()
+{
+	int Nline = 7-WIDE;
+	int Ncol = 6+WIDE;
+	
+	fTabFoilFab =  new TGCompositeFrame**[fNumberOfParc];
+	fCheckArrayFab =  new TGCheckButton**[fNumberOfParc];
+	int *NTab = new int[fNumberOfParc];
+	
+	for (int i = 0 ; i<fNumberOfParc;i++)
+	{
+		NTab[i] = fNumberOfFab[i]/(Nline*Ncol)+1;
+		fTabFoilFab[i] =  new TGCompositeFrame*[NTab[i]];
+		fCheckArrayFab[i] =  new TGCheckButton*[fNumberOfFab[i]];
+		
+	}
+	
+	for (int p = 0;p<fNumberOfParc;p++)
+	{
+		
+		string TabName[NTab[p]];
+		for(int l = 0; l<NTab[p] ; l++)
+		{
+			stringstream tmp;
+			tmp.str("");
+			tmp << "Fab " << l;
+			TabName[l] = tmp.str();
+			fTabFoilFab[p][l] = fItemTab[p][4]->AddTab(TabName[l].c_str());
+			fTabFoilFab[p][l]->SetLayoutManager(new TGMatrixLayout(fTabFoilFab[p][l], Nline, 0, 5));
+		}
+		
+	}
+	
+	for (int p = 0;p<fNumberOfParc;p++)
+	{
+		
+		int current_foil = 0;
+		int current_item = 0;
+		int current_item_in_the_foil = 0;
+		for(int n = 0;n<fNumberOfFab[p];n++)
+		{
+			
+			fCheckArrayFab[p][current_item] =  new TGCheckButton(fTabFoilFab[p][current_foil],fDATA->GetFabricationName()[p][n]);
+			fCheckArrayFab[p][current_item]->SetFont(fLabelFontS);
+			
+			fTabFoilFab[p][current_foil]->AddFrame(fCheckArrayFab[p][current_item]);
+			fCheckArrayFab[p][current_item]->Associate(this);
+			
+			current_item_in_the_foil++;
+			current_item++;
+			if(current_item_in_the_foil>= Ncol*Nline)
+			{
+				current_item_in_the_foil = 0;
+				current_foil++;
+			}
+			
+			
+		}
+	}
+	
+}
+//_____________________________________________________________________________________________
+SubWin::SubWin(string event, const TGWindow *p, const TGWindow *main, UInt_t w,UInt_t h,UInt_t options ):
+TGTransientFrame(p, main, w, h, options)
+{
+	fParent = (MainWin*)main;
+	
+	fS0 = new TGCompositeFrame(this, 50, 20, kVerticalFrame);
+	fL0 =  new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX  , 2, 2, 2, 2);
+	AddFrame(fS0, fL0);
+	
+	fSH1 = new TGHorizontalFrame(fS0, 200, 20);
+	fS0->AddFrame(fSH1,fL0);
+	fLmsg = 0;
+	TEName = 0;
+	
+	if(event == "SaveAs") SaveAs();
+	// Frame for Ok/Cancel button
+	//
+	fSH2 = new TGHorizontalFrame(this, 100, 20,kFixedWidth);
+	AddFrame(fSH2,new TGLayoutHints(kLHintsBottom | kLHintsRight,0,0,10,0));
+	
+	fButtonOK = new TGTextButton(fSH2, "&Ok",M_BUT_OK);
+	fButtonCan =  new TGTextButton(fSH2,"&Cancel",M_BUT_CANCEL);
+	fSH2->AddFrame(fButtonOK, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,2, 2, 2, 2));
+	fSH2->AddFrame(fButtonCan, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,2, 2, 2, 2));
+	fButtonOK->Associate(this);
+	fButtonCan->Associate(this);
+	
+	
+	//***************************************************************************
+	//	The REMAP Section
+	//***************************************************************************
+	MapSubwindows();
+	
+	Resize(GetDefaultSize()); //fit to the exact size
+	// position relative to the parent's window
+	Window_t wdum;
+	int ax, ay;
+	gVirtualX->TranslateCoordinates(main->GetId(), GetParent()->GetId(),
+					((TGFrame *) main)->GetWidth()-(int)(1.1*fWidth),
+					(((TGFrame *) main)->GetHeight() - (int)(1.3*fHeight)) ,ax, ay, wdum);
+	Move(ax, ay);
+	MapSubwindows();
+	MapWindow();
+	fClient->WaitFor(this);
+	
+}
+//_____________________________________________________________________________________________
+void SubWin::SaveAs()
+{
+ fLmsg = new TGLabel(fSH1, new TGString("File Name:"));
+ fSH1->AddFrame(fLmsg, new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2));
+ TGTextBuffer *TBName = new TGTextBuffer(100);
+ TBName->AddText(0, "");
+ TEName = new TGTextEntry(fSH1, TBName);
+ TEName->Resize(200, TEName->GetDefaultHeight());
+ fSH1->AddFrame(TEName, fL0);
+ TEName->Associate(this);
+	
+ fRadioASCIISave = new TGRadioButton(fSH1,"ASCII",M_RADIO_ASCII_SAVE);
+ fRadioXMLSave = new TGRadioButton(fSH1,"XML",M_RADIO_XML_SAVE);
+ fRadioASCIISave->SetState(kButtonDown);
+ fRadioASCIISave->Associate(this);
+ fRadioXMLSave->Associate(this);
+ fSH1->AddFrame(fRadioASCIISave);
+ fSH1->AddFrame(fRadioXMLSave);
+ 
+ SetWindowName("Saving Plotted Data");
+ 
+}
+//_____________________________________________________________________________________________
+SubWin::~SubWin()
+{
+	delete fButtonOK ;
+	delete fButtonCan;
+	delete fSH2;
+	if(TEName) delete TEName;
+	if(fLmsg)
+		delete fLmsg;
+	delete fSH1;
+	delete fS0 ;
+	delete fL0 ;
+}
+
+//_____________________________________________________________________________________________
+Bool_t SubWin::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
+{
+	switch (GET_MSG(msg))
+	{
+		case kC_TEXTENTRY:
+			switch (GET_SUBMSG(msg))
+		{
+			case kTE_TEXTCHANGED:
+				
+				break;
+		}
+			break;
+		case kC_COMMAND:
+			switch (GET_SUBMSG(msg))
+		{
+			case kCM_RADIOBUTTON:
+				switch (parm1)
+			{
+				case M_RADIO_ASCII_SAVE:
+					fRadioASCIISave->SetState(kButtonDown);
+					fRadioXMLSave->SetState(kButtonUp);
+					fParent->fSaveFileFormat = "ASCII";
+					break;
+				case M_RADIO_XML_SAVE:
+					fRadioASCIISave->SetState(kButtonUp);
+					fRadioXMLSave->SetState(kButtonDown);
+					fParent->fSaveFileFormat = "XML";
+					break;
+			}
+			case kCM_BUTTON:
+				switch (parm1)
+			{
+				case M_BUT_CANCEL:
+					CloseWindow();
+					break;
+				case M_BUT_OK:
+					if(TEName)
+						fParent->fSaveFileName = TEName->GetBuffer()->GetString();
+					CloseWindow();
+					break;
+					
+			}
+				break;
+			default	:break;
+		}
+	}
+	return kTRUE;
+}
diff --git a/gui/tags/version4.1/CLASSWin.hxx b/gui/tags/version4.1/CLASSWin.hxx
new file mode 100755
index 000000000..999cbf2c6
--- /dev/null
+++ b/gui/tags/version4.1/CLASSWin.hxx
@@ -0,0 +1,257 @@
+#ifndef _CLASSWIN_
+#define _CLASSWIN_
+
+
+
+
+#include <time.h>
+#include <vector>
+#include <iostream>
+
+
+#include <TROOT.h>
+#include <TStyle.h>
+#include <TGFrame.h>
+#include "TGLayout.h"
+#include <TGTab.h>
+#include <TGButton.h>
+#include <TGMsgBox.h>
+#include <TGComboBox.h>
+#include <TGTextBuffer.h>
+#include <TGLabel.h>
+#include <TGTextEntry.h>
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TLegend.h>
+#include <TH2.h>
+#include "TColor.h"
+#include "THStack.h"
+#include <TGraph.h>
+#include <TGraphErrors.h>
+#include <TLatex.h>
+#include <TGClient.h>
+#include <TGTextView.h>
+#include <TGSlider.h>
+#include <TImage.h>
+
+#include "CLASSRead.hxx"
+
+using namespace std; 
+//________________________________________________________________________
+//
+//		Windows and Widgets classes.
+//@{
+//		MainWin is the main window with Tab (1 for inventory, 1 for cross-section
+//		and 1 for fluxes). SubWin is used for small windows that appears when
+//		some buttons are pressed (e.g. Save As button, Exec Macro button, ...)
+
+// Thank to Francisco, Guerin, Louard, Shi for their participation to the XML ouput implementation
+// @author BLG
+// @author BAM
+// @version 1.0
+
+//@}
+
+//Here is the widget code: it correspond to signal emitted when a widget is activated 
+enum CommandId{
+	M_BUTTON_PLOT = 20,
+	M_BUTTON_SAVE,
+	M_BUTTON_MACRO,
+	M_BUTTON_QUIT,
+	M_BUT_OK,
+	M_BUT_CANCEL,
+	M_CHECK_PLOTALL,
+	M_RADIO_XML_SAVE,
+	M_RADIO_ASCII_SAVE,
+	M_RADIO_DECAY_HEAT,
+	M_RADIO_RADIOTOX,
+	M_CB_SCENAR_Time,
+	M_CHECK_LINEAR_Tox,
+	M_TE_toxfirst,
+	M_TE_toxlast,
+	M_TE_toxnstep,
+	M_CHECK_AM_NUC,
+	M_CHECK_FP_NUC,
+	M_CHECK_BY_MOTHER,
+	M_CHECK_INSIDE,
+	M_CHECK_CUMIN,
+	M_CHECK_CUMOUT,
+	M_BUTTON_MOTHER_MORE};
+			  
+			  
+class MainWin :  public  TGMainFrame   
+{
+public:
+
+	MainWin(CLASSRead *DATA,vector<string> VFileName); 
+	MainWin(){}
+	~MainWin();		//@- destructor
+	
+	
+	void Start(vector<string> VFileName);
+	bool ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); //@- widget signal handler method
+	void CloseWindow();			//@- destroy the main window
+	void Plot();				//@- general Plot method
+        void Conversionxml();                   //@- general Conversionxml method
+
+
+	void FillItemTab(int i);
+	
+	void FillNucTab();			//@- fill the Inventory Tab foil
+	void FillTotalTab();
+	void FillReactorTab();			//@- fill the Cross-section Tab foil
+	void FillStockTab();			//@- fill the Flux Tab foil
+	void FillPoolTab();			//@- fill the Reaction Rate Tab foil
+	void FillFabricationTab();		//@- fill the Breeding Ratio Tab foil
+	void FillNucFoil(int NCheck,int Ncol,int Nline);
+
+	string fSaveFileName;
+	string fSaveFileFormat;
+	
+private:
+	
+	
+	CLASSRead* fDATA;
+
+	
+	
+	int		fGraphLineWidth;
+	double		fGraphMarkerSize;
+
+	int	fNumberOfParc;
+	int	fNumberOfTOT;
+	int *	fNumberOfReactor;
+	int *	fNumberOfStock;
+	int *	fNumberOfPool;
+	int *	fNumberOfFab;
+
+	vector<TGCheckButton*>	fSaveCheckButton;		//@- save each of these check boxes
+	
+	//
+	//widgets
+	//
+	FontStruct_t fLabelFontB;
+	FontStruct_t fLabelFontS;
+	
+	//main tab
+	TGCompositeFrame *	fGeneF0;		//@- Common widget frame
+	TGCompositeFrame *	fPlotSaveQuitFrame;
+	
+	TGCompositeFrame **	fParcTabFoil;
+	TGTab *			fParcTab; //Parc table
+	
+	TGCompositeFrame ***	fFacilitiesTabFoil;
+	
+	TGTab **		fFacilitiesTab;// tab
+	TGTab ***		fItemTab;
+	
+	//Configuration Tab
+
+	TGTab *			fPlotConfigTab; //Plot configuratio tab
+	TGCompositeFrame **	fPlotConfigFoil;
+	TGCompositeFrame	*fInventoryFrame;
+	
+	
+		//Radio Or Decay
+	TGCompositeFrame *	fDecayOrRadioFrame;
+	TGRadioButton		*fButtonRadiotox,*fButtonHeat;
+	
+		//By mother
+	bool			fMotherIsVisible,fIsByMother,fIsLinear;
+	TGPictureButton 	*fByMotherMore;  //@- hide or show by mother
+	int			fTimeStep;
+	TGCheckButton		*fByMotherButton ;
+	TGComboBox		*fScenarTimeCBox;
+	TGCompositeFrame	*fTimeParametersFrame,*fByMotherFrame,*fScenarTimeFrame;
+	TGTextEntry		*TEtoxfirst,*TEtoxlast,*TEtoxnstep;// the write text widget in time evolution parameters
+	TGCheckButton		*fCheckLinear;
+
+	double			fToxTimeFirst;	// first time steps for radiotoxicity calculations
+	double			fToxTimeLast;	// last time steps for radiotoxicity calculations
+	int			fToxNstep;	// number of time steps for radiotoxicity calculations
+
+	
+	//misc frame
+	TGCompositeFrame	*fMiscFrame,*fMiscHzFrame;
+	TGCheckButton		*fCheckAMNuc,*fCheckFPNuc,*fCheckSumOfSelected;
+	
+	//Factories Arrays
+	TGCheckButton ***	fCheckArrayTotal;
+	TGCheckButton ***	fCheckArrayReactor;
+	TGCheckButton ***	fCheckArrayStock;
+	TGCheckButton ***	fCheckArrayPool;
+	TGCheckButton ***	fCheckArrayFab;
+	//Factories Foils
+	TGCompositeFrame ***	fTabFoilReactor;
+	TGCompositeFrame ***	fTabFoilStock;
+	TGCompositeFrame ***	fTabFoilPool;
+	TGCompositeFrame ***	fTabFoilFab;
+	
+
+	TGCheckButton ** fCheckIVPlot ;
+
+	
+	TGTextButton *	fButtonPlot;		//@- Press buttons to Plot,Save,...
+	TGTextButton *	fButtonSave;
+	TGTextButton *	fButtonQuit;
+	int		fMainWidth;		//@- Width of fGeneF0
+	
+	//Inventory tab
+	TGTab *			fTabNuc;		//@- Tab of Inventory nuclei
+	TGCompositeFrame **	fTabFoilNuc;		//@- its foils: AM,FP0,...,FPN, gaz, misc
+	TGComboBox *		fTimeScaleNuc;		//@- time scale combo box
+	
+	
+	//@- specific frames
+	TGCompositeFrame *	fMiscGrpFNuc;
+	TGCompositeFrame *	fXGprFNuc;
+	TGCompositeFrame *	fYGprFNuc;
+	
+	TGCheckButton **	fCheckArrayNuc;	//@- array of check box for inventory nuclei tab
+	int			fNselectedNucleus;	//@- number of check box selected in the previous array
+
+	
+	
+};
+
+
+
+
+class SubWin: public  TGTransientFrame
+{
+public :
+	SubWin(string event,const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
+               UInt_t options = kVerticalFrame);   	//@- Normal constructor
+	~SubWin();
+	
+	
+	Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); //@- widget signal handler method
+	void CloseWindow(){delete this;}		//@- Close windows
+	void SaveAs();
+
+	
+private:
+
+	TGLayoutHints *		fL0;			//@- position hints in the sub win
+	TGCompositeFrame *	fS0;			//@- main frame of the sub win
+	TGHorizontalFrame *	fSH1;			//@- misc frame
+	TGHorizontalFrame *	fSH2;			//@- misc frame
+	
+	TGTextButton *		fButtonOK;		//@- OK an Cancel button
+	TGTextButton *		fButtonCan;		//@- OK an Cancel button
+	
+	TGLabel	*		fLmsg;			//@- a label for the write text widget
+	TGLabel	*		fNucLabel[11];
+	TGTextView *		fTGVNuclei;
+	TGTextEntry *		TEName;		//@- the write text widget in save as and exec macro
+ 	TGTextEntry *		TEExtract[11];		//@- the extract nuclei
+	
+	MainWin	*		fParent; 		//@- parent of the sub win (i.e. MainWin)
+
+	TGRadioButton *fRadioASCIISave;
+	TGRadioButton *fRadioXMLSave;
+	   
+  };
+
+
+#endif
diff --git a/gui/tags/version4.1/Makefile b/gui/tags/version4.1/Makefile
new file mode 100755
index 000000000..e9d52ce08
--- /dev/null
+++ b/gui/tags/version4.1/Makefile
@@ -0,0 +1,71 @@
+include ../config/Makefile.config
+
+OMPFLAGS=
+OMPLIB=
+
+# Directory containing includes for CLASS
+LOCALINC	= ../source/include
+
+######################################################
+######### nothing to change from here ################
+######################################################
+
+#------------------------------------------------------------------------------
+CXXFLAGS      += -g -I$(LOCALINC)
+LD            = $(CXX)
+LIBS          += -L$(LIBDIR) -lCLASSpkg $(OMPLIB)
+LDFLAGS       =
+GLIBS         = $(ROOTGLIBS) -lTMVA
+
+CXXFLAGS     += $(ROOTCFLAGS)
+
+#------------------------------------------------------------------------------
+subO	= CLASSPlotElement.o \
+	  CLASSWin.o \
+	  CLASSRead.o
+#------------------------------------------------------------------------------
+subS	= CLASSPlotElement.cxx \
+	  CLASSWin.cxx \
+	  CLASSRead.cxx
+
+#
+mainO	=  CLASSGui.o
+mainS	=  CLASSGui.cxx
+main	=  CLASSGui
+
+
+OBJS    = $(subO) $(mainO) 
+
+
+
+
+
+all:    $(OBJS)
+		
+	$(LD) $(LDFLAGS) $(OBJS) $(LIBS) $(GLIBS) -o $(main)
+	@mkdir -p $(Gui_bin_PATH)
+	@mv  $(main) $(Gui_bin_PATH)
+	@echo "$(main) done"
+	@echo "CLASSGui is now available in $(Gui_bin_PATH) "
+
+
+
+clean:
+		@rm -f $(OBJS)
+		@rm -f ./bin/CLASSGui
+
+
+.SUFFIXES: .cxx
+
+CLASSRead.o:	CLASSRead.hxx \
+		CLASSPlotElement.hxx
+
+CLASSWin.o:	CLASSRead.hxx \
+		CLASSPlotElement.hxx \
+		CLASSWin.hxx 
+
+CLASSPlotElement.o:	CLASSPlotElement.hxx
+
+.cxx.o:
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c  $<
+
-- 
GitLab