ATLAS Offline Software
Loading...
Searching...
No Matches
CoralCrestManager Class Reference

#include <CoralCrestManager.h>

Collaboration diagram for CoralCrestManager:

Public Member Functions

 CoralCrestManager (const std::string &crest_path, const std::string &crestTag)
void loadTagInfo ()
std::string getFolderDescription ()
Crest::TagDto & getTagDto ()
std::string getPayloadSpec ()
IOVDbNamespace::FolderType determineFolderType ()
std::pair< std::vector< cool::ChannelId >, std::vector< std::string > > getChannelList ()
Crest::TagInfoDto getTagInfoDto ()
bool isVectorPayload ()
coral::AttributeListSpecification * getAttributeListSpec ()
std::vector< std::pair< cool::ValidityKey, std::string > > getIovsForTag (uint64_t since, uint64_t until)
std::vector< uint64_t > loadPayloadForHash (uint64_t since, const std::string &hash)
std::vector< coral::AttributeList > getVectorPayload (coral::AttributeListSpecification *pSpec, const std::string &chId)
std::string dumpPayload (cool::ValidityKey since)
coral::AttributeList getPayload (coral::AttributeListSpecification *pSpec, const std::string &chId)
void selectIov (cool::ValidityKey since)
std::vector< std::string > channelIds (cool::ValidityKey since)

Static Public Member Functions

static std::map< std::string, std::string > getGlobalTagMap (const std::string &crest_path, const std::string &globaltag)

Static Public Attributes

static const std::string prefix1 {"http://"}
static const std::string prefix2 {"https://"}

Private Member Functions

std::string parseTypeName (const std::string &description)
coral::AttributeList createAttributeList (coral::AttributeListSpecification *pSpec, chai::Values &row)
std::pair< uint64_t, uint64_t > getIovInterval (const std::string &tag, const uint64_t since, const uint64_t until)
std::pair< uint64_t, uint64_t > getSinceUntilPair (std::vector< uint64_t > &v, const uint64_t since, const uint64_t until)
void initChaiContainer ()

Private Attributes

std::unique_ptr< Crest::CrestApiBase > m_crestCl
const std::string m_crestTag
std::optional< Crest::TagMetaDto > m_TagMeta
std::optional< Crest::TagDto > m_Tag
std::optional< bool > m_isVectorPayload
std::optional< std::map< uint64_t, chai::ContainerBasePtr > > m_chai_cont
cool::ValidityKey m_since
Crest::ModeId m_id

Detailed Description

Definition at line 41 of file CoralCrestManager.h.

Constructor & Destructor Documentation

◆ CoralCrestManager()

CoralCrestManager::CoralCrestManager ( const std::string & crest_path,
const std::string & crestTag )

Definition at line 67 of file CoralCrestManager.cxx.

67 :m_crestTag(crestTag),m_id(Crest::ModeId::Standard){ //AthMessaging("CoralCrestManager")
68 if(crest_path.length()==0)
69 return;
70 if (crest_path.starts_with(CoralCrestManager::prefix1) || crest_path.starts_with(CoralCrestManager::prefix2)){
71 m_crestCl = std::make_unique<Crest::CrestApi>(Crest::CrestApi(crest_path));
72 }
73 else{
74 m_crestCl = std::make_unique<Crest::CrestApiFs>(Crest::CrestApiFs(false,crest_path));
75 }
76 }
static const std::string prefix1
std::unique_ptr< Crest::CrestApiBase > m_crestCl
static const std::string prefix2
const std::string m_crestTag

Member Function Documentation

◆ channelIds()

std::vector< std::string > CoralCrestManager::channelIds ( cool::ValidityKey since)

Definition at line 455 of file CoralCrestManager.cxx.

