Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/persistency/gdml/src/G4GDMLWriteParamvol.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /persistency/gdml/src/G4GDMLWriteParamvol.cc (Version 11.3.0) and /persistency/gdml/src/G4GDMLWriteParamvol.cc (Version 4.0.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // G4GDMLParamVol implementation                  
 27 //                                                
 28 // Author: Zoltan Torzsok, November 2007          
 29 // -------------------------------------------    
 30                                                   
 31 #include "G4GDMLWriteParamvol.hh"                 
 32 #include "G4GDMLWriteSolids.hh"                   
 33                                                   
 34 #include "G4SystemOfUnits.hh"                     
 35 #include "G4Box.hh"                               
 36 #include "G4Trd.hh"                               
 37 #include "G4Trap.hh"                              
 38 #include "G4Tubs.hh"                              
 39 #include "G4Cons.hh"                              
 40 #include "G4Sphere.hh"                            
 41 #include "G4Orb.hh"                               
 42 #include "G4Torus.hh"                             
 43 #include "G4Ellipsoid.hh"                         
 44 #include "G4Para.hh"                              
 45 #include "G4Hype.hh"                              
 46 #include "G4Polycone.hh"                          
 47 #include "G4Polyhedra.hh"                         
 48 #include "G4LogicalVolume.hh"                     
 49 #include "G4VPhysicalVolume.hh"                   
 50 #include "G4PVParameterised.hh"                   
 51 #include "G4VPVParameterisation.hh"               
 52                                                   
 53 // -------------------------------------------    
 54 G4GDMLWriteParamvol::G4GDMLWriteParamvol()        
 55   : G4GDMLWriteSetup()                            
 56 {                                                 
 57 }                                                 
 58                                                   
 59 // -------------------------------------------    
 60 G4GDMLWriteParamvol::~G4GDMLWriteParamvol()       
 61 {                                                 
 62 }                                                 
 63                                                   
 64 // -------------------------------------------    
 65 void G4GDMLWriteParamvol::Box_dimensionsWrite(    
 66   xercesc::DOMElement* parametersElement, cons    
 67 {                                                 
 68   xercesc::DOMElement* box_dimensionsElement =    
 69   box_dimensionsElement->setAttributeNode(        
 70     NewAttribute("x", 2.0 * box->GetXHalfLengt    
 71   box_dimensionsElement->setAttributeNode(        
 72     NewAttribute("y", 2.0 * box->GetYHalfLengt    
 73   box_dimensionsElement->setAttributeNode(        
 74     NewAttribute("z", 2.0 * box->GetZHalfLengt    
 75   box_dimensionsElement->setAttributeNode(NewA    
 76   parametersElement->appendChild(box_dimension    
 77 }                                                 
 78                                                   
 79 // -------------------------------------------    
 80 void G4GDMLWriteParamvol::Trd_dimensionsWrite(    
 81   xercesc::DOMElement* parametersElement, cons    
 82 {                                                 
 83   xercesc::DOMElement* trd_dimensionsElement =    
 84   trd_dimensionsElement->setAttributeNode(        
 85     NewAttribute("x1", 2.0 * trd->GetXHalfLeng    
 86   trd_dimensionsElement->setAttributeNode(        
 87     NewAttribute("x2", 2.0 * trd->GetXHalfLeng    
 88   trd_dimensionsElement->setAttributeNode(        
 89     NewAttribute("y1", 2.0 * trd->GetYHalfLeng    
 90   trd_dimensionsElement->setAttributeNode(        
 91     NewAttribute("y2", 2.0 * trd->GetYHalfLeng    
 92   trd_dimensionsElement->setAttributeNode(        
 93     NewAttribute("z", 2.0 * trd->GetZHalfLengt    
 94   trd_dimensionsElement->setAttributeNode(NewA    
 95   parametersElement->appendChild(trd_dimension    
 96 }                                                 
 97                                                   
 98 // -------------------------------------------    
 99 void G4GDMLWriteParamvol::Trap_dimensionsWrite    
100   xercesc::DOMElement* parametersElement, cons    
101 {                                                 
102   const G4ThreeVector simaxis = trap->GetSymAx    
103   const G4double phi =                            
104     (simaxis.z() != 1.0) ? (std::atan(simaxis.    
105   const G4double theta  = std::acos(simaxis.z(    
106   const G4double alpha1 = std::atan(trap->GetT    
107   const G4double alpha2 = std::atan(trap->GetT    
108                                                   
109   xercesc::DOMElement* trap_dimensionsElement     
110   trap_dimensionsElement->setAttributeNode(       
111     NewAttribute("z", 2.0 * trap->GetZHalfLeng    
112   trap_dimensionsElement->setAttributeNode(       
113     NewAttribute("theta", theta / degree));       
114   trap_dimensionsElement->setAttributeNode(New    
115   trap_dimensionsElement->setAttributeNode(       
116     NewAttribute("y1", 2.0 * trap->GetYHalfLen    
117   trap_dimensionsElement->setAttributeNode(       
118     NewAttribute("x1", 2.0 * trap->GetXHalfLen    
119   trap_dimensionsElement->setAttributeNode(       
120     NewAttribute("x2", 2.0 * trap->GetXHalfLen    
121   trap_dimensionsElement->setAttributeNode(       
122     NewAttribute("alpha1", alpha1 / degree));     
123   trap_dimensionsElement->setAttributeNode(       
124     NewAttribute("y2", 2.0 * trap->GetYHalfLen    
125   trap_dimensionsElement->setAttributeNode(       
126     NewAttribute("x3", 2.0 * trap->GetXHalfLen    
127   trap_dimensionsElement->setAttributeNode(       
128     NewAttribute("x4", 2.0 * trap->GetXHalfLen    
129   trap_dimensionsElement->setAttributeNode(       
130     NewAttribute("alpha2", alpha2 / degree));     
131   trap_dimensionsElement->setAttributeNode(New    
132   trap_dimensionsElement->setAttributeNode(New    
133   parametersElement->appendChild(trap_dimensio    
134 }                                                 
135                                                   
136 // -------------------------------------------    
137 void G4GDMLWriteParamvol::Tube_dimensionsWrite    
138   xercesc::DOMElement* parametersElement, cons    
139 {                                                 
140   xercesc::DOMElement* tube_dimensionsElement     
141   tube_dimensionsElement->setAttributeNode(       
142     NewAttribute("InR", tube->GetInnerRadius()    
143   tube_dimensionsElement->setAttributeNode(       
144     NewAttribute("OutR", tube->GetOuterRadius(    
145   tube_dimensionsElement->setAttributeNode(       
146     NewAttribute("hz", 2.0 * tube->GetZHalfLen    
147   tube_dimensionsElement->setAttributeNode(       
148     NewAttribute("StartPhi", tube->GetStartPhi    
149   tube_dimensionsElement->setAttributeNode(       
150     NewAttribute("DeltaPhi", tube->GetDeltaPhi    
151   tube_dimensionsElement->setAttributeNode(New    
152   tube_dimensionsElement->setAttributeNode(New    
153   parametersElement->appendChild(tube_dimensio    
154 }                                                 
155                                                   
156 // -------------------------------------------    
157 void G4GDMLWriteParamvol::Cone_dimensionsWrite    
158   xercesc::DOMElement* parametersElement, cons    
159 {                                                 
160   xercesc::DOMElement* cone_dimensionsElement     
161   cone_dimensionsElement->setAttributeNode(       
162     NewAttribute("rmin1", cone->GetInnerRadius    
163   cone_dimensionsElement->setAttributeNode(       
164     NewAttribute("rmax1", cone->GetOuterRadius    
165   cone_dimensionsElement->setAttributeNode(       
166     NewAttribute("rmin2", cone->GetInnerRadius    
167   cone_dimensionsElement->setAttributeNode(       
168     NewAttribute("rmax2", cone->GetOuterRadius    
169   cone_dimensionsElement->setAttributeNode(       
170     NewAttribute("z", 2.0 * cone->GetZHalfLeng    
171   cone_dimensionsElement->setAttributeNode(       
172     NewAttribute("startphi", cone->GetStartPhi    
173   cone_dimensionsElement->setAttributeNode(       
174     NewAttribute("deltaphi", cone->GetDeltaPhi    
175   cone_dimensionsElement->setAttributeNode(New    
176   cone_dimensionsElement->setAttributeNode(New    
177   parametersElement->appendChild(cone_dimensio    
178 }                                                 
179                                                   
180 // -------------------------------------------    
181 void G4GDMLWriteParamvol::Sphere_dimensionsWri    
182   xercesc::DOMElement* parametersElement, cons    
183 {                                                 
184   xercesc::DOMElement* sphere_dimensionsElemen    
185     NewElement("sphere_dimensions");              
186   sphere_dimensionsElement->setAttributeNode(     
187     NewAttribute("rmin", sphere->GetInnerRadiu    
188   sphere_dimensionsElement->setAttributeNode(     
189     NewAttribute("rmax", sphere->GetOuterRadiu    
190   sphere_dimensionsElement->setAttributeNode(     
191     NewAttribute("startphi", sphere->GetStartP    
192   sphere_dimensionsElement->setAttributeNode(     
193     NewAttribute("deltaphi", sphere->GetDeltaP    
194   sphere_dimensionsElement->setAttributeNode(     
195     NewAttribute("starttheta", sphere->GetStar    
196   sphere_dimensionsElement->setAttributeNode(     
197     NewAttribute("deltatheta", sphere->GetDelt    
198   sphere_dimensionsElement->setAttributeNode(N    
199   sphere_dimensionsElement->setAttributeNode(N    
200   parametersElement->appendChild(sphere_dimens    
201 }                                                 
202                                                   
203 // -------------------------------------------    
204 void G4GDMLWriteParamvol::Orb_dimensionsWrite(    
205   xercesc::DOMElement* parametersElement, cons    
206 {                                                 
207   xercesc::DOMElement* orb_dimensionsElement =    
208   orb_dimensionsElement->setAttributeNode(        
209     NewAttribute("r", orb->GetRadius() / mm));    
210   orb_dimensionsElement->setAttributeNode(NewA    
211   parametersElement->appendChild(orb_dimension    
212 }                                                 
213                                                   
214 // -------------------------------------------    
215 void G4GDMLWriteParamvol::Torus_dimensionsWrit    
216   xercesc::DOMElement* parametersElement, cons    
217 {                                                 
218   xercesc::DOMElement* torus_dimensionsElement    
219   torus_dimensionsElement->setAttributeNode(      
220     NewAttribute("rmin", torus->GetRmin() / mm    
221   torus_dimensionsElement->setAttributeNode(      
222     NewAttribute("rmax", torus->GetRmax() / mm    
223   torus_dimensionsElement->setAttributeNode(      
224     NewAttribute("rtor", torus->GetRtor() / mm    
225   torus_dimensionsElement->setAttributeNode(      
226     NewAttribute("startphi", torus->GetSPhi()     
227   torus_dimensionsElement->setAttributeNode(      
228     NewAttribute("deltaphi", torus->GetDPhi()     
229   torus_dimensionsElement->setAttributeNode(Ne    
230   torus_dimensionsElement->setAttributeNode(Ne    
231   parametersElement->appendChild(torus_dimensi    
232 }                                                 
233                                                   
234 // -------------------------------------------    
235 void G4GDMLWriteParamvol::Ellipsoid_dimensions    
236   xercesc::DOMElement* parametersElement, cons    
237 {                                                 
238   xercesc::DOMElement* ellipsoid_dimensionsEle    
239     NewElement("ellipsoid_dimensions");           
240   ellipsoid_dimensionsElement->setAttributeNod    
241     NewAttribute("ax", ellipsoid->GetSemiAxisM    
242   ellipsoid_dimensionsElement->setAttributeNod    
243     NewAttribute("by", ellipsoid->GetSemiAxisM    
244   ellipsoid_dimensionsElement->setAttributeNod    
245     NewAttribute("cz", ellipsoid->GetSemiAxisM    
246   ellipsoid_dimensionsElement->setAttributeNod    
247     NewAttribute("zcut1", ellipsoid->GetZBotto    
248   ellipsoid_dimensionsElement->setAttributeNod    
249     NewAttribute("zcut2", ellipsoid->GetZTopCu    
250   ellipsoid_dimensionsElement->setAttributeNod    
251   parametersElement->appendChild(ellipsoid_dim    
252 }                                                 
253                                                   
254 // -------------------------------------------    
255 void G4GDMLWriteParamvol::Para_dimensionsWrite    
256   xercesc::DOMElement* parametersElement, cons    
257 {                                                 
258   const G4ThreeVector simaxis = para->GetSymAx    
259                                                   
260   const G4double alpha = std::atan(para->GetTa    
261   const G4double theta = std::acos(simaxis.z()    
262   const G4double phi =                            
263     (simaxis.z() != 1.0) ? (std::atan(simaxis.    
264                                                   
265   xercesc::DOMElement* para_dimensionsElement     
266   para_dimensionsElement->setAttributeNode(       
267     NewAttribute("x", 2.0 * para->GetXHalfLeng    
268   para_dimensionsElement->setAttributeNode(       
269     NewAttribute("y", 2.0 * para->GetYHalfLeng    
270   para_dimensionsElement->setAttributeNode(       
271     NewAttribute("z", 2.0 * para->GetZHalfLeng    
272   para_dimensionsElement->setAttributeNode(       
273     NewAttribute("alpha", alpha / degree));       
274   para_dimensionsElement->setAttributeNode(       
275     NewAttribute("theta", theta / degree));       
276   para_dimensionsElement->setAttributeNode(New    
277   para_dimensionsElement->setAttributeNode(New    
278   para_dimensionsElement->setAttributeNode(New    
279   parametersElement->appendChild(para_dimensio    
280 }                                                 
281                                                   
282 // -------------------------------------------    
283 void G4GDMLWriteParamvol::Hype_dimensionsWrite    
284   xercesc::DOMElement* parametersElement, cons    
285 {                                                 
286   xercesc::DOMElement* hype_dimensionsElement     
287   hype_dimensionsElement->setAttributeNode(       
288     NewAttribute("rmin", hype->GetInnerRadius(    
289   hype_dimensionsElement->setAttributeNode(       
290     NewAttribute("rmax", hype->GetOuterRadius(    
291   hype_dimensionsElement->setAttributeNode(       
292     NewAttribute("inst", hype->GetInnerStereo(    
293   hype_dimensionsElement->setAttributeNode(       
294     NewAttribute("outst", hype->GetOuterStereo    
295   hype_dimensionsElement->setAttributeNode(       
296     NewAttribute("z", 2.0 * hype->GetZHalfLeng    
297   hype_dimensionsElement->setAttributeNode(New    
298   hype_dimensionsElement->setAttributeNode(New    
299   parametersElement->appendChild(hype_dimensio    
300 }                                                 
301                                                   
302 // -------------------------------------------    
303 void G4GDMLWriteParamvol::Polycone_dimensionsW    
304   xercesc::DOMElement* parametersElement, cons    
305 {                                                 
306   xercesc::DOMElement* pcone_dimensionsElement    
307     NewElement("polycone_dimensions");            
308                                                   
309   pcone_dimensionsElement->setAttributeNode(      
310     NewAttribute("numRZ", pcone->GetOriginalPa    
311   pcone_dimensionsElement->setAttributeNode(Ne    
312     "startPhi", pcone->GetOriginalParameters()    
313   pcone_dimensionsElement->setAttributeNode(Ne    
314     "openPhi", pcone->GetOriginalParameters()-    
315   pcone_dimensionsElement->setAttributeNode(Ne    
316   pcone_dimensionsElement->setAttributeNode(Ne    
317                                                   
318   parametersElement->appendChild(pcone_dimensi    
319   const size_t num_zplanes   = pcone->GetOrigi    
320   const G4double* z_array    = pcone->GetOrigi    
321   const G4double* rmin_array = pcone->GetOrigi    
322   const G4double* rmax_array = pcone->GetOrigi    
323                                                   
324   for(std::size_t i = 0; i < num_zplanes; ++i)    
325   {                                               
326     ZplaneWrite(pcone_dimensionsElement, z_arr    
327                 rmax_array[i]);                   
328   }                                               
329 }                                                 
330                                                   
331 // -------------------------------------------    
332 void G4GDMLWriteParamvol::Polyhedra_dimensions    
333   xercesc::DOMElement* parametersElement, cons    
334 {                                                 
335   xercesc::DOMElement* polyhedra_dimensionsEle    
336     NewElement("polyhedra_dimensions");           
337                                                   
338   polyhedra_dimensionsElement->setAttributeNod    
339     NewAttribute("numRZ", polyhedra->GetOrigin    
340   polyhedra_dimensionsElement->setAttributeNod    
341     NewAttribute("numSide", polyhedra->GetOrig    
342   polyhedra_dimensionsElement->setAttributeNod    
343     "startPhi", polyhedra->GetOriginalParamete    
344   polyhedra_dimensionsElement->setAttributeNod    
345     "openPhi", polyhedra->GetOriginalParameter    
346   polyhedra_dimensionsElement->setAttributeNod    
347   polyhedra_dimensionsElement->setAttributeNod    
348                                                   
349   parametersElement->appendChild(polyhedra_dim    
350   const size_t num_zplanes   = polyhedra->GetO    
351   const G4double* z_array    = polyhedra->GetO    
352   const G4double* rmin_array = polyhedra->GetO    
353   const G4double* rmax_array = polyhedra->GetO    
354                                                   
355   for(std::size_t i = 0; i < num_zplanes; ++i)    
356   {                                               
357     ZplaneWrite(polyhedra_dimensionsElement, z    
358                 rmax_array[i]);                   
359   }                                               
360 }                                                 
361                                                   
362 // -------------------------------------------    
363 void G4GDMLWriteParamvol::ParametersWrite(xerc    
364                    const G4VPhysicalVolume* co    
365 {                                                 
366   paramvol->GetParameterisation()->ComputeTran    
367     index, const_cast<G4VPhysicalVolume*>(para    
368   G4ThreeVector Angles;                           
369   G4String name = GenerateName(paramvol->GetNa    
370   std::stringstream os;                           
371   os.precision(15);                               
372   os << index;                                    
373   G4String sncopie = os.str();                    
374                                                   
375   xercesc::DOMElement* parametersElement = New    
376   parametersElement->setAttributeNode(NewAttri    
377                                                   
378   PositionWrite(parametersElement, name + snco    
379                 paramvol->GetObjectTranslation    
380   Angles = GetAngles(paramvol->GetObjectRotati    
381   if(Angles.mag2() > DBL_EPSILON)                 
382   {                                               
383     RotationWrite(parametersElement, name + sn    
384                   GetAngles(paramvol->GetObjec    
385   }                                               
386   paramvolElement->appendChild(parametersEleme    
387                                                   
388   G4VSolid* solid = paramvol->GetLogicalVolume    
389                                                   
390   if(G4Box* box = dynamic_cast<G4Box*>(solid))    
391   {                                               
392     paramvol->GetParameterisation()->ComputeDi    
393       *box, index, const_cast<G4VPhysicalVolum    
394     Box_dimensionsWrite(parametersElement, box    
395   }                                               
396   else if(G4Trd* trd = dynamic_cast<G4Trd*>(so    
397   {                                               
398     paramvol->GetParameterisation()->ComputeDi    
399       *trd, index, const_cast<G4VPhysicalVolum    
400     Trd_dimensionsWrite(parametersElement, trd    
401   }                                               
402   else if(G4Trap* trap = dynamic_cast<G4Trap*>    
403   {                                               
404     paramvol->GetParameterisation()->ComputeDi    
405       *trap, index, const_cast<G4VPhysicalVolu    
406     Trap_dimensionsWrite(parametersElement, tr    
407   }                                               
408   else if(G4Tubs* tube = dynamic_cast<G4Tubs*>    
409   {                                               
410     paramvol->GetParameterisation()->ComputeDi    
411       *tube, index, const_cast<G4VPhysicalVolu    
412     Tube_dimensionsWrite(parametersElement, tu    
413   }                                               
414   else if(G4Cons* cone = dynamic_cast<G4Cons*>    
415   {                                               
416     paramvol->GetParameterisation()->ComputeDi    
417       *cone, index, const_cast<G4VPhysicalVolu    
418     Cone_dimensionsWrite(parametersElement, co    
419   }                                               
420   else if(G4Sphere* sphere = dynamic_cast<G4Sp    
421   {                                               
422     paramvol->GetParameterisation()->ComputeDi    
423       *sphere, index, const_cast<G4VPhysicalVo    
424     Sphere_dimensionsWrite(parametersElement,     
425   }                                               
426   else if(G4Orb* orb = dynamic_cast<G4Orb*>(so    
427   {                                               
428     paramvol->GetParameterisation()->ComputeDi    
429       *orb, index, const_cast<G4VPhysicalVolum    
430     Orb_dimensionsWrite(parametersElement, orb    
431   }                                               
432   else if(G4Torus* torus = dynamic_cast<G4Toru    
433   {                                               
434     paramvol->GetParameterisation()->ComputeDi    
435       *torus, index, const_cast<G4VPhysicalVol    
436     Torus_dimensionsWrite(parametersElement, t    
437   }                                               
438   else if(G4Ellipsoid* ellipsoid = dynamic_cas    
439   {                                               
440     paramvol->GetParameterisation()->ComputeDi    
441       *ellipsoid, index, const_cast<G4VPhysica    
442     Ellipsoid_dimensionsWrite(parametersElemen    
443   }                                               
444   else if(G4Para* para = dynamic_cast<G4Para*>    
445   {                                               
446     paramvol->GetParameterisation()->ComputeDi    
447       *para, index, const_cast<G4VPhysicalVolu    
448     Para_dimensionsWrite(parametersElement, pa    
449   }                                               
450   else if(G4Hype* hype = dynamic_cast<G4Hype*>    
451   {                                               
452     paramvol->GetParameterisation()->ComputeDi    
453       *hype, index, const_cast<G4VPhysicalVolu    
454     Hype_dimensionsWrite(parametersElement, hy    
455   }                                               
456   else if(G4Polycone* pcone = dynamic_cast<G4P    
457   {                                               
458     paramvol->GetParameterisation()->ComputeDi    
459       *pcone, index, const_cast<G4VPhysicalVol    
460     Polycone_dimensionsWrite(parametersElement    
461   }                                               
462   else if(G4Polyhedra* polyhedra = dynamic_cas    
463   {                                               
464     paramvol->GetParameterisation()->ComputeDi    
465       *polyhedra, index, const_cast<G4VPhysica    
466     Polyhedra_dimensionsWrite(parametersElemen    
467   }                                               
468   else                                            
469   {                                               
470     G4String error_msg = "Solid '" + solid->Ge    
471                          "' cannot be used in     
472     G4Exception("G4GDMLWriteParamvol::Paramete    
473                 FatalException, error_msg);       
474   }                                               
475 }                                                 
476                                                   
477 // -------------------------------------------    
478 void G4GDMLWriteParamvol::ParamvolWrite(xerces    
479                                         const     
480 {                                                 
481   const G4String volumeref = GenerateName(        
482     paramvol->GetLogicalVolume()->GetName(), p    
483   xercesc::DOMElement* paramvolElement = NewEl    
484   paramvolElement->setAttributeNode(              
485     NewAttribute("ncopies", paramvol->GetMulti    
486   xercesc::DOMElement* volumerefElement = NewE    
487   volumerefElement->setAttributeNode(NewAttrib    
488                                                   
489   xercesc::DOMElement* algorithmElement =         
490     NewElement("parameterised_position_size");    
491   paramvolElement->appendChild(volumerefElemen    
492   paramvolElement->appendChild(algorithmElemen    
493   ParamvolAlgorithmWrite(algorithmElement, par    
494   volumeElement->appendChild(paramvolElement);    
495 }                                                 
496                                                   
497 // -------------------------------------------    
498 void G4GDMLWriteParamvol::ParamvolAlgorithmWri    
499   xercesc::DOMElement* paramvolElement, const     
500 {                                                 
501   const G4String volumeref = GenerateName(        
502     paramvol->GetLogicalVolume()->GetName(), p    
503                                                   
504   const G4int parameterCount = paramvol->GetMu    
505                                                   
506   for(G4int i = 0; i < parameterCount; ++i)       
507   {                                               
508     ParametersWrite(paramvolElement, paramvol,    
509   }                                               
510 }                                                 
511