different handling of the mapping input for PMsrHandler, and minor changes otherwise
This commit is contained in:
parent
fb8e96b2ee
commit
711d47ef18
@ -41,6 +41,11 @@ In order to get musrfit compiled, you need first to build the shared library lib
|
||||
make -f Makefile.musrfit
|
||||
make -f Makefile.musrfit install
|
||||
|
||||
If it doesn't work for linux, try to set first
|
||||
|
||||
export OSTYPE=linux
|
||||
|
||||
for some shells this is needed but I have no clue why it is NOT recognised automatically ...
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# this is the end ...
|
||||
|
@ -1208,17 +1208,13 @@ bool PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit())
|
||||
// only fill map vector until a first zero is encountered
|
||||
if (str.Atoi() != 0)
|
||||
param.fMap.push_back(str.Atoi());
|
||||
else
|
||||
break;
|
||||
param.fMap.push_back(str.Atoi());
|
||||
else
|
||||
error = true;
|
||||
}
|
||||
// check map entries, i.e. if the map values are within parameter bounds
|
||||
for (unsigned int i=0; i<param.fMap.size(); i++) {
|
||||
if ((param.fMap[i] <= 0) || (param.fMap[i] > (int) fParam.size())) {
|
||||
if ((param.fMap[i] < 0) || (param.fMap[i] > (int) fParam.size())) {
|
||||
cout << endl << "**SEVERE ERROR** in PMsrHandler::HandleRunEntry: map value " << param.fMap[i] << " in line " << iter->fLineNo << " is out of range!";
|
||||
error = true;
|
||||
break;
|
||||
@ -2023,7 +2019,8 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
// everything to lower case
|
||||
str.ToLower();
|
||||
|
||||
//cout << endl << ">> " << str.Data();
|
||||
// cout << endl << "-----------------------";
|
||||
// cout << endl << ">> " << str.Data();
|
||||
|
||||
tokens = str.Tokenize(" /t");
|
||||
if (!tokens)
|
||||
@ -2038,8 +2035,9 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
|
||||
// check if fun number is used, and if yes, filter parameter numbers and maps
|
||||
TString sstr;
|
||||
// cout << endl << ">> fun.size() = " << fun.size();
|
||||
for (unsigned int i=0; i<fun.size(); i++) {
|
||||
//cout << endl << ">> funNo: " << fun[i];
|
||||
// cout << endl << ">> funNo: " << fun[i];
|
||||
if (fun[i] == ival) { // function number found
|
||||
// filter for parX
|
||||
sstr = iter->fLine;
|
||||
@ -2047,7 +2045,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
while (sstr.Index("par") != -1) {
|
||||
memset(sval, 0, sizeof(sval));
|
||||
sstr = &sstr[sstr.Index("par")+3]; // trunc sstr
|
||||
//cout << endl << ">> par:sstr: " << sstr.Data();
|
||||
// cout << endl << ">> par:sstr: " << sstr.Data();
|
||||
for (int j=0; j<sstr.Sizeof(); j++) {
|
||||
if (!isdigit(sstr[j]))
|
||||
break;
|
||||
@ -2063,14 +2061,14 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
while (sstr.Index("map") != -1) {
|
||||
memset(sval, 0, sizeof(sval));
|
||||
sstr = &sstr[sstr.Index("map")+3]; // trunc sstr
|
||||
//cout << endl << ">> map:sstr: " << sstr.Data();
|
||||
// cout << endl << ">> map:sstr: " << sstr.Data();
|
||||
for (int j=0; j<sstr.Sizeof(); j++) {
|
||||
if (!isdigit(sstr[j]))
|
||||
break;
|
||||
sval[j] = sstr[j];
|
||||
}
|
||||
sscanf(sval, "%d", &ival);
|
||||
//cout << endl << ">>>> mapX from func 1st, X = " << ival;
|
||||
// cout << endl << ">>>> mapX from func 1st, X = " << ival;
|
||||
// check if map value already in map, otherwise add it
|
||||
if (ival > 0) {
|
||||
unsigned int pos;
|
||||
@ -2150,13 +2148,17 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
// get the parameter number via map
|
||||
//cout << endl << ">> map.size() = " << map.size();
|
||||
for (unsigned int i=0; i<map.size(); i++) {
|
||||
if (map[i] == 0)
|
||||
continue;
|
||||
if (map[i] < tokens->GetEntries()) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(map[i]));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit()) {
|
||||
ival = str.Atoi();
|
||||
fParamInUse[ival-1]++; // this is OK since map is ranging from 1 ..
|
||||
if (ival > 0) {
|
||||
fParamInUse[ival-1]++; // this is OK since map is ranging from 1 ..
|
||||
//cout << endl << ">>>> param no : " << ival << ", via map no : " << map[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2179,6 +2181,9 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
// everything to lower case
|
||||
str.ToLower();
|
||||
|
||||
// cout << endl << "===========================";
|
||||
// cout << endl << ">> " << str.Data();
|
||||
|
||||
tokens = str.Tokenize(" /t");
|
||||
if (!tokens)
|
||||
continue;
|
||||
@ -2206,8 +2211,8 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
sval[j] = sstr[j];
|
||||
}
|
||||
sscanf(sval, "%d", &ival);
|
||||
//cout << endl << ">>>> parX from func 2nd, X = " << ival;
|
||||
fParamInUse[ival-1]++;
|
||||
//cout << endl << ">>>> parX from func 2nd, X = " << ival;
|
||||
}
|
||||
|
||||
// filter for mapX
|
||||
@ -2221,7 +2226,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
sval[j] = sstr[j];
|
||||
}
|
||||
sscanf(sval, "%d", &ival);
|
||||
//cout << endl << ">>>> mapX from func 2nd, X = " << ival;
|
||||
// cout << endl << ">>>> mapX from func 2nd, X = " << ival;
|
||||
// check if map value already in map, otherwise add it
|
||||
if (ival > 0) {
|
||||
unsigned int pos;
|
||||
@ -2244,6 +2249,50 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi
|
||||
}
|
||||
}
|
||||
|
||||
// go through all the run block lines 2nd time to filter remaining maps
|
||||
for (iter = run.begin(); iter != run.end(); ++iter) {
|
||||
// remove potential comments
|
||||
str = iter->fLine;
|
||||
if (str.First('#') != -1)
|
||||
str.Resize(str.First('#'));
|
||||
|
||||
// everything to lower case
|
||||
str.ToLower();
|
||||
|
||||
// handle the maps
|
||||
if (str.Contains("map")) {
|
||||
//cout << endl << ">> " << str.Data();
|
||||
// tokenize string
|
||||
tokens = str.Tokenize(" \t");
|
||||
if (!tokens)
|
||||
continue;
|
||||
|
||||
// get the parameter number via map
|
||||
//cout << endl << ">> map.size() = " << map.size();
|
||||
for (unsigned int i=0; i<map.size(); i++) {
|
||||
if (map[i] == 0)
|
||||
continue;
|
||||
if (map[i] < tokens->GetEntries()) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(map[i]));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit()) {
|
||||
ival = str.Atoi();
|
||||
if (ival > 0) {
|
||||
fParamInUse[ival-1]++; // this is OK since map is ranging from 1 ..
|
||||
//cout << endl << ">>>> param no : " << ival << ", via map no : " << map[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// delete tokens
|
||||
if (tokens) {
|
||||
delete tokens;
|
||||
tokens = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cout << endl << ">> fParamInUse: ";
|
||||
// for (unsigned int i=0; i<fParamInUse.size(); i++)
|
||||
// cout << endl << i+1 << ", " << fParamInUse[i];
|
||||
|
@ -42,6 +42,7 @@ using namespace std;
|
||||
#include <TFile.h>
|
||||
#include <TFolder.h>
|
||||
#include <TH1F.h>
|
||||
#include <TDatime.h>
|
||||
|
||||
#include "TLemRunHeader.h"
|
||||
#include "MuSR_td_PSI_bin.h"
|
||||
@ -118,7 +119,7 @@ PRawRunData* PRunDataHandler::GetRunData(TString runName)
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<fData.size(); i++) {
|
||||
cout << endl << ">> run name = " << fData[i].fRunName.Data();
|
||||
// cout << endl << ">> run name = " << fData[i].fRunName.Data();
|
||||
if (!fData[i].fRunName.CompareTo(runName)) // run found
|
||||
break;
|
||||
}
|
||||
@ -294,11 +295,17 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo)
|
||||
// WKMFULLDATAPATH has the structure: path_1:path_2:...:path_n
|
||||
TObjArray *tokens = str.Tokenize(":");
|
||||
TObjString *ostr;
|
||||
runInfo.fInstitute.ToUpper();
|
||||
runInfo.fBeamline.ToUpper();
|
||||
TDatime datetime;
|
||||
TString dt;
|
||||
dt += datetime.GetYear();
|
||||
for (int i=0; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString() + TString("/data/") +
|
||||
str = ostr->GetString() + TString("/DATA/") +
|
||||
runInfo.fInstitute + TString("/") +
|
||||
runInfo.fBeamline + TString("/") +
|
||||
dt + TString("/") +
|
||||
runInfo.fRunName + TString(".") + ext;
|
||||
cout << endl << ">> generated path: " << str.Data() << endl;
|
||||
if (gSystem->AccessPathName(str.Data())!=true) { // found
|
||||
|
Loading…
x
Reference in New Issue
Block a user