455 {
456 selectIov(since);
457 std::vector<std::string> chIds;
458 std::vector<uint64_t> channels;
459 chai::ContainerBasePtr cont=m_chai_cont->operator[](since);
460 if(cont==nullptr)
461 return chIds;
462 if(chai::Container* v = dynamic_cast<chai::Container*>(cont.get()))
463 channels=v->channelIds();
464 else if(chai::VectorContainer* v = dynamic_cast<chai::VectorContainer*>(cont.get()))
465 channels=v->channelIds();
466 //channels=cont->channelSpec().ids();
467 /*if(isVectorPayload()){
468 ContainerBasePtr cont=m_chai_cont->getVectorContainer(since);
469 if(cont==nullptr)
470 return chIds;
471 channels = cont->channelIds();
472 }
473 else{
474 chai::ConstContainerPtr cont=m_chai_cont->getContainer(since);
475 if(cont==nullptr)
476 return chIds;
477 channels = cont->channelIds(); ;
478 }*/
479 for (auto id : channels) {
480 //if(cont.get()->at(id).size()==0)
481 //continue;
482 chIds.push_back(std::to_string(id));
483 }
484 return chIds;
485 }
std::optional< std::map< uint64_t, chai::ContainerBasePtr > > m_chai_cont
void selectIov(cool::ValidityKey since)

◆ createAttributeList()

coral::AttributeList CoralCrestManager::createAttributeList ( coral::AttributeListSpecification * pSpec,
chai::Values & row )
private

Definition at line 487 of file CoralCrestManager.cxx.

487 {
488 coral::AttributeList attr(*pSpec,true);
489 unsigned int s=attr.size();
490 for (unsigned int i(0);i!=s;++i){
491 //cool::Record does not provide non-const access to AttributeList.
492 // But this is safe because we are filling a local instance.
493 auto & att ATLAS_THREAD_SAFE = const_cast<coral::Attribute&>(attr[i]);
494 if (row.isNull(i)){
495 att.setNull();
496 continue;
497 }
498 chai::Type type = row.type(att.specification().name());
499 switch (type) {
500 case chai::Bool:
501 {
502 att.setValue<bool>(row.get<bool>(att.specification().name()));
503 break;
504 }
505 case chai::Int8:
506 {
507 att.setValue<char>(row.get<int8_t>(att.specification().name()));
508 break;
509 }
510 case chai::UInt8:
511 {
512 att.setValue<unsigned char>(row.get<uint8_t>(att.specification().name()));
513 break;
514 }
515 case chai::UInt16:
516 {
517 att.setValue<unsigned short>(row.get<uint16_t>(att.specification().name()));
518 break;
519 }
520 case chai::Int16:
521 {
522 att.setValue<short>(row.get<int16_t>(att.specification().name()));
523 break;
524 }
525 case chai::UInt32:
526 {
527 att.setValue<unsigned int>(row.get<uint32_t>(att.specification().name()));
528 break;
529 }
530 case chai::Int32:
531 {
532 att.setValue<int>(row.get<int32_t>(att.specification().name()));
533 break;
534 }
535 case chai::UInt64:
536 {
537 att.setValue<unsigned long long>(row.get<uint64_t>(att.specification().name()));
538 break;
539 }
540 case chai::Int64:
541 {
542 att.setValue<long long>(row.get<int64_t>(att.specification().name()));
543 break;
544 }
545 case chai::Float:
546 {
547 att.setValue<float>(row.get<float>(att.specification().name()));
548 break;
549 }
550 case chai::Double:
551 {
552 att.setValue<double>(row.get<double>(att.specification().name()));
553 break;
554 }
555 case chai::String:
556 {
557 att.setValue<std::string>(row.get<std::string>(att.specification().name()));
558 break;
559 }
560 case chai::Blob:
561 {
562 const auto &charVec = row.get<chai::BlobData>(att.specification().name()).m_bytes;//CxxUtils::base64_decode(strVal);
563 coral::Blob blob(charVec.size());
564 memcpy(blob.startingAddress(), charVec.data(), charVec.size());
565 att.setValue<coral::Blob>(blob);
566 break;
567 }
568 case chai::Unknown:
569 {
570 std::string errorMessage("UNTREATED TYPE! " + std::to_string(type));
571 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
572 gLog << MSG::ERROR << "LoadPayloadForHash:" <<errorMessage<<endmsg;
573 throw std::runtime_error(errorMessage);
574 }
575 }
576 }
577 return attr;
578 }
#define endmsg
#define ATLAS_THREAD_SAFE
IMessageSvc * getMessageSvc(bool quiet=false)
row
Appending html table to final .html summary file.
setScaleOne setStatusOne setSaturated int16_t
setWord1 uint16_t
setEventNumber uint32_t

◆ determineFolderType()

