Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Attributes
G4GDMLReadParamvol Class Referenceabstract

#include <G4GDMLReadParamvol.hh>

Inheritance diagram for G4GDMLReadParamvol:
G4GDMLReadSetup G4GDMLReadSolids G4GDMLReadMaterials G4GDMLReadDefine G4GDMLRead G4GDMLReadStructure

Public Member Functions

virtual void DefineRead (const xercesc::DOMElement *const)
 
virtual void ExtensionRead (const xercesc::DOMElement *const)
 
const G4GDMLAuxListTypeGetAuxList () const
 
G4double GetConstant (const G4String &)
 
G4ElementGetElement (const G4String &, G4bool verbose=true) const
 
G4IsotopeGetIsotope (const G4String &, G4bool verbose=true) const
 
G4MaterialGetMaterial (const G4String &, G4bool verbose=true) const
 
G4GDMLMatrix GetMatrix (const G4String &)
 
G4ThreeVector GetPosition (const G4String &)
 
G4double GetQuantity (const G4String &)
 
G4ThreeVector GetRotation (const G4String &)
 
G4ThreeVector GetScale (const G4String &)
 
G4String GetSetup (const G4String &)
 
G4VSolidGetSolid (const G4String &) const
 
G4SurfacePropertyGetSurfaceProperty (const G4String &) const
 
G4double GetVariable (const G4String &)
 
virtual G4LogicalVolumeGetVolume (const G4String &) const =0
 
G4bool IsValidID (const G4String &) const
 
virtual void MaterialsRead (const xercesc::DOMElement *const)
 
void OverlapCheck (G4bool)
 
virtual void Paramvol_contentRead (const xercesc::DOMElement *const)
 
virtual void ParamvolRead (const xercesc::DOMElement *const, G4LogicalVolume *)
 
void Read (const G4String &, G4bool validation, G4bool isModule, G4bool strip=true)
 
void SetReverseSearch (G4bool flag)
 
virtual void SetupRead (const xercesc::DOMElement *const element)
 
virtual void SolidsRead (const xercesc::DOMElement *const)
 
void StripName (G4String &) const
 
void StripNames () const
 
virtual void StructureRead (const xercesc::DOMElement *const)=0
 
virtual void UserinfoRead (const xercesc::DOMElement *const)
 
virtual void Volume_contentRead (const xercesc::DOMElement *const)=0
 

Protected Member Functions

G4double AtomRead (const xercesc::DOMElement *const)
 
G4GDMLAuxStructType AuxiliaryRead (const xercesc::DOMElement *const auxElem)
 
void BooleanRead (const xercesc::DOMElement *const, const BooleanOp)
 
void Box_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void BoxRead (const xercesc::DOMElement *const)
 
G4int CompositeRead (const xercesc::DOMElement *const, G4String &)
 
void Cone_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void ConeRead (const xercesc::DOMElement *const)
 
void ConstantRead (const xercesc::DOMElement *const)
 
void CutTubeRead (const xercesc::DOMElement *const)
 
G4double DRead (const xercesc::DOMElement *const)
 
void ElconeRead (const xercesc::DOMElement *const)
 
void ElementRead (const xercesc::DOMElement *const)
 
void Ellipsoid_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void EllipsoidRead (const xercesc::DOMElement *const)
 
void EltubeRead (const xercesc::DOMElement *const)
 
void ExpressionRead (const xercesc::DOMElement *const)
 
G4double FractionRead (const xercesc::DOMElement *const, G4String &)
 
 G4GDMLReadParamvol ()
 
G4String GenerateName (const G4String &name, G4bool strip=false)
 
void GeneratePhysvolName (const G4String &, G4VPhysicalVolume *)
 
void GenericPolyconeRead (const xercesc::DOMElement *const)
 
void GenericPolyhedraRead (const xercesc::DOMElement *const)
 
void GenTrapRead (const xercesc::DOMElement *const)
 
G4RotationMatrix GetRotationMatrix (const G4ThreeVector &)
 
void Hype_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void HypeRead (const xercesc::DOMElement *const)
 
void IsotopeRead (const xercesc::DOMElement *const)
 
void LoopRead (const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
 
void MaterialRead (const xercesc::DOMElement *const)
 
void MatrixRead (const xercesc::DOMElement *const)
 
G4double MEERead (const xercesc::DOMElement *const)
 
void MixtureRead (const xercesc::DOMElement *const, G4Element *)
 
void MixtureRead (const xercesc::DOMElement *const, G4Material *)
 
void MultiUnionNodeRead (const xercesc::DOMElement *const, G4MultiUnion *const)
 
void MultiUnionRead (const xercesc::DOMElement *const)
 
void OpticalSurfaceRead (const xercesc::DOMElement *const)
 
void Orb_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void OrbRead (const xercesc::DOMElement *const)
 
void Para_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void ParaboloidRead (const xercesc::DOMElement *const)
 
void ParameterisedRead (const xercesc::DOMElement *const)
 
void ParametersRead (const xercesc::DOMElement *const)
 
void ParaRead (const xercesc::DOMElement *const)
 
void Polycone_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void PolyconeRead (const xercesc::DOMElement *const)
 
void Polyhedra_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void PolyhedraRead (const xercesc::DOMElement *const)
 
void PositionRead (const xercesc::DOMElement *const)
 
G4double PRead (const xercesc::DOMElement *const)
 
void PropertyRead (const xercesc::DOMElement *const, G4Material *)
 
void PropertyRead (const xercesc::DOMElement *const, G4OpticalSurface *)
 
G4QuadrangularFacetQuadrangularRead (const xercesc::DOMElement *const)
 
void QuantityRead (const xercesc::DOMElement *const)
 
void ReflectedSolidRead (const xercesc::DOMElement *const)
 
G4String RefRead (const xercesc::DOMElement *const)
 
void RotationRead (const xercesc::DOMElement *const)
 
rzPointType RZPointRead (const xercesc::DOMElement *const)
 
void ScaledSolidRead (const xercesc::DOMElement *const)
 
void ScaleRead (const xercesc::DOMElement *const)
 
G4ExtrudedSolid::ZSection SectionRead (const xercesc::DOMElement *const, G4double)
 
void Sphere_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void SphereRead (const xercesc::DOMElement *const)
 
G4String Strip (const G4String &) const
 
void TessellatedRead (const xercesc::DOMElement *const)
 
void TetRead (const xercesc::DOMElement *const)
 
void Torus_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void TorusRead (const xercesc::DOMElement *const)
 
G4String Transcode (const XMLCh *const)
 
void Trap_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void TrapRead (const xercesc::DOMElement *const)
 
void Trd_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void TrdRead (const xercesc::DOMElement *const)
 
G4double TRead (const xercesc::DOMElement *const)
 
G4TriangularFacetTriangularRead (const xercesc::DOMElement *const)
 
void Tube_dimensionsRead (const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
 
void TubeRead (const xercesc::DOMElement *const)
 
void TwistedboxRead (const xercesc::DOMElement *const)
 
void TwistedtrapRead (const xercesc::DOMElement *const)
 
void TwistedtrdRead (const xercesc::DOMElement *const)
 
void TwistedtubsRead (const xercesc::DOMElement *const)
 
G4TwoVector TwoDimVertexRead (const xercesc::DOMElement *const, G4double)
 
void VariableRead (const xercesc::DOMElement *const)
 
void VectorRead (const xercesc::DOMElement *const, G4ThreeVector &)
 
void XtruRead (const xercesc::DOMElement *const)
 
zplaneType ZplaneRead (const xercesc::DOMElement *const)
 
virtual ~G4GDMLReadParamvol ()
 

Protected Attributes

G4bool check = false
 
G4bool dostrip = true
 
G4GDMLEvaluator eval
 
std::map< G4String, G4GDMLMatrixmatrixMap
 
G4GDMLParameterisationparameterisation = nullptr
 
std::map< G4String, G4ThreeVectorpositionMap
 
std::map< G4String, G4doublequantityMap
 
G4bool reverseSearch = false
 
std::map< G4String, G4ThreeVectorrotationMap
 
std::map< G4String, G4ThreeVectorscaleMap
 
std::map< G4String, G4StringsetupMap
 
G4bool validate = true
 

Private Types

enum  BooleanOp { UNION , SUBTRACTION , INTERSECTION }
 

Private Attributes

G4GDMLAuxListType auxGlobalList
 
G4int inLoop = 0
 
G4int loopCount = 0
 
std::map< G4String, G4MaterialPropertyVector * > mapOfMatPropVects
 

Detailed Description

Definition at line 42 of file G4GDMLReadParamvol.hh.

Member Enumeration Documentation

◆ BooleanOp

enum G4GDMLReadSolids::BooleanOp
privateinherited
Enumerator
UNION 
SUBTRACTION 
INTERSECTION 

Definition at line 51 of file G4GDMLReadSolids.hh.

Constructor & Destructor Documentation

◆ G4GDMLReadParamvol()

G4GDMLReadParamvol::G4GDMLReadParamvol ( )
protected

Definition at line 40 of file G4GDMLReadParamvol.cc.

42{
43}

◆ ~G4GDMLReadParamvol()

G4GDMLReadParamvol::~G4GDMLReadParamvol ( )
protectedvirtual

Definition at line 45 of file G4GDMLReadParamvol.cc.

46{
47}

Member Function Documentation

◆ AtomRead()

G4double G4GDMLReadMaterials::AtomRead ( const xercesc::DOMElement * const  atomElement)
protectedinherited

Definition at line 53 of file G4GDMLReadMaterials.cc.

55{
56 G4double value = 0.0;
57 G4double unit = g / mole;
58
59 const xercesc::DOMNamedNodeMap* const attributes =
60 atomElement->getAttributes();
61 XMLSize_t attributeCount = attributes->getLength();
62
63 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
64 ++attribute_index)
65 {
66 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
67
68 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
69 {
70 continue;
71 }
72
73 const xercesc::DOMAttr* const attribute =
74 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
75 if(attribute == nullptr)
76 {
77 G4Exception("G4GDMLReadMaterials::AtomRead()", "InvalidRead",
78 FatalException, "No attribute found!");
79 return value;
80 }
81 const G4String attName = Transcode(attribute->getName());
82 const G4String attValue = Transcode(attribute->getValue());
83
84 if(attName == "value")
85 {
86 value = eval.Evaluate(attValue);
87 }
88 else if(attName == "unit")
89 {
90 unit = G4UnitDefinition::GetValueOf(attValue);
91 if(G4UnitDefinition::GetCategory(attValue) != "Molar mass")
92 {
93 G4Exception("G4GDMLReadMaterials::AtomRead()", "InvalidRead",
94 FatalException, "Invalid unit for atomic mass!");
95 }
96 }
97 }
98
99 return value * unit;
100}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static constexpr double mole
Definition: G4SIunits.hh:279
static constexpr double g
Definition: G4SIunits.hh:168
double G4double
Definition: G4Types.hh:83
G4double Evaluate(const G4String &)
G4String Transcode(const XMLCh *const)
Definition: G4GDMLRead.cc:55
G4GDMLEvaluator eval
Definition: G4GDMLRead.hh:156
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, g, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), mole, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::ElementRead(), G4GDMLReadMaterials::IsotopeRead(), and G4GDMLReadMaterials::MaterialRead().

◆ AuxiliaryRead()

G4GDMLAuxStructType G4GDMLRead::AuxiliaryRead ( const xercesc::DOMElement *const  auxElem)
protectedinherited

Definition at line 295 of file G4GDMLRead.cc.

297{
298 G4GDMLAuxStructType auxstruct = { "", "", "", 0 };
299 G4GDMLAuxListType* auxList = nullptr;
300
301 const xercesc::DOMNamedNodeMap* const attributes =
302 auxiliaryElement->getAttributes();
303 XMLSize_t attributeCount = attributes->getLength();
304
305 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
306 ++attribute_index)
307 {
308 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
309
310 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
311 {
312 continue;
313 }
314
315 const xercesc::DOMAttr* const attribute =
316 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
317 if(!attribute)
318 {
319 G4Exception("G4GDMLRead::AuxiliaryRead()", "InvalidRead", FatalException,
320 "No attribute found!");
321 return auxstruct;
322 }
323 const G4String attName = Transcode(attribute->getName());
324 const G4String attValue = Transcode(attribute->getValue());
325
326 if(attName == "auxtype")
327 {
328 auxstruct.type = attValue;
329 }
330 else if(attName == "auxvalue")
331 {
332 auxstruct.value = attValue;
333 }
334 else if(attName == "auxunit")
335 {
336 auxstruct.unit = attValue;
337 }
338 }
339
340 for(xercesc::DOMNode* iter = auxiliaryElement->getFirstChild();
341 iter != nullptr; iter = iter->getNextSibling())
342 {
343 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
344 {
345 continue;
346 }
347
348 const xercesc::DOMElement* const child =
349 dynamic_cast<xercesc::DOMElement*>(iter);
350 if(!child)
351 {
352 G4Exception("G4GDMLRead::AuxiliaryRead()", "InvalidRead", FatalException,
353 "No child found!");
354 break;
355 }
356 const G4String tag = Transcode(child->getTagName());
357
358 if(tag == "auxiliary")
359 {
360 if(!auxList)
361 {
362 auxList = new G4GDMLAuxListType;
363 }
364 auxList->push_back(AuxiliaryRead(child));
365 }
366 }
367
368 if(auxList)
369 {
370 auxstruct.auxList = auxList;
371 }
372
373 return auxstruct;
374}
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
G4GDMLAuxStructType AuxiliaryRead(const xercesc::DOMElement *const auxElem)
Definition: G4GDMLRead.cc:295
std::vector< G4GDMLAuxStructType > * auxList
Definition: xmlparse.cc:187

References G4GDMLRead::AuxiliaryRead(), G4GDMLAuxStructType::auxList, FatalException, G4Exception(), G4GDMLRead::Transcode(), G4GDMLAuxStructType::type, G4GDMLAuxStructType::unit, and G4GDMLAuxStructType::value.

Referenced by G4GDMLRead::AuxiliaryRead(), G4GDMLRead::UserinfoRead(), and G4GDMLReadStructure::VolumeRead().

◆ BooleanRead()

void G4GDMLReadSolids::BooleanRead ( const xercesc::DOMElement * const  booleanElement,
const BooleanOp  op 
)
protectedinherited

Definition at line 82 of file G4GDMLReadSolids.cc.

84{
86 G4String first;
87 G4String scnd;
88 G4ThreeVector position(0.0, 0.0, 0.0);
89 G4ThreeVector rotation(0.0, 0.0, 0.0);
90 G4ThreeVector firstposition(0.0, 0.0, 0.0);
91 G4ThreeVector firstrotation(0.0, 0.0, 0.0);
92
93 const xercesc::DOMNamedNodeMap* const attributes =
94 booleanElement->getAttributes();
95 XMLSize_t attributeCount = attributes->getLength();
96
97 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
98 ++attribute_index)
99 {
100 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
101
102 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
103 {
104 continue;
105 }
106
107 const xercesc::DOMAttr* const attribute =
108 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
109 if(attribute == nullptr)
110 {
111 G4Exception("G4GDMLReadSolids::BooleanRead()", "InvalidRead",
112 FatalException, "No attribute found!");
113 return;
114 }
115 const G4String attName = Transcode(attribute->getName());
116 const G4String attValue = Transcode(attribute->getValue());
117
118 if(attName == "name")
119 {
120 name = GenerateName(attValue);
121 }
122 }
123
124 for(xercesc::DOMNode* iter = booleanElement->getFirstChild(); iter != nullptr;
125 iter = iter->getNextSibling())
126 {
127 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
128 {
129 continue;
130 }
131
132 const xercesc::DOMElement* const child =
133 dynamic_cast<xercesc::DOMElement*>(iter);
134 if(child == nullptr)
135 {
136 G4Exception("G4GDMLReadSolids::BooleanRead()", "InvalidRead",
137 FatalException, "No child found!");
138 return;
139 }
140 const G4String tag = Transcode(child->getTagName());
141
142 if(tag == "first")
143 {
144 first = RefRead(child);
145 }
146 else if(tag == "second")
147 {
148 scnd = RefRead(child);
149 }
150 else if(tag == "position")
151 {
152 VectorRead(child, position);
153 }
154 else if(tag == "rotation")
155 {
156 VectorRead(child, rotation);
157 }
158 else if(tag == "positionref")
159 {
161 }
162 else if(tag == "rotationref")
163 {
164 rotation = GetRotation(GenerateName(RefRead(child)));
165 }
166 else if(tag == "firstposition")
167 {
168 VectorRead(child, firstposition);
169 }
170 else if(tag == "firstrotation")
171 {
172 VectorRead(child, firstrotation);
173 }
174 else if(tag == "firstpositionref")
175 {
176 firstposition = GetPosition(GenerateName(RefRead(child)));
177 }
178 else if(tag == "firstrotationref")
179 {
180 firstrotation = GetRotation(GenerateName(RefRead(child)));
181 }
182 else
183 {
184 G4String error_msg = "Unknown tag in boolean solid: " + tag;
185 G4Exception("G4GDMLReadSolids::BooleanRead()", "ReadError",
186 FatalException, error_msg);
187 }
188 }
189
190 G4VSolid* firstSolid = GetSolid(GenerateName(first));
191 G4VSolid* secondSolid = GetSolid(GenerateName(scnd));
192
194
195 if(((firstrotation.x() != 0.0) || (firstrotation.y() != 0.0) ||
196 (firstrotation.z() != 0.0)) ||
197 ((firstposition.x() != 0.0) || (firstposition.y() != 0.0) ||
198 (firstposition.z() != 0.0)))
199 {
200 G4Transform3D firsttransform(GetRotationMatrix(firstrotation),
201 firstposition);
202 firstSolid = new G4DisplacedSolid(GenerateName("displaced_" + first),
203 firstSolid, firsttransform);
204 }
205
206 if(op == UNION)
207 {
208 new G4UnionSolid(name, firstSolid, secondSolid, transform);
209 }
210 else if(op == SUBTRACTION)
211 {
212 new G4SubtractionSolid(name, firstSolid, secondSolid, transform);
213 }
214 else if(op == INTERSECTION)
215 {
216 new G4IntersectionSolid(name, firstSolid, secondSolid, transform);
217 }
218}
void VectorRead(const xercesc::DOMElement *const, G4ThreeVector &)
G4RotationMatrix GetRotationMatrix(const G4ThreeVector &)
G4ThreeVector GetPosition(const G4String &)
G4String RefRead(const xercesc::DOMElement *const)
G4ThreeVector GetRotation(const G4String &)
G4VSolid * GetSolid(const G4String &) const
G4String GenerateName(const G4String &name, G4bool strip=false)
Definition: G4GDMLRead.cc:70
const char * name(G4int ptype)
G4bool transform(G4String &input, const G4String &type)
#define position
Definition: xmlparse.cc:622

References FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetPosition(), G4GDMLReadDefine::GetRotation(), G4GDMLReadDefine::GetRotationMatrix(), G4GDMLReadSolids::GetSolid(), G4GDMLReadSolids::INTERSECTION, G4InuclParticleNames::name(), position, G4GDMLReadDefine::RefRead(), G4GDMLReadSolids::SUBTRACTION, G4GDMLRead::Transcode(), G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), G4GDMLReadSolids::UNION, G4GDMLReadDefine::VectorRead(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ Box_dimensionsRead()

void G4GDMLReadParamvol::Box_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 50 of file G4GDMLReadParamvol.cc.

53{
54 G4double lunit = 1.0;
55
56 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
57 XMLSize_t attributeCount = attributes->getLength();
58
59 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
60 ++attribute_index)
61 {
62 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
63
64 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
65 {
66 continue;
67 }
68
69 const xercesc::DOMAttr* const attribute =
70 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
71 if(attribute == nullptr)
72 {
73 G4Exception("G4GDMLReadParamvol::Box_dimensionsRead()", "InvalidRead",
74 FatalException, "No attribute found!");
75 return;
76 }
77 const G4String attName = Transcode(attribute->getName());
78 const G4String attValue = Transcode(attribute->getValue());
79
80 if(attName == "lunit")
81 {
82 lunit = G4UnitDefinition::GetValueOf(attValue);
83 if(G4UnitDefinition::GetCategory(attValue) != "Length")
84 {
85 G4Exception("G4GDMLReadParamvol::Box_dimensionsRead()", "InvalidRead",
86 FatalException, "Invalid unit for length!");
87 }
88 }
89 else if(attName == "x")
90 {
91 parameter.dimension[0] = eval.Evaluate(attValue);
92 }
93 else if(attName == "y")
94 {
95 parameter.dimension[1] = eval.Evaluate(attValue);
96 }
97 else if(attName == "z")
98 {
99 parameter.dimension[2] = eval.Evaluate(attValue);
100 }
101 }
102
103 parameter.dimension[0] *= 0.5 * lunit;
104 parameter.dimension[1] *= 0.5 * lunit;
105 parameter.dimension[2] *= 0.5 * lunit;
106}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ BoxRead()

void G4GDMLReadSolids::BoxRead ( const xercesc::DOMElement * const  boxElement)
protectedinherited

Definition at line 221 of file G4GDMLReadSolids.cc.

222{
224 G4double lunit = 1.0;
225 G4double x = 0.0;
226 G4double y = 0.0;
227 G4double z = 0.0;
228
229 const xercesc::DOMNamedNodeMap* const attributes =
230 boxElement->getAttributes();
231 XMLSize_t attributeCount = attributes->getLength();
232
233 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
234 ++attribute_index)
235 {
236 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
237
238 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
239 {
240 continue;
241 }
242
243 const xercesc::DOMAttr* const attribute =
244 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
245 if(attribute == nullptr)
246 {
247 G4Exception("G4GDMLReadSolids::BoxRead()", "InvalidRead", FatalException,
248 "No attribute found!");
249 return;
250 }
251 const G4String attName = Transcode(attribute->getName());
252 const G4String attValue = Transcode(attribute->getValue());
253
254 if(attName == "name")
255 {
256 name = GenerateName(attValue);
257 }
258 else if(attName == "lunit")
259 {
260 lunit = G4UnitDefinition::GetValueOf(attValue);
261 if(G4UnitDefinition::GetCategory(attValue) != "Length")
262 {
263 G4Exception("G4GDMLReadSolids::BoxRead()", "InvalidRead",
264 FatalException, "Invalid unit for length!");
265 }
266 }
267 else if(attName == "x")
268 {
269 x = eval.Evaluate(attValue);
270 }
271 else if(attName == "y")
272 {
273 y = eval.Evaluate(attValue);
274 }
275 else if(attName == "z")
276 {
277 z = eval.Evaluate(attValue);
278 }
279 }
280
281 x *= 0.5 * lunit;
282 y *= 0.5 * lunit;
283 z *= 0.5 * lunit;
284
285 new G4Box(name, x, y, z);
286}
Definition: G4Box.hh:56

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ CompositeRead()

G4int G4GDMLReadMaterials::CompositeRead ( const xercesc::DOMElement * const  compositeElement,
G4String ref 
)
protectedinherited

Definition at line 103 of file G4GDMLReadMaterials.cc.

105{
106 G4int n = 0;
107
108 const xercesc::DOMNamedNodeMap* const attributes =
109 compositeElement->getAttributes();
110 XMLSize_t attributeCount = attributes->getLength();
111
112 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
113 ++attribute_index)
114 {
115 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
116
117 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
118 {
119 continue;
120 }
121
122 const xercesc::DOMAttr* const attribute =
123 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
124 if(attribute == nullptr)
125 {
126 G4Exception("G4GDMLReadMaterials::CompositeRead()", "InvalidRead",
127 FatalException, "No attribute found!");
128 return n;
129 }
130 const G4String attName = Transcode(attribute->getName());
131 const G4String attValue = Transcode(attribute->getValue());
132
133 if(attName == "n")
134 {
135 n = eval.EvaluateInteger(attValue);
136 }
137 else if(attName == "ref")
138 {
139 ref = attValue;
140 }
141 }
142
143 return n;
144}
int G4int
Definition: G4Types.hh:85
G4int EvaluateInteger(const G4String &)

References G4GDMLRead::eval, G4GDMLEvaluator::EvaluateInteger(), FatalException, G4Exception(), CLHEP::detail::n, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::MixtureRead().

◆ Cone_dimensionsRead()

void G4GDMLReadParamvol::Cone_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 366 of file G4GDMLReadParamvol.cc.

369{
370 G4double lunit = 1.0;
371 G4double aunit = 1.0;
372
373 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
374 XMLSize_t attributeCount = attributes->getLength();
375
376 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
377 ++attribute_index)
378 {
379 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
380
381 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
382 {
383 continue;
384 }
385
386 const xercesc::DOMAttr* const attribute =
387 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
388 if(attribute == nullptr)
389 {
390 G4Exception("G4GDMLReadParamvol::Cone_dimensionsRead()", "InvalidRead",
391 FatalException, "No attribute found!");
392 return;
393 }
394 const G4String attName = Transcode(attribute->getName());
395 const G4String attValue = Transcode(attribute->getValue());
396
397 if(attName == "lunit")
398 {
399 lunit = G4UnitDefinition::GetValueOf(attValue);
400 if(G4UnitDefinition::GetCategory(attValue) != "Length")
401 {
402 G4Exception("G4GDMLReadParamvol::Cone_dimensionsRead()", "InvalidRead",
403 FatalException, "Invalid unit for length!");
404 }
405 }
406 else if(attName == "aunit")
407 {
408 aunit = G4UnitDefinition::GetValueOf(attValue);
409 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
410 {
411 G4Exception("G4GDMLReadParamvol::Cone_dimensions()", "InvalidRead",
412 FatalException, "Invalid unit for angle!");
413 }
414 }
415 else if(attName == "rmin1")
416 {
417 parameter.dimension[0] = eval.Evaluate(attValue);
418 }
419 else if(attName == "rmax1")
420 {
421 parameter.dimension[1] = eval.Evaluate(attValue);
422 }
423 else if(attName == "rmin2")
424 {
425 parameter.dimension[2] = eval.Evaluate(attValue);
426 }
427 else if(attName == "rmax2")
428 {
429 parameter.dimension[3] = eval.Evaluate(attValue);
430 }
431 else if(attName == "z")
432 {
433 parameter.dimension[4] = eval.Evaluate(attValue);
434 }
435 else if(attName == "startphi")
436 {
437 parameter.dimension[5] = eval.Evaluate(attValue);
438 }
439 else if(attName == "deltaphi")
440 {
441 parameter.dimension[6] = eval.Evaluate(attValue);
442 }
443 }
444
445 parameter.dimension[0] *= lunit;
446 parameter.dimension[1] *= lunit;
447 parameter.dimension[2] *= lunit;
448 parameter.dimension[3] *= lunit;
449 parameter.dimension[4] *= 0.5 * lunit;
450 parameter.dimension[5] *= aunit;
451 parameter.dimension[6] *= aunit;
452}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ ConeRead()

void G4GDMLReadSolids::ConeRead ( const xercesc::DOMElement * const  coneElement)
protectedinherited

Definition at line 289 of file G4GDMLReadSolids.cc.

290{
292 G4double lunit = 1.0;
293 G4double aunit = 1.0;
294 G4double rmin1 = 0.0;
295 G4double rmax1 = 0.0;
296 G4double rmin2 = 0.0;
297 G4double rmax2 = 0.0;
298 G4double z = 0.0;
299 G4double startphi = 0.0;
300 G4double deltaphi = 0.0;
301
302 const xercesc::DOMNamedNodeMap* const attributes =
303 coneElement->getAttributes();
304 XMLSize_t attributeCount = attributes->getLength();
305
306 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
307 ++attribute_index)
308 {
309 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
310
311 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
312 {
313 continue;
314 }
315
316 const xercesc::DOMAttr* const attribute =
317 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
318 if(attribute == nullptr)
319 {
320 G4Exception("G4GDMLReadSolids::ConeRead()", "InvalidRead", FatalException,
321 "No attribute found!");
322 return;
323 }
324 const G4String attName = Transcode(attribute->getName());
325 const G4String attValue = Transcode(attribute->getValue());
326
327 if(attName == "name")
328 {
329 name = GenerateName(attValue);
330 }
331 else if(attName == "lunit")
332 {
333 lunit = G4UnitDefinition::GetValueOf(attValue);
334 if(G4UnitDefinition::GetCategory(attValue) != "Length")
335 {
336 G4Exception("G4GDMLReadSolids::ConeRead()", "InvalidRead",
337 FatalException, "Invalid unit for length!");
338 }
339 }
340 else if(attName == "aunit")
341 {
342 aunit = G4UnitDefinition::GetValueOf(attValue);
343 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
344 {
345 G4Exception("G4GDMLReadSolids::ConeRead()", "InvalidRead",
346 FatalException, "Invalid unit for angle!");
347 }
348 }
349 else if(attName == "rmin1")
350 {
351 rmin1 = eval.Evaluate(attValue);
352 }
353 else if(attName == "rmax1")
354 {
355 rmax1 = eval.Evaluate(attValue);
356 }
357 else if(attName == "rmin2")
358 {
359 rmin2 = eval.Evaluate(attValue);
360 }
361 else if(attName == "rmax2")
362 {
363 rmax2 = eval.Evaluate(attValue);
364 }
365 else if(attName == "z")
366 {
367 z = eval.Evaluate(attValue);
368 }
369 else if(attName == "startphi")
370 {
371 startphi = eval.Evaluate(attValue);
372 }
373 else if(attName == "deltaphi")
374 {
375 deltaphi = eval.Evaluate(attValue);
376 }
377 }
378
379 rmin1 *= lunit;
380 rmax1 *= lunit;
381 rmin2 *= lunit;
382 rmax2 *= lunit;
383 z *= 0.5 * lunit;
384 startphi *= aunit;
385 deltaphi *= aunit;
386
387 new G4Cons(name, rmin1, rmax1, rmin2, rmax2, z, startphi, deltaphi);
388}
Definition: G4Cons.hh:78

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ ConstantRead()

void G4GDMLReadDefine::ConstantRead ( const xercesc::DOMElement * const  constantElement)
protectedinherited

Definition at line 167 of file G4GDMLReadDefine.cc.

169{
170 G4String name = "";
171 G4double value = 0.0;
172
173 const xercesc::DOMNamedNodeMap* const attributes =
174 constantElement->getAttributes();
175 XMLSize_t attributeCount = attributes->getLength();
176
177 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
178 ++attribute_index)
179 {
180 xercesc::DOMNode* node = attributes->item(attribute_index);
181
182 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
183 {
184 continue;
185 }
186
187 const xercesc::DOMAttr* const attribute =
188 dynamic_cast<xercesc::DOMAttr*>(node);
189 if(attribute == nullptr)
190 {
191 G4Exception("G4GDMLRead::ConstantRead()", "InvalidRead", FatalException,
192 "No attribute found!");
193 return;
194 }
195 const G4String attName = Transcode(attribute->getName());
196 const G4String attValue = Transcode(attribute->getValue());
197
198 if(attName == "name")
199 {
200 name = attValue;
201 }
202 else if(attName == "value")
203 {
204 value = eval.Evaluate(attValue);
205 }
206 }
207
208 eval.DefineConstant(name, value);
209}
void DefineConstant(const G4String &, G4double)

References G4GDMLEvaluator::DefineConstant(), G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadDefine::DefineRead().

◆ CutTubeRead()

void G4GDMLReadSolids::CutTubeRead ( const xercesc::DOMElement * const  cuttubeElement)
protectedinherited

Definition at line 2782 of file G4GDMLReadSolids.cc.

2784{
2785 G4String name;
2786 G4double lunit = 1.0;
2787 G4double aunit = 1.0;
2788 G4double rmin = 0.0;
2789 G4double rmax = 0.0;
2790 G4double z = 0.0;
2791 G4double startphi = 0.0;
2792 G4double deltaphi = 0.0;
2793 G4ThreeVector lowNorm(0);
2794 G4ThreeVector highNorm(0);
2795
2796 const xercesc::DOMNamedNodeMap* const attributes =
2797 cuttubeElement->getAttributes();
2798 XMLSize_t attributeCount = attributes->getLength();
2799
2800 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2801 ++attribute_index)
2802 {
2803 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2804
2805 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2806 {
2807 continue;
2808 }
2809
2810 const xercesc::DOMAttr* const attribute =
2811 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2812 if(attribute == nullptr)
2813 {
2814 G4Exception("G4GDMLReadSolids::CutTubeRead()", "InvalidRead",
2815 FatalException, "No attribute found!");
2816 return;
2817 }
2818 const G4String attName = Transcode(attribute->getName());
2819 const G4String attValue = Transcode(attribute->getValue());
2820
2821 if(attName == "name")
2822 {
2823 name = GenerateName(attValue);
2824 }
2825 else if(attName == "lunit")
2826 {
2827 lunit = G4UnitDefinition::GetValueOf(attValue);
2828 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2829 {
2830 G4Exception("G4GDMLReadSolids::CutTubeRead()", "InvalidRead",
2831 FatalException, "Invalid unit for length!");
2832 }
2833 }
2834 else if(attName == "aunit")
2835 {
2836 aunit = G4UnitDefinition::GetValueOf(attValue);
2837 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
2838 {
2839 G4Exception("G4GDMLReadSolids::CutTubeRead()", "InvalidRead",
2840 FatalException, "Invalid unit for angle!");
2841 }
2842 }
2843 else if(attName == "rmin")
2844 {
2845 rmin = eval.Evaluate(attValue);
2846 }
2847 else if(attName == "rmax")
2848 {
2849 rmax = eval.Evaluate(attValue);
2850 }
2851 else if(attName == "z")
2852 {
2853 z = eval.Evaluate(attValue);
2854 }
2855 else if(attName == "startphi")
2856 {
2857 startphi = eval.Evaluate(attValue);
2858 }
2859 else if(attName == "deltaphi")
2860 {
2861 deltaphi = eval.Evaluate(attValue);
2862 }
2863 else if(attName == "lowX")
2864 {
2865 lowNorm.setX(eval.Evaluate(attValue));
2866 }
2867 else if(attName == "lowY")
2868 {
2869 lowNorm.setY(eval.Evaluate(attValue));
2870 }
2871 else if(attName == "lowZ")
2872 {
2873 lowNorm.setZ(eval.Evaluate(attValue));
2874 }
2875 else if(attName == "highX")
2876 {
2877 highNorm.setX(eval.Evaluate(attValue));
2878 }
2879 else if(attName == "highY")
2880 {
2881 highNorm.setY(eval.Evaluate(attValue));
2882 }
2883 else if(attName == "highZ")
2884 {
2885 highNorm.setZ(eval.Evaluate(attValue));
2886 }
2887 }
2888
2889 rmin *= lunit;
2890 rmax *= lunit;
2891 z *= 0.5 * lunit;
2892 startphi *= aunit;
2893 deltaphi *= aunit;
2894
2895 new G4CutTubs(name, rmin, rmax, z, startphi, deltaphi, lowNorm, highNorm);
2896}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ DefineRead()

void G4GDMLReadDefine::DefineRead ( const xercesc::DOMElement * const  defineElement)
virtualinherited

Implements G4GDMLRead.

Definition at line 596 of file G4GDMLReadDefine.cc.

