Skip to content
Snippets Groups Projects

Fix duplicate volumes when reading a .db back in

Merged Riccardo Maria Bianchi requested to merge fix-duplicate-volumes into master
17 files
+ 1193
63
Compare changes
  • Side-by-side
  • Inline
Files
17
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
/*
* HelloGeo.cpp
@@ -66,25 +66,35 @@ GeoPhysVol* createTheWorld(GeoPhysVol* world)
int main(int argc, char *argv[])
{
// QCoreApplication app(argc, argv);
// GET GEOMETRY FROM LOCAL DB
// Set valid db path before first run
const std::string path = "geometry.db";
std::cout << "Using this DB file:" << path << std::endl;
if(argc != 2)
{
fprintf(stderr, "\nERROR!\nusage: %s input.db\n\n", argv[0]);
return 1;
}
// Get the input SQLite '.db' file containing the geometry
std::string line;
std::string fileName;
fileName = argv[1];
std::cout << "Using this SQLite '.db' file:" << fileName << std::endl;
// check if DB file exists. If not, return.
// FIXME: TODO: this check should go in the 'GMDBManager' constructor.
std::ifstream infile(path.c_str());
std::ifstream infile(fileName.c_str());
if ( ! infile.good() ) {
std::cout << "\n\tERROR!! A '" << path << "' file does not exist!! Please, check the path of the input file before running this program. Exiting...";
std::cout << "\n\tERROR!! A '" << fileName << "' file does not exist!! Please, check the path of the input file before running this program. Exiting...";
exit(EXIT_FAILURE);
}
infile.close();
// GET GEOMETRY FROM LOCAL DB
// open the DB
GMDBManager* db = new GMDBManager(path);
GMDBManager* db = new GMDBManager(fileName);
/* Open database */
if (db->checkIsDBOpen()) {
std::cout << "OK! Database is open!\n";
Loading