ATLAS Offline Software
DataHeader_p6.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PERSISTENTDATAMODELTPCNV_DATAHEADER_P6_H
6 #define PERSISTENTDATAMODELTPCNV_DATAHEADER_P6_H
7 
15 #include "CxxUtils/sgkey_t.h"
16 
17 #include <vector>
18 #include <set>
19 #include <string>
20 
21 class Token;
22 
23 
28 friend class DataHeaderCnv_p6;
29 
30 public:
32 
33  struct DbRecord {
34  Guid fid; unsigned tech;
35  DbRecord() {}
36  DbRecord( const Guid& f, unsigned t) : fid(f), tech(t) {}
37  bool operator==(const DbRecord& rhs) const { return fid==rhs.fid && tech==rhs.tech; }
38  };
39  struct ObjRecord {
41  std::string cont, key;
42  unsigned clid; long long oid1;
43  ObjRecord() {}
44  ObjRecord( const Guid& g, const std::string& c, const std::string& k, unsigned id, long long o)
45  : guid(g), cont(c), key(k), clid(id), oid1(o) {}
46  bool operator==(const ObjRecord& rhs) const
47  { return clid == rhs.clid && cont == rhs.cont && key == rhs.key && oid1 == rhs.oid1; }
48  };
49 
50  enum DHVersions { DHverFormRef = 600 };
51  /* DHverFormRef - has the self reference stored at the end of the provenance list
52  */
53 
54 public: // Constructor and Destructor
59 
60  unsigned int insertDb(const DbRecord& rec);
61  std::size_t sizeDb() const;
62  Guid getDbGuid(unsigned int index) const;
63  unsigned int getDbTech(unsigned int index) const;
64 
65  unsigned int insertObj(const ObjRecord& rec,
66  const std::set<std::string>& alias = std::set<std::string>(), bool doAliasFiletering = true,
67  const std::set<unsigned int>& symLinks = std::set<unsigned int>(),
68  const std::vector<sgkey_t>& hashes = std::vector<sgkey_t>());
69  std::size_t sizeObj() const;
70  std::string getObjContainer(unsigned int index) const;
71  std::string getObjKey(unsigned int index) const;
72  unsigned int getObjType(unsigned int index) const;
73  Guid getObjClassId(unsigned int index) const;
74  long long getObjOid1(unsigned int index) const { return m_objRecords[index].oid1; }
75  std::set<std::string> getObjAlias(unsigned int index) const;
76  std::set<unsigned int> getObjSymLinks(unsigned int index) const;
77  std::vector<sgkey_t> getObjHashes(unsigned int index) const;
78  bool isModified() const;
79  void clearModified();
80  void setToken(const std::string& tok);
81  const std::string& getToken() const;
82  void resize(unsigned int size);
83  const std::string& getProcessTag() const { return m_processTag; }
84  void setProcessTag(const std::string& tag) { m_processTag = tag; }
85  unsigned version() const { return m_version; }
87  void setVersion(const DHVersions ver) { m_version = ver; }
88 
89 private:
90  std::vector<DbRecord> m_dbRecords;
91  std::vector<ObjRecord> m_objRecords;
92  std::vector<std::vector<std::string> > m_objAlias;
93  std::vector<std::vector<unsigned int> > m_objSymLinks;
94  std::vector<std::vector<sgkey_t> > m_objHashes;
95 
97  unsigned m_version { DHverFormRef };
99  std::string m_processTag;
100 
101  // transient members:
103  bool m_modified { true };
105  std::string m_token;
106 };
107 
108 
115 {
116  friend class DataHeaderCnv_p6;
117 
118 public:
119  struct FullElement {
120  FullElement() : oid2(0), dbIdx(0), objIdx(0) {}
121  FullElement(unsigned long long o2, unsigned db, unsigned obj) : oid2(o2), dbIdx(db), objIdx(obj) {}
122  unsigned long long oid2;
123  unsigned int dbIdx; // index to DHForm entry with DB GUID & technology
124  unsigned int objIdx; // index to DHForm entry with object data
125  };
126 
128  const std::string& dhFormToken() const;
129  void setDhFormToken(const std::string& formToken);
130 
131 private:
133  unsigned m_commonDbIndex{};
134  unsigned long long m_commonOID2{};
135 
136  std::vector<int> m_shortElements;
137  std::vector<FullElement> m_fullElements;
138  unsigned int m_provenanceSize{};
139 
140  std::string m_dhFormToken;
141 };
142 
143 #endif
python.root_lsr_rank.hashes
hashes
Definition: root_lsr_rank.py:34
DataHeaderForm_p6
This class provides storage for the constant fields of the persistent DataHeader class.
Definition: DataHeader_p6.h:27
DataHeader_p6::DataHeader_p6
DataHeader_p6()
Definition: DataHeader_p6.h:127
DataHeader_p6::FullElement::FullElement
FullElement()
Definition: DataHeader_p6.h:120
DataHeaderForm_p6::DbRecord::fid
Guid fid
Definition: DataHeader_p6.h:34
DataHeaderForm_p6::isModified
bool isModified() const
Definition: DataHeader_p6.cxx:135
DataHeaderForm_p6::setVersion
void setVersion(const DHVersions ver)
change version if writing backward compatible format
Definition: DataHeader_p6.h:87
DataHeaderForm_p6::sgkey_t
SG::sgkey_t sgkey_t
Definition: DataHeader_p6.h:31
DataHeaderCnv_p6
This class provides the converter to customize the saving of DataHeader_p6.
Definition: DataHeaderCnv_p6.h:22
DataHeaderForm_p6::m_objHashes
std::vector< std::vector< sgkey_t > > m_objHashes
Definition: DataHeader_p6.h:94
DataHeaderForm_p6::operator=
DataHeaderForm_p6 & operator=(const DataHeaderForm_p6 &rhs)
Definition: DataHeader_p6.cxx:21
index
Definition: index.py:1
DataHeaderForm_p6::m_processTag
std::string m_processTag
DataHeader SG Key.
Definition: DataHeader_p6.h:99
DataHeader_p6::FullElement
Definition: DataHeader_p6.h:119
DataHeader_p6::m_dhFormToken
std::string m_dhFormToken
Definition: DataHeader_p6.h:140
CaloCondBlobAlgs_fillNoiseFromASCII.db
db
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:43
DataHeaderForm_p6::DbRecord
Definition: DataHeader_p6.h:33
DataHeaderForm_p6::DataHeaderForm_p6
DataHeaderForm_p6()
Definition: DataHeader_p6.h:55
DataHeaderForm_p6::ObjRecord::clid
unsigned clid
Definition: DataHeader_p6.h:42
DataHeaderForm_p6::m_dbRecords
std::vector< DbRecord > m_dbRecords
Definition: DataHeader_p6.h:90
DataHeaderForm_p6::DHVersions
DHVersions
Definition: DataHeader_p6.h:50
DataHeaderForm_p6::version
unsigned version() const
Definition: DataHeader_p6.h:85
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DataHeader_p6::m_provenanceSize
unsigned int m_provenanceSize
Definition: DataHeader_p6.h:138
DataHeaderForm_p6::setProcessTag
void setProcessTag(const std::string &tag)
Definition: DataHeader_p6.h:84
DataHeader_p6::m_commonOID2
unsigned long long m_commonOID2
Definition: DataHeader_p6.h:134
DataHeader_p6::setDhFormToken
void setDhFormToken(const std::string &formToken)
Definition: DataHeader_p6.cxx:167
DataHeader_p6::m_shortElements
std::vector< int > m_shortElements
Definition: DataHeader_p6.h:136
DataHeaderForm_p6::getObjOid1
long long getObjOid1(unsigned int index) const
Definition: DataHeader_p6.h:74
DataHeader_p6::m_fullElements
std::vector< FullElement > m_fullElements
Definition: DataHeader_p6.h:137
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
DataHeader_p6::FullElement::dbIdx
unsigned int dbIdx
Definition: DataHeader_p6.h:123
DataHeaderForm_p6::DHverFormRef
@ DHverFormRef
Definition: DataHeader_p6.h:50
DataHeader_p6::FullElement::FullElement
FullElement(unsigned long long o2, unsigned db, unsigned obj)
Definition: DataHeader_p6.h:121
DataHeaderForm_p6::m_token
std::string m_token
Reference to self in the persistent storage.
Definition: DataHeader_p6.h:105
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Pythia8_A14_NNPDF23LO_Var1Down_Common.ver
ver
Definition: Pythia8_A14_NNPDF23LO_Var1Down_Common.py:26
DataHeaderForm_p6::getObjType
unsigned int getObjType(unsigned int index) const
Definition: DataHeader_p6.cxx:114
DataHeaderForm_p6::m_objRecords
std::vector< ObjRecord > m_objRecords
Definition: DataHeader_p6.h:91
DataHeaderForm_p6::getObjContainer
std::string getObjContainer(unsigned int index) const
Definition: DataHeader_p6.cxx:106
DataHeaderForm_p6::getToken
const std::string & getToken() const
Definition: DataHeader_p6.cxx:148
DataHeaderForm_p6::DbRecord::DbRecord
DbRecord(const Guid &f, unsigned t)
Definition: DataHeader_p6.h:36
DataHeader_p6::dhFormToken
const std::string & dhFormToken() const
Definition: DataHeader_p6.cxx:163
DataHeaderForm_p6::getObjClassId
Guid getObjClassId(unsigned int index) const
Definition: DataHeader_p6.cxx:118
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
DataHeaderForm_p6::getDbGuid
Guid getDbGuid(unsigned int index) const
Definition: DataHeader_p6.cxx:57
COOLRates.alias
alias
Definition: COOLRates.py:1172
DataHeaderForm_p6::DbRecord::operator==
bool operator==(const DbRecord &rhs) const
Definition: DataHeader_p6.h:37
DataHeaderForm_p6::ObjRecord::ObjRecord
ObjRecord(const Guid &g, const std::string &c, const std::string &k, unsigned id, long long o)
Definition: DataHeader_p6.h:44
DataHeaderForm_p6::DbRecord::tech
unsigned tech
Definition: DataHeader_p6.h:34
hist_file_dump.f
f
Definition: hist_file_dump.py:135
DataHeaderForm_p6::DbRecord::DbRecord
DbRecord()
Definition: DataHeader_p6.h:35
DataHeader_p6
This class provides a persistent representation for the DataHeader class.
Definition: DataHeader_p6.h:115
DataHeaderForm_p6::~DataHeaderForm_p6
~DataHeaderForm_p6()
Definition: DataHeader_p6.cxx:36
DataHeaderForm_p6::insertObj
unsigned int insertObj(const ObjRecord &rec, const std::set< std::string > &alias=std::set< std::string >(), bool doAliasFiletering=true, const std::set< unsigned int > &symLinks=std::set< unsigned int >(), const std::vector< sgkey_t > &hashes=std::vector< sgkey_t >())
Definition: DataHeader_p6.cxx:65
DataHeader_p6::FullElement::objIdx
unsigned int objIdx
Definition: DataHeader_p6.h:124
DataHeaderForm_p6::getObjSymLinks
std::set< unsigned int > getObjSymLinks(unsigned int index) const
Definition: DataHeader_p6.cxx:126
DataHeaderForm_p6::clearModified
void clearModified()
Definition: DataHeader_p6.cxx:139
DataHeaderForm_p6::sizeDb
std::size_t sizeDb() const
Definition: DataHeader_p6.cxx:53
DataHeaderForm_p6::m_objAlias
std::vector< std::vector< std::string > > m_objAlias
Definition: DataHeader_p6.h:92
DataHeaderForm_p6::getObjHashes
std::vector< sgkey_t > getObjHashes(unsigned int index) const
Definition: DataHeader_p6.cxx:131
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
DataHeaderForm_p6::ObjRecord::cont
std::string cont
Definition: DataHeader_p6.h:41
DataHeaderForm_p6::setToken
void setToken(const std::string &tok)
Definition: DataHeader_p6.cxx:143
DataHeaderForm_p6::sizeObj
std::size_t sizeObj() const
Definition: DataHeader_p6.cxx:102
SG::sgkey_t
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition: CxxUtils/CxxUtils/sgkey_t.h:32
DataHeaderForm_p6::ObjRecord::oid1
long long oid1
Definition: DataHeader_p6.h:42
python.changerun.o2
o2
Definition: changerun.py:45
DeMoScan.index
string index
Definition: DeMoScan.py:364
DataHeaderForm_p6::m_modified
bool m_modified
indicates that the last event was somehow different and a new DHForm needs to be written
Definition: DataHeader_p6.h:103
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
sgkey_t.h
Define the type used for hashed StoreGate key+CLID pairs.
DataHeaderForm_p6::resize
void resize(unsigned int size)
Definition: DataHeader_p6.cxx:152
DataHeaderForm_p6::getObjKey
std::string getObjKey(unsigned int index) const
Definition: DataHeader_p6.cxx:110
DataHeader_p6::FullElement::oid2
unsigned long long oid2
Definition: DataHeader_p6.h:122
DataHeaderForm_p6::ObjRecord::ObjRecord
ObjRecord()
Definition: DataHeader_p6.h:43
DataHeader_p6::m_commonDbIndex
unsigned m_commonDbIndex
common DB entry index used by all short DH elements
Definition: DataHeader_p6.h:133
DataHeaderForm_p6::m_objSymLinks
std::vector< std::vector< unsigned int > > m_objSymLinks
Definition: DataHeader_p6.h:93
DataHeaderForm_p6::ObjRecord::guid
Guid guid
Definition: DataHeader_p6.h:40
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
DataHeaderForm_p6::getDbTech
unsigned int getDbTech(unsigned int index) const
Definition: DataHeader_p6.cxx:61
DataHeaderForm_p6::ObjRecord::operator==
bool operator==(const ObjRecord &rhs) const
Definition: DataHeader_p6.h:46
Guid.h
This file contains the class definition for the Guid class (migrated from POOL).
DataHeaderForm_p6::insertDb
unsigned int insertDb(const DbRecord &rec)
Definition: DataHeader_p6.cxx:40
DataHeaderForm_p6::m_version
unsigned m_version
Subversion of DHForm_p6 for small changes of data encoding.
Definition: DataHeader_p6.h:97
DataHeaderForm_p6::getProcessTag
const std::string & getProcessTag() const
Definition: DataHeader_p6.h:83
python.PyAthena.obj
obj
Definition: PyAthena.py:132
DataHeaderForm_p6::getObjAlias
std::set< std::string > getObjAlias(unsigned int index) const
Definition: DataHeader_p6.cxx:122
python.compressB64.c
def c
Definition: compressB64.py:93
DataHeaderForm_p6::ObjRecord
Definition: DataHeader_p6.h:39
fitman.k
k
Definition: fitman.py:528
DataHeaderForm_p6::ObjRecord::key
std::string key
Definition: DataHeader_p6.h:41