ATLAS Offline Software
DataHeaderCnv_p4.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
13 
14 #include <cstdio>
15 #include <sstream>
16 
19 
20 //______________________________________________________________________________
22  DataHeaderElement* trans,
23  const std::vector<std::string>& map) {
24  std::vector<unsigned int>::const_iterator intIter = pers->m_clids.begin();
25  const std::vector<unsigned int>::const_iterator intLast = pers->m_clids.end();
26  trans->m_pClid = *intIter; ++intIter;
27  trans->m_clids.clear();
28  for (std::set<CLID>::const_iterator lastClid = trans->m_clids.begin();
29  intIter != intLast; ++intIter) {
30  lastClid = trans->m_clids.insert(lastClid, *intIter);
31  }
32  std::vector<std::string>::const_iterator strIter = pers->m_alias.begin();
33  const std::vector<std::string>::const_iterator strLast = pers->m_alias.end();
34  trans->m_key = *strIter; ++strIter;
35  trans->m_alias.clear();
36  for (std::set<std::string>::const_iterator lastAlias = trans->m_alias.begin();
37  strIter != strLast; ++strIter) {
38  lastAlias = trans->m_alias.insert(lastAlias, *strIter);
39  }
40  trans->m_hashes.clear();
41  trans->m_hashes.reserve(pers->m_hashes.size());
42  for (std::vector<uint64_t>::const_iterator iter = pers->m_hashes.begin(),
43  last = pers->m_hashes.end(); iter != last; ++iter) {
44  trans->m_hashes.push_back((unsigned int)(*iter));
45  }
46 // Translate PoolToken
47  std::string tokenStr;
48  if (map.empty()) {
49  tokenStr = pers->m_token;
50  } else {
51  unsigned int tokenSize = 129 + pers->m_token.size();
52  if (pers->m_prefixIdx > 0) {
53  tokenSize += map[pers->m_prefixIdx].size();
54  }
55  if (pers->m_keyPos > 0) {
56  tokenSize += trans->m_key.size();
57  }
58  tokenStr.reserve(tokenSize);
59 // Append DbGuid
60  tokenStr = "[DB=";
61  tokenStr.append(map[pers->m_dbGuidIdx]);
62 // Still optimize
63  tokenStr.append("][CNT=");
64  std::string cntName;
65  if (pers->m_prefixIdx > 0) {
66  tokenStr.append(map[pers->m_prefixIdx]);
67  }
68 // insert key
69  if (pers->m_keyPos > 0) {
70  tokenStr.append(pers->m_token.substr(0, pers->m_keyPos - 1));
71  tokenStr.append(trans->m_key);
72  tokenStr.append(pers->m_token.substr(pers->m_keyPos - 1));
73  } else {
74  tokenStr.append(pers->m_token);
75  }
76 // Append ClassId
77  tokenStr.append("][CLID=");
78  tokenStr.append(map[pers->m_classIdIdx]);
79 // Add Technology and Offsets
80  const unsigned int length = 40;
81  char text[length];
82  snprintf(text, length, "][TECH=%08X][OID=%08X-%08X]", pers->m_technology, pers->m_oid1, pers->m_oid2);
83  tokenStr.append(text);
84  }
85  Token* token = new Token;
86  token->fromString(tokenStr);
87  delete trans->m_token; trans->m_token = token;
88 }
89 //______________________________________________________________________________
91  DataHeaderElement_p4* /*pers*/,
92  std::vector<std::string>& /*map*/) {
93 // Moved to next _p version
94 }
95 //______________________________________________________________________________
96 //______________________________________________________________________________
99 //______________________________________________________________________________
101  trans->m_inputDataHeader.resize(pers->m_provSize);
103  std::vector<DataHeaderElement_p4>::const_iterator pit = pers->m_dataHeader.begin();
104  for (unsigned int i = 0U; i != pers->m_provSize; ++i, ++it, ++pit) {
105  m_elemCnv.persToTrans(&(*pit), &(*it), pers->m_guidMap);
106  }
107  trans->m_dataHeader.resize(pers->m_dataHeader.size() - pers->m_provSize);
108  it = trans->m_dataHeader.begin();
109  for (std::vector<DataHeaderElement_p4>::const_iterator last = pers->m_dataHeader.end();
110  pit != last; ++it, ++pit) {
111  m_elemCnv.persToTrans(&(*pit), &(*it), pers->m_guidMap);
112  }
113 }
114 //______________________________________________________________________________
115 void DataHeaderCnv_p4::transToPers(const DataHeader* /*trans*/, DataHeader_p4* /*pers*/) {
116 // Moved to next _p version
117 }
118 //______________________________________________________________________________
120  const std::string& /*key*/,
121  const std::string& /*token*/) {
122 // Moved to next _p version
123 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
DataHeader_p4
This class provides a persistent representation for the DataHeader class.
Definition: DataHeader_p4.h:53
DataHeaderElement_p4::m_classIdIdx
unsigned short m_classIdIdx
Definition: DataHeader_p4.h:45
DataHeaderCnv_p4::insertDHRef
void insertDHRef(DataHeader_p4 *pers, const std::string &key, const std::string &token)
Definition: DataHeaderCnv_p4.cxx:119
DataHeaderElement::m_key
std::string m_key
string with StoreGate key.
Definition: DataHeader.h:111
DataHeaderElement_p4::m_token
std::string m_token
Definition: DataHeader_p4.h:42
DataHeaderElement_p4::m_prefixIdx
unsigned short m_prefixIdx
Definition: DataHeader_p4.h:45
DataHeaderElement::m_clids
std::set< CLID > m_clids
set of unsigned long to store ClassID's for symlinked container.
Definition: DataHeader.h:109
DataHeaderElement::m_pClid
CLID m_pClid
primary ClassID.
Definition: DataHeader.h:107
DataHeaderCnv_p4::~DataHeaderCnv_p4
virtual ~DataHeaderCnv_p4()
Definition: DataHeaderCnv_p4.cxx:98
DataHeaderCnv_p4::transToPers
void transToPers(const DataHeader *trans, DataHeader_p4 *pers)
Definition: DataHeaderCnv_p4.cxx:115
skel.it
it
Definition: skel.GENtoEVGEN.py:396
DataHeader_p4::m_guidMap
std::vector< std::string > m_guidMap
Definition: DataHeader_p4.h:70
DataHeader_p4::m_dataHeader
std::vector< DataHeaderElement_p4 > m_dataHeader
Definition: DataHeader_p4.h:68
DataHeaderCnv_p4::m_elemCnv
DataHeaderElementCnv_p4 m_elemCnv
Definition: DataHeaderCnv_p4.h:48
DataHeaderElementCnv_p4::~DataHeaderElementCnv_p4
virtual ~DataHeaderElementCnv_p4()
Definition: DataHeaderCnv_p4.cxx:18
DataHeader_p4::m_provSize
unsigned int m_provSize
Definition: DataHeader_p4.h:69
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
Token::fromString
Token & fromString(const std::string &from)
Build from the string representation of a token.
Definition: Token.cxx:133
DataHeaderElement
This class provides a persistent form for the TransientAddress.
Definition: DataHeader.h:36
DataHeaderElementCnv_p4::transToPers
void transToPers(const DataHeaderElement *trans, DataHeaderElement_p4 *pers, std::vector< std::string > &map)
Definition: DataHeaderCnv_p4.cxx:90
DataHeaderElement::m_alias
std::set< std::string > m_alias
set of StoreGate alias string.
Definition: DataHeader.h:113
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
lumiFormat.i
int i
Definition: lumiFormat.py:85
DataHeaderElementCnv_p4::persToTrans
void persToTrans(const DataHeaderElement_p4 *pers, DataHeaderElement *trans, const std::vector< std::string > &map)
Definition: DataHeaderCnv_p4.cxx:21
DataHeaderElement_p4::m_technology
unsigned int m_technology
Definition: DataHeader_p4.h:44
DataHeaderElement_p4::m_keyPos
unsigned short m_keyPos
Definition: DataHeader_p4.h:46
DataHeader.h
This file contains the class definition for the DataHeader and DataHeaderElement classes.
DataHeaderCnv_p4.h
This file contains the class definition for the DataHeaderCnv_p4 and DataHeaderElementCnv_p4 classes.
DataHeader::m_dataHeader
std::vector< DataHeaderElement > m_dataHeader
vector with DataHeaderElement to "DataObject".
Definition: DataHeader.h:201
DataHeaderElement::m_hashes
std::vector< sgkey_t > m_hashes
hash table for ElementLink host container keys.
Definition: DataHeader.h:118
DataHeaderElement_p4::m_hashes
std::vector< uint64_t > m_hashes
Definition: DataHeader_p4.h:47
DataHeaderElement_p4::m_alias
std::vector< std::string > m_alias
Definition: DataHeader_p4.h:43
DataHeaderElementCnv_p4::DataHeaderElementCnv_p4
DataHeaderElementCnv_p4()
Definition: DataHeaderCnv_p4.cxx:17
DataHeaderElement_p4::m_dbGuidIdx
unsigned short m_dbGuidIdx
Definition: DataHeader_p4.h:45
DataHeaderElement_p4::m_clids
std::vector< unsigned int > m_clids
Definition: DataHeader_p4.h:41
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
DataHeaderElement::m_token
const Token * m_token
pointer to transient address
Definition: DataHeader.h:115
DataHeaderElement_p4::m_oid1
unsigned int m_oid1
Definition: DataHeader_p4.h:44
DataHeaderElement_p4
This class provides a persistent representation for the DataHeaderElement class.
Definition: DataHeader_p4.h:21
DataHeaderCnv_p4::persToTrans
void persToTrans(const DataHeader_p4 *pers, DataHeader *trans)
Definition: DataHeaderCnv_p4.cxx:100
DataHeaderCnv_p4::DataHeaderCnv_p4
DataHeaderCnv_p4()
Definition: DataHeaderCnv_p4.cxx:97
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
DataHeader::m_inputDataHeader
std::vector< DataHeaderElement > m_inputDataHeader
vector with DataHeaderElement to upstream DataHeader ("Provenance").
Definition: DataHeader.h:203
DataHeaderElement_p4::m_oid2
unsigned int m_oid2
Definition: DataHeader_p4.h:44