598{
599#ifdef G4VERBOSE
600 G4cout << "G4GDML: Reading definitions..." << G4endl;
601#endif
602 for(xercesc::DOMNode* iter = defineElement->getFirstChild(); iter != nullptr;
603 iter = iter->getNextSibling())
604 {
605 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
606 {
607 continue;
608 }
609
610 const xercesc::DOMElement* const child =
611 dynamic_cast<xercesc::DOMElement*>(iter);
612 if(child == nullptr)
613 {
614 G4Exception("G4GDMLRead::DefineRead()", "InvalidRead", FatalException,
615 "No child found!");
616 return;
617 }
618 const G4String tag = Transcode(child->getTagName());
619
620 if(tag == "constant")
621 {
622 ConstantRead(child);
623 }
624 else if(tag == "matrix")
625 {
626 MatrixRead(child);
627 }
628 else if(tag == "position")
629 {
630 PositionRead(child);
631 }
632 else if(tag == "rotation")
633 {
634 RotationRead(child);
635 }
636 else if(tag == "scale")
637 {
638 ScaleRead(child);
639 }
640 else if(tag == "variable")
641 {
642 VariableRead(child);
643 }
644 else if(tag == "quantity")
645 {
646 QuantityRead(child);
647 }
648 else if(tag == "expression")
649 {
650 ExpressionRead(child);
651 }
652 else
653 {
654 G4String error_msg = "Unknown tag in define: " + tag;
655 G4Exception("G4GDMLReadDefine::defineRead()", "ReadError", FatalException,
656 error_msg);
657 }
658 }
659}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void ExpressionRead(const xercesc::DOMElement *const)
void VariableRead(const xercesc::DOMElement *const)
void QuantityRead(const xercesc::DOMElement *const)
void PositionRead(const xercesc::DOMElement *const)
void MatrixRead(const xercesc::DOMElement *const)
void RotationRead(const xercesc::DOMElement *const)
void ScaleRead(const xercesc::DOMElement *const)
void ConstantRead(const xercesc::DOMElement *const)

References G4GDMLReadDefine::ConstantRead(), G4GDMLReadDefine::ExpressionRead(), FatalException, G4cout, G4endl, G4Exception(), G4GDMLReadDefine::MatrixRead(), G4GDMLReadDefine::PositionRead(), G4GDMLReadDefine::QuantityRead(), G4GDMLReadDefine::RotationRead(), G4GDMLReadDefine::ScaleRead(), G4GDMLRead::Transcode(), and G4GDMLReadDefine::VariableRead().

Referenced by G4GDMLReadMaterials::MaterialsRead(), and G4GDMLReadSolids::SolidsRead().

◆ DRead()

G4double G4GDMLReadMaterials::DRead ( const xercesc::DOMElement * const  DElement)
protectedinherited

Definition at line 147 of file G4GDMLReadMaterials.cc.

148{
149 G4double value = 0.0;
150 G4double unit = g / cm3;
151
152 const xercesc::DOMNamedNodeMap* const attributes = DElement->getAttributes();
153 XMLSize_t attributeCount = attributes->getLength();
154
155 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
156 ++attribute_index)
157 {
158 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
159
160 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
161 {
162 continue;
163 }
164
165 const xercesc::DOMAttr* const attribute =
166 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
167 if(attribute == nullptr)
168 {
169 G4Exception("G4GDMLReadMaterials::DRead()", "InvalidRead", FatalException,
170 "No attribute found!");
171 return value;
172 }
173 const G4String attName = Transcode(attribute->getName());
174 const G4String attValue = Transcode(attribute->getValue());
175
176 if(attName == "value")
177 {
178 value = eval.Evaluate(attValue);
179 }
180 else if(attName == "unit")
181 {
182 unit = G4UnitDefinition::GetValueOf(attValue);
183 if(G4UnitDefinition::GetCategory(attValue) != "Volumic Mass")
184 {
185 G4Exception("G4GDMLReadMaterials::DRead()", "InvalidRead",
186 FatalException, "Invalid unit for density!");
187 }
188 }
189 }
190
191 return value * unit;
192}
static constexpr double cm3
Definition: G4SIunits.hh:101

References cm3, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, g, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::MaterialRead().

◆ ElconeRead()

void G4GDMLReadSolids::ElconeRead ( const xercesc::DOMElement * const  elconeElement)
protectedinherited

Definition at line 391 of file G4GDMLReadSolids.cc.

393{
395 G4double lunit = 1.0;
396 G4double dx = 0.0;
397 G4double dy = 0.0;
398 G4double zmax = 0.0;
399 G4double zcut = 0.0;
400
401 const xercesc::DOMNamedNodeMap* const attributes =
402 elconeElement->getAttributes();
403 XMLSize_t attributeCount = attributes->getLength();
404
405 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
406 ++attribute_index)
407 {
408 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
409
410 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
411 {
412 continue;
413 }
414
415 const xercesc::DOMAttr* const attribute =
416 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
417 if(attribute == nullptr)
418 {
419 G4Exception("G4GDMLReadSolids::ElconeRead()", "InvalidRead",
420 FatalException, "No attribute found!");
421 return;
422 }
423 const G4String attName = Transcode(attribute->getName());
424 const G4String attValue = Transcode(attribute->getValue());
425
426 if(attName == "name")
427 {
428 name = GenerateName(attValue);
429 }
430 else if(attName == "lunit")
431 {
432 lunit = G4UnitDefinition::GetValueOf(attValue);
433 if(G4UnitDefinition::GetCategory(attValue) != "Length")
434 {
435 G4Exception("G4GDMLReadSolids::ElconeRead()", "InvalidRead",
436 FatalException, "Invalid unit for length!");
437 }
438 }
439 else if(attName == "dx")
440 {
441 dx = eval.Evaluate(attValue);
442 }
443 else if(attName == "dy")
444 {
445 dy = eval.Evaluate(attValue);
446 }
447 else if(attName == "zmax")
448 {
449 zmax = eval.Evaluate(attValue);
450 }
451 else if(attName == "zcut")
452 {
453 zcut = eval.Evaluate(attValue);
454 }
455 }
456
457 zmax *= lunit;
458 zcut *= lunit;
459
460 new G4EllipticalCone(name, dx, dy, zmax, zcut);
461}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ ElementRead()

void G4GDMLReadMaterials::ElementRead ( const xercesc::DOMElement * const  elementElement)
protectedinherited

Definition at line 339 of file G4GDMLReadMaterials.cc.

341{
343 G4String formula;
344 G4double a = 0.0;
345 G4double Z = 0.0;
346
347 const xercesc::DOMNamedNodeMap* const attributes =
348 elementElement->getAttributes();
349 XMLSize_t attributeCount = attributes->getLength();
350
351 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
352 ++attribute_index)
353 {
354 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
355
356 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
357 {
358 continue;
359 }
360
361 const xercesc::DOMAttr* const attribute =
362 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
363 if(attribute == nullptr)
364 {
365 G4Exception("G4GDMLReadMaterials::ElementRead()", "InvalidRead",
366 FatalException, "No attribute found!");
367 return;
368 }
369 const G4String attName = Transcode(attribute->getName());
370 const G4String attValue = Transcode(attribute->getValue());
371
372 if(attName == "name")
373 {
374 name = GenerateName(attValue);
375 }
376 else if(attName == "formula")
377 {
378 formula = attValue;
379 }
380 else if(attName == "Z")
381 {
382 Z = eval.Evaluate(attValue);
383 }
384 }
385
386 G4int nComponents = 0;
387
388 for(xercesc::DOMNode* iter = elementElement->getFirstChild(); iter != nullptr;
389 iter = iter->getNextSibling())
390 {
391 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
392 {
393 continue;
394 }
395
396 const xercesc::DOMElement* const child =
397 dynamic_cast<xercesc::DOMElement*>(iter);
398 if(child == nullptr)
399 {
400 G4Exception("G4GDMLReadMaterials::ElementRead()", "InvalidRead",
401 FatalException, "No child found!");
402 return;
403 }
404 const G4String tag = Transcode(child->getTagName());
405
406 if(tag == "atom")
407 {
408 a = AtomRead(child);
409 }
410 else if(tag == "fraction")
411 {
412 nComponents++;
413 }
414 }
415
416 if(nComponents > 0)
417 {
418 MixtureRead(elementElement,
419 new G4Element(Strip(name), formula, nComponents));
420 }
421 else
422 {
423 new G4Element(Strip(name), formula, Z, a);
424 }
425}
const G4int Z[17]
void MixtureRead(const xercesc::DOMElement *const, G4Element *)
G4double AtomRead(const xercesc::DOMElement *const)
G4String Strip(const G4String &) const
Definition: G4GDMLRead.cc:104

References G4GDMLReadMaterials::AtomRead(), G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadMaterials::MixtureRead(), G4InuclParticleNames::name(), G4GDMLRead::Strip(), G4GDMLRead::Transcode(), and Z.

Referenced by G4GDMLReadMaterials::MaterialsRead().

◆ Ellipsoid_dimensionsRead()

void G4GDMLReadParamvol::Ellipsoid_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 667 of file G4GDMLReadParamvol.cc.

670{
671 G4double lunit = 1.0;
672 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
673 XMLSize_t attributeCount = attributes->getLength();
674
675 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
676 ++attribute_index)
677 {
678 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
679
680 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
681 {
682 continue;
683 }
684
685 const xercesc::DOMAttr* const attribute =
686 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
687 if(attribute == nullptr)
688 {
689 G4Exception("G4GDMLReadParamvol::Ellipsoid_dimensionsRead()",
690 "InvalidRead", FatalException, "No attribute found!");
691 return;
692 }
693 const G4String attName = Transcode(attribute->getName());
694 const G4String attValue = Transcode(attribute->getValue());
695
696 if(attName == "lunit")
697 {
698 lunit = G4UnitDefinition::GetValueOf(attValue);
699 if(G4UnitDefinition::GetCategory(attValue) != "Length")
700 {
701 G4Exception("G4GDMLReadParamvol::Ellipsoid_dimensionsRead()",
702 "InvalidRead", FatalException, "Invalid unit for length!");
703 }
704 }
705 else if(attName == "ax")
706 {
707 parameter.dimension[0] = eval.Evaluate(attValue);
708 }
709 else if(attName == "by")
710 {
711 parameter.dimension[1] = eval.Evaluate(attValue);
712 }
713 else if(attName == "cz")
714 {
715 parameter.dimension[2] = eval.Evaluate(attValue);
716 }
717 else if(attName == "zcut1")
718 {
719 parameter.dimension[3] = eval.Evaluate(attValue);
720 }
721 else if(attName == "zcut2")
722 {
723 parameter.dimension[4] = eval.Evaluate(attValue);
724 }
725 }
726
727 parameter.dimension[0] *= lunit;
728 parameter.dimension[1] *= lunit;
729 parameter.dimension[2] *= lunit;
730 parameter.dimension[3] *= lunit;
731 parameter.dimension[4] *= lunit;
732}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ EllipsoidRead()

void G4GDMLReadSolids::EllipsoidRead ( const xercesc::DOMElement * const  ellipsoidElement)
protectedinherited

Definition at line 464 of file G4GDMLReadSolids.cc.

466{
468 G4double lunit = 1.0;
469 G4double ax = 0.0;
470 G4double by = 0.0;
471 G4double cz = 0.0;
472 G4double zcut1 = 0.0;
473 G4double zcut2 = 0.0;
474
475 const xercesc::DOMNamedNodeMap* const attributes =
476 ellipsoidElement->getAttributes();
477 XMLSize_t attributeCount = attributes->getLength();
478
479 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
480 ++attribute_index)
481 {
482 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
483
484 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
485 {
486 continue;
487 }
488
489 const xercesc::DOMAttr* const attribute =
490 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
491 if(attribute == nullptr)
492 {
493 G4Exception("G4GDMLReadSolids::EllipsoidRead()", "InvalidRead",
494 FatalException, "No attribute found!");
495 return;
496 }
497 const G4String attName = Transcode(attribute->getName());
498 const G4String attValue = Transcode(attribute->getValue());
499
500 if(attName == "name")
501 {
502 name = GenerateName(attValue);
503 }
504 else if(attName == "lunit")
505 {
506 lunit = G4UnitDefinition::GetValueOf(attValue);
507 if(G4UnitDefinition::GetCategory(attValue) != "Length")
508 {
509 G4Exception("G4GDMLReadSolids::EllipsoidRead()", "InvalidRead",
510 FatalException, "Invalid unit for length!");
511 }
512 }
513 else if(attName == "ax")
514 {
515 ax = eval.Evaluate(attValue);
516 }
517 else if(attName == "by")
518 {
519 by = eval.Evaluate(attValue);
520 }
521 else if(attName == "cz")
522 {
523 cz = eval.Evaluate(attValue);
524 }
525 else if(attName == "zcut1")
526 {
527 zcut1 = eval.Evaluate(attValue);
528 }
529 else if(attName == "zcut2")
530 {
531 zcut2 = eval.Evaluate(attValue);
532 }
533 }
534
535 ax *= lunit;
536 by *= lunit;
537 cz *= lunit;
538 zcut1 *= lunit;
539 zcut2 *= lunit;
540
541 new G4Ellipsoid(name, ax, by, cz, zcut1, zcut2);
542}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ EltubeRead()

void G4GDMLReadSolids::EltubeRead ( const xercesc::DOMElement * const  eltubeElement)
protectedinherited

Definition at line 545 of file G4GDMLReadSolids.cc.

547{
549 G4double lunit = 1.0;
550 G4double dx = 0.0;
551 G4double dy = 0.0;
552 G4double dz = 0.0;
553
554 const xercesc::DOMNamedNodeMap* const attributes =
555 eltubeElement->getAttributes();
556 XMLSize_t attributeCount = attributes->getLength();
557
558 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
559 ++attribute_index)
560 {
561 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
562
563 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
564 {
565 continue;
566 }
567
568 const xercesc::DOMAttr* const attribute =
569 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
570 if(attribute == nullptr)
571 {
572 G4Exception("G4GDMLReadSolids::EltubeRead()", "InvalidRead",
573 FatalException, "No attribute found!");
574 return;
575 }
576 const G4String attName = Transcode(attribute->getName());
577 const G4String attValue = Transcode(attribute->getValue());
578
579 if(attName == "name")
580 {
581 name = GenerateName(attValue);
582 }
583 else if(attName == "lunit")
584 {
585 lunit = G4UnitDefinition::GetValueOf(attValue);
586 if(G4UnitDefinition::GetCategory(attValue) != "Length")
587 {
588 G4Exception("G4GDMLReadSolids::EltubeRead()", "InvalidRead",
589 FatalException, "Invalid unit for length!");
590 }
591 }
592 else if(attName == "dx")
593 {
594 dx = eval.Evaluate(attValue);
595 }
596 else if(attName == "dy")
597 {
598 dy = eval.Evaluate(attValue);
599 }
600 else if(attName == "dz")
601 {
602 dz = eval.Evaluate(attValue);
603 }
604 }
605
606 dx *= lunit;
607 dy *= lunit;
608 dz *= lunit;
609
610 new G4EllipticalTube(name, dx, dy, dz);
611}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ ExpressionRead()

void G4GDMLReadDefine::ExpressionRead ( const xercesc::DOMElement * const  expElement)
protectedinherited

Definition at line 212 of file G4GDMLReadDefine.cc.

214{
215 G4String name = "";
216 G4double value = 0.0;
217
218 const xercesc::DOMNamedNodeMap* const attributes =
219 expElement->getAttributes();
220 XMLSize_t attributeCount = attributes->getLength();
221
222 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
223 ++attribute_index)
224 {
225 xercesc::DOMNode* node = attributes->item(attribute_index);
226
227 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
228 {
229 continue;
230 }
231
232 const xercesc::DOMAttr* const attribute =
233 dynamic_cast<xercesc::DOMAttr*>(node);
234 if(attribute == nullptr)
235 {
236 G4Exception("G4GDMLRead::ExpressionRead()", "InvalidRead", FatalException,
237 "No attribute found!");
238 return;
239 }
240 const G4String attName = Transcode(attribute->getName());
241 const G4String attValue = Transcode(attribute->getValue());
242
243 if(attName == "name")
244 {
245 name = attValue;
246 }
247 }
248
249 const G4String expValue = Transcode(expElement->getTextContent());
250 value = eval.Evaluate(expValue);
251 eval.DefineConstant(name, value);
252}

References G4GDMLEvaluator::DefineConstant(), G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadDefine::DefineRead().

◆ ExtensionRead()

void G4GDMLRead::ExtensionRead ( const xercesc::DOMElement * const  )
virtualinherited

Definition at line 414 of file G4GDMLRead.cc.

415{
416 G4String error_msg = "No handle to user-code for parsing extensions!";
417 G4Exception("G4GDMLRead::ExtensionRead()", "NotImplemented", JustWarning,
418 error_msg);
419}
@ JustWarning

References G4Exception(), and JustWarning.

Referenced by G4GDMLRead::Read().

◆ FractionRead()

G4double G4GDMLReadMaterials::FractionRead ( const xercesc::DOMElement * const  fractionElement,
G4String ref 
)
protectedinherited

Definition at line 428 of file G4GDMLReadMaterials.cc.

430{
431 G4double n = 0.0;
432
433 const xercesc::DOMNamedNodeMap* const attributes =
434 fractionElement->getAttributes();
435 XMLSize_t attributeCount = attributes->getLength();
436
437 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
438 ++attribute_index)
439 {
440 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
441
442 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
443 {
444 continue;
445 }
446
447 const xercesc::DOMAttr* const attribute =
448 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
449 if(attribute == nullptr)
450 {
451 G4Exception("G4GDMLReadMaterials::FractionRead()", "InvalidRead",
452 FatalException, "No attribute found!");
453 return n;
454 }
455 const G4String attName = Transcode(attribute->getName());
456 const G4String attValue = Transcode(attribute->getValue());
457
458 if(attName == "n")
459 {
460 n = eval.Evaluate(attValue);
461 }
462 else if(attName == "ref")
463 {
464 ref = attValue;
465 }
466 }
467
468 return n;
469}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), CLHEP::detail::n, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::MixtureRead().

◆ GenerateName()

G4String G4GDMLRead::GenerateName ( const G4String name,
G4bool  strip = false 
)
protectedinherited

Definition at line 70 of file G4GDMLRead.cc.

71{
72 G4String nameOut(nameIn);
73
74 if(inLoop > 0)
75 {
76 nameOut = eval.SolveBrackets(nameOut);
77 }
78 if(strip)
79 {
80 StripName(nameOut);
81 }
82
83 return nameOut;
84}
G4String SolveBrackets(const G4String &)
void StripName(G4String &) const
Definition: G4GDMLRead.cc:112
G4int inLoop
Definition: G4GDMLRead.hh:163
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.

References G4GDMLRead::eval, G4GDMLRead::inLoop, G4GDMLEvaluator::SolveBrackets(), G4StrUtil::strip(), and G4GDMLRead::StripName().

Referenced by G4GDMLReadStructure::AssemblyRead(), G4GDMLReadSolids::BooleanRead(), G4GDMLReadStructure::BorderSurfaceRead(), G4GDMLReadSolids::BoxRead(), G4GDMLReadSolids::ConeRead(), G4GDMLReadSolids::CutTubeRead(), G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadSolids::ElconeRead(), G4GDMLReadMaterials::ElementRead(), G4GDMLReadSolids::EllipsoidRead(), G4GDMLReadSolids::EltubeRead(), G4GDMLReadStructure::FileRead(), G4GDMLReadSolids::GenericPolyconeRead(), G4GDMLReadSolids::GenericPolyhedraRead(), G4GDMLReadSolids::GenTrapRead(), G4GDMLReadStructure::GetWorldVolume(), G4GDMLReadSolids::HypeRead(), G4GDMLReadMaterials::IsotopeRead(), G4GDMLReadMaterials::MaterialRead(), G4GDMLReadDefine::MatrixRead(), G4GDMLReadMaterials::MixtureRead(), G4GDMLReadSolids::MultiUnionNodeRead(), G4GDMLReadSolids::MultiUnionRead(), G4GDMLReadSolids::OpticalSurfaceRead(), G4GDMLReadSolids::OrbRead(), G4GDMLReadSolids::ParaboloidRead(), ParametersRead(), ParamvolRead(), G4GDMLReadSolids::ParaRead(), G4GDMLReadStructure::PhysvolRead(), G4GDMLReadSolids::PolyconeRead(), G4GDMLReadSolids::PolyhedraRead(), G4GDMLReadDefine::PositionRead(), G4GDMLReadMaterials::PropertyRead(), G4GDMLReadSolids::PropertyRead(), G4GDMLReadSolids::QuadrangularRead(), G4GDMLReadSolids::ReflectedSolidRead(), G4GDMLReadStructure::ReplicaRead(), G4GDMLReadStructure::ReplicavolRead(), G4GDMLReadDefine::RotationRead(), G4GDMLReadSolids::ScaledSolidRead(), G4GDMLReadDefine::ScaleRead(), G4GDMLReadSetup::SetupRead(), G4GDMLReadStructure::SkinSurfaceRead(), G4GDMLReadSolids::SphereRead(), G4GDMLReadSolids::TessellatedRead(), G4GDMLReadSolids::TetRead(), G4GDMLReadSolids::TorusRead(), G4GDMLReadSolids::TrapRead(), G4GDMLReadSolids::TrdRead(), G4GDMLReadSolids::TriangularRead(), G4GDMLReadSolids::TubeRead(), G4GDMLReadSolids::TwistedboxRead(), G4GDMLReadSolids::TwistedtrapRead(), G4GDMLReadSolids::TwistedtrdRead(), G4GDMLReadSolids::TwistedtubsRead(), G4GDMLReadStructure::VolumeRead(), and G4GDMLReadSolids::XtruRead().

◆ GeneratePhysvolName()

void G4GDMLRead::GeneratePhysvolName ( const G4String nameIn,
G4VPhysicalVolume physvol 
)
protectedinherited

Definition at line 87 of file G4GDMLRead.cc.

89{
90 G4String nameOut(nameIn);
91
92 if(nameIn.empty())
93 {
94 std::stringstream stream;
95 stream << physvol->GetLogicalVolume()->GetName() << "_PV";
96 nameOut = stream.str();
97 }
98 nameOut = eval.SolveBrackets(nameOut);
99
100 physvol->SetName(nameOut);
101}
const G4String & GetName() const
G4LogicalVolume * GetLogicalVolume() const
void SetName(const G4String &pName)

References G4GDMLRead::eval, G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetName(), G4VPhysicalVolume::SetName(), and G4GDMLEvaluator::SolveBrackets().

Referenced by G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadStructure::PhysvolRead(), and G4GDMLReadStructure::ReplicaRead().

◆ GenericPolyconeRead()

void G4GDMLReadSolids::GenericPolyconeRead ( const xercesc::DOMElement * const  polyconeElement)
protectedinherited

Definition at line 1284 of file G4GDMLReadSolids.cc.

1286{
1287 G4String name;
1288 G4double lunit = 1.0;
1289 G4double aunit = 1.0;
1290 G4double startphi = 0.0;
1291 G4double deltaphi = 0.0;
1292
1293 const xercesc::DOMNamedNodeMap* const attributes =
1294 polyconeElement->getAttributes();
1295 XMLSize_t attributeCount = attributes->getLength();
1296
1297 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1298 ++attribute_index)
1299 {
1300 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1301
1302 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1303 {
1304 continue;
1305 }
1306
1307 const xercesc::DOMAttr* const attribute =
1308 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1309 if(attribute == nullptr)
1310 {
1311 G4Exception("G4GDMLReadSolids::GenericPolyconeRead()", "InvalidRead",
1312 FatalException, "No attribute found!");
1313 return;
1314 }
1315 const G4String attName = Transcode(attribute->getName());
1316 const G4String attValue = Transcode(attribute->getValue());
1317
1318 if(attName == "name")
1319 {
1320 name = GenerateName(attValue);
1321 }
1322 else if(attName == "lunit")
1323 {
1324 lunit = G4UnitDefinition::GetValueOf(attValue);
1325 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1326 {
1327 G4Exception("G4GDMLReadSolids::GenericPolyconeRead()", "InvalidRead",
1328 FatalException, "Invalid unit for length!");
1329 }
1330 }
1331 else if(attName == "aunit")
1332 {
1333 aunit = G4UnitDefinition::GetValueOf(attValue);
1334 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
1335 {
1336 G4Exception("G4GDMLReadSolids::GenericPolyconeRead()", "InvalidRead",
1337 FatalException, "Invalid unit for angle!");
1338 }
1339 }
1340 else if(attName == "startphi")
1341 {
1342 startphi = eval.Evaluate(attValue);
1343 }
1344 else if(attName == "deltaphi")
1345 {
1346 deltaphi = eval.Evaluate(attValue);
1347 }
1348 }
1349
1350 startphi *= aunit;
1351 deltaphi *= aunit;
1352
1353 std::vector<rzPointType> rzPointList;
1354
1355 for(xercesc::DOMNode* iter = polyconeElement->getFirstChild();
1356 iter != nullptr; iter = iter->getNextSibling())
1357 {
1358 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1359 {
1360 continue;
1361 }
1362
1363 const xercesc::DOMElement* const child =
1364 dynamic_cast<xercesc::DOMElement*>(iter);
1365 if(child == nullptr)
1366 {
1367 G4Exception("G4GDMLReadSolids::GenericPolyconeRead()", "InvalidRead",
1368 FatalException, "No child found!");
1369 return;
1370 }
1371 const G4String tag = Transcode(child->getTagName());
1372
1373 if(tag == "rzpoint")
1374 {
1375 rzPointList.push_back(RZPointRead(child));
1376 }
1377 }
1378
1379 G4int numRZPoints = rzPointList.size();
1380
1381 G4double* r_array = new G4double[numRZPoints];
1382 G4double* z_array = new G4double[numRZPoints];
1383
1384 for(G4int i = 0; i < numRZPoints; ++i)
1385 {
1386 r_array[i] = rzPointList[i].r * lunit;
1387 z_array[i] = rzPointList[i].z * lunit;
1388 }
1389 new G4GenericPolycone(name, startphi, deltaphi, numRZPoints, r_array,
1390 z_array);
1391 delete[] r_array;
1392 delete[] z_array;
1393}
rzPointType RZPointRead(const xercesc::DOMElement *const)

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), G4GDMLReadSolids::RZPointRead(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ GenericPolyhedraRead()

void G4GDMLReadSolids::GenericPolyhedraRead ( const xercesc::DOMElement * const  polyhedraElement)
protectedinherited

Definition at line 1518 of file G4GDMLReadSolids.cc.

1520{
1521 G4String name;
1522 G4double lunit = 1.0;
1523 G4double aunit = 1.0;
1524 G4double startphi = 0.0;
1525 G4double deltaphi = 0.0;
1526 G4int numsides = 0;
1527
1528 const xercesc::DOMNamedNodeMap* const attributes =
1529 polyhedraElement->getAttributes();
1530 XMLSize_t attributeCount = attributes->getLength();
1531
1532 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1533 ++attribute_index)
1534 {
1535 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1536
1537 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1538 {
1539 continue;
1540 }
1541
1542 const xercesc::DOMAttr* const attribute =
1543 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1544 if(attribute == nullptr)
1545 {
1546 G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()", "InvalidRead",
1547 FatalException, "No attribute found!");
1548 return;
1549 }
1550 const G4String attName = Transcode(attribute->getName());
1551 const G4String attValue = Transcode(attribute->getValue());
1552
1553 if(attName == "name")
1554 {
1555 name = GenerateName(attValue);
1556 }
1557 else if(attName == "lunit")
1558 {
1559 lunit = G4UnitDefinition::GetValueOf(attValue);
1560 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1561 {
1562 G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()", "InvalidRead",
1563 FatalException, "Invalid unit for length!");
1564 }
1565 }
1566 else if(attName == "aunit")
1567 {
1568 aunit = G4UnitDefinition::GetValueOf(attValue);
1569 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
1570 {
1571 G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()", "InvalidRead",
1572 FatalException, "Invalid unit for angle!");
1573 }
1574 }
1575 else if(attName == "startphi")
1576 {
1577 startphi = eval.Evaluate(attValue);
1578 }
1579 else if(attName == "deltaphi")
1580 {
1581 deltaphi = eval.Evaluate(attValue);
1582 }
1583 else if(attName == "numsides")
1584 {
1585 numsides = eval.EvaluateInteger(attValue);
1586 }
1587 }
1588
1589 startphi *= aunit;
1590 deltaphi *= aunit;
1591
1592 std::vector<rzPointType> rzpointList;
1593
1594 for(xercesc::DOMNode* iter = polyhedraElement->getFirstChild();
1595 iter != nullptr; iter = iter->getNextSibling())
1596 {
1597 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1598 {
1599 continue;
1600 }
1601
1602 const xercesc::DOMElement* const child =
1603 dynamic_cast<xercesc::DOMElement*>(iter);
1604 if(child == nullptr)
1605 {
1606 G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()", "InvalidRead",
1607 FatalException, "No child found!");
1608 return;
1609 }
1610 const G4String tag = Transcode(child->getTagName());
1611
1612 if(tag == "rzpoint")
1613 {
1614 rzpointList.push_back(RZPointRead(child));
1615 }
1616 }
1617
1618 G4int numRZPoints = rzpointList.size();
1619
1620 G4double* r_array = new G4double[numRZPoints];
1621 G4double* z_array = new G4double[numRZPoints];
1622
1623 for(G4int i = 0; i < numRZPoints; ++i)
1624 {
1625 r_array[i] = rzpointList[i].r * lunit;
1626 z_array[i] = rzpointList[i].z * lunit;
1627 }
1628
1629 new G4Polyhedra(name, startphi, deltaphi, numsides, numRZPoints, r_array,
1630 z_array);
1631
1632 delete[] r_array;
1633 delete[] z_array;
1634}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), G4GDMLEvaluator::EvaluateInteger(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), G4GDMLReadSolids::RZPointRead(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ GenTrapRead()

void G4GDMLReadSolids::GenTrapRead ( const xercesc::DOMElement * const  gtrapElement)
protectedinherited

Definition at line 2285 of file G4GDMLReadSolids.cc.

2287{
2288 G4String name;
2289 G4double lunit = 1.0;
2290 G4double dz = 0.0;
2291 G4double v1x = 0.0, v1y = 0.0, v2x = 0.0, v2y = 0.0, v3x = 0.0, v3y = 0.0,
2292 v4x = 0.0, v4y = 0.0, v5x = 0.0, v5y = 0.0, v6x = 0.0, v6y = 0.0,
2293 v7x = 0.0, v7y = 0.0, v8x = 0.0, v8y = 0.0;
2294
2295 const xercesc::DOMNamedNodeMap* const attributes =
2296 gtrapElement->getAttributes();
2297 XMLSize_t attributeCount = attributes->getLength();
2298
2299 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2300 ++attribute_index)
2301 {
2302 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2303
2304 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2305 {
2306 continue;
2307 }
2308
2309 const xercesc::DOMAttr* const attribute =
2310 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2311 if(attribute == nullptr)
2312 {
2313 G4Exception("G4GDMLReadSolids::GenTrapRead()", "InvalidRead",
2314 FatalException, "No attribute found!");
2315 return;
2316 }
2317 const G4String attName = Transcode(attribute->getName());
2318 const G4String attValue = Transcode(attribute->getValue());
2319
2320 if(attName == "name")
2321 {
2322 name = GenerateName(attValue);
2323 }
2324 else if(attName == "lunit")
2325 {
2326 lunit = G4UnitDefinition::GetValueOf(attValue);
2327 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2328 {
2329 G4Exception("G4GDMLReadSolids::GenTrapRead()", "InvalidRead",
2330 FatalException, "Invalid unit for length!");
2331 }
2332 }
2333 else if(attName == "dz")
2334 {
2335 dz = eval.Evaluate(attValue);
2336 }
2337 else if(attName == "v1x")
2338 {
2339 v1x = eval.Evaluate(attValue);
2340 }
2341 else if(attName == "v1y")
2342 {
2343 v1y = eval.Evaluate(attValue);
2344 }
2345 else if(attName == "v2x")
2346 {
2347 v2x = eval.Evaluate(attValue);
2348 }
2349 else if(attName == "v2y")
2350 {
2351 v2y = eval.Evaluate(attValue);
2352 }
2353 else if(attName == "v3x")
2354 {
2355 v3x = eval.Evaluate(attValue);
2356 }
2357 else if(attName == "v3y")
2358 {
2359 v3y = eval.Evaluate(attValue);
2360 }
2361 else if(attName == "v4x")
2362 {
2363 v4x = eval.Evaluate(attValue);
2364 }
2365 else if(attName == "v4y")
2366 {
2367 v4y = eval.Evaluate(attValue);
2368 }
2369 else if(attName == "v5x")
2370 {
2371 v5x = eval.Evaluate(attValue);
2372 }
2373 else if(attName == "v5y")
2374 {
2375 v5y = eval.Evaluate(attValue);
2376 }
2377 else if(attName == "v6x")
2378 {
2379 v6x = eval.Evaluate(attValue);
2380 }
2381 else if(attName == "v6y")
2382 {
2383 v6y = eval.Evaluate(attValue);
2384 }
2385 else if(attName == "v7x")
2386 {
2387 v7x = eval.Evaluate(attValue);
2388 }
2389 else if(attName == "v7y")
2390 {
2391 v7y = eval.Evaluate(attValue);
2392 }
2393 else if(attName == "v8x")
2394 {
2395 v8x = eval.Evaluate(attValue);
2396 }
2397 else if(attName == "v8y")
2398 {
2399 v8y = eval.Evaluate(attValue);
2400 }
2401 }
2402
2403 dz *= lunit;
2404 std::vector<G4TwoVector> vertices;
2405 vertices.push_back(G4TwoVector(v1x * lunit, v1y * lunit));
2406 vertices.push_back(G4TwoVector(v2x * lunit, v2y * lunit));
2407 vertices.push_back(G4TwoVector(v3x * lunit, v3y * lunit));
2408 vertices.push_back(G4TwoVector(v4x * lunit, v4y * lunit));
2409 vertices.push_back(G4TwoVector(v5x * lunit, v5y * lunit));
2410 vertices.push_back(G4TwoVector(v6x * lunit, v6y * lunit));
2411 vertices.push_back(G4TwoVector(v7x * lunit, v7y * lunit));
2412 vertices.push_back(G4TwoVector(v8x * lunit, v8y * lunit));
2413 new G4GenericTrap(name, dz, vertices);
2414}
CLHEP::Hep2Vector G4TwoVector
Definition: G4TwoVector.hh:36

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ GetAuxList()

const G4GDMLAuxListType * G4GDMLRead::GetAuxList ( ) const
inherited

Definition at line 563 of file G4GDMLRead.cc.

564{
565 return &auxGlobalList;
566}
G4GDMLAuxListType auxGlobalList
Definition: G4GDMLRead.hh:164

References G4GDMLRead::auxGlobalList.

◆ GetConstant()

G4double G4GDMLReadDefine::GetConstant ( const G4String ref)
inherited

Definition at line 758 of file G4GDMLReadDefine.cc.

759{
760 return eval.GetConstant(ref);
761}
G4double GetConstant(const G4String &)

References G4GDMLRead::eval, and G4GDMLEvaluator::GetConstant().

◆ GetElement()

G4Element * G4GDMLReadMaterials::GetElement ( const G4String ref,
G4bool  verbose = true 
) const
inherited

Definition at line 932 of file G4GDMLReadMaterials.cc.

