42 objectName.erase(objectName.begin(), std::find_if(objectName.begin(), objectName.end(), [](
unsigned char ch) {
81 Int_t previousErrorLevel = gErrorIgnoreLevel;
82 gErrorIgnoreLevel = kFatal;
83 auto* dh = o2::header::get<o2::header::DataHeader*>(
ref.header);
84 const char* buff =
const_cast<char*
>(
ref.payload);
85 size_t flSize = dh->payloadSize;
87 constexpr char FlatHeaderAnnot[] =
"$HEADER$";
88 constexpr int Offset =
sizeof(
int) +
sizeof(FlatHeaderAnnot);
90 LOGP(
debug,
"DHPayloadSize={}>{} Ref:{}/{} Cmp {}:{}", dh->payloadSize, Offset, dh->dataOrigin.as<std::string>(), dh->dataDescription.as<std::string>(), std::string{buff + dh->payloadSize - sizeof(FlatHeaderAnnot)}, std::string{FlatHeaderAnnot});
92 if (dh->payloadSize >= Offset &&
93 !std::strncmp(buff + dh->payloadSize -
sizeof(FlatHeaderAnnot), FlatHeaderAnnot,
sizeof(FlatHeaderAnnot))) {
94 headerSize = *
reinterpret_cast<const int*
>(buff + dh->payloadSize - Offset);
97 LOGP(fatal,
"Anomalous flattened header size {} extracted for CCDB object {}/{}", headerSize, dh->dataOrigin.as<std::string>(), dh->dataDescription.as<std::string>());
99 TMemFile memFile(
"name",
const_cast<char*
>(
ref.payload), dh->payloadSize - headerSize,
"READ");
100 gErrorIgnoreLevel = previousErrorLevel;
101 if (memFile.IsZombie()) {
105 TClass* tcl = TClass::GetClass(tinfo);
106 result = extractFromTFile(memFile, tcl,
"ccdb_object");
108 throw runtime_error_f(
"Couldn't retrieve object corresponding to %s from TFile", tcl->GetName());
116 auto* dh = o2::header::get<o2::header::DataHeader*>(
ref.header);
117 const char* buff =
const_cast<char*
>(
ref.payload);
119 constexpr char FlatHeaderAnnot[] =
"$HEADER$";
120 constexpr int Offset =
sizeof(
int) +
sizeof(FlatHeaderAnnot);
121 int headerSize = 0, ss0 = 0;
122 std::map<std::string, std::string>
res;
123 if (dh->payloadSize >= Offset && !std::strncmp(buff + dh->payloadSize -
sizeof(FlatHeaderAnnot), FlatHeaderAnnot,
sizeof(FlatHeaderAnnot))) {
124 headerSize = *
reinterpret_cast<const int*
>(buff + dh->payloadSize - Offset);
126 LOGP(warn,
"CCDB headers were not added to condition object blob, returning dummy header map");
130 if (headerSize < 0) {
131 LOGP(fatal,
"Anomalous flattened header size {} extracted for CCDB object {}/{}", headerSize, dh->dataOrigin.as<std::string>(), dh->dataDescription.as<std::string>());
134 buff += dh->payloadSize - headerSize;
135 headerSize -= Offset;
136 const char* str0 = &buff[ss0++];
137 while (ss0 < headerSize) {
138 if (buff[ss0++] == 0) {
142 res.emplace(std::string(str0), std::string(&buff[ss0]));
143 LOGP(
debug,
"Header{} {}:{}",
res.size(), std::string(str0), std::string(&buff[ss0]));