8#include "GaudiKernel/ServiceHandle.h"
27 if(!rdbAccessSvc->connect(connName)) {
29 return StatusCode::FAILURE;
35 ATH_MSG_FATAL(
"Unable to cast IRDBAccessSvc to RDBAccessSvc");
36 return StatusCode::FAILURE;
41 log.open(
"GeometryDBTagDiff.log",std::ofstream::out);
43 std::vector<std::string> tagList;
53 StatusCode
result{StatusCode::SUCCESS};
54 if(!tagList.empty()) {
69 return StatusCode::SUCCESS;
75 return StatusCode::SUCCESS;
81 std::vector<std::string> tagdiff, taglist1, taglist2;
82 std::vector<char> leftright;
85 tagdiff.resize(taglist1.size()+taglist2.size());
86 auto it1 = taglist1.begin();
87 auto it1last = taglist1.end();
88 auto it2 = taglist2.begin();
89 auto it2last = taglist2.end();
90 auto itdiff = tagdiff.begin();
95 leftright.push_back(
'>');
103 while(it1!=it1last) {
104 leftright.push_back(
'<');
116 leftright.push_back(
'<');
118 else if (*it2<*it1) {
122 leftright.push_back(
'>');
130 tagdiff.resize(itdiff-tagdiff.begin());
131 if(!tagdiff.empty()) {
132 log <<
"The databases contain different sets of supported locked global tags" << std::endl;
133 auto leftrightIt = leftright.begin();
134 for(
const std::string& tag : tagdiff ) {
135 log << *leftrightIt <<
" " << tag << std::endl;
147 , std::ofstream& log)
150 for(
const std::string& tag : globalTags) {
152 std::vector<NodeToRecordsetMap>
map;
155 for(
auto& mapel :
map) {
159 return StatusCode::FAILURE;
165 std::ostringstream tagDetailStream;
166 tagDetailStream << atlasTagDetails << std::endl;
172 std::vector<std::string> leafNodes;
174 for(
size_t ii=0; ii<leafNodes.size(); ++ii) {
175 std::string nodeName = leafNodes[ii];
176 int perc = ii*100/leafNodes.size();
177 ATH_MSG_DEBUG(
"\t ** Node: " << nodeName <<
"\t" << perc <<
"%");
179 if(!childTag.empty()) {
182 mapel[nodeName] = std::move(recPtr);
190 if(
map[0].size()!=
map[1].size()) {
191 log << std::endl <<
"TAG: " << tag << std::endl
192 <<
"Different number of leaf nodes in databases! " <<
map[0].size() <<
" vs " <<
map[1].size() << std::endl;
195 bool difFound{
false};
196 NodeToRecordsetMap::const_iterator it =
map[0].begin();
197 for(; it!=
map[0].end(); ++it) {
201 log << std::endl <<
"TAG: " << tag << std::endl
202 <<
"Nodes existing in Session0 but missing in Session1:" << std::endl;
204 log <<
"** " << it->first << std::endl;
210 for(; it!=
map[1].end(); ++it) {
214 log << std::endl <<
"TAG: " << tag << std::endl
215 <<
"Nodes existing in Session1 but missing in Session0:" << std::endl;
217 log <<
"** " << it->first << std::endl;
223 for(; it!=
map[0].end(); ++it) {
224 NodeToRecordsetMap::const_iterator it1 =
map[1].find(it->first);
225 if(it1!=
map[1].end()) {
232 && *recConcrete0!=*recConcrete1) {
235 log << std::endl <<
"TAG: " << tag << std::endl
236 <<
"Differences for common nodes:" << std::endl;
238 log <<std::endl <<
"** " << it->first << std::endl;
239 recConcrete0->
compare(*recConcrete1,log);
244 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
coral::AttributeList RDBTagDetails
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of RDBAccessSvc class.
std::map< std::string, IRDBRecordset_ptr > NodeToRecordsetMap
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
virtual unsigned int size() const =0
RDBAccessSvc is the implementation of IRDBAccessSvc interface.
std::vector< std::string > getLockedSupportedTags(const std::string &supportedFlag, const std::string &connName="ATLASDD")
bool disconnect(const std::string &connName) override
If the counnection counter==1 closes the connection.
IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD") override
Provides access to the Recordset object containing HVS-tagged data.
void getAllLeafNodes(std::vector< std::string > &list, const std::string &connName="ATLASDD")
void getTagDetails(RDBTagDetails &tagDetails, const std::string &tag, const std::string &connName="ATLASDD") override
std::string getChildTag(const std::string &childNode, const std::string &parentTag, const std::string &parentNode, const std::string &connName) override
Gets the tag name for the node by giving its parent node tag.
RDBRecordset is an implementation of IRDBRecordset interface.
void compare(const RDBRecordset &rec, std::ostream &os) const
Gaudi::Property< std::string > m_globalTag
Gaudi::Property< std::string > m_supportedGeometry
virtual StatusCode execute() override
StatusCode compareGlobalTags(const std::vector< std::string > &globalTags, RDBAccessSvc *rdbAccessSvc, std::ofstream &log)
virtual StatusCode initialize() override
virtual StatusCode finalize() override
SourceCompAlg(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< std::string > getGlobalTags(RDBAccessSvc *rdbAccessSvc, std::ofstream &log)
std::vector< std::string > m_connNames
std::string find(const std::string &s)
return a remapped string