IOVDbNamespace::FolderType CoralCrestManager::determineFolderType ( )

Definition at line 107 of file CoralCrestManager.cxx.

107 {
108 Crest::TagInfoDto info = getTagInfoDto();
109 std::string folderDescription = info.getFolderDescription();
110 if (folderDescription.find("<coracool>") != std::string::npos) return IOVDbNamespace::CoraCool;
111 const std::string typeName = parseTypeName(folderDescription);
112 if (typeName=="CondAttrListVec"){
113 m_isVectorPayload = true;
115 }
116 m_isVectorPayload = false;
117 std::vector< std::pair<std::string,std::string> > spec= info.getPayloadSpec().getColumns();
118 std::vector< std::pair<std::string,std::string> > chs = info.getChannels().getChannels();
119 for (auto &p : spec){
120 // Match on any string width: a POOL reference is String4k in COOL, but a CREST
121 // payload spec may name the type generically as "String".
122 if(p.first=="PoolRef" && chai::typeFromString(p.second)==chai::String){
123 int id=std::stoll(chs[0].first);
124 if(chs.size()==1 && id==0)
126 else
128 }
129 }
130 if (typeName == "CondAttrListCollection") return IOVDbNamespace::AttrListColl;
132 }
std::optional< bool > m_isVectorPayload
std::string parseTypeName(const std::string &description)
Crest::TagInfoDto getTagInfoDto()

◆ dumpPayload()

std::string CoralCrestManager::dumpPayload ( cool::ValidityKey since)

Definition at line 361 of file CoralCrestManager.cxx.

361 {
362 std::vector<std::string> chIds=channelIds(since);
364 std::stringstream res;
365 res<<"[";
366 auto* pspec=getAttributeListSpec();
367 std::string sep="";
368 for (auto &ch : chIds){
369 res<<sep;
370 res<<IOVDbNamespace::s_openJson<<"\""<<ch<<"\" : ";
371 switch (ftype){
373 {
374 std::vector<coral::AttributeList> attr=getVectorPayload(pspec,ch);
375 res<<"[";
376 std::string sep2="";
377 for (const auto & vitr:attr){
379 if (sep2.empty()) sep2 =IOVDbNamespace::s_delimiterJson;
380 }
381 res<<"]";
382 break;
383 }
387 {
388 coral::AttributeList attr=getPayload(pspec,ch);
390 break;
391 }
393 {
394 coral::AttributeList attr=getPayload(pspec,ch);
395 std::ostringstream os;
396 attr[0].toOutputStream(os);
397 auto str=os.str();
398 const auto separatorPosition = str.find(colonDelimiter);
399 const std::string payloadOnly=str.substr(separatorPosition+3);
400 res<<"\""<<payloadOnly<<"\"";
401 break;
402 }
404 res<< " CoraCool";
405 break;
406 default:
407 res<<" a_data_value";
408 }
409 if (sep.empty()) sep=",";
411 }
412 res<<"]";
413 pspec->release();
414 return res.str();
415 }
std::pair< std::vector< unsigned int >, bool > res
std::vector< std::string > channelIds(cool::ValidityKey since)
IOVDbNamespace::FolderType determineFolderType()
std::vector< coral::AttributeList > getVectorPayload(coral::AttributeListSpecification *pSpec, const std::string &chId)
coral::AttributeList getPayload(coral::AttributeListSpecification *pSpec, const std::string &chId)
coral::AttributeListSpecification * getAttributeListSpec()
std::string jsonAttributeList(const coral::AttributeList &atrlist)
Produce a representation of a coral::AttributeList as a json string.
static const std::string s_delimiterJson
json standard delimiter ', '
static const std::string s_closeJson
json close tag, '}'
static const std::string s_openJson
json open tag, '{'

◆ getAttributeListSpec()

coral::AttributeListSpecification * CoralCrestManager::getAttributeListSpec ( )

Definition at line 190 of file CoralCrestManager.cxx.

