ATLAS Offline Software
FullHolderFactory.cxx
Go to the documentation of this file.
1 // Emacs -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
10 #include "TrigNavigation/Holder.h"
11 #include "GaudiKernel/IConversionSvc.h"
13 
14 
16  : asg::AsgMessaging("HolderFactory"),
17  m_serializerSvc(0),
18  m_storeGate(0),
19  m_prefix(prefix),
20  m_readonly(false)
21 {
22 }
23 
24 HLT::BaseHolder* HLT::FullHolderFactory::fromSerialized(int version, const std::vector<uint32_t>::const_iterator& start, const std::vector<uint32_t>::const_iterator& end){
25  class_id_type clid{0};
27  std::string label;
28 
29  std::vector<uint32_t>::const_iterator blobIt = start;
30 
31  auto blobsize = std::distance(blobIt,end);
32 
33  if(!blobsize){
34  ATH_MSG_WARNING("trying to deserialize empty blob, returning nullptr");
35  return nullptr;
36  }
37 
39 
40  auto itr = m_ignore.find(clid);
41  if ( itr!=m_ignore.end() && (itr->second.empty() || itr->second.find(label)!=itr->second.end()) ) {
42  ATH_MSG_DEBUG( "deserialize: skipping " << clid << "#" << label );
43  return nullptr;
44  }
45 
46  ATH_MSG_VERBOSE("deserialize: extracted blob CLID: " << clid << " of size: " << blobsize << " SubTypeIndex: " << idx << " Label: " << label);
47 
48  BaseHolder* baseholder = createHolder(clid, label, idx);
49  if (! baseholder) {
50  ATH_MSG_ERROR("deserialize: Could not create holder for CLID " << clid
51  << " this probably means that the package holding the class for this CLID was not compiled against the TrigNavigation package in use!");
52  return nullptr;
53  }
54 
55  // now we have the blobIt pointing to the place where objects may start
56  // if so we ought to do deserialization
57  if ( blobIt != end ) {
58  //copy the blob
59  std::vector<uint32_t>::const_iterator constEnd = end;
60  std::vector<uint32_t> blobpart2(blobIt, constEnd);
61 
62  auto iholder = static_cast<HLTNavDetails::IHolder*>(baseholder);
63 
64  iholder->deserializePayload(blobpart2,version);
65 
66  if ( !iholder->syncWithSG() ) {
67  ATH_MSG_WARNING("deserialize: after deserialization obejct not accessible though SG");
68  }
69  }
70  return baseholder;
71 }
72 
74  ATH_MSG_DEBUG("createHolder: creating holder for CLID: " << clid << " label: " << label << " and index: " << index << " readonly: " << m_readonly);
75 
76  const auto itr = HLT::TypeMaps::holders().find(clid);
77  if ( itr == HLT::TypeMaps::holders().end() ) {
78  ATH_MSG_ERROR("createHolder: holder can't be done, no predefined storage found for CLID: " << clid);
79  return nullptr;
80  }
81 
82  auto holder = itr->second->clone(m_prefix, label, index);
83  if(!holder){
84  ATH_MSG_ERROR("createHolder: clone of holder failed clid: " << clid);
85  return nullptr;
86  }
87 
88  ATH_MSG_DEBUG("preparing holder with msg: " << &msg() << " storegate: " << m_storeGate << " and prefix " << m_prefix);
89 
90  holder->prepare(*this, m_storeGate, m_serializerSvc, m_readonly);
91 
92  ATH_MSG_DEBUG("createHolder: holder prepared " << *holder);
93 
94  return holder;
95 }
TypeMaps.h
index
Definition: index.py:1
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
HLT::FullHolderFactory::createHolder
HLT::BaseHolder * createHolder(class_id_type clid, const std::string &label, uint16_t index) const override
Definition: FullHolderFactory.cxx:73
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
asg
Definition: DataHandleTestTool.h:28
HLT::TypeMaps::holders
static const CLIDtoHolderMap & holders()
Definition: TypeMaps.h:30
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
HLT::FullHolderFactory::fromSerialized
HLT::BaseHolder * fromSerialized(int version, const std::vector< uint32_t >::const_iterator &start, const std::vector< uint32_t >::const_iterator &end) override
Definition: FullHolderFactory.cxx:24
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HLTNavDetails::IHolder::deserializePayload
bool deserializePayload(const std::vector< uint32_t > &dataBlob, int version)
deserialization of holder payload
Definition: Holder.cxx:148
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Holder.h
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
HLT::BaseHolder
Definition: BaseHolder.h:14
HLT::class_id_type
uint32_t class_id_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:11
HLT::sub_index_type
uint16_t sub_index_type
Definition: Trigger/TrigEvent/TrigNavStructure/Root/Types.h:9
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
FullHolderFactory.h
BaseHolder.h
HLT::BaseHolder::enquireSerialized
static bool enquireSerialized(std::vector< uint32_t >::const_iterator &fromHere, const std::vector< uint32_t >::const_iterator &end, class_id_type &c, std::string &label, sub_index_type &subtypeIndex)
Definition: BaseHolder.cxx:12
get_generator_info.version
version
Definition: get_generator_info.py:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
HLTNavDetails::IHolder
Definition: Holder.h:58
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
HLT::FullHolderFactory::FullHolderFactory
FullHolderFactory(const std::string &prefix)
Definition: FullHolderFactory.cxx:15