From fb511fb03389875a13c00863736279b1e7b0f664 Mon Sep 17 00:00:00 2001
From: Baptiste Mouginot <mouginot.baptiste@gmail.com>
Date: Wed, 24 Jun 2015 17:06:52 +0000
Subject: [PATCH] annule last commit

git-svn-id: svn+ssh://svn.in2p3.fr/class@672 0e7d625b-0364-4367-a6be-d5be4a48d228
---
 source/trunk/Model/XS/XSM_MLP.cxx  | 66 +++++++----------------
 source/trunk/Model/XS/XSM_MLP.hxx  | 16 ++----
 source/trunk/include/XSModel.hxx   |  8 +--
 source/trunk/src/EvolutionData.cxx |  2 +-
 source/trunk/src/XSModel.cxx       | 85 +++++++-----------------------
 5 files changed, 43 insertions(+), 134 deletions(-)

diff --git a/source/trunk/Model/XS/XSM_MLP.cxx b/source/trunk/Model/XS/XSM_MLP.cxx
index c9b95a28d..aae0883a9 100644
--- a/source/trunk/Model/XS/XSM_MLP.cxx
+++ b/source/trunk/Model/XS/XSM_MLP.cxx
@@ -2,7 +2,6 @@
 #include "XSModel.hxx"
 #include "XSM_MLP.hxx"
 #include "CLASSLogger.hxx"
-#include "CLASSMethod.hxx"
 #include "StringLine.hxx"
 
 #include "TMVA/Reader.h"
@@ -39,69 +38,46 @@ XSM_MLP::XSM_MLP(string TMVA_Weight_Directory,string InformationFile, bool IsTim
 	fIsStepTime=IsTimeStep;
 	fTMVAWeightFolder = TMVA_Weight_Directory;
 	if(InformationFile=="")
-		fInformationFile = TMVA_Weight_Directory+"/Data_Base_Info.nfo";
+		fMLPInformationFile = TMVA_Weight_Directory+"/Data_Base_Info.nfo";
 	else
-		fInformationFile = fTMVAWeightFolder+InformationFile;
+		fMLPInformationFile=fTMVAWeightFolder+InformationFile;
 
 	GetMLPWeightFiles();
+	GetDataBaseInformation();
 
-	INFO << "__A cross section interpolator using" << endl;
-	INFO << "Multi Layer Perceptron has been define__" << endl;
+	INFO<<"__A cross section interpolator using" <<endl;
+	INFO<<"Multi Layer Perceptron has been define__"<<endl;
 	INFO << " \t His TMVA folder is : \" " << fTMVAWeightFolder << "\"" << endl;
-	
-	LoadKeyword();
-	ReadNFO();
 
 }
-
 //________________________________________________________________________
 XSM_MLP::XSM_MLP(CLASSLogger* Log,string TMVA_Weight_Directory,string InformationFile, bool IsTimeStep):XSModel(Log)
 {
 
-	fIsStepTime = IsTimeStep;
+	fIsStepTime=IsTimeStep;
 	fTMVAWeightFolder = TMVA_Weight_Directory;
-	if( InformationFile == "" )
-		fInformationFile = TMVA_Weight_Directory + "/Data_Base_Info.nfo";
+	if(InformationFile=="")
+		fMLPInformationFile = TMVA_Weight_Directory+"/Data_Base_Info.nfo";
 	else
-		fInformationFile = fTMVAWeightFolder+InformationFile;
+		fMLPInformationFile=fTMVAWeightFolder+InformationFile;
 
 	GetMLPWeightFiles();
+	GetDataBaseInformation();
 
-	INFO << "__A cross section interpolator using" << endl;
-	INFO << "Multi Layer Perceptron has been define__" << endl;
+	INFO<<"__A cross section interpolator using" <<endl;
+	INFO<<"Multi Layer Perceptron has been define__"<<endl;
 	INFO << " \t His TMVA folder is : \" " << fTMVAWeightFolder << "\"" << endl;
-	
-	LoadKeyword();
-	ReadNFO();	
 
 }
-
 //________________________________________________________________________
 XSM_MLP::~XSM_MLP()
 {
 	fMapOfTMVAVariableNames.clear();
 }
