first full version for HDF5 IDF V1 write.
This commit is contained in:
@@ -4833,15 +4833,20 @@ Bool_t PRunDataHandler::WriteNexusFile(TString format, TString fln)
|
|||||||
if (fAny2ManyInfo->idf == 1) { // IDF V1
|
if (fAny2ManyInfo->idf == 1) { // IDF V1
|
||||||
// set NeXus version
|
// set NeXus version
|
||||||
nxs->AddGroupAttribute("/", "NeXus_version", std::string("4.3.0"));
|
nxs->AddGroupAttribute("/", "NeXus_version", std::string("4.3.0"));
|
||||||
|
|
||||||
// set HDF5 version
|
// set HDF5 version
|
||||||
nxs->AddGroupAttribute("/", "HDF_version", nxs->GetHdf5LibVersion());
|
nxs->AddGroupAttribute("/", "HDF_version", nxs->GetHdf5LibVersion());
|
||||||
|
|
||||||
// set file name
|
// set file name
|
||||||
nxs->AddGroupAttribute("/", "file_name", std::string(fln.Data()));
|
nxs->AddGroupAttribute("/", "file_name", std::string(fln.Data()));
|
||||||
|
|
||||||
// set creation time
|
// set creation time
|
||||||
std::string dt = nxs::getIso8601TimestampLocal();
|
std::string dt = nxs::getIso8601TimestampLocal();
|
||||||
nxs->AddGroupAttribute("/", "file_time", dt);
|
nxs->AddGroupAttribute("/", "file_time", dt);
|
||||||
|
|
||||||
// set IDF version
|
// set IDF version
|
||||||
nxs->AddDataset<int>("/run/IDF_version", {(int)fAny2ManyInfo->idf}, {1}, H5::PredType::NATIVE_INT32);
|
nxs->AddDataset<int>("/run/IDF_version", {(int)fAny2ManyInfo->idf}, {1}, H5::PredType::NATIVE_INT32);
|
||||||
|
|
||||||
// set program name
|
// set program name
|
||||||
nxs->AddDataset<std::string>("/run/program_name", {"any2many"}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/program_name", {"any2many"}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
str="n/a";
|
str="n/a";
|
||||||
@@ -4849,56 +4854,77 @@ Bool_t PRunDataHandler::WriteNexusFile(TString format, TString fln)
|
|||||||
str = PACKAGE_VERSION;
|
str = PACKAGE_VERSION;
|
||||||
#endif
|
#endif
|
||||||
nxs->AddDatasetAttribute<std::string>("/run/program_name", "version", str);
|
nxs->AddDatasetAttribute<std::string>("/run/program_name", "version", str);
|
||||||
|
|
||||||
// set run number
|
// set run number
|
||||||
nxs->AddDataset<int>("/run/number", {fData[0].GetRunNumber()}, {1}, H5::PredType::NATIVE_INT32);
|
nxs->AddDataset<int>("/run/number", {fData[0].GetRunNumber()}, {1}, H5::PredType::NATIVE_INT32);
|
||||||
|
|
||||||
// set title
|
// set title
|
||||||
nxs->AddDataset<std::string>("/run/title", {fData[0].GetRunTitle()->Data()}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/title", {fData[0].GetRunTitle()->Data()}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set notes
|
// set notes
|
||||||
nxs->AddDataset<std::string>("/run/notes", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/notes", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set analysis
|
// set analysis
|
||||||
nxs->AddDataset<std::string>("/run/notes", {std::string("muonTD")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/notes", {std::string("muonTD")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set lab
|
// set lab
|
||||||
str = *fData[0].GetLaboratory();
|
str = *fData[0].GetLaboratory();
|
||||||
nxs->AddDataset<std::string>("/run/lab", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/lab", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set beamline
|
// set beamline
|
||||||
str = *fData[0].GetBeamline();
|
str = *fData[0].GetBeamline();
|
||||||
nxs->AddDataset<std::string>("/run/beamline", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/beamline", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set start time
|
// set start time
|
||||||
str = std::string(fData[0].GetStartDate()->Data()) + std::string("T") + std::string(fData[0].GetStartTime()->Data());
|
str = std::string(fData[0].GetStartDate()->Data()) + std::string("T") + std::string(fData[0].GetStartTime()->Data());
|
||||||
nxs->AddDataset<std::string>("/run/start_time", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/start_time", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set stop time
|
// set stop time
|
||||||
str = std::string(fData[0].GetStopDate()->Data()) + std::string("T") + std::string(fData[0].GetStopTime()->Data());
|
str = std::string(fData[0].GetStopDate()->Data()) + std::string("T") + std::string(fData[0].GetStopTime()->Data());
|
||||||
nxs->AddDataset<std::string>("/run/stop_time", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/stop_time", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set switching state
|
// set switching state
|
||||||
nxs->AddDataset<int>("/run/switching_states", {1}, {1}, H5::PredType::NATIVE_INT32);
|
nxs->AddDataset<int>("/run/switching_states", {1}, {1}, H5::PredType::NATIVE_INT32);
|
||||||
|
|
||||||
// set user name
|
// set user name
|
||||||
nxs->AddDataset<std::string>("/run/user/name", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/user/name", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set user experiment_number
|
// set user experiment_number
|
||||||
nxs->AddDataset<std::string>("/run/user/experiment_number", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/user/experiment_number", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set sample name
|
// set sample name
|
||||||
nxs->AddDataset<std::string>("/run/sample/name", {fData[0].GetSample()->Data()}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/sample/name", {fData[0].GetSample()->Data()}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set sample temperature
|
// set sample temperature
|
||||||
nxs->AddDataset<float>("/run/sample/temperature", {(float)fData[0].GetTemperature(0)}, {1}, H5::PredType::NATIVE_FLOAT);
|
nxs->AddDataset<float>("/run/sample/temperature", {(float)fData[0].GetTemperature(0)}, {1}, H5::PredType::NATIVE_FLOAT);
|
||||||
nxs->AddDatasetAttribute<float>("/run/sample/temperature", "units", std::string("Kelvin"));
|
nxs->AddDatasetAttribute<float>("/run/sample/temperature", "units", std::string("Kelvin"));
|
||||||
|
|
||||||
// set magnetic field
|
// set magnetic field
|
||||||
nxs->AddDataset<float>("/run/sample/magnetic_field", {(float)fData[0].GetField()}, {1}, H5::PredType::NATIVE_FLOAT);
|
nxs->AddDataset<float>("/run/sample/magnetic_field", {(float)fData[0].GetField()}, {1}, H5::PredType::NATIVE_FLOAT);
|
||||||
nxs->AddDatasetAttribute<float>("/run/sample/magnetic_field", "units", std::string("Gauss"));
|
nxs->AddDatasetAttribute<float>("/run/sample/magnetic_field", "units", std::string("Gauss"));
|
||||||
|
|
||||||
// set sample environment
|
// set sample environment
|
||||||
nxs->AddDataset<std::string>("/run/sample/environment", {fData[0].GetSetup()->Data()}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/sample/environment", {fData[0].GetSetup()->Data()}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set sample shape
|
// set sample shape
|
||||||
nxs->AddDataset<std::string>("/run/sample/shape", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/sample/shape", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set magnetic field vector
|
// set magnetic field vector
|
||||||
nxs->AddDataset<float>("/run/sample/magnetic_field_vector", {1.0, 1.0, 1.0}, {3}, H5::PredType::NATIVE_FLOAT);
|
nxs->AddDataset<float>("/run/sample/magnetic_field_vector", {1.0, 1.0, 1.0}, {3}, H5::PredType::NATIVE_FLOAT);
|
||||||
nxs->AddDatasetAttribute<float>("/run/sample/magnetic_field_vector", "coordinate_system", std::string("cartesian"));
|
nxs->AddDatasetAttribute<float>("/run/sample/magnetic_field_vector", "coordinate_system", std::string("cartesian"));
|
||||||
nxs->AddDatasetAttribute<float>("/run/sample/magnetic_field_vector", "units", std::string("Gauss"));
|
nxs->AddDatasetAttribute<float>("/run/sample/magnetic_field_vector", "units", std::string("Gauss"));
|
||||||
nxs->AddDatasetAttribute<float>("/run/sample/magnetic_field_vector", "available", 0);
|
nxs->AddDatasetAttribute<float>("/run/sample/magnetic_field_vector", "available", 0);
|
||||||
|
|
||||||
// set instrument name
|
// set instrument name
|
||||||
str = *fData[0].GetInstrument();
|
str = *fData[0].GetInstrument();
|
||||||
nxs->AddDataset<std::string>("/run/instrument/name", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/instrument/name", {str}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set instrument number of detectors
|
// set instrument number of detectors
|
||||||
nxs->AddDataset<int>("/run/instrument/detector/number", {(int)fData[0].GetNoOfHistos()}, {1}, H5::PredType::NATIVE_INT32);
|
nxs->AddDataset<int>("/run/instrument/detector/number", {(int)fData[0].GetNoOfHistos()}, {1}, H5::PredType::NATIVE_INT32);
|
||||||
|
|
||||||
// set instrument collimator
|
// set instrument collimator
|
||||||
nxs->AddDataset<std::string>("/run/instrument/collimator/type", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
nxs->AddDataset<std::string>("/run/instrument/collimator/type", {std::string("n/a")}, {1}, H5::StrType(H5::PredType::C_S1, H5T_VARIABLE));
|
||||||
|
|
||||||
// set instrument beam total number of counts in Mev
|
// set instrument beam total number of counts in Mev
|
||||||
// calculate the total number of counts
|
// calculate the total number of counts
|
||||||
double total_counts = 0;
|
double total_counts = 0;
|
||||||
@@ -4916,10 +4942,100 @@ Bool_t PRunDataHandler::WriteNexusFile(TString format, TString fln)
|
|||||||
float total_counts_mev = (float) total_counts / 1.0e6;
|
float total_counts_mev = (float) total_counts / 1.0e6;
|
||||||
nxs->AddDataset<float>("/run/instrument/beam/total_counts", {total_counts_mev}, {1}, H5::PredType::NATIVE_FLOAT);
|
nxs->AddDataset<float>("/run/instrument/beam/total_counts", {total_counts_mev}, {1}, H5::PredType::NATIVE_FLOAT);
|
||||||
nxs->AddDatasetAttribute<float>("/run/instrument/beam/total_counts", "units", std::string("MEv"));
|
nxs->AddDatasetAttribute<float>("/run/instrument/beam/total_counts", "units", std::string("MEv"));
|
||||||
|
|
||||||
// set time resolution (use FLOAT instead of INT)
|
// set time resolution (use FLOAT instead of INT)
|
||||||
float res = (float)(fData[0].GetTimeResolution()*fAny2ManyInfo->rebin*1.0e3);
|
float res = (float)(fData[0].GetTimeResolution()*fAny2ManyInfo->rebin*1.0e3);
|
||||||
nxs->AddDataset<float>("/run/histogram_data_1/resolution", {res}, {1}, H5::PredType::NATIVE_FLOAT);
|
nxs->AddDataset<float>("/run/histogram_data_1/resolution", {res}, {1}, H5::PredType::NATIVE_FLOAT);
|
||||||
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/resolution", "units", std::string("picoseconds"));
|
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/resolution", "units", std::string("picoseconds"));
|
||||||
|
|
||||||
|
// set time zero time to 0. see t0_bin attribute of counts!
|
||||||
|
nxs->AddDataset<int>("/run/histogram_data_1/time_zero", {0}, {1}, H5::PredType::NATIVE_INT32);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/time_zero", "units", std::string("microseconds"));
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/time_zero", "available", 0);
|
||||||
|
|
||||||
|
// set raw_time
|
||||||
|
res = (float)(fData[0].GetTimeResolution()*fAny2ManyInfo->rebin*1.0e-3);
|
||||||
|
dataSet = fData[0].GetDataSet(0, false); // i.e. the false means, that i is the index and NOT the histo number
|
||||||
|
unsigned int length = (int)(dataSet->GetData()->size() / fAny2ManyInfo->rebin);
|
||||||
|
std::vector<float> time;
|
||||||
|
for (unsigned int i=0; i<length; i++)
|
||||||
|
time.push_back(((float)i+0.5)*res);
|
||||||
|
nxs->AddDataset<float>("/run/histogram_data_1/raw_time", time, {length}, H5::PredType::NATIVE_FLOAT);
|
||||||
|
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/raw_time", "axis", 1);
|
||||||
|
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/raw_time", "primary", 0);
|
||||||
|
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/raw_time", "units", std::string("microseconds"));
|
||||||
|
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/raw_time", "available", 0);
|
||||||
|
|
||||||
|
// set corrected_time
|
||||||
|
nxs->AddDataset<float>("/run/histogram_data_1/corrected_time", time, {length}, H5::PredType::NATIVE_FLOAT);
|
||||||
|
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/corrected_time", "axis", 1);
|
||||||
|
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/corrected_time", "units", std::string("microseconds"));
|
||||||
|
nxs->AddDatasetAttribute<float>("/run/histogram_data_1/corrected_time", "available", 0);
|
||||||
|
|
||||||
|
// set grouping
|
||||||
|
std::vector<int> grouping(fData[0].GetNoOfHistos(), 0);
|
||||||
|
nxs->AddDataset<int>("/run/histogram_data_1/grouping", grouping, {grouping.size()}, H5::PredType::NATIVE_INT32);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/grouping", "avaliabe", 0);
|
||||||
|
|
||||||
|
// set alpha
|
||||||
|
int ival=1;
|
||||||
|
nxs->AddDataset<int>("/run/histogram_data_1/alpha", {ival}, {1}, H5::PredType::NATIVE_INT32);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/alpha", "avaliabe", 0);
|
||||||
|
|
||||||
|
// set counts
|
||||||
|
// feed histos
|
||||||
|
PIntVector data;
|
||||||
|
UInt_t size = 0;
|
||||||
|
int noHisto, histoLength;
|
||||||
|
if (fAny2ManyInfo->rebin == 1) {
|
||||||
|
noHisto = fData[0].GetNoOfHistos();
|
||||||
|
for (UInt_t i=0; i<fData[0].GetNoOfHistos(); i++) {
|
||||||
|
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
|
||||||
|
if (dataSet == nullptr) { // something is really wrong
|
||||||
|
std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=" << i << ")";
|
||||||
|
std::cerr << std::endl << ">> something is really wrong!" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
size = dataSet->GetData()->size();
|
||||||
|
histoLength = size;
|
||||||
|
for (UInt_t j=0; j<size; j++) {
|
||||||
|
data.push_back((UInt_t)dataSet->GetData()->at(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // rebin > 1
|
||||||
|
UInt_t dataRebin = 0;
|
||||||
|
UInt_t dataCount = 0;
|
||||||
|
noHisto = fData[0].GetNoOfHistos();
|
||||||
|
for (UInt_t i=0; i<fData[0].GetNoOfHistos(); i++) {
|
||||||
|
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
|
||||||
|
if (dataSet == nullptr) { // something is really wrong
|
||||||
|
std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=" << i << ")";
|
||||||
|
std::cerr << std::endl << ">> something is really wrong!" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
size = dataSet->GetData()->size();
|
||||||
|
dataCount = 0;
|
||||||
|
for (UInt_t j=0; j<size; j++) {
|
||||||
|
if ((j > 0) && (j % fAny2ManyInfo->rebin == 0)) {
|
||||||
|
dataCount++;
|
||||||
|
data.push_back(dataRebin);
|
||||||
|
dataRebin = 0;
|
||||||
|
}
|
||||||
|
dataRebin += static_cast<UInt_t>(dataSet->GetData()->at(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
size = dataCount;
|
||||||
|
}
|
||||||
|
nxs->AddDataset<int>("/run/histogram_data_1/counts", data, {(long unsigned int)noHisto, size}, H5::PredType::NATIVE_INT32);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/counts", "units", std::string("counts"));
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/counts", "signal", 1);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/counts", "number", noHisto);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/counts", "length", size);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/counts", "t0_bin", 0);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/counts", "first_good_bin", 0);
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/counts", "last_good_bin", 0);
|
||||||
|
res = (float)(fData[0].GetTimeResolution()*fAny2ManyInfo->rebin*1.0e3)/2.0;
|
||||||
|
nxs->AddDatasetAttribute<int>("/run/histogram_data_1/counts", "offset", res);
|
||||||
} else { // IDF V2
|
} else { // IDF V2
|
||||||
// set IDF version
|
// set IDF version
|
||||||
nxs->AddDataset<int>("/raw_data_1/IDF_version", {(int)fAny2ManyInfo->idf}, {1}, H5::PredType::NATIVE_INT32);
|
nxs->AddDataset<int>("/raw_data_1/IDF_version", {(int)fAny2ManyInfo->idf}, {1}, H5::PredType::NATIVE_INT32);
|
||||||
@@ -4938,58 +5054,6 @@ Bool_t PRunDataHandler::WriteNexusFile(TString format, TString fln)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* //as35
|
/* //as35
|
||||||
if (fAny2ManyInfo->idf == 1) {
|
|
||||||
// fill necessary data structures
|
|
||||||
|
|
||||||
for (unsigned int i=0; i<fData[0].GetNoOfHistos(); i++) {
|
|
||||||
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
|
|
||||||
nxs->GetEntryIdf1()->GetData()->SetT0(static_cast<Int_t>(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin), i);
|
|
||||||
nxs->GetEntryIdf1()->GetData()->SetFirstGoodBin(static_cast<Int_t>(dataSet->GetFirstGoodBin()/fAny2ManyInfo->rebin), i);
|
|
||||||
nxs->GetEntryIdf1()->GetData()->SetLastGoodBin(static_cast<Int_t>(dataSet->GetLastGoodBin()/fAny2ManyInfo->rebin), i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// feed histos
|
|
||||||
PUIntVector data;
|
|
||||||
UInt_t size = 0;
|
|
||||||
if (fAny2ManyInfo->rebin == 1) {
|
|
||||||
for (UInt_t i=0; i<fData[0].GetNoOfHistos(); i++) {
|
|
||||||
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
|
|
||||||
if (dataSet == nullptr) { // something is really wrong
|
|
||||||
std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=" << i << ")";
|
|
||||||
std::cerr << std::endl << ">> something is really wrong!" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
size = dataSet->GetData()->size();
|
|
||||||
for (UInt_t j=0; j<size; j++) {
|
|
||||||
data.push_back((UInt_t)dataSet->GetData()->at(j));
|
|
||||||
}
|
|
||||||
nxs->GetEntryIdf1()->GetData()->SetHisto(data, i);
|
|
||||||
data.clear();
|
|
||||||
}
|
|
||||||
} else { // rebin > 1
|
|
||||||
UInt_t dataRebin = 0;
|
|
||||||
UInt_t dataCount = 0;
|
|
||||||
for (UInt_t i=0; i<fData[0].GetNoOfHistos(); i++) {
|
|
||||||
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
|
|
||||||
if (dataSet == nullptr) { // something is really wrong
|
|
||||||
std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=" << i << ")";
|
|
||||||
std::cerr << std::endl << ">> something is really wrong!" << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
size = dataSet->GetData()->size();
|
|
||||||
dataCount = 0;
|
|
||||||
for (UInt_t j=0; j<size; j++) {
|
|
||||||
if ((j > 0) && (j % fAny2ManyInfo->rebin == 0)) {
|
|
||||||
dataCount++;
|
|
||||||
data.push_back(dataRebin);
|
|
||||||
dataRebin = 0;
|
|
||||||
}
|
|
||||||
dataRebin += static_cast<UInt_t>(dataSet->GetData()->at(j));
|
|
||||||
}
|
|
||||||
nxs->GetEntryIdf1()->GetData()->SetHisto(data, i);
|
|
||||||
data.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (fAny2ManyInfo->idf == 2) {
|
} else if (fAny2ManyInfo->idf == 2) {
|
||||||
// fill necessary data structures
|
// fill necessary data structures
|
||||||
nxs->SetFileName(fln.Data());
|
nxs->SetFileName(fln.Data());
|
||||||
|
|||||||
Reference in New Issue
Block a user