934{
935 G4Element* elementPtr = G4Element::GetElement(ref, false);
936
937 if(elementPtr == nullptr)
938 {
939 elementPtr = G4NistManager::Instance()->FindOrBuildElement(ref);
940 }
941
942 if(verbose && elementPtr == nullptr)
943 {
944 G4String error_msg = "Referenced element '" + ref + "' was not found!";
945 G4Exception("G4GDMLReadMaterials::GetElement()", "InvalidRead",
946 FatalException, error_msg);
947 }
948
949 return elementPtr;
950}
static G4Element * GetElement(G4String name, G4bool warning=true)
Definition: G4Element.cc:411
static G4NistManager * Instance()
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)

References FatalException, G4NistManager::FindOrBuildElement(), G4Exception(), G4Element::GetElement(), and G4NistManager::Instance().

Referenced by G4GDMLReadMaterials::MixtureRead().

◆ GetIsotope()

G4Isotope * G4GDMLReadMaterials::GetIsotope ( const G4String ref,
G4bool  verbose = true 
) const
inherited

Definition at line 953 of file G4GDMLReadMaterials.cc.

955{
956 G4Isotope* isotopePtr = G4Isotope::GetIsotope(ref, false);
957
958 if(verbose && isotopePtr == nullptr)
959 {
960 G4String error_msg = "Referenced isotope '" + ref + "' was not found!";
961 G4Exception("G4GDMLReadMaterials::GetIsotope()", "InvalidRead",
962 FatalException, error_msg);
963 }
964
965 return isotopePtr;
966}
static G4Isotope * GetIsotope(const G4String &name, G4bool warning=false)
Definition: G4Isotope.cc:195

References FatalException, G4Exception(), and G4Isotope::GetIsotope().

Referenced by G4GDMLReadMaterials::MixtureRead().

◆ GetMaterial()

G4Material * G4GDMLReadMaterials::GetMaterial ( const G4String ref,
G4bool  verbose = true 
) const
inherited

Definition at line 969 of file G4GDMLReadMaterials.cc.

971{
972 G4Material* materialPtr = G4Material::GetMaterial(ref, false);
973
974 if(materialPtr == nullptr)
975 {
976 materialPtr = G4NistManager::Instance()->FindOrBuildMaterial(ref);
977 }
978
979 if(verbose && materialPtr == nullptr)
980 {
981 G4String error_msg = "Referenced material '" + ref + "' was not found!";
982 G4Exception("G4GDMLReadMaterials::GetMaterial()", "InvalidRead",
983 FatalException, error_msg);
984 }
985
986 return materialPtr;
987}
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:686
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)

References FatalException, G4NistManager::FindOrBuildMaterial(), G4Exception(), G4Material::GetMaterial(), and G4NistManager::Instance().

Referenced by G4GDMLReadMaterials::MixtureRead(), and G4GDMLReadStructure::VolumeRead().

◆ GetMatrix()

G4GDMLMatrix G4GDMLReadDefine::GetMatrix ( const G4String ref)
inherited

Definition at line 818 of file G4GDMLReadDefine.cc.

819{
820 if(matrixMap.find(ref) == matrixMap.end())
821 {
822 G4String error_msg = "Matrix '" + ref + "' was not found!";
823 G4Exception("G4GDMLReadDefine::getMatrix()", "ReadError", FatalException,
824 error_msg);
825 }
826 return matrixMap[ref];
827}
std::map< G4String, G4GDMLMatrix > matrixMap

References FatalException, G4Exception(), and G4GDMLReadDefine::matrixMap.

Referenced by G4GDMLReadMaterials::PropertyRead(), and G4GDMLReadSolids::PropertyRead().

◆ GetPosition()

G4ThreeVector G4GDMLReadDefine::GetPosition ( const G4String ref)
inherited

Definition at line 782 of file G4GDMLReadDefine.cc.

783{
784 if(positionMap.find(ref) == positionMap.cend())
785 {
786 G4String error_msg = "Position '" + ref + "' was not found!";
787 G4Exception("G4GDMLReadDefine::getPosition()", "ReadError", FatalException,
788 error_msg);
789 }
790 return positionMap[ref];
791}
std::map< G4String, G4ThreeVector > positionMap

References FatalException, G4Exception(), and G4GDMLReadDefine::positionMap.

Referenced by G4GDMLReadSolids::BooleanRead(), G4GDMLReadSolids::MultiUnionNodeRead(), ParametersRead(), G4GDMLReadStructure::PhysvolRead(), G4GDMLReadSolids::QuadrangularRead(), G4GDMLReadStructure::ReplicaRead(), G4GDMLReadSolids::TetRead(), and G4GDMLReadSolids::TriangularRead().

◆ GetQuantity()

G4double G4GDMLReadDefine::GetQuantity ( const G4String ref)
inherited

Definition at line 770 of file G4GDMLReadDefine.cc.

771{
772 if(quantityMap.find(ref) == quantityMap.cend())
773 {
774 G4String error_msg = "Quantity '" + ref + "' was not found!";
775 G4Exception("G4GDMLReadDefine::getQuantity()", "ReadError", FatalException,
776 error_msg);
777 }
778 return quantityMap[ref];
779}
std::map< G4String, G4double > quantityMap

References FatalException, G4Exception(), and G4GDMLReadDefine::quantityMap.

Referenced by G4GDMLReadMaterials::MaterialRead().

◆ GetRotation()

G4ThreeVector G4GDMLReadDefine::GetRotation ( const G4String ref)
inherited

Definition at line 794 of file G4GDMLReadDefine.cc.

795{
796 if(rotationMap.find(ref) == rotationMap.cend())
797 {
798 G4String error_msg = "Rotation '" + ref + "' was not found!";
799 G4Exception("G4GDMLReadDefine::getRotation()", "ReadError", FatalException,
800 error_msg);
801 }
802 return rotationMap[ref];
803}
std::map< G4String, G4ThreeVector > rotationMap

References FatalException, G4Exception(), and G4GDMLReadDefine::rotationMap.

Referenced by G4GDMLReadSolids::BooleanRead(), G4GDMLReadSolids::MultiUnionNodeRead(), ParametersRead(), G4GDMLReadStructure::PhysvolRead(), and G4GDMLReadStructure::ReplicaRead().

◆ GetRotationMatrix()

G4RotationMatrix G4GDMLReadDefine::GetRotationMatrix ( const G4ThreeVector angles)
protectedinherited

Definition at line 153 of file G4GDMLReadDefine.cc.

155{
157
158 rot.rotateX(angles.x());
159 rot.rotateY(angles.y());
160 rot.rotateZ(angles.z());
161 rot.rectify(); // Rectify matrix from possible roundoff errors
162
163 return rot;
164}
double z() const
double x() const
double y() const
HepRotation & rotateX(double delta)
Definition: Rotation.cc:61
HepRotation & rotateZ(double delta)
Definition: Rotation.cc:87
HepRotation & rotateY(double delta)
Definition: Rotation.cc:74

References CLHEP::HepRotation::rectify(), CLHEP::HepRotation::rotateX(), CLHEP::HepRotation::rotateY(), CLHEP::HepRotation::rotateZ(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4GDMLReadSolids::BooleanRead(), G4GDMLReadSolids::MultiUnionNodeRead(), G4GDMLReadStructure::PhysvolRead(), and G4GDMLReadSolids::ReflectedSolidRead().

◆ GetScale()

G4ThreeVector G4GDMLReadDefine::GetScale ( const G4String ref)
inherited

Definition at line 806 of file G4GDMLReadDefine.cc.

807{
808 if(scaleMap.find(ref) == scaleMap.end())
809 {
810 G4String error_msg = "Scale '" + ref + "' was not found!";
811 G4Exception("G4GDMLReadDefine::getScale()", "ReadError", FatalException,
812 error_msg);
813 }
814 return scaleMap[ref];
815}
std::map< G4String, G4ThreeVector > scaleMap

References FatalException, G4Exception(), and G4GDMLReadDefine::scaleMap.

Referenced by G4GDMLReadStructure::PhysvolRead(), and G4GDMLReadSolids::ScaledSolidRead().

◆ GetSetup()

G4String G4GDMLReadSetup::GetSetup ( const G4String ref)
virtualinherited

Implements G4GDMLRead.

Definition at line 45 of file G4GDMLReadSetup.cc.

46{
47 if(setupMap.size() == 1) // If there is only one setup defined,
48 { // no matter how it is named
49 return setupMap.cbegin()->second;
50 }
51
52 if(setupMap.find(ref) == setupMap.cend())
53 {
54#ifdef G4VERBOSE
55 std::ostringstream message;
56 message << "Referenced setup '" << ref << "' was not found!";
57 G4Exception("G4GDMLReadSetup::getSetup()", "NullSetup", JustWarning,
58 message, "Returning NULL pointer!");
59#endif
60 return "";
61 }
62
63 return setupMap[ref];
64}
std::map< G4String, G4String > setupMap

References G4Exception(), JustWarning, and G4GDMLReadSetup::setupMap.

Referenced by G4GDMLReadStructure::FileRead(), and G4GDMLReadStructure::GetWorldVolume().

◆ GetSolid()

G4VSolid * G4GDMLReadSolids::GetSolid ( const G4String ref) const
inherited

Definition at line 4057 of file G4GDMLReadSolids.cc.

4058{
4060 ->GetSolid(ref,false,reverseSearch);
4061
4062 if(solidPtr == nullptr)
4063 {
4064 G4String error_msg = "Referenced solid '" + ref + "' was not found!";
4065 G4Exception("G4GDMLReadSolids::GetSolid()", "ReadError", FatalException,
4066 error_msg);
4067 }
4068
4069 return solidPtr;
4070}
G4VSolid * GetSolid(const G4String &name, G4bool verbose=true, G4bool reverseSearch=false) const
static G4SolidStore * GetInstance()

References FatalException, G4Exception(), G4SolidStore::GetInstance(), G4SolidStore::GetSolid(), and G4GDMLReadDefine::reverseSearch.

Referenced by G4GDMLReadSolids::BooleanRead(), G4GDMLReadSolids::MultiUnionNodeRead(), G4GDMLReadSolids::ReflectedSolidRead(), G4GDMLReadSolids::ScaledSolidRead(), and G4GDMLReadStructure::VolumeRead().

◆ GetSurfaceProperty()

G4SurfaceProperty * G4GDMLReadSolids::GetSurfaceProperty ( const G4String ref) const
inherited

Definition at line 4073 of file G4GDMLReadSolids.cc.

4075{
4076 const G4SurfacePropertyTable* surfaceList =
4078 const std::size_t surfaceCount = surfaceList->size();
4079
4080 for(std::size_t i = 0; i < surfaceCount; ++i)
4081 {
4082 if((*surfaceList)[i]->GetName() == ref)
4083 {
4084 return (*surfaceList)[i];
4085 }
4086 }
4087
4088 G4String error_msg =
4089 "Referenced optical surface '" + ref + "' was not found!";
4090 G4Exception("G4GDMLReadSolids::GetSurfaceProperty()", "ReadError",
4091 FatalException, error_msg);
4092
4093 return nullptr;
4094}
std::vector< G4SurfaceProperty * > G4SurfacePropertyTable
static const G4SurfacePropertyTable * GetSurfacePropertyTable()

References FatalException, G4Exception(), and G4SurfaceProperty::GetSurfacePropertyTable().

Referenced by G4GDMLReadStructure::BorderSurfaceRead(), and G4GDMLReadStructure::SkinSurfaceRead().

◆ GetVariable()

G4double G4GDMLReadDefine::GetVariable ( const G4String ref)
inherited

Definition at line 764 of file G4GDMLReadDefine.cc.

765{
766 return eval.GetVariable(ref);
767}
G4double GetVariable(const G4String &)

References G4GDMLRead::eval, and G4GDMLEvaluator::GetVariable().

◆ GetVolume()

virtual G4LogicalVolume * G4GDMLRead::GetVolume ( const G4String ) const
pure virtualinherited

Implemented in G4GDMLReadStructure.

Referenced by ParamvolRead().

◆ Hype_dimensionsRead()

void G4GDMLReadParamvol::Hype_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 819 of file G4GDMLReadParamvol.cc.

822{
823 G4double lunit = 1.0;
824 G4double aunit = 1.0;
825
826 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
827 XMLSize_t attributeCount = attributes->getLength();
828
829 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
830 ++attribute_index)
831 {
832 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
833
834 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
835 {
836 continue;
837 }
838
839 const xercesc::DOMAttr* const attribute =
840 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
841 if(attribute == nullptr)
842 {
843 G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", "InvalidRead",
844 FatalException, "No attribute found!");
845 return;
846 }
847 const G4String attName = Transcode(attribute->getName());
848 const G4String attValue = Transcode(attribute->getValue());
849
850 if(attName == "lunit")
851 {
852 lunit = G4UnitDefinition::GetValueOf(attValue);
853 if(G4UnitDefinition::GetCategory(attValue) != "Length")
854 {
855 G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", "InvalidRead",
856 FatalException, "Invalid unit for length!");
857 }
858 }
859 else if(attName == "aunit")
860 {
861 aunit = G4UnitDefinition::GetValueOf(attValue);
862 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
863 {
864 G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", "InvalidRead",
865 FatalException, "Invalid unit for angle!");
866 }
867 }
868 else if(attName == "rmin")
869 {
870 parameter.dimension[0] = eval.Evaluate(attValue);
871 }
872 else if(attName == "rmax")
873 {
874 parameter.dimension[1] = eval.Evaluate(attValue);
875 }
876 else if(attName == "inst")
877 {
878 parameter.dimension[2] = eval.Evaluate(attValue);
879 }
880 else if(attName == "outst")
881 {
882 parameter.dimension[3] = eval.Evaluate(attValue);
883 }
884 else if(attName == "z")
885 {
886 parameter.dimension[4] = eval.Evaluate(attValue);
887 }
888 }
889
890 parameter.dimension[0] = lunit;
891 parameter.dimension[1] = lunit;
892 parameter.dimension[2] = aunit;
893 parameter.dimension[3] = aunit;
894 parameter.dimension[4] = 0.5 * lunit;
895}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ HypeRead()

void G4GDMLReadSolids::HypeRead ( const xercesc::DOMElement * const  hypeElement)
protectedinherited

Definition at line 694 of file G4GDMLReadSolids.cc.

695{
697 G4double lunit = 1.0;
698 G4double aunit = 1.0;
699 G4double rmin = 0.0;
700 G4double rmax = 0.0;
701 G4double inst = 0.0;
702 G4double outst = 0.0;
703 G4double z = 0.0;
704
705 const xercesc::DOMNamedNodeMap* const attributes =
706 hypeElement->getAttributes();
707 XMLSize_t attributeCount = attributes->getLength();
708
709 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
710 ++attribute_index)
711 {
712 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
713
714 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
715 {
716 continue;
717 }
718
719 const xercesc::DOMAttr* const attribute =
720 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
721 if(attribute == nullptr)
722 {
723 G4Exception("G4GDMLReadSolids::HypeRead()", "InvalidRead", FatalException,
724 "No attribute found!");
725 return;
726 }
727 const G4String attName = Transcode(attribute->getName());
728 const G4String attValue = Transcode(attribute->getValue());
729
730 if(attName == "name")
731 {
732 name = GenerateName(attValue);
733 }
734 else if(attName == "lunit")
735 {
736 lunit = G4UnitDefinition::GetValueOf(attValue);
737 if(G4UnitDefinition::GetCategory(attValue) != "Length")
738 {
739 G4Exception("G4GDMLReadSolids::HypeRead()", "InvalidRead",
740 FatalException, "Invalid unit for length!");
741 }
742 }
743 else if(attName == "aunit")
744 {
745 aunit = G4UnitDefinition::GetValueOf(attValue);
746 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
747 {
748 G4Exception("G4GDMLReadSolids::HypeRead()", "InvalidRead",
749 FatalException, "Invalid unit for angle!");
750 }
751 }
752 else if(attName == "rmin")
753 {
754 rmin = eval.Evaluate(attValue);
755 }
756 else if(attName == "rmax")
757 {
758 rmax = eval.Evaluate(attValue);
759 }
760 else if(attName == "inst")
761 {
762 inst = eval.Evaluate(attValue);
763 }
764 else if(attName == "outst")
765 {
766 outst = eval.Evaluate(attValue);
767 }
768 else if(attName == "z")
769 {
770 z = eval.Evaluate(attValue);
771 }
772 }
773
774 rmin *= lunit;
775 rmax *= lunit;
776 inst *= aunit;
777 outst *= aunit;
778 z *= 0.5 * lunit;
779
780 new G4Hype(name, rmin, rmax, inst, outst, z);
781}
Definition: G4Hype.hh:69

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ IsotopeRead()

void G4GDMLReadMaterials::IsotopeRead ( const xercesc::DOMElement * const  isotopeElement)
protectedinherited

Definition at line 472 of file G4GDMLReadMaterials.cc.

474{
476 G4int Z = 0;
477 G4int N = 0;
478 G4double a = 0.0;
479
480 const xercesc::DOMNamedNodeMap* const attributes =
481 isotopeElement->getAttributes();
482 XMLSize_t attributeCount = attributes->getLength();
483
484 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
485 ++attribute_index)
486 {
487 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
488
489 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
490 {
491 continue;
492 }
493
494 const xercesc::DOMAttr* const attribute =
495 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
496 if(attribute == nullptr)
497 {
498 G4Exception("G4GDMLReadMaterials::IsotopeRead()", "InvalidRead",
499 FatalException, "No attribute found!");
500 return;
501 }
502 const G4String attName = Transcode(attribute->getName());
503 const G4String attValue = Transcode(attribute->getValue());
504
505 if(attName == "name")
506 {
507 name = GenerateName(attValue);
508 }
509 else if(attName == "Z")
510 {
511 Z = eval.EvaluateInteger(attValue);
512 }
513 else if(attName == "N")
514 {
515 N = eval.EvaluateInteger(attValue);
516 }
517 }
518
519 for(xercesc::DOMNode* iter = isotopeElement->getFirstChild(); iter != nullptr;
520 iter = iter->getNextSibling())
521 {
522 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
523 {
524 continue;
525 }
526
527 const xercesc::DOMElement* const child =
528 dynamic_cast<xercesc::DOMElement*>(iter);
529 if(child == nullptr)
530 {
531 G4Exception("G4GDMLReadMaterials::IsotopeRead()", "InvalidRead",
532 FatalException, "No child found!");
533 return;
534 }
535 const G4String tag = Transcode(child->getTagName());
536
537 if(tag == "atom")
538 {
539 a = AtomRead(child);
540 }
541 }
542
543 new G4Isotope(Strip(name), Z, N, a);
544}

References G4GDMLReadMaterials::AtomRead(), G4GDMLRead::eval, G4GDMLEvaluator::EvaluateInteger(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4InuclParticleNames::name(), G4GDMLRead::Strip(), G4GDMLRead::Transcode(), and Z.

Referenced by G4GDMLReadMaterials::MaterialsRead().

◆ IsValidID()

G4bool G4GDMLReadDefine::IsValidID ( const G4String ref) const
inherited

Definition at line 752 of file G4GDMLReadDefine.cc.

753{
754 return eval.IsVariable(ref);
755}
G4bool IsVariable(const G4String &) const

References G4GDMLRead::eval, and G4GDMLEvaluator::IsVariable().

◆ LoopRead()

void G4GDMLRead::LoopRead ( const xercesc::DOMElement * const  element,
void(G4GDMLRead::*)(const xercesc::DOMElement *const)  func 
)
protectedinherited

Definition at line 194 of file G4GDMLRead.cc.

196{
197 G4String var;
198 G4String from;
199 G4String to;
200 G4String step;
201
202 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
203 XMLSize_t attributeCount = attributes->getLength();
204
205 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
206 ++attribute_index)
207 {
208 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
209
210 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
211 {
212 continue;
213 }
214
215 const xercesc::DOMAttr* const attribute =
216 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
217 if(!attribute)
218 {
219 G4Exception("G4GDMLRead::LoopRead()", "InvalidRead", FatalException,
220 "No attribute found!");
221 return;
222 }
223 const G4String attribute_name = Transcode(attribute->getName());
224 const G4String attribute_value = Transcode(attribute->getValue());
225
226 if(attribute_name == "for")
227 {
228 var = attribute_value;
229 }
230 else if(attribute_name == "from")
231 {
232 from = attribute_value;
233 }
234 else if(attribute_name == "to")
235 {
236 to = attribute_value;
237 }
238 else if(attribute_name == "step")
239 {
240 step = attribute_value;
241 }
242 }
243
244 if(var.empty())
245 {
246 G4Exception("G4GDMLRead::loopRead()", "InvalidRead", FatalException,
247 "No variable is determined for loop!");
248 }
249
250 if(!eval.IsVariable(var))
251 {
252 G4Exception("G4GDMLRead::loopRead()", "InvalidRead", FatalException,
253 "Variable is not defined in loop!");
254 }
255
256 G4int _var = eval.EvaluateInteger(var);
257 G4int _from = eval.EvaluateInteger(from);
258 G4int _to = eval.EvaluateInteger(to);
259 G4int _step = eval.EvaluateInteger(step);
260
261 if(!from.empty())
262 {
263 _var = _from;
264 }
265
266 if((_from < _to) && (_step <= 0))
267 {
268 G4Exception("G4GDMLRead::loopRead()", "InvalidRead", FatalException,
269 "Infinite loop!");
270 }
271 if((_from > _to) && (_step >= 0))
272 {
273 G4Exception("G4GDMLRead::loopRead()", "InvalidRead", FatalException,
274 "Infinite loop!");
275 }
276
277 ++inLoop;
278
279 while(_var <= _to)
280 {
281 eval.SetVariable(var, _var);
282 (this->*func)(element);
283 _var += _step;
284 ++loopCount;
285 }
286
287 --inLoop;
288 if(!inLoop)
289 {
290 loopCount = 0;
291 }
292}
void SetVariable(const G4String &, G4double)
G4int loopCount
Definition: G4GDMLRead.hh:163

References G4GDMLRead::eval, G4GDMLEvaluator::EvaluateInteger(), FatalException, G4Exception(), G4GDMLRead::inLoop, G4GDMLEvaluator::IsVariable(), G4GDMLRead::loopCount, G4GDMLEvaluator::SetVariable(), and G4GDMLRead::Transcode().

Referenced by ParameterisedRead(), Paramvol_contentRead(), G4GDMLReadSolids::SolidsRead(), G4GDMLReadStructure::StructureRead(), and G4GDMLReadStructure::Volume_contentRead().

◆ MaterialRead()

void G4GDMLReadMaterials::MaterialRead ( const xercesc::DOMElement * const  materialElement)
protectedinherited

Definition at line 547 of file G4GDMLReadMaterials.cc.

549{
551 G4double Z = 0.0;
552 G4double a = 0.0;
553 G4double D = 0.0;
554 G4State state = kStateUndefined;
557 G4double MEE = -1.0;
558
559 const xercesc::DOMNamedNodeMap* const attributes =
560 materialElement->getAttributes();
561 XMLSize_t attributeCount = attributes->getLength();
562
563 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
564 ++attribute_index)
565 {
566 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
567
568 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
569 {
570 continue;
571 }
572
573 const xercesc::DOMAttr* const attribute =
574 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
575 if(attribute == nullptr)
576 {
577 G4Exception("G4GDMLReadMaterials::MaterialRead()", "InvalidRead",
578 FatalException, "No attribute found!");
579 return;
580 }
581 const G4String attName = Transcode(attribute->getName());
582 const G4String attValue = Transcode(attribute->getValue());
583
584 if(attName == "name")
585 {
586 name = GenerateName(attValue);
587 }
588 else if(attName == "Z")
589 {
590 Z = eval.Evaluate(attValue);
591 }
592 else if(attName == "state")
593 {
594 if(attValue == "solid")
595 {
596 state = kStateSolid;
597 }
598 else if(attValue == "liquid")
599 {
600 state = kStateLiquid;
601 }
602 else if(attValue == "gas")
603 {
604 state = kStateGas;
605 }
606 }
607 }
608
609 std::size_t nComponents = 0;
610
611 for(xercesc::DOMNode* iter = materialElement->getFirstChild();
612 iter != nullptr; iter = iter->getNextSibling())
613 {
614 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
615 {
616 continue;
617 }
618
619 const xercesc::DOMElement* const child =
620 dynamic_cast<xercesc::DOMElement*>(iter);
621 if(child == nullptr)
622 {
623 G4Exception("G4GDMLReadMaterials::MaterialRead()", "InvalidRead",
624 FatalException, "No child found!");
625 return;
626 }
627 const G4String tag = Transcode(child->getTagName());
628
629 if(tag == "atom")
630 {
631 a = AtomRead(child);
632 }
633 else if(tag == "Dref")
634 {
636 }
637 else if(tag == "Pref")
638 {
640 }
641 else if(tag == "Tref")
642 {
643 T = GetQuantity(GenerateName(RefRead(child)));
644 }
645 else if(tag == "MEEref")
646 {
647 MEE = GetQuantity(GenerateName(RefRead(child)));
648 }
649 else if(tag == "D")
650 {
651 D = DRead(child);
652 }
653 else if(tag == "P")
654 {
655 P = PRead(child);
656 }
657 else if(tag == "T")
658 {
659 T = TRead(child);
660 }
661 else if(tag == "MEE")
662 {
663 MEE = MEERead(child);
664 }
665 else if(tag == "fraction" || tag == "composite")
666 {
667 nComponents++;
668 }
669 }
670
671 G4Material* material = nullptr;
672
673 if(nComponents == 0)
674 {
675 material = new G4Material(Strip(name), Z, a, D, state, T, P);
676 }
677 else
678 {
679 material = new G4Material(Strip(name), D, nComponents, state, T, P);
680 MixtureRead(materialElement, material);
681 }
682 if(MEE != -1) // ionisation potential (mean excitation energy)
683 {
684 material->GetIonisation()->SetMeanExcitationEnergy(MEE);
685 }
686
687 for(xercesc::DOMNode* iter = materialElement->getFirstChild();
688 iter != nullptr; iter = iter->getNextSibling())
689 {
690 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
691 {
692 continue;
693 }
694
695 const xercesc::DOMElement* const child =
696 dynamic_cast<xercesc::DOMElement*>(iter);
697 if(child == nullptr)
698 {
699 G4Exception("G4GDMLReadMaterials::MaterialRead()", "InvalidRead",
700 FatalException, "No child found!");
701 return;
702 }
703 const G4String tag = Transcode(child->getTagName());
704
705 if(tag == "property")
706 {
707 PropertyRead(child, material);
708 }
709 }
710}
G4double D(G4double temp)
G4State
Definition: G4Material.hh:111
@ kStateSolid
Definition: G4Material.hh:111
@ kStateLiquid
Definition: G4Material.hh:111
@ kStateGas
Definition: G4Material.hh:111
@ kStateUndefined
Definition: G4Material.hh:111
static const G4double NTP_Temperature
Definition: G4Material.hh:113
G4double GetQuantity(const G4String &)
void PropertyRead(const xercesc::DOMElement *const, G4Material *)
G4double MEERead(const xercesc::DOMElement *const)
G4double DRead(const xercesc::DOMElement *const)
G4double PRead(const xercesc::DOMElement *const)
G4double TRead(const xercesc::DOMElement *const)
string material
Definition: eplot.py:19
int STP_Pressure
Definition: hepunit.py:302
static double P[]

References G4GDMLReadMaterials::AtomRead(), D(), G4GDMLReadMaterials::DRead(), G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetQuantity(), kStateGas, kStateLiquid, kStateSolid, kStateUndefined, eplot::material, G4GDMLReadMaterials::MEERead(), G4GDMLReadMaterials::MixtureRead(), G4InuclParticleNames::name(), NTP_Temperature, P, G4GDMLReadMaterials::PRead(), G4GDMLReadMaterials::PropertyRead(), G4GDMLReadDefine::RefRead(), source.hepunit::STP_Pressure, G4GDMLRead::Strip(), G4GDMLRead::Transcode(), G4GDMLReadMaterials::TRead(), and Z.

Referenced by G4GDMLReadMaterials::MaterialsRead().

◆ MaterialsRead()

void G4GDMLReadMaterials::MaterialsRead ( const xercesc::DOMElement * const  materialsElement)
virtualinherited

Implements G4GDMLRead.

Definition at line 882 of file G4GDMLReadMaterials.cc.

884{
885#ifdef G4VERBOSE
886 G4cout << "G4GDML: Reading materials..." << G4endl;
887#endif
888 for(xercesc::DOMNode* iter = materialsElement->getFirstChild();
889 iter != nullptr; iter = iter->getNextSibling())
890 {
891 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
892 {
893 continue;
894 }
895
896 const xercesc::DOMElement* const child =
897 dynamic_cast<xercesc::DOMElement*>(iter);
898 if(child == nullptr)
899 {
900 G4Exception("G4GDMLReadMaterials::MaterialsRead()", "InvalidRead",
901 FatalException, "No child found!");
902 return;
903 }
904 const G4String tag = Transcode(child->getTagName());
905
906 if(tag == "define")
907 {
908 DefineRead(child);
909 }
910 else if(tag == "element")
911 {
912 ElementRead(child);
913 }
914 else if(tag == "isotope")
915 {
916 IsotopeRead(child);
917 }
918 else if(tag == "material")
919 {
920 MaterialRead(child);
921 }
922 else
923 {
924 G4String error_msg = "Unknown tag in materials: " + tag;
925 G4Exception("G4GDMLReadMaterials::MaterialsRead()", "InvalidSetup",
926 FatalException, error_msg);
927 }
928 }
929}
virtual void DefineRead(const xercesc::DOMElement *const)
void ElementRead(const xercesc::DOMElement *const)
void IsotopeRead(const xercesc::DOMElement *const)
void MaterialRead(const xercesc::DOMElement *const)

References G4GDMLReadDefine::DefineRead(), G4GDMLReadMaterials::ElementRead(), FatalException, G4cout, G4endl, G4Exception(), G4GDMLReadMaterials::IsotopeRead(), G4GDMLReadMaterials::MaterialRead(), and G4GDMLRead::Transcode().

◆ MatrixRead()

void G4GDMLReadDefine::MatrixRead ( const xercesc::DOMElement * const  matrixElement)
protectedinherited

Definition at line 255 of file G4GDMLReadDefine.cc.

257{
258 G4String name = "";
259 G4int coldim = 0;
260 G4String values = "";
261
262 const xercesc::DOMNamedNodeMap* const attributes =
263 matrixElement->getAttributes();
264 XMLSize_t attributeCount = attributes->getLength();
265
266 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
267 ++attribute_index)
268 {
269 xercesc::DOMNode* node = attributes->item(attribute_index);
270
271 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
272 {
273 continue;
274 }
275
276 const xercesc::DOMAttr* const attribute =
277 dynamic_cast<xercesc::DOMAttr*>(node);
278 if(attribute == nullptr)
279 {
280 G4Exception("G4GDMLRead::MatrixRead()", "InvalidRead", FatalException,
281 "No attribute found!");
282 return;
283 }
284 const G4String attName = Transcode(attribute->getName());
285 const G4String attValue = Transcode(attribute->getValue());
286
287 if(attName == "name")
288 {
289 name = GenerateName(attValue);
290 }
291 else if(attName == "coldim")
292 {
293 coldim = eval.EvaluateInteger(attValue);
294 }
295 else if(attName == "values")
296 {
297 values = attValue;
298 }
299 }
300
301 std::stringstream MatrixValueStream(values);
302 std::vector<G4double> valueList;
303
304 while(!MatrixValueStream.eof())
305 {
306 G4String MatrixValue;
307 MatrixValueStream >> MatrixValue;
308 valueList.push_back(eval.Evaluate(MatrixValue));
309 }
310
311 eval.DefineMatrix(name, coldim, valueList);
312
313 G4GDMLMatrix matrix(valueList.size() / coldim, coldim);
314
315 for(std::size_t i = 0; i < valueList.size(); ++i)
316 {
317 matrix.Set(i / coldim, i % coldim, valueList[i]);
318 }
319
320 matrixMap[name] = matrix;
321}
void DefineMatrix(const G4String &, G4int, std::vector< G4double >)