-
-
-
-//________________________________________________________________________
-void XSM_MLP::ReadLine(string line)
-{
-	DBGL
-	
-	int start = 0;
-	string keyword = tlc(StringLine::NextWord(line, start, ' '));
-	(this->*fKeyword[ keyword ])(line);
-	
-	DBGL
-}
-
-
-
 //________________________________________________________________________
 void XSM_MLP::GetDataBaseInformation()
 {
-	ifstream FILE(fInformationFile.c_str());
+	ifstream FILE(fMLPInformationFile.c_str());
 
 	if(FILE.good())
 	{
@@ -195,7 +171,7 @@ void XSM_MLP::GetDataBaseInformation()
 	}
 	else
 	{
-		ERROR << "Can't find/open file " << fInformationFile << endl;
+		ERROR << "Can't find/open file " << fMLPInformationFile << endl;
 		exit(0);
 	}
 
@@ -221,8 +197,7 @@ void XSM_MLP::GetDataBaseInformation()
 }
 //________________________________________________________________________
 void XSM_MLP::GetMLPWeightFiles()
-{
-	DBGL
+{DBGL
 	/**********Get All TMVA weight files*******************/
 	//check if the folder containing weights exists
 	DIR* rep = NULL;
@@ -311,7 +286,7 @@ TTree* XSM_MLP::CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep)
 
 	for( it = fMapOfTMVAVariableNames.begin()  ; it!=fMapOfTMVAVariableNames.end() ; it++)
 	{
-		InputTree->Branch( ((*it).second).c_str() ,&InputTMVA[j], ((*it).second + "/F").c_str());
+		InputTree->Branch( ((*it).second).c_str()	,&InputTMVA[j], ((*it).second + "/F").c_str());
 		IVInputTMVA+= ((*it).first)*1;
 		j++;
 	}
@@ -396,8 +371,7 @@ double XSM_MLP::ExecuteTMVA(string WeightFile,TTree* InputTree)
 }
 //________________________________________________________________________
 EvolutionData XSM_MLP::GetCrossSectionsTime(IsotopicVector IV)
