diff --git a/DDG4/include/DDG4/Geant4DetectorConstruction.h b/DDG4/include/DDG4/Geant4DetectorConstruction.h index ee6d74889f23ceb7efbc240693684edc9f57d7b8..1df4ec316cda933d02179ed07f16cdf87f63c61d 100644 --- a/DDG4/include/DDG4/Geant4DetectorConstruction.h +++ b/DDG4/include/DDG4/Geant4DetectorConstruction.h @@ -15,17 +15,19 @@ #define DD4HEP_GEANT4DETECTORCONSTRUCTION_H // Framework include files +#include "DD4hep/DetElement.h" #include "DDG4/Geant4Action.h" -#if !defined(__CINT__) -#include "DDG4/Geant4GeometryInfo.h" -#endif // Forward declarations class G4VUserDetectorConstruction; class G4VSensitiveDetector; class G4VPhysicalVolume; class G4LogicalVolume; - +class G4UserLimits; +class G4Material; +class G4Element; +class G4VSolid; +class G4Region; /// Namespace for the AIDA detector description toolkit namespace dd4hep { @@ -39,6 +41,7 @@ namespace dd4hep { // Forward declarations class Geant4Kernel; class Geant4GeometryInfo; + class Geant4AssemblyVolume; class Geant4DetectorConstruction; class Geant4DetectorConstructionContext; class Geant4DetectorConstructionSequence; diff --git a/DDG4/include/DDG4/Geant4GeometryInfo.h b/DDG4/include/DDG4/Geant4GeometryInfo.h index 059732d6bfed352b229875b2448eddb0cfc11609..b91aa237e1b0a3d11f8bf4d721fa7404aeb9fcd1 100644 --- a/DDG4/include/DDG4/Geant4GeometryInfo.h +++ b/DDG4/include/DDG4/Geant4GeometryInfo.h @@ -16,6 +16,7 @@ // Framework include files #include "DD4hep/Objects.h" +#include "DD4hep/Printout.h" #include "DD4hep/GeoHandler.h" #include "DDG4/Geant4Primitives.h" @@ -100,7 +101,8 @@ namespace dd4hep { std::map<Region, std::set<const TGeoVolume*> > regions; std::map<LimitSet, std::set<const TGeoVolume*> > limits; G4VPhysicalVolume* m_world; - bool valid; + PrintLevel printLevel; + bool valid; private: friend class Geant4Mapping; /// Default constructor diff --git a/DDG4/include/DDG4/Geant4VolumeManager.h b/DDG4/include/DDG4/Geant4VolumeManager.h index cb5c178fe1f412e8227d7374d09f6b1f3edc1dea..b3c9a0fea4f6d53c0f69b32fe7fa974a9b63e0f9 100644 --- a/DDG4/include/DDG4/Geant4VolumeManager.h +++ b/DDG4/include/DDG4/Geant4VolumeManager.h @@ -17,10 +17,11 @@ #include "DD4hep/Detector.h" #include "DD4hep/IDDescriptor.h" #include "DDG4/Geant4Primitives.h" -#include "DDG4/Geant4GeometryInfo.h" // Geant4 forward declarations class G4VTouchable; +class G4VPhysicalVolume; + /// Namespace for the AIDA detector description toolkit namespace dd4hep { @@ -66,6 +67,7 @@ namespace dd4hep { } /// Assignment operator Geant4VolumeManager& operator=(const Geant4VolumeManager& c) = default; + /// Helper: Generate placement path from touchable object std::vector<const G4VPhysicalVolume*> placementPath(const G4VTouchable* touchable, bool exception = true) const; diff --git a/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp b/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp index 7a4f80c93051addb5fa5ef2b2f7fa97b5ec4b0b6..e67ad7114a9f24cc0b98e4eed5bad89b927fe48a 100644 --- a/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp +++ b/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp @@ -51,7 +51,9 @@ namespace dd4hep { bool m_printPlacements = false; /// Property: Flag to dump all sensitives after the conversion procedure bool m_printSensitives = false; - + + /// Property: Printout level of info object + int m_geoInfoPrintLevel; /// Property: G4 GDML dump file name (default: empty. If non empty, dump) std::string m_dumpGDML; @@ -92,18 +94,19 @@ DECLARE_GEANT4ACTION(Geant4DetectorGeometryConstruction) Geant4DetectorGeometryConstruction::Geant4DetectorGeometryConstruction(Geant4Context* ctxt, const string& nam) : Geant4DetectorConstruction(ctxt,nam) { - declareProperty("DebugMaterials", m_debugMaterials); - declareProperty("DebugElements", m_debugElements); - declareProperty("DebugShapes", m_debugShapes); - declareProperty("DebugVolumes", m_debugVolumes); - declareProperty("DebugPlacements", m_debugPlacements); - declareProperty("DebugRegions", m_debugRegions); - - declareProperty("PrintPlacements", m_printPlacements); - declareProperty("PrintSensitives", m_printSensitives); - - declareProperty("DumpHierarchy", m_dumpHierarchy); - declareProperty("DumpGDML", m_dumpGDML=""); + declareProperty("DebugMaterials", m_debugMaterials); + declareProperty("DebugElements", m_debugElements); + declareProperty("DebugShapes", m_debugShapes); + declareProperty("DebugVolumes", m_debugVolumes); + declareProperty("DebugPlacements", m_debugPlacements); + declareProperty("DebugRegions", m_debugRegions); + + declareProperty("PrintPlacements", m_printPlacements); + declareProperty("PrintSensitives", m_printSensitives); + declareProperty("GeoInfoPrintLevel", m_geoInfoPrintLevel = DEBUG); + + declareProperty("DumpHierarchy", m_dumpHierarchy); + declareProperty("DumpGDML", m_dumpGDML=""); InstanceCount::increment(this); } @@ -114,8 +117,8 @@ Geant4DetectorGeometryConstruction::~Geant4DetectorGeometryConstruction() { /// Geometry construction callback. Called at "Construct()" void Geant4DetectorGeometryConstruction::constructGeo(Geant4DetectorConstructionContext* ctxt) { - Geant4Mapping& g4map = Geant4Mapping::instance(); - DetElement world = ctxt->description.world(); + Geant4Mapping& g4map = Geant4Mapping::instance(); + DetElement world = ctxt->description.world(); Geant4Converter conv(ctxt->description, outputLevel()); conv.debugMaterials = m_debugMaterials; conv.debugElements = m_debugElements; @@ -124,7 +127,8 @@ void Geant4DetectorGeometryConstruction::constructGeo(Geant4DetectorConstruction conv.debugPlacements = m_debugPlacements; conv.debugRegions = m_debugRegions; - ctxt->geometry = conv.create(world).detach(); + ctxt->geometry = conv.create(world).detach(); + ctxt->geometry->printLevel = PrintLevel(m_geoInfoPrintLevel); g4map.attach(ctxt->geometry); G4VPhysicalVolume* w = ctxt->geometry->world(); // Create Geant4 volume manager only if not yet available diff --git a/DDG4/src/Geant4GeometryInfo.cpp b/DDG4/src/Geant4GeometryInfo.cpp index f61d1ba3fa6bc69f77fc91d20ef302e15a7d75a7..06a1367a4a091572eadc1741e97811a9545cbcae 100644 --- a/DDG4/src/Geant4GeometryInfo.cpp +++ b/DDG4/src/Geant4GeometryInfo.cpp @@ -12,9 +12,11 @@ //========================================================================== // Framework include files -#include "G4VPhysicalVolume.hh" #include "DDG4/Geant4GeometryInfo.h" +// Geant4 include files +#include "G4VPhysicalVolume.hh" + // C/C++ include files #include <stdexcept> @@ -39,7 +41,7 @@ string Geant4GeometryInfo::placementPath(const Geant4PlacementPath& path, bool r /// Default constructor Geant4GeometryInfo::Geant4GeometryInfo() - : TNamed("Geant4GeometryInfo", "Geant4GeometryInfo"), m_world(0), valid(false) { + : TNamed("Geant4GeometryInfo", "Geant4GeometryInfo"), m_world(0), printLevel(DEBUG), valid(false) { } /// Default destructor diff --git a/DDG4/src/Geant4VolumeManager.cpp b/DDG4/src/Geant4VolumeManager.cpp index 7c90c6e55e8d4eb8662d43950c7f3da251618961..b5d7f67410a4f8390a77ca2678445c6a9aaeb396 100644 --- a/DDG4/src/Geant4VolumeManager.cpp +++ b/DDG4/src/Geant4VolumeManager.cpp @@ -112,9 +112,9 @@ namespace { IDDescriptor iddesc = ro.idSpec(); VolumeID code = iddesc.encode(ids); Registries::const_iterator i = m_entries.find(code); - PrintLevel print_action = INFO; - PrintLevel print_chain = INFO; - PrintLevel print_res = INFO; + PrintLevel print_action = m_geo.printLevel; + PrintLevel print_chain = m_geo.printLevel; + PrintLevel print_res = m_geo.printLevel; printout(print_action,"Geant4VolumeManager","+++ Add path:%s vid:%016X", detail::tools::placementPath(nodes,false).c_str(),code); diff --git a/examples/DDCodex/src/CODEXb_geo.cpp b/examples/DDCodex/src/CODEXb_geo.cpp index 7c652e958a8e847797f0e2fc257ad043c8f79512..749e810cec57c03c31ba45435be6c8685563dc22 100644 --- a/examples/DDCodex/src/CODEXb_geo.cpp +++ b/examples/DDCodex/src/CODEXb_geo.cpp @@ -32,8 +32,6 @@ static Ref_t create_element(Detector& description, xml_h e, Ref_t sens) { double env_angle = x_envelope.angle(); double env_dz = x_envelope.dz()/2.0; double sin_cone = std::sin(std::atan(x_envelope.rmax()/env_dz/2.0)); - double cos_beam = std::cos(env_angle); - double sin_beam = std::sin(env_angle); //Cone env_cone(env_dz,0,0.0001,x_envelope.rmax(),x_envelope.rmax()+0.0001); //Volume env_vol (det_name,env_cone,description.air()); // If the cone should be removed and replaced by an assembly, diff --git a/examples/LHeD/scripts/LHeDACLick.C b/examples/LHeD/scripts/LHeDACLick.C index 08f433c065054894ccf0e57efc520ab730cb3fc1..c85d3f2b099e4467d3e4b62dda68722dce3aef82 100644 --- a/examples/LHeD/scripts/LHeDACLick.C +++ b/examples/LHeD/scripts/LHeDACLick.C @@ -30,7 +30,6 @@ using namespace dd4hep; using namespace dd4hep::sim; using namespace dd4hep::sim::Test; using namespace dd4hep::sim::Setup; -using namespace dd4hep::sim::Geant4GeometryMaps; Geant4SensDetActionSequence* setupDetector(Geant4Kernel& kernel, const std::string& name) { SensitiveSeq sd = SensitiveSeq(kernel,"Geant4SensDetActionSequence/"+name);