References G4GDMLEvaluator::DefineMatrix(), G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), G4GDMLEvaluator::EvaluateInteger(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::matrixMap, G4InuclParticleNames::name(), G4GDMLMatrix::Set(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadDefine::DefineRead().

◆ MEERead()

G4double G4GDMLReadMaterials::MEERead ( const xercesc::DOMElement * const  PElement)
protectedinherited

Definition at line 291 of file G4GDMLReadMaterials.cc.

292{
293 G4double value = -1;
294 G4double unit = eV;
295
296 const xercesc::DOMNamedNodeMap* const attributes = PElement->getAttributes();
297 XMLSize_t attributeCount = attributes->getLength();
298
299 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
300 ++attribute_index)
301 {
302 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
303
304 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
305 {
306 continue;
307 }
308
309 const xercesc::DOMAttr* const attribute =
310 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
311 if(attribute == nullptr)
312 {
313 G4Exception("G4GDMLReadMaterials::MEERead()", "InvalidRead",
314 FatalException, "No attribute found!");
315 return value;
316 }
317 const G4String attName = Transcode(attribute->getName());
318 const G4String attValue = Transcode(attribute->getValue());
319
320 if(attName == "value")
321 {
322 value = eval.Evaluate(attValue);
323 }
324 else if(attName == "unit")
325 {
326 unit = G4UnitDefinition::GetValueOf(attValue);
327 if(G4UnitDefinition::GetCategory(attValue) != "Energy")
328 {
329 G4Exception("G4GDMLReadMaterials::MEERead()", "InvalidRead",
330 FatalException, "Invalid unit for energy!");
331 }
332 }
333 }
334
335 return value * unit;
336}
static constexpr double eV
Definition: G4SIunits.hh:201

References eV, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::MaterialRead().

◆ MixtureRead() [1/2]

void G4GDMLReadMaterials::MixtureRead ( const xercesc::DOMElement * const  mixtureElement,
G4Element element 
)
protectedinherited

Definition at line 713 of file G4GDMLReadMaterials.cc.

715{
716 for(xercesc::DOMNode* iter = mixtureElement->getFirstChild(); iter != nullptr;
717 iter = iter->getNextSibling())
718 {
719 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
720 {
721 continue;
722 }
723
724 const xercesc::DOMElement* const child =
725 dynamic_cast<xercesc::DOMElement*>(iter);
726 if(child == nullptr)
727 {
728 G4Exception("G4GDMLReadMaterials::MixtureRead()", "InvalidRead",
729 FatalException, "No child found!");
730 return;
731 }
732 const G4String tag = Transcode(child->getTagName());
733
734 if(tag == "fraction")
735 {
736 G4String ref;
737 G4double n = FractionRead(child, ref);
738 element->AddIsotope(GetIsotope(GenerateName(ref, true)), n);
739 }
740 }
741}
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
Definition: G4Element.cc:151
G4Isotope * GetIsotope(const G4String &, G4bool verbose=true) const
G4double FractionRead(const xercesc::DOMElement *const, G4String &)

References G4Element::AddIsotope(), FatalException, G4GDMLReadMaterials::FractionRead(), G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadMaterials::GetIsotope(), CLHEP::detail::n, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::ElementRead(), and G4GDMLReadMaterials::MaterialRead().

◆ MixtureRead() [2/2]

void G4GDMLReadMaterials::MixtureRead ( const xercesc::DOMElement * const  mixtureElement,
G4Material material 
)
protectedinherited

Definition at line 744 of file G4GDMLReadMaterials.cc.

746{
747 for(xercesc::DOMNode* iter = mixtureElement->getFirstChild(); iter != nullptr;
748 iter = iter->getNextSibling())
749 {
750 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
751 {
752 continue;
753 }
754
755 const xercesc::DOMElement* const child =
756 dynamic_cast<xercesc::DOMElement*>(iter);
757 if(child == nullptr)
758 {
759 G4Exception("G4GDMLReadMaterials::MixtureRead()", "InvalidRead",
760 FatalException, "No child found!");
761 return;
762 }
763 const G4String tag = Transcode(child->getTagName());
764
765 if(tag == "fraction")
766 {
767 G4String ref;
768 G4double n = FractionRead(child, ref);
769
770 G4Material* materialPtr = GetMaterial(GenerateName(ref, true), false);
771 G4Element* elementPtr = GetElement(GenerateName(ref, true), false);
772
773 if(elementPtr != nullptr)
774 {
775 material->AddElement(elementPtr, n);
776 }
777 else if(materialPtr != nullptr)
778 {
779 material->AddMaterial(materialPtr, n);
780 }
781
782 if((materialPtr == nullptr) && (elementPtr == nullptr))
783 {
784 G4String error_msg = "Referenced material/element '" +
785 GenerateName(ref, true) + "' was not found!";
786 G4Exception("G4GDMLReadMaterials::MixtureRead()", "InvalidSetup",
787 FatalException, error_msg);
788 }
789 }
790 else if(tag == "composite")
791 {
792 G4String ref;
793 G4int n = CompositeRead(child, ref);
794
795 G4Element* elementPtr = GetElement(GenerateName(ref, true));
796 material->AddElement(elementPtr, n);
797 }
798 }
799}
G4Material * GetMaterial(const G4String &, G4bool verbose=true) const
G4Element * GetElement(const G4String &, G4bool verbose=true) const
G4int CompositeRead(const xercesc::DOMElement *const, G4String &)

References G4GDMLReadMaterials::CompositeRead(), FatalException, G4GDMLReadMaterials::FractionRead(), G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadMaterials::GetElement(), G4GDMLReadMaterials::GetMaterial(), eplot::material, CLHEP::detail::n, and G4GDMLRead::Transcode().

◆ MultiUnionNodeRead()

void G4GDMLReadSolids::MultiUnionNodeRead ( const xercesc::DOMElement * const  unionNodeElement,
G4MultiUnion * const  multiUnionSolid 
)
protectedinherited

Definition at line 784 of file G4GDMLReadSolids.cc.

787{
789 G4String solid;
790 G4ThreeVector position(0.0, 0.0, 0.0);
791 G4ThreeVector rotation(0.0, 0.0, 0.0);
792
793 const xercesc::DOMNamedNodeMap* const attributes =
794 unionNodeElement->getAttributes();
795 XMLSize_t attributeCount = attributes->getLength();
796
797 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
798 ++attribute_index)
799 {
800 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
801
802 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
803 {
804 continue;
805 }
806
807 const xercesc::DOMAttr* const attribute =
808 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
809 if(attribute == nullptr)
810 {
811 G4Exception("G4GDMLReadSolids::MultiUnionNodeRead()", "InvalidRead",
812 FatalException, "No attribute found!");
813 return;
814 }
815 const G4String attName = Transcode(attribute->getName());
816 const G4String attValue = Transcode(attribute->getValue());
817
818 if(attName == "name")
819 {
820 name = GenerateName(attValue);
821 }
822 }
823
824 for(xercesc::DOMNode* iter = unionNodeElement->getFirstChild();
825 iter != nullptr; iter = iter->getNextSibling())
826 {
827 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
828 {
829 continue;
830 }
831
832 const xercesc::DOMElement* const child =
833 dynamic_cast<xercesc::DOMElement*>(iter);
834 if(child == nullptr)
835 {
836 G4Exception("G4GDMLReadSolids::MultiUnionNodeRead()", "InvalidRead",
837 FatalException, "No child found!");
838 return;
839 }
840 const G4String tag = Transcode(child->getTagName());
841
842 if(tag == "position")
843 {
844 VectorRead(child, position);
845 }
846 else if(tag == "rotation")
847 {
848 VectorRead(child, rotation);
849 }
850 else if(tag == "positionref")
851 {
853 }
854 else if(tag == "rotationref")
855 {
856 rotation = GetRotation(GenerateName(RefRead(child)));
857 }
858 else if(tag == "solid")
859 {
860 solid = RefRead(child);
861 }
862 else
863 {
864 G4String error_msg = "Unknown tag in MultiUnion structure: " + tag;
865 G4Exception("G4GDMLReadSolids::MultiUnionNodeRead()", "ReadError",
866 FatalException, error_msg);
867 }
868 }
869 G4VSolid* solidNode = GetSolid(GenerateName(solid));
871 multiUnionSolid->AddNode(*solidNode, transform);
872}
void AddNode(G4VSolid &solid, const G4Transform3D &trans)
Definition: G4MultiUnion.cc:69

References G4MultiUnion::AddNode(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetPosition(), G4GDMLReadDefine::GetRotation(), G4GDMLReadDefine::GetRotationMatrix(), G4GDMLReadSolids::GetSolid(), G4InuclParticleNames::name(), position, G4GDMLReadDefine::RefRead(), G4GDMLRead::Transcode(), G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), and G4GDMLReadDefine::VectorRead().

Referenced by G4GDMLReadSolids::MultiUnionRead().

◆ MultiUnionRead()

void G4GDMLReadSolids::MultiUnionRead ( const xercesc::DOMElement * const  unionElement)
protectedinherited

Definition at line 875 of file G4GDMLReadSolids.cc.

877{
879
880 const xercesc::DOMNamedNodeMap* const attributes =
881 unionElement->getAttributes();
882 XMLSize_t attributeCount = attributes->getLength();
883
884 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
885 ++attribute_index)
886 {
887 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
888
889 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
890 {
891 continue;
892 }
893
894 const xercesc::DOMAttr* const attribute =
895 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
896 if(attribute == nullptr)
897 {
898 G4Exception("G4GDMLReadSolids::MultiUnionRead()", "InvalidRead",
899 FatalException, "No attribute found!");
900 return;
901 }
902 const G4String attName = Transcode(attribute->getName());
903 const G4String attValue = Transcode(attribute->getValue());
904
905 if(attName == "name")
906 {
907 name = GenerateName(attValue);
908 }
909 }
910
911 G4MultiUnion* multiUnion = new G4MultiUnion(name);
912
913 for(xercesc::DOMNode* iter = unionElement->getFirstChild(); iter != nullptr;
914 iter = iter->getNextSibling())
915 {
916 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
917 {
918 continue;
919 }
920
921 const xercesc::DOMElement* const child =
922 dynamic_cast<xercesc::DOMElement*>(iter);
923 if(child == nullptr)
924 {
925 G4Exception("G4GDMLReadSolids::MultiUnionRead()", "InvalidRead",
926 FatalException, "No child found!");
927 return;
928 }
929 const G4String tag = Transcode(child->getTagName());
930
931 if(tag == "multiUnionNode")
932 {
933 MultiUnionNodeRead(child, multiUnion);
934 }
935 else
936 {
937 G4String error_msg = "Unknown tag in MultiUnion structure: " + tag;
938 G4Exception("G4GDMLReadSolids::MultiUnionRead()", "ReadError",
939 FatalException, error_msg);
940 }
941 }
942 multiUnion->Voxelize();
943}
void MultiUnionNodeRead(const xercesc::DOMElement *const, G4MultiUnion *const)

References FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadSolids::MultiUnionNodeRead(), G4InuclParticleNames::name(), G4GDMLRead::Transcode(), and G4MultiUnion::Voxelize().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ OpticalSurfaceRead()

void G4GDMLReadSolids::OpticalSurfaceRead ( const xercesc::DOMElement * const  opticalsurfaceElement)
protectedinherited

Definition at line 3584 of file G4GDMLReadSolids.cc.

3586{
3587 G4String name;
3588 G4String smodel;
3589 G4String sfinish;
3590 G4String stype;
3591 G4double value = 0.0;
3592
3593 const xercesc::DOMNamedNodeMap* const attributes =
3594 opticalsurfaceElement->getAttributes();
3595 XMLSize_t attributeCount = attributes->getLength();
3596
3597 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3598 ++attribute_index)
3599 {
3600 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3601
3602 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3603 {
3604 continue;
3605 }
3606
3607 const xercesc::DOMAttr* const attribute =
3608 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
3609 if(attribute == nullptr)
3610 {
3611 G4Exception("G4GDMLReadSolids::OpticalSurfaceRead()", "InvalidRead",
3612 FatalException, "No attribute found!");
3613 return;
3614 }
3615 const G4String attName = Transcode(attribute->getName());
3616 const G4String attValue = Transcode(attribute->getValue());
3617
3618 if(attName == "name")
3619 {
3620 name = GenerateName(attValue);
3621 }
3622 else if(attName == "model")
3623 {
3624 smodel = attValue;
3625 }
3626 else if(attName == "finish")
3627 {
3628 sfinish = attValue;
3629 }
3630 else if(attName == "type")
3631 {
3632 stype = attValue;
3633 }
3634 else if(attName == "value")
3635 {
3636 value = eval.Evaluate(attValue);
3637 }
3638 }
3639
3642 G4SurfaceType type;
3643
3644 if((smodel == "glisur") || (smodel == "0"))
3645 {
3646 model = glisur;
3647 }
3648 else if((smodel == "unified") || (smodel == "1"))
3649 {
3650 model = unified;
3651 }
3652 else if((smodel == "LUT") || (smodel == "2"))
3653 {
3654 model = LUT;
3655 }
3656 else if((smodel == "DAVIS") || (smodel == "3"))
3657 {
3658 model = DAVIS;
3659 }
3660 else
3661 {
3662 model = dichroic;
3663 }
3664
3665 if((sfinish == "polished") || (sfinish == "0"))
3666 {
3667 finish = polished;
3668 }
3669 else if((sfinish == "polishedfrontpainted") || (sfinish == "1"))
3670 {
3671 finish = polishedfrontpainted;
3672 }
3673 else if((sfinish == "polishedbackpainted") || (sfinish == "2"))
3674 {
3675 finish = polishedbackpainted;
3676 }
3677 else if((sfinish == "ground") || (sfinish == "3"))
3678 {
3679 finish = ground;
3680 }
3681 else if((sfinish == "groundfrontpainted") || (sfinish == "4"))
3682 {
3683 finish = groundfrontpainted;
3684 }
3685 else if((sfinish == "groundbackpainted") || (sfinish == "5"))
3686 {
3687 finish = groundbackpainted;
3688 }
3689 else if((sfinish == "polishedlumirrorair") || (sfinish == "6"))
3690 {
3691 finish = polishedlumirrorair;
3692 }
3693 else if((sfinish == "polishedlumirrorglue") || (sfinish == "7"))
3694 {
3695 finish = polishedlumirrorglue;
3696 }
3697 else if((sfinish == "polishedair") || (sfinish == "8"))
3698 {
3699 finish = polishedair;
3700 }
3701 else if((sfinish == "polishedteflonair") || (sfinish == "9"))
3702 {
3703 finish = polishedteflonair;
3704 }
3705 else if((sfinish == "polishedtioair") || (sfinish == "10"))
3706 {
3707 finish = polishedtioair;
3708 }
3709 else if((sfinish == "polishedtyvekair") || (sfinish == "11"))
3710 {
3711 finish = polishedtyvekair;
3712 }
3713 else if((sfinish == "polishedvm2000air") || (sfinish == "12"))
3714 {
3715 finish = polishedvm2000air;
3716 }
3717 else if((sfinish == "polishedvm2000glue") || (sfinish == "13"))
3718 {
3719 finish = polishedvm2000glue;
3720 }
3721 else if((sfinish == "etchedlumirrorair") || (sfinish == "14"))
3722 {
3723 finish = etchedlumirrorair;
3724 }
3725 else if((sfinish == "etchedlumirrorglue") || (sfinish == "15"))
3726 {
3727 finish = etchedlumirrorglue;
3728 }
3729 else if((sfinish == "etchedair") || (sfinish == "16"))
3730 {
3731 finish = etchedair;
3732 }
3733 else if((sfinish == "etchedteflonair") || (sfinish == "17"))
3734 {
3735 finish = etchedteflonair;
3736 }
3737 else if((sfinish == "etchedtioair") || (sfinish == "18"))
3738 {
3739 finish = etchedtioair;
3740 }
3741 else if((sfinish == "etchedtyvekair") || (sfinish == "19"))
3742 {
3743 finish = etchedtyvekair;
3744 }
3745 else if((sfinish == "etchedvm2000air") || (sfinish == "20"))
3746 {
3747 finish = etchedvm2000air;
3748 }
3749 else if((sfinish == "etchedvm2000glue") || (sfinish == "21"))
3750 {
3751 finish = etchedvm2000glue;
3752 }
3753 else if((sfinish == "groundlumirrorair") || (sfinish == "22"))
3754 {
3755 finish = groundlumirrorair;
3756 }
3757 else if((sfinish == "groundlumirrorglue") || (sfinish == "23"))
3758 {
3759 finish = groundlumirrorglue;
3760 }
3761 else if((sfinish == "groundair") || (sfinish == "24"))
3762 {
3763 finish = groundair;
3764 }
3765 else if((sfinish == "groundteflonair") || (sfinish == "25"))
3766 {
3767 finish = groundteflonair;
3768 }
3769 else if((sfinish == "groundtioair") || (sfinish == "26"))
3770 {
3771 finish = groundtioair;
3772 }
3773 else if((sfinish == "groundtyvekair") || (sfinish == "27"))
3774 {
3775 finish = groundtyvekair;
3776 }
3777 else if((sfinish == "groundvm2000air") || (sfinish == "28"))
3778 {
3779 finish = groundvm2000air;
3780 }
3781 else if((sfinish == "groundvm2000glue") || (sfinish == "29"))
3782 {
3783 finish = groundvm2000glue;
3784 }
3785 else if((sfinish == "Rough_LUT") || (sfinish == "30"))
3786 {
3787 finish = Rough_LUT;
3788 }
3789 else if((sfinish == "RoughTeflon_LUT") || (sfinish == "31"))
3790 {
3791 finish = RoughTeflon_LUT;
3792 }
3793 else if((sfinish == "RoughESR_LUT") || (sfinish == "32"))
3794 {
3795 finish = RoughESR_LUT;
3796 }
3797 else if((sfinish == "RoughESRGrease_LUT") || (sfinish == "33"))
3798 {
3799 finish = RoughESRGrease_LUT;
3800 }
3801 else if((sfinish == "Polished_LUT") || (sfinish == "34"))
3802 {
3803 finish = Polished_LUT;
3804 }
3805 else if((sfinish == "PolishedTeflon_LUT") || (sfinish == "35"))
3806 {
3807 finish = PolishedTeflon_LUT;
3808 }
3809 else if((sfinish == "PolishedESR_LUT") || (sfinish == "36"))
3810 {
3811 finish = PolishedESR_LUT;
3812 }
3813 else if((sfinish == "PolishedESRGrease_LUT") || (sfinish == "37"))
3814 {
3815 finish = PolishedESRGrease_LUT;
3816 }
3817 else
3818 {
3819 finish = Detector_LUT;
3820 }
3821
3822 if((stype == "dielectric_metal") || (stype == "0"))
3823 {
3824 type = dielectric_metal;
3825 }
3826 else if((stype == "dielectric_dielectric") || (stype == "1"))
3827 {
3828 type = dielectric_dielectric;
3829 }
3830 else if((stype == "dielectric_LUT") || (stype == "2"))
3831 {
3832 type = dielectric_LUT;
3833 }
3834 else if((stype == "dielectric_LUTDAVIS") || (stype == "3"))
3835 {
3836 type = dielectric_LUTDAVIS;
3837 }
3838 else if((stype == "dielectric_dichroic") || (stype == "4"))
3839 {
3840 type = dielectric_dichroic;
3841 }
3842 else if((stype == "firsov") || (stype == "5"))
3843 {
3844 type = firsov;
3845 }
3846 else
3847 {
3848 type = x_ray;
3849 }
3850
3851 G4OpticalSurface* opticalsurface =
3852 new G4OpticalSurface(name, model, finish, type, value);
3853
3854 for(xercesc::DOMNode* iter = opticalsurfaceElement->getFirstChild();
3855 iter != nullptr; iter = iter->getNextSibling())
3856 {
3857 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
3858 {
3859 continue;
3860 }
3861
3862 const xercesc::DOMElement* const child =
3863 dynamic_cast<xercesc::DOMElement*>(iter);
3864 if(child == nullptr)
3865 {
3866 G4Exception("G4GDMLReadSolids::OpticalSurfaceRead()", "InvalidRead",
3867 FatalException, "No child found!");
3868 return;
3869 }
3870 const G4String tag = Transcode(child->getTagName());
3871
3872 if(tag == "property")
3873 {
3874 PropertyRead(child, opticalsurface);
3875 }
3876 }
3877}
G4OpticalSurfaceModel
@ unified
@ DAVIS
@ dichroic
@ glisur
G4OpticalSurfaceFinish
@ groundfrontpainted
@ polishedlumirrorair
@ groundtyvekair
@ groundtioair
@ PolishedESR_LUT
@ groundvm2000glue
@ polishedair
@ groundair
@ etchedteflonair
@ etchedtyvekair
@ etchedvm2000glue
@ RoughESR_LUT
@ polishedbackpainted
@ etchedtioair
@ Polished_LUT
@ groundvm2000air
@ polished
@ Detector_LUT
@ polishedlumirrorglue
@ polishedtyvekair
@ PolishedESRGrease_LUT
@ RoughESRGrease_LUT
@ ground
@ Rough_LUT
@ polishedteflonair
@ etchedair
@ polishedvm2000air
@ etchedlumirrorglue
@ polishedvm2000glue
@ polishedfrontpainted
@ RoughTeflon_LUT
@ polishedtioair
@ groundlumirrorglue
@ PolishedTeflon_LUT
@ etchedvm2000air
@ groundbackpainted
@ etchedlumirrorair
@ groundlumirrorair
@ groundteflonair
G4SurfaceType
@ dielectric_metal
@ dielectric_LUT
@ dielectric_dielectric
@ dielectric_LUTDAVIS
@ dielectric_dichroic
@ x_ray
@ firsov
void PropertyRead(const xercesc::DOMElement *const, G4OpticalSurface *)

References DAVIS, Detector_LUT, dichroic, dielectric_dichroic, dielectric_dielectric, dielectric_LUT, dielectric_LUTDAVIS, dielectric_metal, etchedair, etchedlumirrorair, etchedlumirrorglue, etchedteflonair, etchedtioair, etchedtyvekair, etchedvm2000air, etchedvm2000glue, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, firsov, G4Exception(), G4GDMLRead::GenerateName(), glisur, ground, groundair, groundbackpainted, groundfrontpainted, groundlumirrorair, groundlumirrorglue, groundteflonair, groundtioair, groundtyvekair, groundvm2000air, groundvm2000glue, LUT, G4InuclParticleNames::name(), polished, Polished_LUT, polishedair, polishedbackpainted, PolishedESR_LUT, PolishedESRGrease_LUT, polishedfrontpainted, polishedlumirrorair, polishedlumirrorglue, PolishedTeflon_LUT, polishedteflonair, polishedtioair, polishedtyvekair, polishedvm2000air, polishedvm2000glue, G4GDMLReadSolids::PropertyRead(), Rough_LUT, RoughESR_LUT, RoughESRGrease_LUT, RoughTeflon_LUT, G4GDMLRead::Transcode(), unified, and x_ray.

Referenced by G4GDMLReadSolids::SolidsRead().

◆ Orb_dimensionsRead()

void G4GDMLReadParamvol::Orb_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 539 of file G4GDMLReadParamvol.cc.

542{
543 G4double lunit = 1.0;
544
545 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
546 XMLSize_t attributeCount = attributes->getLength();
547
548 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
549 ++attribute_index)
550 {
551 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
552
553 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
554 {
555 continue;
556 }
557
558 const xercesc::DOMAttr* const attribute =
559 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
560 if(attribute == nullptr)
561 {
562 G4Exception("G4GDMLReadParamvol::Orb_dimensionsRead()", "InvalidRead",
563 FatalException, "No attribute found!");
564 return;
565 }
566 const G4String attName = Transcode(attribute->getName());
567 const G4String attValue = Transcode(attribute->getValue());
568
569 if(attName == "lunit")
570 {
571 lunit = G4UnitDefinition::GetValueOf(attValue);
572 }
573 if(G4UnitDefinition::GetCategory(attValue) != "Length")
574 {
575 G4Exception("G4GDMLReadParamvol::Orb_dimensionsRead()", "InvalidRead",
576 FatalException, "Invalid unit for length!");
577 }
578 else if(attName == "r")
579 {
580 parameter.dimension[0] = eval.Evaluate(attValue);
581 }
582 }
583
584 parameter.dimension[0] *= lunit;
585}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ OrbRead()

void G4GDMLReadSolids::OrbRead ( const xercesc::DOMElement * const  orbElement)
protectedinherited

Definition at line 946 of file G4GDMLReadSolids.cc.

947{
949 G4double lunit = 1.0;
950 G4double r = 0.0;
951
952 const xercesc::DOMNamedNodeMap* const attributes =
953 orbElement->getAttributes();
954 XMLSize_t attributeCount = attributes->getLength();
955
956 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
957 ++attribute_index)
958 {
959 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
960
961 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
962 {
963 continue;
964 }
965
966 const xercesc::DOMAttr* const attribute =
967 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
968 if(attribute == nullptr)
969 {
970 G4Exception("G4GDMLReadSolids::OrbRead()", "InvalidRead", FatalException,
971 "No attribute found!");
972 return;
973 }
974 const G4String attName = Transcode(attribute->getName());
975 const G4String attValue = Transcode(attribute->getValue());
976
977 if(attName == "name")
978 {
979 name = GenerateName(attValue);
980 }
981 else if(attName == "lunit")
982 {
983 lunit = G4UnitDefinition::GetValueOf(attValue);
984 if(G4UnitDefinition::GetCategory(attValue) != "Length")
985 {
986 G4Exception("G4GDMLReadSolids::OrbRead()", "InvalidRead",
987 FatalException, "Invalid unit for length!");
988 }
989 }
990 else if(attName == "r")
991 {
992 r = eval.Evaluate(attValue);
993 }
994 }
995
996 r *= lunit;
997
998 new G4Orb(name, r);
999}
Definition: G4Orb.hh:56

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ OverlapCheck()

void G4GDMLRead::OverlapCheck ( G4bool  flag)
inherited

Definition at line 64 of file G4GDMLRead.cc.

65{
66 check = flag;
67}
G4bool check
Definition: G4GDMLRead.hh:158

References G4GDMLRead::check.

◆ Para_dimensionsRead()

void G4GDMLReadParamvol::Para_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 735 of file G4GDMLReadParamvol.cc.

738{
739 G4double lunit = 1.0;
740 G4double aunit = 1.0;
741
742 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
743 XMLSize_t attributeCount = attributes->getLength();
744
745 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
746 ++attribute_index)
747 {
748 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
749
750 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
751 {
752 continue;
753 }
754
755 const xercesc::DOMAttr* const attribute =
756 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
757 if(attribute == nullptr)
758 {
759 G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", "InvalidRead",
760 FatalException, "No attribute found!");
761 return;
762 }
763 const G4String attName = Transcode(attribute->getName());
764 const G4String attValue = Transcode(attribute->getValue());
765
766 if(attName == "lunit")
767 {
768 lunit = G4UnitDefinition::GetValueOf(attValue);
769 if(G4UnitDefinition::GetCategory(attValue) != "Length")
770 {
771 G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", "InvalidRead",
772 FatalException, "Invalid unit for length!");
773 }
774 }
775 else if(attName == "aunit")
776 {
777 aunit = G4UnitDefinition::GetValueOf(attValue);
778 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
779 {
780 G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", "InvalidRead",
781 FatalException, "Invalid unit for angle!");
782 }
783 }
784 else if(attName == "x")
785 {
786 parameter.dimension[0] = eval.Evaluate(attValue);
787 }
788 else if(attName == "y")
789 {
790 parameter.dimension[1] = eval.Evaluate(attValue);
791 }
792 else if(attName == "z")
793 {
794 parameter.dimension[2] = eval.Evaluate(attValue);
795 }
796 else if(attName == "alpha")
797 {
798 parameter.dimension[3] = eval.Evaluate(attValue);
799 }
800 else if(attName == "theta")
801 {
802 parameter.dimension[4] = eval.Evaluate(attValue);
803 }
804 else if(attName == "phi")
805 {
806 parameter.dimension[5] = eval.Evaluate(attValue);
807 }
808 }
809
810 parameter.dimension[0] = 0.5 * lunit;
811 parameter.dimension[1] = 0.5 * lunit;
812 parameter.dimension[2] = 0.5 * lunit;
813 parameter.dimension[3] = aunit;
814 parameter.dimension[4] = aunit;
815 parameter.dimension[5] = aunit;
816}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ ParaboloidRead()

void G4GDMLReadSolids::ParaboloidRead ( const xercesc::DOMElement * const  paraElement)
protectedinherited

Definition at line 1098 of file G4GDMLReadSolids.cc.

1100{
1101 G4String name;
1102 G4double lunit = 1.0;
1103 G4double rlo = 0.0;
1104 G4double rhi = 0.0;
1105 G4double dz = 0.0;
1106
1107 const xercesc::DOMNamedNodeMap* const attributes =
1108 paraElement->getAttributes();
1109 XMLSize_t attributeCount = attributes->getLength();
1110
1111 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1112 ++attribute_index)
1113 {
1114 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1115
1116 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1117 {
1118 continue;
1119 }
1120
1121 const xercesc::DOMAttr* const attribute =
1122 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1123 if(attribute == nullptr)
1124 {
1125 G4Exception("G4GDMLReadSolids::ParaboloidRead()", "InvalidRead",
1126 FatalException, "No attribute found!");
1127 return;
1128 }
1129 const G4String attName = Transcode(attribute->getName());
1130 const G4String attValue = Transcode(attribute->getValue());
1131
1132 if(attName == "name")
1133 {
1134 name = GenerateName(attValue);
1135 }
1136 else if(attName == "lunit")
1137 {
1138 lunit = G4UnitDefinition::GetValueOf(attValue);
1139 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1140 {
1141 G4Exception("G4GDMLReadSolids::ParaboloidRead()", "InvalidRead",
1142 FatalException, "Invalid unit for length!");
1143 }
1144 }
1145 else if(attName == "rlo")
1146 {
1147 rlo = eval.Evaluate(attValue);
1148 }
1149 else if(attName == "rhi")
1150 {
1151 rhi = eval.Evaluate(attValue);
1152 }
1153 else if(attName == "dz")
1154 {
1155 dz = eval.Evaluate(attValue);
1156 }
1157 }
1158
1159 rlo *= 1. * lunit;
1160 rhi *= 1. * lunit;
1161 dz *= 1. * lunit;
1162
1163 new G4Paraboloid(name, dz, rlo, rhi);
1164}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ ParameterisedRead()

void G4GDMLReadParamvol::ParameterisedRead ( const xercesc::DOMElement * const  element)
protected

Definition at line 1219 of file G4GDMLReadParamvol.cc.

1221{
1222 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1223 iter = iter->getNextSibling())
1224 {
1225 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1226 {
1227 continue;
1228 }
1229
1230 const xercesc::DOMElement* const child =
1231 dynamic_cast<xercesc::DOMElement*>(iter);
1232 if(child == nullptr)
1233 {
1234 G4Exception("G4GDMLReadParamvol::ParameterisedRead()", "InvalidRead",
1235 FatalException, "No child found!");
1236 return;
1237 }
1238 const G4String tag = Transcode(child->getTagName());
1239
1240 if(tag == "parameters")
1241 {
1242 const xercesc::DOMNamedNodeMap* const attributes =
1243 element->getAttributes();
1244 XMLSize_t attributeCount = attributes->getLength();
1245 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1246 ++attribute_index)
1247 {
1248 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1249
1250 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1251 {
1252 continue;
1253 }
1254
1255 const xercesc::DOMAttr* const attribute =
1256 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1257 if(attribute == nullptr)
1258 {
1259 G4Exception("G4GDMLReadParamvol::ParameterisedRead()", "InvalidRead",
1260 FatalException, "No attribute found!");
1261 return;
1262 }
1263 const G4String attName = Transcode(attribute->getName());
1264 const G4String attValue = Transcode(attribute->getValue());
1265
1266 if(attName == "number")
1267 {
1268 eval.Evaluate(attValue);
1269 }
1270 }
1271 ParametersRead(child);
1272 }
1273 else
1274 {
1275 if(tag == "loop")
1276 {
1278 }
1279 }
1280 }
1281}
void ParametersRead(const xercesc::DOMElement *const)
virtual void Paramvol_contentRead(const xercesc::DOMElement *const)=0
void LoopRead(const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
Definition: G4GDMLRead.cc:194

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::LoopRead(), ParametersRead(), G4GDMLRead::Paramvol_contentRead(), and G4GDMLRead::Transcode().

Referenced by Paramvol_contentRead().

◆ ParametersRead()

void G4GDMLReadParamvol::ParametersRead ( const xercesc::DOMElement * const  element)
protected

Definition at line 1106 of file G4GDMLReadParamvol.cc.

1108{
1109 G4ThreeVector rotation(0.0, 0.0, 0.0);
1110 G4ThreeVector position(0.0, 0.0, 0.0);
1111
1113
1114 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1115 iter = iter->getNextSibling())
1116 {
1117 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1118 {
1119 continue;
1120 }
1121
1122 const xercesc::DOMElement* const child =
1123 dynamic_cast<xercesc::DOMElement*>(iter);
1124 if(child == nullptr)
1125 {
1126 G4Exception("G4GDMLReadParamvol::ParametersRead()", "InvalidRead",
1127 FatalException, "No child found!");
1128 return;
1129 }
1130 const G4String tag = Transcode(child->getTagName());
1131 if(tag == "rotation")
1132 {
1133 VectorRead(child, rotation);
1134 }
1135 else if(tag == "position")
1136 {
1137 VectorRead(child, position);
1138 }
1139 else if(tag == "positionref")
1140 {
1142 }
1143 else if(tag == "rotationref")
1144 {
1145 rotation = GetRotation(GenerateName(RefRead(child)));
1146 }
1147 else if(tag == "box_dimensions")
1148 {
1149 Box_dimensionsRead(child, parameter);
1150 }
1151 else if(tag == "trd_dimensions")
1152 {
1153 Trd_dimensionsRead(child, parameter);
1154 }
1155 else if(tag == "trap_dimensions")
1156 {
1157 Trap_dimensionsRead(child, parameter);
1158 }
1159 else if(tag == "tube_dimensions")
1160 {
1161 Tube_dimensionsRead(child, parameter);
1162 }
1163 else if(tag == "cone_dimensions")
1164 {
1165 Cone_dimensionsRead(child, parameter);
1166 }
1167 else if(tag == "sphere_dimensions")
1168 {
1169 Sphere_dimensionsRead(child, parameter);
1170 }
1171 else if(tag == "orb_dimensions")
1172 {
1173 Orb_dimensionsRead(child, parameter);
1174 }
1175 else if(tag == "torus_dimensions")
1176 {
1177 Torus_dimensionsRead(child, parameter);
1178 }
1179 else if(tag == "ellipsoid_dimensions")
1180 {
1181 Ellipsoid_dimensionsRead(child, parameter);
1182 }
1183 else if(tag == "para_dimensions")
1184 {
1185 Para_dimensionsRead(child, parameter);
1186 }
1187 else if(tag == "polycone_dimensions")
1188 {
1189 Polycone_dimensionsRead(child, parameter);
1190 }
1191 else if(tag == "polyhedra_dimensions")
1192 {
1193 Polyhedra_dimensionsRead(child, parameter);
1194 }
1195 else if(tag == "hype_dimensions")
1196 {
1197 Hype_dimensionsRead(child, parameter);
1198 }
1199 else
1200 {
1201 G4String error_msg = "Unknown tag in parameters: " + tag;
1202 G4Exception("G4GDMLReadParamvol::ParametersRead()", "ReadError",
1203 FatalException, error_msg);
1204 }
1205 }
1206
1207 parameter.pRot = new G4RotationMatrix();
1208
1209 parameter.pRot->rotateX(rotation.x());
1210 parameter.pRot->rotateY(rotation.y());
1211 parameter.pRot->rotateZ(rotation.z());
1212
1213 parameter.position = position;
1214
1215 parameterisation->AddParameter(parameter);
1216}
CLHEP::HepRotation G4RotationMatrix
void AddParameter(const PARAMETER &)
void Ellipsoid_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Cone_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Box_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Para_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Torus_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
G4GDMLParameterisation * parameterisation
void Sphere_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Hype_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Trap_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Orb_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Trd_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Polyhedra_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Tube_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Polycone_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)

