From 1bf2e19aae13474ffdf7f9d93a9bb95d7a15cdf6 Mon Sep 17 00:00:00 2001 From: Markus FRANK <Markus.Frank@cern.ch> Date: Tue, 13 Apr 2021 11:51:00 +0200 Subject: [PATCH] Adopt new naming convention for Geant4 assembly imprints to allow recuperation of mother/daughter copy numbers --- DDG4/include/DDG4/Geant4AssemblyVolume.h | 19 ++++------------- DDG4/src/Geant4AssemblyVolume.cpp | 27 +++++++++++++++++++++--- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/DDG4/include/DDG4/Geant4AssemblyVolume.h b/DDG4/include/DDG4/Geant4AssemblyVolume.h index 7e2040687..d262b0ea3 100644 --- a/DDG4/include/DDG4/Geant4AssemblyVolume.h +++ b/DDG4/include/DDG4/Geant4AssemblyVolume.h @@ -63,21 +63,10 @@ namespace dd4hep { ~Geant4AssemblyVolume() { } - //std::vector<G4AssemblyTriplet>& triplets() { return fTriplets; } - long placeVolume(const TGeoNode* n, G4LogicalVolume* pPlacedVolume, G4Transform3D& transformation) { - size_t id = fTriplets.size(); - m_entries.push_back(n); - this->AddPlacedVolume(pPlacedVolume, transformation); - return (long)id; - } - - long placeAssembly(const TGeoNode* n, Geant4AssemblyVolume* pPlacedVolume, G4Transform3D& transformation) { - size_t id = fTriplets.size(); - m_entries.push_back(n); - this->AddPlacedAssembly(pPlacedVolume, transformation); - return (long)id; - } - + long placeVolume(const TGeoNode* n, G4LogicalVolume* pPlacedVolume, G4Transform3D& transformation); + + long placeAssembly(const TGeoNode* n, Geant4AssemblyVolume* pPlacedVolume, G4Transform3D& transformation); + void imprint(Geant4GeometryInfo& info, const TGeoNode* n, Chain chain, diff --git a/DDG4/src/Geant4AssemblyVolume.cpp b/DDG4/src/Geant4AssemblyVolume.cpp index cf3fdb958..a5804f4b1 100644 --- a/DDG4/src/Geant4AssemblyVolume.cpp +++ b/DDG4/src/Geant4AssemblyVolume.cpp @@ -27,6 +27,26 @@ using namespace dd4hep::sim; +long Geant4AssemblyVolume::placeVolume(const TGeoNode* n, + G4LogicalVolume* pPlacedVolume, + G4Transform3D& transformation) +{ + size_t id = fTriplets.size(); + m_entries.emplace_back(n); + this->AddPlacedVolume(pPlacedVolume, transformation); + return (long)id; +} + +long Geant4AssemblyVolume::placeAssembly(const TGeoNode* n, + Geant4AssemblyVolume* pPlacedVolume, + G4Transform3D& transformation) +{ + size_t id = fTriplets.size(); + m_entries.emplace_back(n); + this->AddPlacedAssembly(pPlacedVolume, transformation); + return (long)id; +} + void Geant4AssemblyVolume::imprint(Geant4GeometryInfo& info, const TGeoNode* parent, Chain chain, @@ -51,8 +71,9 @@ void Geant4AssemblyVolume::imprint(Geant4GeometryInfo& info, //cout << " Assembly:" << detail::tools::placementPath(chain) << endl; for( unsigned int i = 0; i < triplets.size(); i++ ) { - const TGeoNode* node = pParentAssembly->m_entries[i]; Chain new_chain = chain; + const TGeoNode* node = pParentAssembly->m_entries[i]; + new_chain.emplace_back(node); //cout << " Assembly: Entry: " << detail::tools::placementPath(new_chain) << endl; @@ -91,9 +112,9 @@ void Geant4AssemblyVolume::imprint(Geant4GeometryInfo& info, << ':' << parent->GetNumber() << '#' - << m_entries[i]->GetName() + << node->GetName() << ':' - << m_entries[i]->GetNumber() + << node->GetNumber() << std::ends; // Generate a new physical volume instance inside a mother // (as we allow 3D transformation use G4ReflectionFactory to -- GitLab