190 {
191 Crest::TagInfoDto info = getTagInfoDto();
192 std::vector< std::pair<std::string,std::string> > spec_vec= info.getPayloadSpec().getColumns();
193 auto * spec = new coral::AttributeListSpecification();
194 for (auto &p : spec_vec){
195 const std::type_info * coralType = coralTypeFor(chai::typeFromString(p.second));
196 if (coralType == nullptr){
197 // Skipping the column instead would leave an AttributeList missing a field that
198 // the consuming algorithm looks up by name, which surfaces far downstream as an
199 // opaque CORAL "variable does not exist" error. Fail at the source instead.
200 spec->release();
201 const std::string errorMessage("Unsupported type \"" + p.second + "\" for payload spec column \"" + p.first + "\" of CREST tag " + m_crestTag);
202 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
203 gLog << MSG::ERROR << "getAttributeListSpec: " << errorMessage << endmsg;
204 throw std::runtime_error(errorMessage);
205 }
206 spec->extend(p.first,*coralType);
207 }
208 return spec;
209 }

◆ getChannelList()

std::pair< std::vector< cool::ChannelId >, std::vector< std::string > > CoralCrestManager::getChannelList ( )

Definition at line 176 of file CoralCrestManager.cxx.

176 {
177 if(!m_TagMeta.has_value())
178 loadTagInfo();
179 Crest::TagInfoDto info = getTagInfoDto();
180 std::vector<cool::ChannelId> list;
181 std::vector<std::string> names;
182 std::vector< std::pair<std::string,std::string> > res = info.getChannels().getChannels();
183 for (auto &p : res){
184 list.push_back(std::stoll(p.first));
185 names.push_back(p.second);
186 }
187 return std::make_pair(std::move(list), std::move(names));
188 }
std::optional< Crest::TagMetaDto > m_TagMeta
list(name, path='/')
Definition histSizes.py:38

◆ getFolderDescription()

std::string CoralCrestManager::getFolderDescription ( )

Definition at line 171 of file CoralCrestManager.cxx.

171 {
172 Crest::TagInfoDto info = getTagInfoDto();
173 return info.getFolderDescription();
174 }

◆ getGlobalTagMap()

std::map< std::string, std::string > CoralCrestManager::getGlobalTagMap ( const std::string & crest_path,
const std::string & globaltag )
static

Definition at line 78 of file CoralCrestManager.cxx.

78 {
79 std::unique_ptr<Crest::CrestApiBase> crestCl;
80 if (crest_path.starts_with(CoralCrestManager::prefix1) || crest_path.starts_with(CoralCrestManager::prefix2)){
81 crestCl.reset(new Crest::CrestApi(crest_path));
82 }
83 else{
84 crestCl.reset(new Crest::CrestApiFs(true,crest_path));
85 }
86 std::map<std::string, std::string> tagmap;
87 try{
88 Crest::GlobalTagMapSetDto dto = crestCl->findGlobalTagMap(globaltag,"Trace");
89 for (const auto &tagMapDto : dto.getResources()){
90 tagmap[tagMapDto.getLabel()]=tagMapDto.getTagName();
91 }
92 } catch (std::exception & e){
93 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
94 gLog << MSG::ERROR << __FILE__<<":"<<__LINE__<< ": " << e.what() << " Cannot get a global tag map for " << globaltag<<endmsg;
95 }
96 return tagmap;
97 }

◆ getIovInterval()

std::pair< uint64_t, uint64_t > CoralCrestManager::getIovInterval ( const std::string & tag,
const uint64_t since,
const uint64_t until )
private

Definition at line 262 of file CoralCrestManager.cxx.

262 {
263 Crest::IovSetDto dto = m_crestCl->selectGroups(tag, 0, 10000, 0, "id.since:ASC");
264 std::vector<uint64_t> v = dto.getListSince();
265 v.push_back(cool::ValidityKeyMax); // added "infinity" as the last item 9223372036854775807
266 return getSinceUntilPair(v, since, until);
267 }
std::pair< uint64_t, uint64_t > getSinceUntilPair(std::vector< uint64_t > &v, const uint64_t since, const uint64_t until)

◆ getIovsForTag()

std::vector< std::pair< cool::ValidityKey, std::string > > CoralCrestManager::getIovsForTag ( uint64_t since,
uint64_t until )

Definition at line 269 of file CoralCrestManager.cxx.