References G4GDMLParameterisation::AddParameter(), Box_dimensionsRead(), Cone_dimensionsRead(), Ellipsoid_dimensionsRead(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetPosition(), G4GDMLReadDefine::GetRotation(), Hype_dimensionsRead(), Orb_dimensionsRead(), Para_dimensionsRead(), parameterisation, Polycone_dimensionsRead(), Polyhedra_dimensionsRead(), position, G4GDMLParameterisation::PARAMETER::position, G4GDMLParameterisation::PARAMETER::pRot, G4GDMLReadDefine::RefRead(), CLHEP::HepRotation::rotateX(), CLHEP::HepRotation::rotateY(), CLHEP::HepRotation::rotateZ(), Sphere_dimensionsRead(), Torus_dimensionsRead(), G4GDMLRead::Transcode(), Trap_dimensionsRead(), Trd_dimensionsRead(), Tube_dimensionsRead(), G4GDMLReadDefine::VectorRead(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by ParameterisedRead().

◆ Paramvol_contentRead()

void G4GDMLReadParamvol::Paramvol_contentRead ( const xercesc::DOMElement * const  element)
virtual

Implements G4GDMLRead.

Definition at line 1284 of file G4GDMLReadParamvol.cc.

1286{
1287 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1288 iter = iter->getNextSibling())
1289 {
1290 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1291 {
1292 continue;
1293 }
1294
1295 const xercesc::DOMElement* const child =
1296 dynamic_cast<xercesc::DOMElement*>(iter);
1297 if(child == nullptr)
1298 {
1299 G4Exception("G4GDMLReadParamvol::Paramvol_contentRead()", "InvalidRead",
1300 FatalException, "No child found!");
1301 return;
1302 }
1303 const G4String tag = Transcode(child->getTagName());
1304 if(tag == "parameterised_position_size")
1305 {
1306 ParameterisedRead(child);
1307 }
1308 else if(tag == "loop")
1309 {
1311 }
1312 }
1313}
void ParameterisedRead(const xercesc::DOMElement *const)

References FatalException, G4Exception(), G4GDMLRead::LoopRead(), ParameterisedRead(), G4GDMLRead::Paramvol_contentRead(), and G4GDMLRead::Transcode().

Referenced by ParamvolRead().

◆ ParamvolRead()

void G4GDMLReadParamvol::ParamvolRead ( const xercesc::DOMElement * const  element,
G4LogicalVolume mother 
)
virtual

Definition at line 1316 of file G4GDMLReadParamvol.cc.

1318{
1319 G4String volumeref;
1320
1322 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1323 iter = iter->getNextSibling())
1324 {
1325 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1326 {
1327 continue;
1328 }
1329
1330 const xercesc::DOMElement* const child =
1331 dynamic_cast<xercesc::DOMElement*>(iter);
1332 if(child == nullptr)
1333 {
1334 G4Exception("G4GDMLReadParamvol::ParamvolRead()", "InvalidRead",
1335 FatalException, "No child found!");
1336 return;
1337 }
1338 const G4String tag = Transcode(child->getTagName());
1339
1340 if(tag == "volumeref")
1341 {
1342 volumeref = RefRead(child);
1343 }
1344 }
1345
1346 Paramvol_contentRead(element);
1347
1348 G4LogicalVolume* logvol = GetVolume(GenerateName(volumeref));
1349
1350 if(parameterisation->GetSize() == 0)
1351 {
1352 G4Exception("G4GDMLReadParamvol::ParamvolRead()", "ReadError",
1354 "No parameters are defined in parameterised volume!");
1355 }
1356 G4String pv_name = logvol->GetName() + "_param";
1357 new G4PVParameterised(pv_name, logvol, mother, kUndefined,
1359}
virtual void Paramvol_contentRead(const xercesc::DOMElement *const)
virtual G4LogicalVolume * GetVolume(const G4String &) const =0
@ kUndefined
Definition: geomdefs.hh:61

References G4GDMLRead::check, FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4LogicalVolume::GetName(), G4GDMLParameterisation::GetSize(), G4GDMLRead::GetVolume(), kUndefined, parameterisation, Paramvol_contentRead(), G4GDMLReadDefine::RefRead(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadStructure::Volume_contentRead().

◆ ParaRead()

void G4GDMLReadSolids::ParaRead ( const xercesc::DOMElement * const  paraElement)
protectedinherited

Definition at line 1002 of file G4GDMLReadSolids.cc.

1003{
1004 G4String name;
1005 G4double lunit = 1.0;
1006 G4double aunit = 1.0;
1007 G4double x = 0.0;
1008 G4double y = 0.0;
1009 G4double z = 0.0;
1010 G4double alpha = 0.0;
1011 G4double theta = 0.0;
1012 G4double phi = 0.0;
1013
1014 const xercesc::DOMNamedNodeMap* const attributes =
1015 paraElement->getAttributes();
1016 XMLSize_t attributeCount = attributes->getLength();
1017
1018 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1019 ++attribute_index)
1020 {
1021 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1022
1023 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1024 {
1025 continue;
1026 }
1027
1028 const xercesc::DOMAttr* const attribute =
1029 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1030 if(attribute == nullptr)
1031 {
1032 G4Exception("G4GDMLReadSolids::ParaRead()", "InvalidRead", FatalException,
1033 "No attribute found!");
1034 return;
1035 }
1036 const G4String attName = Transcode(attribute->getName());
1037 const G4String attValue = Transcode(attribute->getValue());
1038
1039 if(attName == "name")
1040 {
1041 name = GenerateName(attValue);
1042 }
1043 else if(attName == "lunit")
1044 {
1045 lunit = G4UnitDefinition::GetValueOf(attValue);
1046 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1047 {
1048 G4Exception("G4GDMLReadSolids::ParaRead()", "InvalidRead",
1049 FatalException, "Invalid unit for length!");
1050 }
1051 }
1052 else if(attName == "aunit")
1053 {
1054 aunit = G4UnitDefinition::GetValueOf(attValue);
1055 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
1056 {
1057 G4Exception("G4GDMLReadSolids::ParaRead()", "InvalidRead",
1058 FatalException, "Invalid unit for angle!");
1059 }
1060 }
1061 else if(attName == "x")
1062 {
1063 x = eval.Evaluate(attValue);
1064 }
1065 else if(attName == "y")
1066 {
1067 y = eval.Evaluate(attValue);
1068 }
1069 else if(attName == "z")
1070 {
1071 z = eval.Evaluate(attValue);
1072 }
1073 else if(attName == "alpha")
1074 {
1075 alpha = eval.Evaluate(attValue);
1076 }
1077 else if(attName == "theta")
1078 {
1079 theta = eval.Evaluate(attValue);
1080 }
1081 else if(attName == "phi")
1082 {
1083 phi = eval.Evaluate(attValue);
1084 }
1085 }
1086
1087 x *= 0.5 * lunit;
1088 y *= 0.5 * lunit;
1089 z *= 0.5 * lunit;
1090 alpha *= aunit;
1091 theta *= aunit;
1092 phi *= aunit;
1093
1094 new G4Para(name, x, y, z, alpha, theta, phi);
1095}
static const G4double alpha
Definition: G4Para.hh:79

References alpha, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ Polycone_dimensionsRead()

void G4GDMLReadParamvol::Polycone_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 898 of file G4GDMLReadParamvol.cc.

901{
902 G4double lunit = 1.0;
903 G4double aunit = 1.0;
904
905 std::vector<zplaneType> zplaneList;
906
907 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
908 XMLSize_t attributeCount = attributes->getLength();
909
910 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
911 ++attribute_index)
912 {
913 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
914
915 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
916 {
917 continue;
918 }
919
920 const xercesc::DOMAttr* const attribute =
921 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
922 if(attribute == nullptr)
923 {
924 G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
925 "InvalidRead", FatalException, "No attribute found!");
926 return;
927 }
928 const G4String attName = Transcode(attribute->getName());
929 const G4String attValue = Transcode(attribute->getValue());
930
931 if(attName == "lunit")
932 {
933 lunit = G4UnitDefinition::GetValueOf(attValue);
934 if(G4UnitDefinition::GetCategory(attValue) != "Length")
935 {
936 G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
937 "InvalidRead", FatalException, "Invalid unit for length!");
938 }
939 }
940 else if(attName == "aunit")
941 {
942 aunit = G4UnitDefinition::GetValueOf(attValue);
943 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
944 {
945 G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
946 "InvalidRead", FatalException, "Invalid unit for angle!");
947 }
948 }
949 else if(attName == "startPhi")
950 {
951 parameter.dimension[0] = eval.Evaluate(attValue);
952 }
953 else if(attName == "openPhi")
954 {
955 parameter.dimension[1] = eval.Evaluate(attValue);
956 }
957 else if(attName == "numRZ")
958 {
959 parameter.dimension[2] = eval.Evaluate(attValue);
960 }
961 }
962
963 parameter.dimension[0] *= aunit;
964 parameter.dimension[1] *= aunit;
965
966 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
967 iter = iter->getNextSibling())
968 {
969 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
970 {
971 continue;
972 }
973
974 const xercesc::DOMElement* const child =
975 dynamic_cast<xercesc::DOMElement*>(iter);
976 if(child == nullptr)
977 {
978 G4Exception("G4GDMLReadParamVol::Polycone_dimensionsRead()",
979 "InvalidRead", FatalException, "No child found!");
980 return;
981 }
982 const G4String tag = Transcode(child->getTagName());
983
984 if(tag == "zplane")
985 {
986 zplaneList.push_back(ZplaneRead(child));
987 }
988 }
989
990 G4int numZPlanes = zplaneList.size();
991 for(G4int i = 0; i < numZPlanes; ++i)
992 {
993 parameter.dimension[3 + i * 3] = zplaneList[i].rmin * lunit;
994 parameter.dimension[4 + i * 3] = zplaneList[i].rmax * lunit;
995 parameter.dimension[5 + i * 3] = zplaneList[i].z * lunit;
996 }
997}
zplaneType ZplaneRead(const xercesc::DOMElement *const)

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4GDMLRead::Transcode(), and G4GDMLReadSolids::ZplaneRead().

Referenced by ParametersRead().

◆ PolyconeRead()

void G4GDMLReadSolids::PolyconeRead ( const xercesc::DOMElement * const  polyconeElement)
protectedinherited

Definition at line 1167 of file G4GDMLReadSolids.cc.

1169{
1170 G4String name;
1171 G4double lunit = 1.0;
1172 G4double aunit = 1.0;
1173 G4double startphi = 0.0;
1174 G4double deltaphi = 0.0;
1175
1176 const xercesc::DOMNamedNodeMap* const attributes =
1177 polyconeElement->getAttributes();
1178 XMLSize_t attributeCount = attributes->getLength();
1179
1180 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1181 ++attribute_index)
1182 {
1183 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1184
1185 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1186 {
1187 continue;
1188 }
1189
1190 const xercesc::DOMAttr* const attribute =
1191 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1192 if(attribute == nullptr)
1193 {
1194 G4Exception("G4GDMLReadSolids::PolyconeRead()", "InvalidRead",
1195 FatalException, "No attribute found!");
1196 return;
1197 }
1198 const G4String attName = Transcode(attribute->getName());
1199 const G4String attValue = Transcode(attribute->getValue());
1200
1201 if(attName == "name")
1202 {
1203 name = GenerateName(attValue);
1204 }
1205 else if(attName == "lunit")
1206 {
1207 lunit = G4UnitDefinition::GetValueOf(attValue);
1208 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1209 {
1210 G4Exception("G4GDMLReadSolids::PolyconeRead()", "InvalidRead",
1211 FatalException, "Invalid unit for length!");
1212 }
1213 }
1214 else if(attName == "aunit")
1215 {
1216 aunit = G4UnitDefinition::GetValueOf(attValue);
1217 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
1218 {
1219 G4Exception("G4GDMLReadSolids::PolyconeRead()", "InvalidRead",
1220 FatalException, "Invalid unit for angle!");
1221 }
1222 }
1223 else if(attName == "startphi")
1224 {
1225 startphi = eval.Evaluate(attValue);
1226 }
1227 else if(attName == "deltaphi")
1228 {
1229 deltaphi = eval.Evaluate(attValue);
1230 }
1231 }
1232
1233 startphi *= aunit;
1234 deltaphi *= aunit;
1235
1236 std::vector<zplaneType> zplaneList;
1237
1238 for(xercesc::DOMNode* iter = polyconeElement->getFirstChild(); iter!= nullptr;
1239 iter = iter->getNextSibling())
1240 {
1241 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1242 {
1243 continue;
1244 }
1245
1246 const xercesc::DOMElement* const child =
1247 dynamic_cast<xercesc::DOMElement*>(iter);
1248 if(child == nullptr)
1249 {
1250 G4Exception("G4GDMLReadSolids::PolyconeRead()", "InvalidRead",
1251 FatalException, "No child found!");
1252 return;
1253 }
1254 const G4String tag = Transcode(child->getTagName());
1255
1256 if(tag == "zplane")
1257 {
1258 zplaneList.push_back(ZplaneRead(child));
1259 }
1260 }
1261
1262 G4int numZPlanes = zplaneList.size();
1263
1264 G4double* rmin_array = new G4double[numZPlanes];
1265 G4double* rmax_array = new G4double[numZPlanes];
1266 G4double* z_array = new G4double[numZPlanes];
1267
1268 for(G4int i = 0; i < numZPlanes; ++i)
1269 {
1270 rmin_array[i] = zplaneList[i].rmin * lunit;
1271 rmax_array[i] = zplaneList[i].rmax * lunit;
1272 z_array[i] = zplaneList[i].z * lunit;
1273 }
1274
1275 new G4Polycone(name, startphi, deltaphi, numZPlanes, z_array, rmin_array,
1276 rmax_array);
1277
1278 delete[] rmin_array;
1279 delete[] rmax_array;
1280 delete[] z_array;
1281}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), G4GDMLRead::Transcode(), and G4GDMLReadSolids::ZplaneRead().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ Polyhedra_dimensionsRead()

void G4GDMLReadParamvol::Polyhedra_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 1000 of file G4GDMLReadParamvol.cc.

1003{
1004 G4double lunit = 1.0;
1005 G4double aunit = 1.0;
1006
1007 std::vector<zplaneType> zplaneList;
1008
1009 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
1010 XMLSize_t attributeCount = attributes->getLength();
1011
1012 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1013 ++attribute_index)
1014 {
1015 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1016
1017 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1018 {
1019 continue;
1020 }
1021
1022 const xercesc::DOMAttr* const attribute =
1023 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1024 if(attribute == nullptr)
1025 {
1026 G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
1027 "InvalidRead", FatalException, "No attribute found!");
1028 return;
1029 }
1030 const G4String attName = Transcode(attribute->getName());
1031 const G4String attValue = Transcode(attribute->getValue());
1032
1033 if(attName == "lunit")
1034 {
1035 lunit = G4UnitDefinition::GetValueOf(attValue);
1036 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1037 {
1038 G4Exception("G4GDMLReadParamvol::Polyhedra_dimensionsRead()",
1039 "InvalidRead", FatalException, "Invalid unit for length!");
1040 }
1041 }
1042 else if(attName == "aunit")
1043 {
1044 aunit = G4UnitDefinition::GetValueOf(attValue);
1045 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
1046 {
1047 G4Exception("G4GDMLReadParamvol::Polyhedra_dimensionsRead()",
1048 "InvalidRead", FatalException, "Invalid unit for angle!");
1049 }
1050 }
1051 else if(attName == "startPhi")
1052 {
1053 parameter.dimension[0] = eval.Evaluate(attValue);
1054 }
1055 else if(attName == "openPhi")
1056 {
1057 parameter.dimension[1] = eval.Evaluate(attValue);
1058 }
1059 else if(attName == "numRZ")
1060 {
1061 parameter.dimension[2] = eval.Evaluate(attValue);
1062 }
1063 else if(attName == "numSide")
1064 {
1065 parameter.dimension[3] = eval.Evaluate(attValue);
1066 }
1067 }
1068
1069 parameter.dimension[0] *= aunit;
1070 parameter.dimension[1] *= aunit;
1071
1072 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1073 iter = iter->getNextSibling())
1074 {
1075 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1076 {
1077 continue;
1078 }
1079
1080 const xercesc::DOMElement* const child =
1081 dynamic_cast<xercesc::DOMElement*>(iter);
1082 if(child == nullptr)
1083 {
1084 G4Exception("G4GDMLReadParamvo::PolyhedraRead()", "InvalidRead",
1085 FatalException, "No child found!");
1086 return;
1087 }
1088 const G4String tag = Transcode(child->getTagName());
1089
1090 if(tag == "zplane")
1091 {
1092 zplaneList.push_back(ZplaneRead(child));
1093 }
1094 }
1095
1096 G4int numZPlanes = zplaneList.size();
1097 for(G4int i = 0; i < numZPlanes; ++i)
1098 {
1099 parameter.dimension[4 + i * 3] = zplaneList[i].rmin * lunit;
1100 parameter.dimension[5 + i * 3] = zplaneList[i].rmax * lunit;
1101 parameter.dimension[6 + i * 3] = zplaneList[i].z * lunit;
1102 }
1103}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4GDMLRead::Transcode(), and G4GDMLReadSolids::ZplaneRead().

Referenced by ParametersRead().

◆ PolyhedraRead()

void G4GDMLReadSolids::PolyhedraRead ( const xercesc::DOMElement * const  polyhedraElement)
protectedinherited

Definition at line 1396 of file G4GDMLReadSolids.cc.

1398{
1399 G4String name;
1400 G4double lunit = 1.0;
1401 G4double aunit = 1.0;
1402 G4double startphi = 0.0;
1403 G4double deltaphi = 0.0;
1404 G4int numsides = 0;
1405
1406 const xercesc::DOMNamedNodeMap* const attributes =
1407 polyhedraElement->getAttributes();
1408 XMLSize_t attributeCount = attributes->getLength();
1409
1410 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1411 ++attribute_index)
1412 {
1413 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1414
1415 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1416 {
1417 continue;
1418 }
1419
1420 const xercesc::DOMAttr* const attribute =
1421 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1422 if(attribute == nullptr)
1423 {
1424 G4Exception("G4GDMLReadSolids::PolyhedraRead()", "InvalidRead",
1425 FatalException, "No attribute found!");
1426 return;
1427 }
1428 const G4String attName = Transcode(attribute->getName());
1429 const G4String attValue = Transcode(attribute->getValue());
1430
1431 if(attName == "name")
1432 {
1433 name = GenerateName(attValue);
1434 }
1435 else if(attName == "lunit")
1436 {
1437 lunit = G4UnitDefinition::GetValueOf(attValue);
1438 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1439 {
1440 G4Exception("G4GDMLReadSolids::PolyhedraRead()", "InvalidRead",
1441 FatalException, "Invalid unit for length!");
1442 }
1443 }
1444 else if(attName == "aunit")
1445 {
1446 aunit = G4UnitDefinition::GetValueOf(attValue);
1447 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
1448 {
1449 G4Exception("G4GDMLReadSolids::PolyhedraRead()", "InvalidRead",
1450 FatalException, "Invalid unit for angle!");
1451 }
1452 }
1453 else if(attName == "startphi")
1454 {
1455 startphi = eval.Evaluate(attValue);
1456 }
1457 else if(attName == "deltaphi")
1458 {
1459 deltaphi = eval.Evaluate(attValue);
1460 }
1461 else if(attName == "numsides")
1462 {
1463 numsides = eval.EvaluateInteger(attValue);
1464 }
1465 }
1466
1467 startphi *= aunit;
1468 deltaphi *= aunit;
1469
1470 std::vector<zplaneType> zplaneList;
1471
1472 for(xercesc::DOMNode* iter = polyhedraElement->getFirstChild();
1473 iter != nullptr; iter = iter->getNextSibling())
1474 {
1475 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1476 {
1477 continue;
1478 }
1479
1480 const xercesc::DOMElement* const child =
1481 dynamic_cast<xercesc::DOMElement*>(iter);
1482 if(child == nullptr)
1483 {
1484 G4Exception("G4GDMLReadSolids::PolyhedraRead()", "InvalidRead",
1485 FatalException, "No child found!");
1486 return;
1487 }
1488 const G4String tag = Transcode(child->getTagName());
1489
1490 if(tag == "zplane")
1491 {
1492 zplaneList.push_back(ZplaneRead(child));
1493 }
1494 }
1495
1496 G4int numZPlanes = zplaneList.size();
1497
1498 G4double* rmin_array = new G4double[numZPlanes];
1499 G4double* rmax_array = new G4double[numZPlanes];
1500 G4double* z_array = new G4double[numZPlanes];
1501
1502 for(G4int i = 0; i < numZPlanes; ++i)
1503 {
1504 rmin_array[i] = zplaneList[i].rmin * lunit;
1505 rmax_array[i] = zplaneList[i].rmax * lunit;
1506 z_array[i] = zplaneList[i].z * lunit;
1507 }
1508
1509 new G4Polyhedra(name, startphi, deltaphi, numsides, numZPlanes, z_array,
1510 rmin_array, rmax_array);
1511
1512 delete[] rmin_array;
1513 delete[] rmax_array;
1514 delete[] z_array;
1515}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), G4GDMLEvaluator::EvaluateInteger(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), G4GDMLRead::Transcode(), and G4GDMLReadSolids::ZplaneRead().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ PositionRead()

void G4GDMLReadDefine::PositionRead ( const xercesc::DOMElement * const  positionElement)
protectedinherited

Definition at line 324 of file G4GDMLReadDefine.cc.

326{
327 G4String name = "";
328 G4double unit = 1.0;
329 G4ThreeVector position(0., 0., 0.);
330
331 const xercesc::DOMNamedNodeMap* const attributes =
332 positionElement->getAttributes();
333 XMLSize_t attributeCount = attributes->getLength();
334
335 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
336 ++attribute_index)
337 {
338 xercesc::DOMNode* node = attributes->item(attribute_index);
339
340 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
341 {
342 continue;
343 }
344
345 const xercesc::DOMAttr* const attribute =
346 dynamic_cast<xercesc::DOMAttr*>(node);
347 if(attribute == nullptr)
348 {
349 G4Exception("G4GDMLRead::PositionRead()", "InvalidRead", FatalException,
350 "No attribute found!");
351 return;
352 }
353 const G4String attName = Transcode(attribute->getName());
354 const G4String attValue = Transcode(attribute->getValue());
355
356 if(attName == "name")
357 {
358 name = GenerateName(attValue);
359 }
360 else if(attName == "unit")
361 {
362 unit = G4UnitDefinition::GetValueOf(attValue);
363 if(G4UnitDefinition::GetCategory(attValue) != "Length")
364 {
365 G4Exception("G4GDMLReadDefine::PositionRead()", "InvalidRead",
366 FatalException, "Invalid unit for length!");
367 }
368 }
369 else if(attName == "x")
370 {
371 position.setX(eval.Evaluate(attValue));
372 }
373 else if(attName == "y")
374 {
375 position.setY(eval.Evaluate(attValue));
376 }
377 else if(attName == "z")
378 {
379 position.setZ(eval.Evaluate(attValue));
380 }
381 }
382
383 positionMap[name] = position * unit;
384}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), position, G4GDMLReadDefine::positionMap, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadDefine::DefineRead().

◆ PRead()

G4double G4GDMLReadMaterials::PRead ( const xercesc::DOMElement * const  PElement)
protectedinherited

Definition at line 195 of file G4GDMLReadMaterials.cc.

196{
197 G4double value = STP_Pressure;
198 G4double unit = hep_pascal;
199
200 const xercesc::DOMNamedNodeMap* const attributes = PElement->getAttributes();
201 XMLSize_t attributeCount = attributes->getLength();
202
203 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
204 ++attribute_index)
205 {
206 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
207
208 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
209 {
210 continue;
211 }
212
213 const xercesc::DOMAttr* const attribute =
214 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
215 if(attribute == nullptr)
216 {
217 G4Exception("G4GDMLReadMaterials::PRead()", "InvalidRead", FatalException,
218 "No attribute found!");
219 return value;
220 }
221 const G4String attName = Transcode(attribute->getName());
222 const G4String attValue = Transcode(attribute->getValue());
223
224 if(attName == "value")
225 {
226 value = eval.Evaluate(attValue);
227 }
228 else if(attName == "unit")
229 {
230 unit = G4UnitDefinition::GetValueOf(attValue);
231 if(G4UnitDefinition::GetCategory(attValue) != "Pressure")
232 {
233 G4Exception("G4GDMLReadMaterials::PRead()", "InvalidRead",
234 FatalException, "Invalid unit for pressure!");
235 }
236 }
237 }
238
239 return value * unit;
240}
static constexpr double hep_pascal
Definition: G4SIunits.hh:222

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), hep_pascal, source.hepunit::STP_Pressure, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::MaterialRead().

◆ PropertyRead() [1/2]

void G4GDMLReadMaterials::PropertyRead ( const xercesc::DOMElement * const  propertyElement,
G4Material material 
)
protectedinherited

Definition at line 802 of file G4GDMLReadMaterials.cc.

804{
806 G4String ref;
807 G4GDMLMatrix matrix;
808
809 const xercesc::DOMNamedNodeMap* const attributes =
810 propertyElement->getAttributes();
811 XMLSize_t attributeCount = attributes->getLength();
812
813 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
814 ++attribute_index)
815 {
816 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
817
818 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
819 {
820 continue;
821 }
822
823 const xercesc::DOMAttr* const attribute =
824 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
825 if(attribute == nullptr)
826 {
827 G4Exception("G4GDMLReadMaterials::PropertyRead()", "InvalidRead",
828 FatalException, "No attribute found!");
829 return;
830 }
831 const G4String attName = Transcode(attribute->getName());
832 const G4String attValue = Transcode(attribute->getValue());
833
834 if(attName == "name")
835 {
836 name = GenerateName(attValue);
837 }
838 else if(attName == "ref")
839 {
840 matrix = GetMatrix(ref = attValue);
841 }
842 }
843
844 /*
845 if (matrix.GetCols() != 2)
846 {
847 G4String error_msg = "Referenced matrix '" + ref
848 + "' should have \n two columns as a property table for material: "
849 + material->GetName();
850 G4Exception("G4GDMLReadMaterials::PropertyRead()", "InvalidRead",
851 FatalException, error_msg);
852 }
853 */
854
855 if(matrix.GetRows() == 0)
856 {
857 return;
858 }
859
860 G4MaterialPropertiesTable* matprop = material->GetMaterialPropertiesTable();
861 if(matprop == nullptr)
862 {
863 matprop = new G4MaterialPropertiesTable();
864 material->SetMaterialPropertiesTable(matprop);
865 }
866 if(matrix.GetCols() == 1) // constant property assumed
867 {
868 matprop->AddConstProperty(Strip(name), matrix.Get(0, 0), true);
869 }
870 else // build the material properties vector
871 {
873 for(std::size_t i = 0; i < matrix.GetRows(); ++i)
874 {
875 propvect->InsertValues(matrix.Get(i, 0), matrix.Get(i, 1));
876 }
877 matprop->AddProperty(Strip(name), propvect, true);
878 }
879}
G4PhysicsFreeVector G4MaterialPropertyVector
std::size_t GetCols() const
std::size_t GetRows() const
G4double Get(std::size_t r, std::size_t c) const
G4GDMLMatrix GetMatrix(const G4String &)
void AddConstProperty(const G4String &key, G4double propertyValue, G4bool createNewKey=false)
G4MaterialPropertyVector * AddProperty(const G4String &key, const std::vector< G4double > &photonEnergies, const std::vector< G4double > &propertyValues, G4bool createNewKey=false, G4bool spline=false)
void InsertValues(const G4double energy, const G4double value)

References G4MaterialPropertiesTable::AddConstProperty(), G4MaterialPropertiesTable::AddProperty(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLMatrix::Get(), G4GDMLMatrix::GetCols(), G4GDMLReadDefine::GetMatrix(), G4GDMLMatrix::GetRows(), G4PhysicsFreeVector::InsertValues(), eplot::material, G4InuclParticleNames::name(), G4GDMLRead::Strip(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::MaterialRead().

◆ PropertyRead() [2/2]

void G4GDMLReadSolids::PropertyRead ( const xercesc::DOMElement * const  propertyElement,
G4OpticalSurface opticalsurface 
)
protectedinherited

Definition at line 3487 of file G4GDMLReadSolids.cc.

3490{
3491 G4String name;
3492 G4String ref;
3493 G4GDMLMatrix matrix;
3494
3495 const xercesc::DOMNamedNodeMap* const attributes =
3496 propertyElement->getAttributes();
3497 XMLSize_t attributeCount = attributes->getLength();
3498
3499 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3500 ++attribute_index)
3501 {
3502 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3503
3504 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3505 {
3506 continue;
3507 }
3508
3509 const xercesc::DOMAttr* const attribute =
3510 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
3511 if(attribute == nullptr)
3512 {
3513 G4Exception("G4GDMLReadSolids::PropertyRead()", "InvalidRead",
3514 FatalException, "No attribute found!");
3515 return;
3516 }
3517 const G4String attName = Transcode(attribute->getName());
3518 const G4String attValue = Transcode(attribute->getValue());
3519
3520 if(attName == "name")
3521 {
3522 name = GenerateName(attValue);
3523 }
3524 else if(attName == "ref")
3525 {
3526 matrix = GetMatrix(ref = attValue);
3527 }
3528 }
3529
3530 /*
3531 if (matrix.GetCols() != 2)
3532 {
3533 G4String error_msg = "Referenced matrix '" + ref
3534 + "' should have \n two columns as a property table for
3535 opticalsurface: "
3536 + opticalsurface->GetName();
3537 G4Exception("G4GDMLReadSolids::PropertyRead()", "InvalidRead",
3538 FatalException, error_msg);
3539 }
3540 */
3541
3542 if(matrix.GetRows() == 0)
3543 {
3544 return;
3545 }
3546
3547 G4MaterialPropertiesTable* matprop =
3548 opticalsurface->GetMaterialPropertiesTable();
3549 if(matprop == nullptr)
3550 {
3551 matprop = new G4MaterialPropertiesTable();
3552 opticalsurface->SetMaterialPropertiesTable(matprop);
3553 }
3554 if(matrix.GetCols() == 1) // constant property assumed
3555 {
3556 matprop->AddConstProperty(Strip(name), matrix.Get(0, 0), true);
3557 }
3558 else // build the material properties vector
3559 {
3560 G4MaterialPropertyVector* propvect;
3561 G4String temp = name + ref;
3562 // first check if it was already built
3563 if(mapOfMatPropVects.find(temp) == mapOfMatPropVects.end())
3564 {
3565 // if not create a new one
3566 propvect = new G4MaterialPropertyVector();
3567 for(size_t i = 0; i < matrix.GetRows(); i++)
3568 {
3569 propvect->InsertValues(matrix.Get(i, 0), matrix.Get(i, 1));
3570 }
3571 // and add it to the list for potential future reuse
3572 mapOfMatPropVects[temp] = propvect;
3573 }
3574 else
3575 {
3576 propvect = mapOfMatPropVects[temp];
3577 }
3578
3579 matprop->AddProperty(Strip(name), propvect, true);
3580 }
3581}
std::map< G4String, G4MaterialPropertyVector * > mapOfMatPropVects
void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const

References G4MaterialPropertiesTable::AddConstProperty(), G4MaterialPropertiesTable::AddProperty(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLMatrix::Get(), G4GDMLMatrix::GetCols(), G4OpticalSurface::GetMaterialPropertiesTable(), G4GDMLReadDefine::GetMatrix(), G4GDMLMatrix::GetRows(), G4PhysicsFreeVector::InsertValues(), G4GDMLReadSolids::mapOfMatPropVects, G4InuclParticleNames::name(), G4OpticalSurface::SetMaterialPropertiesTable(), G4GDMLRead::Strip(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::OpticalSurfaceRead().

◆ QuadrangularRead()

G4QuadrangularFacet * G4GDMLReadSolids::QuadrangularRead ( const xercesc::DOMElement * const  quadrangularElement)
protectedinherited

Definition at line 1637 of file G4GDMLReadSolids.cc.

1639{
1640 G4ThreeVector vertex1;
1641 G4ThreeVector vertex2;
1642 G4ThreeVector vertex3;
1643 G4ThreeVector vertex4;
1645 G4double lunit = 1.0;
1646
1647 const xercesc::DOMNamedNodeMap* const attributes =
1648 quadrangularElement->getAttributes();
1649 XMLSize_t attributeCount = attributes->getLength();
1650
1651 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1652 ++attribute_index)
1653 {
1654 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1655
1656 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1657 {
1658 continue;
1659 }
1660
1661 const xercesc::DOMAttr* const attribute =
1662 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1663 if(attribute == nullptr)
1664 {
1665 G4Exception("G4GDMLReadSolids::QuadrangularRead()", "InvalidRead",
1666 FatalException, "No attribute found!");
1667 return nullptr;
1668 }
1669 const G4String attName = Transcode(attribute->getName());
1670 const G4String attValue = Transcode(attribute->getValue());
1671
1672 if(attName == "vertex1")
1673 {
1674 vertex1 = GetPosition(GenerateName(attValue));
1675 }
1676 else if(attName == "vertex2")
1677 {
1678 vertex2 = GetPosition(GenerateName(attValue));
1679 }
1680 else if(attName == "vertex3")
1681 {
1682 vertex3 = GetPosition(GenerateName(attValue));
1683 }
1684 else if(attName == "vertex4")
1685 {
1686 vertex4 = GetPosition(GenerateName(attValue));
1687 }
1688 else if(attName == "lunit")
1689 {
1690 lunit = G4UnitDefinition::GetValueOf(attValue);
1691 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1692 {
1693 G4Exception("G4GDMLReadSolids::QuadrangularRead()", "InvalidRead",
1694 FatalException, "Invalid unit for length!");
1695 }
1696 }
1697 else if(attName == "type")
1698 {
1699 if(attValue == "RELATIVE")
1700 {
1701 type = RELATIVE;
1702 }
1703 }
1704 }
1705
1706 return new G4QuadrangularFacet(vertex1 * lunit, vertex2 * lunit,
1707 vertex3 * lunit, vertex4 * lunit, type);
1708}
G4FacetVertexType
Definition: G4VFacet.hh:48
@ ABSOLUTE
Definition: G4VFacet.hh:48
@ RELATIVE
Definition: G4VFacet.hh:48

References ABSOLUTE, FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4GDMLReadDefine::GetPosition(), G4UnitDefinition::GetValueOf(), RELATIVE, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::TessellatedRead().

◆ QuantityRead()

void G4GDMLReadDefine::QuantityRead ( const xercesc::DOMElement * const  element)
protectedinherited

Definition at line 547 of file G4GDMLReadDefine.cc.

548{
549 G4String name = "";
550 G4double unit = 1.0;
551 G4double value = 0.0;
552
553 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
554 XMLSize_t attributeCount = attributes->getLength();
555
556 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
557 ++attribute_index)
558 {
559 xercesc::DOMNode* node = attributes->item(attribute_index);
560
561 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
562 {
563 continue;
564 }
565
566 const xercesc::DOMAttr* const attribute =
567 dynamic_cast<xercesc::DOMAttr*>(node);
568 if(attribute == nullptr)
569 {
570 G4Exception("G4GDMLRead::QuantityRead()", "InvalidRead", FatalException,
571 "No attribute found!");
572 return;
573 }
574 const G4String attName = Transcode(attribute->getName());
575 const G4String attValue = Transcode(attribute->getValue());
576
577 if(attName == "name")
578 {
579 name = attValue;
580 }
581 else if(attName == "value")
582 {
583 value = eval.Evaluate(attValue);
584 }
585 else if(attName == "unit")
586 {
587 unit = G4UnitDefinition::GetValueOf(attValue);
588 }
589 }
590
591 quantityMap[name] = value * unit;
592 eval.DefineConstant(name, value * unit);
593}

References G4GDMLEvaluator::DefineConstant(), G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), G4GDMLReadDefine::quantityMap, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadDefine::DefineRead().

◆ Read()

void G4GDMLRead::Read ( const G4String fileName,
G4bool  validation,
G4bool  isModule,
G4bool  strip = true 
)
inherited

Definition at line 422 of file G4GDMLRead.cc.

