added a group histo selector in any2many for MusrRoot when exporting to a too limited file format as PSI-BIN.
This commit is contained in:
parent
e78619c33b
commit
fab7acfedc
@ -54,7 +54,7 @@ using namespace std;
|
||||
void any2many_syntax()
|
||||
{
|
||||
cout << endl << "usage: any2many [--help] : will show this help.";
|
||||
cout << endl << " any2many --version : will show the svn version.";
|
||||
cout << endl << " any2many --version : will show the git version.";
|
||||
cout << endl << " any2many -f <filenameList-input> | -r <runList-input>";
|
||||
cout << endl << " -c <convert-options> [-p <output-path>] [-y <year>]";
|
||||
cout << endl << " [-o <outputFileName> | -t <in-template> <out-template>] [-s]";
|
||||
@ -83,6 +83,10 @@ void any2many_syntax()
|
||||
cout << endl << " NeXus2-HDF4, NeXus2-HDF5, NeXus2-XML, WKM, ASCII";
|
||||
cout << endl << " Comment: ROOT is superseeded by MusrRoot. If there is not a very good";
|
||||
cout << endl << " reason, avoid it!";
|
||||
cout << endl << " -h <histo-group-list> : This option is for MusrRoot input files only!";
|
||||
cout << endl << " Select the the histo groups to be exported. <histo-group-list> is a space";
|
||||
cout << endl << " separated list of the histo group, e.g. -h 0, 20 will try to export the histo";
|
||||
cout << endl << " 0 (NPP) and 20 (PPC).";
|
||||
cout << endl << " -p <output-path> : where <output-path> is the output path for the";
|
||||
cout << endl << " converted files. If nothing is given, the current directory";
|
||||
cout << endl << " will be used, unless the option '-s' is used.";
|
||||
@ -190,7 +194,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// call any2many --help or any2many --version
|
||||
if (argc == 2) {
|
||||
if (strstr(argv[1], "--h"))
|
||||
if (!strncmp(argv[1], "--help", 128))
|
||||
any2many_syntax();
|
||||
else if (strstr(argv[1], "--v")) {
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -344,6 +348,21 @@ int main(int argc, char *argv[])
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
} else if (!strcmp(argv[i], "-h")) { // filter histo group list (for MusrRoot and ROOT (LEM) only!)
|
||||
bool done = false;
|
||||
int j = i+1;
|
||||
do {
|
||||
status = sscanf(argv[j], "%d", &ival);
|
||||
if (status == 1) {
|
||||
info.groupHistoList.push_back(ival);
|
||||
j++;
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
} while (!done && (j<argc));
|
||||
i = j-1;
|
||||
if (j >= argc) // make sure that counter is still in range
|
||||
break;
|
||||
} else if (!strcmp(argv[i], "-p")) { // filter output path name flag
|
||||
if (i+1 < argc) {
|
||||
info.outPath = argv[i+1];
|
||||
|
@ -1734,8 +1734,34 @@ Bool_t PRunDataHandler::ReadRootFile()
|
||||
|
||||
header->Get("RunInfo/RedGreen Offsets", ivec, ok);
|
||||
if (ok) {
|
||||
redGreenOffsets = ivec;
|
||||
runData.SetRedGreenOffset(ivec);
|
||||
// check if any2many is used and a group histo list is defined, if NOT, only take the 0-offset data!
|
||||
if (fAny2ManyInfo) { // i.e. any2many is called
|
||||
if (fAny2ManyInfo->groupHistoList.size() == 0) { // NO group list defined -> use only the 0-offset data
|
||||
redGreenOffsets.push_back(0);
|
||||
} else { // group list defined
|
||||
// make sure that the group list elements is a subset of present RedGreen offsets
|
||||
Bool_t found = false;
|
||||
Int_t ival;
|
||||
for (UInt_t i=0; i<fAny2ManyInfo->groupHistoList.size(); i++) {
|
||||
found = false;
|
||||
for (UInt_t j=0; j<ivec.size(); j++) {
|
||||
if (fAny2ManyInfo->groupHistoList[i] == ivec[i])
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** requested histo group " << fAny2ManyInfo->groupHistoList[i];
|
||||
cerr << endl << ">> which is NOT present in the data file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// found all requested histo groups, hence stuff it to the right places
|
||||
redGreenOffsets = fAny2ManyInfo->groupHistoList;
|
||||
runData.SetRedGreenOffset(fAny2ManyInfo->groupHistoList);
|
||||
}
|
||||
} else { // not any2many, i.e. musrfit, musrview, ...
|
||||
redGreenOffsets = ivec;
|
||||
runData.SetRedGreenOffset(ivec);
|
||||
}
|
||||
}
|
||||
|
||||
// check further for LEM specific stuff in RunInfo
|
||||
|
@ -780,6 +780,7 @@ typedef struct {
|
||||
TString outTemplate; ///< holds the output file template
|
||||
TString year; ///< holds the information about the year to be used
|
||||
PIntVector runList; ///< holds the run number list to be converted
|
||||
PIntVector groupHistoList; ///< holds the histo group list offset (used to define for MusrRoot files, what to be exported)
|
||||
PStringVector inFileName; ///< holds the file name of the input data file
|
||||
TString outFileName; ///< holds the output file name
|
||||
PStringVector outPathFileName; ///< holds the out path/file name
|
||||
|
Loading…
x
Reference in New Issue
Block a user