-{
-	DBGL
+{DBGL
 
 	EvolutionData EvolutionDataFromMLP = EvolutionData();
 
@@ -501,8 +475,7 @@ void XSM_MLP::ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &R
 
 //________________________________________________________________________
 EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV)
-{
-	DBGL
+{DBGL
 	TTree* InputTree=CreateTMVAInputTree(IV);
 
 	EvolutionData EvolutionDataFromMLP = EvolutionData();
@@ -560,8 +533,7 @@ EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV)
 }
 //________________________________________________________________________
 EvolutionData XSM_MLP::GetCrossSections(IsotopicVector IV ,double t)
-{
-	DBGL
+{DBGL
 	if(t!=0)
 		WARNING << " Argument t has non effect here " << endl;
 
diff --git a/source/trunk/Model/XS/XSM_MLP.hxx b/source/trunk/Model/XS/XSM_MLP.hxx
index 7b0bd3cf4..eda1d1faa 100644
--- a/source/trunk/Model/XS/XSM_MLP.hxx
+++ b/source/trunk/Model/XS/XSM_MLP.hxx
@@ -21,11 +21,6 @@
 typedef long long int cSecond;
 using namespace std;
 
-
-class XSM_MLP;
-#ifndef __CINT__
-typedef void (XSM_MLP::*DMthPtr)( const string & ) ;
-#endif
 //-----------------------------------------------------------------------------//
 //! Defines a XSModel getting mean cross sections from neural network execution
 
@@ -75,11 +70,9 @@ class XSM_MLP : public XSModel
 	~XSM_MLP();
 	//@}
 
-	void LoadKeyword() {}
 
- 	EvolutionData GetCrossSections(IsotopicVector IV,double t=0);	//!< Return calculated cross section by the MLP regression
+ 	virtual EvolutionData GetCrossSections(IsotopicVector IV,double t=0);	//!< Return calculated cross section by the MLP regression
 
-	void ReadLine(string line);
 
 	private :
 	
@@ -102,15 +95,14 @@ class XSM_MLP : public XSModel
  	vector<string> 	fWeightFiles;	//!<  All the weight file contains in fTMVAWeightFolder
 	
 	string fTMVAWeightFolder;	//!<  folder containing all the weight file
- 	
+ 	string fMLPInformationFile;	//!<  file containing Reactor Type, Fuel type, HM mass, Power, time vector, and TMVA input variables names (looks the manual for format details)
+	
 	
  	bool fIsStepTime;		//!<  true if one TMVA weihgt per step time is requiered otherwise it assumes time is part of the MLP inputs
 
  	map<ZAI,string> fMapOfTMVAVariableNames;//!<  List of TMVA input variable names (read from fMLPInformationFile ) , name depends on the training step
 	
-#ifndef __CINT__
-	map<string, DMthPtr> fDKeyword;
-#endif
+	
 };
 
 #endif
diff --git a/source/trunk/include/XSModel.hxx b/source/trunk/include/XSModel.hxx
index b8718bf91..bd522cce4 100644
--- a/source/trunk/include/XSModel.hxx
+++ b/source/trunk/include/XSModel.hxx
@@ -90,23 +90,17 @@ class XSModel : public CLASSObject
 	virtual  bool isIVInDomain(IsotopicVector IV) ;
 	//@}
 	
-	void ReadNFO();
-	virtual void ReadLine(string line);
-
-	
 	void ReadZAIlimits(const string &line);
 	void ReadType(const string &line);
 	void ReadRParam(const string &line);
 	
-	virtual void LoadKeyword();
+	void LoadKeyword();
 	
 	
 	void SetZAIThreshold(int Z_Threshold){fZAIThreshold = Z_Threshold;}//!< Set the Z threshold : ZAI with Z < fZAIThreshold are not manage by CLASS
 	int  GetZAIThreshold(){return fZAIThreshold;}//!< Get the Z threshold
 
 	protected :
-	bool freaded;
-	string fInformationFile;	//!<  file containing Reactor Type, Fuel type, HM mass, Power, time vector, and TMVA input variables names (looks the manual for format details)
 	
 	double fDBPower;		//!<  Power of the data base (read from fMLPInformationFile )
 	double fDBHMMass;		//!<  Heavy metal mass of the data base (read from fMLPInformationFile )
diff --git a/source/trunk/src/EvolutionData.cxx b/source/trunk/src/EvolutionData.cxx
index c594286bc..6be228a73 100755
--- a/source/trunk/src/EvolutionData.cxx
+++ b/source/trunk/src/EvolutionData.cxx
@@ -575,7 +575,7 @@ void EvolutionData::ReadDB(string DBfile, bool oldread)
 	if(!DecayDB)				//check if file is correctly open
 	{
 		ERROR << " \n Can't open \"" << DBfile << "\"\n" << endl;
-		ERROR << "\t-> Hint : If loading .dat files using a .idx file (like for a decay data base)\nmake sure the paths in it are correct" << endl;;
+		ERROR <<"\t-> Hint : If loading .dat files using a .idx file (like for a decay data base)\nmake sure the paths in it are correct";
 		exit(1);
 	}
 	vector<double> vTime;
diff --git a/source/trunk/src/XSModel.cxx b/source/trunk/src/XSModel.cxx
index f9fb1a99f..1522534f5 100644
--- a/source/trunk/src/XSModel.cxx
+++ b/source/trunk/src/XSModel.cxx
@@ -17,71 +17,23 @@ using namespace std;
 
 XSModel::XSModel():CLASSObject()
 {
-	XSModel::LoadKeyword();
+	LoadKeyword();
 }
 
 
 XSModel::XSModel(CLASSLogger* log):CLASSObject(log)
 {
-	
-	XSModel::LoadKeyword();
-}
-
-
-void XSModel::ReadNFO()
-{
-	DBGL
-	ifstream NFO(fInformationFile.c_str());
-	
-	if(!NFO)
-	{
-		ERROR << "Can't find/open file " << fInformationFile << endl;
-		exit(0);
-	}
-	
-	do
-	{
-		string line;
-		getline(NFO,line);
-		
-		XSModel::ReadLine(line);
-		
-	} while(NFO.eof());
-	
-	DBGL
-}
-
-//________________________________________________________________________
-void XSModel::ReadLine(string line)
-{
-	DBGL
-	
-	if (!freaded)
-	{
-		int start = 0;
-		string keyword = tlc(StringLine::NextWord(line, start, ' '));
-		
-		(this->*fKeyword[ keyword ])(line);
-		freaded = true;
-		
-		ReadLine(line);
-
-	}
-
-	freaded = false;
-
-	DBGL
-}
-
+	LoadKeyword();
+}	
 
 void XSModel::LoadKeyword()
 {
 	DBGL
 	fKeyword.insert( pair<string, MthPtr>( "k_zail",	& XSModel::ReadZAIlimits));
-	fKeyword.insert( pair<string, MthPtr>( "k_reactor",	& XSModel::ReadType)	 );
-	fKeyword.insert( pair<string, MthPtr>( "k_fuel",	& XSModel::ReadType)	 );
-	fKeyword.insert( pair<string, MthPtr>( "k_mass",	& XSModel::ReadRParam)	 );
-	fKeyword.insert( pair<string, MthPtr>( "k_power",	& XSModel::ReadRParam)	 );
+	fKeyword.insert( pair<string, MthPtr>( "k_reactor",	& XSModel::ReadType)	);
+	fKeyword.insert( pair<string, MthPtr>( "k_fuel",	& XSModel::ReadType)	);
+	fKeyword.insert( pair<string, MthPtr>( "k_mass",	& XSModel::ReadRParam)	);
+	fKeyword.insert( pair<string, MthPtr>( "k_power",	& XSModel::ReadRParam)	);
 	DBGL
 }
 
@@ -89,15 +41,15 @@ void XSModel::ReadRParam(const string &line)
 {
 	DBGL
 	int start = 0;
-	string keyword = tlc(StringLine::NextWord(line, start, ' '));
-	if( keyword != "k_power" || keyword != "k_mass" )	// Check the keyword
+	string type = tlc(StringLine::NextWord(line, start, ' '));
+	if( type != "k_power" || type != "k_mass" )	// Check the keyword
 	{
-		ERROR << " Bad keyword : " << keyword << " Not found !" << endl;
+		ERROR << " Bad keyword : " << type << " Not found !" << endl;
 		exit(1);
 	}
-	if( keyword == "k_mass" )
+	if( type == "k_mass" )
 		fDBHMMass = atof(StringLine::NextWord(line, start, ' ').c_str());
-	else if( keyword == "k_mass" )
+	else if( type == "k_mass" )
 		fDBPower = atof(StringLine::NextWord(line, start, ' ').c_str());
 	
 	DBGL
@@ -108,15 +60,15 @@ void XSModel::ReadType(const string &line)
 {
 	DBGL
 	int start = 0;
-	string keyword = tlc(StringLine::NextWord(line, start, ' '));
-	if( keyword != "k_fuel" || keyword != "k_reactor" )	// Check the keyword
+	string type = tlc(StringLine::NextWord(line, start, ' '));
+	if( type != "k_fuel" || type != "k_reactor" )	// Check the keyword
 	{
-		ERROR << " Bad keyword : " << keyword << " Not found !" << endl;
+		ERROR << " Bad keyword : " << type << " Not found !" << endl;
 		exit(1);
 	}
-	if( keyword == "k_fuel" )
+	if( type == "k_fuel" )
 		fDBFType = StringLine::NextWord(line, start, ' ');
-	else if( keyword == "k_reactor" )
+	else if( type == "k_reactor" )
 		fDBRType = StringLine::NextWord(line, start, ' ');
 
 	DBGL
@@ -127,8 +79,7 @@ void XSModel::ReadZAIlimits(const string &line)
 {
 	DBGL
 	int start = 0;
-	string keyword = tlc(StringLine::NextWord(line, start, ' '));
-	if( keyword != "k_zail" )	// Check the keyword
+	if( tlc(StringLine::NextWord(line, start, ' ')) != "k_zail" )	// Check the keyword
 	{
 		ERROR << " Bad keyword : \"k_zail\" not found !" << endl;
 		exit(1);
-- 
GitLab