From 4c667d2066203875e8a6a88f50cbe63d8295cf5a Mon Sep 17 00:00:00 2001
From: Baptiste LENIAU <baptiste.leniau@subatech.in2p3.fr>
Date: Tue, 19 Apr 2016 14:12:45 +0000
Subject: [PATCH] Add Fanny's upgrades

git-svn-id: svn+ssh://svn.in2p3.fr/class@812 0e7d625b-0364-4367-a6be-d5be4a48d228
---
 .../Equivalence/EQM_FBR_MLP_Keff_BOUND.cxx    | 62 ++++++-------------
 .../Equivalence/EQM_FBR_MLP_Keff_BOUND.hxx    | 16 ++---
 2 files changed, 24 insertions(+), 54 deletions(-)

diff --git a/source/branches/SL3/Model/Equivalence/EQM_FBR_MLP_Keff_BOUND.cxx b/source/branches/SL3/Model/Equivalence/EQM_FBR_MLP_Keff_BOUND.cxx
index 47cc75a67..d5616bb0d 100644
--- a/source/branches/SL3/Model/Equivalence/EQM_FBR_MLP_Keff_BOUND.cxx
+++ b/source/branches/SL3/Model/Equivalence/EQM_FBR_MLP_Keff_BOUND.cxx
@@ -51,7 +51,7 @@ EQM_FBR_MLP_Keff_BOUND::EQM_FBR_MLP_Keff_BOUND(string TMVAWeightPath,  int NumOf
 	fInformationFile = InformationFile;
 	
 	LoadKeyword();
-	ReadNFO();//Getting information from fInformationFile
+	ReadNFO();//Getting information from fMLPInformationFile
 	
 	
 	/* OTHER MODEL PARAMETERS */
@@ -73,26 +73,8 @@ EQM_FBR_MLP_Keff_BOUND::EQM_FBR_MLP_Keff_BOUND(string TMVAWeightPath,  int NumOf
 	INFO << "__An equivalence model has been define__" << endl;
 	INFO << "\tThis model is based on the prediction of keff averaged over the number of batch" << endl;
 	INFO << "\tThe TMVA (weight | information) files are :" << endl;
-	INFO << "\t" << "( " << fTMVAWeightPath << " | " << fInformationFile << " )" << endl;
-	INFO << "Time (s) :"<<endl;
-	for(int i=0;i< (int) fMLP_Time.size();i++)
-			INFO<<fMLP_Time[i]<<endl;
-	INFO<<endl;
-	INFO<<"Z A I Name (input MLP) :"<<endl;
-	map<ZAI ,string >::iterator it;
-	for( it = fMapOfTMVAVariableNames.begin()  ; it != fMapOfTMVAVariableNames.end() ; it++)
-		INFO<<(*it).first.Z()<<" "<<(*it).first.A()<<" "<<(*it).first.I()<<" "<<(*it).second<<endl;
-	INFO<<endl;
-	EquivalenceModel::PrintInfo();
-
-
+	INFO << "\t" << "( " << fTMVAWeightPath[0] << " | " << fMLPInformationFile << " )" << endl;
 
-
-	if(fMapOfTMVAVariableNames.empty() || fFertileList.GetIsotopicQuantity().empty() || fFissileList.GetIsotopicQuantity().empty() || fMLP_Time.size()== 0 )	
-	{
-		ERROR<<"Missing information file in : "<<fInformationFile<<endl;
-		exit(1);
-	}
 	
 	DBGL
 }
@@ -113,7 +95,7 @@ EQM_FBR_MLP_Keff_BOUND::EQM_FBR_MLP_Keff_BOUND(CLASSLogger* log, string TMVAWeig
 	
 	fInformationFile = InformationFile;
 	LoadKeyword();
-	ReadNFO();//Getting information from fInformationFile
+	ReadNFO();//Getting information from fMLPInformationFile
 	
 	
 	
@@ -133,30 +115,12 @@ EQM_FBR_MLP_Keff_BOUND::EQM_FBR_MLP_Keff_BOUND(CLASSLogger* log, string TMVAWeig
 	INFO << "__An equivalence model has been define__" << endl;
 	INFO << "\tThis model is based on the prediction of keff averaged over the number of batch" << endl;
 	INFO << "\tThe TMVA (weight | information) files are :" << endl;
-	INFO << "\t" << "( " << fTMVAWeightPath << " | " << fInformationFile << " )" << endl;
-	INFO << "Time (s) :"<<endl;
-	for(int i=0;i< (int) fMLP_Time.size();i++)
-			INFO<<fMLP_Time[i]<<endl;
-	INFO<<endl;
-	INFO<<"Z A I Name (input MLP) :"<<endl;
-	map<ZAI ,string >::iterator it;
-	for( it = fMapOfTMVAVariableNames.begin()  ; it != fMapOfTMVAVariableNames.end() ; it++)
-		INFO<<(*it).first.Z()<<" "<<(*it).first.A()<<" "<<(*it).first.I()<<" "<<(*it).second<<endl;
-	INFO<<endl;
-	EquivalenceModel::PrintInfo();
-
-
-	if(fMapOfTMVAVariableNames.empty() || fFertileList.GetIsotopicQuantity().empty() || fFissileList.GetIsotopicQuantity().empty() || fMLP_Time.size()== 0 )	
-	{
-		ERROR<<"Missing information file in : "<<fInformationFile<<endl;
-		exit(1);
-	}
-
+	INFO << "\t" << "( " << fTMVAWeightPath[0] << " | " << fMLPInformationFile << " )" << endl;
+	
+	
 	DBGL
-
-
-
 }
+
 //________________________________________________________________________
 TGraph* EQM_FBR_MLP_Keff_BOUND::BuildKeffGraph(IsotopicVector FreshFuel)
 {
@@ -221,6 +185,7 @@ double EQM_FBR_MLP_Keff_BOUND::GetKeffAt(TGraph* GRAPH_KEFF, int Step)
 	DBGL
 	return Keff;
 }
+
 //________________________________________________________________________
 TTree* EQM_FBR_MLP_Keff_BOUND::CreateTMVAInputTree(IsotopicVector TheFreshfuel, double ThisTime)
 {
@@ -322,6 +287,7 @@ double EQM_FBR_MLP_Keff_BOUND::ExecuteTMVA(TTree* InputTree, bool IsTimeDependen
 	DBGL
 	return (double)val;	//return k_{eff}(t = Time)
 }
+
 //________________________________________________________________________
 void EQM_FBR_MLP_Keff_BOUND::LoadKeyword()
 {
@@ -332,6 +298,7 @@ void EQM_FBR_MLP_Keff_BOUND::LoadKeyword()
 	
 	DBGL
 }
+
 //________________________________________________________________________
 void EQM_FBR_MLP_Keff_BOUND::ReadZAIName(const string &line)
 {
@@ -353,6 +320,7 @@ void EQM_FBR_MLP_Keff_BOUND::ReadZAIName(const string &line)
 	fMapOfTMVAVariableNames.insert( pair<ZAI,string>( ZAI(Z, A, I), name ) );
 	DBGL
 }
+
 //________________________________________________________________________
 void EQM_FBR_MLP_Keff_BOUND::ReadTimeSteps(const string &line)
 {
@@ -369,6 +337,7 @@ void EQM_FBR_MLP_Keff_BOUND::ReadTimeSteps(const string &line)
 		fMLP_Time.push_back( atof( (StringLine::NextWord(line,pos,' ')).c_str() ));
 	DBGL
 }
+
 //________________________________________________________________________
 void EQM_FBR_MLP_Keff_BOUND::ReadLine(string line)
 {
@@ -384,10 +353,15 @@ void EQM_FBR_MLP_Keff_BOUND::ReadLine(string line)
 	
 	DBGL
 }
+
 //________________________________________________________________________
-double EQM_FBR_MLP_Keff_BOUND::GetFissileMolarFraction(IsotopicVector Fissile, IsotopicVector Fertile, double TargetBU)
+double EQM_FBR_MLP_Keff_BOUND::GetFissileMolarFraction(vector <IsotopicVector> IVStream, double TargetBU)
 {
 	DBGL
+
+	IsotopicVector Fissile = IVStream[0];
+	IsotopicVector Fertile = IVStream[1];
+
 	if(TargetBU != 0)
 		WARNING << "The third arguement : Burnup has no effect here.";
 	
diff --git a/source/branches/SL3/Model/Equivalence/EQM_FBR_MLP_Keff_BOUND.hxx b/source/branches/SL3/Model/Equivalence/EQM_FBR_MLP_Keff_BOUND.hxx
index e9984b5b4..22cd08900 100644
--- a/source/branches/SL3/Model/Equivalence/EQM_FBR_MLP_Keff_BOUND.hxx
+++ b/source/branches/SL3/Model/Equivalence/EQM_FBR_MLP_Keff_BOUND.hxx
@@ -86,7 +86,7 @@ class EQM_FBR_MLP_Keff_BOUND : public EquivalenceModel
 	 \param Fertil : The composition of the Fertil matter
 	 \param BurnUp : Maximum achievable burn up envisaged
 	 */
-	virtual double GetFissileMolarFraction(IsotopicVector Fissil,IsotopicVector Fertil,double BurnUp = 0);
+	virtual double GetFissileMolarFraction(vector <IsotopicVector> IVStream,double BurnUp = 0);
 	//}
 	
 	/*!
@@ -157,12 +157,13 @@ class EQM_FBR_MLP_Keff_BOUND : public EquivalenceModel
 	private :
 	
 	string fTMVAWeightPath;					//!<The weight needed by TMVA to construct and execute the multilayer perceptron
+	string fMLPInformationFile;				//!<The path to the informations necessary to execute the MLP
 	
 #ifndef __CINT__
 	map<string, FBR_MLP_Keff_BOUND_DMthPtr> fDKeyword;
 #endif
 	
-	map<ZAI,string> fMapOfTMVAVariableNames;//!<  List of TMVA input variable names (read from fInformationFile ) , name depends on the training step
+	map<ZAI,string> fMapOfTMVAVariableNames;//!<  List of TMVA input variable names (read from fMLPInformationFile ) , name depends on the training step
 	
 	vector<double> fMLP_Time;	//!< Time (in seconds) when the MLP(t) = keff(t) has been trained.
 	
@@ -182,19 +183,14 @@ class EQM_FBR_MLP_Keff_BOUND : public EquivalenceModel
 	
 	
 	
-	/*!
-	 \name kinf prediction methods & keff averaging
-	 */
-	//@{
-	 
-	double 	GetKeffAtFixedTime(IsotopicVector FreshFuel){TTree* Input = CreateTMVAInputTree(FreshFuel,-1);  double Keff = ExecuteTMVA( Input, false ); delete Input; return Keff;} //!<time independant since the MLP is trained for 1 time
-
+	
+	double 	GetKeffAtFixedTime(IsotopicVector FreshFuel){return ExecuteTMVA( CreateTMVAInputTree(FreshFuel,-1), false );} //!<time independant since the MLP is trained for 1 time
+	
 	TGraph* BuildKeffGraph(IsotopicVector FreshFuel);
 	TGraph* BuildAverageKeffGraph(TGraph* GRAPH_KEFF);
 	
 	double 	GetKeffAt(TGraph* GRAPH_KEFF, int Step);
 	
-	//@}
 	
 	
 	
-- 
GitLab