269 {
271 int iovNumber = m_crestCl->getSize(m_crestTag);
272 std::vector<std::pair<cool::ValidityKey,std::string>> res;
273 Crest::IovSetDto dto;
274 if(iovNumber <=1000){
275 dto = m_crestCl->selectIovs(m_crestTag, 0, -1, 0, 10000, 0, "id.since:ASC");
276 }
277 else{
278 std::pair<uint64_t,uint64_t> ppt = getIovInterval(m_crestTag, since, until);
279 uint64_t s_time = ppt.first;
280 uint64_t u_time = ppt.second;
281
282 if (s_time == 0 && u_time == 0){ // data out of range
283 return res;
284 }
285 else {
286 dto = m_crestCl->selectIovs(m_crestTag, s_time, u_time, 0, 10000, 0, "id.since:ASC");
287 }
288 }
289 for (auto &p : dto.getResources()){
290 res.push_back(std::make_pair((cool::ValidityKey)p.getSince(),p.getPayloadHash()));
291 }
292 return res;
293 }
std::pair< uint64_t, uint64_t > getIovInterval(const std::string &tag, const uint64_t since, const uint64_t until)

◆ getPayload()

coral::AttributeList CoralCrestManager::getPayload ( coral::AttributeListSpecification * pSpec,
const std::string & chId )

Definition at line 416 of file CoralCrestManager.cxx.

416 {
417 chai::ContainerBasePtr cont=m_chai_cont->operator[](m_since);
418 if(cont==nullptr){
419 std::string errorMessage("Timestamp not found! timestamp=" + std::to_string(m_since));
420 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
421 gLog << MSG::ERROR << "getPayload:" <<errorMessage<<endmsg;
422 throw std::runtime_error(errorMessage);
423 }
424 uint64_t id = std::stoul(chId);
425 chai::Container* cont2 = dynamic_cast<chai::Container*>(cont.get());
426 chai::Values& row = cont2->at(id);
427 return createAttributeList(pSpec,row);
428
429 }
coral::AttributeList createAttributeList(coral::AttributeListSpecification *pSpec, chai::Values &row)
cool::ValidityKey m_since

◆ getPayloadSpec()

std::string CoralCrestManager::getPayloadSpec ( )

Definition at line 167 of file CoralCrestManager.cxx.

167 {
168 return getTagInfoDto().getPayloadSpec().toJson().dump();
169 }

◆ getSinceUntilPair()

std::pair< uint64_t, uint64_t > CoralCrestManager::getSinceUntilPair ( std::vector< uint64_t > & v,
const uint64_t since,
const uint64_t until )
private

Definition at line 233 of file CoralCrestManager.cxx.

233 {
234 uint64_t new_since = 0;
235 uint64_t new_until = 0;
236
237 if (until < since){
238 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
239 gLog << MSG::ERROR << "Wrong since/until."<<endmsg;
240 return std::make_pair(0,0);
241 }
242 const std::size_t N = v.size();
243 std::size_t i = 0;
244 for (; i < N; ++i) {
245 if(v[i] <= since && since < v[i+1]){
246 new_since = v[i];
247 break;
248 }
249 }
250
251 for (; i < N; ++i) {
252 if(v[i] < until && until <= v[i+1]){
253 new_until = v[i+1];
254 break;
255 }
256 }
257
258 return std::make_pair(new_since,new_until);
259 }
constexpr std::size_t N

◆ getTagDto()

Crest::TagDto & CoralCrestManager::getTagDto ( )

Definition at line 160 of file CoralCrestManager.cxx.

160 {
161 if(!m_Tag.has_value()){
162 m_Tag = m_crestCl->findTag(m_crestTag);
163 }
164 return m_Tag.value();
165 }
std::optional< Crest::TagDto > m_Tag

◆ getTagInfoDto()

Crest::TagInfoDto CoralCrestManager::getTagInfoDto ( )

Definition at line 154 of file CoralCrestManager.cxx.

154 {
155 if(!m_TagMeta.has_value())
156 loadTagInfo();
157 return m_TagMeta.value().getTagInfoDto();
158 }

◆ getVectorPayload()

std::vector< coral::AttributeList > CoralCrestManager::getVectorPayload ( coral::AttributeListSpecification * pSpec,
const std::string & chId )

Definition at line 431 of file CoralCrestManager.cxx.

