diff --git a/DDCore/include/DD4hep/objects/DetectorInterna.h b/DDCore/include/DD4hep/objects/DetectorInterna.h index 9d66d8004e3d05d84c46510d0c6ca4bfa17515a7..5e5e69b2e212a602089c5e4a336e64e2424142ea 100644 --- a/DDCore/include/DD4hep/objects/DetectorInterna.h +++ b/DDCore/include/DD4hep/objects/DetectorInterna.h @@ -167,16 +167,19 @@ namespace DD4hep { std::vector<Alignment> volume_surveys; #endif - //@{ Cached information of the detector element + //@{ Cached information of the detector element. + /// The usage is deprecated and only present for backwards compatibility private: friend class VolumeManager_Populator; /// Intermediate buffer to store the transformation to the world coordination system TGeoHMatrix worldTrafo; /// Intermediate buffer to store the transformation to the parent detector element TGeoHMatrix parentTrafo; - //@} /// Create cached matrix to transform to parent coordinates - const TGeoHMatrix& parentTransformation(); + const TGeoHMatrix& __parentTransformation(); + /// Create cached matrix to transform to world coordinates + const TGeoHMatrix& __worldTransformation(); + //@} private: //@{ Private methods used internally by the object itself. */ @@ -198,8 +201,6 @@ namespace DD4hep { { return privateWorld.isValid() ? privateWorld : i_access_world(); } ConditionsContainer assign_conditions(); //@} - /// Create cached matrix to transform to world coordinates - const TGeoHMatrix& worldTransformation(); /// Remove callback from object void removeAtUpdate(unsigned int type, void* pointer); /// Trigger update callbacks diff --git a/DDCore/src/Detector.cpp b/DDCore/src/Detector.cpp index 0d1b6a3cc99ae0c8f64d6fa97621d77300f6213a..99f1066eb6868e8ecc4ed0aab13dcc68ba4b2390 100644 --- a/DDCore/src/Detector.cpp +++ b/DDCore/src/Detector.cpp @@ -358,40 +358,40 @@ const TGeoHMatrix& DetElement::parentTransformation() const { /// Transformation from local coordinates of the placed volume to the world system bool DetElement::localToWorld(const Position& local, Position& global) const { - DD4HEP_DEPRECATED_CALL("DetElement","DetElement::nominal()",__PRETTY_FUNCTION__); + DD4HEP_DEPRECATED_CALL("DetElement","DetElement::nominal() member functions",__PRETTY_FUNCTION__); Double_t master_point[3] = { 0, 0, 0 }, local_point[3] = { local.X(), local.Y(), local.Z() }; // If the path is unknown an exception will be thrown inside worldTransformation() ! - worldTransformation().LocalToMaster(local_point, master_point); + nominal().worldTransformation().LocalToMaster(local_point, master_point); global.SetCoordinates(master_point); return true; } /// Transformation from local coordinates of the placed volume to the parent system bool DetElement::localToParent(const Position& local, Position& global) const { - DD4HEP_DEPRECATED_CALL("DetElement","DetElement::nominal()",__PRETTY_FUNCTION__); - // If the path is unknown an exception will be thrown inside parentTransformation() ! + DD4HEP_DEPRECATED_CALL("DetElement","DetElement::nominal() member functions",__PRETTY_FUNCTION__); + // If the path is unknown an exception will be thrown inside detectorTransformation() ! Double_t master_point[3] = { 0, 0, 0 }, local_point[3] = { local.X(), local.Y(), local.Z() }; - parentTransformation().LocalToMaster(local_point, master_point); + nominal().detectorTransformation().LocalToMaster(local_point, master_point); global.SetCoordinates(master_point); return true; } /// Transformation from world coordinates of the local placed volume coordinates bool DetElement::worldToLocal(const Position& global, Position& local) const { - DD4HEP_DEPRECATED_CALL("DetElement","DetElement::nominal()",__PRETTY_FUNCTION__); + DD4HEP_DEPRECATED_CALL("DetElement","DetElement::nominal() member functions",__PRETTY_FUNCTION__); // If the path is unknown an exception will be thrown inside worldTransformation() ! Double_t master_point[3] = { global.X(), global.Y(), global.Z() }, local_point[3] = { 0, 0, 0 }; - worldTransformation().MasterToLocal(master_point, local_point); + nominal().worldTransformation().MasterToLocal(master_point, local_point); local.SetCoordinates(local_point); return true; } /// Transformation from parent coordinates of the local placed volume coordinates bool DetElement::parentToLocal(const Position& global, Position& local) const { - DD4HEP_DEPRECATED_CALL("DetElement","DetElement::nominal()",__PRETTY_FUNCTION__); - // If the path is unknown an exception will be thrown inside parentTransformation() ! + DD4HEP_DEPRECATED_CALL("DetElement","DetElement::nominal() member functions",__PRETTY_FUNCTION__); + // If the path is unknown an exception will be thrown inside detectorTransformation() ! Double_t master_point[3] = { global.X(), global.Y(), global.Z() }, local_point[3] = { 0, 0, 0 }; - parentTransformation().MasterToLocal(master_point, local_point); + nominal().detectorTransformation().MasterToLocal(master_point, local_point); local.SetCoordinates(local_point); return true; } diff --git a/DDCore/src/DetectorInterna.cpp b/DDCore/src/DetectorInterna.cpp index 12739934080f24b6ab569d51e825d69c26591e77..74b2dc0bc4b4b6695f303f78c617a09addadfc64 100644 --- a/DDCore/src/DetectorInterna.cpp +++ b/DDCore/src/DetectorInterna.cpp @@ -152,8 +152,8 @@ World DetElementObject::i_access_world() { } /// Create cached matrix to transform to world coordinates -const TGeoHMatrix& DetElementObject::worldTransformation() { - DD4HEP_DEPRECATED_CALL("DetElementObject","DetElement::nominal()",__PRETTY_FUNCTION__); +const TGeoHMatrix& DetElementObject::__worldTransformation() { + //DD4HEP_DEPRECATED_CALL("DetElementObject","DetElement::nominal()",__PRETTY_FUNCTION__); if ( (flag&HAVE_WORLD_TRAFO) == 0 ) { PlacementPath nodes; flag |= HAVE_WORLD_TRAFO; @@ -164,8 +164,8 @@ const TGeoHMatrix& DetElementObject::worldTransformation() { } /// Create cached matrix to transform to parent coordinates -const TGeoHMatrix& DetElementObject::parentTransformation() { - DD4HEP_DEPRECATED_CALL("DetElementObject","DetElement::nominal()",__PRETTY_FUNCTION__); +const TGeoHMatrix& DetElementObject::__parentTransformation() { + //DD4HEP_DEPRECATED_CALL("DetElementObject","DetElement::nominal()",__PRETTY_FUNCTION__); if ( (flag&HAVE_PARENT_TRAFO) == 0 ) { PlacementPath nodes; flag |= HAVE_PARENT_TRAFO; diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index be00cbe6d31e9350b5ca4f6bdffa12b36e65119c..5fd9b37bce1ed5e8b368cf0b1150b6119f37ff61 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -33,7 +33,12 @@ namespace DD4hep { /// Namespace for the geometry part of the AIDA detector description toolkit namespace Geometry { - struct VolumeManager_Populator { + /// Helper class to populate the volume manager + /** + * \author M.Frank + * \version 1.0 + */ + class VolumeManager_Populator { typedef PlacedVolume::VolIDs VolIDs; typedef vector<TGeoNode*> Chain; typedef pair<VolumeID, VolumeID> Encoding; @@ -43,6 +48,8 @@ namespace DD4hep { VolumeManager m_volManager; /// Set of already added entries set<VolumeID> m_entries; + + public: /// Default constructor VolumeManager_Populator(LCDD& lcdd, VolumeManager vm) : m_lcdd(lcdd), m_volManager(vm) { @@ -326,7 +333,7 @@ namespace DD4hep { } { double epsilon = 1e-12; - const Double_t* t1 = e->worldTransformation().GetTranslation(); + const Double_t* t1 = e->__worldTransformation().GetTranslation(); const Double_t* t2 = e.nominal().worldTransformation().GetTranslation(); for(int i=0; i<3; ++i) { if ( std::fabs(t1[i]-t2[i]) > epsilon ) { @@ -344,7 +351,7 @@ namespace DD4hep { break; } } - const Double_t* r1 = e->worldTransformation().GetRotationMatrix(); + const Double_t* r1 = e->__worldTransformation().GetRotationMatrix(); const Double_t* r2 = e.nominal().worldTransformation().GetRotationMatrix(); for(int i=0; i<9; ++i) { if ( std::fabs(r1[i]-r2[i]) > epsilon ) { @@ -365,7 +372,7 @@ namespace DD4hep { } { double epsilon = 1e-12; - const Double_t* t1 = e->parentTransformation().GetTranslation(); + const Double_t* t1 = e->__parentTransformation().GetTranslation(); const Double_t* t2 = e.nominal().detectorTransformation().GetTranslation(); for(int i=0; i<3; ++i) { if ( std::fabs(t1[i]-t2[i]) > epsilon ) { @@ -383,7 +390,7 @@ namespace DD4hep { break; } } - const Double_t* r1 = e->parentTransformation().GetRotationMatrix(); + const Double_t* r1 = e->__parentTransformation().GetRotationMatrix(); const Double_t* r2 = e.nominal().detectorTransformation().GetRotationMatrix(); for(int i=0; i<9; ++i) { if ( std::fabs(r1[i]-r2[i]) > epsilon ) { @@ -437,7 +444,7 @@ namespace DD4hep { } context->toDetector = context->toWorld; context->toDetector.MultiplyLeft(nodes[0]->GetMatrix()); - context->toWorld.MultiplyLeft(&parent->worldTransformation()); + context->toWorld.MultiplyLeft(&parent.worldTransformation()); //context->toWorld.MultiplyLeft(&parent.nominal().worldTransformation()); if (!section.adoptPlacement(context)) { print_node(sd, parent, e, n, ids, nodes);