Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
# - G4persistency category build
|
||||
include(ascii/sources.cmake)
|
||||
include(mctruth/sources.cmake)
|
||||
geant4_add_category(G4geomtext MODULES G4geomtext)
|
||||
|
||||
geant4_add_category(G4persistency MODULES G4geomtext G4mctruth)
|
||||
include(mctruth/sources.cmake)
|
||||
geant4_add_category(G4mctruth MODULES G4mctruth)
|
||||
|
||||
if(GEANT4_USE_GDML)
|
||||
include(gdml/sources.cmake)
|
||||
geant4_category_modules(G4persistency G4gdml)
|
||||
geant4_add_category(G4gdml MODULES G4gdml)
|
||||
endif()
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# -----------------------------------------------------------------------
|
||||
# GNUmakefile for persistency library. Gabriele Cosmo, 16/11/96.
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
name := G4persistency
|
||||
|
||||
SUBDIRS := mctruth ascii
|
||||
SUBLIBS = G4mctruth G4geomtext
|
||||
|
||||
ifdef G4LIB_BUILD_GDML
|
||||
SUBDIRS += gdml
|
||||
SUBLIBS += G4gdml
|
||||
endif
|
||||
|
||||
GLOBLIBS = libG4run.lib libG4event.lib libG4tracking.lib
|
||||
GLOBLIBS += libG4processes.lib libG4digits_hits.lib libG4track.lib
|
||||
GLOBLIBS += libG4particles.lib libG4geometry.lib libG4materials.lib
|
||||
GLOBLIBS += libG4graphics_reps.lib libG4intercoms.lib libG4global.lib
|
||||
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/globlib.gmk
|
||||
@@ -6,6 +6,13 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-05-10 Ben Morgan (persistency-V11-01-01)
|
||||
- Split build of G4persistency into G4mctruth, G4geomtext and (optional) G4gdml
|
||||
libraries.
|
||||
|
||||
## 2022-12-12 Ben Morgan (persistency-V11-01-00)
|
||||
- Remove obsolete GNUmakefile scripts
|
||||
|
||||
## 2022-11-11 Gabriele Cosmo (persistency-V11-00-03)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# -----------------------------------------------------------------------
|
||||
# GNUmakefile for persistency library. Gabriele Cosmo, 16/11/96.
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
name := G4geomtext
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += \
|
||||
-I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/global/HEPNumerics/include \
|
||||
-I$(G4BASE)/graphics_reps/include \
|
||||
-I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/geometry/solids/CSG/include \
|
||||
-I$(G4BASE)/geometry/solids/specific/include \
|
||||
-I$(G4BASE)/geometry/solids/Boolean/include \
|
||||
-I$(G4BASE)/geometry/divisions/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/management/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -1,48 +0,0 @@
|
||||
# -----------------------------------------------------------------------
|
||||
# GNUmakefile for persistency library. Gabriele Cosmo, 16/11/96.
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
name := G4gdml
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += \
|
||||
-I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/global/HEPNumerics/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/digits_hits/hits/include \
|
||||
-I$(G4BASE)/digits_hits/digits/include \
|
||||
-I$(G4BASE)/digits_hits/detector/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/particles/bosons/include \
|
||||
-I$(G4BASE)/particles/hadrons/barions/include \
|
||||
-I$(G4BASE)/particles/leptons/include \
|
||||
-I$(G4BASE)/run/include \
|
||||
-I$(G4BASE)/event/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/tracking/include \
|
||||
-I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/processes/cuts/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/navigation/include \
|
||||
-I$(G4BASE)/geometry/solids/CSG/include \
|
||||
-I$(G4BASE)/geometry/solids/Boolean/include \
|
||||
-I$(G4BASE)/geometry/solids/specific/include \
|
||||
-I$(G4BASE)/geometry/divisions/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/graphics_reps/include
|
||||
|
||||
ifdef G4LIB_USE_GDML
|
||||
ifndef XERCESCROOT
|
||||
@echo XERCESCROOT not defined!
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -6,11 +6,33 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2023-06-16 I. Hrivnacova (gdml-V11-00-06)
|
||||
## 2023-06-16 I. Hrivnacova (gdml-V11-01-02)
|
||||
- Let G4ThreeVectorCompare obey the strict weak ordering requirements;
|
||||
which fixes failures in inserting elements in the std::map with
|
||||
this compare operator used in writing tessellated solid.
|
||||
|
||||
# 2023-05-31 Ben Morgan (gdml-V11-01-01)
|
||||
- Allow setting of alternative grammar for schema validation via an environment
|
||||
variable `G4GDML_SCHEMA_FILE`, which overrides the value set by `SetImportSchema`
|
||||
if both are non-empty strings.
|
||||
- Update checking of grammar and schema override to fail on missing schema, and
|
||||
to force parser to ignore any schema set in the input GDML file.
|
||||
|
||||
## 2023-04-26 Gabriele Cosmo (gdml-V11-01-00)
|
||||
- Added possibility to set alternative grammar for schema validation while
|
||||
reading a GDML file. This can be achieved by either calling the new method
|
||||
SetImportSchema(..) from G4GDMLParser, providing the absolute path and file
|
||||
name of the XML schema, or by using the new UI command:
|
||||
/persistency/gdml/schema "[absolute_path]/schema_filename"
|
||||
before importing the GDML file.
|
||||
By setting a locally stored alternative grammar, it will instruct the parser
|
||||
to ignore the default schema specified in the GDML file and therefore
|
||||
no longer require access to the network for retrieving the schema.
|
||||
- In G4GDMLWriteStructure::ExportSD(), use GetMasterSensitiveDetector() from
|
||||
logical volume to retrieve the shadow pointer of the sensitive detector.
|
||||
Fixes issue reported by CMS when exporting sensitive detector auxiliary
|
||||
data in MT mode.
|
||||
|
||||
## 2022-11-11 Gabriele Cosmo (gdml-V11-00-05)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class G4GDMLMessenger : public G4UImessenger
|
||||
|
||||
G4UIdirectory* persistencyDir = nullptr;
|
||||
G4UIdirectory* gdmlDir = nullptr;
|
||||
G4UIcmdWithAString* ReaderSchema = nullptr;
|
||||
G4UIcmdWithAString* ReaderCmd = nullptr;
|
||||
G4UIcmdWithAString* WriterCmd = nullptr;
|
||||
G4UIcmdWithAString* TopVolCmd = nullptr;
|
||||
|
||||
@@ -125,6 +125,7 @@ class G4GDMLParser
|
||||
inline void SetEnergyCutsExport(G4bool);
|
||||
inline void SetSDExport(G4bool);
|
||||
inline void SetReverseSearch(G4bool);
|
||||
inline void SetImportSchema(const G4String& path_and_filename);
|
||||
|
||||
inline G4int GetMaxExportLevel() const; // Manage max number of levels
|
||||
inline void SetMaxExportLevel(G4int); // to export
|
||||
|
||||
@@ -249,6 +249,11 @@ inline void G4GDMLParser::Clear()
|
||||
reader->Clear();
|
||||
}
|
||||
|
||||
inline void G4GDMLParser::SetImportSchema(const G4String& path_and_filename)
|
||||
{
|
||||
reader->SetSchemaFile(path_and_filename);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Methods for Writer
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -131,6 +131,11 @@ class G4GDMLRead
|
||||
//
|
||||
// Strip off pointers from entity IDs.
|
||||
|
||||
const G4String& GetSchemaFile() const;
|
||||
void SetSchemaFile(const G4String& schemaFile);
|
||||
//
|
||||
// Set/Get alternative XML schema path/file for parsing validation.
|
||||
|
||||
void OverlapCheck(G4bool);
|
||||
//
|
||||
// Activate/de-activate surface check for overlaps (default is off).
|
||||
@@ -157,6 +162,7 @@ class G4GDMLRead
|
||||
G4bool validate = true;
|
||||
G4bool check = false;
|
||||
G4bool dostrip = true;
|
||||
G4String schema = "";
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -52,6 +52,12 @@ G4GDMLMessenger::G4GDMLMessenger(G4GDMLParser* myPars)
|
||||
gdmlDir = new G4UIdirectory("/persistency/gdml/");
|
||||
gdmlDir->SetGuidance("GDML parser and writer.");
|
||||
|
||||
ReaderSchema = new G4UIcmdWithAString("/persistency/gdml/schema", this);
|
||||
ReaderSchema->SetGuidance("Set alternative GDML schema file for import validation.");
|
||||
ReaderSchema->SetParameterName("schema_path_and_filename", false);
|
||||
ReaderSchema->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
ReaderSchema->SetToBeBroadcasted(false);
|
||||
|
||||
ReaderCmd = new G4UIcmdWithAString("/persistency/gdml/read", this);
|
||||
ReaderCmd->SetGuidance("Read GDML file.");
|
||||
ReaderCmd->SetParameterName("filename", false);
|
||||
@@ -121,6 +127,7 @@ G4GDMLMessenger::G4GDMLMessenger(G4GDMLParser* myPars)
|
||||
// --------------------------------------------------------------------
|
||||
G4GDMLMessenger::~G4GDMLMessenger()
|
||||
{
|
||||
delete ReaderSchema;
|
||||
delete ReaderCmd;
|
||||
delete WriterCmd;
|
||||
delete ClearCmd;
|
||||
@@ -149,6 +156,11 @@ void G4GDMLMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
myParser->SetAddPointerToName(pFlag);
|
||||
}
|
||||
|
||||
if(command == ReaderSchema)
|
||||
{
|
||||
myParser->SetImportSchema(newValue);
|
||||
}
|
||||
|
||||
if(command == ReaderCmd)
|
||||
{
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "G4SolidStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4EnvironmentUtils.hh"
|
||||
#include "G4Exception.hh"
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4GDMLRead::G4GDMLRead()
|
||||
@@ -418,6 +420,18 @@ void G4GDMLRead::ExtensionRead(const xercesc::DOMElement* const)
|
||||
error_msg);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
const G4String& G4GDMLRead::GetSchemaFile() const
|
||||
{
|
||||
return schema;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4GDMLRead::SetSchemaFile(const G4String& schemaFile)
|
||||
{
|
||||
schema = schemaFile;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4GDMLRead::Read(const G4String& fileName, G4bool validation,
|
||||
G4bool isModule, G4bool strip)
|
||||
@@ -442,6 +456,29 @@ void G4GDMLRead::Read(const G4String& fileName, G4bool validation,
|
||||
if(validate)
|
||||
{
|
||||
parser->setValidationScheme(xercesc::XercesDOMParser::Val_Always);
|
||||
|
||||
// Load alternative schema path if specified by user in
|
||||
// 1. environment variable, or
|
||||
// 2. `schema` data member, or
|
||||
// Will fall back to default validation otherwise (`xsi:noNamespaceSchemaLocation` in input file)
|
||||
if(auto schemaPath = G4GetEnv<G4String>("G4GDML_SCHEMA_FILE", schema); schemaPath != "")
|
||||
{
|
||||
// Pre-parse grammar to check it's present/valid
|
||||
if(parser->loadGrammar(schemaPath.c_str(), xercesc::Grammar::SchemaGrammarType, true) != nullptr)
|
||||
{
|
||||
G4cout << "G4GDML: Loaded alternative schema URI: " << schemaPath << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4GDMLRead::Read()",
|
||||
"InvalidGDMLSchemaFile",
|
||||
FatalException,
|
||||
G4String("Failed to load/parse schema file '" + schemaPath + "'").c_str());
|
||||
}
|
||||
parser->useCachedGrammarInParse(true);
|
||||
// If the schema has been set manually then we want to ignore path set in input file, if any
|
||||
parser->setExternalNoNamespaceSchemaLocation(schemaPath.c_str());
|
||||
}
|
||||
}
|
||||
parser->setValidationSchemaFullChecking(validate);
|
||||
parser->setCreateEntityReferenceNodes(false);
|
||||
|
||||
@@ -890,7 +890,7 @@ void G4GDMLWriteStructure::SetSDExport(G4bool fsd)
|
||||
// --------------------------------------------------------------------
|
||||
void G4GDMLWriteStructure::ExportSD(const G4LogicalVolume* const lvol)
|
||||
{
|
||||
G4VSensitiveDetector* sd = lvol->GetSensitiveDetector();
|
||||
G4VSensitiveDetector* sd = lvol->GetMasterSensitiveDetector();
|
||||
|
||||
if(sd != nullptr)
|
||||
{
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# -----------------------------------------------------------------------
|
||||
# GNUmakefile for persistency library. Gabriele Cosmo, 16/11/96.
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
name := G4mctruth
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/digits_hits/hits/include \
|
||||
-I$(G4BASE)/digits_hits/digits/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/run/include \
|
||||
-I$(G4BASE)/event/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/tracking/include \
|
||||
-I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/geometry/management/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
Reference in New Issue
Block a user