424{
425 dostrip = strip;
426#ifdef G4VERBOSE
427 if(isModule)
428 {
429 G4cout << "G4GDML: Reading module '" << fileName << "'..." << G4endl;
430 }
431 else
432 {
433 G4cout << "G4GDML: Reading '" << fileName << "'..." << G4endl;
434 }
435#endif
436 inLoop = 0;
437 validate = validation;
438
439 xercesc::ErrorHandler* handler = new G4GDMLErrorHandler(!validate);
440 xercesc::XercesDOMParser* parser = new xercesc::XercesDOMParser;
441
442 if(validate)
443 {
444 parser->setValidationScheme(xercesc::XercesDOMParser::Val_Always);
445 }
446 parser->setValidationSchemaFullChecking(validate);
447 parser->setCreateEntityReferenceNodes(false);
448 // Entities will be automatically resolved by Xerces
449
450 parser->setDoNamespaces(true);
451 parser->setDoSchema(validate);
452 parser->setErrorHandler(handler);
453
454 try
455 {
456 parser->parse(fileName.c_str());
457 } catch(const xercesc::XMLException& e)
458 {
459 G4cout << "G4GDML: " << Transcode(e.getMessage()) << G4endl;
460 } catch(const xercesc::DOMException& e)
461 {
462 G4cout << "G4GDML: " << Transcode(e.getMessage()) << G4endl;
463 }
464
465 xercesc::DOMDocument* doc = parser->getDocument();
466
467 if(doc == nullptr)
468 {
469 G4String error_msg = "Unable to open document: " + fileName;
470 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException, error_msg);
471 return;
472 }
473 xercesc::DOMElement* element = doc->getDocumentElement();
474
475 if(element == nullptr )
476 {
477 std::ostringstream message;
478 message << "ERROR - Empty document or unable to validate schema!" << G4endl
479 << " Check Internet connection is ON in case of schema"
480 << G4endl
481 << " validation enabled and location defined as URL in"
482 << G4endl << " the GDML file - " << fileName
483 << " - being imported!" << G4endl
484 << " Otherwise, verify GDML schema server is reachable!";
485 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException, message);
486 return;
487 }
488
489 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
490 iter = iter->getNextSibling())
491 {
492 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
493 {
494 continue;
495 }
496
497 const xercesc::DOMElement* const child =
498 dynamic_cast<xercesc::DOMElement*>(iter);
499 if(child == nullptr)
500 {
501 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException,
502 "No child found!");
503 return;
504 }
505 const G4String tag = Transcode(child->getTagName());
506
507 if(tag == "define")
508 {
509 DefineRead(child);
510 }
511 else if(tag == "materials")
512 {
513 MaterialsRead(child);
514 }
515 else if(tag == "solids")
516 {
517 SolidsRead(child);
518 }
519 else if(tag == "setup")
520 {
521 SetupRead(child);
522 }
523 else if(tag == "structure")
524 {
525 StructureRead(child);
526 }
527 else if(tag == "userinfo")
528 {
529 UserinfoRead(child);
530 }
531 else if(tag == "extension")
532 {
533 ExtensionRead(child);
534 }
535 else
536 {
537 G4String error_msg = "Unknown tag in gdml: " + tag;
538 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException,
539 error_msg);
540 }
541 }
542
543 delete parser;
544 delete handler;
545
546 if(isModule)
547 {
548#ifdef G4VERBOSE
549 G4cout << "G4GDML: Reading module '" << fileName << "' done!" << G4endl;
550#endif
551 }
552 else
553 {
554 G4cout << "G4GDML: Reading '" << fileName << "' done!" << G4endl;
555 if(strip)
556 {
557 StripNames();
558 }
559 }
560}
G4bool validate
Definition: G4GDMLRead.hh:157
G4bool dostrip
Definition: G4GDMLRead.hh:159
virtual void SolidsRead(const xercesc::DOMElement *const)=0
virtual void MaterialsRead(const xercesc::DOMElement *const)=0
virtual void UserinfoRead(const xercesc::DOMElement *const)
Definition: G4GDMLRead.cc:377
virtual void SetupRead(const xercesc::DOMElement *const)=0
virtual void ExtensionRead(const xercesc::DOMElement *const)
Definition: G4GDMLRead.cc:414
virtual void DefineRead(const xercesc::DOMElement *const)=0
virtual void StructureRead(const xercesc::DOMElement *const)=0
void StripNames() const
Definition: G4GDMLRead.cc:122

References G4GDMLRead::DefineRead(), G4GDMLRead::dostrip, G4GDMLRead::ExtensionRead(), FatalException, G4cout, G4endl, G4Exception(), G4GDMLRead::inLoop, G4GDMLRead::MaterialsRead(), geant4_check_module_cycles::parser, G4GDMLRead::SetupRead(), G4GDMLRead::SolidsRead(), G4StrUtil::strip(), G4GDMLRead::StripNames(), G4GDMLRead::StructureRead(), G4GDMLRead::Transcode(), G4GDMLRead::UserinfoRead(), and G4GDMLRead::validate.

Referenced by G4GDMLReadStructure::FileRead().

◆ ReflectedSolidRead()

void G4GDMLReadSolids::ReflectedSolidRead ( const xercesc::DOMElement * const  reflectedSolidElement)
protectedinherited

Definition at line 1711 of file G4GDMLReadSolids.cc.

1713{
1714 G4String name;
1715 G4double lunit = 1.0;
1716 G4double aunit = 1.0;
1717 G4String solid;
1718 G4ThreeVector scale(1.0, 1.0, 1.0);
1719 G4ThreeVector rotation;
1721
1722 const xercesc::DOMNamedNodeMap* const attributes =
1723 reflectedSolidElement->getAttributes();
1724 XMLSize_t attributeCount = attributes->getLength();
1725
1726 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1727 ++attribute_index)
1728 {
1729 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1730
1731 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1732 {
1733 continue;
1734 }
1735
1736 const xercesc::DOMAttr* const attribute =
1737 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1738 if(attribute == nullptr)
1739 {
1740 G4Exception("G4GDMLReadSolids::ReflectedSolidRead()", "InvalidRead",
1741 FatalException, "No attribute found!");
1742 return;
1743 }
1744 const G4String attName = Transcode(attribute->getName());
1745 const G4String attValue = Transcode(attribute->getValue());
1746
1747 if(attName == "name")
1748 {
1749 name = GenerateName(attValue);
1750 }
1751 else if(attName == "lunit")
1752 {
1753 lunit = G4UnitDefinition::GetValueOf(attValue);
1754 if(G4UnitDefinition::GetCategory(attValue) != "Length")
1755 {
1756 G4Exception("G4GDMLReadSolids::ReflectedSolidRead()", "InvalidRead",
1757 FatalException, "Invalid unit for length!");
1758 }
1759 }
1760 else if(attName == "aunit")
1761 {
1762 aunit = G4UnitDefinition::GetValueOf(attValue);
1763 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
1764 {
1765 G4Exception("G4GDMLReadSolids::ReflectedSolidRead()", "InvalidRead",
1766 FatalException, "Invalid unit for angle!");
1767 }
1768 }
1769 else if(attName == "solid")
1770 {
1771 solid = GenerateName(attValue);
1772 }
1773 else if(attName == "sx")
1774 {
1775 scale.setX(eval.Evaluate(attValue));
1776 }
1777 else if(attName == "sy")
1778 {
1779 scale.setY(eval.Evaluate(attValue));
1780 }
1781 else if(attName == "sz")
1782 {
1783 scale.setZ(eval.Evaluate(attValue));
1784 }
1785 else if(attName == "rx")
1786 {
1787 rotation.setX(eval.Evaluate(attValue));
1788 }
1789 else if(attName == "ry")
1790 {
1791 rotation.setY(eval.Evaluate(attValue));
1792 }
1793 else if(attName == "rz")
1794 {
1795 rotation.setZ(eval.Evaluate(attValue));
1796 }
1797 else if(attName == "dx")
1798 {
1799 position.setX(eval.Evaluate(attValue));
1800 }
1801 else if(attName == "dy")
1802 {
1803 position.setY(eval.Evaluate(attValue));
1804 }
1805 else if(attName == "dz")
1806 {
1807 position.setZ(eval.Evaluate(attValue));
1808 }
1809 }
1810
1811 rotation *= aunit;
1812 position *= lunit;
1813
1815 transform = transform * G4Scale3D(scale.x(), scale.y(), scale.z());
1816
1818}
HepGeom::Scale3D G4Scale3D
void setY(double)
void setZ(double)
void setX(double)

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4GDMLReadDefine::GetRotationMatrix(), G4GDMLReadSolids::GetSolid(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), position, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), G4GDMLRead::Transcode(), G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ RefRead()

G4String G4GDMLReadDefine::RefRead ( const xercesc::DOMElement * const  element)
protectedinherited

Definition at line 714 of file G4GDMLReadDefine.cc.

715{
716 G4String ref;
717
718 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
719 XMLSize_t attributeCount = attributes->getLength();
720
721 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
722 ++attribute_index)
723 {
724 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
725
726 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
727 {
728 continue;
729 }
730
731 const xercesc::DOMAttr* const attribute =
732 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
733 if(attribute == nullptr)
734 {
735 G4Exception("G4GDMLRead::Read()", "InvalidRead", FatalException,
736 "No attribute found!");
737 return ref;
738 }
739 const G4String attName = Transcode(attribute->getName());
740 const G4String attValue = Transcode(attribute->getValue());
741
742 if(attName == "ref")
743 {
744 ref = attValue;
745 }
746 }
747
748 return ref;
749}

References FatalException, G4Exception(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::BooleanRead(), G4GDMLReadStructure::BorderSurfaceRead(), G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadMaterials::MaterialRead(), G4GDMLReadSolids::MultiUnionNodeRead(), ParametersRead(), ParamvolRead(), G4GDMLReadStructure::PhysvolRead(), G4GDMLReadStructure::ReplicaRead(), G4GDMLReadStructure::ReplicavolRead(), G4GDMLReadSolids::ScaledSolidRead(), G4GDMLReadSetup::SetupRead(), G4GDMLReadStructure::SkinSurfaceRead(), and G4GDMLReadStructure::VolumeRead().

◆ RotationRead()

void G4GDMLReadDefine::RotationRead ( const xercesc::DOMElement * const  rotationElement)
protectedinherited

Definition at line 387 of file G4GDMLReadDefine.cc.

389{
390 G4String name = "";
391 G4double unit = 1.0;
392 G4ThreeVector rotation(0., 0., 0.);
393
394 const xercesc::DOMNamedNodeMap* const attributes =
395 rotationElement->getAttributes();
396 XMLSize_t attributeCount = attributes->getLength();
397
398 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
399 ++attribute_index)
400 {
401 xercesc::DOMNode* node = attributes->item(attribute_index);
402
403 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
404 {
405 continue;
406 }
407
408 const xercesc::DOMAttr* const attribute =
409 dynamic_cast<xercesc::DOMAttr*>(node);
410 if(attribute == nullptr)
411 {
412 G4Exception("G4GDMLRead::RotationRead()", "InvalidRead", FatalException,
413 "No attribute found!");
414 return;
415 }
416 const G4String attName = Transcode(attribute->getName());
417 const G4String attValue = Transcode(attribute->getValue());
418
419 if(attName == "name")
420 {
421 name = GenerateName(attValue);
422 }
423 else if(attName == "unit")
424 {
425 unit = G4UnitDefinition::GetValueOf(attValue);
426 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
427 {
428 G4Exception("G4GDMLReadDefine::RotationRead()", "InvalidRead",
429 FatalException, "Invalid unit for angle!");
430 }
431 }
432 else if(attName == "x")
433 {
434 rotation.setX(eval.Evaluate(attValue));
435 }
436 else if(attName == "y")
437 {
438 rotation.setY(eval.Evaluate(attValue));
439 }
440 else if(attName == "z")
441 {
442 rotation.setZ(eval.Evaluate(attValue));
443 }
444 }
445
446 rotationMap[name] = rotation * unit;
447}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), G4GDMLReadDefine::rotationMap, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadDefine::DefineRead().

◆ RZPointRead()

G4GDMLReadSolids::rzPointType G4GDMLReadSolids::RZPointRead ( const xercesc::DOMElement * const  zplaneElement)
protectedinherited

Definition at line 3443 of file G4GDMLReadSolids.cc.

3445{
3446 rzPointType rzpoint = { 0., 0. };
3447
3448 const xercesc::DOMNamedNodeMap* const attributes =
3449 zplaneElement->getAttributes();
3450 XMLSize_t attributeCount = attributes->getLength();
3451
3452 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3453 ++attribute_index)
3454 {
3455 xercesc::DOMNode* node = attributes->item(attribute_index);
3456
3457 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3458 {
3459 continue;
3460 }
3461
3462 const xercesc::DOMAttr* const attribute =
3463 dynamic_cast<xercesc::DOMAttr*>(node);
3464 if(attribute == nullptr)
3465 {
3466 G4Exception("G4GDMLReadSolids::RZPointRead()", "InvalidRead",
3467 FatalException, "No attribute found!");
3468 return rzpoint;
3469 }
3470 const G4String attName = Transcode(attribute->getName());
3471 const G4String attValue = Transcode(attribute->getValue());
3472
3473 if(attName == "r")
3474 {
3475 rzpoint.r = eval.Evaluate(attValue);
3476 }
3477 else if(attName == "z")
3478 {
3479 rzpoint.z = eval.Evaluate(attValue);
3480 }
3481 }
3482
3483 return rzpoint;
3484}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLReadSolids::rzPointType::r, G4GDMLRead::Transcode(), and G4GDMLReadSolids::rzPointType::z.

Referenced by G4GDMLReadSolids::GenericPolyconeRead(), and G4GDMLReadSolids::GenericPolyhedraRead().

◆ ScaledSolidRead()

void G4GDMLReadSolids::ScaledSolidRead ( const xercesc::DOMElement * const  scaledSolidElement)
protectedinherited

Definition at line 1821 of file G4GDMLReadSolids.cc.

1823{
1824 G4String name;
1825 G4VSolid* solid = nullptr;
1826 G4ThreeVector scale(1.0, 1.0, 1.0);
1827
1828 const xercesc::DOMNamedNodeMap* const attributes =
1829 scaledSolidElement->getAttributes();
1830 XMLSize_t attributeCount = attributes->getLength();
1831
1832 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1833 ++attribute_index)
1834 {
1835 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1836
1837 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1838 {
1839 continue;
1840 }
1841
1842 const xercesc::DOMAttr* const attribute =
1843 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1844 if(attribute == nullptr)
1845 {
1846 G4Exception("G4GDMLReadSolids::ScaledSolidRead()", "InvalidRead",
1847 FatalException, "No attribute found!");
1848 return;
1849 }
1850 const G4String attName = Transcode(attribute->getName());
1851 const G4String attValue = Transcode(attribute->getValue());
1852
1853 if(attName == "name")
1854 {
1855 name = GenerateName(attValue);
1856 }
1857 }
1858
1859 for(xercesc::DOMNode* iter = scaledSolidElement->getFirstChild();
1860 iter != nullptr; iter = iter->getNextSibling())
1861 {
1862 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1863 {
1864 continue;
1865 }
1866
1867 const xercesc::DOMElement* const child =
1868 dynamic_cast<xercesc::DOMElement*>(iter);
1869 if(child == nullptr)
1870 {
1871 G4Exception("G4GDMLReadSolids::ScaledSolidRead()", "InvalidRead",
1872 FatalException, "No child found!");
1873 return;
1874 }
1875 const G4String tag = Transcode(child->getTagName());
1876
1877 if(tag == "solidref")
1878 {
1879 solid = GetSolid(GenerateName(RefRead(child)));
1880 }
1881 else if(tag == "scale")
1882 {
1883 VectorRead(child, scale);
1884 }
1885 else if(tag == "scaleref")
1886 {
1887 scale = GetScale(GenerateName(RefRead(child)));
1888 }
1889 else
1890 {
1891 G4String error_msg = "Unknown tag in scaled solid: " + tag;
1892 G4Exception("G4GDMLReadSolids::ScaledSolidRead()", "ReadError",
1893 FatalException, error_msg);
1894 return;
1895 }
1896 }
1897
1898 G4Scale3D transform = G4Scale3D(scale.x(), scale.y(), scale.z());
1899
1900 new G4ScaledSolid(name, solid, transform);
1901}
G4ThreeVector GetScale(const G4String &)

References FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetScale(), G4GDMLReadSolids::GetSolid(), G4InuclParticleNames::name(), G4GDMLReadDefine::RefRead(), G4GDMLRead::Transcode(), G4coutFormatters::anonymous_namespace{G4coutFormatters.cc}::transform(), G4GDMLReadDefine::VectorRead(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ ScaleRead()

void G4GDMLReadDefine::ScaleRead ( const xercesc::DOMElement * const  scaleElement)
protectedinherited

Definition at line 450 of file G4GDMLReadDefine.cc.

451{
452 G4String name = "";
453 G4ThreeVector scale(1.0, 1.0, 1.0);
454
455 const xercesc::DOMNamedNodeMap* const attributes =
456 scaleElement->getAttributes();
457 XMLSize_t attributeCount = attributes->getLength();
458
459 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
460 ++attribute_index)
461 {
462 xercesc::DOMNode* node = attributes->item(attribute_index);
463
464 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
465 {
466 continue;
467 }
468
469 const xercesc::DOMAttr* const attribute =
470 dynamic_cast<xercesc::DOMAttr*>(node);
471 if(attribute == nullptr)
472 {
473 G4Exception("G4GDMLRead::ScaleRead()", "InvalidRead", FatalException,
474 "No attribute found!");
475 return;
476 }
477 const G4String attName = Transcode(attribute->getName());
478 const G4String attValue = Transcode(attribute->getValue());
479
480 if(attName == "name")
481 {
482 name = GenerateName(attValue);
483 }
484 else if(attName == "x")
485 {
486 scale.setX(eval.Evaluate(attValue));
487 }
488 else if(attName == "y")
489 {
490 scale.setY(eval.Evaluate(attValue));
491 }
492 else if(attName == "z")
493 {
494 scale.setZ(eval.Evaluate(attValue));
495 }
496 }
497
498 scaleMap[name] = scale;
499}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4InuclParticleNames::name(), G4GDMLReadDefine::scaleMap, CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadDefine::DefineRead().

◆ SectionRead()

G4ExtrudedSolid::ZSection G4GDMLReadSolids::SectionRead ( const xercesc::DOMElement * const  sectionElement,
G4double  lunit 
)
protectedinherited

Definition at line 1904 of file G4GDMLReadSolids.cc.

1906{
1907 G4double zPosition = 0.0;
1908 G4TwoVector Offset;
1909 G4double scalingFactor = 1.0;
1910
1911 const xercesc::DOMNamedNodeMap* const attributes =
1912 sectionElement->getAttributes();
1913 XMLSize_t attributeCount = attributes->getLength();
1914
1915 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1916 ++attribute_index)
1917 {
1918 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1919
1920 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1921 {
1922 continue;
1923 }
1924
1925 const xercesc::DOMAttr* const attribute =
1926 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1927 if(attribute == nullptr)
1928 {
1929 G4Exception("G4GDMLReadSolids::SectionRead()", "InvalidRead",
1930 FatalException, "No attribute found!");
1931 return G4ExtrudedSolid::ZSection(zPosition, Offset, scalingFactor);
1932 }
1933 const G4String attName = Transcode(attribute->getName());
1934 const G4String attValue = Transcode(attribute->getValue());
1935
1936 if(attName == "zPosition")
1937 {
1938 zPosition = eval.Evaluate(attValue) * lunit;
1939 }
1940 else if(attName == "xOffset")
1941 {
1942 Offset.setX(eval.Evaluate(attValue) * lunit);
1943 }
1944 else if(attName == "yOffset")
1945 {
1946 Offset.setY(eval.Evaluate(attValue) * lunit);
1947 }
1948 else if(attName == "scalingFactor")
1949 {
1950 scalingFactor = eval.Evaluate(attValue);
1951 }
1952 }
1953
1954 return G4ExtrudedSolid::ZSection(zPosition, Offset, scalingFactor);
1955}
void setY(double y)
void setX(double x)

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), CLHEP::Hep2Vector::setX(), CLHEP::Hep2Vector::setY(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::XtruRead().

◆ SetReverseSearch()

void G4GDMLReadDefine::SetReverseSearch ( G4bool  flag)
inlineinherited

Definition at line 81 of file G4GDMLReadDefine.hh.

82 { reverseSearch = flag; }

References G4GDMLReadDefine::reverseSearch.

◆ SetupRead()

void G4GDMLReadSetup::SetupRead ( const xercesc::DOMElement *const  element)
virtualinherited

Implements G4GDMLRead.

Definition at line 67 of file G4GDMLReadSetup.cc.

68{
69#ifdef G4VERBOSE
70 G4cout << "G4GDML: Reading setup..." << G4endl;
71#endif
73
74 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
75 XMLSize_t attributeCount = attributes->getLength();
76
77 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
78 ++attribute_index)
79 {
80 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
81
82 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
83 {
84 continue;
85 }
86
87 const xercesc::DOMAttr* const attribute =
88 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
89 if(attribute == nullptr)
90 {
91 G4Exception("G4GDMLReadSetup::SetupRead()", "InvalidRead", FatalException,
92 "No attribute found!");
93 return;
94 }
95 const G4String attName = Transcode(attribute->getName());
96 const G4String attValue = Transcode(attribute->getValue());
97
98 if(attName == "name")
99 {
100 name = attValue;
101 }
102 }
103
104 for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
105 iter = iter->getNextSibling())
106 {
107 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
108 {
109 continue;
110 }
111
112 const xercesc::DOMElement* const child =
113 dynamic_cast<xercesc::DOMElement*>(iter);
114 if(child == nullptr)
115 {
116 G4Exception("G4GDMLReadSetup::SetupRead()", "InvalidRead", FatalException,
117 "No child found!");
118 return;
119 }
120 const G4String tag = Transcode(child->getTagName());
121
122 if(tag == "world")
123 {
125 }
126 }
127}

References FatalException, G4cout, G4endl, G4Exception(), G4GDMLRead::GenerateName(), G4InuclParticleNames::name(), G4GDMLReadDefine::RefRead(), G4GDMLReadSetup::setupMap, and G4GDMLRead::Transcode().

◆ SolidsRead()

void G4GDMLReadSolids::SolidsRead ( const xercesc::DOMElement * const  solidsElement)
virtualinherited

Implements G4GDMLRead.

Definition at line 3880 of file G4GDMLReadSolids.cc.

3882{
3883#ifdef G4VERBOSE
3884 G4cout << "G4GDML: Reading solids..." << G4endl;
3885#endif
3886 for(xercesc::DOMNode* iter = solidsElement->getFirstChild(); iter != nullptr;
3887 iter = iter->getNextSibling())
3888 {
3889 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
3890 {
3891 continue;
3892 }
3893
3894 const xercesc::DOMElement* const child =
3895 dynamic_cast<xercesc::DOMElement*>(iter);
3896 if(child == nullptr)
3897 {
3898 G4Exception("G4GDMLReadSolids::SolidsRead()", "InvalidRead",
3899 FatalException, "No child found!");
3900 return;
3901 }
3902 const G4String tag = Transcode(child->getTagName());
3903 if(tag == "define")
3904 {
3905 DefineRead(child);
3906 }
3907 else if(tag == "box")
3908 {
3909 BoxRead(child);
3910 }
3911 else if(tag == "cone")
3912 {
3913 ConeRead(child);
3914 }
3915 else if(tag == "elcone")
3916 {
3917 ElconeRead(child);
3918 }
3919 else if(tag == "ellipsoid")
3920 {
3921 EllipsoidRead(child);
3922 }
3923 else if(tag == "eltube")
3924 {
3925 EltubeRead(child);
3926 }
3927 else if(tag == "xtru")
3928 {
3929 XtruRead(child);
3930 }
3931 else if(tag == "hype")
3932 {
3933 HypeRead(child);
3934 }
3935 else if(tag == "intersection")
3936 {
3937 BooleanRead(child, INTERSECTION);
3938 }
3939 else if(tag == "multiUnion")
3940 {
3941 MultiUnionRead(child);
3942 }
3943 else if(tag == "orb")
3944 {
3945 OrbRead(child);
3946 }
3947 else if(tag == "para")
3948 {
3949 ParaRead(child);
3950 }
3951 else if(tag == "paraboloid")
3952 {
3953 ParaboloidRead(child);
3954 }
3955 else if(tag == "polycone")
3956 {
3957 PolyconeRead(child);
3958 }
3959 else if(tag == "genericPolycone")
3960 {
3961 GenericPolyconeRead(child);
3962 }
3963 else if(tag == "polyhedra")
3964 {
3965 PolyhedraRead(child);
3966 }
3967 else if(tag == "genericPolyhedra")
3968 {
3969 GenericPolyhedraRead(child);
3970 }
3971 else if(tag == "reflectedSolid")
3972 {
3973 ReflectedSolidRead(child);
3974 }
3975 else if(tag == "scaledSolid")
3976 {
3977 ScaledSolidRead(child);
3978 }
3979 else if(tag == "sphere")
3980 {
3981 SphereRead(child);
3982 }
3983 else if(tag == "subtraction")
3984 {
3985 BooleanRead(child, SUBTRACTION);
3986 }
3987 else if(tag == "tessellated")
3988 {
3989 TessellatedRead(child);
3990 }
3991 else if(tag == "tet")
3992 {
3993 TetRead(child);
3994 }
3995 else if(tag == "torus")
3996 {
3997 TorusRead(child);
3998 }
3999 else if(tag == "arb8")
4000 {
4001 GenTrapRead(child);
4002 }
4003 else if(tag == "trap")
4004 {
4005 TrapRead(child);
4006 }
4007 else if(tag == "trd")
4008 {
4009 TrdRead(child);
4010 }
4011 else if(tag == "tube")
4012 {
4013 TubeRead(child);
4014 }
4015 else if(tag == "cutTube")
4016 {
4017 CutTubeRead(child);
4018 }
4019 else if(tag == "twistedbox")
4020 {
4021 TwistedboxRead(child);
4022 }
4023 else if(tag == "twistedtrap")
4024 {
4025 TwistedtrapRead(child);
4026 }
4027 else if(tag == "twistedtrd")
4028 {
4029 TwistedtrdRead(child);
4030 }
4031 else if(tag == "twistedtubs")
4032 {
4033 TwistedtubsRead(child);
4034 }
4035 else if(tag == "union")
4036 {
4037 BooleanRead(child, UNION);
4038 }
4039 else if(tag == "opticalsurface")
4040 {
4041 OpticalSurfaceRead(child);
4042 }
4043 else if(tag == "loop")
4044 {
4046 }
4047 else
4048 {
4049 G4String error_msg = "Unknown tag in solids: " + tag;
4050 G4Exception("G4GDMLReadSolids::SolidsRead()", "ReadError", FatalException,
4051 error_msg);
4052 }
4053 }
4054}
void ReflectedSolidRead(const xercesc::DOMElement *const)
void ParaboloidRead(const xercesc::DOMElement *const)
void XtruRead(const xercesc::DOMElement *const)
void SphereRead(const xercesc::DOMElement *const)
void TwistedtrapRead(const xercesc::DOMElement *const)
void TubeRead(const xercesc::DOMElement *const)
void GenTrapRead(const xercesc::DOMElement *const)
void HypeRead(const xercesc::DOMElement *const)
void TrdRead(const xercesc::DOMElement *const)
void ParaRead(const xercesc::DOMElement *const)
void TwistedtrdRead(const xercesc::DOMElement *const)
void PolyhedraRead(const xercesc::DOMElement *const)
void ConeRead(const xercesc::DOMElement *const)
void OpticalSurfaceRead(const xercesc::DOMElement *const)
void CutTubeRead(const xercesc::DOMElement *const)
void TetRead(const xercesc::DOMElement *const)
void GenericPolyhedraRead(const xercesc::DOMElement *const)
void MultiUnionRead(const xercesc::DOMElement *const)
void EllipsoidRead(const xercesc::DOMElement *const)
void ElconeRead(const xercesc::DOMElement *const)
void TessellatedRead(const xercesc::DOMElement *const)
void TwistedboxRead(const xercesc::DOMElement *const)
void GenericPolyconeRead(const xercesc::DOMElement *const)
void BoxRead(const xercesc::DOMElement *const)
void OrbRead(const xercesc::DOMElement *const)
void PolyconeRead(const xercesc::DOMElement *const)
void EltubeRead(const xercesc::DOMElement *const)
void TwistedtubsRead(const xercesc::DOMElement *const)
void TorusRead(const xercesc::DOMElement *const)
void ScaledSolidRead(const xercesc::DOMElement *const)
void BooleanRead(const xercesc::DOMElement *const, const BooleanOp)
void TrapRead(const xercesc::DOMElement *const)

References G4GDMLReadSolids::BooleanRead(), G4GDMLReadSolids::BoxRead(), G4GDMLReadSolids::ConeRead(), G4GDMLReadSolids::CutTubeRead(), G4GDMLReadDefine::DefineRead(), G4GDMLReadSolids::ElconeRead(), G4GDMLReadSolids::EllipsoidRead(), G4GDMLReadSolids::EltubeRead(), FatalException, G4cout, G4endl, G4Exception(), G4GDMLReadSolids::GenericPolyconeRead(), G4GDMLReadSolids::GenericPolyhedraRead(), G4GDMLReadSolids::GenTrapRead(), G4GDMLReadSolids::HypeRead(), G4GDMLReadSolids::INTERSECTION, G4GDMLRead::LoopRead(), G4GDMLReadSolids::MultiUnionRead(), G4GDMLReadSolids::OpticalSurfaceRead(), G4GDMLReadSolids::OrbRead(), G4GDMLReadSolids::ParaboloidRead(), G4GDMLReadSolids::ParaRead(), G4GDMLReadSolids::PolyconeRead(), G4GDMLReadSolids::PolyhedraRead(), G4GDMLReadSolids::ReflectedSolidRead(), G4GDMLReadSolids::ScaledSolidRead(), G4GDMLRead::SolidsRead(), G4GDMLReadSolids::SphereRead(), G4GDMLReadSolids::SUBTRACTION, G4GDMLReadSolids::TessellatedRead(), G4GDMLReadSolids::TetRead(), G4GDMLReadSolids::TorusRead(), G4GDMLRead::Transcode(), G4GDMLReadSolids::TrapRead(), G4GDMLReadSolids::TrdRead(), G4GDMLReadSolids::TubeRead(), G4GDMLReadSolids::TwistedboxRead(), G4GDMLReadSolids::TwistedtrapRead(), G4GDMLReadSolids::TwistedtrdRead(), G4GDMLReadSolids::TwistedtubsRead(), G4GDMLReadSolids::UNION, and G4GDMLReadSolids::XtruRead().

◆ Sphere_dimensionsRead()

void G4GDMLReadParamvol::Sphere_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 455 of file G4GDMLReadParamvol.cc.

458{
459 G4double lunit = 1.0;
460 G4double aunit = 1.0;
461
462 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
463 XMLSize_t attributeCount = attributes->getLength();
464
465 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
466 ++attribute_index)
467 {
468 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
469
470 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
471 {
472 continue;
473 }
474
475 const xercesc::DOMAttr* const attribute =
476 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
477 if(attribute == nullptr)
478 {
479 G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()", "InvalidRead",
480 FatalException, "No attribute found!");
481 return;
482 }
483 const G4String attName = Transcode(attribute->getName());
484 const G4String attValue = Transcode(attribute->getValue());
485
486 if(attName == "lunit")
487 {
488 lunit = G4UnitDefinition::GetValueOf(attValue);
489 if(G4UnitDefinition::GetCategory(attValue) != "Length")
490 {
491 G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()",
492 "InvalidRead", FatalException, "Invalid unit for length!");
493 }
494 }
495 else if(attName == "aunit")
496 {
497 aunit = G4UnitDefinition::GetValueOf(attValue);
498 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
499 {
500 G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()",
501 "InvalidRead", FatalException, "Invalid unit for angle!");
502 }
503 }
504 else if(attName == "rmin")
505 {
506 parameter.dimension[0] = eval.Evaluate(attValue);
507 }
508 else if(attName == "rmax")
509 {
510 parameter.dimension[1] = eval.Evaluate(attValue);
511 }
512 else if(attName == "startphi")
513 {
514 parameter.dimension[2] = eval.Evaluate(attValue);
515 }
516 else if(attName == "deltaphi")
517 {
518 parameter.dimension[3] = eval.Evaluate(attValue);
519 }
520 else if(attName == "starttheta")
521 {
522 parameter.dimension[4] = eval.Evaluate(attValue);
523 }
524 else if(attName == "deltatheta")
525 {
526 parameter.dimension[5] = eval.Evaluate(attValue);
527 }
528 }
529
530 parameter.dimension[0] *= lunit;
531 parameter.dimension[1] *= lunit;
532 parameter.dimension[2] *= aunit;
533 parameter.dimension[3] *= aunit;
534 parameter.dimension[4] *= aunit;
535 parameter.dimension[5] *= aunit;
536}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ SphereRead()

void G4GDMLReadSolids::SphereRead ( const xercesc::DOMElement * const  sphereElement)
protectedinherited

Definition at line 1958 of file G4GDMLReadSolids.cc.

1960{
1961 G4String name;
1962 G4double lunit = 1.0;
1963 G4double aunit = 1.0;
1964 G4double rmin = 0.0;
1965 G4double rmax = 0.0;
1966 G4double startphi = 0.0;
1967 G4double deltaphi = 0.0;
1968 G4double starttheta = 0.0;
1969 G4double deltatheta = 0.0;
1970
1971 const xercesc::DOMNamedNodeMap* const attributes =
1972 sphereElement->getAttributes();
1973 XMLSize_t attributeCount = attributes->getLength();
1974
1975 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1976 ++attribute_index)
1977 {
1978 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1979
1980 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1981 {
1982 continue;
1983 }
1984
1985 const xercesc::DOMAttr* const attribute =
1986 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1987 if(attribute == nullptr)
1988 {
1989 G4Exception("G4GDMLReadSolids::SphereRead()", "InvalidRead",
1990 FatalException, "No attribute found!");
1991 return;
1992 }
1993 const G4String attName = Transcode(attribute->getName());
1994 const G4String attValue = Transcode(attribute->getValue());
1995
1996 if(attName == "name")
1997 {
1998 name = GenerateName(attValue);
1999 }
2000 else if(attName == "lunit")
2001 {
2002 lunit = G4UnitDefinition::GetValueOf(attValue);
2003 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2004 {
2005 G4Exception("G4GDMLReadSolids::SphereRead()", "InvalidRead",
2006 FatalException, "Invalid unit for length!");
2007 }
2008 }
2009 else if(attName == "aunit")
2010 {
2011 aunit = G4UnitDefinition::GetValueOf(attValue);
2012 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
2013 {
2014 G4Exception("G4GDMLReadSolids::SphereRead()", "InvalidRead",
2015 FatalException, "Invalid unit for angle!");
2016 }
2017 }
2018 else if(attName == "rmin")
2019 {
2020 rmin = eval.Evaluate(attValue);
2021 }
2022 else if(attName == "rmax")
2023 {
2024 rmax = eval.Evaluate(attValue);
2025 }
2026 else if(attName == "startphi")
2027 {
2028 startphi = eval.Evaluate(attValue);
2029 }
2030 else if(attName == "deltaphi")
2031 {
2032 deltaphi = eval.Evaluate(attValue);
2033 }
2034 else if(attName == "starttheta")
2035 {
2036 starttheta = eval.Evaluate(attValue);
2037 }
2038 else if(attName == "deltatheta")
2039 {
2040 deltatheta = eval.Evaluate(attValue);
2041 }
2042 }
2043
2044 rmin *= lunit;
2045 rmax *= lunit;
2046 startphi *= aunit;
2047 deltaphi *= aunit;
2048 starttheta *= aunit;
2049 deltatheta *= aunit;
2050
2051 new G4Sphere(name, rmin, rmax, startphi, deltaphi, starttheta, deltatheta);
2052}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ Strip()

G4String G4GDMLRead::Strip ( const G4String name) const
protectedinherited

◆ StripName()

void G4GDMLRead::StripName ( G4String name) const
inherited

Definition at line 112 of file G4GDMLRead.cc.

113{
114 auto idx = name.find("0x");
115 if(idx != G4String::npos)
116 {
117 name.erase(idx);
118 }
119}

References G4InuclParticleNames::name().

Referenced by G4GDMLParser::ExportRegions(), G4GDMLRead::GenerateName(), G4GDMLParser::ImportRegions(), G4GDMLRead::Strip(), and G4GDMLRead::StripNames().

◆ StripNames()

void G4GDMLRead::StripNames ( ) const
inherited

Definition at line 122 of file G4GDMLRead.cc.

123{
124 // Strips off names of volumes, solids elements and materials from possible
125 // reference pointers or IDs attached to their original identifiers.
126
130 const G4ElementTable* elements = G4Element::GetElementTable();
132
133 G4cout << "Stripping off GDML names of materials, solids and volumes ..."
134 << G4endl;
135
136 G4String sname;
137 std::size_t i;
138
139 // Solids...
140 //
141 for(i = 0; i < solids->size(); ++i)
142 {
143 G4VSolid* psol = (*solids)[i];
144 sname = psol->GetName();
145 StripName(sname);
146 psol->SetName(sname);
147 }
148 solids->UpdateMap();
149
150 // Logical volumes...
151 //
152 for(i = 0; i < lvols->size(); ++i)
153 {
154 G4LogicalVolume* lvol = (*lvols)[i];
155 sname = lvol->GetName();
156 StripName(sname);
157 lvol->SetName(sname);
158 }
159 lvols->UpdateMap();
160
161 // Physical volumes...
162 //
163 for(i = 0; i < pvols->size(); ++i)
164 {
165 G4VPhysicalVolume* pvol = (*pvols)[i];
166 sname = pvol->GetName();
167 StripName(sname);
168 pvol->SetName(sname);
169 }
170 pvols->UpdateMap();
171
172 // Materials...
173 //
174 for(i = 0; i < materials->size(); ++i)
175 {
176 G4Material* pmat = (*materials)[i];
177 sname = pmat->GetName();
178 StripName(sname);
179 pmat->SetName(sname);
180 }
181
182 // Elements...
183 //
184 for(i = 0; i < elements->size(); ++i)
185 {
186 G4Element* pelm = (*elements)[i];
187 sname = pelm->GetName();
188 StripName(sname);
189 pelm->SetName(sname);
190 }
191}
std::vector< G4Element * > G4ElementTable
std::vector< G4Material * > G4MaterialTable
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:397
void SetName(const G4String &name)
Definition: G4Element.hh:215
const G4String & GetName() const
Definition: G4Element.hh:127
static G4LogicalVolumeStore * GetInstance()
void SetName(const G4String &pName)
void SetName(const G4String &name)
Definition: G4Material.hh:285
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:672
const G4String & GetName() const
Definition: G4Material.hh:173
static G4PhysicalVolumeStore * GetInstance()
void UpdateMap()
const G4String & GetName() const
G4String GetName() const
void SetName(const G4String &name)
Definition: G4VSolid.cc:127

References G4cout, G4endl, G4Element::GetElementTable(), G4LogicalVolumeStore::GetInstance(), G4PhysicalVolumeStore::GetInstance(), G4SolidStore::GetInstance(), G4Material::GetMaterialTable(), G4LogicalVolume::GetName(), G4VPhysicalVolume::GetName(), G4VSolid::GetName(), G4Element::GetName(), G4Material::GetName(), G4VSolid::SetName(), G4Element::SetName(), G4Material::SetName(), G4LogicalVolume::SetName(), G4VPhysicalVolume::SetName(), G4GDMLRead::StripName(), G4LogicalVolumeStore::UpdateMap(), G4PhysicalVolumeStore::UpdateMap(), and G4SolidStore::UpdateMap().

Referenced by G4GDMLRead::Read().

◆ StructureRead()

virtual void G4GDMLRead::StructureRead ( const xercesc::DOMElement * const  )
pure virtualinherited

◆ TessellatedRead()

void G4GDMLReadSolids::TessellatedRead ( const xercesc::DOMElement * const  tessellatedElement)
protectedinherited

Definition at line 2055 of file G4GDMLReadSolids.cc.

2057{
2058 G4String name;
2059
2060 const xercesc::DOMNamedNodeMap* const attributes =
2061 tessellatedElement->getAttributes();
2062 XMLSize_t attributeCount = attributes->getLength();
2063
2064 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2065 ++attribute_index)
2066 {
2067 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2068
2069 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2070 {
2071 continue;
2072 }
2073
2074 const xercesc::DOMAttr* const attribute =
2075 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2076 if(attribute == nullptr)
2077 {
2078 G4Exception("G4GDMLReadSolids::TessellatedRead()", "InvalidRead",
2079 FatalException, "No attribute found!");
2080 return;
2081 }
2082 const G4String attName = Transcode(attribute->getName());
2083 const G4String attValue = Transcode(attribute->getValue());
2084
2085 if(attName == "name")
2086 {
2087 name = GenerateName(attValue);
2088 }
2089 }
2090
2091 G4TessellatedSolid* tessellated = new G4TessellatedSolid(name);
2092
2093 for(xercesc::DOMNode* iter = tessellatedElement->getFirstChild();
2094 iter != nullptr; iter = iter->getNextSibling())
2095 {
2096 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
2097 {
2098 continue;
2099 }
2100
2101 const xercesc::DOMElement* const child =
2102 dynamic_cast<xercesc::DOMElement*>(iter);
2103 if(child == nullptr)
2104 {
2105 G4Exception("G4GDMLReadSolids::TessellatedRead()", "InvalidRead",
2106 FatalException, "No child found!");
2107 return;
2108 }
2109 const G4String tag = Transcode(child->getTagName());
2110
2111 if(tag == "triangular")
2112 {
2113 tessellated->AddFacet(TriangularRead(child));
2114 }
2115 else if(tag == "quadrangular")
2116 {
2117 tessellated->AddFacet(QuadrangularRead(child));
2118 }
2119 }
2120
2121 tessellated->SetSolidClosed(true);
2122}
G4QuadrangularFacet * QuadrangularRead(const xercesc::DOMElement *const)
G4TriangularFacet * TriangularRead(const xercesc::DOMElement *const)
G4bool AddFacet(G4VFacet *aFacet)
void SetSolidClosed(const G4bool t)

References G4TessellatedSolid::AddFacet(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4InuclParticleNames::name(), G4GDMLReadSolids::QuadrangularRead(), G4TessellatedSolid::SetSolidClosed(), G4GDMLRead::Transcode(), and G4GDMLReadSolids::TriangularRead().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ TetRead()

void G4GDMLReadSolids::TetRead ( const xercesc::DOMElement * const  tetElement)
protectedinherited

Definition at line 2125 of file G4GDMLReadSolids.cc.

2126{
2127 G4String name;
2128 G4ThreeVector vertex1;
2129 G4ThreeVector vertex2;
2130 G4ThreeVector vertex3;
2131 G4ThreeVector vertex4;
2132 G4double lunit = 1.0;
2133
2134 const xercesc::DOMNamedNodeMap* const attributes =
2135 tetElement->getAttributes();
2136 XMLSize_t attributeCount = attributes->getLength();
2137
2138 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2139 ++attribute_index)
2140 {
2141 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2142
2143 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2144 {
2145 continue;
2146 }
2147
2148 const xercesc::DOMAttr* const attribute =
2149 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2150 if(attribute == nullptr)
2151 {
2152 G4Exception("G4GDMLReadSolids::TetRead()", "InvalidRead", FatalException,
2153 "No attribute found!");
2154 return;
2155 }
2156 const G4String attName = Transcode(attribute->getName());
2157 const G4String attValue = Transcode(attribute->getValue());
2158
2159 if(attName == "name")
2160 {
2161 name = GenerateName(attValue);
2162 }
2163 else if(attName == "lunit")
2164 {
2165 lunit = G4UnitDefinition::GetValueOf(attValue);
2166 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2167 {
2168 G4Exception("G4GDMLReadSolids::TetRead()", "InvalidRead",
2169 FatalException, "Invalid unit for length!");
2170 }
2171 }
2172 else if(attName == "vertex1")
2173 {
2174 vertex1 = GetPosition(GenerateName(attValue));
2175 }
2176 else if(attName == "vertex2")
2177 {
2178 vertex2 = GetPosition(GenerateName(attValue));
2179 }
2180 else if(attName == "vertex3")
2181 {
2182 vertex3 = GetPosition(GenerateName(attValue));
2183 }
2184 else if(attName == "vertex4")
2185 {
2186 vertex4 = GetPosition(GenerateName(attValue));
2187 }
2188 }
2189
2190 new G4Tet(name, vertex1 * lunit, vertex2 * lunit, vertex3 * lunit,
2191 vertex4 * lunit);
2192}
Definition: G4Tet.hh:56

References FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4GDMLReadDefine::GetPosition(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ Torus_dimensionsRead()

void G4GDMLReadParamvol::Torus_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 588 of file G4GDMLReadParamvol.cc.

591{
592 G4double lunit = 1.0;
593 G4double aunit = 1.0;
594
595 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
596 XMLSize_t attributeCount = attributes->getLength();
597
598 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
599 ++attribute_index)
600 {
601 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
602
603 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
604 {
605 continue;
606 }
607
608 const xercesc::DOMAttr* const attribute =
609 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
610 if(attribute == nullptr)
611 {
612 G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", "InvalidRead",
613 FatalException, "No attribute found!");
614 return;
615 }
616 const G4String attName = Transcode(attribute->getName());
617 const G4String attValue = Transcode(attribute->getValue());
618
619 if(attName == "lunit")
620 {
621 lunit = G4UnitDefinition::GetValueOf(attValue);
622 if(G4UnitDefinition::GetCategory(attValue) != "Length")
623 {
624 G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", "InvalidRead",
625 FatalException, "Invalid unit for length!");
626 }
627 }
628 else if(attName == "aunit")
629 {
630 aunit = G4UnitDefinition::GetValueOf(attValue);
631 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
632 {
633 G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", "InvalidRead",
634 FatalException, "Invalid unit for angle!");
635 }
636 }
637 else if(attName == "rmin")
638 {
639 parameter.dimension[0] = eval.Evaluate(attValue);
640 }
641 else if(attName == "rmax")
642 {
643 parameter.dimension[1] = eval.Evaluate(attValue);
644 }
645 else if(attName == "rtor")
646 {
647 parameter.dimension[2] = eval.Evaluate(attValue);
648 }
649 else if(attName == "startphi")
650 {
651 parameter.dimension[3] = eval.Evaluate(attValue);
652 }
653 else if(attName == "deltaphi")
654 {
655 parameter.dimension[4] = eval.Evaluate(attValue);
656 }
657 }
658
659 parameter.dimension[0] *= lunit;
660 parameter.dimension[1] *= lunit;
661 parameter.dimension[2] *= lunit;
662 parameter.dimension[3] *= aunit;
663 parameter.dimension[4] *= aunit;
664}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ TorusRead()

void G4GDMLReadSolids::TorusRead ( const xercesc::DOMElement * const  torusElement)
protectedinherited

Definition at line 2195 of file G4GDMLReadSolids.cc.

2196{
2197 G4String name;
2198 G4double lunit = 1.0;
2199 G4double aunit = 1.0;
2200 G4double rmin = 0.0;
2201 G4double rmax = 0.0;
2202 G4double rtor = 0.0;
2203 G4double startphi = 0.0;
2204 G4double deltaphi = 0.0;
2205
2206 const xercesc::DOMNamedNodeMap* const attributes =
2207 torusElement->getAttributes();
2208 XMLSize_t attributeCount = attributes->getLength();
2209
2210 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2211 ++attribute_index)
2212 {
2213 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2214
2215 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2216 {
2217 continue;
2218 }
2219
2220 const xercesc::DOMAttr* const attribute =
2221 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2222 if(attribute == nullptr)
2223 {
2224 G4Exception("G4GDMLReadSolids::TorusRead()", "InvalidRead",
2225 FatalException, "No attribute found!");
2226 return;
2227 }
2228 const G4String attName = Transcode(attribute->getName());
2229 const G4String attValue = Transcode(attribute->getValue());
2230
2231 if(attName == "name")
2232 {
2233 name = GenerateName(attValue);
2234 }
2235 else if(attName == "lunit")
2236 {
2237 lunit = G4UnitDefinition::GetValueOf(attValue);
2238 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2239 {
2240 G4Exception("G4GDMLReadSolids::TorusRead()", "InvalidRead",
2241 FatalException, "Invalid unit for length!");
2242 }
2243 }
2244 else if(attName == "aunit")
2245 {
2246 aunit = G4UnitDefinition::GetValueOf(attValue);
2247 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
2248 {
2249 G4Exception("G4GDMLReadSolids::TorusRead()", "InvalidRead",
2250 FatalException, "Invalid unit for angle!");
2251 }
2252 }
2253 else if(attName == "rmin")
2254 {
2255 rmin = eval.Evaluate(attValue);
2256 }
2257 else if(attName == "rmax")
2258 {
2259 rmax = eval.Evaluate(attValue);
2260 }
2261 else if(attName == "rtor")
2262 {
2263 rtor = eval.Evaluate(attValue);
2264 }
2265 else if(attName == "startphi")
2266 {
2267 startphi = eval.Evaluate(attValue);
2268 }
2269 else if(attName == "deltaphi")
2270 {
2271 deltaphi = eval.Evaluate(attValue);
2272 }
2273 }
2274
2275 rmin *= lunit;
2276 rmax *= lunit;
2277 rtor *= lunit;
2278 startphi *= aunit;
2279 deltaphi *= aunit;
2280
2281 new G4Torus(name, rmin, rmax, rtor, startphi, deltaphi);
2282}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ Transcode()

G4String G4GDMLRead::Transcode ( const XMLCh * const  toTranscode)
protectedinherited

Definition at line 55 of file G4GDMLRead.cc.

56{
57 char* char_str = xercesc::XMLString::transcode(toTranscode);
58 G4String my_str(char_str);
59 xercesc::XMLString::release(&char_str);
60 return my_str;
61}

Referenced by G4GDMLReadStructure::AssemblyRead(), G4GDMLReadMaterials::AtomRead(), G4GDMLRead::AuxiliaryRead(), G4GDMLReadStructure::AxisRead(), G4GDMLReadSolids::BooleanRead(), G4GDMLReadStructure::BorderSurfaceRead(), Box_dimensionsRead(), G4GDMLReadSolids::BoxRead(), G4GDMLReadMaterials::CompositeRead(), Cone_dimensionsRead(), G4GDMLReadSolids::ConeRead(), G4GDMLReadDefine::ConstantRead(), G4GDMLReadSolids::CutTubeRead(), G4GDMLReadDefine::DefineRead(), G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadMaterials::DRead(), G4GDMLReadSolids::ElconeRead(), G4GDMLReadMaterials::ElementRead(), Ellipsoid_dimensionsRead(), G4GDMLReadSolids::EllipsoidRead(), G4GDMLReadSolids::EltubeRead(), G4GDMLReadDefine::ExpressionRead(), G4GDMLReadStructure::FileRead(), G4GDMLReadMaterials::FractionRead(), G4GDMLReadSolids::GenericPolyconeRead(), G4GDMLReadSolids::GenericPolyhedraRead(), G4GDMLReadSolids::GenTrapRead(), Hype_dimensionsRead(), G4GDMLReadSolids::HypeRead(), G4GDMLReadMaterials::IsotopeRead(), G4GDMLRead::LoopRead(), G4GDMLReadMaterials::MaterialRead(), G4GDMLReadMaterials::MaterialsRead(), G4GDMLReadDefine::MatrixRead(), G4GDMLReadMaterials::MEERead(), G4GDMLReadMaterials::MixtureRead(), G4GDMLReadSolids::MultiUnionNodeRead(), G4GDMLReadSolids::MultiUnionRead(), G4GDMLReadSolids::OpticalSurfaceRead(), Orb_dimensionsRead(), G4GDMLReadSolids::OrbRead(), Para_dimensionsRead(), G4GDMLReadSolids::ParaboloidRead(), ParameterisedRead(), ParametersRead(), Paramvol_contentRead(), ParamvolRead(), G4GDMLReadSolids::ParaRead(), G4GDMLReadStructure::PhysvolRead(), Polycone_dimensionsRead(), G4GDMLReadSolids::PolyconeRead(), Polyhedra_dimensionsRead(), G4GDMLReadSolids::PolyhedraRead(), G4GDMLReadDefine::PositionRead(), G4GDMLReadMaterials::PRead(), G4GDMLReadMaterials::PropertyRead(), G4GDMLReadSolids::PropertyRead(), G4GDMLReadSolids::QuadrangularRead(), G4GDMLReadStructure::QuantityRead(), G4GDMLReadDefine::QuantityRead(), G4GDMLRead::Read(), G4GDMLReadSolids::ReflectedSolidRead(), G4GDMLReadDefine::RefRead(), G4GDMLReadStructure::ReplicaRead(), G4GDMLReadStructure::ReplicavolRead(), G4GDMLReadDefine::RotationRead(), G4GDMLReadSolids::RZPointRead(), G4GDMLReadSolids::ScaledSolidRead(), G4GDMLReadDefine::ScaleRead(), G4GDMLReadSolids::SectionRead(), G4GDMLReadSetup::SetupRead(), G4GDMLReadStructure::SkinSurfaceRead(), G4GDMLReadSolids::SolidsRead(), Sphere_dimensionsRead(), G4GDMLReadSolids::SphereRead(), G4GDMLReadStructure::StructureRead(), G4GDMLReadSolids::TessellatedRead(), G4GDMLReadSolids::TetRead(), Torus_dimensionsRead(), G4GDMLReadSolids::TorusRead(), Trap_dimensionsRead(), G4GDMLReadSolids::TrapRead(), Trd_dimensionsRead(), G4GDMLReadSolids::TrdRead(), G4GDMLReadMaterials::TRead(), G4GDMLReadSolids::TriangularRead(), Tube_dimensionsRead(), G4GDMLReadSolids::TubeRead(), G4GDMLReadSolids::TwistedboxRead(), G4GDMLReadSolids::TwistedtrapRead(), G4GDMLReadSolids::TwistedtrdRead(), G4GDMLReadSolids::TwistedtubsRead(), G4GDMLReadSolids::TwoDimVertexRead(), G4GDMLRead::UserinfoRead(), G4GDMLReadDefine::VariableRead(), G4GDMLReadDefine::VectorRead(), G4GDMLReadStructure::Volume_contentRead(), G4GDMLReadStructure::VolumeRead(), G4GDMLReadSolids::XtruRead(), and G4GDMLReadSolids::ZplaneRead().

◆ Trap_dimensionsRead()

void G4GDMLReadParamvol::Trap_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 178 of file G4GDMLReadParamvol.cc.

181{
182 G4double lunit = 1.0;
183 G4double aunit = 1.0;
184
185 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
186 XMLSize_t attributeCount = attributes->getLength();
187
188 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
189 ++attribute_index)
190 {
191 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
192
193 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
194 {
195 continue;
196 }
197
198 const xercesc::DOMAttr* const attribute =
199 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
200 if(attribute == nullptr)
201 {
202 G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", "InvalidRead",
203 FatalException, "No attribute found!");
204 return;
205 }
206 const G4String attName = Transcode(attribute->getName());
207 const G4String attValue = Transcode(attribute->getValue());
208
209 if(attName == "lunit")
210 {
211 lunit = G4UnitDefinition::GetValueOf(attValue);
212 if(G4UnitDefinition::GetCategory(attValue) != "Length")
213 {
214 G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", "InvalidRead",
215 FatalException, "Invalid unit for length!");
216 }
217 }
218 else if(attName == "aunit")
219 {
220 aunit = G4UnitDefinition::GetValueOf(attValue);
221 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
222 {
223 G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", "InvalidRead",
224 FatalException, "Invalid unit for angle!");
225 }
226 }
227 else if(attName == "z")
228 {
229 parameter.dimension[0] = eval.Evaluate(attValue);
230 }
231 else if(attName == "theta")
232 {
233 parameter.dimension[1] = eval.Evaluate(attValue);
234 }
235 else if(attName == "phi")
236 {
237 parameter.dimension[2] = eval.Evaluate(attValue);
238 }
239 else if(attName == "y1")
240 {
241 parameter.dimension[3] = eval.Evaluate(attValue);
242 }
243 else if(attName == "x1")
244 {
245 parameter.dimension[4] = eval.Evaluate(attValue);
246 }
247 else if(attName == "x2")
248 {
249 parameter.dimension[5] = eval.Evaluate(attValue);
250 }
251 else if(attName == "alpha1")
252 {
253 parameter.dimension[6] = eval.Evaluate(attValue);
254 }
255 else if(attName == "y2")
256 {
257 parameter.dimension[7] = eval.Evaluate(attValue);
258 }
259 else if(attName == "x3")
260 {
261 parameter.dimension[8] = eval.Evaluate(attValue);
262 }
263 else if(attName == "x4")
264 {
265 parameter.dimension[9] = eval.Evaluate(attValue);
266 }
267 else if(attName == "alpha2")
268 {
269 parameter.dimension[10] = eval.Evaluate(attValue);
270 }
271 }
272
273 parameter.dimension[0] *= 0.5 * lunit;
274 parameter.dimension[1] *= aunit;
275 parameter.dimension[2] *= aunit;
276 parameter.dimension[3] *= 0.5 * lunit;
277 parameter.dimension[4] *= 0.5 * lunit;
278 parameter.dimension[5] *= 0.5 * lunit;
279 parameter.dimension[6] *= aunit;
280 parameter.dimension[7] *= 0.5 * lunit;
281 parameter.dimension[8] *= 0.5 * lunit;
282 parameter.dimension[9] *= 0.5 * lunit;
283 parameter.dimension[10] *= aunit;
284}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ TrapRead()

void G4GDMLReadSolids::TrapRead ( const xercesc::DOMElement * const  trapElement)
protectedinherited

Definition at line 2417 of file G4GDMLReadSolids.cc.

2418{
2419 G4String name;
2420 G4double lunit = 1.0;
2421 G4double aunit = 1.0;
2422 G4double z = 0.0;
2423 G4double theta = 0.0;
2424 G4double phi = 0.0;
2425 G4double y1 = 0.0;
2426 G4double x1 = 0.0;
2427 G4double x2 = 0.0;
2428 G4double alpha1 = 0.0;
2429 G4double y2 = 0.0;
2430 G4double x3 = 0.0;
2431 G4double x4 = 0.0;
2432 G4double alpha2 = 0.0;
2433
2434 const xercesc::DOMNamedNodeMap* const attributes =
2435 trapElement->getAttributes();
2436 XMLSize_t attributeCount = attributes->getLength();
2437
2438 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2439 ++attribute_index)
2440 {
2441 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2442
2443 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2444 {
2445 continue;
2446 }
2447
2448 const xercesc::DOMAttr* const attribute =
2449 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2450 if(attribute == nullptr)
2451 {
2452 G4Exception("G4GDMLReadSolids::TrapRead()", "InvalidRead", FatalException,
2453 "No attribute found!");
2454 return;
2455 }
2456 const G4String attName = Transcode(attribute->getName());
2457 const G4String attValue = Transcode(attribute->getValue());
2458
2459 if(attName == "name")
2460 {
2461 name = GenerateName(attValue);
2462 }
2463 else if(attName == "lunit")
2464 {
2465 lunit = G4UnitDefinition::GetValueOf(attValue);
2466 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2467 {
2468 G4Exception("G4GDMLReadSolids::TrapRead()", "InvalidRead",
2469 FatalException, "Invalid unit for length!");
2470 }
2471 }
2472 else if(attName == "aunit")
2473 {
2474 aunit = G4UnitDefinition::GetValueOf(attValue);
2475 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
2476 {
2477 G4Exception("G4GDMLReadSolids::TrapRead()", "InvalidRead",
2478 FatalException, "Invalid unit for angle!");
2479 }
2480 }
2481 else if(attName == "z")
2482 {
2483 z = eval.Evaluate(attValue);
2484 }
2485 else if(attName == "theta")
2486 {
2487 theta = eval.Evaluate(attValue);
2488 }
2489 else if(attName == "phi")
2490 {
2491 phi = eval.Evaluate(attValue);
2492 }
2493 else if(attName == "y1")
2494 {
2495 y1 = eval.Evaluate(attValue);
2496 }
2497 else if(attName == "x1")
2498 {
2499 x1 = eval.Evaluate(attValue);
2500 }
2501 else if(attName == "x2")
2502 {
2503 x2 = eval.Evaluate(attValue);
2504 }
2505 else if(attName == "alpha1")
2506 {
2507 alpha1 = eval.Evaluate(attValue);
2508 }
2509 else if(attName == "y2")
2510 {
2511 y2 = eval.Evaluate(attValue);
2512 }
2513 else if(attName == "x3")
2514 {
2515 x3 = eval.Evaluate(attValue);
2516 }
2517 else if(attName == "x4")
2518 {
2519 x4 = eval.Evaluate(attValue);
2520 }
2521 else if(attName == "alpha2")
2522 {
2523 alpha2 = eval.Evaluate(attValue);
2524 }
2525 }
2526
2527 z *= 0.5 * lunit;
2528 theta *= aunit;
2529 phi *= aunit;
2530 y1 *= 0.5 * lunit;
2531 x1 *= 0.5 * lunit;
2532 x2 *= 0.5 * lunit;
2533 alpha1 *= aunit;
2534 y2 *= 0.5 * lunit;
2535 x3 *= 0.5 * lunit;
2536 x4 *= 0.5 * lunit;
2537 alpha2 *= aunit;
2538
2539 new G4Trap(name, z, theta, phi, y1, x1, x2, alpha1, y2, x3, x4, alpha2);
2540}
const G4double alpha2

References alpha2, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ Trd_dimensionsRead()

void G4GDMLReadParamvol::Trd_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 109 of file G4GDMLReadParamvol.cc.

112{
113 G4double lunit = 1.0;
114
115 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
116 XMLSize_t attributeCount = attributes->getLength();
117
118 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
119 ++attribute_index)
120 {
121 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
122
123 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
124 {
125 continue;
126 }
127
128 const xercesc::DOMAttr* const attribute =
129 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
130 if(attribute == nullptr)
131 {
132 G4Exception("G4GDMLReadParamvol::Trd_dimensionsRead()", "InvalidRead",
133 FatalException, "No attribute found!");
134 return;
135 }
136 const G4String attName = Transcode(attribute->getName());
137 const G4String attValue = Transcode(attribute->getValue());
138
139 if(attName == "lunit")
140 {
141 lunit = G4UnitDefinition::GetValueOf(attValue);
142 if(G4UnitDefinition::GetCategory(attValue) != "Length")
143 {
144 G4Exception("G4GDMLReadParamvol::Trd_dimensionsRead()", "InvalidRead",
145 FatalException, "Invalid unit for length!");
146 }
147 }
148 else if(attName == "x1")
149 {
150 parameter.dimension[0] = eval.Evaluate(attValue);
151 }
152 else if(attName == "x2")
153 {
154 parameter.dimension[1] = eval.Evaluate(attValue);
155 }
156 else if(attName == "y1")
157 {
158 parameter.dimension[2] = eval.Evaluate(attValue);
159 }
160 else if(attName == "y2")
161 {
162 parameter.dimension[3] = eval.Evaluate(attValue);
163 }
164 else if(attName == "z")
165 {
166 parameter.dimension[4] = eval.Evaluate(attValue);
167 }
168 }
169
170 parameter.dimension[0] *= 0.5 * lunit;
171 parameter.dimension[1] *= 0.5 * lunit;
172 parameter.dimension[2] *= 0.5 * lunit;
173 parameter.dimension[3] *= 0.5 * lunit;
174 parameter.dimension[4] *= 0.5 * lunit;
175}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ TrdRead()

void G4GDMLReadSolids::TrdRead ( const xercesc::DOMElement * const  trdElement)
protectedinherited

Definition at line 2543 of file G4GDMLReadSolids.cc.

2544{
2545 G4String name;
2546 G4double lunit = 1.0;
2547 G4double x1 = 0.0;
2548 G4double x2 = 0.0;
2549 G4double y1 = 0.0;
2550 G4double y2 = 0.0;
2551 G4double z = 0.0;
2552
2553 const xercesc::DOMNamedNodeMap* const attributes =
2554 trdElement->getAttributes();
2555 XMLSize_t attributeCount = attributes->getLength();
2556
2557 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2558 ++attribute_index)
2559 {
2560 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2561
2562 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2563 {
2564 continue;
2565 }
2566
2567 const xercesc::DOMAttr* const attribute =
2568 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2569 if(attribute == nullptr)
2570 {
2571 G4Exception("G4GDMLReadSolids::TrdRead()", "InvalidRead", FatalException,
2572 "No attribute found!");
2573 return;
2574 }
2575 const G4String attName = Transcode(attribute->getName());
2576 const G4String attValue = Transcode(attribute->getValue());
2577
2578 if(attName == "name")
2579 {
2580 name = GenerateName(attValue);
2581 }
2582 else if(attName == "lunit")
2583 {
2584 lunit = G4UnitDefinition::GetValueOf(attValue);
2585 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2586 {
2587 G4Exception("G4GDMLReadSolids::TrdRead()", "InvalidRead",
2588 FatalException, "Invalid unit for length!");
2589 }
2590 }
2591 else if(attName == "x1")
2592 {
2593 x1 = eval.Evaluate(attValue);
2594 }
2595 else if(attName == "x2")
2596 {
2597 x2 = eval.Evaluate(attValue);
2598 }
2599 else if(attName == "y1")
2600 {
2601 y1 = eval.Evaluate(attValue);
2602 }
2603 else if(attName == "y2")
2604 {
2605 y2 = eval.Evaluate(attValue);
2606 }
2607 else if(attName == "z")
2608 {
2609 z = eval.Evaluate(attValue);
2610 }
2611 }
2612
2613 x1 *= 0.5 * lunit;
2614 x2 *= 0.5 * lunit;
2615 y1 *= 0.5 * lunit;
2616 y2 *= 0.5 * lunit;
2617 z *= 0.5 * lunit;
2618
2619 new G4Trd(name, x1, x2, y1, y2, z);
2620}
Definition: G4Trd.hh:63

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ TRead()

G4double G4GDMLReadMaterials::TRead ( const xercesc::DOMElement * const  TElement)
protectedinherited

Definition at line 243 of file G4GDMLReadMaterials.cc.

244{
246 G4double unit = kelvin;
247
248 const xercesc::DOMNamedNodeMap* const attributes = TElement->getAttributes();
249 XMLSize_t attributeCount = attributes->getLength();
250
251 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
252 ++attribute_index)
253 {
254 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
255
256 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
257 {
258 continue;
259 }
260
261 const xercesc::DOMAttr* const attribute =
262 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
263 if(attribute == nullptr)
264 {
265 G4Exception("G4GDMLReadMaterials::TRead()", "InvalidRead", FatalException,
266 "No attribute found!");
267 return value;
268 }
269 const G4String attName = Transcode(attribute->getName());
270 const G4String attValue = Transcode(attribute->getValue());
271
272 if(attName == "value")
273 {
274 value = eval.Evaluate(attValue);
275 }
276 else if(attName == "unit")
277 {
278 unit = G4UnitDefinition::GetValueOf(attValue);
279 if(G4UnitDefinition::GetCategory(attValue) != "Temperature")
280 {
281 G4Exception("G4GDMLReadMaterials::TRead()", "InvalidRead",
282 FatalException, "Invalid unit for temperature!");
283 }
284 }
285 }
286
287 return value * unit;
288}
static constexpr double kelvin
Definition: G4SIunits.hh:274

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), kelvin, NTP_Temperature, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadMaterials::MaterialRead().

◆ TriangularRead()

G4TriangularFacet * G4GDMLReadSolids::TriangularRead ( const xercesc::DOMElement * const  triangularElement)
protectedinherited

Definition at line 2623 of file G4GDMLReadSolids.cc.

2625{
2626 G4ThreeVector vertex1;
2627 G4ThreeVector vertex2;
2628 G4ThreeVector vertex3;
2630 G4double lunit = 1.0;
2631
2632 const xercesc::DOMNamedNodeMap* const attributes =
2633 triangularElement->getAttributes();
2634 XMLSize_t attributeCount = attributes->getLength();
2635
2636 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2637 ++attribute_index)
2638 {
2639 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2640
2641 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2642 {
2643 continue;
2644 }
2645
2646 const xercesc::DOMAttr* const attribute =
2647 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2648 if(attribute == nullptr)
2649 {
2650 G4Exception("G4GDMLReadSolids::TriangularRead()", "InvalidRead",
2651 FatalException, "No attribute found!");
2652 return nullptr;
2653 }
2654 const G4String attName = Transcode(attribute->getName());
2655 const G4String attValue = Transcode(attribute->getValue());
2656
2657 if(attName == "vertex1")
2658 {
2659 vertex1 = GetPosition(GenerateName(attValue));
2660 }
2661 else if(attName == "vertex2")
2662 {
2663 vertex2 = GetPosition(GenerateName(attValue));
2664 }
2665 else if(attName == "vertex3")
2666 {
2667 vertex3 = GetPosition(GenerateName(attValue));
2668 }
2669 else if(attName == "lunit")
2670 {
2671 lunit = G4UnitDefinition::GetValueOf(attValue);
2672 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2673 {
2674 G4Exception("G4GDMLReadSolids::TriangularRead()", "InvalidRead",
2675 FatalException, "Invalid unit for length!");
2676 }
2677 }
2678 else if(attName == "type")
2679 {
2680 if(attValue == "RELATIVE")
2681 {
2682 type = RELATIVE;
2683 }
2684 }
2685 }
2686
2687 return new G4TriangularFacet(vertex1 * lunit, vertex2 * lunit,
2688 vertex3 * lunit, type);
2689}

References ABSOLUTE, FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4GDMLReadDefine::GetPosition(), G4UnitDefinition::GetValueOf(), RELATIVE, and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::TessellatedRead().

◆ Tube_dimensionsRead()

void G4GDMLReadParamvol::Tube_dimensionsRead ( const xercesc::DOMElement * const  element,
G4GDMLParameterisation::PARAMETER parameter 
)
protected

Definition at line 287 of file G4GDMLReadParamvol.cc.

290{
291 G4double lunit = 1.0;
292 G4double aunit = 1.0;
293
294 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
295 XMLSize_t attributeCount = attributes->getLength();
296
297 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
298 ++attribute_index)
299 {
300 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
301
302 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
303 {
304 continue;
305 }
306
307 const xercesc::DOMAttr* const attribute =
308 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
309 if(attribute == nullptr)
310 {
311 G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", "InvalidRead",
312 FatalException, "No attribute found!");
313 return;
314 }
315 const G4String attName = Transcode(attribute->getName());
316 const G4String attValue = Transcode(attribute->getValue());
317
318 if(attName == "lunit")
319 {
320 lunit = G4UnitDefinition::GetValueOf(attValue);
321 if(G4UnitDefinition::GetCategory(attValue) != "Length")
322 {
323 G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", "InvalidRead",
324 FatalException, "Invalid unit for length!");
325 }
326 }
327 else if(attName == "aunit")
328 {
329 aunit = G4UnitDefinition::GetValueOf(attValue);
330 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
331 {
332 G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", "InvalidRead",
333 FatalException, "Invalid unit for angle!");
334 }
335 }
336 else if(attName == "InR")
337 {
338 parameter.dimension[0] = eval.Evaluate(attValue);
339 }
340 else if(attName == "OutR")
341 {
342 parameter.dimension[1] = eval.Evaluate(attValue);
343 }
344 else if(attName == "hz")
345 {
346 parameter.dimension[2] = eval.Evaluate(attValue);
347 }
348 else if(attName == "StartPhi")
349 {
350 parameter.dimension[3] = eval.Evaluate(attValue);
351 }
352 else if(attName == "DeltaPhi")
353 {
354 parameter.dimension[4] = eval.Evaluate(attValue);
355 }
356 }
357
358 parameter.dimension[0] *= lunit;
359 parameter.dimension[1] *= lunit;
360 parameter.dimension[2] *= 0.5 * lunit;
361 parameter.dimension[3] *= aunit;
362 parameter.dimension[4] *= aunit;
363}

