From f3a5364cc0a3fe5432f11c40960bc3920d8c2faf Mon Sep 17 00:00:00 2001 From: Vakho Tsulaia <tsulaia@cern.ch> Date: Wed, 16 Apr 2025 08:56:46 -0700 Subject: [PATCH] Dropped the unused GeoModelG4/GeoModel2G4/original_GeoModel2G4 --- .../original_GeoModel2G4/CMakeLists.txt | 62 -- .../CMakeLists.txt.Athena | 52 -- .../original_GeoModel2G4/README.md | 10 - .../src/ExtParameterisedVolumeBuilder.cxx | 279 ------ .../src/ExtParameterisedVolumeBuilder.h | 40 - .../src/GDMLDetectorTool.cxx | 86 -- .../src/GDMLDetectorTool.h | 53 -- .../src/Geo2G4AssemblyFactory.cxx | 50 -- .../src/Geo2G4AssemblyFactory.h | 20 - .../src/Geo2G4AssemblyTriplet.h | 218 ----- .../src/Geo2G4AssemblyVolume.cxx | 350 -------- .../src/Geo2G4AssemblyVolume.h | 235 ----- .../src/Geo2G4Builder.cxx | 225 ----- .../original_GeoModel2G4/src/Geo2G4Builder.h | 71 -- .../src/Geo2G4LVFactory.cxx | 99 --- .../src/Geo2G4LVFactory.h | 21 - .../src/Geo2G4LogicalVolumeFactory.cxx | 39 - .../src/Geo2G4LogicalVolumeFactory.h | 17 - .../src/Geo2G4OpticalSurfaceFactory.cxx | 127 --- .../src/Geo2G4OpticalSurfaceFactory.h | 25 - .../src/Geo2G4STParameterisation.cxx | 32 - .../src/Geo2G4STParameterisation.h | 71 -- .../src/Geo2G4SolidFactory.cxx | 594 ------------- .../src/Geo2G4SolidFactory.h | 54 -- .../original_GeoModel2G4/src/Geo2G4Svc.cxx | 111 --- .../original_GeoModel2G4/src/Geo2G4Svc.h | 45 - .../src/Geo2G4SvcAccessor.h | 34 - .../src/GeoDetectorTool.cxx | 119 --- .../src/GeoDetectorTool.h | 60 -- .../src/InitializeBuilders.cxx | 10 - .../src/LArFanSection.cxx | 265 ------ .../original_GeoModel2G4/src/LArFanSection.h | 30 - .../src/LArWheelSolid.cxx | 133 --- .../original_GeoModel2G4/src/LArWheelSolid.h | 249 ------ .../src/LArWheelSolidDDProxy.cxx | 65 -- .../src/LArWheelSolidDDProxy.h | 68 -- .../src/LArWheelSolidDisToIn.cxx | 322 ------- .../src/LArWheelSolidDisToOut.cxx | 296 ------- .../src/LArWheelSolidInit.cxx | 271 ------ .../src/LArWheelSolidTests.cxx | 803 ------------------ .../src/LArWheelSolid_type.h | 28 - .../src/SingleLogicalVolumeFactory.cxx | 44 - .../src/SingleLogicalVolumeFactory.h | 29 - .../original_GeoModel2G4/src/VolumeBuilder.h | 52 -- .../src/components/Geo2G4_entries.cxx | 7 - .../src/lcg_dict/selection.xml | 3 - 46 files changed, 5874 deletions(-) delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/CMakeLists.txt delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/CMakeLists.txt.Athena delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/README.md delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/ExtParameterisedVolumeBuilder.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/ExtParameterisedVolumeBuilder.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GDMLDetectorTool.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GDMLDetectorTool.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyFactory.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyFactory.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyTriplet.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyVolume.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyVolume.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Builder.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Builder.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LVFactory.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LVFactory.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LogicalVolumeFactory.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LogicalVolumeFactory.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4OpticalSurfaceFactory.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4OpticalSurfaceFactory.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4STParameterisation.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4STParameterisation.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SolidFactory.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SolidFactory.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Svc.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Svc.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SvcAccessor.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GeoDetectorTool.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GeoDetectorTool.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/InitializeBuilders.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArFanSection.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArFanSection.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDDProxy.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDDProxy.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDisToIn.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDisToOut.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidInit.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidTests.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid_type.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/SingleLogicalVolumeFactory.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/SingleLogicalVolumeFactory.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/VolumeBuilder.h delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/components/Geo2G4_entries.cxx delete mode 100644 GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/lcg_dict/selection.xml diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/CMakeLists.txt b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/CMakeLists.txt deleted file mode 100644 index fafcfaedd..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -################################################################################ -# Package: Geo2G4 -################################################################################ - -cmake_minimum_required(VERSION 3.16...3.26) - -# Declare the package name -project( "Geo2G4" VERSION 1.0.0 LANGUAGES CXX ) - -# External dependencies: -find_package( Geant4 REQUIRED ) -find_package( Boost COMPONENTS filesystem thread system ) -find_package( CLHEP ) -find_package( ROOT COMPONENTS MathCore RIO Core Tree Hist pthread ) -find_package( XercesC ) -# GeoModel dependencies -find_package( GeoModelKernel REQUIRED ) -find_package( GeoModelUtilities REQUIRED ) -find_package( GeoMaterial2G4 REQUIRED ) - -########################################################## -# NOTE! The original package also needs this Athena stuff: -# -# DetectorDescription/GeoModel/GeoModelInterfaces -# DetectorDescription/GeoModel/GeoSpecialShapes -# DetectorDescription/GeoPrimitives -# Simulation/G4Atlas/G4AtlasInterfaces -# Simulation/G4Atlas/G4AtlasTools -# Simulation/G4Sim/SimHelpers - -# Project's Settings - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -# Use the GNU install directory names. -include( GNUInstallDirs ) # it defines CMAKE_INSTALL_LIBDIR - - -# Find the header and source files. -file( GLOB SOURCES src/*.cxx ) -file( GLOB HEADERS GeoMaterial2G4/*.h ) - -# include Geant4 headers -include(${Geant4_USE_FILE}) - -# Set target and properties -add_library( Geo2G4Lib SHARED ${HEADERS} ${SOURCES} ) -target_link_libraries( Geo2G4Lib - PUBLIC ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${ROOT_LIBRARIES} - PRIVATE ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} GeoSpecialShapes G4AtlasToolsLib SimHelpers GeoMaterial2G4 GeoModelUtilities ) -target_include_directories( Geo2G4Lib SYSTEM PUBLIC ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} PRIVATE ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} ) -target_include_directories( Geo2G4Lib PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ) - -### TODO: do we need this from Athena? Maybe not... -# atlas_add_component( Geo2G4 ... ) - -### TODO: do we need this from Athena? Maybe not... -# atlas_add_dictionary( LArWheelSolidCheckerDict ... ) diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/CMakeLists.txt.Athena b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/CMakeLists.txt.Athena deleted file mode 100644 index b695610c1..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/CMakeLists.txt.Athena +++ /dev/null @@ -1,52 +0,0 @@ -################################################################################ -# Package: Geo2G4 -################################################################################ - -# Declare the package name: -atlas_subdir( Geo2G4 ) - -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/SGTools - Control/StoreGate - DetectorDescription/GeoModel/GeoModelInterfaces - DetectorDescription/GeoModel/GeoSpecialShapes - DetectorDescription/GeoModel/GeoModelUtilities - DetectorDescription/GeoPrimitives - Simulation/G4Atlas/G4AtlasInterfaces - Simulation/G4Atlas/G4AtlasTools - Simulation/G4Sim/SimHelpers - Simulation/G4Utilities/GeoMaterial2G4 ) - -# External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) -find_package( CLHEP ) -find_package( Geant4 ) -find_package( ROOT COMPONENTS MathCore RIO Core Tree Hist pthread ) -find_package( XercesC ) -find_package( GeoModel ) - -# Component(s) in the package: -atlas_add_library( Geo2G4Lib - src/*.cxx - PUBLIC_HEADERS Geo2G4 - INCLUDE_DIRS ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} - PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${ROOT_LIBRARIES} GaudiKernel - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaBaseComps SGTools GeoSpecialShapes G4AtlasToolsLib SimHelpers GeoMaterial2G4 AthenaKernel GeoModelUtilities StoreGateLib SGtests ) - -atlas_add_component( Geo2G4 - src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaKernel GeoModelUtilities GaudiKernel AthenaBaseComps SGTools StoreGateLib SGtests GeoSpecialShapes G4AtlasToolsLib SimHelpers GeoMaterial2G4 Geo2G4Lib ) - -atlas_add_dictionary( LArWheelSolidCheckerDict - src/LArWheelSolidDDProxy.h - src/lcg_dict/selection.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${GEOMODEL_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaKernel GeoModelUtilities GaudiKernel AthenaBaseComps SGTools StoreGateLib SGtests GeoSpecialShapes SimHelpers GeoMaterial2G4 Geo2G4Lib ) diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/README.md b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/README.md deleted file mode 100644 index 972e1027e..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Geo2G4 - -```bash -git clone ssh://git@gitlab.cern.ch:7999/GeoModelDev/GeoModelG4Utils/GeoModel2G4.git -mkdir build_geo2g4 -cd build_geo2g4 -cmake -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=RelWithDebInfo ../GeoModel2G4 -make -j4 -make install -``` diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/ExtParameterisedVolumeBuilder.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/ExtParameterisedVolumeBuilder.cxx deleted file mode 100644 index 68be419d7..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/ExtParameterisedVolumeBuilder.cxx +++ /dev/null @@ -1,279 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "ExtParameterisedVolumeBuilder.h" -#include "Geo2G4AssemblyFactory.h" -#include "Geo2G4AssemblyVolume.h" -#include "Geo2G4LVFactory.h" -#include "Geo2G4STParameterisation.h" -#include "G4LogicalVolume.hh" - -#include "G4PVPlacement.hh" -#include "G4ReflectionFactory.hh" -#include "G4VPVParameterisation.hh" -#include "G4PVParameterised.hh" -#include "globals.hh" - -#include "SimHelpers/ServiceAccessor.h" - -#include "GeoModelKernel/GeoAccessVolAndSTAction.h" -#include "GeoModelKernel/GeoVolumeCursor.h" -#include "GeoModelKernel/GeoMaterial.h" -#include "GeoModelKernel/GeoLogVol.h" -#include "GeoModelKernel/GeoSerialTransformer.h" -#include "GeoModelInterfaces/StoredMaterialManager.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" - -#include "StoreGate/StoreGateSvc.h" -#include <iostream> - -#include "GeoPrimitives/CLHEPtoEigenConverter.h" - -ExtParameterisedVolumeBuilder::ExtParameterisedVolumeBuilder(std::string n): - VolumeBuilder(n), - m_getMatEther(true), - m_matEther(0),m_matHypUr(0),m_msg(n) -{ -} - -G4LogicalVolume* ExtParameterisedVolumeBuilder::Build(const PVConstLink theGeoPhysVolume, OpticalVolumesMap* optical_volumes) const -{ - PVConstLink theGeoPhysChild; - const GeoSerialTransformer* serialTransformerChild=0; - G4LogicalVolume* theG4LogChild; - unsigned int numChildNodes; // number of child nodes (PV and ST) - bool descend; // flag to continue geo tree navigation - bool serialExists = false; // flag for existence of ST among childs - std::string nameChild; - - if(m_getMatEther) getMatEther(); - - static Geo2G4LVFactory LVFactory; - - G4LogicalVolume* theG4LogVolume = LVFactory.Build(theGeoPhysVolume,descend); - - if(!descend) return theG4LogVolume; - - numChildNodes = theGeoPhysVolume->getNChildVolAndST(); - - // ***************************************************************** - // ** - // ** If m_ST2Param flag is set: - // ** Check if there's any serial transformer among child volumes - // ** - // ***************************************************************** - - if(m_paramOn) - for(size_t counter1=0; counter1<numChildNodes; counter1++) - { - GeoAccessVolAndSTAction actionVolAndST(counter1); - theGeoPhysVolume->exec(&actionVolAndST); - - if((serialTransformerChild=actionVolAndST.getSerialTransformer())) - { - nameChild = actionVolAndST.getName(); - serialExists = true; - break; - } - } - // *************************************************************************** - // ** Next steps: - // ** - // ** 1. If ST exists and numChildNodes==1, translate ST to G4 ST - // ** - // ** 2. If ST exists and numChildNodes !=1, print information message and - // ** translate ST to single placements as well as all other child volumes - // ** - // ** 3. There's no ST - ok, nothing special ... - // ** - // *************************************************************************** - - if(serialExists && (numChildNodes==1)) - { - theGeoPhysChild = serialTransformerChild->getVolume(); - - // Build the child - if(!(theG4LogChild = Build(theGeoPhysChild,optical_volumes))) return 0; - - if (nameChild == "ANON") nameChild=theG4LogChild->GetName(); - nameChild += "_Param"; - - Geo2G4STParameterisation* stParameterisation = new Geo2G4STParameterisation(serialTransformerChild->getFunction(), - serialTransformerChild->getNCopies()); - - G4VPhysicalVolume* pvParametrised __attribute__ ((unused)) = new G4PVParameterised(nameChild, - theG4LogChild, - theG4LogVolume, - kUndefined, - serialTransformerChild->getNCopies(), - stParameterisation); - } - else - { - if(serialExists) - { - std::string volName = theGeoPhysVolume->getLogVol()->getName(); - PrintSTInfo(volName); - } - - GeoVolumeCursor av(theGeoPhysVolume); - while (!av.atEnd()) - { - int id = 16969; - - // Get child phys volume - theGeoPhysChild = av.getVolume(); - // Get its transform - G4Transform3D theG4Position(Amg::EigenTransformToCLHEP(av.getTransform())); - - Query<int> Qint = av.getId(); - if(Qint.isValid()) id = Qint; - - if(m_matEther == theGeoPhysChild->getLogVol()->getMaterial()) - { - Geo2G4AssemblyVolume* assembly = BuildAssembly(theGeoPhysChild); - - if(Qint.isValid()) - assembly->MakeImprint(theG4LogVolume,theG4Position,id); - else - assembly->MakeImprint(theG4LogVolume,theG4Position); - } - else if(m_matHypUr == theGeoPhysChild->getLogVol()->getMaterial()) - { - Geo2G4AssemblyVolume* assembly = BuildAssembly(theGeoPhysChild); - - if(Qint.isValid()) - assembly->MakeImprint(theG4LogVolume,theG4Position,id,true); - else - assembly->MakeImprint(theG4LogVolume,theG4Position,0,true); - } - else - { - nameChild = av.getName(); - - // Build the child - if(!(theG4LogChild = Build(theGeoPhysChild,optical_volumes))) return 0; - - if (nameChild == "ANON") nameChild=theG4LogChild->GetName(); - - G4PhysicalVolumesPair pvPair = G4ReflectionFactory::Instance()->Place(theG4Position, - nameChild, - theG4LogChild, - theG4LogVolume, - false, - id); - - // if GeoModel volume is optical store it in the map - if(optical_volumes!=0) - { - const GeoOpticalPhysVol* opticalGeoPhysChild = - dynamic_cast < const GeoOpticalPhysVol* >(theGeoPhysChild.operator->()); - if(opticalGeoPhysChild) - (*optical_volumes)[opticalGeoPhysChild] = pvPair.first; - } - } - - av.next(); - } - } - - return theG4LogVolume; -} - -Geo2G4AssemblyVolume* ExtParameterisedVolumeBuilder::BuildAssembly(PVConstLink pv) const -{ - PVConstLink theGeoPhysChild; - G4LogicalVolume* theG4LogChild = 0; - Geo2G4AssemblyVolume* theG4AssemblyChild = 0; - bool descend; // flag to continue geo tree navigation - - if(m_getMatEther) getMatEther(); - - static Geo2G4AssemblyFactory AssemblyFactory; - - Geo2G4AssemblyVolume* assemblyVolume = AssemblyFactory.Build(pv,descend); - - if(!descend) return assemblyVolume; - - // Loop over child volumes and add them to the Geo2G4AssemblyVolume - GeoVolumeCursor av(pv); - while (!av.atEnd()) - { - theGeoPhysChild = av.getVolume(); - std::string nameChild = av.getName(); - - std::string strVolume = std::string("Volume ") + nameChild + " (" - + theGeoPhysChild->getLogVol()->getName() + ")"; - - // Check if it is an assembly - if(m_matEther == theGeoPhysChild->getLogVol()->getMaterial() || - m_matHypUr == theGeoPhysChild->getLogVol()->getMaterial() ) - { - // Build the child assembly - if(!(theG4AssemblyChild = BuildAssembly(theGeoPhysChild))) return 0; - - // Get its transform - G4Transform3D theG4Position(Amg::EigenTransformToCLHEP(av.getTransform())); - - assemblyVolume->AddPlacedAssembly(theG4AssemblyChild,theG4Position); - } - else - { - Query<int> Qint = av.getId(); - - // Build the child - if(!(theG4LogChild = Build(theGeoPhysChild))) return 0; - - // Get its transform - G4Transform3D theG4Position(Amg::EigenTransformToCLHEP(av.getTransform())); - - int placedID = 0; - if(Qint.isValid()) placedID = Qint; - - std::string placedName = nameChild=="ANON" ? "" : nameChild; - - - assemblyVolume->AddPlacedVolume(theG4LogChild,theG4Position,placedID,placedName); - } - - av.next(); - } - - return assemblyVolume; -} - -void ExtParameterisedVolumeBuilder::PrintSTInfo(std::string volume) const -{ - ATH_MSG_INFO ( "**********************************************" ); - ATH_MSG_INFO ( "** " ); - ATH_MSG_INFO ( "** The Volume " << volume ); - ATH_MSG_INFO ( "** Has children of two different types" ); - ATH_MSG_INFO ( "** PeoPhysVolume and GeoSerialTransformer" ); - ATH_MSG_INFO ( "** In this case GeoSerialTransformer will be " ); - ATH_MSG_INFO ( "** translated into G4 placement but not in " ); - ATH_MSG_INFO ( "** G4Parameterisation" ); - ATH_MSG_INFO ( "** " ); - ATH_MSG_INFO ( "********************************************** " ); -} - -void ExtParameterisedVolumeBuilder::getMatEther() const -{ - StoreGateSvc* pDetStore=0; - ISvcLocator* svcLocator = Gaudi::svcLocator(); - if(svcLocator->service("DetectorStore",pDetStore).isFailure()) { - ATH_MSG_ERROR ( "ExtParameterisedVolumeBuilder: Unable to access Detector Store" ); - } - else - { - const StoredMaterialManager* theMaterialManager = nullptr; - if(pDetStore->retrieve(theMaterialManager, "MATERIALS").isFailure()) { - ATH_MSG_ERROR ( "ExtParameterisedVolumeBuilder: Unable to access Material Manager" ); - } - else { - m_matEther = theMaterialManager->getMaterial("special::Ether"); - m_matHypUr = theMaterialManager->getMaterial("special::HyperUranium"); - } - } - m_getMatEther = false; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/ExtParameterisedVolumeBuilder.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/ExtParameterisedVolumeBuilder.h deleted file mode 100644 index a5a6d6147..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/ExtParameterisedVolumeBuilder.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_ExtParameterisedVolumeBuilder_H -#define GEO2G4_ExtParameterisedVolumeBuilder_H - -#include "VolumeBuilder.h" -#include "AthenaKernel/MsgStreamMember.h" -#include <string> - -class Geo2G4AssemblyVolume; -class GeoMaterial; - -class ExtParameterisedVolumeBuilder: public VolumeBuilder -{ -public: - ExtParameterisedVolumeBuilder(std::string n); - /// - G4LogicalVolume* Build(PVConstLink pv, OpticalVolumesMap* optical_volumes = 0) const; - /// - Geo2G4AssemblyVolume* BuildAssembly(PVConstLink pv) const; - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - private: - /// Prints info when some PhysVol contains both types (PV and ST) of daughters - void PrintSTInfo(std::string volume) const; - /// - void getMatEther() const; - - mutable bool m_getMatEther; - mutable const GeoMaterial* m_matEther; - mutable const GeoMaterial* m_matHypUr; - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GDMLDetectorTool.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GDMLDetectorTool.cxx deleted file mode 100644 index d5b556c59..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GDMLDetectorTool.cxx +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// Base class -#include "G4AtlasTools/DetectorGeometryBase.h" -#include "GDMLDetectorTool.h" - -#include "G4GDMLParser.hh" -#include "G4NistManager.hh" -#include "G4LogicalVolume.hh" -#include "G4PVPlacement.hh" - -// Geant4 includes used in functions - -::GDMLDetectorTool(const std::string& type, const std::string& name, const IInterface* parent) - : DetectorGeometryBase(type,name,parent),m_GDMLFileName(""),m_blGetTopTransform(true),m_geoDetectorName("") -{ - m_topTransform.setIdentity(); - ATH_MSG_DEBUG( "GDMLDetectorTool constructor for " << name ); - declareProperty("GeoDetectorName",m_geoDetectorName, "Name of the detector in GeoModel, if different from G4."); - declareProperty("GDMLFileName",m_GDMLFileName,"Name of the GDML file to be used as input."); - -} - -StatusCode GDMLDetectorTool::initialize() -{ - ATH_MSG_DEBUG( name() << " GDMLDetectorTool::initialize(): Starting" ); - - if(m_detectorName.empty()) - { - m_detectorName = this->name(); - // re-initialize m_detectorName in order to take the real detector name rather than the path to it - size_t ipos=m_detectorName.find_last_of("."); - size_t length=m_detectorName.size(); - if (ipos<length) - { - ATH_MSG_DEBUG( "m_detectorName: " << m_detectorName << " needs to be reset."); - m_detectorName=m_detectorName.substr(ipos+1,length-ipos-1); - ATH_MSG_DEBUG( "m_detectorName default value reset to " << m_detectorName); - } - } - ATH_MSG_DEBUG( name() << "GDMLDetectorTool::initialize() : Detector name = " << m_detectorName<<" File name: "<<m_GDMLFileName ); - if(m_geoDetectorName.empty()) - { - m_geoDetectorName = m_detectorName; - } - if(m_GDMLFileName.empty()) - { - m_GDMLFileName = m_detectorName+".gdml"; - } - ATH_MSG_DEBUG( name() << "GDMLDetectorTool::initialize() : Geo Detector name = " << m_geoDetectorName<<" File name: "<<m_GDMLFileName ); - - ATH_MSG_DEBUG( name() << " GDMLDetectorTool::initialize(): Finished" ); - return StatusCode::SUCCESS; -} - - -void GDMLDetectorTool::BuildGeometry() -{ - ATH_MSG_VERBOSE( name() << " GDMLDetectorTool::BuildGeometry(): Starting" ); - - G4GDMLParser parser; - parser.Read(m_GDMLFileName.c_str(),false); - m_envelope.theEnvelope=parser.GetWorldVolume()->GetLogicalVolume(); - - ATH_MSG_VERBOSE( name() << " GDMLDetectorTool::BuildGeometry(): Finished" ); -} - -bool GDMLDetectorTool::IsTopTransform() -{ - return m_blGetTopTransform; -} - -void GDMLDetectorTool::SetInitialTransformation() -{ - ATH_MSG_VERBOSE( name() << " GDMLDetectorTool::SetInitialTransformation(): Starting" ); - if (!m_envelope.theRotation) - { - ATH_MSG_VERBOSE( name() << " GDMLDetectorTool::SetInitialTransformation(): Creating new G4RotationMatrix" ); - m_envelope.theRotation=new G4RotationMatrix; - } - *(m_envelope.theRotation)=m_topTransform.getRotation().inverse(); - m_envelope.thePosition=m_topTransform.getTranslation(); - ATH_MSG_VERBOSE( name() << " GDMLDetectorTool::SetInitialTransformation(): Finished" ); -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GDMLDetectorTool.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GDMLDetectorTool.h deleted file mode 100644 index 36e719de6..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GDMLDetectorTool.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_GDMLDetectorTool_H -#define GEO2G4_GDMLDetectorTool_H - -// Base classes -#include "G4AtlasTools/DetectorGeometryBase.h" -#include "G4AtlasInterfaces/IDetectorGeometrySvc.h" - -#include "G4Transform3D.hh" - -// Members - -// STL library -#include <string> -#include <vector> - -/** @class GDMLDetectorTool - * - * Tool for building detectors out of a GDML description. - * - * @author Andrea Dell'Acqua - * @date 2017-02-21 - */ - -class GDMLDetectorTool final : public DetectorGeometryBase -{ - public: - // Basic constructor and destructor - GDMLDetectorTool(const std::string& type, const std::string& name, const IInterface *parent); - ~GDMLDetectorTool() {} - - /** Athena method. called at initialization time, being customized here */ - virtual StatusCode initialize() override final; - - /** virtual methods being implemented here */ - - virtual void BuildGeometry() override final; - - private: - - std::string m_GDMLFileName; - std::string m_builderName; - bool m_blGetTopTransform; - G4Transform3D m_topTransform; - std::string m_geoDetectorName; - bool IsTopTransform(); - void SetInitialTransformation(); -}; - -#endif // GEO2G4_GDMLDetectorTool_H diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyFactory.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyFactory.cxx deleted file mode 100644 index d042438ea..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyFactory.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4AssemblyFactory.h" -#include "Geo2G4AssemblyVolume.h" - -#include "GeoModelKernel/GeoLogVol.h" -#include "GeoModelKernel/GeoVPhysVol.h" - -#include <iostream> -#include <map> - -typedef std::map<const GeoVPhysVol*, Geo2G4AssemblyVolume*, std::less<const GeoVPhysVol*> > assemblyMap; - -Geo2G4AssemblyFactory::Geo2G4AssemblyFactory() -{ -} - -Geo2G4AssemblyVolume* Geo2G4AssemblyFactory::Build(const PVConstLink thePhys, - bool& descend) const -{ - static assemblyMap map; - assemblyMap::const_iterator it; - Geo2G4AssemblyVolume* assembly; - - const GeoLogVol* theLog = thePhys->getLogVol(); - - // Check if the assembly was used in GeoModel as a leaf node - if(thePhys->getNChildVols() == 0) - throw std::runtime_error(std::string("In GeoModel description the assembly ") + theLog->getName() - + std::string(" has no children!")); - - descend = true; - - // Search for the assembly in the map - it = map.find(&(*thePhys)); - if(it == map.end()) - { - assembly = new Geo2G4AssemblyVolume(); - map[&(*thePhys)] = assembly; - } - else - { - assembly = it->second; - descend = false; - } - - return assembly; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyFactory.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyFactory.h deleted file mode 100644 index d65918133..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyFactory.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4AssemblyFactory_h -#define GEO2G4_Geo2G4AssemblyFactory_h - -#include "GeoModelKernel/GeoVPhysVol.h" - -class Geo2G4AssemblyVolume; - -class Geo2G4AssemblyFactory -{ - public: - Geo2G4AssemblyFactory(); - Geo2G4AssemblyVolume* Build(const PVConstLink, - bool&) const; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyTriplet.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyTriplet.h deleted file mode 100644 index a7ba9be6c..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyTriplet.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_ASSEMBLYTRIPLET_H -#define GEO2G4_ASSEMBLYTRIPLET_H - -#include "G4ThreeVector.hh" -#include "G4RotationMatrix.hh" - -class G4LogicalVolume; -class Geo2G4AssemblyVolume; - -class Geo2G4AssemblyTriplet -{ - public: // with description - - Geo2G4AssemblyTriplet(); - // Default constructor - - Geo2G4AssemblyTriplet( G4LogicalVolume* pVolume, - G4ThreeVector& translation, - G4RotationMatrix* pRotation, - G4bool isReflection = false); - // An explicit constructor for a logical volume - - Geo2G4AssemblyTriplet( Geo2G4AssemblyVolume* pAssembly, - G4ThreeVector& translation, - G4RotationMatrix* pRotation, - G4bool isReflection = false); - // An explicit constructor for an assembly volume - - Geo2G4AssemblyTriplet( const Geo2G4AssemblyTriplet& second ); - // Copy constructor - - ~Geo2G4AssemblyTriplet(); - // Destructor - - Geo2G4AssemblyTriplet& operator=( const Geo2G4AssemblyTriplet& second ); - // Assignment operator - - G4LogicalVolume* GetVolume() const; - // Retrieve the logical volume reference - - void SetVolume( G4LogicalVolume* pVolume ); - // Update the logical volume reference - - Geo2G4AssemblyVolume* GetAssembly() const; - // Retrieve the assembly volume reference - - void SetAssembly( Geo2G4AssemblyVolume* pAssembly ); - // Update the assembly volume reference - - G4ThreeVector GetTranslation() const; - // Retrieve the logical volume translation - - void SetTranslation( G4ThreeVector& pVolume ); - // Update the logical volume translation - - G4RotationMatrix* GetRotation() const; - // Retrieve the logical volume rotation - - void SetRotation( G4RotationMatrix* pVolume ); - // Update the logical volume rotation - - G4bool IsReflection() const; - // Return true if the logical or assembly volume has reflection - - private: - - G4LogicalVolume* m_volume; - // A logical volume - - G4ThreeVector m_translation; - // A logical volume translation - - G4RotationMatrix* m_rotation; - // A logical volume rotation - - private: - - // Member data for handling assemblies of assemblies and reflections - - Geo2G4AssemblyVolume* m_assembly; - // An assembly volume - - G4bool m_isReflection; - // True if the logical or assembly volume has reflection -}; - -inline -Geo2G4AssemblyTriplet::Geo2G4AssemblyTriplet() - : m_volume( 0 ), m_rotation( 0 ), m_assembly(0), m_isReflection(false) -{ - G4ThreeVector v(0.,0.,0.); - m_translation = v; -} - -inline -Geo2G4AssemblyTriplet::Geo2G4AssemblyTriplet( G4LogicalVolume* pVolume, - G4ThreeVector& translation, - G4RotationMatrix* pRotation, - G4bool isReflection ) - : m_volume( pVolume ), m_translation( translation ), m_rotation( pRotation ), - m_assembly( 0 ), m_isReflection(isReflection) -{ -} - -inline -Geo2G4AssemblyTriplet::Geo2G4AssemblyTriplet( Geo2G4AssemblyVolume* pAssembly, - G4ThreeVector& translation, - G4RotationMatrix* pRotation, - G4bool isReflection ) - : m_volume( 0 ), m_translation( translation ), m_rotation( pRotation ), - m_assembly( pAssembly ), m_isReflection(isReflection) -{ -} - -inline -Geo2G4AssemblyTriplet::Geo2G4AssemblyTriplet( const Geo2G4AssemblyTriplet& second ) -{ - m_volume = second.GetVolume(); - m_rotation = second.GetRotation(); - m_translation = second.GetTranslation(); - m_assembly = second.GetAssembly(); - m_isReflection = second.IsReflection(); -} - -inline -Geo2G4AssemblyTriplet::~Geo2G4AssemblyTriplet() -{ -} - -inline -G4LogicalVolume* Geo2G4AssemblyTriplet::GetVolume() const -{ - return m_volume; -} - -inline -void Geo2G4AssemblyTriplet::SetVolume( G4LogicalVolume* pVolume ) -{ - if ( m_assembly ) - { - G4Exception("Geo2G4AssemblyTriplet::SetVolume()", - "IllegalCall", JustWarning, - "There is an assembly already set, it will be ignored."); - } - m_volume = pVolume; - m_assembly = 0; -} - -inline -Geo2G4AssemblyVolume* Geo2G4AssemblyTriplet::GetAssembly() const -{ - return m_assembly; -} - -inline -void Geo2G4AssemblyTriplet::SetAssembly( Geo2G4AssemblyVolume* pAssembly ) -{ - if ( m_volume ) - { - G4Exception("Geo2G4AssemblyTriplet::SetAssembly()", - "IllegalCall", JustWarning, - "There is a volume already set, it will be ignored."); - } - m_assembly = pAssembly; - m_volume = 0; -} - -inline -G4ThreeVector Geo2G4AssemblyTriplet::GetTranslation() const -{ - return m_translation; -} - -inline -void Geo2G4AssemblyTriplet::SetTranslation( G4ThreeVector& translation ) -{ - m_translation = translation; -} - -inline -G4RotationMatrix* Geo2G4AssemblyTriplet::GetRotation() const -{ - return m_rotation; -} - -inline -void Geo2G4AssemblyTriplet::SetRotation( G4RotationMatrix* pRotation ) -{ - m_rotation = pRotation; -} - -inline -G4bool Geo2G4AssemblyTriplet::IsReflection() const -{ - return m_isReflection; -} - -inline -Geo2G4AssemblyTriplet& -Geo2G4AssemblyTriplet::operator=( const Geo2G4AssemblyTriplet& second ) -{ - if( this != &second ) - { - m_volume = second.GetVolume(); - m_rotation = second.GetRotation(); - m_translation = second.GetTranslation(); - m_assembly = second.GetAssembly(); - m_isReflection = second.IsReflection(); - } - - return *this; -} - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyVolume.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyVolume.cxx deleted file mode 100644 index 86de232db..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyVolume.cxx +++ /dev/null @@ -1,350 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4AssemblyVolume.h" -#include "G4PVPlacement.hh" -#include "G4RotationMatrix.hh" -#include "G4AffineTransform.hh" -#include "G4LogicalVolume.hh" -#include "G4VPhysicalVolume.hh" -#include "G4ReflectionFactory.hh" - -#include <sstream> - -unsigned int Geo2G4AssemblyVolume::s_instanceCounter = 0; - -// Default constructor -// -Geo2G4AssemblyVolume::Geo2G4AssemblyVolume() -: m_assemblyID( 0 ) -{ - InstanceCountPlus(); - SetAssemblyID( GetInstanceCount() ); - SetImprintsCount( 0 ); -} - -// Destructor -// -Geo2G4AssemblyVolume::~Geo2G4AssemblyVolume() -{ - unsigned int howmany = m_triplets.size(); - if( howmany != 0 ) - { - for( unsigned int i = 0; i < howmany; i++ ) - { - G4RotationMatrix* pRotToClean = m_triplets[i].GetRotation(); - if( pRotToClean != 0 ) - { - delete pRotToClean; - } - } - } - m_triplets.clear(); - - howmany = m_PVStore.size(); - if( howmany != 0 ) - { - for( unsigned int j = 0; j < howmany; j++ ) - { - G4RotationMatrix* pRotToClean = m_PVStore[j]->GetRotation(); - if( pRotToClean != 0 ) - { - delete pRotToClean; - } - delete m_PVStore[j]; - } - } - m_PVStore.clear(); - InstanceCountMinus(); -} - -// Add and place the given volume according to the specified -// translation and rotation. -// -// The rotation matrix passed in can be 0 = identity or an address even of an -// object on the upper stack frame. During assembly imprint, it creates anyway -// a new matrix and keeps track of it so it can delete it later at destruction -// time. -// This policy has been adopted since user has no control on the way the -// rotations are combined. -// -void Geo2G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume* pVolume, - G4ThreeVector& translation, - G4RotationMatrix* pRotation, - int copyNo, G4String userC) -{ - G4RotationMatrix* toStore = new G4RotationMatrix; - - if( pRotation != 0 ) { *toStore = *pRotation; } - - Geo2G4AssemblyTriplet toAdd( pVolume, translation, toStore ); - m_triplets.push_back( toAdd ); - - m_copyNumbers.push_back( copyNo ); - m_userComments.push_back( userC ); -} - -// Add and place the given volume according to the specified transformation -// -void Geo2G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume* pVolume, - G4Transform3D& transformation, - int copyNo, G4String userC) -{ - // Decompose transformation - G4Scale3D scale; - G4Rotate3D rotation; - G4Translate3D translation; - transformation.getDecomposition(scale, rotation, translation); - - G4ThreeVector v = translation.getTranslation(); - G4RotationMatrix* r = new G4RotationMatrix; - *r = rotation.getRotation(); - - G4bool isReflection = false; - if (scale(0,0)*scale(1,1)*scale(2,2) < 0.) { isReflection = true; } - - Geo2G4AssemblyTriplet toAdd( pVolume, v, r, isReflection ); - m_triplets.push_back( toAdd ); - - m_copyNumbers.push_back( copyNo ); - m_userComments.push_back( userC ); -} - -// Add and place the given assembly volume according to the specified -// translation and rotation. -// -void Geo2G4AssemblyVolume::AddPlacedAssembly( Geo2G4AssemblyVolume* pAssembly, - G4ThreeVector& translation, - G4RotationMatrix* pRotation ) -{ - G4RotationMatrix* toStore = new G4RotationMatrix; - - if( pRotation != 0 ) { *toStore = *pRotation; } - - Geo2G4AssemblyTriplet toAdd( pAssembly, translation, toStore ); - m_triplets.push_back( toAdd ); -} - -// Add and place the given assembly volume according to the specified -// transformation -// -void Geo2G4AssemblyVolume::AddPlacedAssembly( Geo2G4AssemblyVolume* pAssembly, - G4Transform3D& transformation ) -{ - // Decompose transformation - // - G4Scale3D scale; - G4Rotate3D rotation; - G4Translate3D translation; - transformation.getDecomposition(scale, rotation, translation); - - G4ThreeVector v = translation.getTranslation(); - G4RotationMatrix* r = new G4RotationMatrix; - *r = rotation.getRotation(); - - G4bool isReflection = false; - if (scale(0,0)*scale(1,1)*scale(2,2) < 0.) { isReflection = true; } - - Geo2G4AssemblyTriplet toAdd( pAssembly, v, r, isReflection ); - m_triplets.push_back( toAdd ); -} - -// Create an instance of an assembly volume inside of the specified -// mother volume. This works analogically to making stamp imprints. -// This method makes use of the Geant4 affine transformation class. -// The algorithm is defined as follows: -// -// Having rotation matrix Rm and translation vector Tm to be applied -// inside the mother and rotation matrix Ra and translation vector Ta -// to be applied inside the assembly itself for each of the participating -// volumes the resulting transformation is -// -// Tfinal = Ta * Tm -// -// where Ta and Tm are constructed as -// -// -1 -1 -// Ta = Ra * Ta and Tm = Rm * Tm -// -// which in words means that we create first the affine transformations -// by inverse rotation matrices and translations for mother and assembly. -// The resulting final transformation to be applied to each of the -// participating volumes is their product. -// -// IMPORTANT NOTE! -// The order of multiplication is reversed when comparing to CLHEP 3D -// transformation matrix(G4Transform3D class). -// -// The rotation matrix passed in can be 0 = identity or an address even of an -// object on the upper stack frame. During assembly imprint, it creates anyway -// a new matrix and keeps track of it so it can delete it later at destruction -// time. -// This policy has been adopted since user has no control on the way the -// rotations are combined. -// -// If the assembly volume contains assembly (a'), the function is called -// recursively with composed transformation: -// -// Tanew = Ta * Ta' -// -void Geo2G4AssemblyVolume::MakeImprint( Geo2G4AssemblyVolume* pAssembly, - G4LogicalVolume* pMotherLV, - G4Transform3D& transformation, - G4int copyNumBase, - G4bool ITkScheme, - G4bool surfCheck ) -{ - unsigned int numberOfDaughters; - - if( copyNumBase == 0 ) - { - numberOfDaughters = pMotherLV->GetNoDaughters(); - } - else - { - numberOfDaughters = copyNumBase; - } - // We start from the first available index - // - numberOfDaughters++; - - ImprintsCountPlus(); - std::vector<Geo2G4AssemblyTriplet> triplets = pAssembly->m_triplets; - for( unsigned int i = 0; i < triplets.size(); i++ ) - { - G4Transform3D Ta( *(triplets[i].GetRotation()), - triplets[i].GetTranslation() ); - if ( triplets[i].IsReflection() ) { Ta = Ta * G4ReflectZ3D(); } - - G4Transform3D Tfinal = transformation * Ta; - if ( triplets[i].GetVolume() ) - { - // Generate the unique name for the next PV instance - // The name has format: - // - // av_WWW_impr_XXX_YYY_ZZZ - // where the fields mean: - // WWW - assembly volume instance number - // XXX - assembly volume imprint number - // YYY - the name of a log. volume we want to make a placement of - // ZZZ - the log. volume index inside the assembly volume - // - - - std::stringstream pvName; - pvName << "av_" - << GetAssemblyID() - << "_impr_" - << GetImprintsCount() - << "_" - << triplets[i].GetVolume()->GetName().c_str() - << "_pv_" - << i; - if (i<m_userComments.size() && !(m_userComments[i].empty())) pvName<<"_"<<m_userComments[i]; - pvName<<std::ends; - // Generate a new physical volume instance inside a mother - // (as we allow 3D transformation use G4ReflectionFactory to - // take into account eventual reflection) - // - int ccn=numberOfDaughters + i; - if (i<m_copyNumbers.size() && m_copyNumbers[i]) { - if(ITkScheme) ccn=m_copyNumbers[i]; - else ccn=m_copyNumbers[i]+copyNumBase; - } - - G4PhysicalVolumesPair pvPlaced - = G4ReflectionFactory::Instance()->Place( Tfinal, - pvName.str().c_str(), - triplets[i].GetVolume(), - pMotherLV, - false, - ccn, - surfCheck ); - - - // Register the physical volume created by us so we can delete it later - // - m_PVStore.push_back( pvPlaced.first ); - if ( pvPlaced.second ) { m_PVStore.push_back( pvPlaced.second ); } - } - else if ( triplets[i].GetAssembly() ) - { - // Place volumes in this assembly with composed transformation - // - if(ITkScheme) triplets[i].GetAssembly()->MakeImprint( triplets[i].GetAssembly(), pMotherLV, - Tfinal, i*100+copyNumBase, ITkScheme, surfCheck ); - else MakeImprint( triplets[i].GetAssembly(), pMotherLV, - Tfinal, i*100+copyNumBase, ITkScheme, surfCheck ); - } - else - { - G4Exception("Geo2G4AssemblyVolume::MakeImprint(..)", - "NotApplicable", FatalException, - "Triplet has no volume and no assembly"); - } - } -} - -void Geo2G4AssemblyVolume::MakeImprint( G4LogicalVolume* pMotherLV, - G4ThreeVector& translationInMother, - G4RotationMatrix* pRotationInMother, - G4int copyNumBase, - G4bool ITkScheme, - G4bool surfCheck ) -{ - // If needed user can specify explicitely the base count from which to start - // off for the generation of phys. vol. copy numbers. - // The old behaviour is preserved when copyNumBase == 0, e.g. the generated - // copy numbers start from the count equal to current number of daughter - // volumes before an imprint is made - - // Compose transformation - // - if( pRotationInMother == 0 ) - { - // Make it by default an indentity matrix - // - pRotationInMother = - const_cast<G4RotationMatrix*>( &G4RotationMatrix::IDENTITY ); - } - - G4Transform3D transform( *pRotationInMother, - translationInMother ); - MakeImprint(this, pMotherLV, transform, copyNumBase, ITkScheme, surfCheck); -} - -void Geo2G4AssemblyVolume::MakeImprint( G4LogicalVolume* pMotherLV, - G4Transform3D& transformation, - G4int copyNumBase, - G4bool ITkScheme, - G4bool surfCheck ) -{ - // If needed user can specify explicitely the base count from which to start - // off for the generation of phys. vol. copy numbers. - // The old behaviour is preserved when copyNumBase == 0, e.g. the generated - // copy numbers start from the count equal to current number of daughter - // volumes before a imprint is made - - MakeImprint(this, pMotherLV, transformation, copyNumBase, ITkScheme, surfCheck); -} - -unsigned int Geo2G4AssemblyVolume::GetInstanceCount() const -{ - return Geo2G4AssemblyVolume::s_instanceCounter; -} - -void Geo2G4AssemblyVolume::SetInstanceCount( unsigned int value ) -{ - Geo2G4AssemblyVolume::s_instanceCounter = value; -} - -void Geo2G4AssemblyVolume::InstanceCountPlus() -{ - Geo2G4AssemblyVolume::s_instanceCounter++; -} - -void Geo2G4AssemblyVolume::InstanceCountMinus() -{ - Geo2G4AssemblyVolume::s_instanceCounter--; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyVolume.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyVolume.h deleted file mode 100644 index c2b47b528..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4AssemblyVolume.h +++ /dev/null @@ -1,235 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_ASSEMBLYVOLUME_H -#define GEO2G4_ASSEMBLYVOLUME_H - -#include "Geo2G4AssemblyTriplet.h" -#include "G4Transform3D.hh" -#include <vector> - -class G4VPhysicalVolume; - -class Geo2G4AssemblyVolume -{ -public: // with description - - Geo2G4AssemblyVolume(); - Geo2G4AssemblyVolume( G4LogicalVolume* volume, - G4ThreeVector& translation, - G4RotationMatrix* rotation); - ~Geo2G4AssemblyVolume(); - // - // Constructors & destructor. - // At destruction all the generated physical volumes and associated - // rotation matrices of the imprints will be destroyed. - // - // The rotation matrix passed as argument can be 0 (identity) or an address - // even of an object on the upper stack frame. During assembly imprint, a - // new matrix is created anyway and it is kept track of it so it can be - // automatically deleted later at the end of the application. - // This policy is adopted since user has no control on the way the - // rotations are combined. - - void AddPlacedVolume( G4LogicalVolume* pPlacedVolume, - G4ThreeVector& translation, - G4RotationMatrix* rotation, - int copyNo=0,G4String userComment=""); - // - // Place the given volume 'pPlacedVolume' inside the assembly. - // - // The adopted approach: - // - // - Place it w.r.t. the assembly coordinate system. - // This step is applied to each of the participating volumes. - // - // The other possible approaches: - // - // - Place w.r.t. the firstly added volume. - // When placed the first, the virtual coordinate system becomes - // the coordinate system of the first one. - // Every next volume being added into the assembly will be placed - // w.r.t to the first one. - // - // - Place w.r.t the last placed volume. - // When placed the first, the virtual coordinate system becomes - // the coordinate system of the first one. - // Every next volume being added into the assembly will be placed - // w.r.t to the previous one. - // - // The rotation matrix passed as argument can be 0 (identity) or an address - // even of an object on the upper stack frame. During assembly imprint, a - // new matrix is created anyway and it is kept track of it so it can be - // automatically deleted later at the end of the application. - // This policy is adopted since user has no control on the way the - // rotations are combined. - - void AddPlacedVolume( G4LogicalVolume* pPlacedVolume, - G4Transform3D& transformation, - int copyNo=0,G4String userComment=""); - // - // The same as previous, but takes complete 3D transformation in space - // as its argument. - - void AddPlacedAssembly( Geo2G4AssemblyVolume* pAssembly, - G4Transform3D& transformation); - // - // The same as previous AddPlacedVolume(), but takes an assembly volume - // as its argument. - - void AddPlacedAssembly( Geo2G4AssemblyVolume* pAssembly, - G4ThreeVector& translation, - G4RotationMatrix* rotation); - // - // The same as above AddPlacedVolume(), but takes an assembly volume - // as its argument with translation and rotation. - - void MakeImprint( G4LogicalVolume* pMotherLV, - G4ThreeVector& translationInMother, - G4RotationMatrix* pRotationInMother, - G4int copyNumBase = 0, - G4bool ITkScheme = false, - G4bool surfCheck = false ); - // - // Creates instance of an assembly volume inside the given mother volume. - - void MakeImprint( G4LogicalVolume* pMotherLV, - G4Transform3D& transformation, - G4int copyNumBase = 0, - G4bool ITkScheme = false, - G4bool surfCheck = false ); - // - // The same as previous Imprint() method, but takes complete 3D - // transformation in space as its argument. - - inline std::vector<G4VPhysicalVolume*>::iterator GetVolumesIterator(); - inline unsigned int TotalImprintedVolumes() const; - // - // Methods to access the physical volumes imprinted with the assembly. - - unsigned int GetImprintsCount() const; - // - // Return the number of made imprints. - - unsigned int GetInstanceCount() const; - // - // Return the number of existing instance of Geo2G4AssemblyVolume class. - - unsigned int GetAssemblyID() const; - // - // Return instance number of this concrete object. - -protected: - - void SetInstanceCount( unsigned int value ); - void SetAssemblyID( unsigned int value ); - - void InstanceCountPlus(); - void InstanceCountMinus(); - - void SetImprintsCount( unsigned int value ); - void ImprintsCountPlus(); - void ImprintsCountMinus(); - // - // Internal counting mechanism, used to compute unique the names of - // physical volumes created by MakeImprint() methods. - -private: - - void MakeImprint( Geo2G4AssemblyVolume* pAssembly, - G4LogicalVolume* pMotherLV, - G4Transform3D& transformation, - G4int copyNumBase = 0, - G4bool ITkScheme = false, - G4bool surfCheck = false ); - // - // Function for placement of the given assembly in the given mother - // (called recursively if the assembly contains an assembly). - -private: - - std::vector<Geo2G4AssemblyTriplet> m_triplets; - std::vector<int> m_copyNumbers; - std::vector<G4String> m_userComments; - // - // Participating volumes represented as a vector of - // <logical volume, translation, rotation>. - - std::vector<G4VPhysicalVolume*> m_PVStore; - // - // We need to keep list of physical volumes created by MakeImprint() method - // in order to be able to cleanup the objects when not needed anymore. - // This requires the user to keep assembly objects in memory during the - // whole job or during the life-time of G4Navigator, logical volume store - // and physical volume store keep pointers to physical volumes generated by - // the assembly volume. - // When an assembly object is about to die it will destroy all its - // generated physical volumes and rotation matrices as well ! - - unsigned int m_imprintsCounter; - // - // Number of imprints of the given assembly volume. - - static unsigned int s_instanceCounter; - // - // Class instance counter. - - unsigned int m_assemblyID; - // - // Assembly object ID derived from instance counter at construction time. - -}; - -inline -unsigned int Geo2G4AssemblyVolume::GetImprintsCount() const -{ - return m_imprintsCounter; -} - -inline -void Geo2G4AssemblyVolume::SetImprintsCount( unsigned int value ) -{ - m_imprintsCounter = value; -} - - -inline -void Geo2G4AssemblyVolume::ImprintsCountPlus() -{ - m_imprintsCounter++; -} - -inline -void Geo2G4AssemblyVolume::ImprintsCountMinus() -{ - m_imprintsCounter--; -} - -inline -unsigned int Geo2G4AssemblyVolume::GetAssemblyID() const -{ - return m_assemblyID; -} - -inline -void Geo2G4AssemblyVolume::SetAssemblyID( unsigned int value ) -{ - m_assemblyID = value; -} - -inline -std::vector<G4VPhysicalVolume*>::iterator -Geo2G4AssemblyVolume::GetVolumesIterator() -{ - std::vector<G4VPhysicalVolume*>::iterator iterator = m_PVStore.begin(); - return iterator; -} - -inline -unsigned int Geo2G4AssemblyVolume::TotalImprintedVolumes() const -{ - return m_PVStore.size(); -} - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Builder.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Builder.cxx deleted file mode 100644 index c3ef4e89b..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Builder.cxx +++ /dev/null @@ -1,225 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4Builder.h" -#include "Geo2G4SvcAccessor.h" -#include "G4AtlasInterfaces/Geo2G4SvcBase.h" -#include "Geo2G4OpticalSurfaceFactory.h" - -#include "GeoModelKernel/GeoVDetectorManager.h" -#include "GeoModelKernel/GeoShapeUnion.h" -#include "GeoModelKernel/GeoShapeShift.h" -#include "GeoModelKernel/GeoMaterial.h" -#include "GeoModelKernel/GeoLogVol.h" -#include "GeoModelKernel/GeoPhysVol.h" -#include "GeoModelKernel/GeoTransform.h" - -#include "GeoModelUtilities/GeoModelExperiment.h" -#include "GeoModelInterfaces/StoredMaterialManager.h" - -#include "AthenaBaseComps/AthMsgStreamMacros.h" - -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/Bootstrap.h" -#include "StoreGate/StoreGateSvc.h" -#include "StoreGate/StoreGate.h" - -#include "G4ReflectionFactory.hh" -#include "G4LogicalBorderSurface.hh" -#include "G4OpticalSurface.hh" - -#include <map> -#include <iostream> - -Geo2G4Builder::Geo2G4Builder(std::string detectorName) - : m_detectorName(detectorName) - , m_motherTransform(GeoTrf::Transform3D::Identity()) - , m_matAir(nullptr) - , m_pDetStore(nullptr) - , m_msg("Geo2G4Builder") -{ - ISvcLocator* svcLocator = Gaudi::svcLocator(); // from Bootstrap - StatusCode sc=svcLocator->service("DetectorStore",m_pDetStore); - if (sc.isFailure()) { - ATH_MSG_FATAL("Geo2G4Builder for detector "<<detectorName<<"could not access the detector store - PANIC!!!!"); - abort(); - } - - const GeoModelExperiment* theExpt = nullptr; - sc = m_pDetStore->retrieve( theExpt, "ATLAS" ); - if(sc.isFailure()){ - ATH_MSG_ERROR("Detector "<< detectorName << "could not get GeoModelExperiment!"); - } else { - const GeoVDetectorManager *theManager = theExpt->getManager(detectorName); - - for(unsigned int i=0; i<theManager->getNumTreeTops(); i++) - m_treeTops.push_back(theManager->getTreeTop(i)); - - ATH_MSG_INFO("Found detector: top volume(s)"); - for(unsigned int i=0; i<m_treeTops.size();i++) - ATH_MSG_INFO( " Tree Top " << i << " " << m_treeTops[i]->getLogVol()->getName() ); - - if(m_treeTops.size()>1) - { - // -------- -------- MATERIAL MANAGER -------- ---------- - const StoredMaterialManager* theMaterialManager = nullptr; - sc = m_pDetStore->retrieve(theMaterialManager, "MATERIALS"); - if(sc.isFailure()) - ATH_MSG_ERROR("Detector "<< detectorName << "could not retrieve Material Manager when number of tree tops > 1"); - else - m_matAir = theMaterialManager->getMaterial("std::Air"); - } - - Geo2G4SvcAccessor accessor; - Geo2G4SvcBase *g=accessor.GetGeo2G4Svc(); - m_theBuilder=g->GetDefaultBuilder(); - if(m_theBuilder) - ATH_MSG_INFO("Set volume builder ---> "<< m_theBuilder->GetKey()); - else - ATH_MSG_WARNING("0 pointer to volume builder." - <<"\n Use 'DefaultBuilder' property of Geo2G4Svc or" - <<"\n 'GetVolumeBuilder' method of Geo2G4Builder"); - } -} - -G4LogicalVolume* Geo2G4Builder::BuildTree() -{ - G4LogicalVolume* result = 0; - OpticalVolumesMap* optical_volumes = 0; - const GeoBorderSurfaceContainer* surface_container = 0; - - // Check whether we have to deal with optical surfaces - if(m_pDetStore->contains<GeoBorderSurfaceContainer>(m_detectorName)) - { - StatusCode sc = m_pDetStore->retrieve(surface_container,m_detectorName); - if(sc.isSuccess() && surface_container!=0 && surface_container->size()>0) - optical_volumes = new OpticalVolumesMap(); - } - - if(m_theBuilder) //if(m_theBuilder) - { - if(m_treeTops.size()==1) { - m_motherTransform = m_treeTops[0]->getX(); - result = m_theBuilder->Build(m_treeTops[0],optical_volumes); - } else /// xxx - { - // Create temporary GeoModel physical volume - // The shape is composed by TreeTop shapes + their transforms - const GeoShape& shFirst = (*(m_treeTops[0]->getLogVol()->getShape()))<<(m_treeTops[0]->getX()); - const GeoShape* shResult = &shFirst; - - for(unsigned int i=1; i<m_treeTops.size(); i++){ - const GeoShape& shNext = (*shResult).add((*(m_treeTops[i]->getLogVol()->getShape()))<<(m_treeTops[i]->getX())); - shResult = &shNext; - } - - GeoLogVol* lvEnvelope = new GeoLogVol(m_detectorName,shResult,m_matAir); - GeoPhysVol* pvEnvelope = new GeoPhysVol(lvEnvelope); - - result = m_theBuilder->Build(pvEnvelope); - - // Get pointer to the World - PVConstLink world = m_treeTops[0]->getParent(); - - // Add all tree tops to the result - for(unsigned int i=0; i<m_treeTops.size(); i++) - { - // Current Tree Top and its index - PVConstLink pv = m_treeTops[i]; - Query<unsigned int> childIndx = world->indexOf(pv); - - // Tree Top transformation - G4Transform3D theG4Position(Amg::EigenTransformToCLHEP(world->getXToChildVol(childIndx))); - - // Copy number - int id = 16969; - Query<int> Qint = world->getIdOfChildVol(childIndx); - if(Qint.isValid()) id = Qint; - - // PV Tree Top name - std::string nameTT = world->getNameOfChildVol(childIndx); - if (nameTT == "ANON") nameTT = pv->getLogVol()->getName(); - - - G4LogicalVolume* g4LV = m_theBuilder->Build(pv,optical_volumes); - G4ReflectionFactory::Instance()->Place(theG4Position, - nameTT, - g4LV, - result, - false, - id); - } - - // Add the temporary physical volume to the GeoModelExperiment - GeoModelExperiment * theExpt; - StatusCode sc = m_pDetStore->retrieve(theExpt,"ATLAS"); - if(sc.isFailure()) - ATH_MSG_WARNING("Unable to retrieve GeoModelExperiment. Temporary volume cannot be released"); - else - theExpt->addTmpVolume(pvEnvelope); - }/// else xxx - } //if(m_theBuilder) - - // build optical surfaces if necessary - if(optical_volumes!=0 && optical_volumes->size()>0){ - BuildOpticalSurfaces(surface_container,optical_volumes); - } else if (optical_volumes!=0){ - ATH_MSG_WARNING("Optical volumes apparently requested, but none found! Deleting temps"); - } - if (optical_volumes!=0) delete optical_volumes; - - return result; -} - - -VolumeBuilder* Geo2G4Builder::GetVolumeBuilder(std::string bname) -{ - Geo2G4SvcAccessor accessor; - Geo2G4SvcBase *g=accessor.GetGeo2G4Svc(); - - m_theBuilder=g->GetVolumeBuilder(bname); - return m_theBuilder; -} - -void Geo2G4Builder::BuildOpticalSurfaces(const GeoBorderSurfaceContainer* surface_container, - const OpticalVolumesMap* optical_volumes) -{ - Geo2G4OpticalSurfaceFactory surfaceFactory; - - // Iterate over all Border Surfaces in the container - GeoBorderSurfaceContainer::const_iterator first = surface_container->begin(); - GeoBorderSurfaceContainer::const_iterator last = surface_container->end(); - - for(;first!=last;first++) - { - // Build Optical Surface - const GeoBorderSurface& border_surface = *first; - G4OpticalSurface* g4OptSurface = surfaceFactory.Build(border_surface.getOptSurface()); - - G4VPhysicalVolume* g4PV1 = 0; - G4VPhysicalVolume* g4PV2 = 0; - OpticalVolumesMap::const_iterator volIt; - - // First physical volume - volIt = optical_volumes->find(border_surface.getPV1()); - if(volIt == optical_volumes->end()) - { - ATH_MSG_WARNING("Unable to find " << border_surface.getPV1()->getLogVol()->getName() << " in Optical Volumes map"); - continue; - } - g4PV1 = volIt.operator->()->second; - - // Second physical volume - volIt = optical_volumes->find(border_surface.getPV2()); - if(volIt == optical_volumes->end()) - { - ATH_MSG_WARNING("Unable to find " << border_surface.getPV1()->getLogVol()->getName() << " in Optical Volumes map"); - continue; - } - g4PV2 = volIt.operator->()->second; - - // G4LogicalBorderSurface - G4LogicalBorderSurface* g4BorderSurface __attribute__((unused)) = new G4LogicalBorderSurface(border_surface.getName(),g4PV1,g4PV2,g4OptSurface); - } -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Builder.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Builder.h deleted file mode 100644 index 3aa785ebb..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Builder.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4Builder_H -#define GEO2G4_Geo2G4Builder_H - -// main builder to create/position all volumes described in a GeoModel Tree - -// GeoVPhysVol -#include "VolumeBuilder.h" -#include "GeoModelKernel/GeoVPhysVol.h" -#include "GeoModelKernel/GeoDefinitions.h" -#include "G4LogicalVolume.hh" -//#include "Geo2G4/GenericVolumeBuilder.h" - -// Typedef -#include "GeoModelUtilities/GeoBorderSurfaceContainer.h" - -#include "AthenaKernel/MsgStreamMember.h" - -#include "GeoPrimitives/CLHEPtoEigenConverter.h" - -// STL includes -#include <string> -#include <vector> - -class GeoMaterial; -class StoreGateSvc; - -class Geo2G4Builder { - -public: - // Constructor: - Geo2G4Builder(std::string detectorName); - // Destructor: - ~Geo2G4Builder() {;} - - // Build method - geometry - G4LogicalVolume* BuildTree(); - - // Build method - optical surfaces - void BuildOpticalSurfaces(const GeoBorderSurfaceContainer* surface_container, - const OpticalVolumesMap* optical_volumes); - - // Access volume builder: - VolumeBuilder* GetVolumeBuilder(std::string); - - HepGeom::Transform3D GetDetectorTransform() {return Amg::EigenTransformToCLHEP(m_motherTransform);} - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - -private: - - // GeoVDetectorManager* theDetectorElement; - std::string m_detectorName; - GeoTrf::Transform3D m_motherTransform; - std::vector<PVConstLink> m_treeTops; - VolumeBuilder *m_theBuilder; - - // std::Air in the case when top boolean envelope has to be built - const GeoMaterial* m_matAir; - StoreGateSvc* m_pDetStore; - - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LVFactory.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LVFactory.cxx deleted file mode 100644 index f20c86fa8..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LVFactory.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4LVFactory.h" -#include "Geo2G4SolidFactory.h" -#include "GeoMaterial2G4/Geo2G4MaterialFactory.h" - -#include "GeoModelKernel/GeoLogVol.h" -#include "GeoModelKernel/GeoFullPhysVol.h" - -#include "G4LogicalVolume.hh" -#include "G4Material.hh" - -#include <iostream> -#include <map> - -typedef std::map<const GeoLogVol*, G4LogicalVolume*, std::less<const GeoLogVol*> > leafVMap; -typedef std::map<const GeoVPhysVol*, G4LogicalVolume*, std::less<const GeoVPhysVol*> > branchVMap; - -typedef std::map<const GeoFullPhysVol*, G4LogicalVolume*, std::less<const GeoFullPhysVol*> > fullPVMap; - -Geo2G4LVFactory::Geo2G4LVFactory() -{ -} - -G4LogicalVolume* Geo2G4LVFactory::Build(const PVConstLink thePhys, - bool& descend) const -{ - static Geo2G4SolidFactory theSolidFactory; - static Geo2G4MaterialFactory theMaterialFactory; - - static leafVMap sharedLeafLV; - static branchVMap sharedBranchLV; - static fullPVMap clonedLV; - - const GeoFullPhysVol* fullPV = dynamic_cast<const GeoFullPhysVol*>(&(*thePhys)); - const GeoFullPhysVol* clonePV=0; - - const GeoLogVol* theLog = thePhys->getLogVol(); - G4LogicalVolume *theG4Log=0; - G4Material* theG4Mat=0; - G4VSolid* theG4Solid=0; - - descend = true; - bool putLeaf = false; - bool putBranch = false; - bool putFullPV = false; - - // Check if it is a leaf node of Geo tree - if(thePhys->getNChildVols() == 0) - { - descend=false; - - if(sharedLeafLV.find(theLog) != sharedLeafLV.end()) - return sharedLeafLV[theLog]; - else // here supposed to be ---> else if(theLog->refCount() > 1) - putLeaf = true; - } - // Work with the Full Physical Volumes - else if(fullPV) - { - clonePV = fullPV->cloneOrigin(); - if (clonedLV.find(clonePV)==clonedLV.end()) - { - if(clonePV) putFullPV = true; - } - else - { - descend = false; - return clonedLV[clonePV]; - } - } - else - { - if(sharedBranchLV.find(&(*thePhys)) == sharedBranchLV.end()) - putBranch = true; - else - { - descend = false; - return sharedBranchLV[&(*thePhys)]; - } - } - // Actually build the G4Log - - theG4Mat=theMaterialFactory.Build(theLog->getMaterial()); - theG4Solid = theSolidFactory.Build(theLog->getShape(),theLog->getName()); - - theG4Log = new G4LogicalVolume(theG4Solid, - theG4Mat, - theLog->getName(), - 0,0,0); - - if(putLeaf) sharedLeafLV[theLog] = theG4Log; - if(putBranch) sharedBranchLV[&(*thePhys)] = theG4Log; - if(putFullPV) clonedLV[clonePV] = theG4Log; - - return theG4Log; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LVFactory.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LVFactory.h deleted file mode 100644 index 3b75b06b8..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LVFactory.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4LVFactory_h -#define GEO2G4_Geo2G4LVFactory_h - -#include "GeoModelKernel/GeoVPhysVol.h" - -class G4LogicalVolume; -class GeoLogVol; - -class Geo2G4LVFactory -{ - public: - Geo2G4LVFactory(); - G4LogicalVolume* Build(const PVConstLink, - bool&) const; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LogicalVolumeFactory.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LogicalVolumeFactory.cxx deleted file mode 100644 index f37928cf0..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LogicalVolumeFactory.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4LogicalVolumeFactory.h" -#include "Geo2G4SolidFactory.h" -#include "GeoMaterial2G4/Geo2G4MaterialFactory.h" - -#include "GeoModelKernel/GeoLogVol.h" - -#include "G4LogicalVolume.hh" -#include "G4Material.hh" - -#include "SimHelpers/ServiceAccessor.h" - -Geo2G4LogicalVolumeFactory::Geo2G4LogicalVolumeFactory() -{ -} - -G4LogicalVolume *Geo2G4LogicalVolumeFactory::Build(const GeoLogVol* theLog) const -{ - static Geo2G4SolidFactory theSolidFactory; - static Geo2G4MaterialFactory theMaterialFactory; - // - // Get Material from GeoModel - // - std::string n= theLog->getName(); - G4LogicalVolume *theG4Log=0; - G4Material* theG4Mat=theMaterialFactory.Build(theLog->getMaterial()); - - G4VSolid * theG4Solid = theSolidFactory.Build(theLog->getShape(),theLog->getName()); - - theG4Log = new G4LogicalVolume(theG4Solid, - theG4Mat, - theLog->getName(), - 0,0,0); ; - - return theG4Log; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LogicalVolumeFactory.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LogicalVolumeFactory.h deleted file mode 100644 index fec639690..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4LogicalVolumeFactory.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4LogicalVolumeFactory_h -#define GEO2G4_Geo2G4LogicalVolumeFactory_h - -class G4LogicalVolume; -class GeoLogVol; - -class Geo2G4LogicalVolumeFactory { -public: - Geo2G4LogicalVolumeFactory(); - G4LogicalVolume* Build(const GeoLogVol*) const; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4OpticalSurfaceFactory.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4OpticalSurfaceFactory.cxx deleted file mode 100644 index 3af74f855..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4OpticalSurfaceFactory.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4OpticalSurfaceFactory.h" -#include "GeoMaterial2G4/Geo2G4MatPropTableFactory.h" - -#include "GeoModelUtilities/GeoOpticalSurface.h" - -#include "G4OpticalSurface.hh" - -Geo2G4OpticalSurfaceFactory::Geo2G4OpticalSurfaceFactory() -{ -} - -G4OpticalSurface* Geo2G4OpticalSurfaceFactory::Build(const GeoOpticalSurface* geoOpticalSurface) -{ - // - // Check if this surface has already been defined. - // - if(m_definedOptSurfaces.find(geoOpticalSurface) != m_definedOptSurfaces.end()) { - return m_definedOptSurfaces[geoOpticalSurface]; - } - - // map enums - G4OpticalSurfaceModel g4Model; - G4OpticalSurfaceFinish g4Finish; - G4SurfaceType g4Type; - - switch(geoOpticalSurface->GetModel()) - { - case GeoOpticalSurface::glisur: - { - g4Model = glisur; - break; - } - case GeoOpticalSurface::unified: - { - g4Model = unified; - break; - } - default: - g4Model = glisur; - } - - switch(geoOpticalSurface->GetFinish()) - { - case GeoOpticalSurface::polished: - { - g4Finish = polished; - break; - } - case GeoOpticalSurface::polishedfrontpainted: - { - g4Finish = polishedfrontpainted; - break; - } - case GeoOpticalSurface::polishedbackpainted: - { - g4Finish = polishedbackpainted; - break; - } - case GeoOpticalSurface::ground: - { - g4Finish = ground; - break; - } - case GeoOpticalSurface::groundfrontpainted: - { - g4Finish = groundfrontpainted; - break; - } - case GeoOpticalSurface::groundbackpainted: - { - g4Finish = groundbackpainted; - break; - } - default: - g4Finish = polished; - } - - switch(geoOpticalSurface->GetType()) - { - case GeoOpticalSurface::dielectric_metal: - { - g4Type = dielectric_metal; - break; - } - case GeoOpticalSurface::dielectric_dielectric: - { - g4Type = dielectric_dielectric; - break; - } - case GeoOpticalSurface::firsov: - { - g4Type = firsov; - break; - } - case GeoOpticalSurface::x_ray: - { - g4Type = x_ray; - break; - } - default: - g4Type = dielectric_dielectric; - } - - - - G4OpticalSurface* newG4Surface = new G4OpticalSurface(geoOpticalSurface->GetName(), - g4Model, - g4Finish, - g4Type, - geoOpticalSurface->GetParameter()); - - // Create material properties table - Geo2G4MatPropTableFactory* tFactory = Geo2G4MatPropTableFactory::instance(); - GeoMaterialPropertiesTable* geoPropTable = geoOpticalSurface->GetMaterialPropertiesTable(); - - if(geoPropTable){ - G4MaterialPropertiesTable* g4PropTable = tFactory->Build(geoPropTable); - if(g4PropTable) - newG4Surface->SetMaterialPropertiesTable(g4PropTable); - } - - return newG4Surface; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4OpticalSurfaceFactory.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4OpticalSurfaceFactory.h deleted file mode 100644 index 035f1988e..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4OpticalSurfaceFactory.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4OpticalSurfaceFactory_h -#define GEO2G4_Geo2G4OpticalSurfaceFactory_h - -#include <map> - -class GeoOpticalSurface; -class G4OpticalSurface; - -typedef std::map<const GeoOpticalSurface* , G4OpticalSurface*, std::less<const GeoOpticalSurface*> > Geo2G4OptSurfaceMap; - -class Geo2G4OpticalSurfaceFactory -{ - public: - Geo2G4OpticalSurfaceFactory(); - - G4OpticalSurface* Build(const GeoOpticalSurface*); - private: - Geo2G4OptSurfaceMap m_definedOptSurfaces; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4STParameterisation.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4STParameterisation.cxx deleted file mode 100644 index 65ab76da7..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4STParameterisation.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4STParameterisation.h" -#include "G4VPhysicalVolume.hh" -#include "GeoPrimitives/CLHEPtoEigenConverter.h" -#include "CLHEP/Geometry/Transform3D.h" - -Geo2G4STParameterisation::Geo2G4STParameterisation(const GeoXF::Function* func, - unsigned int copies): - m_function(func->clone()), - m_nCopies(copies) -{ - m_rotation = new G4RotationMatrix(); -} - -Geo2G4STParameterisation::~Geo2G4STParameterisation() -{ - delete m_rotation; -} - -void Geo2G4STParameterisation::ComputeTransformation(const G4int copyNo, - G4VPhysicalVolume* physVol) const -{ - HepGeom::Transform3D transform = Amg::EigenTransformToCLHEP((*m_function)(copyNo)); - G4ThreeVector translation = transform.getTranslation(); - *m_rotation = transform.getRotation().inverse(); - - physVol->SetTranslation(translation); - physVol->SetRotation(m_rotation); -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4STParameterisation.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4STParameterisation.h deleted file mode 100644 index 4e501cedb..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4STParameterisation.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4STParameterisation_H -#define GEO2G4_Geo2G4STParameterisation_H - -#include "globals.hh" -#include "G4VPVParameterisation.hh" -#include "G4RotationMatrix.hh" - -#include "GeoModelKernel/GeoXF.h" - -class G4VPhysicalVolume; - -// Dummy declarations. To avoid warnings -class G4Box; -class G4Trd; -class G4Trap; -class G4Cons; -class G4Sphere; -class G4Torus; -class G4Para; -class G4Hype; -class G4Tubs; -class G4Orb; -class G4Polyhedra; -class G4Polycone; -class G4Ellipsoid; - -class Geo2G4STParameterisation : public G4VPVParameterisation -{ -public: - - Geo2G4STParameterisation(const GeoXF::Function* func, - unsigned int copies); - - virtual ~Geo2G4STParameterisation(); - - void ComputeTransformation (const G4int copyNo, - G4VPhysicalVolume* physVol) const; - -private: - // Declaring, but not defining private copy-constructor and - // assignment operator, as an object of this class should never be - // copied. - Geo2G4STParameterisation(const Geo2G4STParameterisation&); - Geo2G4STParameterisation& operator= (const Geo2G4STParameterisation&); - - // Dummy declarations. To avoid warnings - - void ComputeDimensions (G4Box&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Trd&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Trap&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Cons&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Sphere&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Torus&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Para&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Hype&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Tubs&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Orb&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Polycone&,const G4int,const G4VPhysicalVolume*) const {} - void ComputeDimensions (G4Ellipsoid&,const G4int,const G4VPhysicalVolume*) const {} - - const GeoXF::Function *m_function; - G4RotationMatrix* m_rotation; - unsigned int m_nCopies; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SolidFactory.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SolidFactory.cxx deleted file mode 100644 index 3e52caad8..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SolidFactory.cxx +++ /dev/null @@ -1,594 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4SolidFactory.h" -#include "LArWheelSolid.h" -#include "LArWheelSolidDDProxy.h" - -#include "GeoSpecialShapes/LArCustomShape.h" - -#include "GeoModelKernel/GeoShape.h" -#include "GeoModelKernel/GeoBox.h" -#include "GeoModelKernel/GeoTube.h" -#include "GeoModelKernel/GeoTubs.h" -#include "GeoModelKernel/GeoTrd.h" -#include "GeoModelKernel/GeoPcon.h" -#include "GeoModelKernel/GeoPgon.h" -#include "GeoModelKernel/GeoPara.h" -#include "GeoModelKernel/GeoTrap.h" -#include "GeoModelKernel/GeoCons.h" -#include "GeoModelKernel/GeoSimplePolygonBrep.h" -#include "GeoModelKernel/GeoTessellatedSolid.h" -#include "GeoModelKernel/GeoEllipticalTube.h" -#include "GeoModelKernel/GeoTorus.h" -#include "GeoModelKernel/GeoGenericTrap.h" -#include "GeoModelKernel/GeoShapeShift.h" -#include "GeoModelKernel/GeoShapeUnion.h" -#include "GeoModelKernel/GeoShapeIntersection.h" -#include "GeoModelKernel/GeoShapeSubtraction.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" - -#include "G4VSolid.hh" -#include "G4Box.hh" -#include "G4Tubs.hh" -#include "G4Trd.hh" -#include "G4Polycone.hh" -#include "G4Cons.hh" -#include "G4Polyhedra.hh" -#include "G4Trap.hh" -#include "G4Para.hh" -#include "G4UnionSolid.hh" -#include "G4DisplacedSolid.hh" -#include "G4IntersectionSolid.hh" -#include "G4SubtractionSolid.hh" -#include "G4ExtrudedSolid.hh" -#include "G4TessellatedSolid.hh" -#include "G4EllipticalTube.hh" -#include "G4Torus.hh" -#include "G4TriangularFacet.hh" -#include "G4QuadrangularFacet.hh" -#include "G4GenericTrap.hh" - -#include <iostream> -#include <map> -#include <cmath> - -#include "GeoPrimitives/CLHEPtoEigenConverter.h" - -typedef std::map<const GeoShape*, G4VSolid*, std::less<const GeoShape*> > shapesMap; -typedef std::map<std::string, G4VSolid*,std::less<std::string> > customSolidMap; - -const Geo2G4SolidFactory::LArWheelSolid_typemap Geo2G4SolidFactory::s_lwsTypes = { - { "LAr::EMEC::InnerWheel::Absorber", {InnerAbsorberWheel, 1} }, - { "LAr::EMEC::Pos::InnerWheel::Absorber", {InnerAbsorberWheel, 1} }, - - { "LAr::EMEC::OuterWheel::Absorber", {OuterAbsorberWheel, 1} }, - { "LAr::EMEC::Pos::OuterWheel::Absorber", {OuterAbsorberWheel, 1} }, - - { "LAr::EMEC::InnerWheel::Electrode", {InnerElectrodWheel, 1} }, - { "LAr::EMEC::Pos::InnerWheel::Electrode", {InnerElectrodWheel, 1} }, - - { "LAr::EMEC::OuterWheel::Electrode", {OuterElectrodWheel, 1} }, - { "LAr::EMEC::Pos::OuterWheel::Electrode", {OuterElectrodWheel, 1} }, - - { "LAr::EMEC::Neg::InnerWheel::Absorber", {InnerAbsorberWheel, -1} }, - - { "LAr::EMEC::Neg::OuterWheel::Absorber", {OuterAbsorberWheel, -1} }, - - { "LAr::EMEC::Neg::InnerWheel::Electrode", {InnerElectrodWheel, -1} }, - - { "LAr::EMEC::Neg::OuterWheel::Electrode", {OuterElectrodWheel, -1} }, - - { "LAr::EMEC::InnerModule::Absorber", {InnerAbsorberModule, 1} }, - - { "LAr::EMEC::OuterModule::Absorber", {OuterAbsorberModule, 1} }, - - { "LAr::EMEC::InnerModule::Electrode", {InnerElectrodModule, 1} }, - - { "LAr::EMEC::OuterModule::Electrode", {OuterElectrodModule, 1} }, - - { "LAr::EMEC::InnerWheel::Glue", {InnerGlueWheel, 1} }, - { "LAr::EMEC::Pos::InnerWheel::Glue", {InnerGlueWheel, 1} }, - - { "LAr::EMEC::InnerWheel::Lead", {InnerLeadWheel, 1} }, - { "LAr::EMEC::Pos::InnerWheel::Lead", {InnerLeadWheel, 1} }, - - { "LAr::EMEC::OuterWheel::Glue", {OuterGlueWheel, 1} }, - { "LAr::EMEC::Pos::OuterWheel::Glue", {OuterGlueWheel, 1} }, - - { "LAr::EMEC::OuterWheel::Lead", {OuterLeadWheel, 1} }, - { "LAr::EMEC::Pos::OuterWheel::Lead", {OuterLeadWheel, 1} }, - - { "LAr::EMEC::Neg::InnerWheel::Glue", {InnerGlueWheel, -1} }, - - { "LAr::EMEC::Neg::OuterWheel::Glue", {OuterGlueWheel, -1} }, - - { "LAr::EMEC::Neg::InnerWheel::Lead", {InnerLeadWheel, -1} }, - - { "LAr::EMEC::Neg::OuterWheel::Lead", {OuterLeadWheel, -1} } -}; - -Geo2G4SolidFactory::Geo2G4SolidFactory() : - m_msg("Geo2G4SolidFactory"), - m_detStore( "StoreGateSvc/DetectorStore", "Geo2G4SolidFactory" ) -{ -} - -G4VSolid *Geo2G4SolidFactory::Build(const GeoShape* geoShape, std::string name) const -{ - G4VSolid* theSolid(nullptr); - - static customSolidMap customSolids; - static shapesMap sharedShapes; - if(sharedShapes.find(geoShape)!=sharedShapes.end()) - return sharedShapes[geoShape]; - - // ------- Variables for boolean operations - G4VSolid* solidA(nullptr); - G4VSolid* solidB(nullptr); - // ------- Variables for Pcon and Pgon - int nPlanes; - double* zPlane(nullptr); - double* rInner(nullptr); - double* rOuter(nullptr); - - std::string n = name; - - // - // The Box - // - if(geoShape->typeID() == GeoBox::getClassTypeID() ) - { - const GeoBox* theBox = dynamic_cast<const GeoBox*> (geoShape); - if (nullptr==theBox) throw std::runtime_error("TypeID did not match cast for box"); - if (n.empty()) n="G4Box"; - if (theBox->getXHalfLength()<=0.){ ATH_MSG_WARNING("Box " << n << " has an x side of " << theBox->getXHalfLength() <<" - using std::abs.");} - if (theBox->getYHalfLength()<=0.){ ATH_MSG_WARNING("Box " << n << " has an y side of " << theBox->getYHalfLength() <<" - using std::abs.");} - if (theBox->getZHalfLength()<=0.){ ATH_MSG_WARNING("Box " << n << " has an z side of " << theBox->getZHalfLength() <<" - using std::abs.");} - theSolid = new G4Box(n, - std::abs(theBox->getXHalfLength()), - std::abs(theBox->getYHalfLength()), - std::abs(theBox->getZHalfLength())); - } - // - // The Tube - // - else if(geoShape->typeID() == GeoTube::getClassTypeID() ) - { - const GeoTube* theTube = dynamic_cast<const GeoTube*> (geoShape); - if (nullptr==theTube) throw std::runtime_error("TypeID did not match cast for tube"); - if (n.empty()) n="G4Tube"; - if (theTube->getRMax()<=0.){ ATH_MSG_WARNING("Tube " << n << " has a max radius of " << theTube->getRMax() <<" - using std::abs.");} - if (theTube->getZHalfLength()<=0.){ ATH_MSG_WARNING("Tube " << n << " has a z half length of " << theTube->getZHalfLength() << " - using std::abs.");} - if (theTube->getRMax()<theTube->getRMin()){ ATH_MSG_WARNING("Tube " << n << " has a max radius of " << theTube->getRMax() << " and a min radius of " << theTube->getRMin());} - theSolid = new G4Tubs(n, - theTube->getRMin(), - std::abs(theTube->getRMax()), - std::abs(theTube->getZHalfLength()), - 0.,360*CLHEP::deg); - } - // - // The Tubs - // - else if(geoShape->typeID() == GeoTubs::getClassTypeID() ) - { - const GeoTubs* theTubs = dynamic_cast<const GeoTubs*> (geoShape); - if (nullptr==theTubs) throw std::runtime_error("TypeID did not match cast for tubs"); - if (n.empty()) n="G4Tubs"; - if (theTubs->getRMin()<0.){ ATH_MSG_WARNING("Tubs " << n << " has a min radius of " << theTubs->getRMax());} - if (theTubs->getRMax()<=0.){ ATH_MSG_WARNING("Tubs " << n << " has a max radius of " << theTubs->getRMax() <<" - using std::abs.");} - if (theTubs->getZHalfLength()<=0.){ ATH_MSG_WARNING("Tubs " << n << " has a half length of " << theTubs->getZHalfLength() <<" - using std::abs.");} - if (theTubs->getRMax()<theTubs->getRMin()){ ATH_MSG_WARNING("Tubs " << n << " has a max radius of " << theTubs->getRMax() << " and a min radius of " << theTubs->getRMin());} - if (theTubs->getDPhi()<=0.){ ATH_MSG_WARNING("Tubs " << n << " has a dPhi of " << theTubs->getDPhi());} - theSolid = new G4Tubs(n, - theTubs->getRMin(), - std::abs(theTubs->getRMax()), - std::abs(theTubs->getZHalfLength()), - theTubs->getSPhi(), - theTubs->getDPhi()); - } - // - // The Trd - // - else if(geoShape->typeID() == GeoTrd::getClassTypeID() ) - { - const GeoTrd* theTrd = dynamic_cast<const GeoTrd*> (geoShape); - if (nullptr==theTrd) throw std::runtime_error("TypeID did not match cast for trd"); - if (n.empty()) n="G4Trd"; - if (theTrd->getXHalfLength1()<0.){ ATH_MSG_WARNING("Trd " << n << " has a x half length 1 of " << theTrd->getXHalfLength1() << " - using std::abs.");} - if (theTrd->getXHalfLength2()<0.){ ATH_MSG_WARNING("Trd " << n << " has a x half length 2 of " << theTrd->getXHalfLength2() << " - using std::abs.");} - if (theTrd->getYHalfLength1()<0.){ ATH_MSG_WARNING("Trd " << n << " has a y half length 1 of " << theTrd->getYHalfLength1() << " - using std::abs.");} - if (theTrd->getYHalfLength2()<0.){ ATH_MSG_WARNING("Trd " << n << " has a y half length 2 of " << theTrd->getYHalfLength2() << " - using std::abs.");} - if (theTrd->getZHalfLength()<=0.){ ATH_MSG_WARNING("Trd " << n << " has a z half length of " << theTrd->getZHalfLength() << " - using std::abs.");} - if (theTrd->getXHalfLength1()<=0. && theTrd->getXHalfLength2()<=0.){ ATH_MSG_WARNING("Trd " << n << " has an x half length 1 of " << theTrd->getXHalfLength1() - << " and an x half length 2 of " << theTrd->getXHalfLength2() << " - using std::abs.");} - if (theTrd->getYHalfLength1()<=0. && theTrd->getYHalfLength2()<=0.){ ATH_MSG_WARNING("Trd " << n << " has a y half length 1 of " << theTrd->getYHalfLength1() - << " and a y half length 2 of " << theTrd->getYHalfLength2() << " - using std::abs.");} - theSolid = new G4Trd(n, - std::abs(theTrd->getXHalfLength1()), - std::abs(theTrd->getXHalfLength2()), - std::abs(theTrd->getYHalfLength1()), - std::abs(theTrd->getYHalfLength2()), - std::abs(theTrd->getZHalfLength())); - } - // - // GeoPcon - // - else if(geoShape->typeID() == GeoPcon::getClassTypeID()) - { - const GeoPcon* thePcon = dynamic_cast<const GeoPcon*>(geoShape); - if (nullptr==thePcon) throw std::runtime_error("TypeID did not match cast for pcon"); - if (n.empty()) n="G4Polycone"; - nPlanes = static_cast<int>(thePcon->getNPlanes()); - zPlane = new double[nPlanes]; - rInner = new double[nPlanes]; - rOuter = new double[nPlanes]; - for (unsigned int index=0; index<static_cast<unsigned int>(nPlanes); index++) - { - zPlane[index] = thePcon->getZPlane(index); - rInner[index] = thePcon->getRMinPlane(index); - rOuter[index] = thePcon->getRMaxPlane(index); - if (rInner[index]<0.){ ATH_MSG_WARNING("PCon " << n << " has an inner radius of " << rInner[index] << " for slice " << index << " of " << nPlanes);} - if (rOuter[index]<=0.){ - ATH_MSG_WARNING("PCon " << n << " has an outer radius of " << rOuter[index] << " for slice " << index << " of " << nPlanes << " - using std::abs."); - rOuter[index] = std::abs(rOuter[index]); - } - } - - theSolid = new G4Polycone(n, - thePcon->getSPhi(), - thePcon->getDPhi(), - nPlanes, - zPlane, - rInner, - rOuter); - } - // - // GeoCons - // - else if(geoShape->typeID() == GeoCons::getClassTypeID()) - { - const GeoCons* theCons = dynamic_cast<const GeoCons*>(geoShape); - if (nullptr==theCons) throw std::runtime_error("TypeID did not match cast for cons"); - if (n.empty()) n="G4Cons"; - if (theCons->getRMax1()<0.){ ATH_MSG_WARNING("Cons " << n << " has a max radius 1 of " << theCons->getRMax1() << " - will use std::abs.");} - if (theCons->getRMax2()<0.){ ATH_MSG_WARNING("Cons " << n << " has a max radius 2 of " << theCons->getRMax2() << " - will use std::abs.");} - if (theCons->getRMin1()<0.){ ATH_MSG_WARNING("Cons " << n << " has a min radius 1 of " << theCons->getRMin1());} - if (theCons->getRMin2()<0.){ ATH_MSG_WARNING("Cons " << n << " has a min radius 2 of " << theCons->getRMin2());} - if (theCons->getDZ()<=0){ ATH_MSG_WARNING("Cons " << n << " has a DZ of " << theCons->getDZ() << " - will use std::abs.");} - if (theCons->getRMax1()<=0. && theCons->getRMax2()<=0.){ ATH_MSG_WARNING("Cons " << n << " has a max radius 1 of " << theCons->getRMax1() - << " and a max radius 2 of " << theCons->getRMax2() << " - will use std::abs.");} - theSolid = new G4Cons(n, - theCons->getRMin1(), - std::abs(theCons->getRMax1()), - theCons->getRMin2(), - std::abs(theCons->getRMax2()), - std::abs(theCons->getDZ()), - theCons->getSPhi(), - theCons->getDPhi()); - } - // - // GeoPara - // - else if(geoShape->typeID() == GeoPara::getClassTypeID()) - { - const GeoPara* thePara = dynamic_cast<const GeoPara*>(geoShape); - if (nullptr==thePara) throw std::runtime_error("TypeID did not match cast for para"); - if (n.empty()) n="G4Para"; - if (thePara->getXHalfLength()<=0.){ ATH_MSG_WARNING("Para " << n << " has an x side of " << thePara->getXHalfLength() <<" - using std::abs.");} - if (thePara->getYHalfLength()<=0.){ ATH_MSG_WARNING("Para " << n << " has an y side of " << thePara->getYHalfLength() <<" - using std::abs.");} - if (thePara->getZHalfLength()<=0.){ ATH_MSG_WARNING("Para " << n << " has an z side of " << thePara->getZHalfLength() <<" - using std::abs.");} - theSolid = new G4Para(n, - std::abs(thePara->getXHalfLength()), - std::abs(thePara->getYHalfLength()), - std::abs(thePara->getZHalfLength()), - thePara->getAlpha(), - thePara->getTheta(), - thePara->getPhi()); - } - // - // GeoPgon - // - else if(geoShape->typeID() == GeoPgon::getClassTypeID()) - { - const GeoPgon* thePgon = dynamic_cast<const GeoPgon*>(geoShape); - if (nullptr==thePgon) throw std::runtime_error("TypeID did not match cast for pgon"); - if (n.empty()) n="G4Polyhedra"; - nPlanes = static_cast<int>(thePgon->getNPlanes()); - zPlane = new double[nPlanes]; - rInner = new double[nPlanes]; - rOuter = new double[nPlanes]; - double alpha = thePgon->getDPhi()/(2*thePgon->getNSides()); // 1/2 openning angle - for (unsigned int index=0; index<static_cast<unsigned int>(nPlanes); index++) - { - zPlane[index] = thePgon->getZPlane(index); - rInner[index] = thePgon->getRMinPlane(index)*cos(alpha); - rOuter[index] = thePgon->getRMaxPlane(index)*cos(alpha); - if (rInner[index]<0.){ ATH_MSG_WARNING("Pgon " << n << " has an inner radius of " << rInner[index] << " for slice " << index << " of " << nPlanes);} - if (rOuter[index]<=0.){ - ATH_MSG_WARNING("Pgon " << n << " has an outer radius of " << rOuter[index] << " for slice " << index << " of " << nPlanes << " - using std::abs."); - rOuter[index] = std::abs(rOuter[index]); - } - } - - theSolid = new G4Polyhedra(n, - thePgon->getSPhi(), - thePgon->getDPhi(), - thePgon->getNSides(), - nPlanes, - zPlane, - rInner, - rOuter); - } - // - // GeoTrap - // - else if(geoShape->typeID() == GeoTrap::getClassTypeID()) - { - const GeoTrap* theTrap = dynamic_cast<const GeoTrap*>(geoShape); - if (nullptr==theTrap) throw std::runtime_error("TypeID did not match cast for trap"); - if (n.empty()) n="G4Trap"; - if (theTrap->getZHalfLength()<=0.){ ATH_MSG_WARNING("Trap " << n << " has an z side of " << theTrap->getZHalfLength() <<" - using std::abs.");} - theSolid = new G4Trap(n, - std::abs(theTrap->getZHalfLength()), - theTrap->getTheta(), - theTrap->getPhi(), - theTrap->getDydzn(), - theTrap->getDxdyndzn(), - theTrap->getDxdypdzn(), - theTrap->getAngleydzn(), - theTrap->getDydzp(), - theTrap->getDxdyndzp(), - theTrap->getDxdypdzp(), - theTrap->getAngleydzp()); - } - // - // Simple Polygon Brep - // - else if(geoShape->typeID() == GeoSimplePolygonBrep::getClassTypeID()) - { - const GeoSimplePolygonBrep* theBrep = dynamic_cast<const GeoSimplePolygonBrep*>(geoShape); - if (nullptr==theBrep) throw std::runtime_error("TypeID did not match cast for brep"); - if (n.empty()) n="G4ExtrudedSolid"; - double dz = theBrep->getDZ(); - int nVertices = theBrep->getNVertices(); - - G4TwoVector off(0,0); - std::vector<G4TwoVector> polygon; - - for(int i=0; i<nVertices; i++) - polygon.push_back(G4TwoVector(theBrep->getXVertex(nVertices-1-i),theBrep->getYVertex(nVertices-1-i))); - - theSolid = new G4ExtrudedSolid(n,polygon,dz,off,1,off,1); - } - // - // Tessellated Solid - // - else if(geoShape->typeID() == GeoTessellatedSolid::getClassTypeID()) - { - const GeoTessellatedSolid* theTessellated = dynamic_cast<const GeoTessellatedSolid*>(geoShape); - if (nullptr==theTessellated) throw std::runtime_error("TypeID did not match cast for tessellated solid"); - if(n.empty()) n="G4TessellatedSolid"; - - G4TessellatedSolid* g4Tessellated = new G4TessellatedSolid(n); - for(size_t i=0; i<theTessellated->getNumberOfFacets(); ++i) { - GeoFacet* geoFacet = theTessellated->getFacet(i); - G4FacetVertexType vertexType = (geoFacet->getVertexType()==GeoFacet::ABSOLUTE? ABSOLUTE : RELATIVE); - G4VFacet* g4Facet(nullptr); - if(geoFacet->getNumberOfVertices()==3) - g4Facet = new G4TriangularFacet(Amg::EigenToHep3Vector(geoFacet->getVertex(0)), - Amg::EigenToHep3Vector(geoFacet->getVertex(1)), - Amg::EigenToHep3Vector(geoFacet->getVertex(2)), - vertexType); - else - g4Facet = new G4QuadrangularFacet(Amg::EigenToHep3Vector(geoFacet->getVertex(0)), - Amg::EigenToHep3Vector(geoFacet->getVertex(1)), - Amg::EigenToHep3Vector(geoFacet->getVertex(2)), - Amg::EigenToHep3Vector(geoFacet->getVertex(3)), - vertexType); - - g4Tessellated->AddFacet(g4Facet); - } - g4Tessellated->SetSolidClosed(true); - theSolid = g4Tessellated; - } - // - // Elliptical Tube - // - else if(geoShape->typeID() == GeoEllipticalTube::getClassTypeID()) - { - const GeoEllipticalTube* theEltube = dynamic_cast<const GeoEllipticalTube*>(geoShape); - if (nullptr==theEltube) throw std::runtime_error("TypeID did not match cast for elliptical tube"); - if (n.empty()) n="G4EllipticalTube"; - - if (theEltube->getXHalfLength()<=0.){ ATH_MSG_WARNING("Eltube " << n << " has an x side of " << theEltube->getXHalfLength() <<" - using std::abs.");} - if (theEltube->getYHalfLength()<=0.){ ATH_MSG_WARNING("Eltube " << n << " has an y side of " << theEltube->getYHalfLength() <<" - using std::abs.");} - if (theEltube->getZHalfLength()<=0.){ ATH_MSG_WARNING("Eltube " << n << " has an z side of " << theEltube->getZHalfLength() <<" - using std::abs.");} - G4EllipticalTube* g4Eltube = new G4EllipticalTube(n - ,std::abs(theEltube->getXHalfLength()) - ,std::abs(theEltube->getYHalfLength()) - ,std::abs(theEltube->getZHalfLength())); - theSolid = g4Eltube; - } - // - // Torus - // - else if(geoShape->typeID() == GeoTorus::getClassTypeID() ) { - const GeoTorus* theTorus = dynamic_cast<const GeoTorus*> (geoShape); - if (nullptr==theTorus) throw std::runtime_error("TypeID did not match cast for torus"); - if (n.empty()) n="G4Torus"; - - theSolid = new G4Torus(n, - theTorus->getRMin(), - theTorus->getRMax(), - theTorus->getRTor(), - theTorus->getSPhi(), - theTorus->getDPhi()); - } - // - // Generic Trap - // - else if(geoShape->typeID() == GeoGenericTrap::getClassTypeID()) { - const GeoGenericTrap* theGenTrap = dynamic_cast<const GeoGenericTrap*>(geoShape); - if (nullptr==theGenTrap) throw std::runtime_error("TypeID did not match cast for generic trap"); - if (n.empty()) n="G4GenericTrap"; - if (theGenTrap->getZHalfLength()<=0.){ ATH_MSG_WARNING("GenTrap " << n << " has an z side of " << theGenTrap->getZHalfLength() <<" - using std::abs.");} - - // Translate vector of vertices from Eigen to CLHEP - std::vector<CLHEP::Hep2Vector> clhepVertices; - clhepVertices.reserve(theGenTrap->getVertices().size()); - for(const GeoTrf::Vector2D& geoVertex : theGenTrap->getVertices()) { - clhepVertices.push_back(CLHEP::Hep2Vector(geoVertex.x(),geoVertex.y())); - } - - G4GenericTrap* g4GenTrap = new G4GenericTrap(n - ,std::abs(theGenTrap->getZHalfLength()) - ,clhepVertices); - theSolid = g4GenTrap; - } - // - // Boolean volumes - // We make use of G4DisplacedSolid which is not documented in the manual but makes the implementation - // a lot simpler. - // - // GeoShapeShift - // - else if (geoShape->typeID() == GeoShapeShift::getClassTypeID() ) - { - const GeoShapeShift* theShapeShift = dynamic_cast<const GeoShapeShift*> (geoShape); - if (nullptr==theShapeShift) throw std::runtime_error("TypeID did not match cast for shape shift"); - if (n.empty()) n="DisplacedSolid"; - G4VSolid * undisplacedSolid = Build(theShapeShift->getOp()); - theSolid = new G4DisplacedSolid(n, undisplacedSolid, Amg::EigenTransformToCLHEP(theShapeShift->getX())); - } - // - // GeoShapeUnion - // - else if (geoShape->typeID() == GeoShapeUnion::getClassTypeID() ) - { - const GeoShapeUnion* theUnion = dynamic_cast<const GeoShapeUnion*> (geoShape); - if (nullptr==theUnion) throw std::runtime_error("TypeID did not match cast for union"); - if (n.empty()) n="Union"; - solidA = Build(theUnion->getOpA()); - solidB = Build(theUnion->getOpB()); - theSolid = new G4UnionSolid(n, solidA, solidB); - } - // - // GeoShapeIntersection - // - else if (geoShape->typeID() == GeoShapeIntersection::getClassTypeID() ) - { - const GeoShapeIntersection* theIntersection = dynamic_cast<const GeoShapeIntersection*>(geoShape); - if (nullptr==theIntersection) throw std::runtime_error("TypeID did not match cast for intersection"); - if (n.empty()) n="Intersection"; - solidA = Build(theIntersection->getOpA()); - solidB = Build(theIntersection->getOpB()); - theSolid = new G4IntersectionSolid(n, solidA, solidB); - } - // - // GeoShapeSubtraction - // - else if (geoShape->typeID() == GeoShapeSubtraction::getClassTypeID() ) - { - const GeoShapeSubtraction* theSubtraction = dynamic_cast<const GeoShapeSubtraction*>(geoShape); - if (nullptr==theSubtraction) throw std::runtime_error("TypeID did not match cast for subtraction"); - if (n.empty()) n="Subtraction"; - solidA = Build(theSubtraction->getOpA()); - solidB = Build(theSubtraction->getOpB()); - theSolid = new G4SubtractionSolid(n, solidA, solidB); - } - // - // Custom Shapes (presently LAr shapes only) - // - else if(geoShape->typeID() == LArCustomShape::getClassTypeID()) - { - const LArCustomShape* customShape = dynamic_cast<const LArCustomShape*> (geoShape); - if (nullptr==customShape) throw std::runtime_error("TypeID did not match cast for custom shape"); - std::string customName = customShape->name(); - customSolidMap::const_iterator it = customSolids.find(customName); - if(it!=customSolids.end()) - theSolid = it->second; - else - { - theSolid = nullptr; -// if(customName == "LAr::EMEC::InnerWheel::Absorber" || customName == "LAr::EMEC::Pos::InnerWheel::Absorber"){ -// theSolid = new LArWheelSolid(customName, InnerAbsorberWheel, 1); -// } else if(customName == "LAr::EMEC::OuterWheel::Absorber" || customName == "LAr::EMEC::Pos::OuterWheel::Absorber"){ -// theSolid = new LArWheelSolid(customName, OuterAbsorberWheel, 1); -// } else if(customName == "LAr::EMEC::InnerWheel::Electrode" || customName == "LAr::EMEC::Pos::InnerWheel::Electrode"){ -// theSolid = new LArWheelSolid(customName, InnerElectrodWheel, 1); -// } else if(customName == "LAr::EMEC::OuterWheel::Electrode" || customName == "LAr::EMEC::Pos::OuterWheel::Electrode"){ -// theSolid = new LArWheelSolid(customName, OuterElectrodWheel, 1); -// } else if(customName == "LAr::EMEC::Neg::InnerWheel::Absorber"){ -// theSolid = new LArWheelSolid(customName, InnerAbsorberWheel, -1); -// } else if(customName == "LAr::EMEC::Neg::OuterWheel::Absorber"){ -// theSolid = new LArWheelSolid(customName, OuterAbsorberWheel, -1); -// } else if(customName == "LAr::EMEC::Neg::InnerWheel::Electrode"){ -// theSolid = new LArWheelSolid(customName, InnerElectrodWheel, -1); -// } else if(customName == "LAr::EMEC::Neg::OuterWheel::Electrode"){ -// theSolid = new LArWheelSolid(customName, OuterElectrodWheel, -1); -// } else if(customName == "LAr::EMEC::InnerModule::Absorber"){ -// theSolid = new LArWheelSolid(customName, InnerAbsorberModule, 1); -// } else if(customName == "LAr::EMEC::OuterModule::Absorber"){ -// theSolid = new LArWheelSolid(customName, OuterAbsorberModule, 1); -// } else if(customName == "LAr::EMEC::InnerModule::Electrode"){ -// theSolid = new LArWheelSolid(customName, InnerElectrodModule, 1); -// } else if(customName == "LAr::EMEC::OuterModule::Electrode"){ -// theSolid = new LArWheelSolid(customName, OuterElectrodModule, 1); -// } else if(customName == "LAr::EMEC::InnerWheel::Glue" || customName == "LAr::EMEC::Pos::InnerWheel::Glue"){ -// theSolid = new LArWheelSolid(customName, InnerGlueWheel, 1); -// } else if(customName == "LAr::EMEC::InnerWheel::Lead" || customName == "LAr::EMEC::Pos::InnerWheel::Lead"){ -// theSolid = new LArWheelSolid(customName, InnerLeadWheel, 1); -// } else if(customName == "LAr::EMEC::OuterWheel::Glue" || customName == "LAr::EMEC::Pos::OuterWheel::Glue"){ -// theSolid = new LArWheelSolid(customName, OuterGlueWheel, 1); -// } else if(customName == "LAr::EMEC::OuterWheel::Lead" || customName == "LAr::EMEC::Pos::OuterWheel::Lead"){ -// theSolid = new LArWheelSolid(customName, OuterLeadWheel, 1); -// } else if(customName == "LAr::EMEC::Neg::InnerWheel::Glue"){ -// theSolid = new LArWheelSolid(customName, InnerGlueWheel, -1); -// } else if(customName == "LAr::EMEC::Neg::InnerWheel::Lead"){ -// theSolid = new LArWheelSolid(customName, InnerLeadWheel, -1); -// } else if(customName == "LAr::EMEC::Neg::OuterWheel::Glue"){ -// theSolid = new LArWheelSolid(customName, OuterGlueWheel, -1); -// } else if(customName == "LAr::EMEC::Neg::OuterWheel::Lead"){ -// theSolid = new LArWheelSolid(customName, OuterLeadWheel, -1); -// } - - theSolid = createLArWheelSolid(customName, s_lwsTypes.at(customName) ); // map.at throws std::out_of_range exception on unknown shape name - if ( nullptr == theSolid ) { - std::string error = std::string("Can't create LArWheelSolid for name ") + customName + " in Geo2G4SolidFactory::Build"; - throw std::runtime_error(error); - } - - if(theSolid != nullptr) customSolids[customName] = theSolid; - } - } - // - // Catch All - // - else - { - ATH_MSG_FATAL("Sorry this solid is not yet implemented... "); - ATH_MSG_FATAL(geoShape->type()); - ATH_MSG_FATAL("You will have a core dump..."); - return nullptr; - } - - sharedShapes[geoShape] = theSolid; - return theSolid; -} - -G4VSolid* Geo2G4SolidFactory::createLArWheelSolid(const std::string& name, const LArWheelSolidDef_t & lwsdef) const { // LArWheelSolid_t wheelType, int zside - LArWheelSolid_t wheelType = lwsdef.first; - int zside = lwsdef.second; - - LArWheelSolid * theLWS = new LArWheelSolid(name, wheelType, zside); - - LArWheelSolidDDProxy * theLWS_p = new LArWheelSolidDDProxy(theLWS); - // ownership is passed to detStore - if ( detStore()->record(theLWS_p, name).isFailure() ) { - ATH_MSG_WARNING("Can't store proxy for LArWheelSolid to the DetectorStore"); - delete theLWS_p; - } - return theLWS; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SolidFactory.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SolidFactory.h deleted file mode 100644 index c91303d0f..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SolidFactory.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4SolidFactory_h -#define GEO2G4_Geo2G4SolidFactory_h - -#include <map> -#include <string> - -#include "GaudiKernel/ServiceHandle.h" -//#include "GaudiKernel/StatusCode.h" - -#include "AthenaKernel/MsgStreamMember.h" -#include "StoreGate/StoreGateSvc.h" -#include "LArWheelSolid_type.h" - -class G4VSolid; -class GeoShape; - -class Geo2G4SolidFactory -{ -public: - typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t; - typedef std::pair<LArWheelSolid_t, int> LArWheelSolidDef_t; - typedef std::map<std::string, LArWheelSolidDef_t> LArWheelSolid_typemap; - - Geo2G4SolidFactory(); - G4VSolid* Build(const GeoShape*, std::string name=std::string("")) const; - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - - /** @brief The standard @c StoreGateSvc/DetectorStore - * Returns (kind of) a pointer to the @c StoreGateSvc - */ - StoreGateSvc_t& detStore() const; -private: - G4VSolid* createLArWheelSolid(const std::string& name, const LArWheelSolidDef_t & lwsdef) const; - - static const LArWheelSolid_typemap s_lwsTypes; - - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; - /// Pointer to StoreGate (detector store by default) - mutable StoreGateSvc_t m_detStore; -}; - -inline ServiceHandle<StoreGateSvc>& Geo2G4SolidFactory::detStore() const { - return m_detStore; -} - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Svc.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Svc.cxx deleted file mode 100644 index e41fb09c6..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Svc.cxx +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "Geo2G4Svc.h" -#include "VolumeBuilder.h" - -void InitializeBuilders(); - -Geo2G4Svc::Geo2G4Svc(const std::string& name, ISvcLocator* svcLocator) - : base_class(name,svcLocator) - , m_defaultBuilder(nullptr) - , m_getTopTransform(true) -{ - ATH_MSG_VERBOSE ("Creating the Geo2G4Svc."); - declareProperty("GetTopTransform", m_getTopTransform); -} -Geo2G4Svc::~Geo2G4Svc() -{;} - -StatusCode Geo2G4Svc::initialize() -{ - static int initialized=0; - if (initialized) - { - ATH_MSG_VERBOSE (" Geo2G4Svc already initialized."); - return StatusCode::SUCCESS; - } - ATH_MSG_VERBOSE ("Initializing the Geo2G4Svc."); - ATH_MSG_VERBOSE ("Creating all builders available."); - InitializeBuilders(); // separate function not part of this class - - const std::string nameBuilder = "Extended_Parameterised_Volume_Builder"; //TODO Configurable property?? - this->SetDefaultBuilder(nameBuilder); - ATH_MSG_VERBOSE (nameBuilder << " --> set as default builder" ); - ATH_MSG_VERBOSE (nameBuilder << " --> ParamOn flag = " << m_defaultBuilder->GetParam()); - initialized=1; - if(msgLvl(MSG::VERBOSE)) - { - this->ListVolumeBuilders(); - } - return StatusCode::SUCCESS; -} - -StatusCode Geo2G4Svc::finalize() -{ - ATH_MSG_VERBOSE ("Finalizing the Geo2G4Svc."); - - return StatusCode::SUCCESS; -} - -void Geo2G4Svc::handle(const Incident& ) -{ -} - -void Geo2G4Svc::RegisterVolumeBuilder(VolumeBuilder* vb) -{ - std::string key(vb->GetKey()); - if (m_builders.find(key)!=m_builders.end()) - { - ATH_MSG_DEBUG ("Trying to set an already existing builder "<<key); - ATH_MSG_DEBUG ("\t request ignored, nothing done "); - } - else - { - m_builders[key]=vb; - ATH_MSG_DEBUG ("Volume builder registered "<<key); - } -} - -void Geo2G4Svc::ListVolumeBuilders() const -{ - ATH_MSG_INFO("---- List of all Volume Builders registered with Geo2G4Svc ----"); - ATH_MSG_INFO("---------------------------------------------------------------"); - for (const auto& builder : m_builders) - { - ATH_MSG_INFO(" Volume Builder: "<<builder.second->GetKey()); - } - ATH_MSG_INFO("---------------------------------------------------------------"); - ATH_MSG_INFO(" default builder is "<<m_defaultBuilder->GetKey()); -} - -void Geo2G4Svc::UnregisterVolumeBuilder(VolumeBuilder* vb) -{ - const std::string key(vb->GetKey()); - if (m_builders.find(key)!=m_builders.end()) - { - ATH_MSG_DEBUG ("Removing builder "<<key<<" from the list"); - m_builders.erase(key); - } - else - { - ATH_MSG_ERROR ("Trying to remove a not-existing builder "<<key); - ATH_MSG_ERROR ("\t request ignored, nothing done "); - } -} - -VolumeBuilder* Geo2G4Svc::GetVolumeBuilder(std::string s) const -{ - const auto builderItr(m_builders.find(s)); - if (builderItr!=m_builders.end()) - { - return builderItr->second; - } - else - { - ATH_MSG_ERROR ("Trying to retrieve a not existing builder "<<s); - ATH_MSG_ERROR ("\treturning Default Builder"); - } - return m_defaultBuilder; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Svc.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Svc.h deleted file mode 100644 index 93f8db6ff..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4Svc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4Svc_H -#define GEO2G4_Geo2G4Svc_H - -#include "G4AtlasInterfaces/IGeo2G4Svc.h" - -#include "AthenaBaseComps/AthService.h" -#include "GaudiKernel/IIncidentListener.h" - -#include <string> -#include <map> - -class VolumeBuilder; -typedef std::map< std::string, VolumeBuilder*,std::less<std::string> > BuilderMap; - -/// @todo NEEDS DOCUMENTATION -class Geo2G4Svc: public extends<AthService, IGeo2G4Svc, IIncidentListener> -{ -public: - Geo2G4Svc(const std::string& , ISvcLocator *); - virtual ~Geo2G4Svc(); - /// AthService methods - virtual StatusCode initialize() override final; - virtual StatusCode finalize() override final; - /// IIncidentListener methods - FIXME does this service actually need to listen for Incidents? - virtual void handle(const Incident&) override final; - /// Geo2G4SvcBase methods - virtual void RegisterVolumeBuilder(VolumeBuilder* vb) override final; - virtual void UnregisterVolumeBuilder(VolumeBuilder* vb) override final; - virtual void SetDefaultBuilder(VolumeBuilder *vb) override final {m_defaultBuilder=vb;} - virtual void SetDefaultBuilder(std::string n) override final {this->SetDefaultBuilder(this->GetVolumeBuilder(n));} - virtual VolumeBuilder* GetVolumeBuilder(std::string s) const override final; - virtual VolumeBuilder* GetDefaultBuilder() const override final {return m_defaultBuilder;} - virtual bool UseTopTransforms() const override final {return m_getTopTransform;} - virtual void ListVolumeBuilders() const override final; -private: - VolumeBuilder *m_defaultBuilder; - BuilderMap m_builders ; - bool m_getTopTransform; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SvcAccessor.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SvcAccessor.h deleted file mode 100644 index 70a5956a6..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/Geo2G4SvcAccessor.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_Geo2G4SvcAccessor_H -#define GEO2G4_Geo2G4SvcAccessor_H - -#include "G4AtlasInterfaces/Geo2G4SvcBase.h" -#include "G4AtlasInterfaces/IGeo2G4Svc.h" - -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/Bootstrap.h" - -class Geo2G4SvcAccessor { -public: - Geo2G4SvcBase* GetGeo2G4Svc() const; -}; - -inline Geo2G4SvcBase* Geo2G4SvcAccessor::GetGeo2G4Svc() const -{ - IService* g2gSvc; - ISvcLocator* svcLocator = Gaudi::svcLocator(); // from Bootstrap - StatusCode result = svcLocator->service("Geo2G4Svc",g2gSvc); - - if(result.isSuccess()) - { - Geo2G4SvcBase* temp=dynamic_cast<Geo2G4SvcBase*>(g2gSvc); - return temp; - } - else - return 0; -} - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GeoDetectorTool.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GeoDetectorTool.cxx deleted file mode 100644 index 7f24abfaf..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GeoDetectorTool.cxx +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// Base class -#include "G4AtlasTools/DetectorGeometryBase.h" -#include "GeoDetectorTool.h" -#include "Geo2G4SvcAccessor.h" -#include "G4AtlasInterfaces/Geo2G4SvcBase.h" -#include "Geo2G4Builder.h" -#include "VolumeBuilder.h" - -#include "G4NistManager.hh" -#include "G4LogicalVolume.hh" -#include "G4PVPlacement.hh" -#include "G4GDMLParser.hh" - -// Geant4 includes used in functions - -GeoDetectorTool::GeoDetectorTool(const std::string& type, const std::string& name, const IInterface* parent) - : DetectorGeometryBase(type,name,parent),m_blParamOn(false),m_blGetTopTransform(true),m_geoDetectorName("") -{ - m_topTransform.setIdentity(); - ATH_MSG_DEBUG( "GeoDetectorTool constructor for " << name ); - declareProperty("GeoDetectorName",m_geoDetectorName, "Name of the detector in GeoModel, if different from G4."); - declareProperty("GDMLFileOut",m_dumpGDMLFile,"File name where the GDML description for the detector will be dumped."); - . -} - -StatusCode GeoDetectorTool::initialize() -{ - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::initialize(): Starting" ); - if(m_detectorName.empty()) - { - m_detectorName = this->name(); - // re-initialize m_detectorName in order to take the real detector name rather than the path to it - size_t ipos=m_detectorName.find_last_of("."); - size_t length=m_detectorName.size(); - if (ipos<length) - { - ATH_MSG_VERBOSE( "m_detectorName: " << m_detectorName << " needs to be reset."); - m_detectorName=m_detectorName.substr(ipos+1,length-ipos-1); - ATH_MSG_VERBOSE( "m_detectorName default value reset to " << m_detectorName); - } - } - ATH_MSG_DEBUG( name() << "GeoDetectorTool::initialize() : Detector name = " << m_detectorName ); - if(m_geoDetectorName.empty()) - { - m_geoDetectorName = m_detectorName; - } - ATH_MSG_DEBUG( name() << "GeoDetectorTool::initialize() : Geo Detector name = " << m_geoDetectorName ); - - Geo2G4SvcAccessor accessor; - Geo2G4SvcBase *g=accessor.GetGeo2G4Svc(); - m_builderName=g->GetDefaultBuilder()->GetKey(); - m_blGetTopTransform = g->UseTopTransforms(); - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::initialize(): Finished" ); - return StatusCode::SUCCESS; -} - - -void GeoDetectorTool::BuildGeometry() -{ - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::BuildGeometry(): Starting" ); - G4LogicalVolume* temp = this->Convert(); - m_envelope.theEnvelope=temp; - - if (this->IsTopTransform()) - { - this->SetInitialTransformation(); - } - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::BuildGeometry(): Finished" ); -} - -void GeoDetectorTool::PositionInParent() -{ - ATH_MSG_DEBUG( name() << " GeoDetectorTool::PositionInParent(): Starting" ); - - DetectorGeometryBase::PositionInParent(); - if (!m_dumpGDMLFile.empty()) { - G4GDMLParser parser; - parser.Write(m_dumpGDMLFile,m_envelope.thePositionedVolume); - } -} - -G4LogicalVolume* GeoDetectorTool::Convert() -{ - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::Convert(): Starting" ); - ATH_MSG_DEBUG( name() << " GeoDetectorTool::Convert(): GeoDetectorName:builderName = "<<m_geoDetectorName<<":"<<m_builderName); - Geo2G4Builder Builder(m_geoDetectorName); - VolumeBuilder *b=Builder.GetVolumeBuilder(m_builderName); - b->SetParam(m_blParamOn); - G4LogicalVolume *temp=Builder.BuildTree(); - if(this->IsTopTransform()) - { - m_topTransform = Builder.GetDetectorTransform(); - } - - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::Convert(): Finished" ); - return temp; -} - -bool GeoDetectorTool::IsTopTransform() -{ - return m_blGetTopTransform; -} - -void GeoDetectorTool::SetInitialTransformation() -{ - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::SetInitialTransformation(): Starting" ); - if (!m_envelope.theRotation) - { - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::SetInitialTransformation(): Creating new G4RotationMatrix" ); - m_envelope.theRotation=new G4RotationMatrix; - } - *(m_envelope.theRotation)=m_topTransform.getRotation().inverse(); - m_envelope.thePosition=m_topTransform.getTranslation(); - ATH_MSG_VERBOSE( name() << " GeoDetectorTool::SetInitialTransformation(): Finished" ); -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GeoDetectorTool.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GeoDetectorTool.h deleted file mode 100644 index 5bb4985d9..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/GeoDetectorTool.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_GeoDetectorTool_H -#define GEO2G4_GeoDetectorTool_H - -// Base classes -#include "G4AtlasTools/DetectorGeometryBase.h" -#include "G4AtlasInterfaces/IDetectorGeometrySvc.h" - -#include "G4Transform3D.hh" - -// Members - -// STL library -#include <string> -#include <vector> - -/** @class GeoDetectorTool GeoDetectorTool.h "G4AtlasTools/GeoDetectorTool.h" -* -* Tool for building detectors out of a GeoModel description. Basically a -* carbon copy of GeoDetectorFacility in GeoDetectorPlugins which is supposed -* to replace. -* -* @author Andrea Dell'Acqua -* @date 2015-03-10 -*/ - -class GeoDetectorTool final : public DetectorGeometryBase -{ -public: - // Basic constructor and destructor - GeoDetectorTool(const std::string& type, const std::string& name, const IInterface *parent); - ~GeoDetectorTool() {} - - /** Athena method. called at initialization time, being customized here */ - virtual StatusCode initialize() override final; - - /** virtual methods being implemented here */ - - virtual void BuildGeometry() override final; - - virtual void PositionInParent() override final; - -private: - - std::string m_builderName; - std::string m_dumpGDMLFile=""; - bool m_blParamOn; - bool m_blGetTopTransform; - G4Transform3D m_topTransform; - std::string m_geoDetectorName; - G4LogicalVolume* Convert(); - bool IsTopTransform(); - void SetInitialTransformation(); - -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/InitializeBuilders.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/InitializeBuilders.cxx deleted file mode 100644 index 57770d6c4..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/InitializeBuilders.cxx +++ /dev/null @@ -1,10 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "ExtParameterisedVolumeBuilder.h" - -void InitializeBuilders() -{ - ExtParameterisedVolumeBuilder *epb __attribute__ ((unused)) = new ExtParameterisedVolumeBuilder("Extended_Parameterised_Volume_Builder"); -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArFanSection.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArFanSection.cxx deleted file mode 100644 index 8582d3f53..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArFanSection.cxx +++ /dev/null @@ -1,265 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "LArWheelSolid.h" -#include "LArFanSection.h" -#include "GeoSpecialShapes/LArWheelCalculator.h" -#include<iostream> - - -void LArFanSections::print(void) const -{ - std::cout << "LArFanSections at " << this << std::endl - << "Amin = " << Amin << ", Amax = " << Amax - << std::endl - << "Bmin = " << Bmin << ", Bmax = " << Bmax << std::endl - << "xmin = " << xmin << ", xmax = " << xmax - << "Cflat2 = " << Cflat2 << std::endl; -} - -LArFanSections::LArFanSections( - G4double ri1, G4double ri2, G4double ro1, G4double ro2, - G4double Xmax, G4double z1, G4double z2 -) -{ - const G4double dz = z2 - z1; - Amin = (ri2 - ri1) / dz; - Amax = (ro2 - ro1) / dz; - Bmin = ri1 - Amin * z1; - Bmax = ro1 - Amax * z1; - Cflat2 = ro2*ro2; - - Amin2 = Amin*Amin; Amax2 = Amax*Amax; - Bmin2 = Bmin*Bmin; Bmax2 = Bmax*Bmax; - ABmin = Amin*Bmin; ABmax = Amax*Bmax; - - xmax = Xmax; - xmin = -xmax; -} - -G4bool LArWheelSolid::check_D( - G4double &t1, G4double A, G4double B, G4double C, G4bool out -) const -{ - // G4bool out is to be set true if the point is surface-outside - // then have to discard first intersection - - const G4double D = B*B - A*C; - LWSDBG(8, std::cout << "check D=" << D << " out=" << out << std::endl); - if(D < 0.) return false; - - const G4double D1 = sqrt(D); - t1 = (-B + D1) / A; - const G4double t2 = (-B - D1) / A; - LWSDBG(8, std::cout << "t1=" << t1 << " t2=" << t2 << std::endl); - if(t1 > 0.){ - if(t2 > 0.){ - if(out){ - if(t2 > t1) t1 = t2; - } else { - if(t2 < t1) t1 = t2; - } - } else if(t2 < 0.){ - if(out) return false; - } else { // answer is t1 - } - } else if(t1 < 0.){ - if(t2 > 0.){ - if(out) return false; - t1 = t2; - } else if(t2 < 0.){ - return false; - } else { - return false; - } - } else { - if(t2 > 0.){ - t1 = t2; - } else if(t2 < 0.){ - return false; - } else { - return false; - } - } - return true; -} - -// p must be not outside of the "FanBound" -// if track crosses inner cone in valid (z, x) interval, -// returns true, sets q to the cross point -bool LArWheelSolid::fs_cross_lower( - const G4ThreeVector &p, const G4ThreeVector &v, - G4ThreeVector &q) const -{ - LWSDBG(7, std::cout << "fcl" << std::endl); - const G4double A = v.perp2() - m_fs->Amin2*v.z()*v.z(); - const G4double B = p.x()*v.x() + p.y()*v.y() - - m_fs->Amin2*p.z()*v.z() - m_fs->ABmin*v.z(); - const G4double C = p.perp2() - m_fs->Amin2*p.z()*p.z() - - 2.*m_fs->ABmin*p.z() - m_fs->Bmin2; - G4double t1(0.0); - const G4double out_dist = m_fs->Amin*p.z() + m_fs->Bmin - p.perp(); - LWSDBG(8, std::cout << "fcl out_dist(p)=" << out_dist << " Tolerance=" << s_Tolerance << std::endl); - const G4bool out = out_dist >= 0.0; - if(check_D(t1, A, B, C, out)){ - const G4double zz1 = p.z() + v.z() * t1; - if(zz1 < m_Zsect.front() || zz1 > m_Zsect.back()){ - LWSDBG(8, std::cout << "fcl out on Z " << zz1 << std::endl); - return false; - } - const G4double xx1 = p.x() + v.x() * t1; - if(xx1 < m_fs->xmin || xx1 > m_fs->xmax){ - LWSDBG(8, std::cout << "fcl out on X " << xx1 << std::endl); - return false; - } - if(out_dist == 0.){ // entry point is exactly on the cone - // here we got t1 > 0 from check_D, founded point seems to be in x and z ranges - // if the track leaves the surface, then the entry is the intersection, - // and the distance is 0 - // if the track is on the surface, then there is no lower cone intersection - - // estimate deviation of the track from the surface - // (exact calculations are too complicated) - const G4double xx2 = p.x() + v.x() * t1 * 0.5; - const G4double yy2 = p.y() + v.y() * t1 * 0.5; - const G4double dev = fabs(sqrt(xx2 *xx2 + yy2*yy2) - - m_fs->Amin*(p.z() + zz1)*0.5 - - m_fs->Bmin); - if(dev < s_Tolerance){ - LWSDBG(8, std::cout << "fcl on the surface" << std::endl); - return false; - } else { - LWSDBG(8, std::cout << "fcl out = in" << std::endl); - q = p; - return true; - } - } - q.setX(xx1); - q.setY(p.y() + v.y() * t1); - q.setZ(zz1); - LWSDBG(8, std::cout << "fcl got " << t1 << std::endl); - return true; - } - LWSDBG(8, std::cout << "fcl no intersection" << std::endl); - return false; -} - -// p must be not outside of the "FanBound" -// if track crosses outer cone in valid (z, x) interval, -// returns true, adds to b the distance to the cross point, -// sets q to the cross point -bool LArWheelSolid::fs_cross_upper( - const G4ThreeVector &p, const G4ThreeVector &v, - G4ThreeVector &q) const -{ - LWSDBG(7, std::cout << "fcu" << std::endl); - G4double A = v.perp2(); - G4double B = p.x()*v.x() + p.y()*v.y(); - G4double C = p.perp2(); - - if(m_IsOuter){ - const G4double &Af = A, &Bf = B; - const G4double Cf = C - m_fs->Cflat2; - G4double b1; - if(check_D(b1, Af, Bf, Cf, Cf >= 0.)){ - const G4double zz1 = p.z() + v.z() * b1; - if(zz1 >= m_Zmid && zz1 <= m_Zsect.back()){ - const G4double xx1 = p.x() + v.x() * b1; - if(xx1 < m_fs->xmin || xx1 > m_fs->xmax) return false; - q.setX(xx1); - q.setY(p.y() + v.y() * b1); - q.setZ(zz1); - return true; - } - } - LWSDBG(8, std::cout << "fcu no cyl intersection" << std::endl); - } - - A -= m_fs->Amax2*v.z()*v.z(); - B -= m_fs->Amax2*p.z()*v.z() + m_fs->ABmax*v.z(); - C -= m_fs->Amax2*p.z()*p.z() + 2.*m_fs->ABmax*p.z() + m_fs->Bmax2; - - G4double t1; - const G4bool out = m_fs->Amax*p.z() + m_fs->Bmax <= p.perp(); - if(check_D(t1, A, B, C, out)){ - const G4double zz1 = p.z() + v.z() * t1; - LWSDBG(8, std::cout << "fcu z = " << zz1 << ", lim: (" << m_Zsect.front() << ", " << m_Zmid << ")" << std::endl); - if(zz1 < m_Zsect.front() || zz1 > m_Zmid) return false; - const G4double xx1 = p.x() + v.x() * t1; - LWSDBG(8, std::cout << "fcu x = " << xx1 << ", lim: (" << m_fs->xmin << ", " << m_fs->xmax << ")" << std::endl); - if(xx1 < m_fs->xmin || xx1 > m_fs->xmax) return false; - q.setX(xx1); - q.setY(p.y() + v.y() * t1); - q.setZ(zz1); - return true; - } - LWSDBG(8, std::cout << "fcu no cone intersection" << std::endl); - return false; -} - -/* p must be not outside "FanBound" */ -LArWheelSolid::FanBoundExit_t LArWheelSolid::find_exit_point( - const G4ThreeVector &p, const G4ThreeVector &v, - G4ThreeVector &q) const -{ - LWSDBG(6, std::cout << "in fep p" << MSG_VECTOR(p)<< ", v"<< MSG_VECTOR(v) << ", q" << MSG_VECTOR(q) << std::endl); - -/* by construction, cannot have true from both upper and lower */ -/* the only problem is the points on surface but "slightly outside" */ -/* fs_cross_* account for (x, z) range */ -// lower has to be checked first, since outer might find more distant -// intersection in the acceptable (x, z) range - if(fs_cross_lower(p, v, q)) return ExitAtInner; - LWSDBG(6, std::cout << "after fs_cross_lower q" << MSG_VECTOR(q) << std::endl); - if(fs_cross_upper(p, v, q)) return ExitAtOuter; - LWSDBG(6, std::cout << "after fs_cross_upper q" << MSG_VECTOR(q) << std::endl); - - FanBoundExit_t result = ExitAtSide; - G4double d; - if(v.x() > 0.) d = (m_fs->xmax - p.x()) / v.x(); - else if(v.x() < 0.) d = (m_fs->xmin - p.x()) / v.x(); - else d = kInfinity; - - G4double dz; - FanBoundExit_t resultz = NoCross; - if(v.z() > 0.){ - dz = (m_Zsect.back() - p.z()) / v.z(); - resultz = ExitAtBack; - } else if(v.z() < 0.){ - dz = (m_Zsect.front() - p.z()) / v.z(); - resultz = ExitAtFront; - } else { - dz = kInfinity; - } - if(d > dz){ - d = dz; - result = resultz; - } - q = p + v * d; - LWSDBG(7, std::cout << "fep side " << d << " " << result << " q" << MSG_VECTOR(q) << std::endl); - const G4double out_distlower = m_fs->Amin*q.z() + m_fs->Bmin - q.perp(); // > 0 - below lower cone - LWSDBG(7, std::cout << "fep out_distlower(q)=" << out_distlower << " Tolerance=" << s_Tolerance << std::endl); - if (out_distlower >= 0.0) { - // side intersection point is below lower cone - // initial point p was at exit boundary - q = p; - return NoCross; - } - - if (m_IsOuter && q.z() >= m_Zmid && q.z() <= m_Zsect.back()+s_Tolerance && q.perp2() >= m_fs->Cflat2) { - // outside of upper cylinder - q = p; - return NoCross; - } - const G4double out_distupper = m_fs->Amax*q.z() + m_fs->Bmax - q.perp(); // < 0 - above upper cone - LWSDBG(7, std::cout << "fep out_distupper(q)=" << out_distupper << " Tolerance=" << s_Tolerance << std::endl); - if (out_distupper <= 0.0) { - // side intersection point is above upper cone - // initial point p was at exit boundary - q = p; - return NoCross; - } - assert((q - p).mag() < kInfinity); - return result; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArFanSection.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArFanSection.h deleted file mode 100644 index af3327c31..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArFanSection.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef __LARFANSECTION_H__ -#define __LARFANSECTION_H__ - -// helper class to replace G4Polycone -// in certain LArWheelSolid operations - -class LArFanSections -{ -public: - G4double Amin, Amax; - G4double Bmin, Bmax; - G4double Amin2, Amax2; - G4double Bmin2, Bmax2; - G4double xmin, xmax; - G4double Cflat2, ABmax, ABmin; - - LArFanSections( - G4double ri1, G4double ri2, - G4double ro1, G4double ro2, - G4double Xmax, G4double z1, G4double z2 - ); - - void print(void) const; -}; - -#endif // __LARFANSECTION_H__ diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid.cxx deleted file mode 100644 index 3fa7e28d4..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "G4VGraphicsScene.hh" -#include "G4VisExtent.hh" - -#include "GeoSpecialShapes/LArWheelCalculator.h" -#include "LArWheelSolid.h" - -class G4NURBS; -class G4VoxelLimits; -class G4AffineTransform; - -EInside LArWheelSolid::Inside(const G4ThreeVector &inputP) const -{ - LWSDBG(10, std::cout << std::setprecision(25)); - LWSDBG(1, std::cout << TypeStr() << " Inside " << MSG_VECTOR(inputP) << std::endl); - const EInside inside_BS = m_BoundingShape->Inside(inputP); - if(inside_BS == kOutside){ - LWSDBG(2, std::cout << "outside BS" << std::endl); - return kOutside; - } - G4ThreeVector p( inputP ); - int p_fan = 0; - const G4double d = fabs(GetCalculator()->DistanceToTheNearestFan(p, p_fan)); - if(d > m_FHTplusT){ - LWSDBG(2, std::cout << "outside fan d=" << d << ", m_FHTplusT=" << m_FHTplusT << std::endl); - return kOutside; - } - if(d < m_FHTminusT){ - LWSDBG(2, std::cout << "inside fan d=" << d << ", m_FHTminusT=" << m_FHTminusT << ", inside_BS=" << inside(inside_BS) << std::endl); - return inside_BS; - } - LWSDBG(2, std::cout << "surface" << std::endl); - return kSurface; -} - -G4ThreeVector LArWheelSolid::SurfaceNormal(const G4ThreeVector &inputP) const -{ - LWSDBG(1, std::cout << TypeStr() << " SurfaceNormal" << MSG_VECTOR(inputP) << std::endl); - EInside inside_BS = m_BoundingShape->Inside(inputP); - if(inside_BS != kInside){ - LWSDBG(2, std::cout << "not inside BS" << std::endl); - return m_BoundingShape->SurfaceNormal(inputP); - } - G4ThreeVector p( inputP ); - int p_fan = 0; - GetCalculator()->DistanceToTheNearestFan(p, p_fan); - G4ThreeVector d = GetCalculator()->NearestPointOnNeutralFibre(p, p_fan); - d.rotateZ(inputP.phi() - p.phi()); // rotate back to initial position - LWSDBG(4, std::cout << "npnf" << MSG_VECTOR(d) << std::endl); - p = inputP - d; - LWSDBG(2, std::cout << "sn " << MSG_VECTOR(p.unit()) << std::endl); - return(p.unit()); -} - -G4bool LArWheelSolid::CalculateExtent(const EAxis a, const G4VoxelLimits &vl, - const G4AffineTransform &t, G4double &p, - G4double &q) const -{ - return m_BoundingShape->CalculateExtent(a, vl, t, p, q); -} - -G4GeometryType LArWheelSolid::GetEntityType() const -{ - switch(m_Type){ - case InnerAbsorberWheel: - return G4String("LArInnerAbsorberWheel"); - break; - case OuterAbsorberWheel: - return G4String("LArOuterAbsorberWheel"); - break; - case InnerElectrodWheel: - return G4String("LArInnerElecrodWheel"); - break; - case OuterElectrodWheel: - return G4String("LArOuterElecrodWheel"); - break; - case InnerAbsorberModule: - return G4String("LArInnerAbsorberModule"); - break; - case OuterAbsorberModule: - return G4String("LArOuterAbsorberModule"); - break; - case InnerElectrodModule: - return G4String("LArInnerElecrodModule"); - break; - case OuterElectrodModule: - return G4String("LArOuterElecrodModule"); - break; - case InnerGlueWheel: - return G4String("LArInnerGlueWheel"); - break; - case OuterGlueWheel: - return G4String("LArOuterGlueWheel"); - break; - case InnerLeadWheel: - return G4String("LArInnerLeadWheel"); - break; - case OuterLeadWheel: - return G4String("LArOuterLeadWheel"); - break; - } - G4Exception("LArWheelSolid", "UnknownSolidType", FatalException,"GetEntityType: Unknown LArWheelType."); - return G4String(""); -} - -void LArWheelSolid::DescribeYourselfTo(G4VGraphicsScene &scene) const -{ - scene.AddSolid(*this); -} - -G4VisExtent LArWheelSolid::GetExtent() const -{ - return m_BoundingShape->GetExtent(); -} - -G4Polyhedron* LArWheelSolid::CreatePolyhedron() const -{ - return m_BoundingShape->CreatePolyhedron(); -} - -/* - * returns the number of lower z boundary of z-section containing Z - */ -G4int LArWheelSolid::select_section(const G4double &Z) const -{ - for(G4int i = m_Zsect_start_search; i > 0; -- i){ - if(Z > m_Zsect[i]) return i; - } - return 0; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid.h deleted file mode 100644 index 46c423c47..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_LARWHEELSOLID_H -#define GEO2G4_LARWHEELSOLID_H - -#include "AthenaKernel/MsgStreamMember.h" -#include "G4VSolid.hh" - -// set this to allow debug output in LArWheelSolid methods -// disabled by default to avoid any performance degradation -//#define DEBUG_LARWHEELSOLID - -// set this to use native G4 FanBound's methods for DisToIn -// instead of local calculations -//#define LARWHEELSOLID_USE_FANBOUND - -// set this to use BoundingShape's methods for DisToOut -// instead of local calculations -#define LARWHEELSOLID_USE_BS_DTO - -// change this to have more z sections -#define LARWHEELSOLID_ZSECT_MULT 1 - - -// set this to check in dti and dto functions if particle direction -// pointing inside or outside of volume to return zero fast when it is required by spec. -// currently at development stage, requires accurate surface normal calculations -//#define CHECK_DIRTONORM_ANGLE_ON_SURFACE - -#ifdef DEBUG_LARWHEELSOLID -#define LWSDBG(a, b) if(Verbose >= a) b -#define MSG_VECTOR(v) "(" << v.x() << ", " << v.y() << ", " << v.z() << ")" -//#define LWS_HARD_TEST_DTI -//#define LWS_HARD_TEST_DTO -#else -#define LWSDBG(a, b) -#endif - -// Forward declarations. -class G4VGraphicsScene; -class G4VisExtent; -class G4Polyhedron; -class G4NURBS; -class G4VoxelLimits; -class G4AffineTransform; -class G4Polycone; -class LArWheelCalculator; -class TF1; -class LArFanSections; -class G4Polyhedra; - -#include "LArWheelSolid_type.h" - -inline const char *LArWheelSolidTypeString(LArWheelSolid_t type) -{ - switch(type){ - case InnerAbsorberWheel: return("InnerAbsorberWheel"); - case OuterAbsorberWheel: return("OuterAbsorberWheel"); - case InnerElectrodWheel: return("InnerElectrodWheel"); - case OuterElectrodWheel: return("OuterElectrodWheel"); - case InnerAbsorberModule: return("InnerAbsorberModule"); - case OuterAbsorberModule: return("OuterAbsorberModule"); - case InnerElectrodModule: return("InnerElectrodModule"); - case OuterElectrodModule: return("OuterElectrodModule"); - case InnerLeadWheel: return("InnerLeadWheel"); - case OuterLeadWheel: return("OuterLeadWheel"); - case InnerGlueWheel: return("InnerGlueWheel"); - case OuterGlueWheel: return("OuterGlueWheel"); - } - return("unknown"); -} - -class LArWheelSolid : public G4VSolid -{ -public: - - LArWheelSolid(const G4String& name, LArWheelSolid_t type, G4int zside = 1); - virtual ~LArWheelSolid(); - - // Mandatory for custom solid Geant4 functions - EInside Inside(const G4ThreeVector&) const; - G4double DistanceToIn(const G4ThreeVector&, - const G4ThreeVector&) const; - G4double DistanceToIn(const G4ThreeVector&) const; - G4double DistanceToOut(const G4ThreeVector&, - const G4ThreeVector&, - const G4bool calcNorm = false, - G4bool* validNorm = 0, - G4ThreeVector* n = 0) const; - G4double DistanceToOut(const G4ThreeVector&) const; - G4ThreeVector SurfaceNormal (const G4ThreeVector&) const; - G4bool CalculateExtent(const EAxis, - const G4VoxelLimits&, - const G4AffineTransform&, - G4double&, - G4double&) const; - G4GeometryType GetEntityType() const; - void DescribeYourselfTo(G4VGraphicsScene&) const; - G4VisExtent GetExtent() const; - G4Polyhedron* CreatePolyhedron() const; - - // 07-Feb-2003 WGS: For compatibility with Geant 4.5.0 - virtual std::ostream& StreamInfo(std::ostream& os) const { return os; } - - const G4Polycone *GetBoundingPolycone(void) const { return m_BoundingPolycone; } - const LArWheelCalculator *GetCalculator(void) const { return m_Calculator; } - LArWheelSolid_t GetType(void) const { return m_Type; } - - G4ThreeVector GetPointOnSurface(void) const; - G4double GetCubicVolume(void); - G4double GetSurfaceArea(void); - -private: - static const G4double s_Tolerance; - static const G4double s_AngularTolerance; - static const G4double s_IterationPrecision; - static const G4double s_IterationPrecision2; - static const unsigned int s_IterationsLimit; - - G4bool m_IsOuter; - const LArWheelSolid_t m_Type; - LArWheelCalculator *m_Calculator; - G4double m_FanHalfThickness, m_FHTplusT, m_FHTminusT; - G4double m_FanPhiAmplitude; - G4double m_MinPhi; - G4double m_MaxPhi; - const G4double m_PhiPosition; - G4Polycone* m_BoundingPolycone; - G4VSolid* m_BoundingShape; -#ifdef LARWHEELSOLID_USE_FANBOUND - G4VSolid* m_FanBound; -#endif - - std::vector<G4double> m_Zsect; - G4int m_Zsect_start_search; - - LArFanSections *m_fs; - - // z at outer wheel "bend" - G4double m_Zmid; - // Special limit, used in dto - G4double m_Ymin; - // limits for use in service functions - G4double m_Zmin, m_Zmax, m_Rmin, m_Rmax; - //artificial level to distinguish between inner and outer cones - G4double m_Ymid; - - void inner_solid_init(const G4String &); - void outer_solid_init(const G4String &); - void set_phi_size(void); - - virtual G4double distance_to_in(G4ThreeVector &, const G4ThreeVector &, int) const; - G4double in_iteration_process(const G4ThreeVector &, - G4double, G4ThreeVector &, int) const; - G4double search_for_nearest_point( - const G4ThreeVector &, const G4double, - const G4ThreeVector &, int - ) const; - G4bool search_for_most_remoted_point(const G4ThreeVector &, - const G4ThreeVector &, - G4ThreeVector &, const int) const; - G4double out_iteration_process(const G4ThreeVector &, - G4ThreeVector &, const int) const; - - typedef enum { - NoCross, ExitAtInner, ExitAtOuter, - ExitAtFront, ExitAtBack, ExitAtSide - } FanBoundExit_t; - - FanBoundExit_t find_exit_point(const G4ThreeVector &p, - const G4ThreeVector &v, - G4ThreeVector &q) const; - G4bool fs_cross_lower(const G4ThreeVector &p, const G4ThreeVector &v, - G4ThreeVector &q) const; - G4bool fs_cross_upper(const G4ThreeVector &p, const G4ThreeVector &v, - G4ThreeVector &q) const; - G4bool check_D(G4double &b, - G4double A, G4double B, G4double C, G4bool) const; - -/* - FanBoundExit_t find_exit_point(const G4ThreeVector &p, - const G4ThreeVector &v, - EInside inside_bs, - G4ThreeVector &q) const; - G4bool fs_check_inner(const G4ThreeVector &p, const G4ThreeVector &v, - G4bool surface, G4ThreeVector &q) const; -*/ - G4int select_section(const G4double &Z) const; - - EInside Inside_accordion(const G4ThreeVector&) const; - void get_point_on_accordion_surface(G4ThreeVector &) const; - void get_point_on_polycone_surface(G4ThreeVector &) const; - void get_point_on_flat_surface(G4ThreeVector &) const; - void set_failover_point(G4ThreeVector &p, const char *m = 0) const; - - G4double get_area_on_polycone(void) const; - G4double get_area_on_face(void) const; - G4double get_area_on_side(void) const; - - G4double get_area_at_r(G4double r) const; - G4double get_length_at_r(G4double r) const; - - void test(void); - void clean_tests(void); - void init_tests(void); - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - -protected: - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; - - TF1 *m_f_area, *m_f_vol, *m_f_area_on_pc, *m_f_length, *m_f_side_area; - - double m_test_index; - friend double LArWheelSolid_fcn_area(double *, double *); - friend double LArWheelSolid_fcn_vol(double *, double *); - friend double LArWheelSolid_fcn_area_on_pc(double *, double *); - friend double LArWheelSolid_get_dl(double *, double *, G4int); - friend double LArWheelSolid_fcn_side_area(double *, double *); - -#ifdef DEBUG_LARWHEELSOLID - static const char* inside(EInside i) - { - switch(i){ - case kInside: return "inside"; break; - case kSurface: return "surface"; break; - case kOutside: return "outside"; break; - } - return "unknown"; - } - - public: - static G4int Verbose; - void SetVerbose(G4int v){ Verbose = v; } - G4bool test_dti(const G4ThreeVector &p, - const G4ThreeVector &v, const G4double distance) const; - G4bool test_dto(const G4ThreeVector &p, - const G4ThreeVector &v, const G4double distance) const; - private: - const char *TypeStr(void) const { return LArWheelSolidTypeString(m_Type); } -#endif -}; - -#endif // GEO2G4_LARWHEELSOLID_H diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDDProxy.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDDProxy.cxx deleted file mode 100644 index 450291f4b..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDDProxy.cxx +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// LArWheelSolidDDProxy -// proxy for LArWheelSolid to store in DetectorDescription -// Author: D. A. Maximov - -#include "LArWheelSolidDDProxy.h" -#include "LArWheelSolid.h" -#include<iostream> - -LArWheelSolidDDProxy::LArWheelSolidDDProxy(LArWheelSolid* plws) : - m_plws(plws) - {} - -LArWheelSolidDDProxy::~LArWheelSolidDDProxy() {} - -int LArWheelSolidDDProxy::Inside(const CLHEP::Hep3Vector& p) const { - return m_plws->Inside(p); -} - -double LArWheelSolidDDProxy::DistanceToIn(const CLHEP::Hep3Vector& p, const CLHEP::Hep3Vector& v) const { - return m_plws->DistanceToIn(p, v); -} - -double LArWheelSolidDDProxy::DistanceToIn(const CLHEP::Hep3Vector& p) const { - return m_plws->DistanceToIn(p); -} - -double LArWheelSolidDDProxy::DistanceToOut(const CLHEP::Hep3Vector& p, const CLHEP::Hep3Vector& v) const { - return m_plws->DistanceToOut(p, v); -} - -double LArWheelSolidDDProxy::DistanceToOut(const CLHEP::Hep3Vector& p) const { - return m_plws->DistanceToOut(p); -} - -CLHEP::Hep3Vector LArWheelSolidDDProxy::SurfaceNormal(const CLHEP::Hep3Vector& p) const { - return m_plws->SurfaceNormal(p); -} - -CLHEP::Hep3Vector LArWheelSolidDDProxy::GetPointOnSurface() const { - return m_plws->GetPointOnSurface(); -} - -double LArWheelSolidDDProxy::GetCubicVolume() { - return m_plws->GetCubicVolume(); -} - -double LArWheelSolidDDProxy::GetSurfaceArea() { - return m_plws->GetSurfaceArea(); -} - -#ifdef DEBUG_LARWHEELSOLID -void LArWheelSolidDDProxy::SetVerbose(int v) const -{ - m_plws->SetVerbose(v); -} -#else -void LArWheelSolidDDProxy::SetVerbose(int) const -{ - std::cerr << "DEBUG_LARWHEELSOLID is off" << std::endl; -} -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDDProxy.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDDProxy.h deleted file mode 100644 index 52a8ba283..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDDProxy.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// LArWheelSolidDDProxy -// proxy for LArWheelSolid to store in DetectorDescription -// Author: D. A. Maximov - -#ifndef __LArWheelSolidDDProxy_HH__ -#define __LArWheelSolidDDProxy_HH__ - -// #include "AthenaKernel/MsgStreamMember.h" -#include "CLHEP/Vector/ThreeVector.h" -#include "SGTools/CLASS_DEF.h" - - -class LArWheelSolid; - -class LArWheelSolidDDProxy { -public: - - LArWheelSolidDDProxy(LArWheelSolid* plws); - virtual ~LArWheelSolidDDProxy(); - - // Mandatory for custom solid Geant4 functions -/* EInside Inside(const G4ThreeVector&) const; - G4double DistanceToIn(const G4ThreeVector&, - const G4ThreeVector&) const; - G4double DistanceToIn(const G4ThreeVector&) const; - G4double DistanceToOut(const G4ThreeVector&, - const G4ThreeVector&, - const G4bool calcNorm = false, - G4bool* validNorm = 0, - G4ThreeVector* n = 0) const; */ - int Inside(const CLHEP::Hep3Vector&) const; - - double DistanceToIn(const CLHEP::Hep3Vector&, const CLHEP::Hep3Vector&) const; - double DistanceToIn(const CLHEP::Hep3Vector&) const; - - double DistanceToOut(const CLHEP::Hep3Vector&, const CLHEP::Hep3Vector&) const; - - double DistanceToOut(const CLHEP::Hep3Vector&) const; - CLHEP::Hep3Vector SurfaceNormal (const CLHEP::Hep3Vector&) const; - -// G4bool CalculateExtent(const EAxis, -// const G4VoxelLimits&, -// const G4AffineTransform&, -// G4double&, -// G4double&) const; - - CLHEP::Hep3Vector GetPointOnSurface() const; - double GetCubicVolume(); - double GetSurfaceArea(); - - void SetVerbose(int v) const; - -private: - - LArWheelSolid * m_plws; - -}; - - -//using the macro below we can assign an identifier (and a version) -//This is required and checked at compile time when you try to record/retrieve -CLASS_DEF(LArWheelSolidDDProxy, 900345679 , 1) - -#endif // __LArWheelSolidDDProxy_HH__ diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDisToIn.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDisToIn.cxx deleted file mode 100644 index 52a7c8c8f..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDisToIn.cxx +++ /dev/null @@ -1,322 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// DistanceToIn stuff for LArWheelSolid -#include <cassert> -#include "AthenaBaseComps/AthMsgStreamMacros.h" -#include "CLHEP/Units/PhysicalConstants.h" - -#include "GeoSpecialShapes/LArWheelCalculator.h" -#include "LArWheelSolid.h" -#include "LArFanSection.h" - -G4double LArWheelSolid::DistanceToIn(const G4ThreeVector &inputP) const -{ - LWSDBG(1, std::cout << TypeStr() << " DisToIn" << MSG_VECTOR(inputP) << std::endl); - if(m_BoundingShape->Inside(inputP) == kOutside) { - // here is an approximation - for the point outside m_BoundingShape - // the solid looks like a m_BoundingShape - // it's okay since the result could be underestimated - LWSDBG(2, std::cout << "Outside BS" << std::endl); - return m_BoundingShape->DistanceToIn(inputP); - } - G4ThreeVector p(inputP); - - // - // DistanceToTheNearestFan: - // rotates point p to the localFan coordinates and returns fan number to out_fan_number parameter - // returns distance to fan as result - // - - int p_fan = 0; - const G4double d = fabs(GetCalculator()->DistanceToTheNearestFan(p, p_fan)); - if(d > m_FHTplusT){ - const G4double result = d - m_FanHalfThickness; - LWSDBG(2, std::cout << "dti result = " << result << std::endl); - return result; - } - LWSDBG(2, std::cout << "already inside, return 0" << MSG_VECTOR(p) << std::endl); - return 0.; -} - -G4double LArWheelSolid::DistanceToIn(const G4ThreeVector &inputP, - const G4ThreeVector &inputV) const -{ - LWSDBG(1, std::cout << TypeStr() << " DisToIn" << MSG_VECTOR(inputP) - << MSG_VECTOR(inputV) << std::endl); - - G4double distance = 0.; - const EInside inside_BS = m_BoundingShape->Inside(inputP); - G4ThreeVector p(inputP); - if(inside_BS == kOutside) { - distance = m_BoundingShape->DistanceToIn(inputP, inputV); - if(distance == kInfinity) { - LWSDBG(2, std::cout << "Infinity distance to m_BoundingShape" << MSG_VECTOR(inputP) << MSG_VECTOR(inputV) << std::endl); - return kInfinity; - } - p += inputV * distance; - assert(m_BoundingShape->Inside(p) != kOutside); - LWSDBG(2, std::cout << "shift" << MSG_VECTOR(inputP) << std::endl); - } - - const G4double phi0 = p.phi(); - int p_fan = 0; - const G4double d = GetCalculator()->DistanceToTheNearestFan(p, p_fan); - if(fabs(d) < m_FHTminusT){ - LWSDBG(2, std::cout << "already inside fan" << MSG_VECTOR(p) << std::endl); - // if initial point is on BS surface and inside fan volume it is a real surface - if(inside_BS == kSurface) { - LWSDBG(2, std::cout << "On BS surface" << std::endl); - return m_BoundingShape->DistanceToIn(inputP, inputV); - } - return distance; - } - G4ThreeVector v(inputV); - v.rotateZ(p.phi() - phi0); - - const G4double d0 = distance_to_in(p, v, p_fan); - distance += d0; - -#ifdef DEBUG_LARWHEELSOLID - if(Verbose > 2){ - if(Verbose > 3){ - std::cout << MSG_VECTOR(inputP) - << " " << MSG_VECTOR(inputV) << std::endl; - } - std::cout << "dti: " << d0 << ", DTI: " << distance << std::endl; - } - if(Verbose > 3){ - if(d0 < kInfinity){ - G4ThreeVector p2 = inputP + inputV*distance; - EInside i = Inside(p2); - std::cout << "DTI hit at dist. " << distance << ", point " - << MSG_VECTOR(p2) << ", " - << inside(i) << std::endl; - } else { - std::cout << "got infinity from dti" << std::endl; - } - } -#ifdef LWS_HARD_TEST_DTI - if(test_dti(inputP, inputV, distance)){ - if(Verbose == 1){ - std::cout << TypeStr() << " DisToIn" << MSG_VECTOR(inputP) - << MSG_VECTOR(inputV) << std::endl; - } - } - if(Verbose == 1){ - std::cout << TypeStr() << " DisToIn" << MSG_VECTOR(inputP) - << MSG_VECTOR(inputV) << " " << distance << std::endl; - } -#endif // ifdef LWS_HARD_TEST_DTI - -#endif // ifdef DEBUG_LARWHEELSOLID - - return distance; -} - -// This functions should be called in the case when we are sure that -// points p (which sould be OUTSIDE of vertical fan) and out_point have -// the surface of the vertical fan between them. -// returns distance from point p to absorber surface -// sets last parameter to the founded point -G4double LArWheelSolid::in_iteration_process( - const G4ThreeVector &p, G4double dist_p, G4ThreeVector &B, int p_fan -) const -{ - LWSDBG(6, std::cout << "iip from " << p << " to " << B - << " dir " << (B - p).unit() - << std::endl); - - G4ThreeVector A, C, diff; - A = p; - G4double dist_c; - unsigned int niter = 0; - // assert(fabs(GetCalculator()->DistanceToTheNeutralFibre(A)) > m_FHTplusT); - // assert(GetCalculator()->DistanceToTheNeutralFibre(A) == dist_p); - do { - C = A + B; - C *= 0.5; - dist_c = GetCalculator()->DistanceToTheNeutralFibre(C, p_fan); - if(dist_c * dist_p < 0. || fabs(dist_c) < m_FHTminusT){ - B = C; - } else { - A = C; - } - niter ++; - diff = A - B; - } while(diff.mag2() > s_IterationPrecision2 && niter < s_IterationsLimit); - assert(niter < s_IterationsLimit); - assert(fabs(GetCalculator()->DistanceToTheNeutralFibre(B, p_fan)) < m_FHTplusT); - diff = p - B; - LWSDBG(7, std::cout << "iip result in " << niter << " = " << B - << " " << diff.mag() << std::endl); - return diff.mag(); -} - -// search for the nearest to the neutral fibre of the vertical fan point -// on the segment between p_in and p_out -G4double LArWheelSolid::search_for_nearest_point( - const G4ThreeVector &p_in, const G4double dist_p_in, - const G4ThreeVector &p_out, int p_fan -) const -{ - LWSDBG(6, std::cout << "sfnp " << MSG_VECTOR(p_in) << " " - << MSG_VECTOR(p_out) << std::endl); - - G4ThreeVector A, B, C, l, diff; - A = p_in; - B = p_out; - diff = B - A; - l = diff.unit() * s_IterationPrecision; - // this is to correctly take the sign of the distance into account - G4double sign = dist_p_in < 0.? -1. : 1.; - G4double d_prime; - G4double dist_c; - unsigned long niter = 0; - do { - C = A + B; - C *= 0.5; - dist_c = GetCalculator()->DistanceToTheNeutralFibre(C, p_fan); - if(dist_c * sign <= 0.){ // we are in coditions for in_iteration_process - LWSDBG(7, std::cout << "sfnp0 " << dist_c << std::endl); - return in_iteration_process(p_in, dist_p_in, C, p_fan); - } - // calculate sign of derivative of distance to the neutral fibre - // hope this substitution is acceptable - diff = C - l; - d_prime = (dist_c - GetCalculator()->DistanceToTheNeutralFibre(diff, p_fan)) * sign; - if(d_prime < 0.) A = C; - else B = C; - niter ++; - diff = A - B; - } while(diff.mag2() > s_IterationPrecision2 && niter < s_IterationsLimit); - assert(niter < s_IterationsLimit); - if(fabs(dist_c) < m_FHTminusT){ - LWSDBG(7, std::cout << "sfnp1 " << dist_c << std::endl); - return in_iteration_process(p_in, dist_p_in, C, p_fan); - } - // let's check at p_in and p_out - if(dist_p_in * sign < dist_c * sign){ - C = p_in; - dist_c = dist_p_in; - } - G4double dist_p_out = GetCalculator()->DistanceToTheNeutralFibre(p_out, p_fan); - if(dist_p_out *sign < dist_c * sign) C = p_out; - if(fabs(dist_p_out) < m_FHTminusT){ - LWSDBG(7, std::cout << "sfnp2 " << dist_p_out << std::endl); - return in_iteration_process(p_in, dist_p_in, C, p_fan); - } - return kInfinity; -} - -G4double LArWheelSolid::distance_to_in(G4ThreeVector &p, const G4ThreeVector &v, int p_fan) const -{ - LWSDBG(4, std::cout << "dti: " << MSG_VECTOR(p) << " " - << MSG_VECTOR(v) << std::endl); - - G4double distance = 0.; -#ifdef LARWHEELSOLID_USE_FANBOUND - if(FanBound->Inside(p) == kOutside) { - const G4double d = FanBound->DistanceToIn(p, v); - p += v * d; - distance += d; - } -#else - if(p.x() > m_fs->xmax) { - if(v.x() >= 0.) return kInfinity; - const G4double b = (m_fs->xmax - p.x()) / v.x(); - const G4double y2 = p.y() + v.y() * b; - const G4double z2 = p.z() + v.z() * b; - p.set(m_fs->xmax, y2, z2); - distance += b; - } else if(p.x() < m_fs->xmin) { - if(v.x() <= 0.) return kInfinity; - const G4double b = (m_fs->xmin - p.x()) / v.x(); - const G4double y2 = p.y() + v.y() * b; - const G4double z2 = p.z() + v.z() * b; - p.set(m_fs->xmin, y2, z2); - distance += b; - } -#endif - -// here p is on surface of or inside the "FanBound", -// distance corrected, misses are accounted for - LWSDBG(5, std::cout << "dti corrected: " << MSG_VECTOR(p) << std::endl); - - G4double dist_p = GetCalculator()->DistanceToTheNeutralFibre(p, p_fan); - if(fabs(dist_p) < m_FHTminusT) { - LWSDBG(5, std::cout << "hit fan dist_p=" << dist_p << ", m_FHTminusT=" << m_FHTminusT << std::endl); - return distance; - } - -#ifdef CHECK_DIRTONORM_ANGLE_ON_SURFACE - if(fabs(dist_p) > m_FHTplusT) { - LWSDBG(5, std::cout << "outside fan dist_p=" << dist_p << ", m_FHTplusT=" << m_FHTplusT << std::endl); - } else { - LWSDBG(5, std::cout << "on fan surface dist_p=" << dist_p << ", m_FHTplusT=" << m_FHTplusT << ", m_FHTminusT=" << m_FHTminusT << std::endl); - - const G4ThreeVector d = GetCalculator()->NearestPointOnNeutralFibre(p, p_fan); - // check dot product between normal and v - if ( (p-d).cosTheta(v) < -AngularTolerance ) { - // direction "v" definitely pointing inside - // return 0.0, it should be in "distance" - return distance; - } - } -#endif - - G4ThreeVector q; -#ifdef LARWHEELSOLID_USE_FANBOUND - q = p + v * FanBound->DistanceToOut(p, v); -#else - find_exit_point(p, v, q); -#endif - - G4int start = select_section(p.z()); - G4int stop = select_section(q.z()); - G4int step = -1; - if(stop > start) { step = 1; start ++; stop ++; } - LWSDBG(5, std::cout << "dti sections " << start << " " << stop - << " " << step << std::endl); - G4ThreeVector p1; - for(G4int i = start; i != stop; i += step){ -// v.z() can't be 0, otherwise start == stop, so the exit point could be only -// at z border of the fan section - const G4double d1 = (m_Zsect[i] - p.z()) / v.z(); - const G4double x1 = p.x() + v.x() * d1, y1 = p.y() + v.y() * d1; - p1.set(x1, y1, m_Zsect[i]); - G4double dist_p1 = GetCalculator()->DistanceToTheNeutralFibre(p1, p_fan); - LWSDBG(5, std::cout << i << ">" << p << " " << dist_p << " " - << p1 << " " << dist_p1 << std::endl); - G4double dd = kInfinity; - if(dist_p * dist_p1 < 0.){// it certanly cross current half-wave - dd = in_iteration_process(p, dist_p, p1, p_fan); - } - G4double d2 = search_for_nearest_point(p, dist_p, p1, p_fan); - LWSDBG(6, std::cout << i << "> dd=" << dd << ", d2=" << d2 << ", distance=" << distance << std::endl); - if(d2 < kInfinity){ - return distance + d2; // this half-wave is intersected - } else if(dd < kInfinity){ - return distance + dd; - } - distance += d1; - p.set(x1, y1, m_Zsect[i]); - dist_p = dist_p1; - } - - G4double dist_q = GetCalculator()->DistanceToTheNeutralFibre(q, p_fan); - LWSDBG(5, std::cout << "dti exit point: " << MSG_VECTOR(q) << " " - << dist_q << std::endl); - G4double dd = kInfinity; - if(dist_p * dist_q < 0.){// it certanly cross current half-wave - dd = in_iteration_process(p, dist_p, q, p_fan); - } - G4double d2 = search_for_nearest_point(p, dist_p, q, p_fan); - if(d2 < kInfinity){ - return distance + d2; // this half-wave is intersected - } else if(dd < kInfinity){ - return distance + dd; - } - return kInfinity; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDisToOut.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDisToOut.cxx deleted file mode 100644 index 847a7c03f..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidDisToOut.cxx +++ /dev/null @@ -1,296 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <cassert> - -#include "GeoSpecialShapes/LArWheelCalculator.h" -#include "LArWheelSolid.h" -#include "LArFanSection.h" - -G4double LArWheelSolid::DistanceToOut(const G4ThreeVector &inputP) const -{ - LWSDBG(1, std::cout << TypeStr() << " DisToOut" << MSG_VECTOR(inputP) << std::endl); - if(m_BoundingShape->Inside(inputP) != kInside){ - LWSDBG(2, std::cout << "DistanceToOut(p):" - << " point " << MSG_VECTOR(inputP) - << " is not inside of the m_BoundingShape." - << std::endl); - return 0.; - } - G4ThreeVector p( inputP ); - int p_fan = 0; - const G4double d = m_FanHalfThickness - fabs(GetCalculator()->DistanceToTheNearestFan(p, p_fan)); - if(d < s_Tolerance){ - LWSDBG(2, std::cout << "already not inside " << MSG_VECTOR(p) << std::endl); - return 0.; - } - const G4double d0 = m_BoundingShape->DistanceToOut(inputP); - LWSDBG(2, std::cout << "dto " << d << " " << d0 << std::endl); - if(d > d0) return d0; - else return d; -} - -G4double LArWheelSolid::DistanceToOut(const G4ThreeVector &inputP, - const G4ThreeVector &inputV, - const G4bool calcNorm, - G4bool* validNorm, - G4ThreeVector* sn) const -{ - LWSDBG(1, std::cout << TypeStr() << " DisToOut" << MSG_VECTOR(inputP) - << MSG_VECTOR(inputV) << std::endl); - - const EInside inside_BS = m_BoundingShape->Inside(inputP); - if(inside_BS == kOutside){ - LWSDBG(2, std::cout << "DistanceToOut(p):" - << " point " << MSG_VECTOR(inputP) - << " is outside of m_BoundingShape." << std::endl); - if(calcNorm) *validNorm = false; - return 0.; - } - - // If here inside or on surface of BS - G4ThreeVector p(inputP); - int p_fan = 0; - const G4double adtnf_p = fabs(GetCalculator()->DistanceToTheNearestFan(p, p_fan)); - if(adtnf_p >= m_FHTplusT) { - LWSDBG(2, std::cout << "DistanceToOut(p, v): point " - << MSG_VECTOR(inputP) - << " is outside of solid." << std::endl); - if(calcNorm) *validNorm = false; - return 0.; - } - - G4ThreeVector v(inputV); - const G4double phi0 = p.phi() - inputP.phi(); - v.rotateZ(phi0); - -#ifdef CHECK_DIRTONORM_ANGLE_ON_SURFACE - if(adtnf_p < FHTminusT) { - LWSDBG(5, std::cout << "inside fan point " << MSG_VECTOR(inputP) << ", FHTminusT=" << FHTminusT << std::endl); - } else { - LWSDBG(5, std::cout << "on fan surface adtnf_p=" << adtnf_p << ", m_FHTplusT=" << m_FHTplusT << ", FHTminusT=" << FHTminusT << std::endl); - - const G4ThreeVector d = GetCalculator()->NearestPointOnNeutralFibre(p, p_fan); - // check dot product between normal and v - if ( (p-d).cosTheta(v) > AngularTolerance ) { - // direction "v" definitely pointing outside - // return 0.0 - return 0.; - } - } -#endif - -// former distance_to_out starts here - LWSDBG(4, std::cout << "dto: " << MSG_VECTOR(p) << " " - << MSG_VECTOR(v) << std::endl); - - G4ThreeVector q(p); -#ifdef LARWHEELSOLID_USE_BS_DTO - const G4double dto_bs = m_BoundingShape->DistanceToOut( - inputP, inputV, calcNorm, validNorm, sn - ); - q = p + v * dto_bs; - if(q.y() < m_Ymin){ - LWSDBG(5, std::cout << "dto exit point too low " << MSG_VECTOR(q) << std::endl); - const G4double dy = (m_Ymin - p.y()) / v.y(); - q.setX(p.x() + v.x() * dy); - q.setY(m_Ymin); - q.setZ(p.z() + v.z() * dy); - } -#else - FanBoundExit_t exit = find_exit_point(p, v, q); - LWSDBG(5, std::cout << "dto exit " << exit << std::endl); -#endif - LWSDBG(5, std::cout << "dto exit point " << MSG_VECTOR(q) << std::endl); - - G4double distance = 0.; - G4int start = select_section(p.z()); - G4int stop = select_section(q.z()); - G4int step = -1; - if(stop > start){ step = 1; start ++; stop ++; } - LWSDBG(5, std::cout << "dto sections " << start << " " << stop << " " << step << std::endl); - - G4double tmp; - G4ThreeVector p1, C; - - for(G4int i = start; i != stop; i += step){ - const G4double d1 = (m_Zsect[i] - p.z()) / v.z(); -// v.z() can't be 0, otherwise start == stop, so the exit point could be only -// at z border of the fan section - LWSDBG(5, std::cout << "at " << i << " dist to zsec = " << d1 << std::endl); - const G4double x1 = p.x() + v.x() * d1, y1 = p.y() + v.y() * d1; - p1.set(x1, y1, m_Zsect[i]); - const G4double dd = fabs(GetCalculator()->DistanceToTheNeutralFibre(p1, p_fan)); - if(dd > m_FHTplusT){ - tmp = out_iteration_process(p, p1, p_fan); - //while(search_for_most_remoted_point(p, out_section, C)){ - if(search_for_most_remoted_point(p, p1, C, p_fan)){ - tmp = out_iteration_process(p, C, p_fan); - } - distance += tmp; -#ifndef LARWHEELSOLID_USE_BS_DTO - exit = NoCross; -#endif - goto end_dto; - } - if(search_for_most_remoted_point(p, p1, C, p_fan)){ - distance += out_iteration_process(p, C, p_fan); -#ifndef LARWHEELSOLID_USE_BS_DTO - exit = NoCross; -#endif - goto end_dto; - } - distance += d1; - p.set(x1, y1, m_Zsect[i]); - } - - if(fabs(GetCalculator()->DistanceToTheNeutralFibre(q, p_fan)) > m_FHTplusT){ - LWSDBG(5, std::cout << "q=" << MSG_VECTOR(q) << " outside fan cur distance=" << distance << ", m_FHTplusT=" << m_FHTplusT << std::endl); - tmp = out_iteration_process(p, q, p_fan); -#ifndef LARWHEELSOLID_USE_BS_DTO - exit = NoCross; -#endif - } else { - tmp = (q - p).mag(); - } - //while(search_for_most_remoted_point(out, out1, C, p_fan)){ - if(search_for_most_remoted_point(p, q, C, p_fan)){ - tmp = out_iteration_process(p, C, p_fan); -#ifndef LARWHEELSOLID_USE_BS_DTO - exit = NoCross; -#endif - } - distance += tmp; -// former distance_to_out ends here - end_dto: - LWSDBG(5, std::cout << "At end_dto distance=" << distance << std::endl); -#ifdef LARWHEELSOLID_USE_BS_DTO - if(calcNorm && distance < dto_bs) *validNorm = false; -#else - if(calcNorm){ - LWSDBG(5, std::cout << "dto calc norm " << exit << std::endl); - switch(exit){ - case ExitAtBack: - sn->set(0., 0., 1.); - *validNorm = true; - break; - case ExitAtFront: - sn->set(0., 0., -1.); - *validNorm = true; - break; - case ExitAtOuter: - q.rotateZ(-phi0); - sn->set(q.x(), q.y(), 0.); - if(q.z() <= m_Zmid) sn->setZ(- q.perp() * m_fs->Amax); - sn->setMag(1.0); - *validNorm = true; - break; - default: - *validNorm = false; - break; - } - } -#endif - -#ifdef DEBUG_LARWHEELSOLID - if(Verbose > 2){ - std::cout << "DTO: " << distance << " "; - if (*validNorm) { - std::cout << *validNorm << " " << MSG_VECTOR((*sn)); - } else { - std::cout << "Norm is not valid"; - } - std::cout << std::endl; - if(Verbose > 3){ - G4ThreeVector p2 = inputP + inputV * distance; - EInside i = Inside(p2); - std::cout << "DTO hit at " << MSG_VECTOR(p2) << ", " - << inside(i) << std::endl; - } - } -#ifdef LWS_HARD_TEST_DTO - if(test_dto(inputP, inputV, distance)){ - if(Verbose == 1){ - std::cout << TypeStr() << " DisToOut" << MSG_VECTOR(inputP) - << MSG_VECTOR(inputV) << std::endl; - } - } -#endif -#endif - return distance; -} - -// This functions should be called in the case when we are sure that -// point p is NOT OUTSIDE of vertical fan and point out is NOT INSIDE vertical fan -// returns distance from point p to fan surface, sets last -// parameter to the found point -// may give wrong answer - see description -G4double LArWheelSolid::out_iteration_process(const G4ThreeVector &p, - G4ThreeVector &B, const int p_fan) const -{ - LWSDBG(6, std::cout << "oip: " << p << " " << B); - assert(fabs(GetCalculator()->DistanceToTheNeutralFibre(p, p_fan)) < m_FHTplusT); - assert(fabs(GetCalculator()->DistanceToTheNeutralFibre(B, p_fan)) > m_FHTminusT); - G4ThreeVector A(p), C, diff; - unsigned int niter = 0; - do { - C = A + B; - C *= 0.5; - if(fabs(GetCalculator()->DistanceToTheNeutralFibre(C, p_fan)) < m_FHTplusT){ - A = C; - } else { - B = C; - } - niter ++; - diff = A - B; - } while(diff.mag2() > s_IterationPrecision2 && niter < s_IterationsLimit); - assert(fabs(GetCalculator()->DistanceToTheNeutralFibre(B, p_fan)) > m_FHTplusT); - assert(niter < s_IterationsLimit); - diff = p - B; - LWSDBG(7, std::cout << " -> " << B << " " << diff.mag()); - LWSDBG(6, std::cout << std::endl); - return diff.mag(); -} - -// returns true if the point being outside vert. fan is found, also set C to -// that point in this case -// returns false if the whole track looks like being inside vert. fan -G4bool LArWheelSolid::search_for_most_remoted_point( - const G4ThreeVector &a, const G4ThreeVector &b, G4ThreeVector &C, const int p_fan -) const -{ - LWSDBG(6, std::cout << "sfmrp " << a << " " << b << std::endl); - G4ThreeVector diff(b - a); - - if(diff.mag2() <= s_IterationPrecision2) return false; - G4ThreeVector A(a), B(b), l(diff.unit() * s_IterationPrecision); - // find the most remoted point on the line AB - // and check if it is outside vertical fan - // small vector along the segment AB - G4double d1, d2; - unsigned int niter = 0; - // searching for maximum of (GetCalculator()->DistanceToTheNeutralFibre)^2 along AB - do { - C = A + B; - C *= 0.5; - d1 = GetCalculator()->DistanceToTheNeutralFibre(C, p_fan); - if(fabs(d1) > m_FHTplusT){ - // here out_iteration_process gives the answer - LWSDBG(7, std::cout << "sfmrp -> " << C << " " << fabs(d1) - << " " << (C - a).unit() << " " - << (C - a).mag() << std::endl); - return true; - } - // sign of derivative - //d1 = GetCalculator()->DistanceToTheNeutralFibre(C + l); - d2 = GetCalculator()->DistanceToTheNeutralFibre(C - l, p_fan); - if(d1 * d1 - d2 * d2 > 0.) A = C; - else B = C; - niter ++; - diff = A - B; - } while(diff.mag2() > s_IterationPrecision2 && niter < s_IterationsLimit); - // the line entirely lies inside fan - assert(niter < s_IterationsLimit); - return false; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidInit.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidInit.cxx deleted file mode 100644 index d79f09ec1..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidInit.cxx +++ /dev/null @@ -1,271 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <cassert> -#include <stdexcept> -#include <iostream> - -#include "CLHEP/Units/PhysicalConstants.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" -#include "G4GeometryTolerance.hh" -#include "G4Polycone.hh" - -#include "GeoSpecialShapes/LArWheelCalculator.h" -#include "LArWheelSolid.h" -#include "LArFanSection.h" - -#ifdef DEBUG_LARWHEELSOLID -G4int LArWheelSolid::Verbose = 0; -#endif - -// these are internal technical constants, should not go in DB -const unsigned int LArWheelSolid::s_IterationsLimit = 50; // That's enough even for 10e-15 IterationPrecision -const G4double LArWheelSolid::s_Tolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance() / 2; -const G4double LArWheelSolid::s_AngularTolerance = G4GeometryTolerance::GetInstance()->GetAngularTolerance() / 2; -const G4double LArWheelSolid::s_IterationPrecision = 0.001*CLHEP::mm; -const G4double LArWheelSolid::s_IterationPrecision2 = s_IterationPrecision * s_IterationPrecision; - -LArWheelSolid::LArWheelSolid(const G4String& name, LArWheelSolid_t type, - G4int zside) - : G4VSolid(name), m_Type(type), m_PhiPosition(CLHEP::halfpi), m_fs(0), - m_msg("LArWheelSolid"), - m_f_area(0), m_f_vol(0), m_f_area_on_pc(0), m_f_length(0), m_f_side_area(0) -{ -#ifdef LARWHEELSOLID_USE_FANBOUND - ATH_MSG_INFO ( "compiled with G4 FanBound" ); -#else - ATH_MSG_INFO ( "compiled with private find_exit_point" ); -#endif - - LArG4::LArWheelCalculator_t calc_type = LArG4::LArWheelCalculator_t(0); - switch(m_Type){ - case InnerAbsorberWheel: - calc_type = LArG4::InnerAbsorberWheel; - break; - case OuterAbsorberWheel: - calc_type = LArG4::OuterAbsorberWheel; - break; - case InnerElectrodWheel: - calc_type = LArG4::InnerElectrodWheel; - break; - case OuterElectrodWheel: - calc_type = LArG4::OuterElectrodWheel; - break; - case InnerAbsorberModule: - calc_type = LArG4::InnerAbsorberModule; - break; - case OuterAbsorberModule: - calc_type = LArG4::OuterAbsorberModule; - break; - case InnerElectrodModule: - calc_type = LArG4::InnerElectrodModule; - break; - case OuterElectrodModule: - calc_type = LArG4::OuterElectrodModule; - break; - case InnerGlueWheel: - calc_type = LArG4::InnerGlueWheel; - break; - case OuterGlueWheel: - calc_type = LArG4::OuterGlueWheel; - break; - case InnerLeadWheel: - calc_type = LArG4::InnerLeadWheel; - break; - case OuterLeadWheel: - calc_type = LArG4::OuterLeadWheel; - break; - default: - G4Exception("LArWheelSolid", "UnknownSolidType", FatalException, - "Constructor: unknown LArWheelSolid_t"); - } - m_Calculator = new LArWheelCalculator(calc_type, zside); - const G4String bs_name = name + "-Bounding"; -#ifdef DEBUG_LARWHEELSOLID - const char *venv = getenv("LARWHEELSOLID_VERBOSE"); - if(venv) Verbose = atoi(venv); - std::cout << "The LArWheelSolid build " << __DATE__ << " " << __TIME__ - << std::endl; - std::cout << "LArWheelSolid verbosity level is " << Verbose << std::endl; -#endif - - // Initialize code that depends on wheel type: - m_FanHalfThickness = GetCalculator()->GetFanHalfThickness(); - m_FHTplusT = m_FanHalfThickness + s_Tolerance; - m_FHTminusT = m_FanHalfThickness - s_Tolerance; - switch(m_Type){ - case InnerAbsorberWheel: - case InnerElectrodWheel: - case InnerAbsorberModule: - case InnerElectrodModule: - case InnerGlueWheel: - case InnerLeadWheel: - inner_solid_init(bs_name); - break; - case OuterAbsorberWheel: - case OuterElectrodWheel: - case OuterAbsorberModule: - case OuterElectrodModule: - case OuterGlueWheel: - case OuterLeadWheel: - outer_solid_init(bs_name); - break; - default: - G4Exception("LArWheelSolid", "UnknownSolidType", FatalException, - "Constructor: unknown LArWheelSolid_t"); - } - - m_Zsect_start_search = (m_Zsect.size() - 1) - 1; - - init_tests(); - test(); // activated by env. variable - clean_tests(); - -#ifdef DEBUG_LARWHEELSOLID - m_fs->print(); - std::cout << "Limits: (" << m_Zsect.size() << ")" << std::endl; - for(size_t i = 0; i < m_Zsect.size(); ++ i){ - std::cout << i << " " << m_Zsect[i] << std::endl; - } -#endif - ATH_MSG_DEBUG ( "solid of type " - << LArWheelCalculator::LArWheelCalculatorTypeString(calc_type) - << " initialized" ); -} - -LArWheelSolid::~LArWheelSolid() -{ - if(m_fs) delete m_fs; -} - -// initialization of inner Absorber or Electrod wheels -void LArWheelSolid::inner_solid_init(const G4String &bs_name) -{ - m_IsOuter = false; - m_FanPhiAmplitude = 0.065; // internal technical constant, should not go in DB - set_phi_size(); - - G4double zPlane[2], rInner[2], rOuter[2]; - zPlane[0] = 0.; - zPlane[1] = GetCalculator()->GetWheelThickness(); - G4double wheel_thickness = zPlane[1] - zPlane[0]; - GetCalculator()->GetWheelInnerRadius(rInner); - GetCalculator()->GetWheelOuterRadius(rOuter); - const G4double phi_min = m_PhiPosition - m_FanPhiAmplitude - - GetCalculator()->GetFanStepOnPhi() * 2; - - m_Zmin = zPlane[0]; m_Zmax = zPlane[1]; - m_Rmin = rInner[0]; m_Rmax = rOuter[1]; - m_Ymin = m_Rmin * 0.9; - m_Zmid = zPlane[1]; - m_Ymid = (rInner[0] + rOuter[1]) * 0.5; - - m_BoundingPolycone = new G4Polycone(bs_name + "Polycone", m_MinPhi, m_MaxPhi - m_MinPhi, - 2, zPlane, rInner, rOuter); - - m_BoundingShape = m_BoundingPolycone; -#ifdef LARWHEELSOLID_USE_FANBOUND - const G4double phi_size = (m_FanPhiAmplitude + GetCalculator()->GetFanStepOnPhi() * 2) * 2; - FanBound = new G4Polycone(bs_name + "ofFan", phi_min, phi_size, - 2, zPlane, rInner, rOuter); -#endif - ATH_MSG_INFO(m_BoundingShape->GetName() + " is the m_BoundingShape"); - - const G4double half_wave_length = GetCalculator()->GetHalfWaveLength(); - const G4double sss = GetCalculator()->GetStraightStartSection(); - m_Zsect.push_back(0.); - m_Zsect.push_back(sss + half_wave_length * 0.25); - const G4int num_fs = GetCalculator()->GetNumberOfHalfWaves() + 1; - for(G4int i = 2; i < num_fs; i ++){ - const G4double zi = half_wave_length * (i - 1) + sss; -#if LARWHEELSOLID_ZSECT_MULT > 1 - for(G4int j = LARWHEELSOLID_ZSECT_MULT - 1; j > 0; -- j){ - m_Zsect.push_back(zi - half_wave_length * j / LARWHEELSOLID_ZSECT_MULT); - } -#endif - m_Zsect.push_back(zi); - } - m_Zsect.push_back(wheel_thickness - m_Zsect[1]); - m_Zsect.push_back(wheel_thickness - m_Zsect[0]); - - m_fs = new LArFanSections( - rInner[0], rInner[1], rOuter[0], rOuter[1], - m_Rmax*cos(phi_min), m_Zsect.front(), m_Zsect.back() - ); -} - -// initialization of outer Absorber or Electrod wheels -void LArWheelSolid::outer_solid_init(const G4String &bs_name) -{ - m_IsOuter = true; - m_FanPhiAmplitude = 0.02; // internal technical constant, should not go in DB - set_phi_size(); - - G4double zPlane[3], rInner[3], rOuter[3]; - zPlane[0] = 0.; - zPlane[2] = GetCalculator()->GetWheelThickness(); - G4double wheel_thickness = zPlane[2] - zPlane[0]; - zPlane[1] = GetCalculator()->GetWheelInnerRadius(rInner); - GetCalculator()->GetWheelOuterRadius(rOuter); - const G4double phi_min = m_PhiPosition - m_FanPhiAmplitude - - GetCalculator()->GetFanStepOnPhi() * 2; - - m_Zmin = zPlane[0]; m_Zmax = zPlane[2]; - m_Rmin = rInner[0]; m_Rmax = rOuter[2]; - m_Ymin = m_Rmin * 0.9; - m_Zmid = zPlane[1]; - m_Ymid = (rInner[0] + rOuter[2]) * 0.5; - - m_BoundingPolycone = new G4Polycone(bs_name + "Polycone", m_MinPhi, m_MaxPhi - m_MinPhi, - 3, zPlane, rInner, rOuter); - m_BoundingShape = m_BoundingPolycone; -#ifdef LARWHEELSOLID_USE_FANBOUND - const G4double phi_size = (m_FanPhiAmplitude + GetCalculator()->GetFanStepOnPhi() * 2) * 2; - FanBound = new G4Polycone(bs_name + "ofFan", phi_min, phi_size, - 3, zPlane, rInner, rOuter); -#endif - ATH_MSG_INFO(m_BoundingShape->GetName() + "is the m_BoundingShape"); - - const G4double half_wave_length = GetCalculator()->GetHalfWaveLength(); - const G4double sss = GetCalculator()->GetStraightStartSection(); - m_Zsect.push_back(0.); - m_Zsect.push_back(sss + half_wave_length * 0.25); - const G4int num_fs = GetCalculator()->GetNumberOfHalfWaves() + 1; - for(G4int i = 2; i < num_fs; i ++){ - const G4double zi = half_wave_length * (i - 1) + sss; -#if LARWHEELSOLID_ZSECT_MULT > 1 - for(G4int j = LARWHEELSOLID_ZSECT_MULT - 1; j > 0; -- j){ - G4double zj = zi - half_wave_length * j / LARWHEELSOLID_ZSECT_MULT; - m_Zsect.push_back(zj); - if(m_Zsect.back() <= m_Zmid && m_Zmid < zj){ - m_Zsect.push_back(m_Zmid); - } - } -#endif - if(m_Zsect.back() <= m_Zmid && m_Zmid < zi){ - m_Zsect.push_back(m_Zmid); - } - m_Zsect.push_back(zi); - } - m_Zsect.push_back(wheel_thickness - m_Zsect[1]); - m_Zsect.push_back(wheel_thickness - m_Zsect[0]); - - m_fs = new LArFanSections( - rInner[0], rInner[1], rOuter[0], rOuter[1], - m_Rmax*cos(phi_min), m_Zsect.front(), m_Zmid - ); -} - -// it should be called after m_FanPhiAmplitude has been set -// and before m_BoundingShape creation -void LArWheelSolid::set_phi_size(void) -{ - if(GetCalculator()->GetisModule()){ - m_MinPhi = m_PhiPosition - CLHEP::pi * (1. / 8.) - m_FanPhiAmplitude; - m_MaxPhi = m_PhiPosition + CLHEP::pi * (1. / 8.) + m_FanPhiAmplitude; - } else { - m_MinPhi = 0.; - m_MaxPhi = CLHEP::twopi; - } -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidTests.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidTests.cxx deleted file mode 100644 index 46796aff9..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolidTests.cxx +++ /dev/null @@ -1,803 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream> -#include <stdexcept> -#include "boost/io/ios_state.hpp" -#include <map> - -#include "TRandom3.h" -#include "TF1.h" -#include "TNtupleD.h" -#include "TFile.h" -// For root version ifdef -#include "TROOT.h" - -#include "G4Polycone.hh" - -#include "GeoSpecialShapes/LArWheelCalculator.h" -#include "LArWheelSolid.h" -#include "CLHEP/Units/SystemOfUnits.h" -#include "CLHEP/Units/PhysicalConstants.h" -//#define LOCAL_DEBUG 1 -#include<stdlib.h> - -static double IntPrecision = 0.0001; - -EInside LArWheelSolid::Inside_accordion(const G4ThreeVector &p) const -{ - G4ThreeVector p1 = p; - int p1_fan = 0; - G4double d = m_FanHalfThickness - fabs(GetCalculator()->DistanceToTheNearestFan(p1, p1_fan)); - if(d > s_Tolerance) return kInside; - if(d > -s_Tolerance) return kSurface; - return kOutside; -} - -void LArWheelSolid::set_failover_point(G4ThreeVector &p, -#ifdef LOCAL_DEBUG - const char *m) const -#else - const char *) const -#endif - { - p[0] = 0.; p[1] = m_Rmin; p[2] = m_Zmin; - int p_fan = 0; - GetCalculator()->DistanceToTheNearestFan(p, p_fan); - -#ifdef LOCAL_DEBUG - if(m) std::cout << m << std::endl; -#endif - } - -static void get_r(const G4Polycone *p, G4double z, - G4double &rmin, G4double &rmax - ) -{ - G4ThreeVector from(10.*CLHEP::m, 0., z); - rmax = from[0] - p->DistanceToIn(from, G4ThreeVector(-1., 0., 0.)); - from[0] = 0.; - rmin = p->DistanceToIn(from, G4ThreeVector(1., 0., 0.)); -} - -static TRandom *rnd = 0; -G4ThreeVector LArWheelSolid::GetPointOnSurface(void) const -{ - if(rnd == 0){ - rnd = new TRandom3(0); - } - - G4double r = rnd->Uniform(); - - G4ThreeVector p(0., 0., 0.); - - G4double level1 = .980; - G4double level2 = .993; - const char *v = getenv("LARWHEELSOLID_TEST_MODE_LEVEL1"); - if(v) level1 = atof(v); - const char *v1 = getenv("LARWHEELSOLID_TEST_MODE_LEVEL2"); - if(v1) level2 = atof(v1); - -#if LOCAL_DEBUG > 1 - std::cout << "LWS::GPOS " << r << std::endl; -#endif - - if(r <= level1){ - get_point_on_accordion_surface(p); - } else if(r <= level2){ - get_point_on_polycone_surface(p); - } else if(r <= 1.){ - get_point_on_flat_surface(p); - } else { - G4Exception("LArWheelSolid", "Rnd generator error", FatalException, "GetPointOnSurface: Wrong data from rnd generator"); - } - return p; -} - -void LArWheelSolid::get_point_on_accordion_surface(G4ThreeVector &p) const -{ - p[0] = 0.; - p[1] = 0.; - p[2] = rnd->Uniform(m_Zmin, m_Zmax); - - G4double rmin, rmax; - get_r(m_BoundingPolycone, p[2], rmin, rmax); - - p[1] = rnd->Uniform(rmin, rmax); - p.setPhi(rnd->Uniform(m_MinPhi, m_MaxPhi)); - G4double dphi = p.phi(); - int p_fan = 0; - G4double d = GetCalculator()->DistanceToTheNearestFan(p, p_fan); - dphi -= p.phi(); - - G4int side = 0; - if(d < 0.) side = -1; - if(d >= 0.) side = 1; - - G4double a = GetCalculator()->AmplitudeOfSurface(p, side, p_fan); - p[0] = a; - - p.rotateZ(dphi); - - if(m_BoundingPolycone->Inside(p) == kOutside){ - G4ThreeVector D = p; D[2] = 0.; - G4double d1 = m_BoundingPolycone->DistanceToIn(p, D); - if(d1 > 10.*CLHEP::m){ - D *= -1; - d1 = m_BoundingPolycone->DistanceToIn(p, D); - } - if(d1 > 10.*CLHEP::m){ - set_failover_point(p, "acc fail0"); - return; - } - d1 *= 2.; - - G4ThreeVector B = p + D * d1; - G4double dphi = B.phi(); - int B_fan = 0; - GetCalculator()->DistanceToTheNearestFan(B, B_fan); - dphi -= B.phi(); - - B[0] = GetCalculator()->AmplitudeOfSurface(B, side, B_fan); - B.rotateZ(dphi); - EInside Bi = m_BoundingPolycone->Inside(B); - if(Bi == kSurface){ - p = B; - return; - } - if(Bi == kOutside){ - set_failover_point(p, "acc fail1"); - return; - } - G4ThreeVector D1 = (p - B).unit(); - G4ThreeVector X = B + D1 * m_BoundingPolycone->DistanceToOut(B, D1); - if(Inside(X) == kSurface){ - p = X; - } else { // failed - set_failover_point(p, "acc fail2"); - return; - } - } -} - -void LArWheelSolid::get_point_on_polycone_surface(G4ThreeVector &p) const -{ - const G4double z = rnd->Uniform(m_Zmin, m_Zmax); - G4double rmin, rmax; - get_r(m_BoundingPolycone, z, rmin, rmax); - const bool inner = rnd->Uniform() > 0.5? true: false; - - p[0] = 0.; p[1] = inner? rmin: rmax; p[2] = z; - p.setPhi(rnd->Uniform(m_MinPhi, m_MaxPhi)); - G4double dphi = p.phi(); - int p_fan = 0; - GetCalculator()->DistanceToTheNearestFan(p, p_fan); - dphi -= p.phi(); - - const G4double r = p[1]; - - G4ThreeVector A1(0., r, z); - A1[0] = GetCalculator()->AmplitudeOfSurface(A1, -1, p_fan); - A1.rotateZ(dphi); - EInside A1i = m_BoundingPolycone->Inside(A1); - // EInside A1a = Inside_accordion(A1); - //std::cout << "A1: " << A1i << " " << A1a << std::endl; - if(A1i == kSurface){ - //std::cout << "got A1" << std::endl; - p = A1; - return; - } - - G4ThreeVector A2(0., r, z); - A2[0] = GetCalculator()->AmplitudeOfSurface(A2, 1, p_fan); - A2.rotateZ(dphi); - EInside A2i = m_BoundingPolycone->Inside(A2); - // EInside A2a = Inside_accordion(A2); - //std::cout << "A2: " << A2i << " " << A2a << std::endl; - if(A2i == kSurface){ - //std::cout << "got A2" << std::endl; - p = A2; - return; - } - - if(A1i != A2i){ - if(A2i == kOutside){ - std::swap(A1, A2); - std::swap(A1i, A2i); - } - // here A1 is outside BP, A2 is inside BP - G4ThreeVector d = (A2 - A1).unit(); - p = A1 + d * m_BoundingPolycone->DistanceToIn(A1, d); - //std::cout << "got A1<->A2" << std::endl; - return; - } - // here A1i == A2i - - G4double step; - if(A1i == kInside){ - G4double d1 = m_BoundingPolycone->DistanceToOut(A1); - G4double d2 = m_BoundingPolycone->DistanceToOut(A2); - step = d1 > d2? d1 : d2; - if(inner) step *= -2; - else step *= 2; - } else { - G4double d1 = m_BoundingPolycone->DistanceToIn(A1); - G4double d2 = m_BoundingPolycone->DistanceToIn(A2); - step = d1 > d2? d1 : d2; - if(inner) step *= 2; - else step *= -2; - } - - G4ThreeVector B1(0., r + step, z); - B1[0] = GetCalculator()->AmplitudeOfSurface(B1, -1, p_fan); - B1.rotateZ(dphi); - EInside B1i = m_BoundingPolycone->Inside(B1); - // EInside B1a = Inside_accordion(B1); - //std::cout << "B1: " << B1i << " " << B1a << std::endl; - if(B1i == kSurface){ - //std::cout << "got B1" << std::endl; - p = B1; - return; - } - G4ThreeVector B2(0., r + step, z); - B2[0] = GetCalculator()->AmplitudeOfSurface(B2, 1, p_fan); - B2.rotateZ(dphi); - EInside B2i = m_BoundingPolycone->Inside(B2); - // EInside B2a = Inside_accordion(B2); - //std::cout << "B2: " << B2i << " " << B2a << std::endl; - if(B2i == kSurface){ - //std::cout << "got B2" << std::endl; - p = B2; - return; - } - - if(B1i == A1i || B2i == A1i){ // failed - set_failover_point(p, "pol fail1"); - return; - } - if(A1i == kInside){ - std::swap(A1, B1); - std::swap(A2, B2); - std::swap(A1i, B1i); - std::swap(A2i, B2i); - } - // here A* outside, B* inside, all on accordion surface - - G4ThreeVector d1 = (A1 - B1).unit(); - G4ThreeVector X1 = B1 + d1 * m_BoundingPolycone->DistanceToOut(B1, d1); - G4ThreeVector d2 = (A2 - B2).unit(); - G4ThreeVector X2 = B2 + d2 * m_BoundingPolycone->DistanceToOut(B2, d2); - - G4ThreeVector X = X1; - G4double phi1 = X1.phi(), phi2 = X2.phi(); - // X1 corresponds to side = -, X2 to side = + - if(phi1 > 0. && phi2 < 0.) phi2 += CLHEP::twopi; - G4double phiX = rnd->Uniform(phi1, phi2); - if(phiX > CLHEP::pi) phiX -= CLHEP::twopi; - X.setPhi(phiX); - - if(Inside(X) == kSurface){ - p = X; - } else { // failed - set_failover_point(p, "pol fail2"); - } -} - -void LArWheelSolid::get_point_on_flat_surface(G4ThreeVector &p) const -{ - p[0] = 0.; - p[1] = 0.; - p[2] = rnd->Uniform() > 0.5? m_Zmin: m_Zmax; - - G4double rmin, rmax; - get_r(m_BoundingPolycone, p[2], rmin, rmax); - - p[1] = rnd->Uniform(rmin, rmax); - p.setPhi(rnd->Uniform(m_MinPhi, m_MaxPhi)); - G4double dphi = p.phi(); - int p_fan = 0; - GetCalculator()->DistanceToTheNearestFan(p, p_fan); - dphi -= p.phi(); - - p[0] = rnd->Uniform( - GetCalculator()->AmplitudeOfSurface(p, -1, p_fan), - GetCalculator()->AmplitudeOfSurface(p, 1, p_fan) - ); - - p.rotateZ(dphi); - - if(m_BoundingPolycone->Inside(p) != kSurface){ - set_failover_point(p, "flat fail"); - } -} - -G4double LArWheelSolid::GetCubicVolume(void) -{ - // sagging ignored, effect should be negligible -#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) - double result = - f_vol->Integral(m_Rmin, Rmax, (const Double_t *)0, IntPrecision) -#else - double result = - m_f_vol->Integral(m_Rmin, m_Rmax, IntPrecision) -#endif - -#ifndef LOCAL_DEBUG - * GetCalculator()->GetNumberOfFans() -#endif - ; - return result; -} - -G4double LArWheelSolid::get_area_on_polycone(void) const -{ - return m_f_area_on_pc->Integral(m_Zmin, m_Zmax); -} - -G4double LArWheelSolid::get_area_on_face(void) const -{ - G4double result = 0.; - G4double rmin, rmax; - get_r(m_BoundingPolycone, m_Zmin, rmin, rmax); - result += rmax - rmin; - get_r(m_BoundingPolycone, m_Zmax, rmin, rmax); - result += rmax - rmin; - result *= GetCalculator()->GetFanHalfThickness() * 2.; - return result; -} - -G4double LArWheelSolid::get_length_at_r(G4double r) const -{ - m_f_length->SetParameter(0, r); - - double zmin = m_BoundingPolycone->DistanceToIn( - G4ThreeVector(0., r, -m_Zmin), G4ThreeVector(0., 0., 1.) - ); - zmin -= m_Zmin * 2.; - double zmax = m_BoundingPolycone->DistanceToIn( - G4ThreeVector(0., r, m_Zmax), G4ThreeVector(0., 0., -1.) - ); - zmax = m_Zmax - zmax; - double result = m_f_length->Integral(zmin, zmax); - return result; -} - -G4double LArWheelSolid::get_area_on_side(void) const -{ -#if ROOT_VERSION_CODE < ROOT_VERSION(6,0,0) - return f_side_area->Integral(m_Rmin, m_Rmax, (const Double_t *)0, IntPrecision); -#else - return m_f_side_area->Integral(m_Rmin, m_Rmax, IntPrecision); -#endif -} - -G4double LArWheelSolid::GetSurfaceArea(void) -{ - double result = 0.; - - double a1 = get_area_on_polycone(); - result += a1; -#ifdef LOCAL_DEBUG - std::cout << "get_area_on_polycone: " << a1/mm2 << std::endl; -#endif - - double a2 = get_area_on_face(); - result += a2; -#ifdef LOCAL_DEBUG - std::cout << "get_area_on_face: " << a2/mm2 << std::endl; -#endif - - double a3 = get_area_on_side(); - result += a3; -#ifdef LOCAL_DEBUG - std::cout << "get_area_on_side: " << a3/mm2 << std::endl; -#endif - - // sagging ignored, effect should be negligible - return result -#ifndef LOCAL_DEBUG - * GetCalculator()->GetNumberOfFans() -#endif - ; -} - -void LArWheelSolid::test(void) -{ - boost::io::ios_all_saver ias(std::cout); - const char *on = getenv("LARWHEELSOLID_TEST"); - if(on == 0) return; - std::string test_mode = on; - - std::cout << "============| LArWheelSolid test() routine |==============" - << std::endl; - std::cout << "Solid of type " << LArWheelSolidTypeString(m_Type) - << std::endl; - std::cout.precision(6); - std::cout << std::fixed; - const char *prec = getenv("LARWHEELSOLID_TEST_INTPRECISION"); - if(prec) IntPrecision = atof(prec); - std::cout << "Int. precision " << IntPrecision << std::endl; - std::cout << "test mode " << test_mode << std::endl; - - std::cout << "m_Rmin = " << m_Rmin << " m_Rmax = " << m_Rmax << std::endl - << "m_Zmin = " << m_Zmin << " m_Zmax = " << m_Zmax << std::endl; - - // TFile *F = new TFile("LArWheelSolid_test.root", "RECREATE"); - TFile *F = 0; - TNtupleD *T = 0; - if(test_mode.find("root") != std::string::npos){ - F = new TFile("LArWheelSolid_test.root", "UPDATE"); - T = new TNtupleD(GetName(), GetName(), "x:y:z"); - } - int N = 1000000; - const int Nmax(1000000000); - char *NN = getenv("LARWHEELSOLID_TEST_NPOINTS"); - - if(NN) { - char *endptr; - N = strtol(NN, &endptr, 0); - if (endptr[0] != '\0') { - throw std::invalid_argument("Could not convert string to int: " + std::string(NN)); - } - } - if (Nmax<N) { - std::cout << "Number of points from LARWHEELSOLID_TEST_NPOINTS environment variable ("<<N<<") is too large. Using " << Nmax << " instead." << std::endl; - N=Nmax; - } - if (N<0) { - std::cout << "Number of points from LARWHEELSOLID_TEST_NPOINTS environment variable ("<<N<<") is negative!!. Using 0 instead." << std::endl; - N=0; - } - if(test_mode.find("points") == std::string::npos){ - N = 0; - } else { - std::cout << N << " points" << std::endl; - } - for(int i = 0; i < N; ++ i){ - G4ThreeVector p = GetPointOnSurface(); -#ifdef LOCAL_DEBUG - EInside ii = Inside(p); - if(ii != kSurface){ - std::cout << i << " " - << (ii == kInside? "inside": "outside") - << std::endl; - } -#endif - if(T) T->Fill(p[0], p[1], p[2]); - } - if(F){ - T->Write(); - F->Write(); - F->Close(); - delete F; - } - - if(test_mode.find("volume") != std::string::npos){ - double cv = GetCubicVolume(); - std::cout << "GetCubicVolume: " << cv/CLHEP::mm3 << " mm^3" << std::endl; - } - - if(test_mode.find("area") != std::string::npos){ - double sa = GetSurfaceArea(); - std::cout << "GetSurfaceArea: " << sa/CLHEP::mm2 << " mm^2" << std::endl; - } - - std::cout << "======= end of ArWheelSolid test() routine =============" - << std::endl; - - if(m_Type == OuterAbsorberWheel) { - if(test_mode.find("once") != std::string::npos) exit(0); } - - ias.restore(); -} - -void LArWheelSolid::clean_tests(void) { - if(m_f_area) { - delete m_f_area; - m_f_area = 0; - } - if(m_f_vol) { - delete m_f_vol; - m_f_vol = 0; - } - - if(m_f_area_on_pc) { - delete m_f_area_on_pc; - m_f_area_on_pc = 0; - } - - if(m_f_length) { - delete m_f_length; - m_f_length = 0; - } - if(m_f_side_area) { - delete m_f_side_area; - m_f_side_area = 0; - } -} - -G4double LArWheelSolid::get_area_at_r(G4double r) const -{ - m_f_area->SetParameter(0, r); - - double zmin = m_BoundingPolycone->DistanceToIn( - G4ThreeVector(0., r, m_Zmin), G4ThreeVector(0., 0., 1.) - ); - double zmax = m_BoundingPolycone->DistanceToIn( - G4ThreeVector(0., r, m_Zmax), G4ThreeVector(0., 0., -1.) - ); - zmax = m_Zmax - zmax; - - double result = m_f_area->Integral(zmin, zmax); - - return result; -} - -static std::map<double, LArWheelSolid *> solid; - -double LArWheelSolid_fcn_area(double *x, double *p) -{ - const double &z = x[0]; - const double &r = p[0]; - const double &index = p[1]; - - G4ThreeVector a(0., r, z); - double b = solid[index]->GetCalculator()->AmplitudeOfSurface(a, -1, 121) // sagging ignored, effect should be negligible, use arbitrary fan number - - solid[index]->GetCalculator()->AmplitudeOfSurface(a, 1, 121); - return b; -} - -double LArWheelSolid_fcn_vol(double *x, double *p) -{ - const double &r = x[0]; - const double &index = p[0]; - - return solid[index]->get_area_at_r(r); -} - -double LArWheelSolid_fcn_area_on_pc(double *x, double *p) -{ - const double &z = x[0]; - const double &index = p[0]; - - G4double rmin, rmax; - get_r(solid[index]->m_BoundingPolycone, z, rmin, rmax); - - double result = 0.; - G4ThreeVector a(0., rmin, z); - result += solid[index]->GetCalculator()->AmplitudeOfSurface(a, -1, 232) // sagging ignored, effect should be negligible, use arbitrary fan number - - solid[index]->GetCalculator()->AmplitudeOfSurface(a, 1, 232); - a[1] = rmax; - result += solid[index]->GetCalculator()->AmplitudeOfSurface(a, -1, 343) - - solid[index]->GetCalculator()->AmplitudeOfSurface(a, 1, 343); - - return result; -} - - -double LArWheelSolid_get_dl(double *x, double *par, G4int side) -{ - const double &z = x[0]; - const double &r = par[0]; - const double &index = par[1]; - - const double h = 0.001; - - //check what happens if z+h > m_Zmax etc - G4ThreeVector p(0., r, z + h); - G4double D1 = solid[index]->GetCalculator()->AmplitudeOfSurface(p, side, 5665); // sagging ignored, effect should be negligible, use arbitrary fan number - p[2] = z - h; - D1 -= solid[index]->GetCalculator()->AmplitudeOfSurface(p, side, 5665); - D1 /= 2 * h; - - p[2] = z + h / 2; - G4double D2 = solid[index]->GetCalculator()->AmplitudeOfSurface(p, side, 5665); - p[2] = z - h / 2; - D2 -= solid[index]->GetCalculator()->AmplitudeOfSurface(p, side, 5665); - D2 /= h; - - G4double D = (D2 * 4 - D1) / 3.; - G4double dl = sqrt(1 + D * D); - - return dl; -} - -static double fcn_length(double *x, double *p) -{ - return LArWheelSolid_get_dl(x, p, 1) + LArWheelSolid_get_dl(x, p, -1); -} - -double LArWheelSolid_fcn_side_area(double *x, double *p) -{ - const double &r = x[0]; - const double &index = p[0]; - - return solid[index]->get_length_at_r(r); -} - -void LArWheelSolid::init_tests(void) -{ - m_test_index = double(solid.size()); - solid[m_test_index] = this; - -#ifdef DEBUG_LARWHEELSOLID - std::cout << "LArWheelSolid::init_tests: put " << this - << " with index " << m_test_index << std::endl; -#endif - - m_f_area = new TF1( - (GetName() + "_f_area").c_str(), &LArWheelSolid_fcn_area, - m_Zmin, m_Zmax, 2 - ); - m_f_area->FixParameter(1, m_test_index); - - m_f_vol = new TF1( - (GetName() + "_f_vol").c_str(), &LArWheelSolid_fcn_vol, - m_Rmin, m_Rmax, 1 - ); - m_f_vol->FixParameter(0, m_test_index); - - m_f_area_on_pc = new TF1( - (GetName() + "_f_area_pc").c_str(), &LArWheelSolid_fcn_area_on_pc, - m_Zmin, m_Zmax, 1 - ); - m_f_area_on_pc->FixParameter(0, m_test_index); - - m_f_length = new TF1( - (GetName() + "_f_length").c_str(), &fcn_length, - m_Zmin, m_Zmax, 2 - ); - m_f_length->FixParameter(1, m_test_index); - - m_f_side_area = new TF1( - (GetName() + "_f_side_area").c_str(), &LArWheelSolid_fcn_side_area, - m_Rmin, m_Rmax, 1 - ); - m_f_side_area->FixParameter(0, m_test_index); -} - -#ifdef DEBUG_LARWHEELSOLID -G4bool LArWheelSolid::test_dti( - const G4ThreeVector &inputP, const G4ThreeVector &inputV, - const G4double distance -) const -{ - if(distance > 10.*CLHEP::m){ - LWSDBG(1, std::cout << "DTI test skipped, distance > 10 m" - << std::endl); - return false; - } - unsigned long counter = 0; - counter ++; - G4ThreeVector p; - if(m_BoundingShape->Inside(inputP) == kOutside){ - p = inputP + inputV * m_BoundingShape->DistanceToIn(inputP, inputV); - } else p = inputP; - const G4double phi0 = p.phi(); - int p_fan = 0; - const G4double d = GetCalculator()->DistanceToTheNearestFan(p, p_fan); - if(fabs(d) < m_FHTplusT){ - std::cout << "DTI test already inside" << MSG_VECTOR(p) << std::endl; - return false; - } - G4ThreeVector v( inputV ); - v.rotateZ(p.phi() - phi0); - const G4double dd = s_IterationPrecision; - LWSDBG(1, std::cout << "Start DTI test, expect " - << long(distance / dd) << " iterations" - << std::endl); - - G4int V = Verbose; - Verbose = 0; - - const G4double d1 = distance - s_IterationPrecision; - bool first = true; - for(G4double t = s_IterationPrecision; t < d1; t += dd){ - G4ThreeVector p1 = p + v * t; - if(fabs(GetCalculator()->DistanceToTheNeutralFibre(p1, p_fan)) < m_FHTplusT){ - std::cout << "DTI test at " << MSG_VECTOR(inputP) << " -> " - << MSG_VECTOR(inputV) << ", translated to " - << MSG_VECTOR(p) << " - > " << MSG_VECTOR(v) - << " in range of " - << distance << ": found nearer intersection at local point" - << MSG_VECTOR(p1) << ", distance " << t - << ", call " << counter - << std::endl; - Verbose = V; - - if(first){ - first = false; - FILE *F = fopen("dti_error.dat", "w"); - if(F){ - fprintf(F, "%10e %10e %10e\n", p.x(), p.y(), p.z()); - fprintf(F, "%10e %10e %10e\n", v.x(), v.y(), v.z()); - for(G4double e = s_IterationPrecision; e < d1; e += dd){ - p1 = p + v * e; - G4double f = fabs(GetCalculator()->DistanceToTheNeutralFibre(p1, p_fan)) - m_FanHalfThickness; - fprintf(F, "%10e %10e\n", e, f); - } - fclose(F); - } - } - - return true; - } - } - Verbose = V; - LWSDBG(1, std::cout << "DTI test at " << MSG_VECTOR(p) << " -> " - << MSG_VECTOR(v) << " in range of " - << distance << ": allright" << std::endl); - return false; -} - -G4bool LArWheelSolid::test_dto( - const G4ThreeVector &inputP, const G4ThreeVector &inputV, - const G4double distance -) const -{ - if(distance > 10.*CLHEP::m){ - LWSDBG(1, std::cout << "DTO test skipped, distance > 10 m" - << std::endl); - return false; - } - unsigned long counter = 0; - counter ++; - G4ThreeVector p( inputP ); - const G4double phi0 = p.phi(); - int p_fan = 0; - const G4double d = GetCalculator()->DistanceToTheNearestFan(p, p_fan); - if(fabs(d) > m_FHTplusT){ - std::cout << "DTO test already outside" << MSG_VECTOR(p) << std::endl; - return false; - } - G4ThreeVector v( inputV ); - v.rotateZ(p.phi() - phi0); - const G4double dd = s_IterationPrecision; - LWSDBG(1, std::cout << "Start DTO test, expect " - << long(distance / dd) << " iterations" - << std::endl); - - G4int V = Verbose; - Verbose = 0; - - const G4double d1 = distance - s_IterationPrecision; - static bool first = true; - for(G4double t = s_IterationPrecision; t < d1; t += dd){ - G4ThreeVector p1 = p + v * t; - if(fabs(GetCalculator()->DistanceToTheNeutralFibre(p1, p_fan)) > m_FHTplusT){ - std::cout << "DTO test at " << MSG_VECTOR(inputP) << " -> " - << MSG_VECTOR(inputV) << ", translated to " - << MSG_VECTOR(p) << " - > " << MSG_VECTOR(v) - << " in range of " - << distance << ": found nearer intersection at local point" - << MSG_VECTOR(p1) << ", distance " << t - << ", call " << counter - << std::endl; - Verbose = V; - - if(first){ - first = false; - FILE *F = fopen("dto_error.dat", "w"); - if(F){ - fprintf(F, "%10e %10e %10e\n", p.x(), p.y(), p.z()); - fprintf(F, "%10e %10e %10e\n", v.x(), v.y(), v.z()); - for(G4double e = s_IterationPrecision; e < d1; e += dd){ - p1 = p + v * e; - G4double f = fabs(GetCalculator()->DistanceToTheNeutralFibre(p1, p_fan)) - m_FanHalfThickness; - fprintf(F, "%10e %10e\n", e, f); - } - fclose(F); - } - } - - return true; - } - } - Verbose = V; - LWSDBG(1, std::cout << "DTO test at " << MSG_VECTOR(p) << " -> " - << MSG_VECTOR(v) << " in range of " - << distance << ": allright" << std::endl); - return false; -} -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid_type.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid_type.h deleted file mode 100644 index b30d4dc6c..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/LArWheelSolid_type.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// LArWheelSolid_type -// Author: D. A. Maximov -// typedefs for LArWheelSolid - -#ifndef __LArWheelSolid_type_HH__ -#define __LArWheelSolid_type_HH__ - -typedef enum { - InnerAbsorberWheel, - OuterAbsorberWheel, - InnerElectrodWheel, - OuterElectrodWheel, - InnerAbsorberModule, - OuterAbsorberModule, - InnerElectrodModule, - OuterElectrodModule, - InnerGlueWheel, - OuterGlueWheel, - InnerLeadWheel, - OuterLeadWheel -} LArWheelSolid_t; - - -#endif // __LArWheelSolid_type_HH__ diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/SingleLogicalVolumeFactory.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/SingleLogicalVolumeFactory.cxx deleted file mode 100644 index 24ae0c0d6..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/SingleLogicalVolumeFactory.cxx +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "SingleLogicalVolumeFactory.h" -#include "Geo2G4SolidFactory.h" -#include "GeoMaterial2G4/Geo2G4MaterialFactory.h" -#include "GeoModelKernel/GeoLogVol.h" -#include "SimHelpers/ServiceAccessor.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" -#include "G4LogicalVolume.hh" -#include "G4Material.hh" - -SingleLogicalVolumeFactory::SingleLogicalVolumeFactory(): m_msg("SingleLogicalVolumeFactory") -{ -} - -typedef std::map<std::string, G4LogicalVolume*, std::less<std::string> > vMap; - -G4LogicalVolume *SingleLogicalVolumeFactory::Build(const GeoLogVol* theLog) const -{ - static Geo2G4SolidFactory theSolidFactory; - static Geo2G4MaterialFactory theMaterialFactory; - static vMap volumeList; - // - // Get Material from GeoModel - // - std::string n= theLog->getName(); - if (volumeList.find(n) == volumeList.end()) { - G4LogicalVolume *theG4Log=0; - G4Material* theG4Mat=theMaterialFactory.Build(theLog->getMaterial()); - - G4VSolid * theG4Solid = theSolidFactory.Build(theLog->getShape()); - - ATH_MSG_DEBUG("Building logical volume (single) "<<theLog->getName()<< " " << theG4Mat); - theG4Log = new G4LogicalVolume(theG4Solid, - theG4Mat, - theLog->getName(), - 0,0,0); - volumeList[n] = theG4Log; - return theG4Log; - } - return volumeList[n]; -} diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/SingleLogicalVolumeFactory.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/SingleLogicalVolumeFactory.h deleted file mode 100644 index 7a089ee90..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/SingleLogicalVolumeFactory.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_SingleLogicalVolumeFactory_h -#define GEO2G4_SingleLogicalVolumeFactory_h - -#include "AthenaKernel/MsgStreamMember.h" - -class G4LogicalVolume; -class GeoLogVol; - -#include <string> -#include <map> - -class SingleLogicalVolumeFactory { -public: - SingleLogicalVolumeFactory(); - G4LogicalVolume* Build(const GeoLogVol*) const; - /// Log a message using the Athena controlled logging system - MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } - /// Check whether the logging system is active at the provided verbosity level - bool msgLvl( MSG::Level lvl ) const { return m_msg.get().level() <= lvl; } - private: - /// Private message stream member - mutable Athena::MsgStreamMember m_msg; -}; - -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/VolumeBuilder.h b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/VolumeBuilder.h deleted file mode 100644 index c4b02e6bd..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/VolumeBuilder.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef GEO2G4_VolumeBuilder_H -#define GEO2G4_VolumeBuilder_H - -#include "G4LogicalVolume.hh" -#include "Geo2G4SvcAccessor.h" - -#include "GeoModelUtilities/GeoOpticalPhysVol.h" - -#include "G4VPhysicalVolume.hh" - -#include <string> -#include <iostream> -#include <map> - -typedef std::map< const GeoOpticalPhysVol*, G4VPhysicalVolume*,std::less< const GeoOpticalPhysVol*> > OpticalVolumesMap; - -class VolumeBuilder -{ - public: - VolumeBuilder(std::string k): m_paramOn(false), m_key(k) - { - Geo2G4SvcAccessor accessor; - Geo2G4SvcBase *g=accessor.GetGeo2G4Svc(); - g->RegisterVolumeBuilder(this); - } - - virtual ~VolumeBuilder() - { - Geo2G4SvcAccessor accessor; - Geo2G4SvcBase *g=accessor.GetGeo2G4Svc(); - g->UnregisterVolumeBuilder(this); - } - - std::string GetKey() const {return m_key;} - - // flag controlling Parameterization to Parameterization translation - void SetParam(bool flag){m_paramOn = flag;} - bool GetParam(){return m_paramOn;} - - virtual G4LogicalVolume* Build(PVConstLink pv, OpticalVolumesMap* optical_volumes = 0) const = 0; - - protected: - bool m_paramOn; - - private: - std::string m_key; -}; -#endif diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/components/Geo2G4_entries.cxx b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/components/Geo2G4_entries.cxx deleted file mode 100644 index 103fd8729..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/components/Geo2G4_entries.cxx +++ /dev/null @@ -1,7 +0,0 @@ -#include "../Geo2G4Svc.h" -#include "../GeoDetectorTool.h" -#include "../GDMLDetectorTool.h" - -DECLARE_COMPONENT( Geo2G4Svc ) -DECLARE_COMPONENT( GeoDetectorTool ) -DECLARE_COMPONENT( GDMLDetectorTool ) diff --git a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/lcg_dict/selection.xml b/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/lcg_dict/selection.xml deleted file mode 100644 index 98e02df07..000000000 --- a/GeoModelG4/GeoModel2G4/original_GeoModel2G4/src/lcg_dict/selection.xml +++ /dev/null @@ -1,3 +0,0 @@ -<lcgdict> - <class name="LArWheelSolidDDProxy" /> -</lcgdict> -- GitLab