Skip to content
Snippets Groups Projects
Commit 515e4b80 authored by BaM's avatar BaM
Browse files

ongoing work (bis)

git-svn-id: svn+ssh://svn.in2p3.fr/class@674 0e7d625b-0364-4367-a6be-d5be4a48d228
parent 79e80b65
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "XSModel.hxx" #include "XSModel.hxx"
#include "XSM_MLP.hxx" #include "XSM_MLP.hxx"
#include "CLASSLogger.hxx" #include "CLASSLogger.hxx"
#include "CLASSMethod.hxx"
#include "StringLine.hxx" #include "StringLine.hxx"
#include "TMVA/Reader.h" #include "TMVA/Reader.h"
...@@ -34,51 +35,74 @@ ...@@ -34,51 +35,74 @@
//________________________________________________________________________ //________________________________________________________________________
XSM_MLP::XSM_MLP(string TMVA_Weight_Directory,string InformationFile, bool IsTimeStep):XSModel(new CLASSLogger("XSM_MLP.log")) XSM_MLP::XSM_MLP(string TMVA_Weight_Directory,string InformationFile, bool IsTimeStep):XSModel(new CLASSLogger("XSM_MLP.log"))
{ {
fIsStepTime=IsTimeStep; fIsStepTime=IsTimeStep;
fTMVAWeightFolder = TMVA_Weight_Directory; fTMVAWeightFolder = TMVA_Weight_Directory;
if(InformationFile=="") if(InformationFile=="")
fMLPInformationFile = TMVA_Weight_Directory+"/Data_Base_Info.nfo"; fInformationFile = TMVA_Weight_Directory+"/Data_Base_Info.nfo";
else else
fMLPInformationFile=fTMVAWeightFolder+InformationFile; fInformationFile = fTMVAWeightFolder+InformationFile;
GetMLPWeightFiles(); GetMLPWeightFiles();
GetDataBaseInformation();
INFO << "__A cross section interpolator using" << endl;
INFO<<"__A cross section interpolator using" <<endl; INFO << "Multi Layer Perceptron has been define__" << endl;
INFO<<"Multi Layer Perceptron has been define__"<<endl;
INFO << " \t His TMVA folder is : \" " << fTMVAWeightFolder << "\"" << 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) XSM_MLP::XSM_MLP(CLASSLogger* Log,string TMVA_Weight_Directory,string InformationFile, bool IsTimeStep):XSModel(Log)
{ {
fIsStepTime=IsTimeStep; fIsStepTime = IsTimeStep;
fTMVAWeightFolder = TMVA_Weight_Directory; fTMVAWeightFolder = TMVA_Weight_Directory;
if(InformationFile=="") if( InformationFile == "" )
fMLPInformationFile = TMVA_Weight_Directory+"/Data_Base_Info.nfo"; fInformationFile = TMVA_Weight_Directory + "/Data_Base_Info.nfo";
else else
fMLPInformationFile=fTMVAWeightFolder+InformationFile; fInformationFile = fTMVAWeightFolder+InformationFile;
GetMLPWeightFiles(); GetMLPWeightFiles();
GetDataBaseInformation();
INFO << "__A cross section interpolator using" << endl;
INFO<<"__A cross section interpolator using" <<endl; INFO << "Multi Layer Perceptron has been define__" << endl;
INFO<<"Multi Layer Perceptron has been define__"<<endl;
INFO << " \t His TMVA folder is : \" " << fTMVAWeightFolder << "\"" << endl; INFO << " \t His TMVA folder is : \" " << fTMVAWeightFolder << "\"" << endl;
LoadKeyword();
ReadNFO();
} }
//________________________________________________________________________ //________________________________________________________________________
XSM_MLP::~XSM_MLP() XSM_MLP::~XSM_MLP()
{ {
fMapOfTMVAVariableNames.clear(); fMapOfTMVAVariableNames.clear();
} }
//________________________________________________________________________ //________________________________________________________________________
void XSM_MLP::GetDataBaseInformation() void XSM_MLP::ReadLine(string line)
{ {
ifstream FILE(fMLPInformationFile.c_str()); 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());
if(FILE.good()) if(FILE.good())
{ {
while(!FILE.eof()) while(!FILE.eof())
...@@ -92,13 +116,13 @@ void XSM_MLP::GetDataBaseInformation() ...@@ -92,13 +116,13 @@ void XSM_MLP::GetDataBaseInformation()
size_t foundTime = line.find("Time (s) :"); size_t foundTime = line.find("Time (s) :");
size_t foundZAI = line.find("Z A I Name (input MLP) :"); size_t foundZAI = line.find("Z A I Name (input MLP) :");
size_t foundDomain = line.find("Fuel range (Z A I min max) :"); size_t foundDomain = line.find("Fuel range (Z A I min max) :");
int pos=0; int pos=0;
if(foundRType != std::string::npos) if(foundRType != std::string::npos)
{ StringLine::NextWord(line,pos,':'); { StringLine::NextWord(line,pos,':');
fDBRType = atof( (StringLine::NextWord(line,pos,':')).c_str() ); fDBRType = atof( (StringLine::NextWord(line,pos,':')).c_str() );
} }
pos=0; pos=0;
if(foundFType != std::string::npos) if(foundFType != std::string::npos)
{ StringLine::NextWord(line,pos,':'); { StringLine::NextWord(line,pos,':');
fDBFType = atof( (StringLine::NextWord(line,pos,':')).c_str() ); fDBFType = atof( (StringLine::NextWord(line,pos,':')).c_str() );
...@@ -113,14 +137,14 @@ void XSM_MLP::GetDataBaseInformation() ...@@ -113,14 +137,14 @@ void XSM_MLP::GetDataBaseInformation()
{ StringLine::NextWord(line,pos,':'); { StringLine::NextWord(line,pos,':');
fDBPower = atof( (StringLine::NextWord(line,pos,':') ).c_str() ); fDBPower = atof( (StringLine::NextWord(line,pos,':') ).c_str() );
} }
pos=0; pos=0;
if(foundTime!=std::string::npos) if(foundTime!=std::string::npos)
{ {
StringLine::NextWord(line,pos,':'); StringLine::NextWord(line,pos,':');
while( pos< (int)line.size() ) while( pos< (int)line.size() )
fMLP_Time.push_back( atof( (StringLine::NextWord(line,pos,' ')).c_str() )); fMLP_Time.push_back( atof( (StringLine::NextWord(line,pos,' ')).c_str() ));
} }
pos=0; pos=0;
if(foundZAI != std::string::npos) if(foundZAI != std::string::npos)
{ string Z; { string Z;
string A; string A;
...@@ -134,14 +158,14 @@ void XSM_MLP::GetDataBaseInformation() ...@@ -134,14 +158,14 @@ void XSM_MLP::GetDataBaseInformation()
ssline<<line; ssline<<line;
ssline>>Z>>A>>I>>Name; ssline>>Z>>A>>I>>Name;
if(StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I) ) if(StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I) )
{ {
fMapOfTMVAVariableNames.insert( pair<ZAI,string>(ZAI(atoi(Z.c_str()),atoi(A.c_str()),atoi(I.c_str())),Name) ); fMapOfTMVAVariableNames.insert( pair<ZAI,string>(ZAI(atoi(Z.c_str()),atoi(A.c_str()),atoi(I.c_str())),Name) );
} }
}while((StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I)) && !FILE.eof()); }while((StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I)) && !FILE.eof());
FILE.seekg(posoflinebeforbadline); //return one line before FILE.seekg(posoflinebeforbadline); //return one line before
} }
if(foundDomain != std::string::npos) if(foundDomain != std::string::npos)
{ string Z; { string Z;
...@@ -157,24 +181,24 @@ void XSM_MLP::GetDataBaseInformation() ...@@ -157,24 +181,24 @@ void XSM_MLP::GetDataBaseInformation()
ssline<<line; ssline<<line;
ssline>>Z>>A>>I>>min>>max; ssline>>Z>>A>>I>>min>>max;
if(StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I) && StringLine::IsDouble(min) && StringLine::IsDouble(max) ) if(StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I) && StringLine::IsDouble(min) && StringLine::IsDouble(max) )
{ {
fZAILimits.insert( pair<ZAI,pair<double,double> >(ZAI(atoi(Z.c_str()),atoi(A.c_str()),atoi(I.c_str())),make_pair(atof(min.c_str()),atof(max.c_str()))) ); fZAILimits.insert( pair<ZAI,pair<double,double> >(ZAI(atoi(Z.c_str()),atoi(A.c_str()),atoi(I.c_str())),make_pair(atof(min.c_str()),atof(max.c_str()))) );
} }
} }
while((StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I) )&& !FILE.eof()); while((StringLine::IsDouble(Z) && StringLine::IsDouble(A) && StringLine::IsDouble(I) )&& !FILE.eof());
FILE.seekg(posoflinebeforbadline); //return one line before FILE.seekg(posoflinebeforbadline); //return one line before
} }
} }
} }
else else
{ {
ERROR << "Can't find/open file " << fMLPInformationFile << endl; ERROR << "Can't find/open file " << fInformationFile << endl;
exit(0); exit(0);
} }
/********DEBUG*************************************/ /********DEBUG*************************************/
INFO<<"\tMLP XS Data Base Information : "<<endl; INFO<<"\tMLP XS Data Base Information : "<<endl;
INFO<<"\t\tHeavy Metal (t) :"<<fDBHMMass<<endl; INFO<<"\t\tHeavy Metal (t) :"<<fDBHMMass<<endl;
...@@ -183,21 +207,22 @@ void XSM_MLP::GetDataBaseInformation() ...@@ -183,21 +207,22 @@ void XSM_MLP::GetDataBaseInformation()
for (int i = 0; i < (int)fMLP_Time.size(); ++i) for (int i = 0; i < (int)fMLP_Time.size(); ++i)
INFO<<"\t\t\t"<<fMLP_Time[i]<<endl; INFO<<"\t\t\t"<<fMLP_Time[i]<<endl;
INFO<<"\t\tZ A I Name (input MLP) :"<<endl; INFO<<"\t\tZ A I Name (input MLP) :"<<endl;
map<ZAI ,string >::iterator it; map<ZAI ,string >::iterator it;
for (it= fMapOfTMVAVariableNames.begin();it!=fMapOfTMVAVariableNames.end();it++) for (it= fMapOfTMVAVariableNames.begin();it!=fMapOfTMVAVariableNames.end();it++)
INFO<<"\t\t\t"<< it->first.Z()<<" "<<it->first.A()<<" "<<it->second<<endl; INFO<<"\t\t\t"<< it->first.Z()<<" "<<it->first.A()<<" "<<it->second<<endl;
INFO<<"\t\tFuel range"<<endl; INFO<<"\t\tFuel range"<<endl;
for (map<ZAI,pair<double,double> >::iterator it_dom = fZAILimits.begin();it_dom!=fZAILimits.end();it_dom++) for (map<ZAI,pair<double,double> >::iterator it_dom = fZAILimits.begin();it_dom!=fZAILimits.end();it_dom++)
INFO<<"\t\t\t"<< it_dom->second.first<<" <= "<<it_dom->first.Z()<<" "<<it_dom->first.A()<<" "<<it_dom->first.I()<<" <= "<<it_dom->second.second<<endl;; INFO<<"\t\t\t"<< it_dom->second.first<<" <= "<<it_dom->first.Z()<<" "<<it_dom->first.A()<<" "<<it_dom->first.I()<<" <= "<<it_dom->second.second<<endl;;
} }
//________________________________________________________________________ //________________________________________________________________________
void XSM_MLP::GetMLPWeightFiles() void XSM_MLP::GetMLPWeightFiles()
{DBGL {
DBGL
/**********Get All TMVA weight files*******************/ /**********Get All TMVA weight files*******************/
//check if the folder containing weights exists //check if the folder containing weights exists
DIR* rep = NULL; DIR* rep = NULL;
...@@ -205,10 +230,10 @@ void XSM_MLP::GetMLPWeightFiles() ...@@ -205,10 +230,10 @@ void XSM_MLP::GetMLPWeightFiles()
rep = opendir(fTMVAWeightFolder.c_str()); rep = opendir(fTMVAWeightFolder.c_str());
if (rep == NULL) if (rep == NULL)
{ {
ERROR<<" Reading error for TMVA weight folder "<<fTMVAWeightFolder.c_str()<<" : "<<strerror(errno)<<endl; ERROR<<" Reading error for TMVA weight folder "<<fTMVAWeightFolder.c_str()<<" : "<<strerror(errno)<<endl;
exit(1); exit(1);
} }
/**Save file names of TMVA weights*/ /**Save file names of TMVA weights*/
fWeightFiles.resize(0); fWeightFiles.resize(0);
while ((fichierLu = readdir(rep)) != NULL) while ((fichierLu = readdir(rep)) != NULL)
...@@ -218,7 +243,7 @@ void XSM_MLP::GetMLPWeightFiles() ...@@ -218,7 +243,7 @@ void XSM_MLP::GetMLPWeightFiles()
{ {
if(FileName[FileName.size()-3]=='x' && FileName[FileName.size()-2]=='m' && FileName[FileName.size()-1]=='l' && FileName[0]!='.' ) if(FileName[FileName.size()-3]=='x' && FileName[FileName.size()-2]=='m' && FileName[FileName.size()-1]=='l' && FileName[0]!='.' )
fWeightFiles.push_back(FileName); fWeightFiles.push_back(FileName);
} }
} }
DBGL DBGL
...@@ -235,71 +260,71 @@ void XSM_MLP::ReadWeightFile(string Filename, int &Z, int &A, int &I, int &React ...@@ -235,71 +260,71 @@ void XSM_MLP::ReadWeightFile(string Filename, int &Z, int &A, int &I, int &React
A=-1; A=-1;
I=-1; I=-1;
Reaction=-1; Reaction=-1;
size_t found = Filename.find("XS"); size_t found = Filename.find("XS");
string NameJOB; string NameJOB;
NameJOB=Filename.substr(found); NameJOB=Filename.substr(found);
int pos=0; int pos=0;
StringLine::NextWord(NameJOB, pos, '_'); StringLine::NextWord(NameJOB, pos, '_');
Z = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); Z = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() );
A = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); A = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() );
I = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); I = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() );
string sReaction = (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ; string sReaction = (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ;
size_t foundext = sReaction.find(".weights.xml"); size_t foundext = sReaction.find(".weights.xml");
sReaction = sReaction.substr(0,foundext); sReaction = sReaction.substr(0,foundext);
if(sReaction=="fis") if(sReaction=="fis")
Reaction=0; Reaction=0;
if(sReaction=="cap") if(sReaction=="cap")
Reaction=1; Reaction=1;
if(sReaction=="n2n") if(sReaction=="n2n")
Reaction=2; Reaction=2;
if(Z<=0 || A<=0 || I<0 || Reaction==-1) if(Z<=0 || A<=0 || I<0 || Reaction==-1)
{ {
ERROR << " wrong TMVA weight format " << endl; ERROR << " wrong TMVA weight format " << endl;
exit(0); exit(0);
} }
} }
//________________________________________________________________________ //________________________________________________________________________
TTree* XSM_MLP::CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep) TTree* XSM_MLP::CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep)
{ {
/******Create Input data tree to be interpreted by TMVA::Reader***/ /******Create Input data tree to be interpreted by TMVA::Reader***/
TTree* InputTree = new TTree("InTMP", "InTMP"); TTree* InputTree = new TTree("InTMP", "InTMP");
vector<float> InputTMVA; vector<float> InputTMVA;
for(int i = 0 ; i< (int)fMapOfTMVAVariableNames.size() ; i++) for(int i = 0 ; i< (int)fMapOfTMVAVariableNames.size() ; i++)
InputTMVA.push_back(0); InputTMVA.push_back(0);
float Time=0; float Time=0;
IsotopicVector IVInputTMVA; IsotopicVector IVInputTMVA;
map<ZAI ,string >::iterator it; map<ZAI ,string >::iterator it;
int j=0; int j=0;
for( it = fMapOfTMVAVariableNames.begin() ; it!=fMapOfTMVAVariableNames.end() ; it++) 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; IVInputTMVA+= ((*it).first)*1;
j++; j++;
} }
if( !fIsStepTime) if( !fIsStepTime)
InputTree->Branch( "Time" ,&Time ,"Time/F" ); InputTree->Branch( "Time" ,&Time ,"Time/F" );
IsotopicVector IVAccordingToUserInfoFile = isotopicvector.GetThisComposition(IVInputTMVA); IsotopicVector IVAccordingToUserInfoFile = isotopicvector.GetThisComposition(IVInputTMVA);
double Ntot = IVAccordingToUserInfoFile.GetSumOfAll(); double Ntot = IVAccordingToUserInfoFile.GetSumOfAll();
IVAccordingToUserInfoFile = IVAccordingToUserInfoFile/Ntot; IVAccordingToUserInfoFile = IVAccordingToUserInfoFile/Ntot;
j=0; j=0;
map<ZAI ,string >::iterator it2; map<ZAI ,string >::iterator it2;
DBGV("INPUT TMVA"); DBGV("INPUT TMVA");
...@@ -309,11 +334,11 @@ TTree* XSM_MLP::CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep) ...@@ -309,11 +334,11 @@ TTree* XSM_MLP::CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep)
DBGV((*it2).first.Z()<<" "<<(*it2).first.A()<<" "<<InputTMVA[j]); DBGV((*it2).first.Z()<<" "<<(*it2).first.A()<<" "<<InputTMVA[j]);
j++; j++;
} }
Time=fMLP_Time[TimeStep]; Time=fMLP_Time[TimeStep];
InputTree->Fill(); InputTree->Fill();
return InputTree; return InputTree;
} }
//________________________________________________________________________ //________________________________________________________________________
...@@ -322,14 +347,14 @@ double XSM_MLP::ExecuteTMVA(string WeightFile,TTree* InputTree) ...@@ -322,14 +347,14 @@ double XSM_MLP::ExecuteTMVA(string WeightFile,TTree* InputTree)
DBGV( "File :" << WeightFile); DBGV( "File :" << WeightFile);
// --- Create the Reader object // --- Create the Reader object
TMVA::Reader *reader = new TMVA::Reader( "Silent" ); TMVA::Reader *reader = new TMVA::Reader( "Silent" );
// Create a set of variables and declare them to the reader // Create a set of variables and declare them to the reader
// - the variable names MUST corresponds in name and type to those given in the weight file(s) used // - the variable names MUST corresponds in name and type to those given in the weight file(s) used
vector<float> InputTMVA; vector<float> InputTMVA;
for(int i = 0 ; i< (int)fMapOfTMVAVariableNames.size() ; i++) for(int i = 0 ; i< (int)fMapOfTMVAVariableNames.size() ; i++)
InputTMVA.push_back(0); InputTMVA.push_back(0);
Float_t Time; Float_t Time;
map<ZAI ,string >::iterator it; map<ZAI ,string >::iterator it;
int j=0; int j=0;
for( it = fMapOfTMVAVariableNames.begin() ; it!=fMapOfTMVAVariableNames.end() ; it++) for( it = fMapOfTMVAVariableNames.begin() ; it!=fMapOfTMVAVariableNames.end() ; it++)
...@@ -338,18 +363,18 @@ double XSM_MLP::ExecuteTMVA(string WeightFile,TTree* InputTree) ...@@ -338,18 +363,18 @@ double XSM_MLP::ExecuteTMVA(string WeightFile,TTree* InputTree)
} }
if(!fIsStepTime) if(!fIsStepTime)
reader->AddVariable( "Time" ,&Time); reader->AddVariable( "Time" ,&Time);
// --- Book the MVA methods // --- Book the MVA methods
string dir = fTMVAWeightFolder; string dir = fTMVAWeightFolder;
if(dir[dir.size()-1]!='/') if(dir[dir.size()-1]!='/')
dir+="/"; dir+="/";
// Book method MLP // Book method MLP
TString methodName = "MLP method"; TString methodName = "MLP method";
TString weightpath = dir + WeightFile ; TString weightpath = dir + WeightFile ;
reader->BookMVA( methodName, weightpath ); reader->BookMVA( methodName, weightpath );
map<ZAI ,string >::iterator it2; map<ZAI ,string >::iterator it2;
j=0; j=0;
for( it2 = fMapOfTMVAVariableNames.begin() ; it2!=fMapOfTMVAVariableNames.end() ; it2++) for( it2 = fMapOfTMVAVariableNames.begin() ; it2!=fMapOfTMVAVariableNames.end() ; it2++)
...@@ -357,24 +382,25 @@ double XSM_MLP::ExecuteTMVA(string WeightFile,TTree* InputTree) ...@@ -357,24 +382,25 @@ double XSM_MLP::ExecuteTMVA(string WeightFile,TTree* InputTree)
InputTree->SetBranchAddress(( (*it2).second ).c_str(),&InputTMVA[j]); InputTree->SetBranchAddress(( (*it2).second ).c_str(),&InputTMVA[j]);
j++; j++;
} }
if(!fIsStepTime) if(!fIsStepTime)
InputTree->SetBranchAddress( "Time" ,&Time ); InputTree->SetBranchAddress( "Time" ,&Time );
InputTree->GetEntry(0); InputTree->GetEntry(0);
Float_t val = (reader->EvaluateRegression( methodName ))[0]; Float_t val = (reader->EvaluateRegression( methodName ))[0];
delete reader; delete reader;
DBGL DBGL
return (double)val; return (double)val;
} }
//________________________________________________________________________ //________________________________________________________________________
EvolutionData XSM_MLP::GetCrossSectionsTime(IsotopicVector IV) EvolutionData XSM_MLP::GetCrossSectionsTime(IsotopicVector IV)
{DBGL {
DBGL
EvolutionData EvolutionDataFromMLP = EvolutionData(); EvolutionData EvolutionDataFromMLP = EvolutionData();
map<ZAI,TGraph*> ExtrapolatedXS[3]; map<ZAI,TGraph*> ExtrapolatedXS[3];
/*************DATA BASE INFO****************/ /*************DATA BASE INFO****************/
EvolutionDataFromMLP.SetReactorType(fDBRType); EvolutionDataFromMLP.SetReactorType(fDBRType);
...@@ -390,44 +416,44 @@ EvolutionData XSM_MLP::GetCrossSectionsTime(IsotopicVector IV) ...@@ -390,44 +416,44 @@ EvolutionData XSM_MLP::GetCrossSectionsTime(IsotopicVector IV)
int Reaction=-2; int Reaction=-2;
ReadWeightFile( fWeightFiles[i], Z, A, I, Reaction); ReadWeightFile( fWeightFiles[i], Z, A, I, Reaction);
if( Z >= GetZAIThreshold() ) if( Z >= GetZAIThreshold() )
{ {
for(int TimeStep=0;TimeStep<int(fMLP_Time.size());TimeStep++) for(int TimeStep=0;TimeStep<int(fMLP_Time.size());TimeStep++)
{ {
TTree* InputTree = CreateTMVAInputTree(IV,TimeStep); TTree* InputTree = CreateTMVAInputTree(IV,TimeStep);
pair< map<ZAI, TGraph*>::iterator, bool> IResult; pair< map<ZAI, TGraph*>::iterator, bool> IResult;
IResult = ExtrapolatedXS[Reaction].insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph() ) ); IResult = ExtrapolatedXS[Reaction].insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph() ) );
double XSValue = ExecuteTMVA(fWeightFiles[i],InputTree ); double XSValue = ExecuteTMVA(fWeightFiles[i],InputTree );
if(IResult.second ) if(IResult.second )
{ {
(IResult.first)->second->SetPoint(0, (double)fMLP_Time[TimeStep], XSValue ); (IResult.first)->second->SetPoint(0, (double)fMLP_Time[TimeStep], XSValue );
} }
else else
{ {
(IResult.first)->second->SetPoint( (IResult.first)->second->GetN(), (double)fMLP_Time[TimeStep], XSValue ); (IResult.first)->second->SetPoint( (IResult.first)->second->GetN(), (double)fMLP_Time[TimeStep], XSValue );
} }
delete InputTree; delete InputTree;
} }
} }
} }
/**********Sorting TGraph*********/ /**********Sorting TGraph*********/
for(int x=0;x<3;x++) for(int x=0;x<3;x++)
{ map<ZAI,TGraph*>::iterator it; { map<ZAI,TGraph*>::iterator it;
for(it = ExtrapolatedXS[x].begin(); it != ExtrapolatedXS[x].end(); it++) for(it = ExtrapolatedXS[x].begin(); it != ExtrapolatedXS[x].end(); it++)
it->second->Sort(); it->second->Sort();
} }
/**********Filling Matrices*/ /**********Filling Matrices*/
EvolutionDataFromMLP.SetFissionXS(ExtrapolatedXS[0]); EvolutionDataFromMLP.SetFissionXS(ExtrapolatedXS[0]);
EvolutionDataFromMLP.SetCaptureXS(ExtrapolatedXS[1]); EvolutionDataFromMLP.SetCaptureXS(ExtrapolatedXS[1]);
EvolutionDataFromMLP.Setn2nXS(ExtrapolatedXS[2]); EvolutionDataFromMLP.Setn2nXS(ExtrapolatedXS[2]);
DBGL DBGL
return EvolutionDataFromMLP; return EvolutionDataFromMLP;
} }
...@@ -443,29 +469,29 @@ void XSM_MLP::ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &R ...@@ -443,29 +469,29 @@ void XSM_MLP::ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &R
A=-1; A=-1;
I=-1; I=-1;
Reaction=-1; Reaction=-1;
size_t found = Filename.find("XS"); size_t found = Filename.find("XS");
string NameJOB; string NameJOB;
NameJOB=Filename.substr(found); NameJOB=Filename.substr(found);
int pos=0; int pos=0;
StringLine::NextWord(NameJOB, pos, '_'); StringLine::NextWord(NameJOB, pos, '_');
Z = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); Z = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() );
A = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); A = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() );
I = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); I = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() );
string sReaction = (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ; string sReaction = (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ;
if(sReaction=="fis") if(sReaction=="fis")
Reaction=0; Reaction=0;
if(sReaction=="cap") if(sReaction=="cap")
Reaction=1; Reaction=1;
if(sReaction=="n2n") if(sReaction=="n2n")
Reaction=2; Reaction=2;
TimeStep = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() ); TimeStep = atof( (StringLine::NextWord(NameJOB,pos,'_') ).c_str() );
if(Z==-1 || A==-1 || I==-1 || Reaction==-1 || TimeStep==-1) if(Z==-1 || A==-1 || I==-1 || Reaction==-1 || TimeStep==-1)
{ {
ERROR << " wrong TMVA weight format " << endl; ERROR << " wrong TMVA weight format " << endl;
...@@ -475,20 +501,21 @@ void XSM_MLP::ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &R ...@@ -475,20 +501,21 @@ void XSM_MLP::ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &R
//________________________________________________________________________ //________________________________________________________________________
EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV) EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV)
{DBGL {
DBGL
TTree* InputTree=CreateTMVAInputTree(IV); TTree* InputTree=CreateTMVAInputTree(IV);
EvolutionData EvolutionDataFromMLP = EvolutionData(); EvolutionData EvolutionDataFromMLP = EvolutionData();
map<ZAI,TGraph*> ExtrapolatedXS[3]; map<ZAI,TGraph*> ExtrapolatedXS[3];
/*************DATA BASE INFO****************/ /*************DATA BASE INFO****************/
EvolutionDataFromMLP.SetReactorType("PWR"); EvolutionDataFromMLP.SetReactorType("PWR");
EvolutionDataFromMLP.SetFuelType("MOX"); EvolutionDataFromMLP.SetFuelType("MOX");
EvolutionDataFromMLP.SetPower(fDBPower); EvolutionDataFromMLP.SetPower(fDBPower);
EvolutionDataFromMLP.SetHeavyMetalMass(fDBHMMass); EvolutionDataFromMLP.SetHeavyMetalMass(fDBHMMass);
/************* The Cross sections***********/ /************* The Cross sections***********/
for(int i=0;i<int(fWeightFiles.size());i++) for(int i=0;i<int(fWeightFiles.size());i++)
{ {
int Z=-2; int Z=-2;
...@@ -498,13 +525,13 @@ EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV) ...@@ -498,13 +525,13 @@ EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV)
int TimeStep=-2; int TimeStep=-2;
ReadWeightFileStep( fWeightFiles[i], Z, A, I, Reaction, TimeStep); ReadWeightFileStep( fWeightFiles[i], Z, A, I, Reaction, TimeStep);
if( Z >= GetZAIThreshold() ) if( Z >= GetZAIThreshold() )
{ {
ZAI zaitmp = ZAI(Z,A,I); ZAI zaitmp = ZAI(Z,A,I);
pair< map<ZAI, TGraph*>::iterator, bool> IResult; pair< map<ZAI, TGraph*>::iterator, bool> IResult;
IResult = ExtrapolatedXS[Reaction].insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph() ) ); IResult = ExtrapolatedXS[Reaction].insert(pair<ZAI ,TGraph* >(ZAI(Z,A,I), new TGraph() ) );
if( IResult.second ) if( IResult.second )
{ {
(IResult.first)->second->SetPoint(0, (double)fMLP_Time[TimeStep], ExecuteTMVA(fWeightFiles[i],InputTree) ); (IResult.first)->second->SetPoint(0, (double)fMLP_Time[TimeStep], ExecuteTMVA(fWeightFiles[i],InputTree) );
...@@ -515,7 +542,7 @@ EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV) ...@@ -515,7 +542,7 @@ EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV)
} }
} }
} }
/**********Sorting TGraph*********/ /**********Sorting TGraph*********/
for(int x=0;x<3;x++) for(int x=0;x<3;x++)
{ map<ZAI,TGraph*>::iterator it; { map<ZAI,TGraph*>::iterator it;
...@@ -526,21 +553,22 @@ EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV) ...@@ -526,21 +553,22 @@ EvolutionData XSM_MLP::GetCrossSectionsStep(IsotopicVector IV)
EvolutionDataFromMLP.SetFissionXS(ExtrapolatedXS[0]); EvolutionDataFromMLP.SetFissionXS(ExtrapolatedXS[0]);
EvolutionDataFromMLP.SetCaptureXS(ExtrapolatedXS[1]); EvolutionDataFromMLP.SetCaptureXS(ExtrapolatedXS[1]);
EvolutionDataFromMLP.Setn2nXS(ExtrapolatedXS[2]); EvolutionDataFromMLP.Setn2nXS(ExtrapolatedXS[2]);
delete InputTree; delete InputTree;
DBGL DBGL
return EvolutionDataFromMLP; return EvolutionDataFromMLP;
} }
//________________________________________________________________________ //________________________________________________________________________
EvolutionData XSM_MLP::GetCrossSections(IsotopicVector IV ,double t) EvolutionData XSM_MLP::GetCrossSections(IsotopicVector IV ,double t)
{DBGL {
DBGL
if(t!=0) if(t!=0)
WARNING << " Argument t has non effect here " << endl; WARNING << " Argument t has non effect here " << endl;
EvolutionData EV; EvolutionData EV;
if(fIsStepTime) if(fIsStepTime)
EV=GetCrossSectionsStep(IV); EV=GetCrossSectionsStep(IV);
else else
EV=GetCrossSectionsTime(IV); EV=GetCrossSectionsTime(IV);
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
/*! /*!
\file \file
\brief Header file for XSM_MLP class. \brief Header file for XSM_MLP class.
@authors BLG @authors BLG
@version 1.0 @version 1.0
*/ */
...@@ -21,14 +21,19 @@ ...@@ -21,14 +21,19 @@
typedef long long int cSecond; typedef long long int cSecond;
using namespace std; 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 //! Defines a XSModel getting mean cross sections from neural network execution
/*! /*!
Define a XSM_MLP. Define a XSM_MLP.
This is the class to predict cross sections with a This is the class to predict cross sections with a
set of Multi Layer Perceptrons (MLP) set of Multi Layer Perceptrons (MLP)
@authors BLG @authors BLG
@version 1.0 @version 1.0
*/ */
...@@ -38,19 +43,19 @@ using namespace std; ...@@ -38,19 +43,19 @@ using namespace std;
class XSM_MLP : public XSModel class XSM_MLP : public XSModel
{ {
public : public :
/*! /*!
\name Constructor/Desctructor \name Constructor/Desctructor
*/ */
//@{ //@{
//{ //{
/// Normal Constructor /// Normal Constructor
/*! /*!
\param TMVA_Weight_Directory : The directory where all the TMVA weight are located \param TMVA_Weight_Directory : The directory where all the TMVA weight are located
\param InformationFile : Name of the information file located in TMVA_Weight_Directory (default : Data_Base_Info.nfo) \param InformationFile : Name of the information file located in TMVA_Weight_Directory (default : Data_Base_Info.nfo)
\param IsTimeStep : if true , one TMVA weihgt per step time is requiered otherwise it assumes time is part of the MLP inputs \param IsTimeStep : if true , one TMVA weihgt per step time is requiered otherwise it assumes time is part of the MLP inputs
*/ */
XSM_MLP(string TMVA_Weight_Directory,string InformationFile="",bool IsTimeStep=false); XSM_MLP(string TMVA_Weight_Directory,string InformationFile="",bool IsTimeStep=false);
//} //}
...@@ -69,40 +74,43 @@ class XSM_MLP : public XSModel ...@@ -69,40 +74,43 @@ class XSM_MLP : public XSModel
~XSM_MLP(); ~XSM_MLP();
//@} //@}
void LoadKeyword() {}
virtual EvolutionData GetCrossSections(IsotopicVector IV,double t=0); //!< Return calculated cross section by the MLP regression
EvolutionData GetCrossSections(IsotopicVector IV,double t=0); //!< Return calculated cross section by the MLP regression
void ReadLine(string line);
private : private :
void GetDataBaseInformation(); //!< Read information file and fill Reactor Type, Fuel type, HM mass, Power, time vector, and TMVA input variables names void GetDataBaseInformation(); //!< Read information file and fill Reactor Type, Fuel type, HM mass, Power, time vector, and TMVA input variables names
void GetMLPWeightFiles(); //!< Find all .xml file in TMVA_Weight_Directory void GetMLPWeightFiles(); //!< Find all .xml file in TMVA_Weight_Directory
EvolutionData GetCrossSectionsStep(IsotopicVector IV); //!< Return calculated cross section by the MLP regression when fIsTimeStep==true EvolutionData GetCrossSectionsStep(IsotopicVector IV); //!< Return calculated cross section by the MLP regression when fIsTimeStep==true
EvolutionData GetCrossSectionsTime(IsotopicVector IV); //!< Return calculated cross section by the MLP regression when fIsTimeStep==false EvolutionData GetCrossSectionsTime(IsotopicVector IV); //!< Return calculated cross section by the MLP regression when fIsTimeStep==false
void ReadWeightFile(string Filename, int &Z, int &A, int &I, int &Reaction) ; //!< Select the reaction according to the weight file name void ReadWeightFile(string Filename, int &Z, int &A, int &I, int &Reaction) ; //!< Select the reaction according to the weight file name
void ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &Reaction, int &TimeStep);; //!< Select the reaction according to the weight file name void ReadWeightFileStep(string Filename, int &Z, int &A, int &I, int &Reaction, int &TimeStep);; //!< Select the reaction according to the weight file name
double ExecuteTMVA(string WeightFile, TTree* InputTree); //!<Execute the MLP according to the input tree created double ExecuteTMVA(string WeightFile, TTree* InputTree); //!<Execute the MLP according to the input tree created
TTree* CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep=0); //!<Create input tmva tree to be read by ExecuteTMVA TTree* CreateTMVAInputTree(IsotopicVector isotopicvector,int TimeStep=0); //!<Create input tmva tree to be read by ExecuteTMVA
vector<double> fMLP_Time; //!< Time vector of the data base vector<double> fMLP_Time; //!< Time vector of the data base
vector<string> fWeightFiles; //!< All the weight file contains in fTMVAWeightFolder vector<string> fWeightFiles; //!< All the weight file contains in fTMVAWeightFolder
string fTMVAWeightFolder; //!< folder containing all the weight file 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 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
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 #endif
......
...@@ -30,14 +30,14 @@ typedef void (XSModel::*MthPtr)( const string & ) ; ...@@ -30,14 +30,14 @@ typedef void (XSModel::*MthPtr)( const string & ) ;
//! Defines a mean cross section predictor //! Defines a mean cross section predictor
/*! /*!
This is the mother class for methods related to XS prediction This is the mother class for methods related to XS prediction
\warning \warning
Never instantiate XSModel in your CLASS input but it's derivated class Never instantiate XSModel in your CLASS input but it's derivated class
@see XSM_CLOSEST @see XSM_CLOSEST
@see XSM_MLP @see XSM_MLP
@author BaM @author BaM
@author BLG @author BLG
@version 1.0 @version 1.0
...@@ -47,19 +47,19 @@ This is the mother class for methods related to XS prediction ...@@ -47,19 +47,19 @@ This is the mother class for methods related to XS prediction
class XSModel : public CLASSObject class XSModel : public CLASSObject
{ {
public : public :
/*! /*!
\name Constructor/Desctructor \name Constructor/Desctructor
*/ */
//@{ //@{
XSModel(); //!<Default constructor XSModel(); //!<Default constructor
XSModel(CLASSLogger* log); //!<Logger constructor XSModel(CLASSLogger* log); //!<Logger constructor
//@} //@}
...@@ -90,23 +90,29 @@ class XSModel : public CLASSObject ...@@ -90,23 +90,29 @@ class XSModel : public CLASSObject
virtual bool isIVInDomain(IsotopicVector IV) ; virtual bool isIVInDomain(IsotopicVector IV) ;
//@} //@}
void ReadNFO();
virtual void ReadLine(string line);
void ReadZAIlimits(const string &line); void ReadZAIlimits(const string &line);
void ReadType(const string &line); void ReadType(const string &line);
void ReadRParam(const string &line); void ReadRParam(const string &line);
void LoadKeyword(); virtual void LoadKeyword();
void SetZAIThreshold(int Z_Threshold){fZAIThreshold = Z_Threshold;}//!< Set the Z threshold : ZAI with Z < fZAIThreshold are not manage by CLASS 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 int GetZAIThreshold(){return fZAIThreshold;}//!< Get the Z threshold
protected : 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 fDBPower; //!< Power of the data base (read from fMLPInformationFile )
double fDBHMMass; //!< Heavy metal mass of the data base (read from fMLPInformationFile ) double fDBHMMass; //!< Heavy metal mass of the data base (read from fMLPInformationFile )
string fDBFType; //!< Fuel Type (e.g MOX, UOX, ThU, ThPu ...) string fDBFType; //!< Fuel Type (e.g MOX, UOX, ThU, ThPu ...)
string fDBRType; //!< Reactor Type (e.g PWR, FBR-Na, ADS..) string fDBRType; //!< Reactor Type (e.g PWR, FBR-Na, ADS..)
map< ZAI, pair<double,double> > fZAILimits; //!< Fresh fuel range : map<ZAI<min edge ,max edge >> map< ZAI, pair<double,double> > fZAILimits; //!< Fresh fuel range : map<ZAI<min edge ,max edge >>
#ifndef __CINT__ #ifndef __CINT__
......
This diff is collapsed.
...@@ -17,23 +17,71 @@ using namespace std; ...@@ -17,23 +17,71 @@ using namespace std;
XSModel::XSModel():CLASSObject() XSModel::XSModel():CLASSObject()
{ {
LoadKeyword(); XSModel::LoadKeyword();
} }
XSModel::XSModel(CLASSLogger* log):CLASSObject(log) XSModel::XSModel(CLASSLogger* log):CLASSObject(log)
{ {
LoadKeyword();
} 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
}
void XSModel::LoadKeyword() void XSModel::LoadKeyword()
{ {
DBGL DBGL
fKeyword.insert( pair<string, MthPtr>( "k_zail", & XSModel::ReadZAIlimits)); fKeyword.insert( pair<string, MthPtr>( "k_zail", & XSModel::ReadZAIlimits));
fKeyword.insert( pair<string, MthPtr>( "k_reactor", & XSModel::ReadType) ); fKeyword.insert( pair<string, MthPtr>( "k_reactor", & XSModel::ReadType) );
fKeyword.insert( pair<string, MthPtr>( "k_fuel", & 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_mass", & XSModel::ReadRParam) );
fKeyword.insert( pair<string, MthPtr>( "k_power", & XSModel::ReadRParam) ); fKeyword.insert( pair<string, MthPtr>( "k_power", & XSModel::ReadRParam) );
DBGL DBGL
} }
...@@ -41,15 +89,15 @@ void XSModel::ReadRParam(const string &line) ...@@ -41,15 +89,15 @@ void XSModel::ReadRParam(const string &line)
{ {
DBGL DBGL
int start = 0; int start = 0;
string type = tlc(StringLine::NextWord(line, start, ' ')); string keyword = tlc(StringLine::NextWord(line, start, ' '));
if( type != "k_power" || type != "k_mass" ) // Check the keyword if( keyword != "k_power" || keyword != "k_mass" ) // Check the keyword
{ {
ERROR << " Bad keyword : " << type << " Not found !" << endl; ERROR << " Bad keyword : " << keyword << " Not found !" << endl;
exit(1); exit(1);
} }
if( type == "k_mass" ) if( keyword == "k_mass" )
fDBHMMass = atof(StringLine::NextWord(line, start, ' ').c_str()); fDBHMMass = atof(StringLine::NextWord(line, start, ' ').c_str());
else if( type == "k_mass" ) else if( keyword == "k_mass" )
fDBPower = atof(StringLine::NextWord(line, start, ' ').c_str()); fDBPower = atof(StringLine::NextWord(line, start, ' ').c_str());
DBGL DBGL
...@@ -60,17 +108,17 @@ void XSModel::ReadType(const string &line) ...@@ -60,17 +108,17 @@ void XSModel::ReadType(const string &line)
{ {
DBGL DBGL
int start = 0; int start = 0;
string type = tlc(StringLine::NextWord(line, start, ' ')); string keyword = tlc(StringLine::NextWord(line, start, ' '));
if( type != "k_fuel" || type != "k_reactor" ) // Check the keyword if( keyword != "k_fuel" || keyword != "k_reactor" ) // Check the keyword
{ {
ERROR << " Bad keyword : " << type << " Not found !" << endl; ERROR << " Bad keyword : " << keyword << " Not found !" << endl;
exit(1); exit(1);
} }
if( type == "k_fuel" ) if( keyword == "k_fuel" )
fDBFType = StringLine::NextWord(line, start, ' '); fDBFType = StringLine::NextWord(line, start, ' ');
else if( type == "k_reactor" ) else if( keyword == "k_reactor" )
fDBRType = StringLine::NextWord(line, start, ' '); fDBRType = StringLine::NextWord(line, start, ' ');
DBGL DBGL
} }
...@@ -79,7 +127,8 @@ void XSModel::ReadZAIlimits(const string &line) ...@@ -79,7 +127,8 @@ void XSModel::ReadZAIlimits(const string &line)
{ {
DBGL DBGL
int start = 0; int start = 0;
if( tlc(StringLine::NextWord(line, start, ' ')) != "k_zail" ) // Check the keyword string keyword = tlc(StringLine::NextWord(line, start, ' '));
if( keyword != "k_zail" ) // Check the keyword
{ {
ERROR << " Bad keyword : \"k_zail\" not found !" << endl; ERROR << " Bad keyword : \"k_zail\" not found !" << endl;
exit(1); exit(1);
...@@ -98,9 +147,9 @@ void XSModel::ReadZAIlimits(const string &line) ...@@ -98,9 +147,9 @@ void XSModel::ReadZAIlimits(const string &line)
bool XSModel::isIVInDomain(IsotopicVector IV) bool XSModel::isIVInDomain(IsotopicVector IV)
{ {
DBGL DBGL
bool IsInDomain=true; bool IsInDomain=true;
if(fZAILimits.empty()) if(fZAILimits.empty())
{ {
WARNING << "Fresh Fuel variation domain is not set" << endl; WARNING << "Fresh Fuel variation domain is not set" << endl;
...@@ -108,19 +157,19 @@ DBGL ...@@ -108,19 +157,19 @@ DBGL
WARNING << "Proceed finger crossed !!" << endl; WARNING << "Proceed finger crossed !!" << endl;
return true; return true;
} }
else else
{ {
IsotopicVector IVNorm = IV /IV.GetSumOfAll(); IsotopicVector IVNorm = IV /IV.GetSumOfAll();
for (map< ZAI,pair<double,double> >::iterator Domain_it=fZAILimits.begin(); Domain_it!=fZAILimits.end(); Domain_it++) for (map< ZAI,pair<double,double> >::iterator Domain_it=fZAILimits.begin(); Domain_it!=fZAILimits.end(); Domain_it++)
{ {
double ThatZAIProp = IVNorm.GetIsotopicQuantity()[Domain_it->first] ; double ThatZAIProp = IVNorm.GetIsotopicQuantity()[Domain_it->first] ;
double ThatZAIMin = Domain_it->second.first; double ThatZAIMin = Domain_it->second.first;
double ThatZAIMax = Domain_it->second.second; double ThatZAIMax = Domain_it->second.second;
if( (ThatZAIProp > ThatZAIMax) || (ThatZAIProp < ThatZAIMin) ) if( (ThatZAIProp > ThatZAIMax) || (ThatZAIProp < ThatZAIMin) )
{ {
IsInDomain = false; IsInDomain = false;
WARNING<<"Fresh fuel out of model range"<<endl; WARNING<<"Fresh fuel out of model range"<<endl;
WARNING<<"\t AT LEAST this ZAI is accused to be outrange :"<<endl; WARNING<<"\t AT LEAST this ZAI is accused to be outrange :"<<endl;
WARNING<<"\t\t"<<Domain_it->first.Z()<<" "<<Domain_it->first.A()<<" "<<Domain_it->first.I()<<endl; WARNING<<"\t\t"<<Domain_it->first.Z()<<" "<<Domain_it->first.A()<<" "<<Domain_it->first.I()<<endl;
...@@ -129,9 +178,9 @@ DBGL ...@@ -129,9 +178,9 @@ DBGL
WARNING<<IVNorm.sPrint()<<endl; WARNING<<IVNorm.sPrint()<<endl;
break; break;
} }
} }
} }
DBGL DBGL
return IsInDomain; return IsInDomain;
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment