35 StringProperty containerPrefixProp(
"PoolContainerPrefix",
"CollectionTree");
36 StringProperty containerNameHintProp(
"TopLevelContainerName",
"");
37 StringProperty branchNameHintProp(
"SubLevelBranchName",
"<type>/<key>");
38 if (propertyServer !=
nullptr) {
39 propertyServer->getProperty(&containerPrefixProp).ignore();
40 propertyServer->getProperty(&containerNameHintProp).ignore();
41 propertyServer->getProperty(&branchNameHintProp).ignore();
46 return(StatusCode::SUCCESS);
58 return(POOL_StorageType);
64 bool ownTokAddr =
false;
65 if (tokAddr ==
nullptr || tokAddr->
getToken() ==
nullptr) {
67 auto token = std::make_unique<Token>();
68 token->fromString(*(pAddr->par()));
69 GenericAddress* genAddr =
dynamic_cast<GenericAddress*
>(pAddr);
71 ATH_MSG_ERROR(
"Dynamic cast failed in AthenaPoolConverter::createObj");
73 return StatusCode::FAILURE;
79 ::sprintf(
text,
"[CTXT=%08X]",
static_cast<int>(*(pAddr->ipar())));
87 std::string
key = pAddr->par()[1];
96 if (pObj ==
nullptr) {
100 delete tokAddr; tokAddr =
nullptr;
103 if (pObj ==
nullptr) {
104 return(StatusCode::FAILURE);
106 return(StatusCode::SUCCESS);
111 if (
proxy ==
nullptr) {
112 ATH_MSG_ERROR(
"AthenaPoolConverter CreateRep failed to cast DataProxy, key = " << pObj->name());
113 return(StatusCode::FAILURE);
119 return(StatusCode::FAILURE);
123 return(StatusCode::FAILURE);
126 if (pAddr ==
nullptr) {
130 GenericAddress* gAddr =
dynamic_cast<GenericAddress*
>(pAddr);
131 if (gAddr !=
nullptr) {
135 return(StatusCode::SUCCESS);
143 return(StatusCode::FAILURE);
147 return(StatusCode::FAILURE);
149 return(StatusCode::SUCCESS);
153 return(POOL_StorageType);
158 ::
Converter(POOL_StorageType, myCLID, pSvcLocator),
160 name ?
name :
"AthenaPoolConverter"),
161 m_detStore(
"DetectorStore",
name ?
name :
"AthenaPoolConverter"),
162 m_athenaPoolCnvSvc(
"AthenaPoolCnvSvc",
name ?
name :
"AthenaPoolConverter"),
166 m_containerPrefix(
""),
167 m_containerNameHint(
""),
168 m_branchNameHint(
""),
169 m_dataObject(nullptr),
170 m_i_poolToken(nullptr) {
176 std::string::size_type pos1 =
output.find(
'[');
177 std::string outputConnectionSpec =
output.substr(0, pos1);
185 std::string containerName;
188 std::size_t colonPos = containerPrefix.find(
':');
189 if (colonPos != std::string::npos) {
190 dhContainerPrefix = containerPrefix.substr(0, colonPos + 1) + dhContainerPrefix;
196 std::string containerFriendPostfix;
197 while (pos1 != std::string::npos) {
198 const std::string::size_type pos2 =
output.find(
'=', pos1);
199 const std::string thisKey =
output.substr(pos1 + 1, pos2 - pos1 - 1);
200 const std::string::size_type pos3 =
output.find(
']', pos2);
201 const std::string
value =
output.substr(pos2 + 1, pos3 - pos2 - 1);
202 if (thisKey ==
"OutputCollection") {
203 dhContainerPrefix =
value;
204 }
else if (thisKey ==
"PoolContainerPrefix") {
205 containerPrefix =
value;
206 }
else if (thisKey ==
"TopLevelContainerName") {
207 containerNameHint =
value;
208 }
else if (thisKey ==
"SubLevelBranchName") {
209 branchNameHint =
value;
210 }
else if (thisKey ==
"PoolContainerFriendPostfix") {
211 containerFriendPostfix =
value;
213 pos1 =
output.find(
'[', pos3);
217 if( tname.compare(0, 10,
"DataHeader") == 0 ) {
218 if( tname.compare(10, 4,
"Form") == 0 ) {
219 containerName = dhContainerPrefix +
"Form" +
"(" + tname +
")";
221 if (
key[
key.size() - 1] ==
'/') {
222 containerName = dhContainerPrefix +
"(" +
key + tname +
")";
224 containerName = dhContainerPrefix +
"(" + tname +
")";
229 else if (tname.compare(0, 13,
"AttributeList") == 0) {
231 if( pool::ROOTRNTUPLE_StorageType.exactMatch(tech) ) {
236 tech = pool::ROOTTREE_StorageType.
type();
242 const std::string typeTok =
"<type>", keyTok =
"<key>";
243 containerName = containerPrefix + containerFriendPostfix + containerNameHint;
244 if (!branchNameHint.empty()) {
245 containerName +=
"(" + branchNameHint +
")";
247 const std::size_t pos1 = containerName.find(typeTok);
248 if (pos1 != std::string::npos) {
249 containerName.replace(pos1, typeTok.size(), tname);
251 const std::size_t pos2 = containerName.find(keyTok);
252 if (pos2 != std::string::npos) {
254 containerName.replace(pos2, keyTok.size(), tname);
256 containerName.replace(pos2, keyTok.size(),
key);
275 ATH_MSG_DEBUG(
"AthenaPoolConverter cleanUp called for base class.");
276 return(StatusCode::SUCCESS);