Commit e104243f authored by Simon Spannagel's avatar Simon Spannagel
Browse files

GeometryBuilder: properly propagate GDML presence flag

parent 7eac8dd8
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -11,12 +11,9 @@ ENDIF()
# Add "geant4.sh" as runtime dependency for setup.sh file:
ADD_RUNTIME_DEP(geant4.sh)

# Print message if GDML support is not enabled in Geant4
# Add GDML flag if suported
IF(Geant4_gdml_FOUND)
  message(STATUS "Geometry export in GDML format is enabled.")
    ADD_DEFINITIONS(-DGeant4_GDML)
ELSE()
  message(STATUS "Geometry export in GDML format is disabled. To enable it, configure and compile Geant4 with the option -DGEANT4_USE_GDML=ON.")
ENDIF()

# Add Geant4 flags before our own flags
+7 −0
Original line number Diff line number Diff line
@@ -41,7 +41,14 @@ allpix::PassiveMaterialModel::factory(const std::string& type, const Configurati
    } else if(type == "sphere") {
        return std::make_shared<SphereModel>(config, geo_manager);
    } else if(type == "gdml") {
#ifdef Geant4_GDML
        return std::make_shared<GDMLModel>(config, geo_manager);
#else
        throw allpix::InvalidValueError(
            config,
            "type",
            "GDML not supported by Geant4 version. Recompile Geant4 with the option -DGEANT4_USE_GDML=ON to enable support");
#endif
    } else {
        throw ModuleError("Passive Material has an unknown type " + type);
    }
+5 −15
Original line number Diff line number Diff line
@@ -11,27 +11,16 @@
#ifndef ALLPIX_PASSIVE_MATERIAL_GDML_H
#define ALLPIX_PASSIVE_MATERIAL_GDML_H

#ifdef Geant4_GDML

#include <string>

#include <G4Color.hh>
#include <G4GDMLParser.hh>
#include <G4SubtractionSolid.hh>
#include <G4VSolid.hh>
#include "PassiveMaterialModel.hpp"

// Include GDML if Geant4 version has it
#ifdef Geant4_GDML
#include "G4GDMLParser.hh"
#endif

// #ifdef Geant4_GDML
//
// #else
// std::string error = "You requested to import the geometry in GDML. ";
// error += "However, GDML support is currently disabled in Geant4. ";
// error += "To enable it, configure and compile Geant4 with the option "
// "-DGEANT4_USE_GDML=ON.";
// throw allpix::InvalidValueError(config_, "GDML_input_file", error);
// #endif
#include "PassiveMaterialModel.hpp"

namespace allpix {

@@ -177,4 +166,5 @@ namespace allpix {
    };
} // namespace allpix

#endif /* Geant4_GDML */
#endif /* ALLPIX_PASSIVE_MATERIAL_GDML_H */