more work towards NeXus exchange
This commit is contained in:
parent
60a11bffa5
commit
7e2ea62ac3
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
changes since 0.9.0
|
changes since 0.9.0
|
||||||
===================================
|
===================================
|
||||||
|
NEW 2011-12-22 added nexus_dump. It is used to dump nexus files in an ascii
|
||||||
|
form. For instance it can be used to read header info.
|
||||||
NEW if the background is estimated form an interval rather than fitted, it will be added as a comment
|
NEW if the background is estimated form an interval rather than fitted, it will be added as a comment
|
||||||
to the background interval tag. (MUSR-192).
|
to the background interval tag. (MUSR-192).
|
||||||
NEW forward/backward accept now not only c0 c1 c2 ... cn, but also c0-cn cm-cp, or c0 c1-cn cm cx-cy, etc. (MUSR-201, improvement whish).
|
NEW forward/backward accept now not only c0 c1 c2 ... cn, but also c0-cn cm-cp, or c0 c1-cn cm cx-cy, etc. (MUSR-201, improvement whish).
|
||||||
@ -19,7 +21,7 @@ NEW the chi^2 calculation in single-histogram and asymmetry fits is parallelized
|
|||||||
if musrfit is built using a compiler supporting OpenMP (e.g. GCC >= 4.2)
|
if musrfit is built using a compiler supporting OpenMP (e.g. GCC >= 4.2)
|
||||||
Using --disable-omp this feature can be disabled on the configure level.
|
Using --disable-omp this feature can be disabled on the configure level.
|
||||||
NEW any2many: force the user to define the exact NeXus ouput format (HDF4,HDF5,XML)
|
NEW any2many: force the user to define the exact NeXus ouput format (HDF4,HDF5,XML)
|
||||||
FIXED 2011-12-15 some more work towards a proper NeXus muon data format support.
|
FIXED 2011-12-22 some more work towards a proper NeXus muon data format support.
|
||||||
FIXED proper phase correction for Re/Im Fourier transform (MUSR-206)
|
FIXED proper phase correction for Re/Im Fourier transform (MUSR-206)
|
||||||
FIXED when release or restore is called (command block commands), the
|
FIXED when release or restore is called (command block commands), the
|
||||||
corresponding parameter error is set to 2% of its parameter value (MUSR-188).
|
corresponding parameter error is set to 2% of its parameter value (MUSR-188).
|
||||||
|
BIN
doc/examples/data/EMU00005989_v2.nxs
Normal file
BIN
doc/examples/data/EMU00005989_v2.nxs
Normal file
Binary file not shown.
Binary file not shown.
@ -20,7 +20,7 @@ FUNCTIONS
|
|||||||
fun1 = gamma_mu * par4
|
fun1 = gamma_mu * par4
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
RUN data/emu00005989_v2 EMU ISIS NEXUS (name beamline institute data-file-format)
|
RUN data/EMU00005989_v2 EMU ISIS NEXUS (name beamline institute data-file-format)
|
||||||
fittype 2 (asymmetry fit)
|
fittype 2 (asymmetry fit)
|
||||||
alpha 1
|
alpha 1
|
||||||
map 0 0 0 0 0 0 0 0 0 0
|
map 0 0 0 0 0 0 0 0 0 0
|
||||||
|
@ -26,7 +26,7 @@ fun1 = par2 + map1
|
|||||||
fun2 = gamma_mu * par3
|
fun2 = gamma_mu * par3
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
RUN data/emu00005989_v2 XXXX ISIS NEXUS (name beamline institute data-file-format)
|
RUN data/EMU00005989_v2 XXXX ISIS NEXUS (name beamline institute data-file-format)
|
||||||
fittype 0 (single histogram fit)
|
fittype 0 (single histogram fit)
|
||||||
norm 7
|
norm 7
|
||||||
backgr.fit 8
|
backgr.fit 8
|
||||||
@ -37,7 +37,7 @@ data 40 1500
|
|||||||
fit 0.2 14
|
fit 0.2 14
|
||||||
packing 1
|
packing 1
|
||||||
|
|
||||||
RUN data/emu00005989_v2 XXXX ISIS NEXUS (name beamline institute data-file-format)
|
RUN data/EMU00005989_v2 XXXX ISIS NEXUS (name beamline institute data-file-format)
|
||||||
fittype 0 (single histogram fit)
|
fittype 0 (single histogram fit)
|
||||||
norm 9
|
norm 9
|
||||||
backgr.fit 10
|
backgr.fit 10
|
||||||
|
@ -17,12 +17,23 @@ SUBDIRS = external/TLemRunHeader \
|
|||||||
external/mud \
|
external/mud \
|
||||||
$(PNEXUSDIRS) \
|
$(PNEXUSDIRS) \
|
||||||
classes \
|
classes \
|
||||||
external \
|
external
|
||||||
$(EDITORDIR)
|
|
||||||
|
|
||||||
|
if BUILD_MUSRGUI
|
||||||
|
SUBDIRS += $(EDITORDIR)
|
||||||
EXTRA_DIST = $(EDITORDIR)/Makefile
|
EXTRA_DIST = $(EDITORDIR)/Makefile
|
||||||
|
endif
|
||||||
|
|
||||||
|
if BUILD_MUSREDIT
|
||||||
|
SUBDIRS += $(EDITORDIR)
|
||||||
|
EXTRA_DIST = $(EDITORDIR)/Makefile
|
||||||
|
endif
|
||||||
|
|
||||||
bin_PROGRAMS = musrfit musrview musrt0 musrparam msr2msr msr2data any2many
|
bin_PROGRAMS = musrfit musrview musrt0 musrparam msr2msr msr2data any2many
|
||||||
|
if PNEXUS_ENABLED
|
||||||
|
bin_PROGRAMS += nexus_dump
|
||||||
|
endif
|
||||||
|
|
||||||
musrfit_SOURCES = musrfit.cpp
|
musrfit_SOURCES = musrfit.cpp
|
||||||
musrview_SOURCES = musrview.cpp
|
musrview_SOURCES = musrview.cpp
|
||||||
musrt0_SOURCES = musrt0.cpp
|
musrt0_SOURCES = musrt0.cpp
|
||||||
@ -30,6 +41,9 @@ musrparam_SOURCES = musrparam.cpp
|
|||||||
msr2msr_SOURCES = msr2msr.cpp
|
msr2msr_SOURCES = msr2msr.cpp
|
||||||
msr2data_SOURCES = msr2data.cpp
|
msr2data_SOURCES = msr2data.cpp
|
||||||
any2many_SOURCES = any2many.cpp
|
any2many_SOURCES = any2many.cpp
|
||||||
|
if PNEXUS_ENABLED
|
||||||
|
nexus_dump_SOURCES = nexus_dump.cpp
|
||||||
|
endif
|
||||||
|
|
||||||
xmldir = $(bindir)
|
xmldir = $(bindir)
|
||||||
xml_DATA = musrfit_startup.xml
|
xml_DATA = musrfit_startup.xml
|
||||||
@ -39,6 +53,10 @@ LIBADD = $(PMUSR_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS)
|
|||||||
AM_CXXFLAGS = $(LOCAL_BIN_CXXFLAGS)
|
AM_CXXFLAGS = $(LOCAL_BIN_CXXFLAGS)
|
||||||
AM_LDFLAGS = $(LOCAL_BIN_LDFLAGS)
|
AM_LDFLAGS = $(LOCAL_BIN_LDFLAGS)
|
||||||
INCLUDES = $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS)
|
INCLUDES = $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS)
|
||||||
|
if PNEXUS_ENABLED
|
||||||
|
INCLUDES += $(HDF5_CFLAGS) $(NEXUS_CFLAGS) $(PNEXUS_CXXFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
LIBS = $(PMUSR_LIBS) $(USERFCN_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)
|
LIBS = $(PMUSR_LIBS) $(USERFCN_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)
|
||||||
|
|
||||||
install-xmlDATA: $(xml_DATA)
|
install-xmlDATA: $(xml_DATA)
|
||||||
@ -72,12 +90,10 @@ uninstall-xmlDATA:
|
|||||||
read REMOVE && \
|
read REMOVE && \
|
||||||
if test "$$REMOVE" = "y" || test "$$REMOVE" = "Y"; then \
|
if test "$$REMOVE" = "y" || test "$$REMOVE" = "Y"; then \
|
||||||
echo "$(RM) '$(DESTDIR)$(xmldir)/$(xml_DATA)'" && \
|
echo "$(RM) '$(DESTDIR)$(xmldir)/$(xml_DATA)'" && \
|
||||||
$(RM) "$(DESTDIR)$(xmldir)/$(xml_DATA)" && \
|
$(RM) "$(DESTDIR)$(xmldir)/$(xml_DATA)"; \
|
||||||
rmdir "$(DESTDIR)$(xmldir)"; \
|
|
||||||
fi; \
|
fi; \
|
||||||
else \
|
else \
|
||||||
echo "$(RM) '$(DESTDIR)$(xmldir)/$(xml_DATA)'" && \
|
echo "$(RM) '$(DESTDIR)$(xmldir)/$(xml_DATA)'" && \
|
||||||
$(RM) "$(DESTDIR)$(xmldir)/$(xml_DATA)" && \
|
$(RM) "$(DESTDIR)$(xmldir)/$(xml_DATA)"; \
|
||||||
rmdir "$(DESTDIR)$(xmldir)"; \
|
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
@ -53,8 +53,8 @@ void any2many_syntax()
|
|||||||
cout << endl << "usage: any2many [--help] : will show this help.";
|
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 svn version.";
|
||||||
cout << endl << " any2many -f <filenameList-input> | -r <runList-input>";
|
cout << endl << " any2many -f <filenameList-input> | -r <runList-input>";
|
||||||
cout << endl << " -c <convert-options> [-p <output-path>]";
|
cout << endl << " -c <convert-options> [-p <output-path>] [-y <year>]";
|
||||||
cout << endl << " [-y <year>] [-t <in-template> <out-template>] [-s]";
|
cout << endl << " [-o <outputFileName> | -t <in-template> <out-template>] [-s]";
|
||||||
cout << endl << " [-rebin <n>] [-z <compressed>]";
|
cout << endl << " [-rebin <n>] [-z <compressed>]";
|
||||||
cout << endl << " -f <filenameList-input> : where <filenameList-input> is space";
|
cout << endl << " -f <filenameList-input> : where <filenameList-input> is space";
|
||||||
cout << endl << " separeted a list of file names (not starting with a '-'),";
|
cout << endl << " separeted a list of file names (not starting with a '-'),";
|
||||||
|
@ -224,6 +224,8 @@ PRawRunData::PRawRunData()
|
|||||||
fLaboratory = TString("n/a");
|
fLaboratory = TString("n/a");
|
||||||
fBeamline = TString("n/a");
|
fBeamline = TString("n/a");
|
||||||
fInstrument = TString("n/a");
|
fInstrument = TString("n/a");
|
||||||
|
fMuonSource = TString("n/a");
|
||||||
|
fMuonSpecies = TString("n/a");
|
||||||
fRunName = TString("n/a");
|
fRunName = TString("n/a");
|
||||||
fRunNumber = -1;
|
fRunNumber = -1;
|
||||||
fRunTitle = TString("n/a");
|
fRunTitle = TString("n/a");
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <TROOT.h>
|
#include <TROOT.h>
|
||||||
@ -584,7 +585,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// FileAlreadyRead
|
// FileAlreadyRead (private)
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p> Checks if a file has been already read in order to prevent multiple
|
* <p> Checks if a file has been already read in order to prevent multiple
|
||||||
@ -608,7 +609,7 @@ Bool_t PRunDataHandler::FileAlreadyRead(TString runName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// TestFileName -- private
|
// TestFileName (private)
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p> Tests if a file exists (with or without given extension).
|
* <p> Tests if a file exists (with or without given extension).
|
||||||
@ -622,75 +623,91 @@ void PRunDataHandler::TestFileName(TString &runName, const TString &ext)
|
|||||||
TString tmpStr(runName), tmpExt(ext);
|
TString tmpStr(runName), tmpExt(ext);
|
||||||
|
|
||||||
// check first if the file exists with the default extension which is not given with the run name
|
// check first if the file exists with the default extension which is not given with the run name
|
||||||
runName += TString(".") + ext;
|
tmpStr += TString(".") + ext;
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
return;
|
runName = tmpStr;
|
||||||
}
|
|
||||||
|
|
||||||
// test if the file exists with only upper-case letters
|
|
||||||
runName.ToUpper();
|
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// test if the file exists with only lower-case letters
|
|
||||||
runName.ToLower();
|
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// test if the file exists with the given run name but an only upper-case extension which is not included in the file name
|
// test if the file exists with the given run name but an only upper-case extension which is not included in the file name
|
||||||
runName = tmpStr;
|
tmpStr = runName;
|
||||||
tmpExt.ToUpper();
|
tmpExt.ToUpper();
|
||||||
runName += TString(".") + tmpExt;
|
tmpStr += TString(".") + tmpExt;
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// test if the file exists with the given run name but an only lower-case extension which is not included in the file name
|
// test if the file exists with the given run name but an only lower-case extension which is not included in the file name
|
||||||
|
tmpStr = runName;
|
||||||
tmpExt.ToLower();
|
tmpExt.ToLower();
|
||||||
runName = runName.Replace(static_cast<Ssiz_t>(runName.Length()-tmpExt.Length()), tmpExt.Length(), tmpExt);
|
tmpStr += TString(".") + tmpExt;
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
runName = tmpStr;
|
// test if the file exists with only upper-case letters
|
||||||
|
tmpStr = runName + TString(".") + tmpExt;
|
||||||
|
tmpStr.ToUpper();
|
||||||
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// test if the file exists with only lower-case letters
|
||||||
|
tmpStr.ToLower();
|
||||||
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpStr = runName;
|
||||||
|
|
||||||
// the extension is already part of the file name, therefore, do not append it
|
// the extension is already part of the file name, therefore, do not append it
|
||||||
if (runName.EndsWith(ext.Data(), TString::kIgnoreCase)) {
|
if (tmpStr.EndsWith(ext.Data(), TString::kIgnoreCase)) {
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// assume some extension is part of the given file name but the real data file ends with an lower-case extension
|
// assume some extension is part of the given file name but the real data file ends with an lower-case extension
|
||||||
tmpExt.ToLower();
|
tmpExt.ToLower();
|
||||||
runName = runName.Replace(static_cast<Ssiz_t>(runName.Length()-tmpExt.Length()), tmpExt.Length(), tmpExt);
|
tmpStr = tmpStr.Replace(static_cast<Ssiz_t>(tmpStr.Length()-tmpExt.Length()), tmpExt.Length(), tmpExt);
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// assume some extension is part of the given file name but the real data file ends with an upper-case extension
|
// assume some extension is part of the given file name but the real data file ends with an upper-case extension
|
||||||
tmpExt.ToUpper();
|
tmpExt.ToUpper();
|
||||||
runName = runName.Replace(static_cast<Ssiz_t>(runName.Length()-tmpExt.Length()), tmpExt.Length(), tmpExt);
|
tmpStr = runName;
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
tmpStr = tmpStr.Replace(static_cast<Ssiz_t>(tmpStr.Length()-tmpExt.Length()), tmpExt.Length(), tmpExt);
|
||||||
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// test if the file exists with only lower-case letters and the extension already included in the file name
|
// test if the file exists with only lower-case letters and the extension already included in the file name
|
||||||
runName.ToLower();
|
tmpStr = runName;
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
tmpStr.ToLower();
|
||||||
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// test if the file exists with only upper-case letters and the extension already included in the file name
|
// test if the file exists with only upper-case letters and the extension already included in the file name
|
||||||
runName.ToUpper();
|
tmpStr = runName;
|
||||||
if (gSystem->AccessPathName(runName.Data()) != true) { // found
|
tmpStr.ToUpper();
|
||||||
|
if (gSystem->AccessPathName(tmpStr.Data()) != true) { // found
|
||||||
|
runName = tmpStr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the file has not been found, set the run name to be empty
|
// if the file has not been found, set the run name to be empty
|
||||||
runName = "";
|
runName = "";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,6 +1060,8 @@ Bool_t PRunDataHandler::ReadRootFile(UInt_t tag)
|
|||||||
runData.SetLaboratory("PSI");
|
runData.SetLaboratory("PSI");
|
||||||
runData.SetBeamline("muE4");
|
runData.SetBeamline("muE4");
|
||||||
runData.SetInstrument("LEM");
|
runData.SetInstrument("LEM");
|
||||||
|
runData.SetMuonSource("low energy muon source");
|
||||||
|
runData.SetMuonSpecies("positive muons");
|
||||||
|
|
||||||
// get run title
|
// get run title
|
||||||
TObjString ostr = runHeader->GetRunTitle();
|
TObjString ostr = runHeader->GetRunTitle();
|
||||||
@ -1072,36 +1091,14 @@ Bool_t PRunDataHandler::ReadRootFile(UInt_t tag)
|
|||||||
time_t idt = (time_t)runHeader->GetStartTime();
|
time_t idt = (time_t)runHeader->GetStartTime();
|
||||||
runData.SetStartDateTime(idt);
|
runData.SetStartDateTime(idt);
|
||||||
struct tm *dt = localtime(&idt);
|
struct tm *dt = localtime(&idt);
|
||||||
TString stime("");
|
char str[128];
|
||||||
Int_t yy = dt->tm_year;
|
strftime(str, sizeof(str), "%F", dt);
|
||||||
if (yy > 100)
|
TString stime(str);
|
||||||
yy -= 100;
|
|
||||||
if (yy < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += yy;
|
|
||||||
stime += "-";
|
|
||||||
stime += GetMonth(dt->tm_mon);
|
|
||||||
stime += "-";
|
|
||||||
if (dt->tm_mday < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_mday;
|
|
||||||
runData.SetStartDate(stime);
|
runData.SetStartDate(stime);
|
||||||
// start time
|
// start time
|
||||||
if (dt->tm_hour == 0)
|
memset(str, 0, sizeof(str));
|
||||||
stime = "00";
|
strftime(str, sizeof(str), "%T", dt);
|
||||||
else if (dt->tm_hour < 10)
|
stime = str;
|
||||||
stime = "0";
|
|
||||||
else
|
|
||||||
stime = "";
|
|
||||||
stime += dt->tm_hour;
|
|
||||||
stime += ":";
|
|
||||||
if (dt->tm_min < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_min;
|
|
||||||
stime += ":";
|
|
||||||
if (dt->tm_sec < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_sec;
|
|
||||||
runData.SetStartTime(stime);
|
runData.SetStartTime(stime);
|
||||||
|
|
||||||
// get stop time/date
|
// get stop time/date
|
||||||
@ -1109,36 +1106,14 @@ Bool_t PRunDataHandler::ReadRootFile(UInt_t tag)
|
|||||||
idt = (time_t)runHeader->GetStopTime();
|
idt = (time_t)runHeader->GetStopTime();
|
||||||
runData.SetStopDateTime(idt);
|
runData.SetStopDateTime(idt);
|
||||||
dt = localtime(&idt);
|
dt = localtime(&idt);
|
||||||
stime = "";
|
memset(str, 0, sizeof(str));
|
||||||
yy = dt->tm_year;
|
strftime(str, sizeof(str), "%F", dt);
|
||||||
if (yy > 100)
|
stime = str;
|
||||||
yy -= 100;
|
|
||||||
if (yy < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += yy;
|
|
||||||
stime += "-";
|
|
||||||
stime += GetMonth(dt->tm_mon);
|
|
||||||
stime += "-";
|
|
||||||
if (dt->tm_mday < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_mday;
|
|
||||||
runData.SetStopDate(stime);
|
runData.SetStopDate(stime);
|
||||||
// stop time
|
// stop time
|
||||||
if (dt->tm_hour == 0)
|
memset(str, 0, sizeof(str));
|
||||||
stime = "00";
|
strftime(str, sizeof(str), "%T", dt);
|
||||||
else if (dt->tm_hour < 10)
|
stime = str;
|
||||||
stime = "0";
|
|
||||||
else
|
|
||||||
stime = "";
|
|
||||||
stime += dt->tm_hour;
|
|
||||||
stime += ":";
|
|
||||||
if (dt->tm_min < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_min;
|
|
||||||
stime += ":";
|
|
||||||
if (dt->tm_sec < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_sec;
|
|
||||||
runData.SetStopTime(stime);
|
runData.SetStopTime(stime);
|
||||||
|
|
||||||
// get time resolution
|
// get time resolution
|
||||||
@ -1155,6 +1130,11 @@ Bool_t PRunDataHandler::ReadRootFile(UInt_t tag)
|
|||||||
for (Int_t i=0; i<noOfHistos; i++) {
|
for (Int_t i=0; i<noOfHistos; i++) {
|
||||||
runData.AppendT0((Int_t)t0[i]);
|
runData.AppendT0((Int_t)t0[i]);
|
||||||
}
|
}
|
||||||
|
if (tag == ROOT_ALL) { // since NPP and PPC the t0's needs to be doubled
|
||||||
|
for (Int_t i=0; i<noOfHistos; i++) {
|
||||||
|
runData.AppendT0((Int_t)t0[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// read run summary to obtain ring anode HV values
|
// read run summary to obtain ring anode HV values
|
||||||
@ -1513,6 +1493,26 @@ Bool_t PRunDataHandler::ReadNexusFile()
|
|||||||
}
|
}
|
||||||
// get header information
|
// get header information
|
||||||
|
|
||||||
|
// get/set laboratory
|
||||||
|
str = TString(nxs_file->GetEntryIdf2()->GetInstrument()->GetSource()->GetName());
|
||||||
|
runData.SetLaboratory(str);
|
||||||
|
|
||||||
|
// get/set beamline
|
||||||
|
str = TString(nxs_file->GetEntryIdf2()->GetInstrument()->GetName());
|
||||||
|
runData.SetBeamline(str);
|
||||||
|
|
||||||
|
// get/set instrument
|
||||||
|
str = TString(nxs_file->GetEntryIdf2()->GetInstrument()->GetName());
|
||||||
|
runData.SetInstrument(str);
|
||||||
|
|
||||||
|
// get/set muon source
|
||||||
|
str = TString(nxs_file->GetEntryIdf2()->GetInstrument()->GetSource()->GetType());
|
||||||
|
runData.SetMuonSource(str);
|
||||||
|
|
||||||
|
// get/set muon species
|
||||||
|
str = TString(nxs_file->GetEntryIdf2()->GetInstrument()->GetSource()->GetProbe());
|
||||||
|
runData.SetMuonSpecies(str);
|
||||||
|
|
||||||
// get/set run title
|
// get/set run title
|
||||||
str = TString(nxs_file->GetEntryIdf2()->GetTitle());
|
str = TString(nxs_file->GetEntryIdf2()->GetTitle());
|
||||||
runData.SetRunTitle(str);
|
runData.SetRunTitle(str);
|
||||||
@ -1588,7 +1588,7 @@ Bool_t PRunDataHandler::ReadNexusFile()
|
|||||||
int *lgb = nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetLastGoodBins();
|
int *lgb = nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetLastGoodBins();
|
||||||
PIntPair goodDataBin;
|
PIntPair goodDataBin;
|
||||||
|
|
||||||
if (nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetT0Tag() == 2) { // t0, fgb, lgb: [][]
|
if (nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetT0Tag() == 3) { // t0, fgb, lgb: [][]
|
||||||
for (int i=0; i<nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfPeriods(); i++) {
|
for (int i=0; i<nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfPeriods(); i++) {
|
||||||
for (int j=0; j<nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); j++) {
|
for (int j=0; j<nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); j++) {
|
||||||
if (fgb && lgb) {
|
if (fgb && lgb) {
|
||||||
@ -1601,6 +1601,17 @@ Bool_t PRunDataHandler::ReadNexusFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetT0Tag() == 2) { // t0, fgb, lgb: []
|
||||||
|
for (int i=0; i<nxs_file->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); i++) {
|
||||||
|
if (fgb && lgb) {
|
||||||
|
goodDataBin.first = *(fgb+i);
|
||||||
|
goodDataBin.second = *(lgb+i);
|
||||||
|
}
|
||||||
|
runData.AppendT0(*(t0+i));
|
||||||
|
if (fgb && lgb) {
|
||||||
|
runData.AppendGoodDataBin(goodDataBin);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else { // t0, fgb, lgb: single numbers
|
} else { // t0, fgb, lgb: single numbers
|
||||||
if (fgb && lgb) {
|
if (fgb && lgb) {
|
||||||
goodDataBin.first = *fgb;
|
goodDataBin.first = *fgb;
|
||||||
@ -2011,27 +2022,42 @@ Bool_t PRunDataHandler::ReadPsiBinFile()
|
|||||||
|
|
||||||
// filter from the file name the instrument
|
// filter from the file name the instrument
|
||||||
TString instrument("n/a"), beamline("n/a");
|
TString instrument("n/a"), beamline("n/a");
|
||||||
|
TString muonSource("n/a"), muonSpecies("n/a");
|
||||||
if (fRunPathName.Contains("_gps_", TString::kIgnoreCase)) {
|
if (fRunPathName.Contains("_gps_", TString::kIgnoreCase)) {
|
||||||
instrument = "GPS";
|
instrument = "GPS";
|
||||||
beamline = "piM3.2";
|
beamline = "piM3.2";
|
||||||
|
muonSource = "continuous surface muon source";
|
||||||
|
muonSpecies = "positive muons";
|
||||||
} else if (fRunPathName.Contains("_ltf_", TString::kIgnoreCase)) {
|
} else if (fRunPathName.Contains("_ltf_", TString::kIgnoreCase)) {
|
||||||
instrument = "LTF";
|
instrument = "LTF";
|
||||||
beamline = "piM3.3";
|
beamline = "piM3.3";
|
||||||
|
muonSource = "continuous surface muon source";
|
||||||
|
muonSpecies = "positive muons";
|
||||||
} else if (fRunPathName.Contains("_gpd_", TString::kIgnoreCase)) {
|
} else if (fRunPathName.Contains("_gpd_", TString::kIgnoreCase)) {
|
||||||
instrument = "GPD";
|
instrument = "GPD";
|
||||||
beamline = "muE1";
|
beamline = "muE1";
|
||||||
|
muonSource = "continuous decay channel muon source";
|
||||||
|
muonSpecies = "positive muons";
|
||||||
} else if (fRunPathName.Contains("_dolly_", TString::kIgnoreCase)) {
|
} else if (fRunPathName.Contains("_dolly_", TString::kIgnoreCase)) {
|
||||||
instrument = "DOLLY";
|
instrument = "DOLLY";
|
||||||
beamline = "piE1";
|
beamline = "piE1";
|
||||||
|
muonSource = "continuous surface muon source";
|
||||||
|
muonSpecies = "positive muons";
|
||||||
} else if (fRunPathName.Contains("_alc_", TString::kIgnoreCase)) {
|
} else if (fRunPathName.Contains("_alc_", TString::kIgnoreCase)) {
|
||||||
instrument = "ALC";
|
instrument = "ALC";
|
||||||
beamline = "piE3";
|
beamline = "piE3";
|
||||||
|
muonSource = "continuous surface muon source";
|
||||||
|
muonSpecies = "positive muons";
|
||||||
} else if (fRunPathName.Contains("_hifi_", TString::kIgnoreCase)) {
|
} else if (fRunPathName.Contains("_hifi_", TString::kIgnoreCase)) {
|
||||||
instrument = "HIFI";
|
instrument = "HIFI";
|
||||||
beamline = "piE3";
|
beamline = "piE3";
|
||||||
|
muonSource = "continuous surface muon source";
|
||||||
|
muonSpecies = "positive muons";
|
||||||
}
|
}
|
||||||
runData.SetInstrument(instrument);
|
runData.SetInstrument(instrument);
|
||||||
runData.SetBeamline(beamline);
|
runData.SetBeamline(beamline);
|
||||||
|
runData.SetMuonSource(muonSource);
|
||||||
|
runData.SetMuonSpecies(muonSpecies);
|
||||||
|
|
||||||
// keep run name
|
// keep run name
|
||||||
runData.SetRunName(fRunName);
|
runData.SetRunName(fRunName);
|
||||||
@ -2091,7 +2117,13 @@ Bool_t PRunDataHandler::ReadPsiBinFile()
|
|||||||
if (sDateTime.size() < 2) {
|
if (sDateTime.size() < 2) {
|
||||||
cerr << endl << ">> **WARNING** psi-bin file: couldn't obtain run start date/time" << endl;
|
cerr << endl << ">> **WARNING** psi-bin file: couldn't obtain run start date/time" << endl;
|
||||||
}
|
}
|
||||||
runData.SetStartDate(sDateTime[0]);
|
string date("");
|
||||||
|
if (DateToISO8601(sDateTime[0], date)) {
|
||||||
|
runData.SetStartDate(date);
|
||||||
|
} else {
|
||||||
|
cerr << endl << ">> **WARNING** failed to convert start date: " << sDateTime[0] << " into ISO 8601 date." << endl;
|
||||||
|
runData.SetStartDate(sDateTime[0]);
|
||||||
|
}
|
||||||
runData.SetStartTime(sDateTime[1]);
|
runData.SetStartTime(sDateTime[1]);
|
||||||
sDateTime.clear();
|
sDateTime.clear();
|
||||||
|
|
||||||
@ -2099,7 +2131,13 @@ Bool_t PRunDataHandler::ReadPsiBinFile()
|
|||||||
if (sDateTime.size() < 2) {
|
if (sDateTime.size() < 2) {
|
||||||
cerr << endl << ">> **WARNING** psi-bin file: couldn't obtain run stop date/time" << endl;
|
cerr << endl << ">> **WARNING** psi-bin file: couldn't obtain run stop date/time" << endl;
|
||||||
}
|
}
|
||||||
runData.SetStopDate(sDateTime[0]);
|
date = string("");
|
||||||
|
if (DateToISO8601(sDateTime[0], date)) {
|
||||||
|
runData.SetStopDate(date);
|
||||||
|
} else {
|
||||||
|
cerr << endl << ">> **WARNING** failed to convert stop date: " << sDateTime[0] << " into ISO 8601 date." << endl;
|
||||||
|
runData.SetStopDate(sDateTime[0]);
|
||||||
|
}
|
||||||
runData.SetStopTime(sDateTime[1]);
|
runData.SetStopTime(sDateTime[1]);
|
||||||
sDateTime.clear();
|
sDateTime.clear();
|
||||||
|
|
||||||
@ -2209,41 +2247,20 @@ Bool_t PRunDataHandler::ReadMudFile()
|
|||||||
time_t tval;
|
time_t tval;
|
||||||
struct tm *dt;
|
struct tm *dt;
|
||||||
TString stime("");
|
TString stime("");
|
||||||
Int_t yy = 0;
|
|
||||||
success = MUD_getTimeBegin( fh, (UINT32*)&tval );
|
success = MUD_getTimeBegin( fh, (UINT32*)&tval );
|
||||||
if (success) {
|
if (success) {
|
||||||
runData.SetStartDateTime((const time_t)tval);
|
runData.SetStartDateTime((const time_t)tval);
|
||||||
dt = localtime((const time_t*)&tval);
|
dt = localtime((const time_t*)&tval);
|
||||||
assert(dt);
|
assert(dt);
|
||||||
yy = dt->tm_year;
|
|
||||||
if (yy > 100)
|
// start date
|
||||||
yy -= 100;
|
strftime(str, sizeof(str), "%F", dt);
|
||||||
if (yy < 10)
|
stime = str;
|
||||||
stime += "0";
|
|
||||||
stime += yy;
|
|
||||||
stime += "-";
|
|
||||||
stime += GetMonth(dt->tm_mon);
|
|
||||||
stime += "-";
|
|
||||||
if (dt->tm_mday < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_mday;
|
|
||||||
runData.SetStartDate(stime);
|
runData.SetStartDate(stime);
|
||||||
// start time
|
// start time
|
||||||
if (dt->tm_hour == 0)
|
memset(str, 0, sizeof(str));
|
||||||
stime = "00";
|
strftime(str, sizeof(str), "%T", dt);
|
||||||
else if (dt->tm_hour < 10)
|
stime = str;
|
||||||
stime = "0";
|
|
||||||
else
|
|
||||||
stime = "";
|
|
||||||
stime += dt->tm_hour;
|
|
||||||
stime += ":";
|
|
||||||
if (dt->tm_min < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_min;
|
|
||||||
stime += ":";
|
|
||||||
if (dt->tm_sec < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_sec;
|
|
||||||
runData.SetStartTime(stime);
|
runData.SetStartTime(stime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2253,36 +2270,15 @@ Bool_t PRunDataHandler::ReadMudFile()
|
|||||||
runData.SetStopDateTime((const time_t)tval);
|
runData.SetStopDateTime((const time_t)tval);
|
||||||
dt = localtime((const time_t*)&tval);
|
dt = localtime((const time_t*)&tval);
|
||||||
assert(dt);
|
assert(dt);
|
||||||
stime = "";
|
|
||||||
yy = dt->tm_year;
|
// stop date
|
||||||
if (yy > 100)
|
strftime(str, sizeof(str), "%F", dt);
|
||||||
yy -= 100;
|
stime = str;
|
||||||
if (yy < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += yy;
|
|
||||||
stime += "-";
|
|
||||||
stime += GetMonth(dt->tm_mon);
|
|
||||||
stime += "-";
|
|
||||||
if (dt->tm_mday < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_mday;
|
|
||||||
runData.SetStopDate(stime);
|
runData.SetStopDate(stime);
|
||||||
// stop time
|
// stop time
|
||||||
if (dt->tm_hour == 0)
|
memset(str, 0, sizeof(str));
|
||||||
stime = "00";
|
strftime(str, sizeof(str), "%T", dt);
|
||||||
else if (dt->tm_hour < 10)
|
stime = str;
|
||||||
stime = "0";
|
|
||||||
else
|
|
||||||
stime = "";
|
|
||||||
stime += dt->tm_hour;
|
|
||||||
stime += ":";
|
|
||||||
if (dt->tm_min < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_min;
|
|
||||||
stime += ":";
|
|
||||||
if (dt->tm_sec < 10)
|
|
||||||
stime += "0";
|
|
||||||
stime += dt->tm_sec;
|
|
||||||
runData.SetStopTime(stime);
|
runData.SetStopTime(stime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3687,8 +3683,6 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln)
|
|||||||
{
|
{
|
||||||
|
|
||||||
#ifdef PNEXUS_ENABLED
|
#ifdef PNEXUS_ENABLED
|
||||||
int *t0=0, *fgb=0, *lgb=0, *histo=0;
|
|
||||||
|
|
||||||
// generate output file name
|
// generate output file name
|
||||||
if (fln.Length() == 0) {
|
if (fln.Length() == 0) {
|
||||||
Bool_t ok = false;
|
Bool_t ok = false;
|
||||||
@ -3725,7 +3719,7 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln)
|
|||||||
tm = localtime(&now);
|
tm = localtime(&now);
|
||||||
string str("");
|
string str("");
|
||||||
char cstr[128];
|
char cstr[128];
|
||||||
sprintf(cstr, "%04d-%02d-%02d %02d:%02d:%02d", 1900+tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_hour, tm->tm_sec);
|
strftime(cstr, sizeof(cstr), "%FT%T", tm);
|
||||||
str = string(cstr);
|
str = string(cstr);
|
||||||
nxs->SetFileTime(str);
|
nxs->SetFileTime(str);
|
||||||
|
|
||||||
@ -3739,9 +3733,9 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln)
|
|||||||
nxs->GetEntryIdf1()->SetLaboratory(fData[0].GetLaboratory()->Data());
|
nxs->GetEntryIdf1()->SetLaboratory(fData[0].GetLaboratory()->Data());
|
||||||
if (*fData[0].GetBeamline() != "n/a")
|
if (*fData[0].GetBeamline() != "n/a")
|
||||||
nxs->GetEntryIdf1()->SetBeamline(fData[0].GetBeamline()->Data());
|
nxs->GetEntryIdf1()->SetBeamline(fData[0].GetBeamline()->Data());
|
||||||
str = string(fData[0].GetStartDate()->Data()) + string(" ") + string(fData[0].GetStartTime()->Data());
|
str = string(fData[0].GetStartDate()->Data()) + string("T") + string(fData[0].GetStartTime()->Data());
|
||||||
nxs->GetEntryIdf1()->SetStartTime(str);
|
nxs->GetEntryIdf1()->SetStartTime(str);
|
||||||
str = string(fData[0].GetStopDate()->Data()) + string(" ") + string(fData[0].GetStopTime()->Data());
|
str = string(fData[0].GetStopDate()->Data()) + string("T") + string(fData[0].GetStopTime()->Data());
|
||||||
nxs->GetEntryIdf1()->SetStopTime(str);
|
nxs->GetEntryIdf1()->SetStopTime(str);
|
||||||
nxs->GetEntryIdf1()->SetSwitchingState(1);
|
nxs->GetEntryIdf1()->SetSwitchingState(1);
|
||||||
nxs->GetEntryIdf1()->GetUser()->SetName("n/a");
|
nxs->GetEntryIdf1()->GetUser()->SetName("n/a");
|
||||||
@ -3749,13 +3743,23 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln)
|
|||||||
nxs->GetEntryIdf1()->GetSample()->SetName(fData[0].GetSample()->Data());
|
nxs->GetEntryIdf1()->GetSample()->SetName(fData[0].GetSample()->Data());
|
||||||
nxs->GetEntryIdf1()->GetSample()->SetPhysProp("temperature", fData[0].GetTemperature(0), "Kelvin");
|
nxs->GetEntryIdf1()->GetSample()->SetPhysProp("temperature", fData[0].GetTemperature(0), "Kelvin");
|
||||||
nxs->GetEntryIdf1()->GetSample()->SetPhysProp("magnetic_field", fData[0].GetField(), "Gauss");
|
nxs->GetEntryIdf1()->GetSample()->SetPhysProp("magnetic_field", fData[0].GetField(), "Gauss");
|
||||||
nxs->GetEntryIdf1()->GetSample()->SetEnvironment("n/a");
|
nxs->GetEntryIdf1()->GetSample()->SetEnvironment(fData[0].GetSetup()->Data());
|
||||||
nxs->GetEntryIdf1()->GetSample()->SetShape("n/a");
|
nxs->GetEntryIdf1()->GetSample()->SetShape("n/a");
|
||||||
nxs->GetEntryIdf1()->GetSample()->SetMagneticFieldVectorAvailable(0);
|
nxs->GetEntryIdf1()->GetSample()->SetMagneticFieldVectorAvailable(0);
|
||||||
if (*fData[0].GetInstrument() != "n/a")
|
if (*fData[0].GetInstrument() != "n/a")
|
||||||
nxs->GetEntryIdf1()->GetInstrument()->SetName(fData[0].GetInstrument()->Data());
|
nxs->GetEntryIdf1()->GetInstrument()->SetName(fData[0].GetInstrument()->Data());
|
||||||
nxs->GetEntryIdf1()->GetInstrument()->GetDetector()->SetNumber(fData[0].GetNoOfHistos());
|
nxs->GetEntryIdf1()->GetInstrument()->GetDetector()->SetNumber(fData[0].GetNoOfHistos());
|
||||||
nxs->GetEntryIdf1()->GetInstrument()->GetCollimator()->SetType("n/a");
|
nxs->GetEntryIdf1()->GetInstrument()->GetCollimator()->SetType("n/a");
|
||||||
|
// calculate the total number of counts
|
||||||
|
int total_counts = 0;
|
||||||
|
for (unsigned int i=0; i<fData[0].GetNoOfHistos(); i++) {
|
||||||
|
for (unsigned int j=0; j<fData[0].GetDataBin(i)->size(); j++)
|
||||||
|
total_counts += fData[0].GetDataBin(i)->at(j);
|
||||||
|
}
|
||||||
|
double total_counts_mev = (double) total_counts / 1.0e6;
|
||||||
|
nxs->GetEntryIdf1()->GetInstrument()->GetBeam()->SetTotalCounts(total_counts_mev);
|
||||||
|
nxs->GetEntryIdf1()->GetInstrument()->GetBeam()->SetUnits("Mev");
|
||||||
|
|
||||||
nxs->GetEntryIdf1()->GetData()->SetTimeResolution(fData[0].GetTimeResolution(), "ns");
|
nxs->GetEntryIdf1()->GetData()->SetTimeResolution(fData[0].GetTimeResolution(), "ns");
|
||||||
|
|
||||||
// t0
|
// t0
|
||||||
@ -3792,60 +3796,149 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln)
|
|||||||
tm = localtime(&now);
|
tm = localtime(&now);
|
||||||
string str("");
|
string str("");
|
||||||
char cstr[128];
|
char cstr[128];
|
||||||
sprintf(cstr, "%04d-%02d-%02d %02d:%02d:%02d", 1900+tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_hour, tm->tm_sec);
|
strftime(cstr, sizeof(cstr), "%FT%T", tm);
|
||||||
str = string(cstr);
|
str = string(cstr);
|
||||||
nxs->SetFileTime(str);
|
nxs->SetFileTime(str);
|
||||||
|
|
||||||
nxs->SetCreator("PSI - any2many");
|
// NXroot info
|
||||||
|
nxs->SetCreator("PSI: any2many");
|
||||||
|
|
||||||
nxs->GetEntryIdf2()->SetDefinition("pulsedTD");
|
// NXentry info
|
||||||
|
nxs->GetEntryIdf2()->SetDefinition("muonTD");
|
||||||
|
nxs->GetEntryIdf2()->SetProgramName("any2many");
|
||||||
|
nxs->GetEntryIdf2()->SetProgramVersion("$Id$");
|
||||||
nxs->GetEntryIdf2()->SetRunNumber(fData[0].GetRunNumber());
|
nxs->GetEntryIdf2()->SetRunNumber(fData[0].GetRunNumber());
|
||||||
nxs->GetEntryIdf2()->SetTitle(fData[0].GetRunTitle()->Data());
|
nxs->GetEntryIdf2()->SetTitle(fData[0].GetRunTitle()->Data());
|
||||||
str = string(fData[0].GetStartDate()->Data()) + string(" ") + string(fData[0].GetStartTime()->Data());
|
str = string(fData[0].GetStartDate()->Data()) + string("T") + string(fData[0].GetStartTime()->Data());
|
||||||
nxs->GetEntryIdf2()->SetStartTime(str);
|
nxs->GetEntryIdf2()->SetStartTime(str);
|
||||||
str = string(fData[0].GetStopDate()->Data()) + string(" ") + string(fData[0].GetStopTime()->Data());
|
str = string(fData[0].GetStopDate()->Data()) + string("T") + string(fData[0].GetStopTime()->Data());
|
||||||
nxs->GetEntryIdf2()->SetStopTime(str);
|
nxs->GetEntryIdf2()->SetStopTime(str);
|
||||||
|
|
||||||
nxs->GetEntryIdf2()->SetExperimentIdentifier("n/a");
|
nxs->GetEntryIdf2()->SetExperimentIdentifier("n/a");
|
||||||
|
|
||||||
|
// NXuser info
|
||||||
nxs->GetEntryIdf2()->GetUser()->SetName("n/a");
|
nxs->GetEntryIdf2()->GetUser()->SetName("n/a");
|
||||||
|
|
||||||
|
// NXsample info
|
||||||
nxs->GetEntryIdf2()->GetSample()->SetName(fData[0].GetSample()->Data());
|
nxs->GetEntryIdf2()->GetSample()->SetName(fData[0].GetSample()->Data());
|
||||||
nxs->GetEntryIdf2()->GetSample()->SetDescription("n/a");
|
nxs->GetEntryIdf2()->GetSample()->SetDescription("n/a");
|
||||||
nxs->GetEntryIdf2()->GetSample()->SetPhysProp("temperature_1", fData[0].GetTemperature(0), "Kelvin");
|
nxs->GetEntryIdf2()->GetSample()->SetPhysProp("temperature_1", fData[0].GetTemperature(0), "Kelvin");
|
||||||
nxs->GetEntryIdf2()->GetSample()->SetPhysProp("magnetic_field_1", fData[0].GetField(), "Gauss");
|
nxs->GetEntryIdf2()->GetSample()->SetPhysProp("magnetic_field_1", fData[0].GetField(), "Gauss");
|
||||||
nxs->GetEntryIdf2()->GetSample()->SetEnvironmentTemp("n/a");
|
nxs->GetEntryIdf2()->GetSample()->SetEnvironmentTemp(fData[0].GetSetup()->Data());
|
||||||
nxs->GetEntryIdf2()->GetSample()->SetEnvironmentField("n/a");
|
nxs->GetEntryIdf2()->GetSample()->SetEnvironmentField("n/a");
|
||||||
|
|
||||||
// here would be the information for NXinstrument. Currently there are not enough information to feed this
|
// here would be the information for NXinstrument. Currently there are not much information to feed this
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->SetName(fData[0].GetInstrument()->Data());
|
||||||
|
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetDescription("n/a");
|
// NXinstrument/NXsource
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfPeriods(1); // currently red/green is not distinguished
|
nxs->GetEntryIdf2()->GetInstrument()->GetSource()->SetName(fData[0].GetLaboratory()->Data());
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetSource()->SetType(fData[0].GetMuonSource()->Data());
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetSource()->SetProbe(fData[0].GetMuonSpecies()->Data());
|
||||||
|
|
||||||
|
// NXinstrument/NXbeamline
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetBeamline()->SetName(fData[0].GetBeamline()->Data());
|
||||||
|
|
||||||
|
// NXinstrument/NXdetector
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetDescription(fData[0].GetInstrument()->Data()); // assume that this should be the instrument name
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfPeriods(0); // currently red/green is not distinguished
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfSpectra(fData[0].GetNoOfHistos());
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfSpectra(fData[0].GetNoOfHistos());
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfBins(fData[0].GetDataBin(0)->size());
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfBins(fData[0].GetDataBin(0)->size());
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetTimeResolution(fData[0].GetTimeResolution(), "ns");
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetTimeResolution(fData[0].GetTimeResolution(), "ns");
|
||||||
histo = new int[fData[0].GetNoOfHistos()*fData[0].GetDataBin(0)->size()];
|
int *histo = new int[fData[0].GetNoOfHistos()*fData[0].GetDataBin(0)->size()];
|
||||||
for (int i=0; i<nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); i++) {
|
for (int i=0; i<nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); i++) {
|
||||||
for (unsigned int j=0; j<fData[0].GetDataBin(0)->size(); j++) {
|
for (unsigned int j=0; j<fData[0].GetDataBin(0)->size(); j++) {
|
||||||
*(histo+i*fData[0].GetDataBin(0)->size()+j) = (int) fData[0].GetDataBin(i)->at(j);
|
*(histo+i*fData[0].GetDataBin(0)->size()+j) = (int) fData[0].GetDataBin(i)->at(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetHistos(histo);
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetHistos(histo);
|
||||||
|
// clean up
|
||||||
|
if (histo) {
|
||||||
|
delete [] histo;
|
||||||
|
histo = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle spectrum index
|
||||||
for (int i=0; i<nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); i++)
|
for (int i=0; i<nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); i++)
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetSpectrumIndex(i+1);
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetSpectrumIndex(i+1);
|
||||||
|
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetT0Tag(2);
|
// handle histogram resolution
|
||||||
int *t0 = new int[fData[0].GetT0Size()];
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetTimeResolution(fData[0].GetTimeResolution(), "ns");
|
||||||
|
|
||||||
|
// handle raw time
|
||||||
|
vector<double> raw_time;
|
||||||
|
for (unsigned int i=0; i<fData[0].GetDataBin(0)->size(); i++) {
|
||||||
|
raw_time.push_back((double)i * fData[0].GetTimeResolution() * 1.0e-3); // since time resolution is given in ns, the factor 1.0e-3 is needed to convert to us
|
||||||
|
}
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetRawTime(raw_time);
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetRawTimeUnit("micro.second");
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetRawTimeName("time");
|
||||||
|
raw_time.clear();
|
||||||
|
|
||||||
|
// handle t0
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetT0Tag(2); // i.e. t0[#histo] format
|
||||||
|
int *t0 = new int[fData[0].GetNoOfHistos()];
|
||||||
for (unsigned int i=0; i<fData[0].GetNoOfHistos(); i++) {
|
for (unsigned int i=0; i<fData[0].GetNoOfHistos(); i++) {
|
||||||
if (i<fData[0].GetT0Size())
|
if (fData[0].GetT0Size() == 0) { // NO t0's present, hence take the estimated ones
|
||||||
*(t0+i) = fData[0].GetT0(i);
|
if (i == 0) { // place a warning in case NO t0's were present
|
||||||
else
|
cerr << endl << ">> **WARNING** NO t0's are present in the original file, will use the estimated once, no waranty this is correct!!" << endl;
|
||||||
*(t0+i) = fData[0].GetT0(0);
|
}
|
||||||
|
if (i<fData[0].GetT0Size())
|
||||||
|
t0[i] = fData[0].GetT0Estimated(i);
|
||||||
|
else
|
||||||
|
t0[i] = fData[0].GetT0Estimated(0);
|
||||||
|
} else { // t0's are given
|
||||||
|
if (i<fData[0].GetT0Size())
|
||||||
|
t0[i] = fData[0].GetT0(i);
|
||||||
|
else
|
||||||
|
t0[i] = fData[0].GetT0(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetT0(t0);
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetT0(t0);
|
||||||
|
|
||||||
// first_good_bin - still missing
|
// handle first_good_bin
|
||||||
// last_good_bin - still missing
|
int *fgb = new int[fData[0].GetNoOfHistos()];
|
||||||
|
for (unsigned int i=0; i<fData[0].GetNoOfHistos(); i++) {
|
||||||
|
if (fData[0].GetGoodDataBinSize() == 0) { // first good bin NOT present, hence fgb = t0 + 10ns
|
||||||
|
fgb[i] = t0[i] + (int)(10.0/fData[0].GetTimeResolution()); // t0 + 10ns
|
||||||
|
} else { // first good bin present
|
||||||
|
if (i < fData[0].GetGoodDataBinSize())
|
||||||
|
fgb[i] = fData[0].GetGoodDataBin(i).first;
|
||||||
|
else
|
||||||
|
fgb[i] = fData[0].GetGoodDataBin(0).first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetFirstGoodBin(fgb);
|
||||||
|
// clean up
|
||||||
|
if (fgb) {
|
||||||
|
delete [] fgb;
|
||||||
|
fgb = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle last_good_bin
|
||||||
|
int *lgb = new int[fData[0].GetNoOfHistos()];
|
||||||
|
for (unsigned int i=0; i<fData[0].GetNoOfHistos(); i++) {
|
||||||
|
if (fData[0].GetGoodDataBinSize() == 0) { // last good bin NOT present, hence lgb = length of histo - 1
|
||||||
|
lgb[i] = fData[0].GetDataBin(i)->size() - 1;
|
||||||
|
} else { // first good bin present
|
||||||
|
if (i < fData[0].GetGoodDataBinSize())
|
||||||
|
lgb[i] = fData[0].GetGoodDataBin(i).second;
|
||||||
|
else
|
||||||
|
lgb[i] = fData[0].GetGoodDataBin(0).second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetLastGoodBin(lgb);
|
||||||
|
// clean up
|
||||||
|
if (lgb) {
|
||||||
|
delete [] lgb;
|
||||||
|
lgb = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
if (t0) {
|
||||||
|
delete [] t0;
|
||||||
|
t0 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// clean up
|
// clean up
|
||||||
if (nxs != 0) {
|
if (nxs != 0) {
|
||||||
@ -3877,23 +3970,6 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln)
|
|||||||
// write file
|
// write file
|
||||||
nxs->WriteFile(fln, fileType, fAny2ManyInfo->idf);
|
nxs->WriteFile(fln, fileType, fAny2ManyInfo->idf);
|
||||||
|
|
||||||
// clean up
|
|
||||||
if (t0) {
|
|
||||||
delete [] t0;
|
|
||||||
t0 = 0;
|
|
||||||
}
|
|
||||||
if (fgb) {
|
|
||||||
delete [] fgb;
|
|
||||||
fgb = 0;
|
|
||||||
}
|
|
||||||
if (lgb) {
|
|
||||||
delete [] lgb;
|
|
||||||
lgb = 0;
|
|
||||||
}
|
|
||||||
if (histo) {
|
|
||||||
delete [] histo;
|
|
||||||
histo = 0;
|
|
||||||
}
|
|
||||||
if (nxs != 0) {
|
if (nxs != 0) {
|
||||||
delete nxs;
|
delete nxs;
|
||||||
nxs = 0;
|
nxs = 0;
|
||||||
@ -4915,49 +4991,32 @@ TString PRunDataHandler::FileNameFromTemplate(TString &fileNameTemplate, Int_t r
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// GetMonth (private)
|
// DateToISO8601 (private)
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>Spits out the month as MMM for a given numerical month 0..11
|
* <p>If possible converts a inDate, into a ISO8601 standard date.
|
||||||
*
|
*
|
||||||
* <b>return:</b>
|
* <p><b>return:</b> true if conversion was successfull otherwise false.
|
||||||
* - constructed file name from template, run number, and year
|
|
||||||
* - empty string
|
|
||||||
*
|
*
|
||||||
* \param template template string
|
* \param inDate input date which should be converted to an ISO 8601 date.
|
||||||
|
* \param iso8601Date on success the converted iso8601Date, otherwise an empty string
|
||||||
*/
|
*/
|
||||||
TString PRunDataHandler::GetMonth(Int_t month)
|
bool PRunDataHandler::DateToISO8601(string inDate, string &iso8601Date)
|
||||||
{
|
{
|
||||||
TString mm("");
|
iso8601Date = string("");
|
||||||
|
|
||||||
if (month == 0)
|
struct tm tm;
|
||||||
mm = "JAN";
|
|
||||||
else if (month == 1)
|
|
||||||
mm = "FEB";
|
|
||||||
else if (month == 2)
|
|
||||||
mm = "MAR";
|
|
||||||
else if (month == 3)
|
|
||||||
mm = "APR";
|
|
||||||
else if (month == 4)
|
|
||||||
mm = "MAY";
|
|
||||||
else if (month == 5)
|
|
||||||
mm = "JUN";
|
|
||||||
else if (month == 6)
|
|
||||||
mm = "JUL";
|
|
||||||
else if (month == 7)
|
|
||||||
mm = "AUG";
|
|
||||||
else if (month == 8)
|
|
||||||
mm = "SEP";
|
|
||||||
else if (month == 9)
|
|
||||||
mm = "OCT";
|
|
||||||
else if (month == 10)
|
|
||||||
mm = "NOV";
|
|
||||||
else if (month == 11)
|
|
||||||
mm = "DEC";
|
|
||||||
else
|
|
||||||
mm = "???";
|
|
||||||
|
|
||||||
return mm;
|
// currently only dates like dd-mmm-yy are handled, where dd day of the month, mmm month as abbrivation, e.g. JAN, and yy as the year
|
||||||
|
if (!strptime(inDate.c_str(), "%d-%b-%y", &tm)) // failed
|
||||||
|
return false;
|
||||||
|
|
||||||
|
TString str("");
|
||||||
|
str.Form("%04d-%02d-%02d", 1900+tm.tm_year, tm.tm_mon, tm.tm_mday);
|
||||||
|
|
||||||
|
iso8601Date = str.Data();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
702
src/external/nexus/PNeXus.cpp
vendored
702
src/external/nexus/PNeXus.cpp
vendored
File diff suppressed because it is too large
Load Diff
13
src/external/nexus/PNeXus.h
vendored
13
src/external/nexus/PNeXus.h
vendored
@ -386,6 +386,9 @@ class PNeXusDetector2 {
|
|||||||
|
|
||||||
virtual string GetDescription() { return fDescription; }
|
virtual string GetDescription() { return fDescription; }
|
||||||
virtual double GetTimeResolution(string units);
|
virtual double GetTimeResolution(string units);
|
||||||
|
virtual vector<double> *GetRawTime() { return &fRawTime; }
|
||||||
|
virtual string GetRawTimeName() { return fRawTimeName; }
|
||||||
|
virtual string GetRawTimeUnit() { return fRawTimeUnit; }
|
||||||
virtual bool IsT0Present() { return (fT0 == 0) ? false : true; }
|
virtual bool IsT0Present() { return (fT0 == 0) ? false : true; }
|
||||||
virtual int GetT0Tag() { return fT0Tag; }
|
virtual int GetT0Tag() { return fT0Tag; }
|
||||||
virtual int GetT0(int idxp=-1, int idxs=-1);
|
virtual int GetT0(int idxp=-1, int idxs=-1);
|
||||||
@ -393,7 +396,7 @@ class PNeXusDetector2 {
|
|||||||
virtual bool IsFirstGoodBinPresent() { return (fFirstGoodBin == 0) ? false : true; }
|
virtual bool IsFirstGoodBinPresent() { return (fFirstGoodBin == 0) ? false : true; }
|
||||||
virtual int GetFirstGoodBin(int idxp=-1, int idxs=-1);
|
virtual int GetFirstGoodBin(int idxp=-1, int idxs=-1);
|
||||||
virtual int* GetFirstGoodBins() { return fFirstGoodBin; }
|
virtual int* GetFirstGoodBins() { return fFirstGoodBin; }
|
||||||
virtual bool IsLastGoodBinPresent() { return (fFirstGoodBin == 0) ? false : true; }
|
virtual bool IsLastGoodBinPresent() { return (fLastGoodBin == 0) ? false : true; }
|
||||||
virtual int GetLastGoodBin(int idxp=-1, int idxs=-1);
|
virtual int GetLastGoodBin(int idxp=-1, int idxs=-1);
|
||||||
virtual int* GetLastGoodBins() { return fLastGoodBin; }
|
virtual int* GetLastGoodBins() { return fLastGoodBin; }
|
||||||
virtual int GetNoOfPeriods() { return fNoOfPeriods; }
|
virtual int GetNoOfPeriods() { return fNoOfPeriods; }
|
||||||
@ -407,6 +410,9 @@ class PNeXusDetector2 {
|
|||||||
|
|
||||||
virtual void SetDescription(string description) { fDescription = description; }
|
virtual void SetDescription(string description) { fDescription = description; }
|
||||||
virtual void SetTimeResolution(double val, string units);
|
virtual void SetTimeResolution(double val, string units);
|
||||||
|
virtual void SetRawTime(vector<double> &rawTime);
|
||||||
|
virtual void SetRawTimeName(string rawTimeName) { fRawTimeName = rawTimeName; }
|
||||||
|
virtual void SetRawTimeUnit(string rawTimeUnit) { fRawTimeUnit = rawTimeUnit; }
|
||||||
virtual void SetT0Tag(int tag) { fT0Tag = tag; }
|
virtual void SetT0Tag(int tag) { fT0Tag = tag; }
|
||||||
virtual int SetT0(int *t0);
|
virtual int SetT0(int *t0);
|
||||||
virtual int SetFirstGoodBin(int *fgb);
|
virtual int SetFirstGoodBin(int *fgb);
|
||||||
@ -423,12 +429,15 @@ class PNeXusDetector2 {
|
|||||||
string fDescription; ///< description of the detector
|
string fDescription; ///< description of the detector
|
||||||
double fTimeResolution; ///< keeps the time resolution in (ps)
|
double fTimeResolution; ///< keeps the time resolution in (ps)
|
||||||
vector<int> fSpectrumIndex; ///< list of global spectra
|
vector<int> fSpectrumIndex; ///< list of global spectra
|
||||||
|
vector<double> fRawTime; ///< keeps a raw time vector
|
||||||
|
string fRawTimeName; ///< name of the raw time vector
|
||||||
|
string fRawTimeUnit; ///< unit of the raw time vector
|
||||||
|
|
||||||
int fNoOfPeriods; ///< number of periods or -1 if not defined
|
int fNoOfPeriods; ///< number of periods or -1 if not defined
|
||||||
int fNoOfSpectra; ///< number of spectra or -1 if not defined
|
int fNoOfSpectra; ///< number of spectra or -1 if not defined
|
||||||
int fNoOfBins; ///< number of bins of a spectrum or -1 if not defined
|
int fNoOfBins; ///< number of bins of a spectrum or -1 if not defined
|
||||||
|
|
||||||
int fT0Tag; ///< tag for t0, fgb, lgb structure. -1==not present, 1==NX_INT, 2=NX_INT[np][ns]
|
int fT0Tag; ///< tag for t0, fgb, lgb structure. -1==not present, 1==NX_INT, 2==NX_INT[ns], 3==NX_INT[np][ns]
|
||||||
int *fT0;
|
int *fT0;
|
||||||
int *fFirstGoodBin;
|
int *fFirstGoodBin;
|
||||||
int *fLastGoodBin;
|
int *fLastGoodBin;
|
||||||
|
@ -279,6 +279,8 @@ class PRawRunData {
|
|||||||
virtual const TString* GetBeamline() { return &fBeamline; }
|
virtual const TString* GetBeamline() { return &fBeamline; }
|
||||||
virtual const TString* GetInstrument() { return &fInstrument; }
|
virtual const TString* GetInstrument() { return &fInstrument; }
|
||||||
virtual const TString* GetRunName() { return &fRunName; }
|
virtual const TString* GetRunName() { return &fRunName; }
|
||||||
|
virtual const TString* GetMuonSource() { return &fMuonSource; }
|
||||||
|
virtual const TString* GetMuonSpecies() { return &fMuonSpecies; }
|
||||||
virtual const Int_t GetRunNumber() { return fRunNumber; }
|
virtual const Int_t GetRunNumber() { return fRunNumber; }
|
||||||
virtual const TString* GetRunTitle() { return &fRunTitle; }
|
virtual const TString* GetRunTitle() { return &fRunTitle; }
|
||||||
virtual const TString* GetSetup() { return &fSetup; }
|
virtual const TString* GetSetup() { return &fSetup; }
|
||||||
@ -305,6 +307,7 @@ class PRawRunData {
|
|||||||
virtual const UInt_t GetT0EstimatedSize() { return fT0Estimated.size(); }
|
virtual const UInt_t GetT0EstimatedSize() { return fT0Estimated.size(); }
|
||||||
virtual const Int_t GetT0Estimated(const UInt_t idx);
|
virtual const Int_t GetT0Estimated(const UInt_t idx);
|
||||||
virtual const PIntPair GetBkgBin(const UInt_t idx);
|
virtual const PIntPair GetBkgBin(const UInt_t idx);
|
||||||
|
virtual const UInt_t GetGoodDataBinSize() { return fGoodDataBin.size(); }
|
||||||
virtual const PIntPair GetGoodDataBin(const UInt_t idx);
|
virtual const PIntPair GetGoodDataBin(const UInt_t idx);
|
||||||
virtual const UInt_t GetNoOfHistos() { return fDataBin.size(); }
|
virtual const UInt_t GetNoOfHistos() { return fDataBin.size(); }
|
||||||
virtual const PDoubleVector* GetDataBin(const UInt_t idx);
|
virtual const PDoubleVector* GetDataBin(const UInt_t idx);
|
||||||
@ -313,6 +316,8 @@ class PRawRunData {
|
|||||||
virtual void SetLaboratory(const TString &str) { fLaboratory = str; }
|
virtual void SetLaboratory(const TString &str) { fLaboratory = str; }
|
||||||
virtual void SetBeamline(const TString &str) { fBeamline = str; }
|
virtual void SetBeamline(const TString &str) { fBeamline = str; }
|
||||||
virtual void SetInstrument(const TString &str) { fInstrument = str; }
|
virtual void SetInstrument(const TString &str) { fInstrument = str; }
|
||||||
|
virtual void SetMuonSource(const TString &str) { fMuonSource = str; }
|
||||||
|
virtual void SetMuonSpecies(const TString &str) { fMuonSpecies = str; }
|
||||||
virtual void SetRunName(const TString &str) { fRunName = str; }
|
virtual void SetRunName(const TString &str) { fRunName = str; }
|
||||||
virtual void SetRunNumber(const Int_t &val) { fRunNumber = val; }
|
virtual void SetRunNumber(const Int_t &val) { fRunNumber = val; }
|
||||||
virtual void SetRunTitle(const TString str) { fRunTitle = str; }
|
virtual void SetRunTitle(const TString str) { fRunTitle = str; }
|
||||||
@ -347,6 +352,8 @@ class PRawRunData {
|
|||||||
TString fLaboratory; ///< keeps the name of the laboratory, e.g. PSI, ISIS, TRIUMF, JPARC
|
TString fLaboratory; ///< keeps the name of the laboratory, e.g. PSI, ISIS, TRIUMF, JPARC
|
||||||
TString fBeamline; ///< keeps the name of the be beamline, e.g. muE4, piM3.1, ...
|
TString fBeamline; ///< keeps the name of the be beamline, e.g. muE4, piM3.1, ...
|
||||||
TString fInstrument; ///< keeps the name of the instrument, e.g. LEM, GPS, MUSR, EMU, ...
|
TString fInstrument; ///< keeps the name of the instrument, e.g. LEM, GPS, MUSR, EMU, ...
|
||||||
|
TString fMuonSource; ///< keeps the type of muon source, e.g. continous surface beam, pulsed beam, low energy muon beam
|
||||||
|
TString fMuonSpecies; ///< positive muon or negative muon
|
||||||
TString fRunName; ///< name of the run
|
TString fRunName; ///< name of the run
|
||||||
Int_t fRunNumber; ///< run number
|
Int_t fRunNumber; ///< run number
|
||||||
TString fRunTitle; ///< run title
|
TString fRunTitle; ///< run title
|
||||||
|
@ -95,7 +95,7 @@ class PRunDataHandler
|
|||||||
|
|
||||||
virtual TString GetFileName(const TString extension, Bool_t &ok);
|
virtual TString GetFileName(const TString extension, Bool_t &ok);
|
||||||
virtual TString FileNameFromTemplate(TString &fileNameTemplate, Int_t run, TString &year, Bool_t &ok);
|
virtual TString FileNameFromTemplate(TString &fileNameTemplate, Int_t run, TString &year, Bool_t &ok);
|
||||||
virtual TString GetMonth(Int_t month);
|
virtual bool DateToISO8601(string inDate, string &iso8601Date);
|
||||||
virtual void SplitTimeDate(TString timeDate, TString &time, TString &date, Bool_t &ok);
|
virtual void SplitTimeDate(TString timeDate, TString &time, TString &date, Bool_t &ok);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
74
src/nexus_dump.cpp
Normal file
74
src/nexus_dump.cpp
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
nexus_read_test.cpp
|
||||||
|
|
||||||
|
Author: Andreas Suter
|
||||||
|
e-mail: andreas.suter@psi.ch
|
||||||
|
|
||||||
|
$Id: nexus_read_test.cpp 4981 2011-08-23 17:22:29Z nemu $
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2007-2011 by Andreas Suter *
|
||||||
|
* andreas.suter@psi.ch *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include "PNeXus.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void nexus_read_test_syntax()
|
||||||
|
{
|
||||||
|
cout << endl << ">>---------------------------------------------------------------------------------------";
|
||||||
|
cout << endl << ">> usage: nexus_dump <nexus-in-filename>";
|
||||||
|
cout << endl << ">> This will try to read a nexus-files <nexus-in-filename> and send the relevant";
|
||||||
|
cout << endl << ">> information to the standard output.";
|
||||||
|
cout << endl << ">>---------------------------------------------------------------------------------------";
|
||||||
|
cout << endl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (argc !=2) {
|
||||||
|
nexus_read_test_syntax();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
PNeXus *nxs_file = new PNeXus(argv[1]);
|
||||||
|
|
||||||
|
if (nxs_file->IsValid(false)) {
|
||||||
|
nxs_file->Dump();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nxs_file)
|
||||||
|
delete nxs_file;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -6,12 +6,12 @@ NEXUS_CLASS_DIR = ../../external/nexus
|
|||||||
|
|
||||||
CXX = g++
|
CXX = g++
|
||||||
CXXFLAGS = -g -Wall -fPIC
|
CXXFLAGS = -g -Wall -fPIC
|
||||||
INCLUDES = -I /usr/local/include -I $(NEXUS_CLASS_DIR)
|
INCLUDES = -I /opt/nexus/include -I $(NEXUS_CLASS_DIR)
|
||||||
LD = g++
|
LD = g++
|
||||||
LDFLAGS = -g
|
LDFLAGS = -g
|
||||||
|
|
||||||
LIBS = -L /usr/local/lib -lNeXus
|
LIBS = -L /opt/nexus/lib -lNeXus
|
||||||
LIBS += -L /usr/lib -lhdf5
|
LIBS += -L /opt/hdf/lib -lhdf5
|
||||||
|
|
||||||
EXEC = nexus_read_test
|
EXEC = nexus_read_test
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
PNeXus *nxs_file = new PNeXus(argv[1]);
|
PNeXus *nxs_file = new PNeXus(argv[1]);
|
||||||
|
|
||||||
if (nxs_file->IsValid(true)) {
|
if (nxs_file->IsValid(false)) {
|
||||||
nxs_file->Dump();
|
nxs_file->Dump();
|
||||||
|
|
||||||
if (argc == 5) {
|
if (argc == 5) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user