References G4GDMLParameterisation::PARAMETER::dimension, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), and G4GDMLRead::Transcode().

Referenced by ParametersRead().

◆ TubeRead()

void G4GDMLReadSolids::TubeRead ( const xercesc::DOMElement * const  tubeElement)
protectedinherited

Definition at line 2692 of file G4GDMLReadSolids.cc.

2693{
2694 G4String name;
2695 G4double lunit = 1.0;
2696 G4double aunit = 1.0;
2697 G4double rmin = 0.0;
2698 G4double rmax = 0.0;
2699 G4double z = 0.0;
2700 G4double startphi = 0.0;
2701 G4double deltaphi = 0.0;
2702
2703 const xercesc::DOMNamedNodeMap* const attributes =
2704 tubeElement->getAttributes();
2705 XMLSize_t attributeCount = attributes->getLength();
2706
2707 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2708 ++attribute_index)
2709 {
2710 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2711
2712 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2713 {
2714 continue;
2715 }
2716
2717 const xercesc::DOMAttr* const attribute =
2718 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2719 if(attribute == nullptr)
2720 {
2721 G4Exception("G4GDMLReadSolids::TubeRead()", "InvalidRead", FatalException,
2722 "No attribute found!");
2723 return;
2724 }
2725 const G4String attName = Transcode(attribute->getName());
2726 const G4String attValue = Transcode(attribute->getValue());
2727
2728 if(attName == "name")
2729 {
2730 name = GenerateName(attValue);
2731 }
2732 else if(attName == "lunit")
2733 {
2734 lunit = G4UnitDefinition::GetValueOf(attValue);
2735 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2736 {
2737 G4Exception("G4GDMLReadSolids::TubeRead()", "InvalidRead",
2738 FatalException, "Invalid unit for length!");
2739 }
2740 }
2741 else if(attName == "aunit")
2742 {
2743 aunit = G4UnitDefinition::GetValueOf(attValue);
2744 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
2745 {
2746 G4Exception("G4GDMLReadSolids::TubeRead()", "InvalidRead",
2747 FatalException, "Invalid unit for angle!");
2748 }
2749 }
2750 else if(attName == "rmin")
2751 {
2752 rmin = eval.Evaluate(attValue);
2753 }
2754 else if(attName == "rmax")
2755 {
2756 rmax = eval.Evaluate(attValue);
2757 }
2758 else if(attName == "z")
2759 {
2760 z = eval.Evaluate(attValue);
2761 }
2762 else if(attName == "startphi")
2763 {
2764 startphi = eval.Evaluate(attValue);
2765 }
2766 else if(attName == "deltaphi")
2767 {
2768 deltaphi = eval.Evaluate(attValue);
2769 }
2770 }
2771
2772 rmin *= lunit;
2773 rmax *= lunit;
2774 z *= 0.5 * lunit;
2775 startphi *= aunit;
2776 deltaphi *= aunit;
2777
2778 new G4Tubs(name, rmin, rmax, z, startphi, deltaphi);
2779}
Definition: G4Tubs.hh:75

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ TwistedboxRead()

void G4GDMLReadSolids::TwistedboxRead ( const xercesc::DOMElement * const  twistedboxElement)
protectedinherited

Definition at line 2899 of file G4GDMLReadSolids.cc.

2901{
2902 G4String name;
2903 G4double lunit = 1.0;
2904 G4double aunit = 1.0;
2905 G4double PhiTwist = 0.0;
2906 G4double x = 0.0;
2907 G4double y = 0.0;
2908 G4double z = 0.0;
2909
2910 const xercesc::DOMNamedNodeMap* const attributes =
2911 twistedboxElement->getAttributes();
2912 XMLSize_t attributeCount = attributes->getLength();
2913
2914 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2915 ++attribute_index)
2916 {
2917 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2918
2919 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2920 {
2921 continue;
2922 }
2923
2924 const xercesc::DOMAttr* const attribute =
2925 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2926 if(attribute == nullptr)
2927 {
2928 G4Exception("G4GDMLReadSolids::TwistedboxRead()", "InvalidRead",
2929 FatalException, "No attribute found!");
2930 return;
2931 }
2932 const G4String attName = Transcode(attribute->getName());
2933 const G4String attValue = Transcode(attribute->getValue());
2934
2935 if(attName == "name")
2936 {
2937 name = GenerateName(attValue);
2938 }
2939 else if(attName == "lunit")
2940 {
2941 lunit = G4UnitDefinition::GetValueOf(attValue);
2942 if(G4UnitDefinition::GetCategory(attValue) != "Length")
2943 {
2944 G4Exception("G4GDMLReadSolids::TwistedBoxRead()", "InvalidRead",
2945 FatalException, "Invalid unit for length!");
2946 }
2947 }
2948 else if(attName == "aunit")
2949 {
2950 aunit = G4UnitDefinition::GetValueOf(attValue);
2951 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
2952 {
2953 G4Exception("G4GDMLReadSolids::TwistedboxRead()", "InvalidRead",
2954 FatalException, "Invalid unit for angle!");
2955 }
2956 }
2957 else if(attName == "PhiTwist")
2958 {
2959 PhiTwist = eval.Evaluate(attValue);
2960 }
2961 else if(attName == "x")
2962 {
2963 x = eval.Evaluate(attValue);
2964 }
2965 else if(attName == "y")
2966 {
2967 y = eval.Evaluate(attValue);
2968 }
2969 else if(attName == "z")
2970 {
2971 z = eval.Evaluate(attValue);
2972 }
2973 }
2974
2975 PhiTwist *= aunit;
2976 x *= 0.5 * lunit;
2977 y *= 0.5 * lunit;
2978 z *= 0.5 * lunit;
2979
2980 new G4TwistedBox(name, PhiTwist, x, y, z);
2981}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ TwistedtrapRead()

void G4GDMLReadSolids::TwistedtrapRead ( const xercesc::DOMElement * const  twistedtrapElement)
protectedinherited

Definition at line 2984 of file G4GDMLReadSolids.cc.

2986{
2987 G4String name;
2988 G4double lunit = 1.0;
2989 G4double aunit = 1.0;
2990 G4double PhiTwist = 0.0;
2991 G4double z = 0.0;
2992 G4double Theta = 0.0;
2993 G4double Phi = 0.0;
2994 G4double y1 = 0.0;
2995 G4double x1 = 0.0;
2996 G4double x2 = 0.0;
2997 G4double y2 = 0.0;
2998 G4double x3 = 0.0;
2999 G4double x4 = 0.0;
3000 G4double Alph = 0.0;
3001
3002 const xercesc::DOMNamedNodeMap* const attributes =
3003 twistedtrapElement->getAttributes();
3004 XMLSize_t attributeCount = attributes->getLength();
3005
3006 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3007 ++attribute_index)
3008 {
3009 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3010
3011 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3012 {
3013 continue;
3014 }
3015
3016 const xercesc::DOMAttr* const attribute =
3017 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
3018 if(attribute == nullptr)
3019 {
3020 G4Exception("G4GDMLReadSolids::TwistedtrapRead()", "InvalidRead",
3021 FatalException, "No attribute found!");
3022 return;
3023 }
3024 const G4String attName = Transcode(attribute->getName());
3025 const G4String attValue = Transcode(attribute->getValue());
3026
3027 if(attName == "name")
3028 {
3029 name = GenerateName(attValue);
3030 }
3031 else if(attName == "lunit")
3032 {
3033 lunit = G4UnitDefinition::GetValueOf(attValue);
3034 if(G4UnitDefinition::GetCategory(attValue) != "Length")
3035 {
3036 G4Exception("G4GDMLReadSolids::TwistedtrapRead()", "InvalidRead",
3037 FatalException, "Invalid unit for length!");
3038 }
3039 }
3040 else if(attName == "aunit")
3041 {
3042 aunit = G4UnitDefinition::GetValueOf(attValue);
3043 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
3044 {
3045 G4Exception("G4GDMLReadSolids::TwistedtrapRead()", "InvalidRead",
3046 FatalException, "Invalid unit for angle!");
3047 }
3048 }
3049 else if(attName == "PhiTwist")
3050 {
3051 PhiTwist = eval.Evaluate(attValue);
3052 }
3053 else if(attName == "z")
3054 {
3055 z = eval.Evaluate(attValue);
3056 }
3057 else if(attName == "Theta")
3058 {
3059 Theta = eval.Evaluate(attValue);
3060 }
3061 else if(attName == "Phi")
3062 {
3063 Phi = eval.Evaluate(attValue);
3064 }
3065 else if(attName == "y1")
3066 {
3067 y1 = eval.Evaluate(attValue);
3068 }
3069 else if(attName == "x1")
3070 {
3071 x1 = eval.Evaluate(attValue);
3072 }
3073 else if(attName == "x2")
3074 {
3075 x2 = eval.Evaluate(attValue);
3076 }
3077 else if(attName == "y2")
3078 {
3079 y2 = eval.Evaluate(attValue);
3080 }
3081 else if(attName == "x3")
3082 {
3083 x3 = eval.Evaluate(attValue);
3084 }
3085 else if(attName == "x4")
3086 {
3087 x4 = eval.Evaluate(attValue);
3088 }
3089 else if(attName == "Alph")
3090 {
3091 Alph = eval.Evaluate(attValue);
3092 }
3093 }
3094
3095 PhiTwist *= aunit;
3096 z *= 0.5 * lunit;
3097 Theta *= aunit;
3098 Phi *= aunit;
3099 Alph *= aunit;
3100 y1 *= 0.5 * lunit;
3101 x1 *= 0.5 * lunit;
3102 x2 *= 0.5 * lunit;
3103 y2 *= 0.5 * lunit;
3104 x3 *= 0.5 * lunit;
3105 x4 *= 0.5 * lunit;
3106
3107 new G4TwistedTrap(name, PhiTwist, z, Theta, Phi, y1, x1, x2, y2, x3, x4,
3108 Alph);
3109}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ TwistedtrdRead()

void G4GDMLReadSolids::TwistedtrdRead ( const xercesc::DOMElement * const  twistedtrdElement)
protectedinherited

Definition at line 3112 of file G4GDMLReadSolids.cc.

3114{
3115 G4String name;
3116 G4double lunit = 1.0;
3117 G4double aunit = 1.0;
3118 G4double x1 = 0.0;
3119 G4double x2 = 0.0;
3120 G4double y1 = 0.0;
3121 G4double y2 = 0.0;
3122 G4double z = 0.0;
3123 G4double PhiTwist = 0.0;
3124
3125 const xercesc::DOMNamedNodeMap* const attributes =
3126 twistedtrdElement->getAttributes();
3127 XMLSize_t attributeCount = attributes->getLength();
3128
3129 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3130 ++attribute_index)
3131 {
3132 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3133
3134 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3135 {
3136 continue;
3137 }
3138
3139 const xercesc::DOMAttr* const attribute =
3140 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
3141 if(attribute == nullptr)
3142 {
3143 G4Exception("G4GDMLReadSolids::TwistedtrdRead()", "InvalidRead",
3144 FatalException, "No attribute found!");
3145 return;
3146 }
3147 const G4String attName = Transcode(attribute->getName());
3148 const G4String attValue = Transcode(attribute->getValue());
3149
3150 if(attName == "name")
3151 {
3152 name = GenerateName(attValue);
3153 }
3154 else if(attName == "lunit")
3155 {
3156 lunit = G4UnitDefinition::GetValueOf(attValue);
3157 if(G4UnitDefinition::GetCategory(attValue) != "Length")
3158 {
3159 G4Exception("G4GDMLReadSolids::TwistedtrdRead()", "InvalidRead",
3160 FatalException, "Invalid unit for length!");
3161 }
3162 }
3163 else if(attName == "aunit")
3164 {
3165 aunit = G4UnitDefinition::GetValueOf(attValue);
3166 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
3167 {
3168 G4Exception("G4GDMLReadSolids::TwistedtrdRead()", "InvalidRead",
3169 FatalException, "Invalid unit for angle!");
3170 }
3171 }
3172 else if(attName == "x1")
3173 {
3174 x1 = eval.Evaluate(attValue);
3175 }
3176 else if(attName == "x2")
3177 {
3178 x2 = eval.Evaluate(attValue);
3179 }
3180 else if(attName == "y1")
3181 {
3182 y1 = eval.Evaluate(attValue);
3183 }
3184 else if(attName == "y2")
3185 {
3186 y2 = eval.Evaluate(attValue);
3187 }
3188 else if(attName == "z")
3189 {
3190 z = eval.Evaluate(attValue);
3191 }
3192 else if(attName == "PhiTwist")
3193 {
3194 PhiTwist = eval.Evaluate(attValue);
3195 }
3196 }
3197
3198 x1 *= 0.5 * lunit;
3199 x2 *= 0.5 * lunit;
3200 y1 *= 0.5 * lunit;
3201 y2 *= 0.5 * lunit;
3202 z *= 0.5 * lunit;
3203 PhiTwist *= aunit;
3204
3205 new G4TwistedTrd(name, x1, x2, y1, y2, z, PhiTwist);
3206}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ TwistedtubsRead()

void G4GDMLReadSolids::TwistedtubsRead ( const xercesc::DOMElement * const  twistedtubsElement)
protectedinherited

Definition at line 3209 of file G4GDMLReadSolids.cc.

3211{
3212 G4String name;
3213 G4double lunit = 1.0;
3214 G4double aunit = 1.0;
3215 G4double twistedangle = 0.0;
3216 G4double endinnerrad = 0.0;
3217 G4double endouterrad = 0.0;
3218 G4double zlen = 0.0;
3219 G4double phi = 0.0;
3220 G4double totphi = 0.0;
3221 G4double midinnerrad = 0.0;
3222 G4double midouterrad = 0.0;
3223 G4double positiveEndz = 0.0;
3224 G4double negativeEndz = 0.0;
3225 G4int nseg = 0;
3226
3227 const xercesc::DOMNamedNodeMap* const attributes =
3228 twistedtubsElement->getAttributes();
3229 XMLSize_t attributeCount = attributes->getLength();
3230
3231 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3232 ++attribute_index)
3233 {
3234 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3235
3236 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3237 {
3238 continue;
3239 }
3240
3241 const xercesc::DOMAttr* const attribute =
3242 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
3243 if(attribute == nullptr)
3244 {
3245 G4Exception("G4GDMLReadSolids::TwistedtubsRead()", "InvalidRead",
3246 FatalException, "No attribute found!");
3247 return;
3248 }
3249 const G4String attName = Transcode(attribute->getName());
3250 const G4String attValue = Transcode(attribute->getValue());
3251
3252 if(attName == "name")
3253 {
3254 name = GenerateName(attValue);
3255 }
3256 else if(attName == "lunit")
3257 {
3258 lunit = G4UnitDefinition::GetValueOf(attValue);
3259 if(G4UnitDefinition::GetCategory(attValue) != "Length")
3260 {
3261 G4Exception("G4GDMLReadSolids::TwistedtubsRead()", "InvalidRead",
3262 FatalException, "Invalid unit for length!");
3263 }
3264 }
3265 else if(attName == "aunit")
3266 {
3267 aunit = G4UnitDefinition::GetValueOf(attValue);
3268 if(G4UnitDefinition::GetCategory(attValue) != "Angle")
3269 {
3270 G4Exception("G4GDMLReadSolids::TwistedtubsRead()", "InvalidRead",
3271 FatalException, "Invalid unit for angle!");
3272 }
3273 }
3274 else if(attName == "twistedangle")
3275 {
3276 twistedangle = eval.Evaluate(attValue);
3277 }
3278 else if(attName == "endinnerrad")
3279 {
3280 endinnerrad = eval.Evaluate(attValue);
3281 }
3282 else if(attName == "endouterrad")
3283 {
3284 endouterrad = eval.Evaluate(attValue);
3285 }
3286 else if(attName == "zlen")
3287 {
3288 zlen = eval.Evaluate(attValue);
3289 }
3290 else if(attName == "midinnerrad")
3291 {
3292 midinnerrad = eval.Evaluate(attValue);
3293 }
3294 else if(attName == "midouterrad")
3295 {
3296 midouterrad = eval.Evaluate(attValue);
3297 }
3298 else if(attName == "negativeEndz")
3299 {
3300 negativeEndz = eval.Evaluate(attValue);
3301 }
3302 else if(attName == "positiveEndz")
3303 {
3304 positiveEndz = eval.Evaluate(attValue);
3305 }
3306 else if(attName == "nseg")
3307 {
3308 nseg = eval.Evaluate(attValue);
3309 }
3310 else if(attName == "totphi")
3311 {
3312 totphi = eval.Evaluate(attValue);
3313 }
3314 else if(attName == "phi")
3315 {
3316 phi = eval.Evaluate(attValue);
3317 }
3318 }
3319
3320 twistedangle *= aunit;
3321 endinnerrad *= lunit;
3322 endouterrad *= lunit;
3323 zlen *= 0.5 * lunit;
3324 midinnerrad *= lunit;
3325 midouterrad *= lunit;
3326 positiveEndz *= lunit;
3327 negativeEndz *= lunit;
3328 phi *= aunit;
3329 totphi *= aunit;
3330
3331 if(zlen != 0.0)
3332 {
3333 if(nseg != 0)
3334 new G4TwistedTubs(name, twistedangle, endinnerrad, endouterrad, zlen,
3335 nseg, totphi);
3336 else
3337 new G4TwistedTubs(name, twistedangle, endinnerrad, endouterrad, zlen,
3338 phi);
3339 }
3340 else
3341 {
3342 if(nseg != 0)
3343 new G4TwistedTubs(name, twistedangle, midinnerrad, midouterrad,
3344 negativeEndz, positiveEndz, nseg, totphi);
3345 else
3346 new G4TwistedTubs(name, twistedangle, midinnerrad, midouterrad,
3347 negativeEndz, positiveEndz, phi);
3348 }
3349}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ TwoDimVertexRead()

G4TwoVector G4GDMLReadSolids::TwoDimVertexRead ( const xercesc::DOMElement * const  element,
G4double  lunit 
)
protectedinherited

Definition at line 3352 of file G4GDMLReadSolids.cc.

3354{
3355 G4TwoVector vec;
3356
3357 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
3358 XMLSize_t attributeCount = attributes->getLength();
3359
3360 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3361 ++attribute_index)
3362 {
3363 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3364
3365 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3366 {
3367 continue;
3368 }
3369
3370 const xercesc::DOMAttr* const attribute =
3371 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
3372 if(attribute == nullptr)
3373 {
3374 G4Exception("G4GDMLReadSolids::TwoDimVertexRead()", "InvalidRead",
3375 FatalException, "No attribute found!");
3376 return vec;
3377 }
3378 const G4String attName = Transcode(attribute->getName());
3379 const G4String attValue = Transcode(attribute->getValue());
3380
3381 if(attName == "x")
3382 {
3383 vec.setX(eval.Evaluate(attValue) * lunit);
3384 }
3385 else if(attName == "y")
3386 {
3387 vec.setY(eval.Evaluate(attValue) * lunit);
3388 }
3389 }
3390
3391 return vec;
3392}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), CLHEP::Hep2Vector::setX(), CLHEP::Hep2Vector::setY(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::XtruRead().

◆ UserinfoRead()

void G4GDMLRead::UserinfoRead ( const xercesc::DOMElement * const  userinfoElement)
virtualinherited

Definition at line 377 of file G4GDMLRead.cc.

378{
379#ifdef G4VERBOSE
380 G4cout << "G4GDML: Reading userinfo..." << G4endl;
381#endif
382 for(xercesc::DOMNode* iter = userinfoElement->getFirstChild();
383 iter != nullptr; iter = iter->getNextSibling())
384 {
385 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
386 {
387 continue;
388 }
389
390 const xercesc::DOMElement* const child =
391 dynamic_cast<xercesc::DOMElement*>(iter);
392 if(!child)
393 {
394 G4Exception("G4GDMLRead::UserinfoRead()", "InvalidRead", FatalException,
395 "No child found!");
396 return;
397 }
398 const G4String tag = Transcode(child->getTagName());
399
400 if(tag == "auxiliary")
401 {
402 auxGlobalList.push_back(AuxiliaryRead(child));
403 }
404 else
405 {
406 G4String error_msg = "Unknown tag in structure: " + tag;
407 G4Exception("G4GDMLRead::UserinfoRead()", "ReadError", FatalException,
408 error_msg);
409 }
410 }
411}

References G4GDMLRead::auxGlobalList, G4GDMLRead::AuxiliaryRead(), FatalException, G4cout, G4endl, G4Exception(), and G4GDMLRead::Transcode().

Referenced by G4GDMLRead::Read().

◆ VariableRead()

void G4GDMLReadDefine::VariableRead ( const xercesc::DOMElement * const  variableElement)
protectedinherited

Definition at line 502 of file G4GDMLReadDefine.cc.

504{
505 G4String name = "";
506 G4double value = 0.0;
507
508 const xercesc::DOMNamedNodeMap* const attributes =
509 variableElement->getAttributes();
510 XMLSize_t attributeCount = attributes->getLength();
511
512 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
513 ++attribute_index)
514 {
515 xercesc::DOMNode* node = attributes->item(attribute_index);
516
517 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
518 {
519 continue;
520 }
521
522 const xercesc::DOMAttr* const attribute =
523 dynamic_cast<xercesc::DOMAttr*>(node);
524 if(attribute == nullptr)
525 {
526 G4Exception("G4GDMLRead::VariableRead()", "InvalidRead", FatalException,
527 "No attribute found!");
528 return;
529 }
530 const G4String attName = Transcode(attribute->getName());
531 const G4String attValue = Transcode(attribute->getValue());
532
533 if(attName == "name")
534 {
535 name = attValue;
536 }
537 else if(attName == "value")
538 {
539 value = eval.Evaluate(attValue);
540 }
541 }
542
543 eval.DefineVariable(name, value);
544}
void DefineVariable(const G4String &, G4double)

References G4GDMLEvaluator::DefineVariable(), G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4InuclParticleNames::name(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadDefine::DefineRead().

◆ VectorRead()

void G4GDMLReadDefine::VectorRead ( const xercesc::DOMElement * const  vectorElement,
G4ThreeVector vec 
)
protectedinherited

Definition at line 662 of file G4GDMLReadDefine.cc.

664{
665 G4double unit = 1.0;
666
667 const xercesc::DOMNamedNodeMap* const attributes =
668 vectorElement->getAttributes();
669 XMLSize_t attributeCount = attributes->getLength();
670
671 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
672 ++attribute_index)
673 {
674 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
675
676 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
677 {
678 continue;
679 }
680
681 const xercesc::DOMAttr* const attribute =
682 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
683 if(attribute == nullptr)
684 {
685 G4Exception("G4GDMLRead::VectorRead()", "InvalidRead", FatalException,
686 "No attribute found!");
687 return;
688 }
689 const G4String attName = Transcode(attribute->getName());
690 const G4String attValue = Transcode(attribute->getValue());
691
692 if(attName == "unit")
693 {
694 unit = G4UnitDefinition::GetValueOf(attValue);
695 }
696 else if(attName == "x")
697 {
698 vec.setX(eval.Evaluate(attValue));
699 }
700 else if(attName == "y")
701 {
702 vec.setY(eval.Evaluate(attValue));
703 }
704 else if(attName == "z")
705 {
706 vec.setZ(eval.Evaluate(attValue));
707 }
708 }
709
710 vec *= unit;
711}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4UnitDefinition::GetValueOf(), CLHEP::Hep3Vector::setX(), CLHEP::Hep3Vector::setY(), CLHEP::Hep3Vector::setZ(), and G4GDMLRead::Transcode().

Referenced by G4GDMLReadSolids::BooleanRead(), G4GDMLReadSolids::MultiUnionNodeRead(), ParametersRead(), G4GDMLReadStructure::PhysvolRead(), G4GDMLReadStructure::ReplicaRead(), and G4GDMLReadSolids::ScaledSolidRead().

◆ Volume_contentRead()

virtual void G4GDMLRead::Volume_contentRead ( const xercesc::DOMElement * const  )
pure virtualinherited

◆ XtruRead()

void G4GDMLReadSolids::XtruRead ( const xercesc::DOMElement * const  xtruElement)
protectedinherited

Definition at line 614 of file G4GDMLReadSolids.cc.

615{
617 G4double lunit = 1.0;
618
619 const xercesc::DOMNamedNodeMap* const attributes =
620 xtruElement->getAttributes();
621 XMLSize_t attributeCount = attributes->getLength();
622
623 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
624 ++attribute_index)
625 {
626 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
627
628 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
629 {
630 continue;
631 }
632
633 const xercesc::DOMAttr* const attribute =
634 dynamic_cast<xercesc::DOMAttr*>(attribute_node);
635 if(attribute == nullptr)
636 {
637 G4Exception("G4GDMLReadSolids::XtruRead()", "InvalidRead", FatalException,
638 "No attribute found!");
639 return;
640 }
641 const G4String attName = Transcode(attribute->getName());
642 const G4String attValue = Transcode(attribute->getValue());
643
644 if(attName == "name")
645 {
646 name = GenerateName(attValue);
647 }
648 else if(attName == "lunit")
649 {
650 lunit = G4UnitDefinition::GetValueOf(attValue);
651 if(G4UnitDefinition::GetCategory(attValue) != "Length")
652 {
653 G4Exception("G4GDMLReadSolids::XtruRead()", "InvalidRead",
654 FatalException, "Invalid unit for length!");
655 }
656 }
657 }
658
659 std::vector<G4TwoVector> twoDimVertexList;
660 std::vector<G4ExtrudedSolid::ZSection> sectionList;
661
662 for(xercesc::DOMNode* iter = xtruElement->getFirstChild(); iter != nullptr;
663 iter = iter->getNextSibling())
664 {
665 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
666 {
667 continue;
668 }
669
670 const xercesc::DOMElement* const child =
671 dynamic_cast<xercesc::DOMElement*>(iter);
672 if(child == nullptr)
673 {
674 G4Exception("G4GDMLReadSolids::XtruRead()", "InvalidRead", FatalException,
675 "No child found!");
676 return;
677 }
678 const G4String tag = Transcode(child->getTagName());
679
680 if(tag == "twoDimVertex")
681 {
682 twoDimVertexList.push_back(TwoDimVertexRead(child, lunit));
683 }
684 else if(tag == "section")
685 {
686 sectionList.push_back(SectionRead(child, lunit));
687 }
688 }
689
690 new G4ExtrudedSolid(name, twoDimVertexList, sectionList);
691}
G4ExtrudedSolid::ZSection SectionRead(const xercesc::DOMElement *const, G4double)
G4TwoVector TwoDimVertexRead(const xercesc::DOMElement *const, G4double)

References FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4UnitDefinition::GetCategory(), G4UnitDefinition::GetValueOf(), G4InuclParticleNames::name(), G4GDMLReadSolids::SectionRead(), G4GDMLRead::Transcode(), and G4GDMLReadSolids::TwoDimVertexRead().

Referenced by G4GDMLReadSolids::SolidsRead().

◆ ZplaneRead()

G4GDMLReadSolids::zplaneType G4GDMLReadSolids::ZplaneRead ( const xercesc::DOMElement * const  zplaneElement)
protectedinherited

Definition at line 3395 of file G4GDMLReadSolids.cc.

3397{
3398 zplaneType zplane = { 0., 0., 0. };
3399
3400 const xercesc::DOMNamedNodeMap* const attributes =
3401 zplaneElement->getAttributes();
3402 XMLSize_t attributeCount = attributes->getLength();
3403
3404 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3405 ++attribute_index)
3406 {
3407 xercesc::DOMNode* node = attributes->item(attribute_index);
3408
3409 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3410 {
3411 continue;
3412 }
3413
3414 const xercesc::DOMAttr* const attribute =
3415 dynamic_cast<xercesc::DOMAttr*>(node);
3416 if(attribute == nullptr)
3417 {
3418 G4Exception("G4GDMLReadSolids::ZplaneRead()", "InvalidRead",
3419 FatalException, "No attribute found!");
3420 return zplane;
3421 }
3422 const G4String attName = Transcode(attribute->getName());
3423 const G4String attValue = Transcode(attribute->getValue());
3424
3425 if(attName == "rmin")
3426 {
3427 zplane.rmin = eval.Evaluate(attValue);
3428 }
3429 else if(attName == "rmax")
3430 {
3431 zplane.rmax = eval.Evaluate(attValue);
3432 }
3433 else if(attName == "z")
3434 {
3435 zplane.z = eval.Evaluate(attValue);
3436 }
3437 }
3438
3439 return zplane;
3440}

References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLReadSolids::zplaneType::rmax, G4GDMLReadSolids::zplaneType::rmin, G4GDMLRead::Transcode(), and G4GDMLReadSolids::zplaneType::z.

Referenced by Polycone_dimensionsRead(), G4GDMLReadSolids::PolyconeRead(), Polyhedra_dimensionsRead(), and G4GDMLReadSolids::PolyhedraRead().

Field Documentation

◆ auxGlobalList

G4GDMLAuxListType G4GDMLRead::auxGlobalList
privateinherited

Definition at line 164 of file G4GDMLRead.hh.

Referenced by G4GDMLRead::GetAuxList(), and G4GDMLRead::UserinfoRead().

◆ check

G4bool G4GDMLRead::check = false
protectedinherited

◆ dostrip

G4bool G4GDMLRead::dostrip = true
protectedinherited

Definition at line 159 of file G4GDMLRead.hh.

Referenced by G4GDMLReadStructure::GetWorldVolume(), and G4GDMLRead::Read().

◆ eval

G4GDMLEvaluator G4GDMLRead::eval
protectedinherited

Definition at line 156 of file G4GDMLRead.hh.

Referenced by G4GDMLReadMaterials::AtomRead(), G4GDMLReadStructure::AxisRead(), Box_dimensionsRead(), G4GDMLReadSolids::BoxRead(), G4GDMLReadStructure::Clear(), G4GDMLReadMaterials::CompositeRead(), Cone_dimensionsRead(), G4GDMLReadSolids::ConeRead(), G4GDMLReadDefine::ConstantRead(), G4GDMLReadSolids::CutTubeRead(), G4GDMLReadStructure::DivisionvolRead(), G4GDMLReadMaterials::DRead(), G4GDMLReadSolids::ElconeRead(), G4GDMLReadMaterials::ElementRead(), Ellipsoid_dimensionsRead(), G4GDMLReadSolids::EllipsoidRead(), G4GDMLReadSolids::EltubeRead(), G4GDMLReadDefine::ExpressionRead(), G4GDMLReadMaterials::FractionRead(), G4GDMLRead::GenerateName(), G4GDMLRead::GeneratePhysvolName(), G4GDMLReadSolids::GenericPolyconeRead(), G4GDMLReadSolids::GenericPolyhedraRead(), G4GDMLReadSolids::GenTrapRead(), G4GDMLReadDefine::GetConstant(), G4GDMLReadDefine::GetVariable(), Hype_dimensionsRead(), G4GDMLReadSolids::HypeRead(), G4GDMLReadMaterials::IsotopeRead(), G4GDMLReadDefine::IsValidID(), G4GDMLRead::LoopRead(), G4GDMLReadMaterials::MaterialRead(), G4GDMLReadDefine::MatrixRead(), G4GDMLReadMaterials::MEERead(), G4GDMLReadSolids::OpticalSurfaceRead(), Orb_dimensionsRead(), G4GDMLReadSolids::OrbRead(), Para_dimensionsRead(), G4GDMLReadSolids::ParaboloidRead(), ParameterisedRead(), G4GDMLReadSolids::ParaRead(), G4GDMLReadStructure::PhysvolRead(), Polycone_dimensionsRead(), G4GDMLReadSolids::PolyconeRead(), Polyhedra_dimensionsRead(), G4GDMLReadSolids::PolyhedraRead(), G4GDMLReadDefine::PositionRead(), G4GDMLReadMaterials::PRead(), G4GDMLReadStructure::QuantityRead(), G4GDMLReadDefine::QuantityRead(), G4GDMLReadSolids::ReflectedSolidRead(), G4GDMLReadDefine::RotationRead(), G4GDMLReadSolids::RZPointRead(), G4GDMLReadDefine::ScaleRead(), G4GDMLReadSolids::SectionRead(), Sphere_dimensionsRead(), G4GDMLReadSolids::SphereRead(), Torus_dimensionsRead(), G4GDMLReadSolids::TorusRead(), Trap_dimensionsRead(), G4GDMLReadSolids::TrapRead(), Trd_dimensionsRead(), G4GDMLReadSolids::TrdRead(), G4GDMLReadMaterials::TRead(), Tube_dimensionsRead(), G4GDMLReadSolids::TubeRead(), G4GDMLReadSolids::TwistedboxRead(), G4GDMLReadSolids::TwistedtrapRead(), G4GDMLReadSolids::TwistedtrdRead(), G4GDMLReadSolids::TwistedtubsRead(), G4GDMLReadSolids::TwoDimVertexRead(), G4GDMLReadDefine::VariableRead(), G4GDMLReadDefine::VectorRead(), G4GDMLReadStructure::Volume_contentRead(), and G4GDMLReadSolids::ZplaneRead().

◆ inLoop

G4int G4GDMLRead::inLoop = 0
privateinherited

Definition at line 163 of file G4GDMLRead.hh.

Referenced by G4GDMLRead::GenerateName(), G4GDMLRead::LoopRead(), and G4GDMLRead::Read().

◆ loopCount

G4int G4GDMLRead::loopCount = 0
privateinherited

Definition at line 163 of file G4GDMLRead.hh.

Referenced by G4GDMLRead::LoopRead().

◆ mapOfMatPropVects

std::map<G4String, G4MaterialPropertyVector*> G4GDMLReadSolids::mapOfMatPropVects
privateinherited

Definition at line 126 of file G4GDMLReadSolids.hh.

Referenced by G4GDMLReadSolids::PropertyRead().

◆ matrixMap

std::map<G4String, G4GDMLMatrix> G4GDMLReadDefine::matrixMap
protectedinherited

◆ parameterisation

G4GDMLParameterisation* G4GDMLReadParamvol::parameterisation = nullptr
protected

Definition at line 87 of file G4GDMLReadParamvol.hh.

Referenced by ParametersRead(), and ParamvolRead().

◆ positionMap

std::map<G4String, G4ThreeVector> G4GDMLReadDefine::positionMap
protectedinherited

◆ quantityMap

std::map<G4String, G4double> G4GDMLReadDefine::quantityMap
protectedinherited

◆ reverseSearch

G4bool G4GDMLReadDefine::reverseSearch = false
protectedinherited

◆ rotationMap

std::map<G4String, G4ThreeVector> G4GDMLReadDefine::rotationMap
protectedinherited

◆ scaleMap

std::map<G4String, G4ThreeVector> G4GDMLReadDefine::scaleMap
protectedinherited

Definition at line 107 of file G4GDMLReadDefine.hh.

Referenced by G4GDMLReadDefine::GetScale(), and G4GDMLReadDefine::ScaleRead().

◆ setupMap

std::map<G4String, G4String> G4GDMLReadSetup::setupMap
protectedinherited

Definition at line 58 of file G4GDMLReadSetup.hh.

Referenced by G4GDMLReadSetup::GetSetup(), and G4GDMLReadSetup::SetupRead().

◆ validate

G4bool G4GDMLRead::validate = true
protectedinherited

Definition at line 157 of file G4GDMLRead.hh.

Referenced by G4GDMLReadStructure::FileRead(), and G4GDMLRead::Read().


The documentation for this class was generated from the following files: