diff --git a/ChangeLog b/ChangeLog index 1961bc70..bae38690 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ changes since 0.9.0 =================================== +NEW any2many: force the user to define the exact NeXus ouput formate (HDF4, +HDF5, XML) FIXED Makefiles so that the NeXus support will not be built if it has not been enabled during the configure stage FIXED ASCII export from musrview in case of a Fourier-Power- or Fourier-Phase-difference plot FIXED bug in asymmetry fit with fixed background diff --git a/src/any2many.cpp b/src/any2many.cpp index 5b8447ff..1373156f 100644 --- a/src/any2many.cpp +++ b/src/any2many.cpp @@ -64,9 +64,9 @@ void any2many_syntax() cout << endl << " etc., or a sequence of runs -, e.g. 111-222"; cout << endl << " -c : "; cout << endl << " : input data file format. Supported formats are:"; - cout << endl << " PSI-BIN, ROOT (LEM), MUD, NeXuS, PSI-MDU, WKM"; + cout << endl << " PSI-BIN, ROOT (LEM), MUD, NeXus, PSI-MDU, WKM"; cout << endl << " : ouput data file format. Supported formats are:"; - cout << endl << " PSI-BIN, ROOT (LEM), MUD, NeXuS, WKM, ASCII"; + cout << endl << " PSI-BIN, ROOT (LEM), MUD, NeXus-HDF4, NeXus-HDF5, NeXus-XML, WKM, ASCII"; cout << endl << " -p : where 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."; @@ -149,7 +149,9 @@ int main(int argc, char *argv[]) outputFormat.push_back("psi-bin"); outputFormat.push_back("root"); outputFormat.push_back("mud"); - outputFormat.push_back("nexus"); + outputFormat.push_back("nexus-hdf4"); + outputFormat.push_back("nexus-hdf5"); + outputFormat.push_back("nexus-xml"); outputFormat.push_back("wkm"); outputFormat.push_back("ascii"); diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index 8e77c390..38e48d02 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -4269,10 +4269,13 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() return false; } if (fRuns[i].GetNormParamNo() > static_cast(fParam.size())) { - cerr << endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << " forward histogram number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; - cerr << endl << " Consider to check the manual ;-)" << endl; - return false; + // check if forward histogram number is a function + if (fRuns[i].GetNormParamNo() - MSR_PARAM_FUN_OFFSET > static_cast(fParam.size())) { + cerr << endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + cerr << endl << " forward histogram number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; + cerr << endl << " Consider to check the manual ;-)" << endl; + return false; + } } // check fit range if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index c0b4f50f..6795dbf6 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -64,14 +64,14 @@ using namespace std; #define ROOT_NPP 1 #define ROOT_PPC 2 -#define A2M_UNDEFINED 0 -#define A2M_ROOT 1 -#define A2M_PSIBIN 2 -#define A2M_PSIMDU 3 -#define A2M_MUD 4 -#define A2M_NEXUS 5 -#define A2M_WKM 6 -#define A2M_ASCII 7 +#define A2M_UNDEFINED 0 +#define A2M_ROOT 1 +#define A2M_PSIBIN 2 +#define A2M_PSIMDU 3 +#define A2M_MUD 4 +#define A2M_NEXUS 5 +#define A2M_WKM 6 +#define A2M_ASCII 7 //-------------------------------------------------------------------------- // Constructor @@ -279,7 +279,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() outTag = A2M_PSIBIN; else if (!fAny2ManyInfo->outFormat.CompareTo("mud",TString::kIgnoreCase)) outTag = A2M_MUD; - else if (!fAny2ManyInfo->outFormat.CompareTo("nexus", TString::kIgnoreCase)) + else if (fAny2ManyInfo->outFormat.BeginsWith("nexus", TString::kIgnoreCase)) outTag = A2M_NEXUS; else if (!fAny2ManyInfo->outFormat.CompareTo("wkm", TString::kIgnoreCase)) outTag = A2M_WKM; @@ -617,7 +617,7 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) ext = TString("root"); else if (!runInfo.GetFileFormat(idx)->CompareTo("root-ppc")) // post pile up corrected histos ext = TString("root"); - else if (!runInfo.GetFileFormat(idx)->CompareTo("nexus")) + else if ((!runInfo.GetFileFormat(idx)->CompareTo("nexus-hdf4")) || (!runInfo.GetFileFormat(idx)->CompareTo("nexus-hdf5")) || (!runInfo.GetFileFormat(idx)->CompareTo("nexus-xml"))) ext = TString("NXS"); else if (!runInfo.GetFileFormat(idx)->CompareTo("psi-bin")) ext = TString("bin"); @@ -650,16 +650,16 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) pstr->ToUpper(); cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** File Format '" << pstr->Data() << "' unsupported."; cerr << endl << ">> support file formats are:"; - cerr << endl << ">> ROOT-NPP -> root not post pileup corrected for lem"; - cerr << endl << ">> ROOT-PPC -> root post pileup corrected for lem"; - cerr << endl << ">> NEXUS -> nexus file format"; - cerr << endl << ">> PSI-BIN -> psi bin file format"; - cerr << endl << ">> PSI-MDU -> psi mdu file format (see also MDU-ASCII)"; - cerr << endl << ">> MUD -> triumf mud file format"; - cerr << endl << ">> WKM -> wkm ascii file format"; - cerr << endl << ">> MDU-ASCII -> psi mdu ascii file format"; - cerr << endl << ">> ASCII -> column like file format"; - cerr << endl << ">> DB -> triumf db file \"format\""; + cerr << endl << ">> ROOT-NPP -> root not post pileup corrected for lem"; + cerr << endl << ">> ROOT-PPC -> root post pileup corrected for lem"; + cerr << endl << ">> NEXUS -> nexus file format, HDF4, HDF5, or XML"; + cerr << endl << ">> PSI-BIN -> psi bin file format"; + cerr << endl << ">> PSI-MDU -> psi mdu file format (see also MDU-ASCII)"; + cerr << endl << ">> MUD -> triumf mud file format"; + cerr << endl << ">> WKM -> wkm ascii file format"; + cerr << endl << ">> MDU-ASCII -> psi mdu ascii file format"; + cerr << endl << ">> ASCII -> column like file format"; + cerr << endl << ">> DB -> triumf db file \"format\""; cerr << endl; return success; } @@ -3354,8 +3354,27 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) data.clear(); } + // filter out the proper file type, i.e. HDF4, HDF5, or XML + char fileType[32]; + memset(fileType, '\0', 32); + if (!fAny2ManyInfo->outFormat.CompareTo("nexus-hdf4", TString::kIgnoreCase)) + strncpy(fileType, "hdf4", sizeof(fileType)); + else if (!fAny2ManyInfo->outFormat.CompareTo("nexus-hdf5", TString::kIgnoreCase)) + strncpy(fileType, "hdf5", sizeof(fileType)); + else if (!fAny2ManyInfo->outFormat.CompareTo("nexus-xml", TString::kIgnoreCase)) + strncpy(fileType, "xml", sizeof(fileType)); + else { + cerr << endl << ">> PRunDataHandler::WriteNexusFile(): **ERROR** undefined output NeXus format " << fAny2ManyInfo->outFormat.Data() << " found."; + cerr << endl << ">> Allowed are: hdf4, hdf5, xml" << endl; + if (nxs != 0) { + delete nxs; + nxs = 0; + } + return false; + } + // write file - nxs->WriteFile(fln); + nxs->WriteFile(fln, fileType); // clean up if (nxs != 0) { @@ -4022,7 +4041,7 @@ Bool_t PRunDataHandler::StripWhitespace(TString &str) return false; strncpy(subs, s+start, end-start+1); - subs[end-start+1] = 0; + subs[end-start+1] = '\0'; str = TString(subs);