add Red/Green mode handling for NeXus HDF5 IDF V2. See also the musrfit docu.
Build and Deploy Documentation / build-and-deploy (push) Successful in 32s
Build and Deploy Documentation / build-and-deploy (push) Successful in 32s
This commit is contained in:
@@ -865,7 +865,7 @@ Bool_t PRunDataHandler::ReadNexusFileIdf2(T& nxs_file)
|
||||
|
||||
// data with its metadata
|
||||
if (nxs_file->HasDataset("/raw_data_1/instrument/detector_1/counts")) {
|
||||
int t0_bin{-1}, fgb{-1}, lgb{-1}, noOfHistos{-1}, histoLength{-1};
|
||||
int t0_bin{-1}, fgb{-1}, lgb{-1}, noOfPeriods{-1}, noOfHistos{-1}, histoLength{-1};
|
||||
auto count_ds = nxs_file->template GetDataset<int>("/raw_data_1/instrument/detector_1/counts");
|
||||
auto count = count_ds.GetData();
|
||||
auto dims = count_ds.GetDimensions();
|
||||
@@ -873,6 +873,7 @@ Bool_t PRunDataHandler::ReadNexusFileIdf2(T& nxs_file)
|
||||
std::cerr << std::endl << "**ERROR** PNeXus data dimension error! dims.size()=" << dims.size() << ", expecting == 3." << std::endl;
|
||||
return false;
|
||||
}
|
||||
noOfPeriods = dims[0];
|
||||
noOfHistos = dims[1];
|
||||
histoLength = dims[2];
|
||||
// get all necessary attributes
|
||||
@@ -882,24 +883,26 @@ Bool_t PRunDataHandler::ReadNexusFileIdf2(T& nxs_file)
|
||||
fgb = std::any_cast<int>(count_ds.GetAttribute("first_good_bin"));
|
||||
if (count_ds.HasAttribute("last_good_bin"))
|
||||
lgb = std::any_cast<int>(count_ds.GetAttribute("last_good_bin"));
|
||||
if (static_cast<int>(count.size()) != noOfHistos*histoLength) {
|
||||
std::cerr << std::endl << "**ERROR** PNeXus data size error! count.size()=" << count.size() << ", #histos=" << noOfHistos << ", length=" << histoLength << "." << std::endl;
|
||||
if (static_cast<int>(count.size()) != noOfPeriods*noOfHistos*histoLength) {
|
||||
std::cerr << std::endl << "**ERROR** PNeXus data size error! count.size()=" << count.size() << ", #periods=" << noOfPeriods << ", #histos=" << noOfHistos << ", length=" << histoLength << "." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// fill dataSet
|
||||
PDoubleVector data;
|
||||
for (int i=0; i<noOfHistos; i++) {
|
||||
dataSet.Clear();
|
||||
dataSet.SetHistoNo(i+1); // i.e. histo numbers start with 1
|
||||
dataSet.SetTimeZeroBin(t0_bin);
|
||||
dataSet.SetFirstGoodBin(fgb);
|
||||
dataSet.SetLastGoodBin(lgb);
|
||||
for (int j=0; j<histoLength; j++)
|
||||
data.push_back(count[i*histoLength+j]);
|
||||
dataSet.SetData(data);
|
||||
runData.SetDataSet(dataSet);
|
||||
data.clear();
|
||||
for (int i=0; i<noOfPeriods; i++) {
|
||||
for (int j=0; j<noOfHistos; j++) {
|
||||
dataSet.Clear();
|
||||
dataSet.SetHistoNo(i*10000+j+1); // i.e. histo numbers start with 1
|
||||
dataSet.SetTimeZeroBin(t0_bin);
|
||||
dataSet.SetFirstGoodBin(fgb);
|
||||
dataSet.SetLastGoodBin(lgb);
|
||||
for (int k=0; k<histoLength; k++)
|
||||
data.push_back(count[i*noOfHistos*histoLength+j*histoLength+k]);
|
||||
dataSet.SetData(data);
|
||||
runData.SetDataSet(dataSet);
|
||||
data.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// keep run name from the msr-file
|
||||
|
||||
Reference in New Issue
Block a user