431 {
432 std::vector<coral::AttributeList> res;
433 uint64_t id = std::stoul(chId);
434 chai::ContainerBasePtr cont=m_chai_cont->operator[](m_since);
435 if(cont==nullptr){
436 std::string errorMessage("Timestamp not found! timestamp=" + std::to_string(m_since));
437 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
438 gLog << MSG::ERROR << "getPayload:" <<errorMessage<<endmsg;
439 throw std::runtime_error(errorMessage);
440 }
441 chai::VectorContainer* cont2 = dynamic_cast<chai::VectorContainer*>(cont.get());
442 const std::vector<chai::ValuesPtr>& rows = cont2->rows(id);
443 for (auto &row : rows){
444 chai::Values* val = row.get();
445 coral::AttributeList att=createAttributeList(pSpec,*val);
446 res.push_back(att);
447 }
448 return res;
449 }

◆ initChaiContainer()

void CoralCrestManager::initChaiContainer ( )
private

Definition at line 210 of file CoralCrestManager.cxx.

210 {
211 if(m_chai_cont.has_value()){
212 return;
213 }
214 Crest::TagInfoDto info = getTagInfoDto();
215 Crest::TagDto tag = getTagDto();
216 const std::string & objectType = tag.getObjectType();
217 if(objectType=="crest-json-multi-iov-sparse"){
219 }
220 else if(objectType=="crest-json-multi-iov"){
221 // Transitional heuristic, mirroring chai::Tag::initConverterFromObjectType():
222 // a multi-channel block in the unsuffixed format is delta encoded all the same,
223 // so it still needs the sparse converter. Only a single-channel block is dense.
224 // Retire this branch once every such tag in CREST carries the "-sparse" suffix
225 // and the objectType alone is authoritative.
226 const bool multiChannel = info.getChannels().getChannels().size() > 1;
228 }
229 m_chai_cont.emplace();
230 }
Crest::TagDto & getTagDto()

◆ isVectorPayload()

bool CoralCrestManager::isVectorPayload ( )

Definition at line 134 of file CoralCrestManager.cxx.

134 {
135 if(!m_isVectorPayload.has_value())
137 return m_isVectorPayload.value();
138 }

◆ loadPayloadForHash()

std::vector< uint64_t > CoralCrestManager::loadPayloadForHash ( uint64_t since,
const std::string & hash )

Definition at line 295 of file CoralCrestManager.cxx.

295 {
297 std::string reply;
298 try{
299 // get payload from Crest server
300 reply = m_crestCl->getPayload(hash);
301 } catch (std::exception & e){
302 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
303 gLog << MSG::ERROR << __FILE__<<":"<<__LINE__<< ": "<<e.what()<<" while trying to find the payload"<<endmsg;
304 throw std::runtime_error(e.what());
305 }
306 try{
307 Crest::TagInfoDto info = getTagInfoDto();
308 nlohmann::json j_spec=info.getPayloadSpec().toJson();
309 nlohmann::json j_chs=info.getChannels().toJson();
310 chai::PayloadSpec chaiSpec(j_spec,j_chs);
311 nlohmann::json j = reply;
312 if (j.is_string()){
313 std::istringstream ss(to_string(j));
314 std::string st;
315 ss >> std::quoted(st);
316 j = json::parse(st);
317 }
320 if(isVectorPayload()){
321 std::shared_ptr<chai::VectorContainer> cont = std::make_shared<chai::VectorContainer>(chai::VectorContainer::fromJson(j,chaiSpec));
322 m_chai_cont->insert(std::pair<uint64_t,chai::ContainerBasePtr>(since,cont));
323 }
324 else{
325 std::shared_ptr<chai::Container> cont = std::make_shared<chai::Container>(chai::Container::fromJson(j,chaiSpec));
326 m_chai_cont->insert(std::pair<uint64_t,chai::ContainerBasePtr>(since,cont));
327 }
328 std::vector<uint64_t> res;
329 res.push_back(m_since);
330 return res;
331 }
332 else{
333 std::unique_ptr<chai::ClobMultiIovConverter> converter;
335 converter = std::make_unique<chai::JsonMultiIovSparseConverter>(chaiSpec);
336 else
337 converter = std::make_unique<chai::JsonMultiIovConverter>(chaiSpec);
338 std::unique_ptr<chai::ContainerMapBase> chai_map_cont = converter->deserialize(j.dump());
339 std::vector<uint64_t> res=chai_map_cont->keys();
340 for(auto const& key: res){
341 chai::ConstContainerPtr const_cont = chai_map_cont->getContainer(key);
342 // Share the map's control block rather than building a second one over the same
343 // object: chai_map_cont is destroyed on leaving this scope, and a shared_ptr built
344 // from the bare pointer would own the Container all over again and free it twice.
345 // Dropping const is safe because every consumer of m_chai_cont only reads. It has
346 // to stay read-only: a sparse block shares its Values between sub-IOVs, so writing
347 // through one Container would silently alter the others.
348 chai::ContainerPtr cont ATLAS_THREAD_SAFE = std::const_pointer_cast<chai::Container>(const_cont);
349 m_chai_cont->insert(std::pair<uint64_t,chai::ContainerBasePtr>(key,cont));
350 }
351 return res;
352 }
353 } catch (std::exception & e){
354 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
355 gLog << MSG::ERROR << "LoadPayloadForHash:"<<e.what()<<" while trying to parse the payload. Since="<<since<<", hash="<<hash<<endmsg;
356 throw std::runtime_error(e.what());
357 }
358 }
static std::string to_string(const std::vector< T > &v)
static Double_t ss
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)

◆ loadTagInfo()

void CoralCrestManager::loadTagInfo ( )

Definition at line 140 of file CoralCrestManager.cxx.

140 {
141 if(m_TagMeta.has_value()){
142 return;
143 }
144
145 try{
146 m_TagMeta = m_crestCl->findTagMeta(m_crestTag);
147 } catch (std::exception & e){
148 MsgStream gLog(Athena::getMessageSvc(), "CoralCrestManager");
149 gLog << MSG::ERROR << __FILE__<<":"<<__LINE__<< ": " << e.what() << " Cannot get a tag meta info " << m_crestTag<<endmsg;
150 }
151 return;
152 }

◆ parseTypeName()

std::string CoralCrestManager::parseTypeName ( const std::string & description)
private

Definition at line 99 of file CoralCrestManager.cxx.

99 {
100 std::string regex=R"delim(<typeName>\s*([^\s]+)\s*</typeName>)delim";
101 std::regex re(regex);
102 std::smatch typeMatch;
103 bool match=std::regex_search(description, typeMatch,re);
104 return (match) ? std::string(typeMatch[1]) : std::string("");
105 }
const std::regex re(r_e)
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:93
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:359
End of vector before end of string
Definition Arrayrep.cxx:228

◆ selectIov()

void CoralCrestManager::selectIov ( cool::ValidityKey since)

Definition at line 451 of file CoralCrestManager.cxx.

451 {
453 }

Member Data Documentation

◆ m_chai_cont

std::optional<std::map<uint64_t,chai::ContainerBasePtr> > CoralCrestManager::m_chai_cont
private

Definition at line 86 of file CoralCrestManager.h.

◆ m_crestCl

std::unique_ptr<Crest::CrestApiBase> CoralCrestManager::m_crestCl
private

Definition at line 76 of file CoralCrestManager.h.

◆ m_crestTag

const std::string CoralCrestManager::m_crestTag
private

Definition at line 77 of file CoralCrestManager.h.

◆ m_id

Crest::ModeId CoralCrestManager::m_id
private

Definition at line 89 of file CoralCrestManager.h.

◆ m_isVectorPayload

std::optional<bool> CoralCrestManager::m_isVectorPayload
private

Definition at line 80 of file CoralCrestManager.h.

◆ m_since

cool::ValidityKey CoralCrestManager::m_since
private

Definition at line 88 of file CoralCrestManager.h.

◆ m_Tag

std::optional<Crest::TagDto> CoralCrestManager::m_Tag
private

Definition at line 79 of file CoralCrestManager.h.

◆ m_TagMeta

std::optional<Crest::TagMetaDto> CoralCrestManager::m_TagMeta
private

Definition at line 78 of file CoralCrestManager.h.

◆ prefix1

const std::string CoralCrestManager::prefix1 {"http://"}
inlinestatic

Definition at line 43 of file CoralCrestManager.h.

43{"http://"};

◆ prefix2

const std::string CoralCrestManager::prefix2 {"https://"}
inlinestatic

Definition at line 44 of file CoralCrestManager.h.

44{"https://"};

The documentation for this class was generated from the following files: