added some additional BMW checks

This commit is contained in:
nemu 2009-04-02 19:22:21 +00:00
parent fcc18e2ae4
commit 2e4763b9b0
2 changed files with 29 additions and 12 deletions

View File

@ -159,27 +159,27 @@ int PMsrHandler::ReadMsrFile()
// check for a msr block // check for a msr block
if (line_no == 1) { // title if (line_no == 1) { // title
fTitle = line; fTitle = line;
} else if (line.Contains("FITPARAMETER")) { // FITPARAMETER block tag } else if (line.BeginsWith("FITPARAMETER")) { // FITPARAMETER block tag
fMsrBlockCounter = MSR_TAG_FITPARAMETER; fMsrBlockCounter = MSR_TAG_FITPARAMETER;
} else if (line.Contains("THEORY")) { // THEORY block tag } else if (line.BeginsWith("THEORY")) { // THEORY block tag
fMsrBlockCounter = MSR_TAG_THEORY; fMsrBlockCounter = MSR_TAG_THEORY;
theory.push_back(current); theory.push_back(current);
} else if (line.Contains("FUNCTIONS")) { // FUNCTIONS block tag } else if (line.BeginsWith("FUNCTIONS")) { // FUNCTIONS block tag
fMsrBlockCounter = MSR_TAG_FUNCTIONS; fMsrBlockCounter = MSR_TAG_FUNCTIONS;
functions.push_back(current); functions.push_back(current);
} else if (line.Contains("RUN")) { // RUN block tag } else if (line.BeginsWith("RUN")) { // RUN block tag
fMsrBlockCounter = MSR_TAG_RUN; fMsrBlockCounter = MSR_TAG_RUN;
run.push_back(current); run.push_back(current);
} else if (line.Contains("COMMANDS")) { // COMMANDS block tag } else if (line.BeginsWith("COMMANDS")) { // COMMANDS block tag
fMsrBlockCounter = MSR_TAG_COMMANDS; fMsrBlockCounter = MSR_TAG_COMMANDS;
commands.push_back(current); commands.push_back(current);
} else if (line.Contains("FOURIER")) { // FOURIER block tag } else if (line.BeginsWith("FOURIER")) { // FOURIER block tag
fMsrBlockCounter = MSR_TAG_FOURIER; fMsrBlockCounter = MSR_TAG_FOURIER;
fourier.push_back(current); fourier.push_back(current);
} else if (line.Contains("PLOT")) { // PLOT block tag } else if (line.BeginsWith("PLOT")) { // PLOT block tag
fMsrBlockCounter = MSR_TAG_PLOT; fMsrBlockCounter = MSR_TAG_PLOT;
plot.push_back(current); plot.push_back(current);
} else if (line.Contains("STATISTIC")) { // STATISTIC block tag } else if (line.BeginsWith("STATISTIC")) { // STATISTIC block tag
fMsrBlockCounter = MSR_TAG_STATISTIC; fMsrBlockCounter = MSR_TAG_STATISTIC;
statistic.push_back(current); statistic.push_back(current);
} else { // the read line is some real stuff } else { // the read line is some real stuff
@ -425,8 +425,6 @@ int PMsrHandler::WriteMsrLogFile(TString ext)
f << endl << str.Data(); f << endl << str.Data();
CheckAndWriteComment(f, ++lineNo); CheckAndWriteComment(f, ++lineNo);
} }
} else {
CheckAndWriteComment(f, ++lineNo);
} }
// write run block // write run block
@ -1285,7 +1283,7 @@ bool PMsrHandler::HandleFunctionsEntry(PMsrLines &lines)
// create function handler // create function handler
fFuncHandler = new PFunctionHandler(fFunctions); fFuncHandler = new PFunctionHandler(fFunctions);
if (fFuncHandler == 0) { if (fFuncHandler == 0) {
cout << endl << ">> PMsrHandler::HandleFunctionsEntry: **ERROR**: PMsrHandler::HandleFunctionsEntry: Couldn't invoke PFunctionHandler"; cout << endl << ">> PMsrHandler::HandleFunctionsEntry: **ERROR** Couldn't invoke PFunctionHandler." << endl;
return false; return false;
} }
@ -1294,6 +1292,14 @@ bool PMsrHandler::HandleFunctionsEntry(PMsrLines &lines)
return false; return false;
} }
// check if an empty FUNCTIONS block is present
if ((fFuncHandler->GetNoOfFuncs() == 0) && !lines.empty()) {
cout << endl << ">> PMsrHandler::HandleFunctionsEntry: **ERROR** empty FUNCTIONS block are not supported!";
cout << endl << ">> If you want to keep it, just comment the whole block ;-)";
cout << endl;
return false;
}
return true; return true;
} }

View File

@ -801,7 +801,18 @@ void PTheory::MakeCleanAndTidyPolynom(unsigned int i, PMsrLines *fullTheoryBlock
// tokenize line // tokenize line
tokens = str.Tokenize(" \t"); tokens = str.Tokenize(" \t");
for (unsigned int j=1; j<(unsigned int)tokens->GetEntries(); j++) { // check if comment is already present, and if yes ignore it by setting max correctly
unsigned int max = (unsigned int)tokens->GetEntries();
for (unsigned int j=1; j<max; j++) {
ostr = dynamic_cast<TObjString*>(tokens->At(j));
str = ostr->GetString();
if (str.Contains("(")) { // comment present
max=j;
break;
}
}
for (unsigned int j=1; j<max; j++) {
ostr = dynamic_cast<TObjString*>(tokens->At(j)); ostr = dynamic_cast<TObjString*>(tokens->At(j));
str = ostr->GetString(); str = ostr->GetString();
sprintf(substr, "%6s", str.Data()); sprintf(substr, "%6s", str.Data());