38 #include <Geant4/G4SystemOfUnits.hh>
39 #include <Geant4/G4Box.hh>
40 #include <Geant4/G4Trd.hh>
41 #include <Geant4/G4Trap.hh>
42 #include <Geant4/G4Tubs.hh>
43 #include <Geant4/G4Cons.hh>
44 #include <Geant4/G4Sphere.hh>
45 #include <Geant4/G4Orb.hh>
46 #include <Geant4/G4Torus.hh>
47 #include <Geant4/G4Ellipsoid.hh>
48 #include <Geant4/G4Para.hh>
49 #include <Geant4/G4Hype.hh>
50 #include <Geant4/G4Polycone.hh>
51 #include <Geant4/G4Polyhedra.hh>
52 #include <Geant4/G4LogicalVolume.hh>
53 #include <Geant4/G4VPhysicalVolume.hh>
54 #include <Geant4/G4PVParameterised.hh>
55 #include <Geant4/G4VPVParameterisation.hh>
71 xercesc::DOMElement* box_dimensionsElement =
NewElement(
"box_dimensions");
72 box_dimensionsElement->
74 box_dimensionsElement->
76 box_dimensionsElement->
78 box_dimensionsElement->
80 parametersElement->appendChild(box_dimensionsElement);
85 const G4Trd*
const trd)
87 xercesc::DOMElement* trd_dimensionsElement =
NewElement(
"trd_dimensions");
88 trd_dimensionsElement->
90 trd_dimensionsElement->
92 trd_dimensionsElement->
94 trd_dimensionsElement->
96 trd_dimensionsElement->
98 trd_dimensionsElement->
100 parametersElement->appendChild(trd_dimensionsElement);
109 ? (std::atan(simaxis.
y()/simaxis.
x())) : (0.0);
114 xercesc::DOMElement* trap_dimensionsElement =
NewElement(
"trap");
115 trap_dimensionsElement->
117 trap_dimensionsElement->
119 trap_dimensionsElement->
121 trap_dimensionsElement->
123 trap_dimensionsElement->
125 trap_dimensionsElement->
127 trap_dimensionsElement->
129 trap_dimensionsElement->
131 trap_dimensionsElement->
133 trap_dimensionsElement->
135 trap_dimensionsElement->
137 trap_dimensionsElement->
139 trap_dimensionsElement->
141 parametersElement->appendChild(trap_dimensionsElement);
148 xercesc::DOMElement* tube_dimensionsElement =
NewElement(
"tube_dimensions");
149 tube_dimensionsElement->
151 tube_dimensionsElement->
153 tube_dimensionsElement->
155 tube_dimensionsElement->
157 tube_dimensionsElement->
159 tube_dimensionsElement->
161 tube_dimensionsElement->
163 parametersElement->appendChild(tube_dimensionsElement);
171 xercesc::DOMElement* cone_dimensionsElement =
NewElement(
"cone_dimensions");
172 cone_dimensionsElement->
174 cone_dimensionsElement->
176 cone_dimensionsElement->
178 cone_dimensionsElement->
180 cone_dimensionsElement->
182 cone_dimensionsElement->
184 cone_dimensionsElement->
186 cone_dimensionsElement->
188 cone_dimensionsElement->
190 parametersElement->appendChild(cone_dimensionsElement);
197 xercesc::DOMElement* sphere_dimensionsElement =
199 sphere_dimensionsElement->setAttributeNode(
NewAttribute(
"rmin",
201 sphere_dimensionsElement->setAttributeNode(
NewAttribute(
"rmax",
203 sphere_dimensionsElement->setAttributeNode(
NewAttribute(
"startphi",
205 sphere_dimensionsElement->setAttributeNode(
NewAttribute(
"deltaphi",
207 sphere_dimensionsElement->setAttributeNode(
NewAttribute(
"starttheta",
209 sphere_dimensionsElement->setAttributeNode(
NewAttribute(
"deltatheta",
211 sphere_dimensionsElement->setAttributeNode(
NewAttribute(
"aunit",
"deg"));
212 sphere_dimensionsElement->setAttributeNode(
NewAttribute(
"lunit",
"mm"));
213 parametersElement->appendChild(sphere_dimensionsElement);
218 const G4Orb*
const orb)
220 xercesc::DOMElement* orb_dimensionsElement =
NewElement(
"orb_dimensions");
221 orb_dimensionsElement->setAttributeNode(
NewAttribute(
"r",
223 orb_dimensionsElement->setAttributeNode(
NewAttribute(
"lunit",
"mm"));
224 parametersElement->appendChild(orb_dimensionsElement);
231 xercesc::DOMElement* torus_dimensionsElement =
233 torus_dimensionsElement->
235 torus_dimensionsElement->
237 torus_dimensionsElement->
239 torus_dimensionsElement->
241 torus_dimensionsElement->
243 torus_dimensionsElement->
245 torus_dimensionsElement->
247 parametersElement->appendChild(torus_dimensionsElement);
254 xercesc::DOMElement* ellipsoid_dimensionsElement =
256 ellipsoid_dimensionsElement->
258 ellipsoid_dimensionsElement->
260 ellipsoid_dimensionsElement->
262 ellipsoid_dimensionsElement->
264 ellipsoid_dimensionsElement->
266 ellipsoid_dimensionsElement->
268 parametersElement->appendChild(ellipsoid_dimensionsElement);
280 ? (std::atan(simaxis.
y()/simaxis.
x())) : (0.0);
282 xercesc::DOMElement* para_dimensionsElement =
NewElement(
"para_dimensions");
283 para_dimensionsElement->
285 para_dimensionsElement->
287 para_dimensionsElement->
289 para_dimensionsElement->
291 para_dimensionsElement->
293 para_dimensionsElement->
295 para_dimensionsElement->
297 para_dimensionsElement->
299 parametersElement->appendChild(para_dimensionsElement);
306 xercesc::DOMElement* hype_dimensionsElement =
NewElement(
"hype_dimensions");
307 hype_dimensionsElement->
309 hype_dimensionsElement->
311 hype_dimensionsElement->
313 hype_dimensionsElement->
315 hype_dimensionsElement->
317 hype_dimensionsElement->
319 hype_dimensionsElement->
321 parametersElement->appendChild(hype_dimensionsElement);
328 xercesc::DOMElement* pcone_dimensionsElement
331 pcone_dimensionsElement->setAttributeNode(
NewAttribute(
"numRZ",
333 pcone_dimensionsElement->setAttributeNode(
NewAttribute(
"startPhi",
335 pcone_dimensionsElement->setAttributeNode(
NewAttribute(
"openPhi",
337 pcone_dimensionsElement->setAttributeNode(
NewAttribute(
"aunit",
"deg"));
338 pcone_dimensionsElement->setAttributeNode(
NewAttribute(
"lunit",
"mm"));
340 parametersElement->appendChild(pcone_dimensionsElement);
346 for (
size_t i=0; i<num_zplanes; i++)
349 rmin_array[i],rmax_array[i]);
357 xercesc::DOMElement* polyhedra_dimensionsElement
360 polyhedra_dimensionsElement->setAttributeNode(
NewAttribute(
"numRZ",
362 polyhedra_dimensionsElement->setAttributeNode(
NewAttribute(
"numSide",
364 polyhedra_dimensionsElement->setAttributeNode(
NewAttribute(
"startPhi",
366 polyhedra_dimensionsElement->setAttributeNode(
NewAttribute(
"openPhi",
368 polyhedra_dimensionsElement->setAttributeNode(
NewAttribute(
"aunit",
"deg"));
369 polyhedra_dimensionsElement->setAttributeNode(
NewAttribute(
"lunit",
"mm"));
371 parametersElement->appendChild(polyhedra_dimensionsElement);
377 for (
size_t i=0; i<num_zplanes; i++)
379 ZplaneWrite(polyhedra_dimensionsElement,z_array[i],
380 rmin_array[i],rmax_array[i]);
392 std::stringstream os;
397 xercesc::DOMElement* parametersElement =
NewElement(
"parameters");
398 parametersElement->setAttributeNode(
NewAttribute(
"number",index+1));
408 paramvolElement->appendChild(parametersElement);
412 if (
G4Box*
box = dynamic_cast<G4Box*>(solid))
415 const_cast<G4VPhysicalVolume*>(paramvol));
418 if (
G4Trd* trd = dynamic_cast<G4Trd*>(solid))
421 const_cast<G4VPhysicalVolume*>(paramvol));
424 if (
G4Trap* trap = dynamic_cast<G4Trap*>(solid))
427 const_cast<G4VPhysicalVolume*>(paramvol));
430 if (
G4Tubs* tube = dynamic_cast<G4Tubs*>(solid))
433 const_cast<G4VPhysicalVolume*>(paramvol));
436 if (
G4Cons* cone = dynamic_cast<G4Cons*>(solid))
439 const_cast<G4VPhysicalVolume*>(paramvol));
442 if (
G4Sphere* sphere = dynamic_cast<G4Sphere*>(solid))
445 const_cast<G4VPhysicalVolume*>(paramvol));
448 if (
G4Orb* orb = dynamic_cast<G4Orb*>(solid))
451 const_cast<G4VPhysicalVolume*>(paramvol));
454 if (
G4Torus* torus = dynamic_cast<G4Torus*>(solid))
457 const_cast<G4VPhysicalVolume*>(paramvol));
460 if (
G4Ellipsoid* ellipsoid = dynamic_cast<G4Ellipsoid*>(solid))
463 const_cast<G4VPhysicalVolume*>(paramvol));
466 if (
G4Para* para = dynamic_cast<G4Para*>(solid))
469 const_cast<G4VPhysicalVolume*>(paramvol));
472 if (
G4Hype* hype = dynamic_cast<G4Hype*>(solid))
475 const_cast<G4VPhysicalVolume*>(paramvol));
478 if (
G4Polycone* pcone = dynamic_cast<G4Polycone*>(solid))
481 const_cast<G4VPhysicalVolume*>(paramvol));
484 if (
G4Polyhedra* polyhedra = dynamic_cast<G4Polyhedra*>(solid))
487 const_cast<G4VPhysicalVolume*>(paramvol));
493 +
"' cannot be used in parameterised volume!";
494 G4Exception(
"PHG4GDMLWriteParamvol::ParametersWrite()",
506 xercesc::DOMElement* paramvolElement =
NewElement(
"paramvol");
507 paramvolElement->setAttributeNode(
NewAttribute(
"ncopies",
509 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
510 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
512 xercesc::DOMElement* algorithmElement =
514 paramvolElement->appendChild(volumerefElement);
515 paramvolElement->appendChild(algorithmElement);
517 volumeElement->appendChild(paramvolElement);
530 for (
G4int i=0; i<parameterCount; i++)