fixed a bug in PMsrHandler::FillParameterInUse
This commit is contained in:
@ -2023,13 +2023,14 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
TObjArray *tokens = 0;
|
TObjArray *tokens = 0;
|
||||||
TObjString *ostr = 0;
|
TObjString *ostr = 0;
|
||||||
TString str;
|
TString str;
|
||||||
int ival;
|
int ival, funNo;
|
||||||
|
|
||||||
// create and initialize fParamInUse vector
|
// create and initialize fParamInUse vector
|
||||||
for (unsigned int i=0; i<fParam.size(); i++)
|
for (unsigned int i=0; i<fParam.size(); i++)
|
||||||
fParamInUse.push_back(0);
|
fParamInUse.push_back(0);
|
||||||
|
|
||||||
// go through all the theory lines ------------------------------------
|
// go through all the theory lines ------------------------------------
|
||||||
|
//cout << endl << ">> theory block check ...";
|
||||||
for (iter = theory.begin(); iter != theory.end(); ++iter) {
|
for (iter = theory.begin(); iter != theory.end(); ++iter) {
|
||||||
// remove potential comments
|
// remove potential comments
|
||||||
str = iter->fLine;
|
str = iter->fLine;
|
||||||
@ -2072,6 +2073,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// go through all the function lines: 1st time -----------------------------
|
// go through all the function lines: 1st time -----------------------------
|
||||||
|
//cout << endl << ">> function block check (1st time) ...";
|
||||||
for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
|
for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
|
||||||
// remove potential comments
|
// remove potential comments
|
||||||
str = iter->fLine;
|
str = iter->fLine;
|
||||||
@ -2091,16 +2093,16 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
// filter fun number
|
// filter fun number
|
||||||
ostr = dynamic_cast<TObjString*>(tokens->At(0));
|
ostr = dynamic_cast<TObjString*>(tokens->At(0));
|
||||||
str = ostr->GetString();
|
str = ostr->GetString();
|
||||||
if (!FilterFunMapNumber(str, "fun", ival))
|
if (!FilterFunMapNumber(str, "fun", funNo))
|
||||||
continue;
|
continue;
|
||||||
ival -= MSR_PARAM_FUN_OFFSET;
|
funNo -= MSR_PARAM_FUN_OFFSET;
|
||||||
|
|
||||||
// check if fun number is used, and if yes, filter parameter numbers and maps
|
// check if fun number is used, and if yes, filter parameter numbers and maps
|
||||||
TString sstr;
|
TString sstr;
|
||||||
//cout << endl << ">> fun.size() = " << fun.size();
|
//cout << endl << ">> fun.size() = " << fun.size();
|
||||||
for (unsigned int i=0; i<fun.size(); i++) {
|
for (unsigned int i=0; i<fun.size(); i++) {
|
||||||
// cout << endl << ">> funNo: " << fun[i];
|
//cout << endl << ">> funNo: " << fun[i] << ", funNo: " << funNo;
|
||||||
if (fun[i] == ival) { // function number found
|
if (fun[i] == funNo) { // function number found
|
||||||
// filter for parX
|
// filter for parX
|
||||||
sstr = iter->fLine;
|
sstr = iter->fLine;
|
||||||
char sval[128];
|
char sval[128];
|
||||||
@ -2155,6 +2157,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// go through all the run block lines -------------------------------------
|
// go through all the run block lines -------------------------------------
|
||||||
|
//cout << endl << ">> run block check (1st time) ...";
|
||||||
for (iter = run.begin(); iter != run.end(); ++iter) {
|
for (iter = run.begin(); iter != run.end(); ++iter) {
|
||||||
// remove potential comments
|
// remove potential comments
|
||||||
str = iter->fLine;
|
str = iter->fLine;
|
||||||
@ -2234,6 +2237,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// go through all the function lines: 2nd time -----------------------------
|
// go through all the function lines: 2nd time -----------------------------
|
||||||
|
//cout << endl << ">> function block check (2nd time) ...";
|
||||||
for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
|
for (iter = funcs.begin(); iter != funcs.end(); ++iter) {
|
||||||
// remove potential comments
|
// remove potential comments
|
||||||
str = iter->fLine;
|
str = iter->fLine;
|
||||||
@ -2253,14 +2257,15 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
// filter fun number
|
// filter fun number
|
||||||
ostr = dynamic_cast<TObjString*>(tokens->At(0));
|
ostr = dynamic_cast<TObjString*>(tokens->At(0));
|
||||||
str = ostr->GetString();
|
str = ostr->GetString();
|
||||||
if (!FilterFunMapNumber(str, "fun", ival))
|
if (!FilterFunMapNumber(str, "fun", funNo))
|
||||||
continue;
|
continue;
|
||||||
ival -= MSR_PARAM_FUN_OFFSET;
|
funNo -= MSR_PARAM_FUN_OFFSET;
|
||||||
|
|
||||||
// check if fun number is used, and if yes, filter parameter numbers and maps
|
// check if fun number is used, and if yes, filter parameter numbers and maps
|
||||||
TString sstr;
|
TString sstr;
|
||||||
for (unsigned int i=0; i<fun.size(); i++) {
|
for (unsigned int i=0; i<fun.size(); i++) {
|
||||||
if (fun[i] == ival) { // function number found
|
//cout << endl << ">> funNo: " << fun[i] << ", funNo: " << funNo;
|
||||||
|
if (fun[i] == funNo) { // function number found
|
||||||
// filter for parX
|
// filter for parX
|
||||||
sstr = iter->fLine;
|
sstr = iter->fLine;
|
||||||
char sval[128];
|
char sval[128];
|
||||||
@ -2296,7 +2301,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
if (ival == map[pos])
|
if (ival == map[pos])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((unsigned int)ival == map.size()) { // new map value
|
if ((unsigned int)pos == map.size()) { // new map value
|
||||||
map.push_back(ival);
|
map.push_back(ival);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2312,6 +2317,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// go through all the run block lines 2nd time to filter remaining maps
|
// go through all the run block lines 2nd time to filter remaining maps
|
||||||
|
cout << endl << ">> run block check (2nd time) ...";
|
||||||
for (iter = run.begin(); iter != run.end(); ++iter) {
|
for (iter = run.begin(); iter != run.end(); ++iter) {
|
||||||
// remove potential comments
|
// remove potential comments
|
||||||
str = iter->fLine;
|
str = iter->fLine;
|
||||||
@ -2330,7 +2336,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// get the parameter number via map
|
// get the parameter number via map
|
||||||
//cout << endl << ">> map.size() = " << map.size();
|
cout << endl << ">> map.size() = " << map.size();
|
||||||
for (unsigned int i=0; i<map.size(); i++) {
|
for (unsigned int i=0; i<map.size(); i++) {
|
||||||
if (map[i] == 0)
|
if (map[i] == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -2341,7 +2347,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
ival = str.Atoi();
|
ival = str.Atoi();
|
||||||
if (ival > 0) {
|
if (ival > 0) {
|
||||||
fParamInUse[ival-1]++; // this is OK since map is ranging from 1 ..
|
fParamInUse[ival-1]++; // this is OK since map is ranging from 1 ..
|
||||||
//cout << endl << ">>>> param no : " << ival << ", via map no : " << map[i];
|
cout << endl << ">>>> param no : " << ival << ", via map no : " << map[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2355,10 +2361,10 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << endl << ">> fParamInUse: ";
|
cout << endl << ">> fParamInUse: ";
|
||||||
// for (unsigned int i=0; i<fParamInUse.size(); i++)
|
for (unsigned int i=0; i<fParamInUse.size(); i++)
|
||||||
// cout << endl << i+1 << ", " << fParamInUse[i];
|
cout << endl << i+1 << ", " << fParamInUse[i];
|
||||||
// cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
map.clear();
|
map.clear();
|
||||||
|
Reference in New Issue
Block a user