diff --git a/DDCore/include/DD4hep/Detector.h b/DDCore/include/DD4hep/Detector.h index 95a57da98c7ef68879d09a300e42e9b73606c313..ee6094646c7e7f91c90258860075ec89aa9ed8e5 100644 --- a/DDCore/include/DD4hep/Detector.h +++ b/DDCore/include/DD4hep/Detector.h @@ -286,7 +286,7 @@ namespace dd4hep { /// Stupid legacy method virtual void dump() const = 0; /// Manipulate geometry using factory converter - virtual long apply(const char* factory, int argc, char** argv) = 0; + virtual long apply(const char* factory, int argc, char** argv) const = 0; /// Add an extension object to the detector element (low level member function) virtual void* addUserExtension(unsigned long long int key, ExtensionEntry* entry) = 0; diff --git a/DDCore/include/DD4hep/VolumeManager.h b/DDCore/include/DD4hep/VolumeManager.h index 0e6c0fd109e77d6dfd39d167ef19f5e83ec26f62..3cb72178fe205304dc496acc0099baa51941bfbd 100644 --- a/DDCore/include/DD4hep/VolumeManager.h +++ b/DDCore/include/DD4hep/VolumeManager.h @@ -146,7 +146,7 @@ namespace dd4hep { * Please see enum PopulateFlags for further info. * No action whatsoever is performed here, if the detector element is not valid. */ - VolumeManager(Detector& description, + VolumeManager(const Detector& description, const std::string& name, DetElement world = DetElement(), Readout ro = Readout(), @@ -155,7 +155,7 @@ namespace dd4hep { VolumeManager(DetElement subdetector, Readout ro); /// static accessor calling DD4hepVolumeManagerPlugin if necessary - static VolumeManager getVolumeManager(Detector& description); + static VolumeManager getVolumeManager(const Detector& description); /// Assignment operator VolumeManager& operator=(const VolumeManager& m) = default; diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp index 2a43619e2c0c0b36f739d8c580966a231c12d2bc..1192a8f568822bc8518938e1aa1a220698abf82f 100644 --- a/DDCore/src/DetectorImp.cpp +++ b/DDCore/src/DetectorImp.cpp @@ -698,7 +698,7 @@ void DetectorImp::dump() const { } /// Manipulate geometry using facroy converter -long DetectorImp::apply(const char* factory_type, int argc, char** argv) { +long DetectorImp::apply(const char* factory_type, int argc, char** argv) const { string fac = factory_type; try { long result = PluginService::Create<long>(fac, (Detector*) this, argc, argv); diff --git a/DDCore/src/DetectorImp.h b/DDCore/src/DetectorImp.h index be947b8ddf4402f0fe3d9087ec0e2faae5e6a582..441f30a6046ff5d0001e2acf10ce7621dbc3bf8c 100644 --- a/DDCore/src/DetectorImp.h +++ b/DDCore/src/DetectorImp.h @@ -112,7 +112,7 @@ namespace dd4hep { virtual void dump() const override; /// Manipulate geometry using facroy converter - virtual long apply(const char* factory, int argc, char** argv) override; + virtual long apply(const char* factory, int argc, char** argv) const override; /// Open the geometry at startup. virtual void init() override; diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index dc06b84cba2211928def066e56ef242927d58d0d..162be4e01276635fed76e680084e3f98509ab261 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -63,19 +63,19 @@ namespace dd4hep { typedef PlacedVolume::VolIDs VolIDs; typedef pair<VolumeID, VolumeID> Encoding; /// Reference to the Detector instance - Detector& m_detDesc; + const Detector& m_detDesc; /// Reference to the volume manager to be populated - VolumeManager m_volManager; + VolumeManager m_volManager; /// Set of already added entries - set<VolumeID> m_entries; + set<VolumeID> m_entries; /// Debug flag - bool m_debug = false; + bool m_debug = false; /// Node counter - size_t m_numNodes = 0; + size_t m_numNodes = 0; public: /// Default constructor - VolumeManager_Populator(Detector& description, VolumeManager vm) + VolumeManager_Populator(const Detector& description, VolumeManager vm) : m_detDesc(description), m_volManager(vm) { m_debug = (0 != ::getenv("DD4HEP_VOLMGR_DEBUG")); @@ -343,7 +343,7 @@ const TGeoHMatrix& VolumeManagerContext::toElement() const { } /// Initializing constructor to create a new object -VolumeManager::VolumeManager(Detector& description, const string& nam, DetElement elt, Readout ro, int flags) { +VolumeManager::VolumeManager(const Detector& description, const string& nam, DetElement elt, Readout ro, int flags) { printout(INFO, "VolumeManager", " - populating volume ids - be patient ..." ); size_t node_count = 0; Object* obj_ptr = new Object(); @@ -368,7 +368,7 @@ VolumeManager::VolumeManager(DetElement sub_detector, Readout ro) { assign(obj_ptr, sub_detector.name(), "VolumeManager"); } -VolumeManager VolumeManager::getVolumeManager(Detector& description) { +VolumeManager VolumeManager::getVolumeManager(const Detector& description) { if( not description.volumeManager().isValid() ) { description.apply("DD4hepVolumeManager", 0, 0); } diff --git a/DDG4/include/DDG4/Geant4Converter.h b/DDG4/include/DDG4/Geant4Converter.h index b3c190f65c92126ceee11f2e6e5db0cf6b5ddd90..7b46df9526b7562547745cacd85608e6898cf497 100644 --- a/DDG4/include/DDG4/Geant4Converter.h +++ b/DDG4/include/DDG4/Geant4Converter.h @@ -57,10 +57,10 @@ namespace dd4hep { PrintLevel outputLevel; /// Initializing Constructor - Geant4Converter(Detector& description); + Geant4Converter(const Detector& description); /// Initializing Constructor - Geant4Converter(Detector& description, PrintLevel level); + Geant4Converter(const Detector& description, PrintLevel level); /// Standard destructor virtual ~Geant4Converter(); diff --git a/DDG4/include/DDG4/Geant4Mapping.h b/DDG4/include/DDG4/Geant4Mapping.h index 4d5eed2e85c8703b765c4d131dcfee7af1c978e1..10956e8c30ebb7120e87d7dbe4259948e2de6431 100644 --- a/DDG4/include/DDG4/Geant4Mapping.h +++ b/DDG4/include/DDG4/Geant4Mapping.h @@ -34,14 +34,14 @@ namespace dd4hep { */ class Geant4Mapping: public detail::GeoHandlerTypes { protected: - Detector& m_detDesc; + const Detector& m_detDesc; Geant4GeometryInfo* m_dataPtr; /// When resolving pointers, we must check for the validity of the data block void checkValidity() const; public: /// Initializing Constructor - Geant4Mapping(Detector& description); + Geant4Mapping(const Detector& description); /// Standard destructor virtual ~Geant4Mapping(); @@ -50,7 +50,7 @@ namespace dd4hep { static Geant4Mapping& instance(); /// Accesor to the Detector instance - Detector& detectorDescription() const { + const Detector& detectorDescription() const { return m_detDesc; } diff --git a/DDG4/include/DDG4/Geant4VolumeManager.h b/DDG4/include/DDG4/Geant4VolumeManager.h index b3c9a0fea4f6d53c0f69b32fe7fa974a9b63e0f9..a7f9991d81a86b151d27db8bebe42418db392a0c 100644 --- a/DDG4/include/DDG4/Geant4VolumeManager.h +++ b/DDG4/include/DDG4/Geant4VolumeManager.h @@ -53,7 +53,7 @@ namespace dd4hep { static const VolumeID NonExisting = 0ULL; /// Initializing constructor. The tree will automatically be built if possible - Geant4VolumeManager(Detector& description, Geant4GeometryInfo* info); + Geant4VolumeManager(const Detector& description, Geant4GeometryInfo* info); /// Default constructor Geant4VolumeManager() = default; /// Constructor to be used when reading the already parsed object diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index 727e476f76563dfe75a51f55f1297757b362a641..fcfba4fbb4d609e924be8dbccf640b5cd975f953 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -269,7 +269,7 @@ namespace { } /// Initializing Constructor -Geant4Converter::Geant4Converter(Detector& description_ref) +Geant4Converter::Geant4Converter(const Detector& description_ref) : Geant4Mapping(description_ref), checkOverlaps(true) { this->Geant4Mapping::init(); m_propagateRegions = true; @@ -277,7 +277,7 @@ Geant4Converter::Geant4Converter(Detector& description_ref) } /// Initializing Constructor -Geant4Converter::Geant4Converter(Detector& description_ref, PrintLevel level) +Geant4Converter::Geant4Converter(const Detector& description_ref, PrintLevel level) : Geant4Mapping(description_ref), checkOverlaps(true) { this->Geant4Mapping::init(); m_propagateRegions = true; diff --git a/DDG4/src/Geant4Mapping.cpp b/DDG4/src/Geant4Mapping.cpp index 9bc8efcf83f3735f74f0a384329b04bcd2b19099..0521bdcccc5532acc76ffd82ec18811c960812da 100644 --- a/DDG4/src/Geant4Mapping.cpp +++ b/DDG4/src/Geant4Mapping.cpp @@ -24,7 +24,7 @@ using namespace dd4hep; using namespace std; /// Initializing Constructor -Geant4Mapping::Geant4Mapping(Detector& description_ref) +Geant4Mapping::Geant4Mapping(const Detector& description_ref) : m_detDesc(description_ref), m_dataPtr(0) { } @@ -73,7 +73,7 @@ void Geant4Mapping::attach(Geant4GeometryInfo* data_ptr) { Geant4VolumeManager Geant4Mapping::volumeManager() const { if ( m_dataPtr ) { if ( m_dataPtr->g4Paths.empty() ) { - VolumeManager::getVolumeManager(m_detDesc); + //VolumeManager::getVolumeManager(m_detDesc); return Geant4VolumeManager(m_detDesc, m_dataPtr); } return Geant4VolumeManager(Handle < Geant4GeometryInfo > (m_dataPtr)); diff --git a/DDG4/src/Geant4VolumeManager.cpp b/DDG4/src/Geant4VolumeManager.cpp index c7d395d183e1c16d5b18129b397fa9d0116b4bff..b3ac6ca8a910538973b597154efe945a895b55cc 100644 --- a/DDG4/src/Geant4VolumeManager.cpp +++ b/DDG4/src/Geant4VolumeManager.cpp @@ -44,14 +44,14 @@ namespace { typedef vector<const TGeoNode*> Chain; typedef map<VolumeID,Geant4GeometryInfo::Geant4PlacementPath> Registries; /// Reference to the Detector instance - Detector& m_detDesc; + const Detector& m_detDesc; /// Set of already added entries Registries m_entries; /// Reference to Geant4 translation information Geant4GeometryInfo& m_geo; /// Default constructor - Populator(Detector& description, Geant4GeometryInfo& g) + Populator(const Detector& description, Geant4GeometryInfo& g) : m_detDesc(description), m_geo(g) { } @@ -185,7 +185,7 @@ namespace { } /// Initializing constructor. The tree will automatically be built if possible -Geant4VolumeManager::Geant4VolumeManager(Detector& description, Geant4GeometryInfo* info) +Geant4VolumeManager::Geant4VolumeManager(const Detector& description, Geant4GeometryInfo* info) : Handle<Geant4GeometryInfo>(info), m_isValid(false) { if (info && info->valid && info->g4Paths.empty()) { Populator p(description, *info);