diff --git a/DDAlign/include/DDAlign/AlignmentTags.h b/DDAlign/include/DDAlign/AlignmentTags.h index eb1afe8f5..530a1e357 100644 --- a/DDAlign/include/DDAlign/AlignmentTags.h +++ b/DDAlign/include/DDAlign/AlignmentTags.h @@ -13,8 +13,8 @@ #ifndef DDALIGN_ALIGNMENTTAGS_H #define DDALIGN_ALIGNMENTTAGS_H -// Framework include files -#include "XML/XMLElements.h" +/// Framework include files +#include #ifndef UNICODE #define UNICODE(x) extern const ::dd4hep::xml::Tag_t Unicode_##x #endif @@ -45,7 +45,7 @@ namespace dd4hep { } #undef UNICODE // Do not miss this one! -#include "XML/XMLTags.h" +#include #define _ALU(a) ::dd4hep::DDAlign::Unicode_##a diff --git a/DDAlign/include/DDAlign/AlignmentsCalib.h b/DDAlign/include/DDAlign/AlignmentsCalib.h index aac045d9e..8b2273651 100644 --- a/DDAlign/include/DDAlign/AlignmentsCalib.h +++ b/DDAlign/include/DDAlign/AlignmentsCalib.h @@ -14,11 +14,11 @@ #define DDALIGN_ALIGNMENTSCALIB_H // Framework includes -#include "DD4hep/DetElement.h" -#include "DD4hep/Alignments.h" -#include "DD4hep/AlignmentData.h" -#include "DD4hep/ConditionsMap.h" -#include "DD4hep/AlignmentsCalculator.h" +#include +#include +#include +#include +#include // C/C++ include files #include diff --git a/DDAlign/include/DDAlign/GlobalAlignmentCache.h b/DDAlign/include/DDAlign/GlobalAlignmentCache.h index 85700cbde..a14694042 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentCache.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentCache.h @@ -14,9 +14,9 @@ #define DDALIGN_GLOBALALIGNMENTCACHE_H // Framework include files -#include "DD4hep/ExtensionEntry.h" -#include "DD4hep/GlobalAlignment.h" -#include "DDAlign/GlobalAlignmentStack.h" +#include +#include +#include /// Namespace for the AIDA detector description toolkit namespace dd4hep { diff --git a/DDAlign/include/DDAlign/GlobalAlignmentOperators.h b/DDAlign/include/DDAlign/GlobalAlignmentOperators.h index 510089502..e2a19a936 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentOperators.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentOperators.h @@ -14,9 +14,9 @@ #define DDALIGN_GLOBALALIGNMENTOPERATORS_H // Framework include files -#include "DD4hep/Alignments.h" -#include "DD4hep/GlobalAlignment.h" -#include "DDAlign/GlobalAlignmentCache.h" +#include +#include +#include /// Namespace for the AIDA detector description toolkit namespace dd4hep { diff --git a/DDAlign/include/DDAlign/GlobalAlignmentStack.h b/DDAlign/include/DDAlign/GlobalAlignmentStack.h index 75483b75f..3543358fc 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentStack.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentStack.h @@ -14,10 +14,9 @@ #define DDALIGN_GLOBALALIGNMENTSTACK_H // Framework include files -#include "DD4hep/Alignments.h" -#include "DD4hep/AlignmentData.h" -//#include "DD4hep/Objects.h" -#include "DD4hep/Memory.h" +#include +#include +#include /// Namespace for the AIDA detector description toolkit diff --git a/DDAlign/include/DDAlign/GlobalAlignmentWriter.h b/DDAlign/include/DDAlign/GlobalAlignmentWriter.h index 0909b6424..3ebf47118 100644 --- a/DDAlign/include/DDAlign/GlobalAlignmentWriter.h +++ b/DDAlign/include/DDAlign/GlobalAlignmentWriter.h @@ -14,9 +14,9 @@ #define DDALIGN_GLOBALALIGNMENTWRITER_H // Framework include files -#include "XML/XMLElements.h" -#include "DD4hep/DetElement.h" -#include "DD4hep/GlobalAlignment.h" +#include +#include +#include /// Namespace for the AIDA detector description toolkit namespace dd4hep { diff --git a/DDAlign/include/DDAlign/GlobalDetectorAlignment.h b/DDAlign/include/DDAlign/GlobalDetectorAlignment.h index 81706df59..49c7bc92a 100644 --- a/DDAlign/include/DDAlign/GlobalDetectorAlignment.h +++ b/DDAlign/include/DDAlign/GlobalDetectorAlignment.h @@ -14,8 +14,8 @@ #define DDALIGN_GLOBALDETECTORALIGNMENT_H // Framework include files -#include "DD4hep/DetElement.h" -#include "DD4hep/GlobalAlignment.h" +#include +#include // Forward declarations class TGeoHMatrix; diff --git a/DDAlign/src/GlobalDetectorAlignment.cpp b/DDAlign/src/GlobalDetectorAlignment.cpp index ecff68eb7..daafddb86 100644 --- a/DDAlign/src/GlobalDetectorAlignment.cpp +++ b/DDAlign/src/GlobalDetectorAlignment.cpp @@ -24,11 +24,15 @@ #include #include - #ifdef __GNUC__ // Disable some diagnostics. #pragma GCC diagnostic ignored "-Wunused-function" #endif +using LevelElements = std::vector >; +using namespace dd4hep::align; +using dd4hep::printout; +using dd4hep::INFO; + /// Namespace for the AIDA detector description toolkit namespace dd4hep { @@ -43,63 +47,95 @@ namespace dd4hep { */ class GlobalAlignmentData : public NamedObject { public: - GlobalAlignment global; + GlobalAlignment global; std::vector volume_alignments; + public: - GlobalAlignmentData(const std::string& path) : NamedObject(path,"global-alignment") { - global = GlobalAlignment(path); + GlobalAlignmentData(const std::string& path) + : NamedObject(path, "global-alignment") + { + this->global = GlobalAlignment( path ); } - virtual ~GlobalAlignmentData() { - detail::destroyHandle (global); + virtual ~GlobalAlignmentData() { + detail::destroyHandle( this->global ); } }; - } /* End namespace Aligments */ -} /* End namespace dd4hep */ - -using namespace dd4hep::align; -typedef std::vector > LevelElements; + } /* End namespace Aligments */ +} /* End namespace dd4hep */ DD4HEP_INSTANTIATE_HANDLE_NAMED(GlobalAlignmentData); namespace { - static bool s_GlobalDetectorAlignment_debug = false; - + static bool s_GlobalDetectorAlignment_debug = true; + GlobalAlignment _align(const GlobalAlignment& a, TGeoHMatrix* transform, bool check, double overlap) { - TGeoPhysicalNode* n = a.ptr(); - if ( n ) { - TGeoMatrix* mm = n->GetNode()->GetMatrix(); + TGeoPhysicalNode* node = a.ptr(); + if ( node ) { + TGeoMatrix* mm = node->GetNode()->GetMatrix(); bool dbg = GlobalDetectorAlignment::debug(); if ( dbg ) { - printout(dd4hep::INFO,"Alignment","DELTA matrix of %s", n->GetName()); + printout(INFO, "Alignment", "DELTA matrix of %s", node->GetName()); transform->Print(); - dd4hep::printout(dd4hep::INFO,"Alignment","OLD matrix of %s", n->GetName()); + printout(INFO, "Alignment", "OLD matrix of %s", node->GetName()); mm->Print(); } + std::vector places; + for( int i = 0; i < node->GetLevel(); ++i ) + places.emplace_back(node->GetNode(i+1)); + transform->MultiplyLeft(mm); // orig * delta - n->Align(transform, 0, check, overlap); - if ( dbg ) { - dd4hep::printout(dd4hep::INFO,"Alignment","NEW matrix of %s", n->GetName()); - n->GetNode()->GetMatrix()->Print(); + node->Align(transform, 0, check, overlap); + if ( dbg ) { + printout(INFO, "Alignment", "NEW matrix of %s", node->GetName()); + node->GetNode()->GetMatrix()->Print(); } + + for( int i = 0; i < node->GetLevel(); ++i ) { + //const char *tag = " "; + dd4hep::PlacedVolume p = node->GetNode(i+1); + if ( nullptr == p->GetUserExtension() ) { + //tag = "SET "; + p->SetUserExtension(places[i]->GetUserExtension()); + } +#if 0 + printout(INFO, "Alignment", "_align(places): %s Path[%d]: %-24s %p <-> %p %s", + tag, i, p.name(), p.ptr(), places[i].ptr(), places[i].name()); + tag = " "; +#endif + dd4hep::Volume v = p->GetVolume(); + if ( nullptr == v->GetUserExtension() ) { + //tag = "SET "; + v->SetUserExtension(places[i].volume()->GetUserExtension()); + } +#if 0 + printout(INFO, "Alignment", "_align(volumes): %s Path[%d]: %-24s %p <-> %p %s", + tag, i, v.name(), v.ptr(), places[i].volume().ptr(), places[i].volume().name()); + p.access(); + v.access(); + places[i].access(); + places[i].volume().access(); +#endif + } + /* - printout(dd4hep::INFO,"Alignment","Apply new relative matrix mother to daughter:"); + printout(INFO, "Alignment", "Apply new relative matrix mother to daughter:"); transform->Print(); transform->MultiplyLeft(mm); // orig * delta - printout(dd4hep::INFO,"Alignment","With deltas %s ....", n->GetName()); + printout(INFO, "Alignment", "With deltas %s ....", n->GetName()); transform->Print(); n->Align(transform, 0, check, overlap); - + Position local, global = a.toGlobal(local); cout << "Local:" << local << " Global: " << global << " and back:" << a.globalToLocal(global) << endl; */ - return GlobalAlignment(n); + return GlobalAlignment(node); } dd4hep::except("GlobalDetectorAlignment", "Cannot align non existing physical node. [Invalid Handle]"); return { }; } - + GlobalAlignment _alignment(const GlobalDetectorAlignment& det) { dd4hep::DetElement::Object& e = det._data(); if ( !e.global_alignment.isValid() ) { @@ -118,17 +154,17 @@ namespace { int level = 0; dd4hep::detail::tools::PlacementPath nodes; dd4hep::detail::tools::ElementPath det_nodes; - dd4hep::detail::tools::placementPath(det,nodes); - dd4hep::detail::tools::elementPath(det,det_nodes); + dd4hep::detail::tools::placementPath(det, nodes); + dd4hep::detail::tools::elementPath(det, det_nodes); /// std::cout << "Placement path:"; dd4hep::detail::tools::PlacementPath::const_reverse_iterator j=nodes.rbegin(); dd4hep::detail::tools::ElementPath::const_reverse_iterator k=det_nodes.rbegin(); for(; j!=nodes.rend(); ++j, ++level) { //cout << "(" << level << ") " << (void*)((*j).ptr()) // << " " << string((*j)->GetName()) << " "; - if ( ::strcmp((*j).ptr()->GetName(),(*k).placement().ptr()->GetName()) ) { + if ( ::strcmp((*j).ptr()->GetName(), (*k).placement().ptr()->GetName()) ) { //cout << "[DE]"; - elements.emplace_back(level,*k); + elements.emplace_back(level, *k); ++k; } else { @@ -166,7 +202,7 @@ bool GlobalDetectorAlignment::debug(bool value) { /// Collect all placements from the detector element up to the world volume void GlobalDetectorAlignment::collectNodes(std::vector& nodes) { - detail::tools::placementPath(*this,nodes); + detail::tools::placementPath(*this, nodes); } /// Access to the alignment block @@ -188,62 +224,62 @@ const std::vector& GlobalDetectorAlignment::volumeAlignments() /// Align the PhysicalNode of the placement of the detector element (translation only) GlobalAlignment GlobalDetectorAlignment::align(const Position& pos, bool chk, double overlap) { - return align(detail::matrix::_transform(pos),chk,overlap); + return align(detail::matrix::_transform(pos), chk, overlap); } /// Align the PhysicalNode of the placement of the detector element (rotation only) GlobalAlignment GlobalDetectorAlignment::align(const RotationZYX& rot, bool chk, double overlap) { - return align(detail::matrix::_transform(rot),chk,overlap); + return align(detail::matrix::_transform(rot), chk, overlap); } /// Align the PhysicalNode of the placement of the detector element (translation + rotation) GlobalAlignment GlobalDetectorAlignment::align(const Position& pos, const RotationZYX& rot, bool chk, double overlap) { - return align(detail::matrix::_transform(pos,rot),chk,overlap); + return align(detail::matrix::_transform(pos, rot), chk, overlap); } /// Align the physical node according to a generic Transform3D GlobalAlignment GlobalDetectorAlignment::align(const Transform3D& transform, bool chk, double overlap) { - return align(detail::matrix::_transform(transform),chk,overlap); + return align(detail::matrix::_transform(transform), chk, overlap); } /// Align the physical node according to a generic TGeo matrix GlobalAlignment GlobalDetectorAlignment::align(TGeoHMatrix* matrix, bool chk, double overlap) { - return _align(_alignment(*this),matrix,chk,overlap); + return _align(_alignment(*this), matrix, chk, overlap); } /// Align the PhysicalNode of the placement of the detector element (translation only) GlobalAlignment GlobalDetectorAlignment::align(const std::string& elt_path, const Position& pos, bool chk, double overlap) { - return align(elt_path,detail::matrix::_transform(pos),chk,overlap); + return align(elt_path,detail::matrix::_transform(pos), chk, overlap); } /// Align the PhysicalNode of the placement of the detector element (rotation only) GlobalAlignment GlobalDetectorAlignment::align(const std::string& elt_path, const RotationZYX& rot, bool chk, double overlap) { - return align(elt_path,detail::matrix::_transform(rot),chk,overlap); + return align(elt_path,detail::matrix::_transform(rot), chk, overlap); } /// Align the PhysicalNode of the placement of the detector element (translation + rotation) GlobalAlignment GlobalDetectorAlignment::align(const std::string& elt_path, const Position& pos, const RotationZYX& rot, bool chk, double overlap) { - return align(elt_path,detail::matrix::_transform(pos,rot),chk,overlap); + return align(elt_path,detail::matrix::_transform(pos, rot), chk, overlap); } /// Align the physical node according to a generic Transform3D GlobalAlignment GlobalDetectorAlignment::align(const std::string& elt_path, const Transform3D& transform, bool chk, double overlap) { - return align(elt_path,detail::matrix::_transform(transform),chk,overlap); + return align(elt_path,detail::matrix::_transform(transform), chk, overlap); } /// Align the physical node according to a generic TGeo matrix GlobalAlignment GlobalDetectorAlignment::align(const std::string& elt_path, TGeoHMatrix* matrix, bool chk, double overlap) { if ( elt_path.empty() ) - return _align(_alignment(*this),matrix,chk,overlap); + return _align(_alignment(*this), matrix, chk, overlap); else if ( elt_path == placementPath() ) - return _align(_alignment(*this),matrix,chk,overlap); + return _align(_alignment(*this), matrix, chk, overlap); else if ( elt_path[0] == '/' ) { GlobalAlignment a(elt_path); volumeAlignments().emplace_back(a); - return _align(a,matrix,chk,overlap); + return _align(a, matrix, chk, overlap); } - GlobalAlignment a(placementPath()+'/'+elt_path); + GlobalAlignment a(placementPath() + '/' + elt_path); volumeAlignments().emplace_back(a); - return _align(a,matrix,chk,overlap); + return _align(a, matrix, chk, overlap); } diff --git a/DDCore/src/GlobalAlignment.cpp b/DDCore/src/GlobalAlignment.cpp index b97658a60..cc06eca25 100644 --- a/DDCore/src/GlobalAlignment.cpp +++ b/DDCore/src/GlobalAlignment.cpp @@ -13,47 +13,42 @@ // Framework include files #include -#include #include #include // ROOT include files -#include #include -using namespace dd4hep; -using namespace dd4hep::align; - namespace { struct CheckHandle { - CheckHandle(const GlobalAlignment& a) { + CheckHandle(const dd4hep::align::GlobalAlignment& a) { if ( a.isValid() ) return; - except("dd4hep:GlobalAlignment", "Attempt to access invalid alignment object. [Invalid Handle]"); + dd4hep::except("dd4hep:GlobalAlignment", "Attempt to access invalid alignment object. [Invalid Handle]"); } ~CheckHandle() {} }; } /// Initializing constructor to create a new object -GlobalAlignment::GlobalAlignment(const std::string& path) { +dd4hep::align::GlobalAlignment::GlobalAlignment(const std::string& path) { //cout << "GlobalAlignment: path=" << path << endl; m_element = new TGeoPhysicalNode(path.c_str()); } /// Number of nodes in this branch -int GlobalAlignment::numNodes() const { +int dd4hep::align::GlobalAlignment::numNodes() const { CheckHandle verify_handle(*this); return ptr()->GetLevel(); } /// Access the placement of this node -PlacedVolume GlobalAlignment::placement() const { +dd4hep::PlacedVolume dd4hep::align::GlobalAlignment::placement() const { CheckHandle verify_handle(*this); return ptr()->GetNode(0); } /// Access the placement of a node in the chain of placements for this branch -PlacedVolume GlobalAlignment::nodePlacement(int level) const { +dd4hep::PlacedVolume dd4hep::align::GlobalAlignment::nodePlacement(int level) const { CheckHandle verify_handle(*this); TGeoNode* n = ptr()->GetNode(level); if ( n ) return n; @@ -63,7 +58,7 @@ PlacedVolume GlobalAlignment::nodePlacement(int level) const { } /// Access the placement of the mother of this node -PlacedVolume GlobalAlignment::motherPlacement(int level_up) const { +dd4hep::PlacedVolume dd4hep::align::GlobalAlignment::motherPlacement(int level_up) const { CheckHandle verify_handle(*this); Int_t ind = ptr()->GetLevel()-level_up; if ( ind >= 0 ) { @@ -75,13 +70,13 @@ PlacedVolume GlobalAlignment::motherPlacement(int level_up) const { } /// Access the currently applied alignment/placement matrix -Transform3D GlobalAlignment::toGlobal(int level) const { +dd4hep::Transform3D dd4hep::align::GlobalAlignment::toGlobal(int level) const { CheckHandle verify_handle(*this); return detail::matrix::_transform(ptr()->GetMatrix(level)); } /// Transform a point from local coordinates of a given level to global coordinates -Position GlobalAlignment::toGlobal(const Position& localPoint, int level) const { +dd4hep::Position dd4hep::align::GlobalAlignment::toGlobal(const Position& localPoint, int level) const { CheckHandle verify_handle(*this); Position result; TGeoHMatrix* matrix = ptr()->GetMatrix(level); @@ -90,7 +85,7 @@ Position GlobalAlignment::toGlobal(const Position& localPoint, int level) const } /// Transform a point from local coordinates of a given level to global coordinates -Position GlobalAlignment::globalToLocal(const Position& globalPoint, int level) const { +dd4hep::Position dd4hep::align::GlobalAlignment::globalToLocal(const Position& globalPoint, int level) const { CheckHandle verify_handle(*this); Position result; TGeoHMatrix* matrix = ptr()->GetMatrix(level); @@ -99,19 +94,19 @@ Position GlobalAlignment::globalToLocal(const Position& globalPoint, int level) } /// Access the currently applied alignment/placement matrix -Transform3D GlobalAlignment::toMother(int level) const { +dd4hep::Transform3D dd4hep::align::GlobalAlignment::toMother(int level) const { CheckHandle verify_handle(*this); return detail::matrix::_transform(ptr()->GetNode(level)->GetMatrix()); } /// Access the currently applied alignment/placement matrix -Transform3D GlobalAlignment::nominal() const { +dd4hep::Transform3D dd4hep::align::GlobalAlignment::nominal() const { CheckHandle verify_handle(*this); return detail::matrix::_transform(ptr()->GetOriginalMatrix()); } /// Access the currently applied correction matrix (delta) -Transform3D GlobalAlignment::delta() const { +dd4hep::Transform3D dd4hep::align::GlobalAlignment::delta() const { // It may be useful at some point to cache some of these matrices.... CheckHandle verify_handle(*this); TGeoPhysicalNode* n = ptr(); @@ -122,7 +117,7 @@ Transform3D GlobalAlignment::delta() const { } /// Access the inverse of the currently applied correction matrix (delta) (mother to daughter) -Transform3D GlobalAlignment::invDelta() const { +dd4hep::Transform3D dd4hep::align::GlobalAlignment::invDelta() const { // It may be useful at some point to cache some of these matrices.... CheckHandle verify_handle(*this); TGeoPhysicalNode* n = ptr(); diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index 3b4fa7c81..0c5482b67 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -1157,12 +1157,15 @@ static long dump_volume_tree(Detector& description, int argc, char** argv) { pref += aligned->GetName(); } /// + TGeoVolume* mother = ideal ? ideal->GetMotherVolume() : nullptr; if ( m_printPositions || m_printVolIDs ) { if ( m_printPointers ) { if ( ideal != aligned ) - std::snprintf(fmt,sizeof(fmt),"Ideal:%p Aligned:%p ",(void*)ideal,(void*)aligned); + std::snprintf(fmt,sizeof(fmt),"Ideal:%p Aligned:%p ", + (void*)ideal,(void*)aligned); else - std::snprintf(fmt,sizeof(fmt),"Ideal:%p ",(void*)ideal); + std::snprintf(fmt,sizeof(fmt),"Ideal:%p MotherVol:%p", + (void*)ideal, (void*)mother); log << fmt; } // Top level volume! have no volume ids @@ -1204,8 +1207,8 @@ static long dump_volume_tree(Detector& description, int argc, char** argv) { char sens = vol.isSensitive() ? 'S' : ' '; if ( m_printPointers ) { if ( ideal == aligned ) { - std::snprintf(fmt,sizeof(fmt),"%03d %%s [Ideal:%p] %%-%ds %%-16s Vol:%%s shape:%%s \t %c %%s", - level+1,(void*)ideal,2*level+1,sens); + std::snprintf(fmt,sizeof(fmt),"%03d %%s [Ideal:%p Vol:%p MotherVol:%p] %%-%ds %%-16s Vol:%%s shape:%%s \t %c %%s", + level+1,(void*)ideal,(void*)vol, (void*)mother, 2*level+1, sens); } else { std::snprintf(fmt,sizeof(fmt),"%03d %%s Ideal:%p Aligned:%p %%-%ds %%-16s Vol:%%s shape:%%s %c %%s", diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index 4ca3bd57e..8bfc8921b 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -908,9 +908,9 @@ void* Geant4Converter::handleAssembly(const std::string& name, const TGeoNode* n return nullptr; } g4->placeAssembly(dau, (*ia).second, transform); - printout(lvl, "Geant4Converter", "+++ Assembly: AddPlacedAssembly : dau:%s " + printout(lvl, "Geant4Converter", "+++ Assembly: AddPlacedAssembly %p: dau:%s " "to mother %s Tr:x=%8.3f y=%8.3f z=%8.3f", - dau_vol->GetName(), mot_vol->GetName(), + (void*)dau_vol, dau_vol->GetName(), mot_vol->GetName(), transform.dx(), transform.dy(), transform.dz()); } else { @@ -922,9 +922,9 @@ void* Geant4Converter::handleAssembly(const std::string& name, const TGeoNode* n __FILE__, __LINE__, name.c_str(), dau->GetName()); } g4->placeVolume(dau,(*iv).second, transform); - printout(lvl, "Geant4Converter", "+++ Assembly: AddPlacedVolume : dau:%s " + printout(lvl, "Geant4Converter", "+++ Assembly: AddPlacedVolume %p: dau:%s " "to mother %s Tr:x=%8.3f y=%8.3f z=%8.3f", - dau_vol->GetName(), mot_vol->GetName(), + (void*)dau_vol, dau_vol->GetName(), mot_vol->GetName(), transform.dx(), transform.dy(), transform.dz()); } } @@ -1003,7 +1003,7 @@ void* Geant4Converter::handlePlacement(const std::string& name, const TGeoNode* return nullptr; } else if ( node != info.manager->GetTopNode() && volIt == info.g4Volumes.end() ) { - throw std::logic_error("Geant4Converter: Invalid mother volume found!"); + //throw std::logic_error("Geant4Converter: Invalid mother volume found!"); } PlacedVolume pv(node); const auto* pv_data = pv.data(); @@ -1692,51 +1692,7 @@ Geant4Converter& Geant4Converter::create(DetElement top) { std::map >::const_reverse_iterator i = m_data->rbegin(); for ( ; i != m_data->rend(); ++i ) { for ( const TGeoNode* node : i->second ) { -#if 0 - TGeoVolume* vm = node->GetMotherVolume(); - if ( vm ) { - for(int iv=0; iv < vm->GetNdaughters(); ++iv) { - TGeoNode* n = vm->GetNode(iv); - this->handlePlacement(n->GetName(), n); - } - } -#endif this->handlePlacement(node->GetName(), node); -#if 0 -#if 0 - auto idau = m_daughters->find(Volume(node->GetVolume())); - std::vector > vol_daughters; - if ( idau != m_daughters->end() ) { - for( auto* d : idau->second ) { - void* dau = handlePlacement(d->GetName(), d); - vol_daughters.push_back({ d, (G4VPhysicalVolume*)dau }); - } - } - G4VPhysicalVolume* pl = (G4VPhysicalVolume*)handlePlacement(node->GetName(), node); - if ( pl ) { - // Now run check: - G4LogicalVolume* lv = pl->GetLogicalVolume(); - for(int ik=0; ikGetNdaughters(); ++ik) { - const auto& p = vol_daughters[ik]; - printout(INFO, "Geant4Converter", "+++ %i TGEO Parent: %s daughter: %s", - ik, node->GetName(), node->GetDaughter(ik)->GetName()); - printout(INFO, "Geant4Converter", "+++ %i G4 Parent: %s daughter: %s", - ik, pl->GetName().c_str(), lv->GetDaughter(ik)->GetName().c_str()); - if ( p.first != node->GetDaughter(ik) || p.second != lv->GetDaughter(ik) ) { - printout(INFO, "Geant4Converter", "+++ BAD Volume order: %s", p.first->GetName()); - } - } - } -#else - auto id = m_daughters->find(node); - if ( id != m_daughters->end() ) { - for( auto* dau : id->second ) { - handlePlacement(dau->GetName(), dau); - } - } - handlePlacement(node->GetName(), node); -#endif -#endif } } /// Handle concrete surfaces diff --git a/examples/AlignDet/compact/AlephTPC_alignment.xml b/examples/AlignDet/compact/AlephTPC_alignment.xml index 41623abf8..e80928d52 100644 --- a/examples/AlignDet/compact/AlephTPC_alignment.xml +++ b/examples/AlignDet/compact/AlephTPC_alignment.xml @@ -34,50 +34,50 @@ - - + + - + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + +