Import Geant4 10.3.0.beta source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile 89398 2015-04-09 09:56:29Z gcosmo $
|
||||
# $Id: GNUmakefile 96677 2016-04-29 12:20:20Z gcosmo $
|
||||
# -----------------------------------------------------------------------
|
||||
# GNUmakefile for persistency library. Gabriele Cosmo, 16/11/96.
|
||||
# -----------------------------------------------------------------------
|
||||
@@ -18,6 +18,7 @@ CPPFLAGS += \
|
||||
-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 \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History 93171 2015-10-09 09:04:09Z gcosmo $
|
||||
$Id: History 96677 2016-04-29 12:20:20Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,28 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
29 April 2016 Gabriele Cosmo (gdml-V10-02-06)
|
||||
- Added missing new dependency on digits_hits/detector in GNUmakefile.
|
||||
|
||||
28 April 2016 Witek Pokorski (gdml-V10-02-05)
|
||||
- Added ability to automatically export the names of sensitive detectors
|
||||
as the auxiliary information.
|
||||
|
||||
22 March 2016 Witek Pokorski (gdml-V10-02-04)
|
||||
- adding check for correctness of the units
|
||||
|
||||
21 March 2016 Witek Pokorski (gdml-V10-02-03)
|
||||
- increasing max_chars in the transcode() calls in G4GDLWrite (bug #1847)
|
||||
|
||||
16 March 2016 Gabriele Cosmo (gdml-V10-02-02, 01)
|
||||
- Added ability to import and export scaled shapes.
|
||||
Extended GDML schema by adding "scaledSolid" tag supporting scaled shapes.
|
||||
New GDML schema version 3.1.4 (files: gdml.xsd, gdml_solids.xsd).
|
||||
Requires tags "geommng-V10-02-00" and "geom-bool-V10-02-01".
|
||||
|
||||
14 December 2015 Gabriele Cosmo (gdml-V10-02-00)
|
||||
- Corrected broken URLs and version number to schema.
|
||||
|
||||
07 October 2015 Gabriele Cosmo (gdml-V10-01-24)
|
||||
- Protected compilation of G4MultiUnion wrapper with G4GEOM_USE_USOLIDS flag.
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLMessenger.hh 89381 2015-04-08 15:32:47Z gcosmo $
|
||||
// $Id: G4GDMLMessenger.hh 96673 2016-04-29 12:08:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4GDMLMessenger
|
||||
@@ -73,6 +73,7 @@ class G4GDMLMessenger : public G4UImessenger
|
||||
G4UIcmdWithoutParameter* ClearCmd;
|
||||
G4UIcmdWithABool* RegionCmd;
|
||||
G4UIcmdWithABool* EcutsCmd;
|
||||
G4UIcmdWithABool* SDCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLParser.hh 89698 2015-04-27 13:25:23Z gcosmo $
|
||||
// $Id: G4GDMLParser.hh 96673 2016-04-29 12:08:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4GDMLParser
|
||||
@@ -126,6 +126,7 @@ class G4GDMLParser
|
||||
inline void SetOverlapCheck(G4bool);
|
||||
inline void SetRegionExport(G4bool);
|
||||
inline void SetEnergyCutsExport(G4bool);
|
||||
inline void SetSDExport(G4bool);
|
||||
|
||||
inline void Clear(); // Clears the evaluator
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLParser.icc 89698 2015-04-27 13:25:23Z gcosmo $
|
||||
// $Id: G4GDMLParser.icc 96673 2016-04-29 12:08:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4GDMLParser inline methods
|
||||
@@ -208,6 +208,11 @@ inline void G4GDMLParser::SetEnergyCutsExport(G4bool flag)
|
||||
writer->SetEnergyCutsExport(flag);
|
||||
}
|
||||
|
||||
inline void G4GDMLParser::SetSDExport(G4bool flag)
|
||||
{
|
||||
writer->SetSDExport(flag);
|
||||
}
|
||||
|
||||
inline void G4GDMLParser::Clear()
|
||||
{
|
||||
reader->Clear();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLReadSolids.hh 82922 2014-07-18 15:56:35Z gcosmo $
|
||||
// $Id: G4GDMLReadSolids.hh 96133 2016-03-16 22:21:17Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4GDMLReadSolids
|
||||
@@ -87,6 +87,7 @@ class G4GDMLReadSolids : public G4GDMLReadMaterials
|
||||
void GenericPolyhedraRead(const xercesc::DOMElement* const);
|
||||
G4QuadrangularFacet* QuadrangularRead(const xercesc::DOMElement* const);
|
||||
void ReflectedSolidRead(const xercesc::DOMElement* const);
|
||||
void ScaledSolidRead(const xercesc::DOMElement* const);
|
||||
G4ExtrudedSolid::ZSection SectionRead(const xercesc::DOMElement* const,G4double);
|
||||
void SphereRead(const xercesc::DOMElement* const);
|
||||
void TessellatedRead(const xercesc::DOMElement* const);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLWriteSolids.hh 82922 2014-07-18 15:56:35Z gcosmo $
|
||||
// $Id: G4GDMLWriteSolids.hh 96133 2016-03-16 22:21:17Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4GDMLWriteSolids
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "G4MultiUnion.hh"
|
||||
|
||||
class G4BooleanSolid;
|
||||
class G4ScaledSolid;
|
||||
class G4Box;
|
||||
class G4Cons;
|
||||
class G4EllipticalCone;
|
||||
@@ -108,6 +109,7 @@ class G4GDMLWriteSolids : public G4GDMLWriteMaterials
|
||||
|
||||
void MultiUnionWrite(xercesc::DOMElement* solElement, const G4MultiUnion* const);
|
||||
void BooleanWrite(xercesc::DOMElement*, const G4BooleanSolid* const);
|
||||
void ScaledWrite(xercesc::DOMElement*, const G4ScaledSolid* const);
|
||||
void BoxWrite(xercesc::DOMElement*, const G4Box* const);
|
||||
void ConeWrite(xercesc::DOMElement*, const G4Cons* const);
|
||||
void ElconeWrite(xercesc::DOMElement*, const G4EllipticalCone* const);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLWriteStructure.hh 89493 2015-04-14 09:22:54Z gcosmo $
|
||||
// $Id: G4GDMLWriteStructure.hh 96677 2016-04-29 12:20:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4GDMLWriteStructure
|
||||
@@ -65,6 +65,7 @@ class G4GDMLWriteStructure : public G4GDMLWriteParamvol
|
||||
void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume* const);
|
||||
|
||||
void SetEnergyCutsExport(G4bool);
|
||||
void SetSDExport(G4bool);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -81,6 +82,7 @@ class G4GDMLWriteStructure : public G4GDMLWriteParamvol
|
||||
const G4LogicalSkinSurface* GetSkinSurface(const G4LogicalVolume* const);
|
||||
G4bool FindOpticalSurface(const G4SurfaceProperty*);
|
||||
void ExportEnergyCuts(const G4LogicalVolume* const);
|
||||
void ExportSD(const G4LogicalVolume* const);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -94,6 +96,7 @@ class G4GDMLWriteStructure : public G4GDMLWriteParamvol
|
||||
std::vector<const G4OpticalSurface*> opt_vec;
|
||||
G4ReflectionFactory* reflFactory;
|
||||
G4bool cexport; // Flag for optional export of energy cuts per volume
|
||||
G4bool sdexport; // Flag for optional export of SD per volume
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:include schemaLocation="gdml_core.xsd"/>
|
||||
<xs:include schemaLocation="gdml_define.xsd"/>
|
||||
<xs:include schemaLocation="gdml_materials.xsd"/>
|
||||
@@ -198,7 +198,7 @@
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute fixed="2.10.0" name="version" type="xs:string">
|
||||
<xs:attribute fixed="3.1.4" name="version" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The GDML Schema version consists of 3 digits X.Y.Z
|
||||
where these mean:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xs:schema []>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
<xs:simpleType name="InlineExpressionType">
|
||||
<xs:restriction base="xs:string"></xs:restriction>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xs:schema>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!DOCTYPE xs:schema []>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:include schemaLocation="gdml_core.xsd"/>
|
||||
<xs:include schemaLocation="gdml_extensions.xsd"/>
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="loop">
|
||||
<xs:complexType>
|
||||
<xs:choice maxOccurs="unbounded">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xs:schema []>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="0.1" xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="0.1" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
<xs:include schemaLocation="gdml_core.xsd"></xs:include>
|
||||
<xs:include schemaLocation="gdml_define.xsd"></xs:include>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:include schemaLocation="gdml_define.xsd"/>
|
||||
<xs:include schemaLocation="gdml_extensions.xsd"/>
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:include schemaLocation="gdml_define.xsd"/>
|
||||
<xs:include schemaLocation="gdml_extensions.xsd"/>
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xs:schema>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://cern.ch/2001/Schemas/GDML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!DOCTYPE xs:schema []>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" version="1.0" xmlns:gdml="http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:include schemaLocation="gdml_core.xsd"></xs:include>
|
||||
<xs:include schemaLocation="gdml_define.xsd"></xs:include>
|
||||
<xs:include schemaLocation="gdml_extensions.xsd"/>
|
||||
@@ -53,7 +53,6 @@
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
<xs:complexType name="multiUnionNode">
|
||||
@@ -76,7 +75,6 @@
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
<xs:element name="multiUnion" substitutionGroup="Solid">
|
||||
@@ -96,7 +94,6 @@
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
<xs:element name="reflectedSolid" substitutionGroup="Solid">
|
||||
@@ -126,6 +123,28 @@
|
||||
</xs:element>
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
<xs:element name="scaledSolid" substitutionGroup="Solid">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Scaled solid:
|
||||
For the scale component, values must be greater than zero.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:complexContent>
|
||||
<xs:extension base="SolidType">
|
||||
<xs:sequence>
|
||||
<xs:element name="solidref" type="ReferenceType"></xs:element>
|
||||
<xs:choice minOccurs="1">
|
||||
<xs:element name="scale" type="scaleType"></xs:element>
|
||||
<xs:element name="scaleref" type="ReferenceType"></xs:element>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
||||
|
||||
<xs:complexType name="SurfacePropertyType">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Base surface type</xs:documentation>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake 89398 2015-04-09 09:56:29Z gcosmo $
|
||||
# $Id: sources.cmake 96673 2016-04-29 12:08:20Z gcosmo $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -49,6 +49,7 @@ include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/run/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/detector/include)
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLMessenger.cc 89381 2015-04-08 15:32:47Z gcosmo $
|
||||
// $Id: G4GDMLMessenger.cc 96673 2016-04-29 12:08:20Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4GDMLMessenger Implementation
|
||||
@@ -85,6 +85,13 @@ G4GDMLMessenger::G4GDMLMessenger(G4GDMLParser* myPars)
|
||||
EcutsCmd->SetDefaultValue(false);
|
||||
EcutsCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
SDCmd = new G4UIcmdWithABool("/persistency/gdml/export_SD",this);
|
||||
SDCmd->SetGuidance("Enable export of SD associated");
|
||||
SDCmd->SetGuidance("to logical volumes.");
|
||||
SDCmd->SetParameterName("export_SD",false);
|
||||
SDCmd->SetDefaultValue(false);
|
||||
SDCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
ClearCmd = new G4UIcmdWithoutParameter("/persistency/gdml/clear",this);
|
||||
ClearCmd->SetGuidance("Clear geometry (before reading a new one from GDML).");
|
||||
ClearCmd->AvailableForStates(G4State_Idle);
|
||||
@@ -98,6 +105,7 @@ G4GDMLMessenger::~G4GDMLMessenger()
|
||||
delete TopVolCmd;
|
||||
delete RegionCmd;
|
||||
delete EcutsCmd;
|
||||
delete SDCmd;
|
||||
delete persistencyDir;
|
||||
delete gdmlDir;
|
||||
}
|
||||
@@ -123,6 +131,12 @@ void G4GDMLMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
myParser->SetEnergyCutsExport(mode);
|
||||
}
|
||||
|
||||
if( command == SDCmd )
|
||||
{
|
||||
G4bool mode = SDCmd->GetNewBoolValue(newValue);
|
||||
myParser->SetSDExport(mode);
|
||||
}
|
||||
|
||||
if( command == TopVolCmd )
|
||||
{
|
||||
topvol = G4LogicalVolumeStore::GetInstance()->GetVolume(newValue);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLParser.cc 90041 2015-05-11 09:46:06Z gcosmo $
|
||||
// $Id: G4GDMLParser.cc 96190 2016-03-29 08:07:36Z gcosmo $
|
||||
//
|
||||
//
|
||||
// class G4GDMLParser Implementation
|
||||
@@ -121,6 +121,9 @@ void G4GDMLParser::ImportRegions()
|
||||
{
|
||||
const G4String& cvalue = raux->value;
|
||||
const G4String& cunit = raux->unit;
|
||||
if (G4UnitDefinition::GetCategory(cunit)!="Length") {
|
||||
G4Exception("G4GDMLParser::ImportRegions()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
G4double cut = eval.Evaluate(cvalue) * G4UnitDefinition::GetValueOf(cunit);
|
||||
pcuts->SetProductionCut(cut,"proton");
|
||||
} else
|
||||
@@ -128,6 +131,9 @@ void G4GDMLParser::ImportRegions()
|
||||
{
|
||||
const G4String& cvalue = raux->value;
|
||||
const G4String& cunit = raux->unit;
|
||||
if (G4UnitDefinition::GetCategory(cunit)!="Length") {
|
||||
G4Exception("G4GDMLParser::ImportRegions()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
G4double cut = eval.Evaluate(cvalue) * G4UnitDefinition::GetValueOf(cunit);
|
||||
pcuts->SetProductionCut(cut,"e-");
|
||||
} else
|
||||
@@ -135,6 +141,9 @@ void G4GDMLParser::ImportRegions()
|
||||
{
|
||||
const G4String& cvalue = raux->value;
|
||||
const G4String& cunit = raux->unit;
|
||||
if (G4UnitDefinition::GetCategory(cunit)!="Length") {
|
||||
G4Exception("G4GDMLParser::ImportRegions()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
G4double cut = eval.Evaluate(cvalue) * G4UnitDefinition::GetValueOf(cunit);
|
||||
pcuts->SetProductionCut(cut,"e+");
|
||||
} else
|
||||
@@ -142,6 +151,9 @@ void G4GDMLParser::ImportRegions()
|
||||
{
|
||||
const G4String& cvalue = raux->value;
|
||||
const G4String& cunit = raux->unit;
|
||||
if (G4UnitDefinition::GetCategory(cunit)!="Length") {
|
||||
G4Exception("G4GDMLParser::ImportRegions()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
G4double cut = eval.Evaluate(cvalue) * G4UnitDefinition::GetValueOf(cunit);
|
||||
pcuts->SetProductionCut(cut,"gamma");
|
||||
} else
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4GDMLReadDefine.cc 92977 2015-09-24 14:56:22Z gcosmo $
|
||||
// $Id: G4GDMLReadDefine.cc 96190 2016-03-29 08:07:36Z gcosmo $
|
||||
//
|
||||
// class G4GDMLReadDefine Implementation
|
||||
//
|
||||
@@ -299,7 +299,11 @@ G4GDMLReadDefine::PositionRead(const xercesc::DOMElement* const positionElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadDefine::PositionRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="x") { position.setX(eval.Evaluate(attValue)); } else
|
||||
if (attName=="y") { position.setY(eval.Evaluate(attValue)); } else
|
||||
if (attName=="z") { position.setZ(eval.Evaluate(attValue)); }
|
||||
@@ -338,8 +342,12 @@ G4GDMLReadDefine::RotationRead(const xercesc::DOMElement* const rotationElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="x") { rotation.setX(eval.Evaluate(attValue)); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadDefine::RotationRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="x") { rotation.setX(eval.Evaluate(attValue)); } else
|
||||
if (attName=="y") { rotation.setY(eval.Evaluate(attValue)); } else
|
||||
if (attName=="z") { rotation.setZ(eval.Evaluate(attValue)); }
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLReadMaterials.cc 89243 2015-03-27 16:24:39Z gcosmo $
|
||||
// $Id: G4GDMLReadMaterials.cc 96190 2016-03-29 08:07:36Z gcosmo $
|
||||
// GEANT4 tag $ Name:$
|
||||
//
|
||||
// class G4GDMLReadMaterials Implementation
|
||||
@@ -81,7 +81,11 @@ G4GDMLReadMaterials::AtomRead(const xercesc::DOMElement* const atomElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="value") { value = eval.Evaluate(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); }
|
||||
if (attName=="unit") {unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Molar mass") {
|
||||
G4Exception("G4GDMLReadMaterials::AtomRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for atomic mass!"); }
|
||||
}
|
||||
}
|
||||
|
||||
return value*unit;
|
||||
@@ -151,7 +155,12 @@ G4double G4GDMLReadMaterials::DRead(const xercesc::DOMElement* const DElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="value") { value = eval.Evaluate(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); }
|
||||
if (attName=="unit") {
|
||||
unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Volumic Mass") {
|
||||
G4Exception("G4GDMLReadMaterials::DRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for density!"); }
|
||||
}
|
||||
}
|
||||
|
||||
return value*unit;
|
||||
@@ -185,7 +194,11 @@ G4double G4GDMLReadMaterials::PRead(const xercesc::DOMElement* const PElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="value") { value = eval.Evaluate(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); }
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Pressure") {
|
||||
G4Exception("G4GDMLReadMaterials::PRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for pressure!"); }
|
||||
}
|
||||
}
|
||||
|
||||
return value*unit;
|
||||
@@ -219,7 +232,11 @@ G4double G4GDMLReadMaterials::TRead(const xercesc::DOMElement* const TElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="value") { value = eval.Evaluate(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); }
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Temperature") {
|
||||
G4Exception("G4GDMLReadMaterials::TRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for temperature!"); }
|
||||
}
|
||||
}
|
||||
|
||||
return value*unit;
|
||||
@@ -253,7 +270,11 @@ G4double G4GDMLReadMaterials::MEERead(const xercesc::DOMElement* const PElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="value") { value = eval.Evaluate(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); }
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Energy") {
|
||||
G4Exception("G4GDMLReadMaterials::MEERead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for energy!"); }
|
||||
}
|
||||
}
|
||||
|
||||
return value*unit;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4GDMLReadParamvol.cc 89243 2015-03-27 16:24:39Z gcosmo $
|
||||
// $Id: G4GDMLReadParamvol.cc 96190 2016-03-29 08:07:36Z gcosmo $
|
||||
//
|
||||
// class G4GDMLReadParamvol Implementation
|
||||
//
|
||||
@@ -76,7 +76,11 @@ Box_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attName = Transcode(attribute->getName());
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Box_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="x") { parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="y") { parameter.dimension[1] = eval.Evaluate(attValue); } else
|
||||
if (attName=="z") { parameter.dimension[2] = eval.Evaluate(attValue); }
|
||||
@@ -115,7 +119,11 @@ Trd_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attName = Transcode(attribute->getName());
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Trd_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="x1") { parameter.dimension[0]=eval.Evaluate(attValue); } else
|
||||
if (attName=="x2") { parameter.dimension[1]=eval.Evaluate(attValue); } else
|
||||
if (attName=="y1") { parameter.dimension[2]=eval.Evaluate(attValue); } else
|
||||
@@ -160,9 +168,17 @@ Trap_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="z")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="theta")
|
||||
@@ -230,9 +246,17 @@ Tube_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="InR")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="OutR")
|
||||
@@ -282,9 +306,17 @@ Cone_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Cone_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Cone_dimensions()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin1")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax1")
|
||||
@@ -340,9 +372,17 @@ Sphere_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax")
|
||||
@@ -393,7 +433,11 @@ Orb_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attName = Transcode(attribute->getName());
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); }
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Orb_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
else
|
||||
if (attName=="r") { parameter.dimension[0] = eval.Evaluate(attValue); }
|
||||
}
|
||||
|
||||
@@ -430,9 +474,17 @@ Torus_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax")
|
||||
@@ -480,7 +532,11 @@ Ellipsoid_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Ellipsoid_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="ax")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="by")
|
||||
@@ -530,9 +586,17 @@ Para_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="x")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="y")
|
||||
@@ -585,9 +649,17 @@ Hype_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax")
|
||||
@@ -639,9 +711,17 @@ Polycone_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="startPhi")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="openPhi")
|
||||
@@ -712,9 +792,17 @@ Polyhedra_dimensionsRead( const xercesc::DOMElement* const element,
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadParamvol::Polyhedra_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit")
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadParamvol::Polyhedra_dimensionsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="startPhi")
|
||||
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
|
||||
if (attName=="openPhi")
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4GDMLReadSolids.cc 93151 2015-10-08 11:53:10Z gcosmo $
|
||||
// $Id: G4GDMLReadSolids.cc 96190 2016-03-29 08:07:36Z gcosmo $
|
||||
//
|
||||
// class G4GDMLReadSolids Implementation
|
||||
//
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "G4Polyhedra.hh"
|
||||
#include "G4QuadrangularFacet.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
#include "G4ScaledSolid.hh"
|
||||
#include "G4Sphere.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
#include "G4SubtractionSolid.hh"
|
||||
@@ -206,8 +207,13 @@ void G4GDMLReadSolids::BoxRead(const xercesc::DOMElement* const boxElement)
|
||||
const G4String attName = Transcode(attribute->getName());
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::BoxRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
}
|
||||
else
|
||||
if (attName=="x") { x = eval.Evaluate(attValue); } else
|
||||
if (attName=="y") { y = eval.Evaluate(attValue); } else
|
||||
if (attName=="z") { z = eval.Evaluate(attValue); }
|
||||
@@ -256,9 +262,17 @@ void G4GDMLReadSolids::ConeRead(const xercesc::DOMElement* const coneElement)
|
||||
const G4String attName = Transcode(attribute->getName());
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::ConeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::ConeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin1") { rmin1 = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax1") { rmax1 = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmin2") { rmin2 = eval.Evaluate(attValue); } else
|
||||
@@ -313,7 +327,11 @@ ElconeRead(const xercesc::DOMElement* const elconeElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::ElconeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="dx") { dx = eval.Evaluate(attValue); } else
|
||||
if (attName=="dy") { dy = eval.Evaluate(attValue); } else
|
||||
if (attName=="zmax") { zmax = eval.Evaluate(attValue); } else
|
||||
@@ -361,7 +379,11 @@ EllipsoidRead(const xercesc::DOMElement* const ellipsoidElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::EllipsoidRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="ax") { ax = eval.Evaluate(attValue); } else
|
||||
if (attName=="by") { by = eval.Evaluate(attValue); } else
|
||||
if (attName=="cz") { cz = eval.Evaluate(attValue); } else
|
||||
@@ -411,7 +433,11 @@ EltubeRead(const xercesc::DOMElement* const eltubeElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::EltubeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="dx") { dx = eval.Evaluate(attValue); } else
|
||||
if (attName=="dy") { dy = eval.Evaluate(attValue); } else
|
||||
if (attName=="dz") { dz = eval.Evaluate(attValue); }
|
||||
@@ -453,7 +479,11 @@ void G4GDMLReadSolids::XtruRead(const xercesc::DOMElement* const xtruElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); }
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::XtruRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<G4TwoVector> twoDimVertexList;
|
||||
@@ -518,8 +548,16 @@ void G4GDMLReadSolids::HypeRead(const xercesc::DOMElement* const hypeElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::HypeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::HypeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
|
||||
if (attName=="inst") { inst = eval.Evaluate(attValue); } else
|
||||
@@ -717,7 +755,11 @@ void G4GDMLReadSolids::OrbRead(const xercesc::DOMElement* const orbElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::OrbRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="r") { r = eval.Evaluate(attValue); }
|
||||
}
|
||||
|
||||
@@ -762,9 +804,17 @@ void G4GDMLReadSolids::ParaRead(const xercesc::DOMElement* const paraElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="x") { x = eval.Evaluate(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::ParaRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::ParaRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="x") { x = eval.Evaluate(attValue); } else
|
||||
if (attName=="y") { y = eval.Evaluate(attValue); } else
|
||||
if (attName=="z") { z = eval.Evaluate(attValue); } else
|
||||
if (attName=="alpha") { alpha = eval.Evaluate(attValue); } else
|
||||
@@ -815,7 +865,11 @@ ParaboloidRead(const xercesc::DOMElement* const paraElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::ParaboloidRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="rlo") { rlo = eval.Evaluate(attValue); } else
|
||||
if (attName=="rhi") { rhi = eval.Evaluate(attValue); } else
|
||||
if (attName=="dz") { dz = eval.Evaluate(attValue); }
|
||||
@@ -861,8 +915,16 @@ PolyconeRead(const xercesc::DOMElement* const polyconeElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::PolyconeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::PolyconeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="startphi") { startphi = eval.Evaluate(attValue); }else
|
||||
if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); }
|
||||
}
|
||||
@@ -944,8 +1006,16 @@ GenericPolyconeRead(const xercesc::DOMElement* const polyconeElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::GenericPolyconeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::GenericPolyconeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="startphi") { startphi = eval.Evaluate(attValue); }else
|
||||
if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); }
|
||||
}
|
||||
@@ -1023,8 +1093,16 @@ PolyhedraRead(const xercesc::DOMElement* const polyhedraElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::PolyhedraRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::PolyhedraRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
|
||||
if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else
|
||||
if (attName=="numsides") { numsides = eval.EvaluateInteger(attValue); }
|
||||
@@ -1108,8 +1186,16 @@ GenericPolyhedraRead(const xercesc::DOMElement* const polyhedraElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
|
||||
if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else
|
||||
if (attName=="numsides") { numsides = eval.EvaluateInteger(attValue); }
|
||||
@@ -1198,8 +1284,12 @@ QuadrangularRead(const xercesc::DOMElement* const quadrangularElement)
|
||||
if (attName=="vertex4")
|
||||
{ vertex4 = GetPosition(GenerateName(attValue)); } else
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="type")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::QuadrangularRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="type")
|
||||
{ if (attValue=="RELATIVE") { type = RELATIVE; } }
|
||||
}
|
||||
|
||||
@@ -1242,8 +1332,16 @@ ReflectedSolidRead(const xercesc::DOMElement* const reflectedSolidElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::ReflectedSolidRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::ReflectedSolidRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="solid") { solid = GenerateName(attValue); } else
|
||||
if (attName=="sx") { scale.setX(eval.Evaluate(attValue)); } else
|
||||
if (attName=="sy") { scale.setY(eval.Evaluate(attValue)); } else
|
||||
@@ -1265,6 +1363,74 @@ ReflectedSolidRead(const xercesc::DOMElement* const reflectedSolidElement)
|
||||
new G4ReflectedSolid(name,GetSolid(solid),transform);
|
||||
}
|
||||
|
||||
void G4GDMLReadSolids::
|
||||
ScaledSolidRead(const xercesc::DOMElement* const scaledSolidElement)
|
||||
{
|
||||
G4String name;
|
||||
G4VSolid* solid=0;
|
||||
G4ThreeVector scale(1.0,1.0,1.0);
|
||||
|
||||
const xercesc::DOMNamedNodeMap* const attributes
|
||||
= scaledSolidElement->getAttributes();
|
||||
XMLSize_t attributeCount = attributes->getLength();
|
||||
|
||||
for (XMLSize_t attribute_index=0;
|
||||
attribute_index<attributeCount; attribute_index++)
|
||||
{
|
||||
xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
|
||||
|
||||
if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
|
||||
{ continue; }
|
||||
|
||||
const xercesc::DOMAttr* const attribute
|
||||
= dynamic_cast<xercesc::DOMAttr*>(attribute_node);
|
||||
if (!attribute)
|
||||
{
|
||||
G4Exception("G4GDMLReadSolids::ScaledSolidRead()",
|
||||
"InvalidRead", FatalException, "No attribute found!");
|
||||
return;
|
||||
}
|
||||
const G4String attName = Transcode(attribute->getName());
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); }
|
||||
}
|
||||
|
||||
for (xercesc::DOMNode* iter = scaledSolidElement->getFirstChild();
|
||||
iter != 0; iter = iter->getNextSibling())
|
||||
{
|
||||
if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
|
||||
|
||||
const xercesc::DOMElement* const child
|
||||
= dynamic_cast<xercesc::DOMElement*>(iter);
|
||||
if (!child)
|
||||
{
|
||||
G4Exception("G4GDMLReadSolids::ScaledSolidRead()",
|
||||
"InvalidRead", FatalException, "No child found!");
|
||||
return;
|
||||
}
|
||||
const G4String tag = Transcode(child->getTagName());
|
||||
|
||||
if (tag=="solidref")
|
||||
{ solid = GetSolid(GenerateName(RefRead(child))); }
|
||||
else if (tag=="scale")
|
||||
{ VectorRead(child,scale); }
|
||||
else if (tag=="scaleref")
|
||||
{ scale = GetScale(GenerateName(RefRead(child))); }
|
||||
else
|
||||
{
|
||||
G4String error_msg = "Unknown tag in scaled solid: " + tag;
|
||||
G4Exception("G4GDMLReadSolids::ScaledSolidRead()", "ReadError",
|
||||
FatalException, error_msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
G4Scale3D transform = G4Scale3D(scale.x(),scale.y(),scale.z());
|
||||
|
||||
new G4ScaledSolid(name, solid ,transform);
|
||||
}
|
||||
|
||||
G4ExtrudedSolid::ZSection G4GDMLReadSolids::
|
||||
SectionRead(const xercesc::DOMElement* const sectionElement,G4double lunit)
|
||||
{
|
||||
@@ -1345,8 +1511,16 @@ SphereRead(const xercesc::DOMElement* const sphereElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::SphereRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::SphereRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
|
||||
if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
|
||||
@@ -1457,7 +1631,11 @@ void G4GDMLReadSolids::TetRead(const xercesc::DOMElement* const tetElement)
|
||||
if (attName=="name")
|
||||
{ name = GenerateName(attValue); } else
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TetRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="vertex1")
|
||||
{ vertex1 = GetPosition(GenerateName(attValue)); } else
|
||||
if (attName=="vertex2")
|
||||
@@ -1506,8 +1684,16 @@ void G4GDMLReadSolids::TorusRead(const xercesc::DOMElement* const torusElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TorusRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::TorusRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
|
||||
if (attName=="rtor") { rtor = eval.Evaluate(attValue); } else
|
||||
@@ -1558,7 +1744,11 @@ GenTrapRead(const xercesc::DOMElement* const gtrapElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::GenTrapRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="dz") { dz = eval.Evaluate(attValue); } else
|
||||
if (attName=="v1x") { v1x = eval.Evaluate(attValue); } else
|
||||
if (attName=="v1y") { v1y = eval.Evaluate(attValue); } else
|
||||
@@ -1632,8 +1822,16 @@ void G4GDMLReadSolids::TrapRead(const xercesc::DOMElement* const trapElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TrapRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::TrapRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="z") { z = eval.Evaluate(attValue); } else
|
||||
if (attName=="theta") { theta = eval.Evaluate(attValue); } else
|
||||
if (attName=="phi") { phi = eval.Evaluate(attValue); } else
|
||||
@@ -1695,7 +1893,11 @@ void G4GDMLReadSolids::TrdRead(const xercesc::DOMElement* const trdElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TrdRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="x1") { x1 = eval.Evaluate(attValue); } else
|
||||
if (attName=="x2") { x2 = eval.Evaluate(attValue); } else
|
||||
if (attName=="y1") { y1 = eval.Evaluate(attValue); } else
|
||||
@@ -1751,7 +1953,11 @@ TriangularRead(const xercesc::DOMElement* const triangularElement)
|
||||
if (attName=="vertex3")
|
||||
{ vertex3 = GetPosition(GenerateName(attValue)); } else
|
||||
if (attName=="lunit")
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
{ lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TriangularRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="type")
|
||||
{ if (attValue=="RELATIVE") { type = RELATIVE; } }
|
||||
}
|
||||
@@ -1794,8 +2000,16 @@ void G4GDMLReadSolids::TubeRead(const xercesc::DOMElement* const tubeElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TubeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::TubeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
|
||||
if (attName=="z") { z = eval.Evaluate(attValue); } else
|
||||
@@ -1849,8 +2063,16 @@ void G4GDMLReadSolids::CutTubeRead(const xercesc::DOMElement* const cuttubeEleme
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::CutTubeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::CutTubeRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
|
||||
if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
|
||||
if (attName=="z") { z = eval.Evaluate(attValue); } else
|
||||
@@ -1909,8 +2131,16 @@ TwistedboxRead(const xercesc::DOMElement* const twistedboxElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TwistedBoxRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::TwistedboxRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="PhiTwist") { PhiTwist = eval.Evaluate(attValue); } else
|
||||
if (attName=="x") { x = eval.Evaluate(attValue); } else
|
||||
if (attName=="y") { y = eval.Evaluate(attValue); } else
|
||||
@@ -1967,8 +2197,16 @@ TwistedtrapRead(const xercesc::DOMElement* const twistedtrapElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TwistedtrapRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::TwistedtrapRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="PhiTwist") { PhiTwist = eval.Evaluate(attValue); } else
|
||||
if (attName=="z") { z = eval.Evaluate(attValue); } else
|
||||
if (attName=="Theta") { Theta = eval.Evaluate(attValue); } else
|
||||
@@ -2035,8 +2273,16 @@ TwistedtrdRead(const xercesc::DOMElement* const twistedtrdElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TwistedtrdRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::TwistedtrdRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="x1") { x1 = eval.Evaluate(attValue); } else
|
||||
if (attName=="x2") { x2 = eval.Evaluate(attValue); } else
|
||||
if (attName=="y1") { y1 = eval.Evaluate(attValue); } else
|
||||
@@ -2091,8 +2337,16 @@ TwistedtubsRead(const xercesc::DOMElement* const twistedtubsElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = GenerateName(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadSolids::TwistedtubsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
|
||||
G4Exception("G4GDMLReadSolids::TwistedtubsRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for angle!"); }
|
||||
} else
|
||||
if (attName=="twistedangle") { twistedangle=eval.Evaluate(attValue); } else
|
||||
if (attName=="endinnerrad") { endinnerrad=eval.Evaluate(attValue); } else
|
||||
if (attName=="endouterrad") { endouterrad=eval.Evaluate(attValue); } else
|
||||
@@ -2371,6 +2625,7 @@ void G4GDMLReadSolids::SolidsRead(const xercesc::DOMElement* const solidsElement
|
||||
if (tag=="polyhedra") { PolyhedraRead(child); } else
|
||||
if (tag=="genericPolyhedra") { GenericPolyhedraRead(child); } else
|
||||
if (tag=="reflectedSolid") { ReflectedSolidRead(child); } else
|
||||
if (tag=="scaledSolid") { ScaledSolidRead(child); } else
|
||||
if (tag=="sphere") { SphereRead(child); } else
|
||||
if (tag=="subtraction") { BooleanRead(child,SUBTRACTION); } else
|
||||
if (tag=="tessellated") { TessellatedRead(child); } else
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4GDMLReadStructure.cc 91689 2015-07-31 09:58:27Z gcosmo $
|
||||
// $Id: G4GDMLReadStructure.cc 96190 2016-03-29 08:07:36Z gcosmo $
|
||||
//
|
||||
// class G4GDMLReadStructure Implementation
|
||||
//
|
||||
@@ -156,7 +156,11 @@ DivisionvolRead(const xercesc::DOMElement* const divisionvolElement)
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="name") { name = attValue; } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadStructure::DivisionvolRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="width") { width = eval.Evaluate(attValue); } else
|
||||
if (attName=="offset") { offset = eval.Evaluate(attValue); } else
|
||||
if (attName=="number") { number = eval.EvaluateInteger(attValue); } else
|
||||
@@ -550,7 +554,11 @@ QuantityRead(const xercesc::DOMElement* const readElement)
|
||||
const G4String attName = Transcode(attribute->getName());
|
||||
const G4String attValue = Transcode(attribute->getValue());
|
||||
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue); } else
|
||||
if (attName=="unit") { unit = G4UnitDefinition::GetValueOf(attValue);
|
||||
if (G4UnitDefinition::GetCategory(attValue)!="Length") {
|
||||
G4Exception("G4GDMLReadStructure::QuantityRead()", "InvalidRead",
|
||||
FatalException, "Invalid unit for length!"); }
|
||||
} else
|
||||
if (attName=="value"){ value= eval.Evaluate(attValue); }
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLWrite.cc 89243 2015-03-27 16:24:39Z gcosmo $
|
||||
// $Id: G4GDMLWrite.cc 96170 2016-03-22 09:17:29Z gcosmo $
|
||||
//
|
||||
// class G4GDMLWrite Implementation
|
||||
//
|
||||
@@ -136,9 +136,9 @@ G4String G4GDMLWrite::GenerateName(const G4String& name, const void* const ptr)
|
||||
xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
|
||||
const G4String& value)
|
||||
{
|
||||
xercesc::XMLString::transcode(name,tempStr,99);
|
||||
xercesc::XMLString::transcode(name,tempStr,9999);
|
||||
xercesc::DOMAttr* att = doc->createAttribute(tempStr);
|
||||
xercesc::XMLString::transcode(value,tempStr,99);
|
||||
xercesc::XMLString::transcode(value,tempStr,9999);
|
||||
att->setValue(tempStr);
|
||||
return att;
|
||||
}
|
||||
@@ -146,20 +146,20 @@ xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
|
||||
xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
|
||||
const G4double& value)
|
||||
{
|
||||
xercesc::XMLString::transcode(name,tempStr,99);
|
||||
xercesc::XMLString::transcode(name,tempStr,9999);
|
||||
xercesc::DOMAttr* att = doc->createAttribute(tempStr);
|
||||
std::ostringstream ostream;
|
||||
ostream.precision(15);
|
||||
ostream << value;
|
||||
G4String str = ostream.str();
|
||||
xercesc::XMLString::transcode(str,tempStr,99);
|
||||
xercesc::XMLString::transcode(str,tempStr,9999);
|
||||
att->setValue(tempStr);
|
||||
return att;
|
||||
}
|
||||
|
||||
xercesc::DOMElement* G4GDMLWrite::NewElement(const G4String& name)
|
||||
{
|
||||
xercesc::XMLString::transcode(name,tempStr,99);
|
||||
xercesc::XMLString::transcode(name,tempStr,9999);
|
||||
return doc->createElement(tempStr);
|
||||
}
|
||||
|
||||
@@ -185,12 +185,12 @@ G4Transform3D G4GDMLWrite::Write(const G4String& fname,
|
||||
VolumeMap().clear(); // The module map is global for all modules,
|
||||
// so clear it only at once!
|
||||
|
||||
xercesc::XMLString::transcode("LS", tempStr, 99);
|
||||
xercesc::XMLString::transcode("LS", tempStr, 9999);
|
||||
xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
|
||||
xercesc::XMLString::transcode("Range", tempStr, 99);
|
||||
xercesc::XMLString::transcode("Range", tempStr, 9999);
|
||||
xercesc::DOMImplementation* impl =
|
||||
xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
|
||||
xercesc::XMLString::transcode("gdml", tempStr, 99);
|
||||
xercesc::XMLString::transcode("gdml", tempStr, 9999);
|
||||
doc = impl->createDocument(0,tempStr,0);
|
||||
xercesc::DOMElement* gdml = doc->getDocumentElement();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLWriteSolids.cc 93151 2015-10-08 11:53:10Z gcosmo $
|
||||
// $Id: G4GDMLWriteSolids.cc 96133 2016-03-16 22:21:17Z gcosmo $
|
||||
//
|
||||
// class G4GDMLWriteSolids Implementation
|
||||
//
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4BooleanSolid.hh"
|
||||
#include "G4ScaledSolid.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Ellipsoid.hh"
|
||||
@@ -265,6 +266,39 @@ BooleanWrite(xercesc::DOMElement* solElement,
|
||||
}
|
||||
}
|
||||
|
||||
void G4GDMLWriteSolids::
|
||||
ScaledWrite(xercesc::DOMElement* solElement,
|
||||
const G4ScaledSolid* const scaled)
|
||||
{
|
||||
G4String tag("scaledSolid");
|
||||
|
||||
G4VSolid* solid = const_cast<G4VSolid*>(scaled->GetUnscaledSolid());
|
||||
G4Scale3D scale = scaled->GetScaleTransform();
|
||||
G4ThreeVector sclVector = G4ThreeVector(scale.xx(), scale.yy(), scale.zz());
|
||||
|
||||
AddSolid(solid); // Add the constituent solid!
|
||||
|
||||
const G4String& name = GenerateName(scaled->GetName(),scaled);
|
||||
const G4String& solidref = GenerateName(solid->GetName(),solid);
|
||||
|
||||
xercesc::DOMElement* scaledElement = NewElement(tag);
|
||||
scaledElement->setAttributeNode(NewAttribute("name",name));
|
||||
|
||||
xercesc::DOMElement* solidElement = NewElement("solidref");
|
||||
solidElement->setAttributeNode(NewAttribute("ref",solidref));
|
||||
scaledElement->appendChild(solidElement);
|
||||
|
||||
if ( (std::fabs(scale.xx()) > kLinearPrecision)
|
||||
&& (std::fabs(scale.yy()) > kLinearPrecision)
|
||||
&& (std::fabs(scale.zz()) > kLinearPrecision) )
|
||||
{
|
||||
ScaleWrite(scaledElement, name+"_scl", sclVector);
|
||||
}
|
||||
|
||||
solElement->appendChild(scaledElement);
|
||||
// Add the scaled solid AFTER its constituent solid!
|
||||
}
|
||||
|
||||
void G4GDMLWriteSolids::
|
||||
BoxWrite(xercesc::DOMElement* solElement, const G4Box* const box)
|
||||
{
|
||||
@@ -1041,6 +1075,9 @@ void G4GDMLWriteSolids::AddSolid(const G4VSolid* const solidPtr)
|
||||
if (const G4BooleanSolid* const booleanPtr
|
||||
= dynamic_cast<const G4BooleanSolid*>(solidPtr))
|
||||
{ BooleanWrite(solidsElement,booleanPtr); } else
|
||||
if (const G4ScaledSolid* const scaledPtr
|
||||
= dynamic_cast<const G4ScaledSolid*>(solidPtr))
|
||||
{ ScaledWrite(solidsElement,scaledPtr); } else
|
||||
if (solidPtr->GetEntityType()=="G4MultiUnion")
|
||||
{ const G4MultiUnion* const munionPtr
|
||||
= static_cast<const G4MultiUnion*>(solidPtr);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GDMLWriteStructure.cc 91789 2015-08-06 08:14:46Z gcosmo $
|
||||
// $Id: G4GDMLWriteStructure.cc 96677 2016-04-29 12:20:20Z gcosmo $
|
||||
//
|
||||
// class G4GDMLWriteStructure Implementation
|
||||
//
|
||||
@@ -55,6 +55,8 @@
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Proton.hh"
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
G4GDMLWriteStructure::G4GDMLWriteStructure()
|
||||
: G4GDMLWriteParamvol(), cexport(false)
|
||||
{
|
||||
@@ -527,7 +529,10 @@ TraverseVolumeTree(const G4LogicalVolume* const volumePtr, const G4int depth)
|
||||
|
||||
if (cexport) { ExportEnergyCuts(volumePtr); }
|
||||
// Add optional energy cuts
|
||||
|
||||
|
||||
if (sdexport) { ExportSD(volumePtr); }
|
||||
// Add optional SDs
|
||||
|
||||
// Here write the auxiliary info
|
||||
//
|
||||
auxiter = auxmap.find(volumePtr);
|
||||
@@ -607,3 +612,24 @@ G4GDMLWriteStructure::ExportEnergyCuts(const G4LogicalVolume* const lvol)
|
||||
AddVolumeAuxiliary(eplusinfo, lvol);
|
||||
AddVolumeAuxiliary(protinfo, lvol);
|
||||
}
|
||||
|
||||
void
|
||||
G4GDMLWriteStructure::SetSDExport(G4bool fsd)
|
||||
{
|
||||
sdexport = fsd;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
G4GDMLWriteStructure::ExportSD(const G4LogicalVolume* const lvol)
|
||||
{
|
||||
G4VSensitiveDetector* sd = lvol->GetSensitiveDetector();
|
||||
|
||||
if(sd)
|
||||
{
|
||||
G4String SDname = sd->GetName();
|
||||
|
||||
G4GDMLAuxStructType SDinfo = {"SensDet", SDname, "", 0};
|
||||
AddVolumeAuxiliary(SDinfo, lvol);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user