154 if (nbytes == 0 ||
m_token.empty()) {
155 return(StatusCode::SUCCESS);
157 ATH_MSG_INFO(
"AthenaHDFStreamTool::putObject: source = " <<
source <<
", nbytes = " << nbytes);
159 if (
m_token.find(
"[CONT=") != std::string::npos)
m_token.replace(
m_token.find(
"[CONT="), 6,
"[CNT=");
161 stringBefore(ds_name,
']');
162 while (ds_name.find(
"/") != std::string::npos) { ds_name = ds_name.replace(ds_name.find(
"/"), 1,
"_"); }
168 long long unsigned int positionCount = 0;
169 if (
m_token.find(
"[CLID=") == std::string::npos) {
173 sprintf(
text, fmt_aux, nbytes);
177 positionCount =
offset[0];
178 const hsize_t ds_size[1] = {
offset[0] + 15};
180 H5::DataSpace filespace =
dataset.getSpace();
181 const hsize_t mem_size[1] = {15};
182 filespace.selectHyperslab(H5S_SELECT_SET, mem_size,
offset);
183 H5::DataSpace memspace(1, mem_size);
184 dataset.write(
text, H5::PredType::NATIVE_CHAR, memspace, filespace);
188 if (!
m_group->exists(ds_name)) {
189 const hsize_t maxdim[1] = {H5S_UNLIMITED};
190 const hsize_t ds_size[1] = {nbytes};
191 H5::DataSpace filespace(1, ds_size, maxdim);
192 H5::DSetCreatPropList ds_prop;
193 hsize_t chunkdim[1] = {nbytes};
198 }
else if (nbytes < 16 * 512) {
199 chunkdim[0] = 4 * 4096;
201 chunkdim[0] = (
int(nbytes / 4096) + 1) * 4096;
204 ds_prop.setChunk(1, chunkdim);
205 char fill_val[1] = {0};
206 ds_prop.setFillValue(H5::PredType::NATIVE_CHAR, fill_val);
207 H5::DataSet
dataset =
m_group->createDataSet(ds_name, H5::PredType::NATIVE_CHAR, filespace, ds_prop);
212 positionCount =
offset[0];
213 const hsize_t ds_size[1] = {
offset[0] + nbytes};
215 H5::DataSpace filespace =
dataset.getSpace();
216 const hsize_t mem_size[1] = {nbytes};
217 filespace.selectHyperslab(H5S_SELECT_SET, mem_size,
offset);
218 H5::DataSpace memspace(1, mem_size);
219 dataset.write(
source, H5::PredType::NATIVE_CHAR, memspace, filespace);
221 if (
m_token.find(
"[OID=") == std::string::npos) {
223 sprintf(
text, fmt_oid, 0
ul, nbytes, positionCount);
228 std::size_t firstU, firstL;
229 long long unsigned int second;
230 ::sscanf(
m_token.substr(
m_token.find(
"[OID="), 40).c_str(), fmt_oid, &firstU, &firstL, &
second);
234 firstL = positionCount + nbytes -
second;
235 sprintf(
text, fmt_oid, firstU, firstL,
second);
240 std::string entry_name = ds_name.substr(ds_name.find(
'(') + 1);
241 stringBefore(entry_name,
')');
243 if (entry_name ==
"DataHeader" || entry_name ==
"DataHeaderForm") {
244 auto dh_entry = ds_name +
"_entry";
245 if (!
m_group->exists(dh_entry)) {
246 const hsize_t maxdim[1] = {H5S_UNLIMITED};
247 const hsize_t ds_size[1] = {2};
248 H5::DataSpace filespace(1, ds_size, maxdim);
249 H5::DSetCreatPropList ds_prop;
250 const hsize_t chunkdim[1] = {512};
251 ds_prop.setChunk(1, chunkdim);
252 char fill_val[1] = {0};
253 ds_prop.setFillValue(H5::PredType::NATIVE_ULLONG, fill_val);
254 H5::DataSet
dataset =
m_group->createDataSet(dh_entry, H5::PredType::NATIVE_ULLONG, filespace, ds_prop);
255 long long unsigned int ds_data[2] = {positionCount, positionCount + nbytes};
256 dataset.write(ds_data, H5::PredType::NATIVE_ULLONG);
260 const hsize_t ds_size[1] = {
offset[0] + 1};
262 H5::DataSpace filespace =
dataset.getSpace();
263 const hsize_t mem_size[1] = {1};
264 filespace.selectHyperslab(H5S_SELECT_SET, mem_size,
offset);
265 H5::DataSpace memspace(1, mem_size);
266 long long unsigned int ds_data[1] = {positionCount + nbytes};
267 dataset.write(ds_data, H5::PredType::NATIVE_ULLONG, memspace, filespace);
269 if (entry_name ==
"DataHeader") {
270 auto dh_form_entry = ds_name +
"_form_entry";
271 if (!
m_group->exists(dh_form_entry)) {
272 const hsize_t maxdim[1] = {H5S_UNLIMITED};
273 const hsize_t ds_size[1] = {1};
274 H5::DataSpace filespace(1, ds_size, maxdim);
275 H5::DSetCreatPropList ds_prop;
276 const hsize_t chunkdim[1] = {512};
277 ds_prop.setChunk(1, chunkdim);
278 char fill_val[1] = {0};
279 ds_prop.setFillValue(H5::PredType::NATIVE_ULLONG, fill_val);
280 H5::DataSet
dataset =
m_group->createDataSet(dh_form_entry, H5::PredType::NATIVE_ULLONG, filespace, ds_prop);
281 long long unsigned int ds_data[1] = {0};
282 dataset.write(ds_data, H5::PredType::NATIVE_ULLONG);
286 const hsize_t ds_size[1] = {
offset[0] + 1};
288 H5::DataSpace filespace =
dataset.getSpace();
289 const hsize_t mem_size[1] = {1};
290 filespace.selectHyperslab(H5S_SELECT_SET, mem_size,
offset);
291 H5::DataSpace memspace(1, mem_size);
292 auto dh_form_entry_name = ds_name.substr(0, ds_name.find(
'(')) +
"Form(DataHeaderForm)_entry";
293 H5::DataSet dh_form_dataset =
m_group->openDataSet(dh_form_entry_name);
294 long long unsigned int ds_data[1] = {dh_form_dataset.getInMemDataSize()/8 - 1};
295 dataset.write(ds_data, H5::PredType::NATIVE_ULLONG, memspace, filespace);
298 if (entry_name ==
"DataHeaderForm") {
299 auto dh_entry_name = ds_name.substr(0, ds_name.find(
'(') - 4) +
"(DataHeader)_form_entry";
301 const hsize_t
offset[1] = {
dataset.getInMemDataSize()/8 - 1};
302 H5::DataSpace filespace =
dataset.getSpace();
303 const hsize_t mem_size[1] = {1};
304 filespace.selectHyperslab(H5S_SELECT_SET, mem_size,
offset);
305 H5::DataSpace memspace(1, mem_size);
306 H5::DataSet dh_form_dataset =
m_group->openDataSet(ds_name +
"_entry");
307 long long unsigned int ds_data[1] = {dh_form_dataset.getInMemDataSize()/8 - 1};
308 dataset.write(ds_data, H5::PredType::NATIVE_ULLONG, memspace, filespace);
311 return(StatusCode::SUCCESS);