Skip to content
Snippets Groups Projects
Commit 21195f45 authored by Joseph Boudreau's avatar Joseph Boudreau
Browse files

revert the bugfix for duplicated phys vols which does not work on Ubuntu,...

revert the bugfix for duplicated phys vols which does not work on Ubuntu, unfortunately.  This is not critical and will be fixed when understood
parent 3733e0de
Branches
Tags
No related merge requests found
......@@ -176,10 +176,10 @@ private:
void storeBuiltAlignableTransform(GeoAlignableTransform* node);
GeoAlignableTransform* getBuiltAlignableTransform(const unsigned int id);
//void storeVPhysVol(const unsigned int id, const unsigned int tableId, const unsigned int copyNumber, GeoGraphNode* node);
//GeoGraphNode* getVPhysVol(const unsigned int id, const unsigned int tableId, const unsigned int copyNumber);
void storeVPhysVol(const unsigned int id, const unsigned int tableId, GeoGraphNode* node);
GeoGraphNode* getVPhysVol(const unsigned int id, const unsigned int tableId);
void storeVPhysVol(const unsigned int id, const unsigned int tableId, const unsigned int copyNumber, GeoGraphNode* node);
GeoGraphNode* getVPhysVol(const unsigned int id, const unsigned int tableId, const unsigned int copyNumber);
//void storeVPhysVol(const unsigned int id, const unsigned int tableId, GeoGraphNode* node);
//GeoGraphNode* getVPhysVol(const unsigned int id, const unsigned int tableId);
bool isBuiltLog(const unsigned int id);
void storeBuiltLog(GeoLogVol* nodePtr);
......
......@@ -40,7 +40,7 @@ namespace GeoModelIO {
++ii;
N volPtr = nullptr;
if constexpr ( std::is_same_v<GeoFullPhysVol*, N> ) {
volPtr = dynamic_cast<GeoFullPhysVol*>( getVPhysVol(std::stoul(volID), 2) ); //always table=2, and we should have copyN=1 because FullPhysVols are not sharable
volPtr = dynamic_cast<GeoFullPhysVol*>( getVPhysVol(std::stoul(volID), 2,1) ); //always table=2, and we should have copyN=1 because FullPhysVols are not sharable
} else if constexpr ( std::is_same_v<GeoAlignableTransform*, N> ) {
volPtr = getBuiltAlignableTransform(std::stoul(volID));
} else {
......
......@@ -800,16 +800,16 @@ GeoVPhysVol* ReadGeoModel::buildVPhysVolInstance(const unsigned int id, const un
}
// A - if the instance has been previously built, return that
//if ( nullptr != getVPhysVol(id, tableId, copyN)) {
if ( nullptr != getVPhysVol(id, tableId)) {
if ( nullptr != getVPhysVol(id, tableId, copyN)) {
//if ( nullptr != getVPhysVol(id, tableId)) {
if (m_deepDebug) {
muxCout.lock();
//std::cout << "getting the instance volume from memory... Returning: [" << getVPhysVol(id, tableId, copyN) << "] -- logvol: " << ((GeoVPhysVol*)getVPhysVol(id, tableId, copyN))->getLogVol()->getName() << std::endl;
std::cout << "getting the instance volume from memory... Returning: [" << getVPhysVol(id, tableId) << "] -- logvol: " << ((GeoVPhysVol*)getVPhysVol(id, tableId))->getLogVol()->getName() << std::endl;
std::cout << "getting the instance volume from memory... Returning: [" << getVPhysVol(id, tableId, copyN) << "] -- logvol: " << ((GeoVPhysVol*)getVPhysVol(id, tableId, copyN))->getLogVol()->getName() << std::endl;
//std::cout << "getting the instance volume from memory... Returning: [" << getVPhysVol(id, tableId) << "] -- logvol: " << ((GeoVPhysVol*)getVPhysVol(id, tableId))->getLogVol()->getName() << std::endl;
muxCout.unlock();
}
//return dynamic_cast<GeoVPhysVol*>(getVPhysVol(id, tableId, copyN));
return dynamic_cast<GeoVPhysVol*>(getVPhysVol(id, tableId));
return dynamic_cast<GeoVPhysVol*>(getVPhysVol(id, tableId, copyN));
//return dynamic_cast<GeoVPhysVol*>(getVPhysVol(id, tableId));
}
// B - if not built already, then get the actual volume,
......@@ -841,8 +841,8 @@ GeoVPhysVol* ReadGeoModel::buildVPhysVolInstance(const unsigned int id, const un
std::cout << "ERROR! VPhysVol not found! It should be already built, by now. Exiting...\n";
exit(EXIT_FAILURE);
}
//storeVPhysVol(id, tableId, copyN, vol);
storeVPhysVol(id, tableId, vol);
storeVPhysVol(id, tableId, copyN, vol);
//storeVPhysVol(id, tableId, vol);
return vol;
}
......@@ -3019,30 +3019,30 @@ GeoSerialTransformer* ReadGeoModel::getBuiltSerialTransformer(const unsigned int
*/
// --- methods for caching GeoPhysVol/GeoFullPhysVol nodes ---
//std::string getVPhysVolKey(const unsigned int id, const unsigned int tableId, const unsigned int copyNumber)
//{
//std::string key = std::to_string(id) + ":" + std::to_string(tableId) + ":" + std::to_string(copyNumber);
//return key;
//}
std::string getVPhysVolKey(const unsigned int id, const unsigned int tableId)
std::string getVPhysVolKey(const unsigned int id, const unsigned int tableId, const unsigned int copyNumber)
{
std::string key = std::to_string(id) + ":" + std::to_string(tableId);
std::string key = std::to_string(id) + ":" + std::to_string(tableId) + ":" + std::to_string(copyNumber);
return key;
}
//void ReadGeoModel::storeVPhysVol(const unsigned int id, const unsigned int tableId, const unsigned int copyN, GeoGraphNode* nodePtr)
void ReadGeoModel::storeVPhysVol(const unsigned int id, const unsigned int tableId, GeoGraphNode* nodePtr)
//std::string getVPhysVolKey(const unsigned int id, const unsigned int tableId)
//{
// std::string key = std::to_string(id) + ":" + std::to_string(tableId);
// return key;
//}
void ReadGeoModel::storeVPhysVol(const unsigned int id, const unsigned int tableId, const unsigned int copyN, GeoGraphNode* nodePtr)
//void ReadGeoModel::storeVPhysVol(const unsigned int id, const unsigned int tableId, GeoGraphNode* nodePtr)
{
std::lock_guard<std::mutex> lk(muxVPhysVol);
//std::string key = getVPhysVolKey(id, tableId, copyN);
std::string key = getVPhysVolKey(id, tableId);
std::string key = getVPhysVolKey(id, tableId, copyN);
//std::string key = getVPhysVolKey(id, tableId);
m_memMap[key] = nodePtr;
}
//GeoGraphNode* ReadGeoModel::getVPhysVol(const unsigned int id, const unsigned int tableId, const unsigned int copyN)
GeoGraphNode* ReadGeoModel::getVPhysVol(const unsigned int id, const unsigned int tableId)
GeoGraphNode* ReadGeoModel::getVPhysVol(const unsigned int id, const unsigned int tableId, const unsigned int copyN)
//GeoGraphNode* ReadGeoModel::getVPhysVol(const unsigned int id, const unsigned int tableId)
{
std::lock_guard<std::mutex> lk(muxVPhysVol);
//std::string key = getVPhysVolKey(id, tableId, copyN);
std::string key = getVPhysVolKey(id, tableId);
std::string key = getVPhysVolKey(id, tableId, copyN);
// std::string key = getVPhysVolKey(id, tableId);
if (m_memMap.find(key) == m_memMap.end()) {
return nullptr; // if volume is not found in cache
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment