Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLEvaluator.cc 68053 2013-03-13 14:39:51Z gcosmo $
// GEANT4 tag $ Name:$
//
// class G4GDMLEvaluator Implementation
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLMessenger.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
//
// class G4GDMLMessenger Implementation
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4GDMLParameterisation.cc 77556 2013-11-26 08:56:14Z gcosmo $
//
// class G4GDMLParameterisation Implementation
//
@@ -32,6 +32,8 @@
// -------------------------------------------------------------------------
#include "G4GDMLParameterisation.hh"
#include "G4PolyconeHistorical.hh"
#include "G4PolyhedraHistorical.hh"
G4int G4GDMLParameterisation::GetSize() const
{
@@ -109,7 +111,7 @@ ComputeDimensions(G4Cons& cons,const G4int index,const G4VPhysicalVolume*) const
void G4GDMLParameterisation::
ComputeDimensions(G4Sphere& sphere,const G4int index,const G4VPhysicalVolume*) const
{
sphere.SetInsideRadius(parameterList[index].dimension[0]);
sphere.SetInnerRadius(parameterList[index].dimension[0]);
sphere.SetOuterRadius(parameterList[index].dimension[1]);
sphere.SetStartPhiAngle(parameterList[index].dimension[2]);
sphere.SetDeltaPhiAngle(parameterList[index].dimension[3]);
@@ -123,6 +125,16 @@ ComputeDimensions(G4Orb& orb,const G4int index,const G4VPhysicalVolume*) const
orb.SetRadius(parameterList[index].dimension[0]);
}
void G4GDMLParameterisation::
ComputeDimensions(G4Ellipsoid& ellipsoid,const G4int index,const G4VPhysicalVolume*) const
{
ellipsoid.SetSemiAxis(parameterList[index].dimension[0],
parameterList[index].dimension[1],
parameterList[index].dimension[2]);
ellipsoid.SetZCuts(parameterList[index].dimension[3],
parameterList[index].dimension[4]);
}
void G4GDMLParameterisation::
ComputeDimensions(G4Torus& torus,const G4int index,const G4VPhysicalVolume*) const
{
@@ -155,17 +167,46 @@ ComputeDimensions(G4Hype& hype,const G4int index,const G4VPhysicalVolume*) const
}
void G4GDMLParameterisation::
ComputeDimensions(G4Polycone&,const G4int,const G4VPhysicalVolume*) const
ComputeDimensions(G4Polycone& pcone,const G4int index,const G4VPhysicalVolume*) const
{
G4Exception("G4GDMLParameterisation::ComputeDimensions()",
"InvalidSetup", FatalException,
"Parameterisation of G4Polycone not implemented yet. Sorry!");
G4PolyconeHistorical origparam( *(pcone.GetOriginalParameters()) );
origparam.Start_angle = parameterList[index].dimension[0];
origparam.Opening_angle = parameterList[index].dimension[1];
origparam.Num_z_planes = (G4int) parameterList[index].dimension[2];
G4int nZplanes = origparam.Num_z_planes;
for( G4int ii = 0; ii < nZplanes; ii++ )
{
origparam.Rmin[ii] = parameterList[index].dimension[3+ii*3] ;
origparam.Rmax[ii] = parameterList[index].dimension[4+ii*3] ;
origparam.Z_values[ii] = parameterList[index].dimension[5+ii*3] ;
}
pcone.SetOriginalParameters(&origparam); // copy values & transfer pointers
pcone.Reset(); // reset to new solid parameters
}
void G4GDMLParameterisation::
ComputeDimensions(G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const
ComputeDimensions(G4Polyhedra& polyhedra,const G4int index,const G4VPhysicalVolume*) const
{
G4Exception("G4GDMLParameterisation::ComputeDimensions()",
"InvalidSetup", FatalException,
"Parameterisation of G4Polyhedra not implemented yet. Sorry!");
G4PolyhedraHistorical origparam( *(polyhedra.GetOriginalParameters()) );
origparam.Start_angle = parameterList[index].dimension[0];
origparam.Opening_angle = parameterList[index].dimension[1];
origparam.Num_z_planes = (G4int) parameterList[index].dimension[2];
origparam.numSide = (G4int) parameterList[index].dimension[3];
G4int nZplanes = origparam.Num_z_planes;
for( G4int ii = 0; ii < nZplanes; ii++ )
{
origparam.Rmin[ii] = parameterList[index].dimension[4+ii*3] ;
origparam.Rmax[ii] = parameterList[index].dimension[5+ii*3] ;
origparam.Z_values[ii] = parameterList[index].dimension[6+ii*3] ;
}
polyhedra.SetOriginalParameters(&origparam); // copy values & transfer pointers
polyhedra.Reset(); // reset to new solid parameters
}
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLParser.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
//
// class G4GDMLParser Implementation
+1 -1
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4GDMLRead.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
// class G4GDMLRead Implementation
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4GDMLReadDefine.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
// class G4GDMLReadDefine Implementation
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLReadMaterials.cc 70764 2013-06-05 12:54:37Z gcosmo $
// GEANT4 tag $ Name:$
//
// class G4GDMLReadMaterials Implementation
@@ -159,7 +159,7 @@ G4double G4GDMLReadMaterials::DRead(const xercesc::DOMElement* const DElement)
G4double G4GDMLReadMaterials::PRead(const xercesc::DOMElement* const PElement)
{
G4double value = STP_Pressure;
G4double unit = pascal;
G4double unit = hep_pascal;
const xercesc::DOMNamedNodeMap* const attributes = PElement->getAttributes();
XMLSize_t attributeCount = attributes->getLength();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4GDMLReadParamvol.cc 77913 2013-11-29 10:59:07Z gcosmo $
//
// class G4GDMLReadParamvol Implementation
//
@@ -32,7 +32,7 @@
// -------------------------------------------------------------------------
#include "G4GDMLReadParamvol.hh"
#include "G4GDMLReadSolids.hh"
#include "G4LogicalVolume.hh"
#include "G4PVParameterised.hh"
#include "G4PVPlacement.hh"
@@ -451,6 +451,54 @@ Torus_dimensionsRead( const xercesc::DOMElement* const element,
parameter.dimension[4] *= aunit;
}
void G4GDMLReadParamvol::
Ellipsoid_dimensionsRead( const xercesc::DOMElement* const element,
G4GDMLParameterisation::PARAMETER& parameter )
{
G4double lunit = 1.0;
const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
XMLSize_t attributeCount = attributes->getLength();
for (XMLSize_t attribute_index=0;
attribute_index<attributeCount; attribute_index++)
{
xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
{ continue; }
const xercesc::DOMAttr* const attribute
= dynamic_cast<xercesc::DOMAttr*>(attribute_node);
if (!attribute)
{
G4Exception("G4GDMLReadParamvol::Ellipsoid_dimensionsRead()",
"InvalidRead", FatalException, "No attribute found!");
return;
}
const G4String attName = Transcode(attribute->getName());
const G4String attValue = Transcode(attribute->getValue());
if (attName=="lunit")
{ lunit = eval.Evaluate(attValue); } else
if (attName=="ax")
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
if (attName=="by")
{ parameter.dimension[1] = eval.Evaluate(attValue); } else
if (attName=="cz")
{ parameter.dimension[2] = eval.Evaluate(attValue); } else
if (attName=="zcut1")
{ parameter.dimension[3] = eval.Evaluate(attValue); } else
if (attName=="zcut2")
{ parameter.dimension[4] = eval.Evaluate(attValue); }
}
parameter.dimension[0] *= lunit;
parameter.dimension[1] *= lunit;
parameter.dimension[2] *= lunit;
parameter.dimension[3] *= lunit;
parameter.dimension[4] *= lunit;
}
void G4GDMLReadParamvol::
Para_dimensionsRead( const xercesc::DOMElement* const element,
G4GDMLParameterisation::PARAMETER& parameter )
@@ -559,8 +607,156 @@ Hype_dimensionsRead( const xercesc::DOMElement* const element,
}
void G4GDMLReadParamvol::
ParametersRead(const xercesc::DOMElement* const element) {
Polycone_dimensionsRead( const xercesc::DOMElement* const element,
G4GDMLParameterisation::PARAMETER& parameter )
{
G4double lunit = 1.0;
G4double aunit = 1.0;
std::vector<zplaneType> zplaneList;
const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
XMLSize_t attributeCount = attributes->getLength();
for (XMLSize_t attribute_index=0;
attribute_index<attributeCount; attribute_index++)
{
xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
{ continue; }
const xercesc::DOMAttr* const attribute
= dynamic_cast<xercesc::DOMAttr*>(attribute_node);
if (!attribute)
{
G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
"InvalidRead", FatalException, "No attribute found!");
return;
}
const G4String attName = Transcode(attribute->getName());
const G4String attValue = Transcode(attribute->getValue());
if (attName=="lunit")
{ lunit = eval.Evaluate(attValue); } else
if (attName=="aunit")
{ aunit = eval.Evaluate(attValue); } else
if (attName=="startPhi")
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
if (attName=="openPhi")
{ parameter.dimension[1] = eval.Evaluate(attValue); } else
if (attName=="numRZ")
{ parameter.dimension[2] = eval.Evaluate(attValue); }
}
parameter.dimension[0] *= aunit;
parameter.dimension[1] *= aunit;
for (xercesc::DOMNode* iter = element->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
const xercesc::DOMElement* const child
= dynamic_cast<xercesc::DOMElement*>(iter);
if (!child)
{
G4Exception("G4GDMLReadParamVol::Polycone_dimensionsRead()",
"InvalidRead", FatalException, "No child found!");
return;
}
const G4String tag = Transcode(child->getTagName());
if (tag=="zplane") { zplaneList.push_back(ZplaneRead(child)); }
}
G4int numZPlanes = zplaneList.size();
for (G4int i=0; i<numZPlanes; i++)
{
parameter.dimension[3+i*3] = zplaneList[i].rmin*lunit;
parameter.dimension[4+i*3] = zplaneList[i].rmax*lunit;
parameter.dimension[5+i*3] = zplaneList[i].z*lunit;
}
}
void G4GDMLReadParamvol::
Polyhedra_dimensionsRead( const xercesc::DOMElement* const element,
G4GDMLParameterisation::PARAMETER& parameter )
{
G4double lunit = 1.0;
G4double aunit = 1.0;
std::vector<zplaneType> zplaneList;
const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
XMLSize_t attributeCount = attributes->getLength();
for (XMLSize_t attribute_index=0;
attribute_index<attributeCount; attribute_index++)
{
xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
{ continue; }
const xercesc::DOMAttr* const attribute
= dynamic_cast<xercesc::DOMAttr*>(attribute_node);
if (!attribute)
{
G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
"InvalidRead", FatalException, "No attribute found!");
return;
}
const G4String attName = Transcode(attribute->getName());
const G4String attValue = Transcode(attribute->getValue());
if (attName=="lunit")
{ lunit = eval.Evaluate(attValue); } else
if (attName=="aunit")
{ aunit = eval.Evaluate(attValue); } else
if (attName=="startPhi")
{ parameter.dimension[0] = eval.Evaluate(attValue); } else
if (attName=="openPhi")
{ parameter.dimension[1] = eval.Evaluate(attValue); } else
if (attName=="numRZ")
{ parameter.dimension[2] = eval.Evaluate(attValue); } else
if (attName=="numSide")
{ parameter.dimension[3] = eval.Evaluate(attValue); }
}
parameter.dimension[0] *= aunit;
parameter.dimension[1] *= aunit;
for (xercesc::DOMNode* iter = element->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
const xercesc::DOMElement* const child
= dynamic_cast<xercesc::DOMElement*>(iter);
if (!child)
{
G4Exception("G4GDMLReadParamvo::PolyhedraRead()",
"InvalidRead", FatalException, "No child found!");
return;
}
const G4String tag = Transcode(child->getTagName());
if (tag=="zplane") { zplaneList.push_back(ZplaneRead(child)); }
}
G4int numZPlanes = zplaneList.size();
for (G4int i=0; i<numZPlanes; i++)
{
parameter.dimension[4+i*3] = zplaneList[i].rmin*lunit;
parameter.dimension[5+i*3] = zplaneList[i].rmax*lunit;
parameter.dimension[6+i*3] = zplaneList[i].z*lunit;
}
}
void G4GDMLReadParamvol::
ParametersRead(const xercesc::DOMElement* const element)
{
G4ThreeVector rotation(0.0,0.0,0.0);
G4ThreeVector position(0.0,0.0,0.0);
@@ -591,10 +787,13 @@ ParametersRead(const xercesc::DOMElement* const element) {
if (tag=="trap_dimensions") { Trap_dimensionsRead(child,parameter); } else
if (tag=="tube_dimensions") { Tube_dimensionsRead(child,parameter); } else
if (tag=="cone_dimensions") { Cone_dimensionsRead(child,parameter); } else
if (tag=="sphere_dimensions") { Cone_dimensionsRead(child,parameter); } else
if (tag=="orb_dimensions") { Cone_dimensionsRead(child,parameter); } else
if (tag=="torus_dimensions") { Cone_dimensionsRead(child,parameter); } else
if (tag=="para_dimensions") { Cone_dimensionsRead(child,parameter); } else
if (tag=="sphere_dimensions") { Sphere_dimensionsRead(child,parameter); } else
if (tag=="orb_dimensions") { Orb_dimensionsRead(child,parameter); } else
if (tag=="torus_dimensions") { Torus_dimensionsRead(child,parameter); } else
if (tag=="ellipsoid_dimensions") { Ellipsoid_dimensionsRead(child,parameter); } else
if (tag=="para_dimensions") { Para_dimensionsRead(child,parameter); } else
if (tag=="polycone_dimensions") { Polycone_dimensionsRead(child,parameter); } else
if (tag=="polyhedra_dimensions") { Polyhedra_dimensionsRead(child,parameter); } else
if (tag=="hype_dimensions") { Hype_dimensionsRead(child,parameter); }
else
{
@@ -696,7 +895,6 @@ ParamvolRead(const xercesc::DOMElement* const element, G4LogicalVolume* mother)
G4String volumeref;
parameterisation = new G4GDMLParameterisation();
for (xercesc::DOMNode* iter = element->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4GDMLReadSetup.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
// class G4GDMLReadSetup Implementation
//
+203 -2
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4GDMLReadSolids.cc 77528 2013-11-25 13:06:36Z gcosmo $
//
// class G4GDMLReadSolids Implementation
//
@@ -32,7 +32,6 @@
// --------------------------------------------------------------------
#include "G4GDMLReadSolids.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Ellipsoid.hh"
@@ -44,6 +43,7 @@
#include "G4Para.hh"
#include "G4Paraboloid.hh"
#include "G4Polycone.hh"
#include "G4GenericPolycone.hh"
#include "G4Polyhedra.hh"
#include "G4QuadrangularFacet.hh"
#include "G4ReflectedSolid.hh"
@@ -535,6 +535,13 @@ void G4GDMLReadSolids::HypeRead(const xercesc::DOMElement* const hypeElement)
new G4Hype(name,rmin,rmax,inst,outst,z);
}
void G4GDMLReadSolids::MultiUnionRead(const xercesc::DOMElement* const)
{
G4Exception("G4GDMLReadSolids::MultiUnionRead()",
"InvalidSetup", JustWarning,
"MultiUnion is not supported yet. Sorry!");
}
void G4GDMLReadSolids::OrbRead(const xercesc::DOMElement* const orbElement)
{
G4String name;
@@ -755,6 +762,82 @@ PolyconeRead(const xercesc::DOMElement* const polyconeElement)
z_array,rmin_array,rmax_array);
}
void G4GDMLReadSolids::
GenericPolyconeRead(const xercesc::DOMElement* const polyconeElement)
{
G4String name;
G4double lunit = 1.0;
G4double aunit = 1.0;
G4double startphi = 0.0;
G4double deltaphi = 0.0;
const xercesc::DOMNamedNodeMap* const attributes
= polyconeElement->getAttributes();
XMLSize_t attributeCount = attributes->getLength();
for (XMLSize_t attribute_index=0;
attribute_index<attributeCount; attribute_index++)
{
xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
{ continue; }
const xercesc::DOMAttr* const attribute
= dynamic_cast<xercesc::DOMAttr*>(attribute_node);
if (!attribute)
{
G4Exception("G4GDMLReadSolids::GenericPolyconeRead()",
"InvalidRead", FatalException, "No attribute found!");
return;
}
const G4String attName = Transcode(attribute->getName());
const G4String attValue = Transcode(attribute->getValue());
if (attName=="name") { name = GenerateName(attValue); } else
if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else
if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else
if (attName=="startphi") { startphi = eval.Evaluate(attValue); }else
if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); }
}
startphi *= aunit;
deltaphi *= aunit;
std::vector<rzPointType> rzPointList;
for (xercesc::DOMNode* iter = polyconeElement->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
const xercesc::DOMElement* const child
= dynamic_cast<xercesc::DOMElement*>(iter);
if (!child)
{
G4Exception("G4GDMLReadSolids::GenericPolyconeRead()",
"InvalidRead", FatalException, "No child found!");
return;
}
const G4String tag = Transcode(child->getTagName());
if (tag=="rzpoint") { rzPointList.push_back(RZPointRead(child)); }
}
G4int numRZPoints = rzPointList.size();
G4double* r_array = new G4double[numRZPoints];
G4double* z_array = new G4double[numRZPoints];
for (G4int i=0; i<numRZPoints; i++)
{
r_array[i] = rzPointList[i].r*lunit;
z_array[i] = rzPointList[i].z*lunit;
}
new G4GenericPolycone(name,startphi,deltaphi,numRZPoints,
r_array,z_array);
}
void G4GDMLReadSolids::
PolyhedraRead(const xercesc::DOMElement* const polyhedraElement)
{
@@ -837,6 +920,87 @@ PolyhedraRead(const xercesc::DOMElement* const polyhedraElement)
}
void G4GDMLReadSolids::
GenericPolyhedraRead(const xercesc::DOMElement* const polyhedraElement)
{
G4String name;
G4double lunit = 1.0;
G4double aunit = 1.0;
G4double startphi = 0.0;
G4double deltaphi = 0.0;
G4int numsides = 0;
const xercesc::DOMNamedNodeMap* const attributes
= polyhedraElement->getAttributes();
XMLSize_t attributeCount = attributes->getLength();
for (XMLSize_t attribute_index=0;
attribute_index<attributeCount; attribute_index++)
{
xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
{ continue; }
const xercesc::DOMAttr* const attribute
= dynamic_cast<xercesc::DOMAttr*>(attribute_node);
if (!attribute)
{
G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()",
"InvalidRead", FatalException, "No attribute found!");
return;
}
const G4String attName = Transcode(attribute->getName());
const G4String attValue = Transcode(attribute->getValue());
if (attName=="name") { name = GenerateName(attValue); } else
if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else
if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else
if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else
if (attName=="numsides") { numsides = eval.EvaluateInteger(attValue); }
}
startphi *= aunit;
deltaphi *= aunit;
std::vector<rzPointType> rzpointList;
for (xercesc::DOMNode* iter = polyhedraElement->getFirstChild();
iter != 0; iter = iter->getNextSibling())
{
if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
const xercesc::DOMElement* const child
= dynamic_cast<xercesc::DOMElement*>(iter);
if (!child)
{
G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()",
"InvalidRead", FatalException, "No child found!");
return;
}
const G4String tag = Transcode(child->getTagName());
if (tag=="rzpoint") { rzpointList.push_back(RZPointRead(child)); }
}
G4int numRZPoints = rzpointList.size();
G4double* r_array = new G4double[numRZPoints];
G4double* z_array = new G4double[numRZPoints];
for (G4int i=0; i<numRZPoints; i++)
{
r_array[i] = rzpointList[i].r*lunit;
z_array[i] = rzpointList[i].z*lunit;
}
new G4Polyhedra(name,startphi,deltaphi,numsides,numRZPoints,
r_array,z_array);
}
G4QuadrangularFacet* G4GDMLReadSolids::
QuadrangularRead(const xercesc::DOMElement* const quadrangularElement)
{
@@ -1858,6 +2022,40 @@ ZplaneRead(const xercesc::DOMElement* const zplaneElement)
return zplane;
}
G4GDMLReadSolids::rzPointType G4GDMLReadSolids::
RZPointRead(const xercesc::DOMElement* const zplaneElement)
{
rzPointType rzpoint = {0.,0.};
const xercesc::DOMNamedNodeMap* const attributes
= zplaneElement->getAttributes();
XMLSize_t attributeCount = attributes->getLength();
for (XMLSize_t attribute_index=0;
attribute_index<attributeCount; attribute_index++)
{
xercesc::DOMNode* node = attributes->item(attribute_index);
if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) { continue; }
const xercesc::DOMAttr* const attribute
= dynamic_cast<xercesc::DOMAttr*>(node);
if (!attribute)
{
G4Exception("G4GDMLReadSolids::RZPointRead()",
"InvalidRead", FatalException, "No attribute found!");
return rzpoint;
}
const G4String attName = Transcode(attribute->getName());
const G4String attValue = Transcode(attribute->getValue());
if (attName=="r") { rzpoint.r = eval.Evaluate(attValue); } else
if (attName=="z") { rzpoint.z = eval.Evaluate(attValue); }
}
return rzpoint;
}
void G4GDMLReadSolids::
OpticalSurfaceRead(const xercesc::DOMElement* const opticalsurfaceElement)
@@ -2006,11 +2204,14 @@ void G4GDMLReadSolids::SolidsRead(const xercesc::DOMElement* const solidsElement
if (tag=="xtru") { XtruRead(child); } else
if (tag=="hype") { HypeRead(child); } else
if (tag=="intersection") { BooleanRead(child,INTERSECTION); } else
if (tag=="multiunion") { MultiUnionRead(child); } else
if (tag=="orb") { OrbRead(child); } else
if (tag=="para") { ParaRead(child); } else
if (tag=="paraboloid") { ParaboloidRead(child); } else
if (tag=="polycone") { PolyconeRead(child); } else
if (tag=="genericPolycone") { GenericPolyconeRead(child); } else
if (tag=="polyhedra") { PolyhedraRead(child); } else
if (tag=="genericPolyhedra") { GenericPolyhedraRead(child); } else
if (tag=="reflectedSolid") { ReflectedSolidRead(child); } else
if (tag=="sphere") { SphereRead(child); } else
if (tag=="subtraction") { BooleanRead(child,SUBTRACTION); } else
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4GDMLReadStructure.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
// class G4GDMLReadStructure Implementation
//
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLWrite.cc 69013 2013-04-15 09:41:13Z gcosmo $
//
// class G4GDMLWrite Implementation
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLWriteDefine.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
// class G4GDMLWriteDefine Implementation
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLWriteMaterials.cc 70764 2013-06-05 12:54:37Z gcosmo $
//
// class G4GDMLWriteMaterials Implementation
//
@@ -74,7 +74,7 @@ PWrite(xercesc::DOMElement* element,const G4double& P)
{
xercesc::DOMElement* PElement = NewElement("P");
PElement->setAttributeNode(NewAttribute("unit","pascal"));
PElement->setAttributeNode(NewAttribute("value",P/pascal));
PElement->setAttributeNode(NewAttribute("value",P/hep_pascal));
element->appendChild(PElement);
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLWriteParamvol.cc 77913 2013-11-29 10:59:07Z gcosmo $
//
// class G4GDMLParamVol Implementation
//
@@ -33,6 +33,7 @@
// --------------------------------------------------------------------
#include "G4GDMLWriteParamvol.hh"
#include "G4GDMLWriteSolids.hh"
#include "G4SystemOfUnits.hh"
#include "G4Box.hh"
@@ -43,8 +44,11 @@
#include "G4Sphere.hh"
#include "G4Orb.hh"
#include "G4Torus.hh"
#include "G4Ellipsoid.hh"
#include "G4Para.hh"
#include "G4Hype.hh"
#include "G4Polycone.hh"
#include "G4Polyhedra.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVParameterised.hh"
@@ -193,7 +197,7 @@ Sphere_dimensionsWrite(xercesc::DOMElement* parametersElement,
xercesc::DOMElement* sphere_dimensionsElement =
NewElement("sphere_dimensions");
sphere_dimensionsElement->setAttributeNode(NewAttribute("rmin",
sphere->GetInsideRadius()/mm));
sphere->GetInnerRadius()/mm));
sphere_dimensionsElement->setAttributeNode(NewAttribute("rmax",
sphere->GetOuterRadius()/mm));
sphere_dimensionsElement->setAttributeNode(NewAttribute("startphi",
@@ -243,11 +247,33 @@ Torus_dimensionsWrite(xercesc::DOMElement* parametersElement,
parametersElement->appendChild(torus_dimensionsElement);
}
void G4GDMLWriteParamvol::
Ellipsoid_dimensionsWrite(xercesc::DOMElement* parametersElement,
const G4Ellipsoid* const ellipsoid)
{
xercesc::DOMElement* ellipsoid_dimensionsElement =
NewElement("ellipsoid_dimensions");
ellipsoid_dimensionsElement->
setAttributeNode(NewAttribute("ax",ellipsoid->GetSemiAxisMax(0)/mm));
ellipsoid_dimensionsElement->
setAttributeNode(NewAttribute("by",ellipsoid->GetSemiAxisMax(1)/mm));
ellipsoid_dimensionsElement->
setAttributeNode(NewAttribute("cz",ellipsoid->GetSemiAxisMax(2)/mm));
ellipsoid_dimensionsElement->
setAttributeNode(NewAttribute("zcut1",ellipsoid->GetZBottomCut()/mm));
ellipsoid_dimensionsElement->
setAttributeNode(NewAttribute("zcut2",ellipsoid->GetZTopCut()/mm));
ellipsoid_dimensionsElement->
setAttributeNode(NewAttribute("lunit","mm"));
parametersElement->appendChild(ellipsoid_dimensionsElement);
}
void G4GDMLWriteParamvol::
Para_dimensionsWrite(xercesc::DOMElement* parametersElement,
const G4Para* const para)
{
const G4ThreeVector simaxis = para->GetSymAxis();
const G4double alpha = std::atan(para->GetTanAlpha());
const G4double theta = std::acos(simaxis.z());
const G4double phi = (simaxis.z() != 1.0)
@@ -295,6 +321,66 @@ Hype_dimensionsWrite(xercesc::DOMElement* parametersElement,
parametersElement->appendChild(hype_dimensionsElement);
}
void G4GDMLWriteParamvol::
Polycone_dimensionsWrite(xercesc::DOMElement* parametersElement,
const G4Polycone* const pcone)
{
xercesc::DOMElement* pcone_dimensionsElement
= NewElement("polycone_dimensions");
pcone_dimensionsElement->setAttributeNode(NewAttribute("numRZ",
pcone->GetOriginalParameters()->Num_z_planes));
pcone_dimensionsElement->setAttributeNode(NewAttribute("startPhi",
pcone->GetOriginalParameters()->Start_angle/degree));
pcone_dimensionsElement->setAttributeNode(NewAttribute("openPhi",
pcone->GetOriginalParameters()->Opening_angle/degree));
pcone_dimensionsElement->setAttributeNode(NewAttribute("aunit","deg"));
pcone_dimensionsElement->setAttributeNode(NewAttribute("lunit","mm"));
parametersElement->appendChild(pcone_dimensionsElement);
const size_t num_zplanes = pcone->GetOriginalParameters()->Num_z_planes;
const G4double* z_array = pcone->GetOriginalParameters()->Z_values;
const G4double* rmin_array = pcone->GetOriginalParameters()->Rmin;
const G4double* rmax_array = pcone->GetOriginalParameters()->Rmax;
for (size_t i=0; i<num_zplanes; i++)
{
ZplaneWrite(pcone_dimensionsElement,z_array[i],
rmin_array[i],rmax_array[i]);
}
}
void G4GDMLWriteParamvol::
Polyhedra_dimensionsWrite(xercesc::DOMElement* parametersElement,
const G4Polyhedra* const polyhedra)
{
xercesc::DOMElement* polyhedra_dimensionsElement
= NewElement("polyhedra_dimensions");
polyhedra_dimensionsElement->setAttributeNode(NewAttribute("numRZ",
polyhedra->GetOriginalParameters()->Num_z_planes));
polyhedra_dimensionsElement->setAttributeNode(NewAttribute("numSide",
polyhedra->GetOriginalParameters()->numSide));
polyhedra_dimensionsElement->setAttributeNode(NewAttribute("startPhi",
polyhedra->GetOriginalParameters()->Start_angle/degree));
polyhedra_dimensionsElement->setAttributeNode(NewAttribute("openPhi",
polyhedra->GetOriginalParameters()->Opening_angle/degree));
polyhedra_dimensionsElement->setAttributeNode(NewAttribute("aunit","deg"));
polyhedra_dimensionsElement->setAttributeNode(NewAttribute("lunit","mm"));
parametersElement->appendChild(polyhedra_dimensionsElement);
const size_t num_zplanes = polyhedra->GetOriginalParameters()->Num_z_planes;
const G4double* z_array = polyhedra->GetOriginalParameters()->Z_values;
const G4double* rmin_array = polyhedra->GetOriginalParameters()->Rmin;
const G4double* rmax_array = polyhedra->GetOriginalParameters()->Rmax;
for (size_t i=0; i<num_zplanes; i++)
{
ZplaneWrite(polyhedra_dimensionsElement,z_array[i],
rmin_array[i],rmax_array[i]);
}
}
void G4GDMLWriteParamvol::
ParametersWrite(xercesc::DOMElement* paramvolElement,
const G4VPhysicalVolume* const paramvol,const G4int& index)
@@ -371,6 +457,12 @@ ParametersWrite(xercesc::DOMElement* paramvolElement,
const_cast<G4VPhysicalVolume*>(paramvol));
Torus_dimensionsWrite(parametersElement,torus);
} else
if (G4Ellipsoid* ellipsoid = dynamic_cast<G4Ellipsoid*>(solid))
{
paramvol->GetParameterisation()->ComputeDimensions(*ellipsoid,index,
const_cast<G4VPhysicalVolume*>(paramvol));
Ellipsoid_dimensionsWrite(parametersElement,ellipsoid);
} else
if (G4Para* para = dynamic_cast<G4Para*>(solid))
{
paramvol->GetParameterisation()->ComputeDimensions(*para,index,
@@ -382,6 +474,18 @@ ParametersWrite(xercesc::DOMElement* paramvolElement,
paramvol->GetParameterisation()->ComputeDimensions(*hype,index,
const_cast<G4VPhysicalVolume*>(paramvol));
Hype_dimensionsWrite(parametersElement,hype);
}else
if (G4Polycone* pcone = dynamic_cast<G4Polycone*>(solid))
{
paramvol->GetParameterisation()->ComputeDimensions(*pcone,index,
const_cast<G4VPhysicalVolume*>(paramvol));
Polycone_dimensionsWrite(parametersElement,pcone);
}else
if (G4Polyhedra* polyhedra = dynamic_cast<G4Polyhedra*>(solid))
{
paramvol->GetParameterisation()->ComputeDimensions(*polyhedra,index,
const_cast<G4VPhysicalVolume*>(paramvol));
Polyhedra_dimensionsWrite(parametersElement,polyhedra);
}
else
{
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLWriteSetup.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
// class G4GDMLWriteSetup Implementation
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLWriteSolids.cc 76271 2013-11-08 11:51:39Z gcosmo $
//
// class G4GDMLWriteSolids Implementation
//
@@ -48,6 +48,7 @@
#include "G4Paraboloid.hh"
#include "G4IntersectionSolid.hh"
#include "G4Polycone.hh"
#include "G4GenericPolycone.hh"
#include "G4Polyhedra.hh"
#include "G4ReflectedSolid.hh"
#include "G4Sphere.hh"
@@ -409,32 +410,59 @@ ParaboloidWrite(xercesc::DOMElement* solElement,
paraboloidElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(paraboloidElement);
}
void G4GDMLWriteSolids::
PolyconeWrite(xercesc::DOMElement* solElement,
const G4Polycone* const polycone)
{
const G4String& name = GenerateName(polycone->GetName(),polycone);
xercesc::DOMElement* polyconeElement = NewElement("polycone");
polyconeElement->setAttributeNode(NewAttribute("name",name));
polyconeElement->setAttributeNode(NewAttribute("startphi",
xercesc::DOMElement* polyconeElement = NewElement("polycone");
polyconeElement->setAttributeNode(NewAttribute("name",name));
polyconeElement->setAttributeNode(NewAttribute("startphi",
polycone->GetOriginalParameters()->Start_angle/degree));
polyconeElement->setAttributeNode(NewAttribute("deltaphi",
polyconeElement->setAttributeNode(NewAttribute("deltaphi",
polycone->GetOriginalParameters()->Opening_angle/degree));
polyconeElement->setAttributeNode(NewAttribute("aunit","deg"));
polyconeElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyconeElement);
polyconeElement->setAttributeNode(NewAttribute("aunit","deg"));
polyconeElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyconeElement);
const size_t num_zplanes = polycone->GetOriginalParameters()->Num_z_planes;
const G4double* z_array = polycone->GetOriginalParameters()->Z_values;
const G4double* rmin_array = polycone->GetOriginalParameters()->Rmin;
const G4double* rmax_array = polycone->GetOriginalParameters()->Rmax;
const size_t num_zplanes = polycone->GetOriginalParameters()->Num_z_planes;
const G4double* z_array = polycone->GetOriginalParameters()->Z_values;
const G4double* rmin_array = polycone->GetOriginalParameters()->Rmin;
const G4double* rmax_array = polycone->GetOriginalParameters()->Rmax;
for (size_t i=0; i<num_zplanes; i++)
{
for (size_t i=0; i<num_zplanes; i++)
{
ZplaneWrite(polyconeElement,z_array[i],rmin_array[i],rmax_array[i]);
}
}
}
void G4GDMLWriteSolids::
GenericPolyconeWrite(xercesc::DOMElement* solElement,
const G4GenericPolycone* const polycone)
{
const G4String& name = GenerateName(polycone->GetName(),polycone);
xercesc::DOMElement* polyconeElement = NewElement("genericPolycone");
const G4double startPhi=polycone->GetStartPhi();
polyconeElement->setAttributeNode(NewAttribute("name",name));
polyconeElement->setAttributeNode(NewAttribute("startphi",
startPhi/degree));
polyconeElement->setAttributeNode(NewAttribute("deltaphi",
(polycone->GetEndPhi()-startPhi)/degree));
polyconeElement->setAttributeNode(NewAttribute("aunit","deg"));
polyconeElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyconeElement);
const size_t num_rzpoints = polycone->GetNumRZCorner();
for (size_t i=0; i<num_rzpoints; i++)
{
const G4double r_point=polycone->GetCorner(i).r;
const G4double z_point=polycone->GetCorner(i).z;
RZPointWrite(polyconeElement,r_point,z_point);
}
}
void G4GDMLWriteSolids::
@@ -442,33 +470,56 @@ PolyhedraWrite(xercesc::DOMElement* solElement,
const G4Polyhedra* const polyhedra)
{
const G4String& name = GenerateName(polyhedra->GetName(),polyhedra);
xercesc::DOMElement* polyhedraElement = NewElement("polyhedra");
polyhedraElement->setAttributeNode(NewAttribute("name",name));
polyhedraElement->setAttributeNode(NewAttribute("startphi",
if(polyhedra->IsGeneric() == false){
xercesc::DOMElement* polyhedraElement = NewElement("polyhedra");
polyhedraElement->setAttributeNode(NewAttribute("name",name));
polyhedraElement->setAttributeNode(NewAttribute("startphi",
polyhedra->GetOriginalParameters()->Start_angle/degree));
polyhedraElement->setAttributeNode(NewAttribute("deltaphi",
polyhedraElement->setAttributeNode(NewAttribute("deltaphi",
polyhedra->GetOriginalParameters()->Opening_angle/degree));
polyhedraElement->setAttributeNode(NewAttribute("numsides",
polyhedraElement->setAttributeNode(NewAttribute("numsides",
polyhedra->GetOriginalParameters()->numSide));
polyhedraElement->setAttributeNode(NewAttribute("aunit","deg"));
polyhedraElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyhedraElement);
polyhedraElement->setAttributeNode(NewAttribute("aunit","deg"));
polyhedraElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyhedraElement);
const size_t num_zplanes = polyhedra->GetOriginalParameters()->Num_z_planes;
const G4double* z_array = polyhedra->GetOriginalParameters()->Z_values;
const G4double* rmin_array = polyhedra->GetOriginalParameters()->Rmin;
const G4double* rmax_array = polyhedra->GetOriginalParameters()->Rmax;
const size_t num_zplanes = polyhedra->GetOriginalParameters()->Num_z_planes;
const G4double* z_array = polyhedra->GetOriginalParameters()->Z_values;
const G4double* rmin_array = polyhedra->GetOriginalParameters()->Rmin;
const G4double* rmax_array = polyhedra->GetOriginalParameters()->Rmax;
const G4double convertRad =
const G4double convertRad =
std::cos(0.5*polyhedra->GetOriginalParameters()->Opening_angle
/ polyhedra->GetOriginalParameters()->numSide);
for (size_t i=0;i<num_zplanes;i++)
{
for (size_t i=0;i<num_zplanes;i++)
{
ZplaneWrite(polyhedraElement,z_array[i],
rmin_array[i]*convertRad, rmax_array[i]*convertRad);
}
}
}else{//generic polyhedra
xercesc::DOMElement* polyhedraElement = NewElement("genericPolyhedra");
polyhedraElement->setAttributeNode(NewAttribute("name",name));
polyhedraElement->setAttributeNode(NewAttribute("startphi",
polyhedra->GetOriginalParameters()->Start_angle/degree));
polyhedraElement->setAttributeNode(NewAttribute("deltaphi",
polyhedra->GetOriginalParameters()->Opening_angle/degree));
polyhedraElement->setAttributeNode(NewAttribute("numsides",
polyhedra->GetOriginalParameters()->numSide));
polyhedraElement->setAttributeNode(NewAttribute("aunit","deg"));
polyhedraElement->setAttributeNode(NewAttribute("lunit","mm"));
solElement->appendChild(polyhedraElement);
const size_t num_rzpoints = polyhedra->GetNumRZCorner();
for (size_t i=0;i<num_rzpoints;i++)
{
const G4double r_point = polyhedra->GetCorner(i).r;
const G4double z_point = polyhedra->GetCorner(i).z;
RZPointWrite(polyhedraElement,r_point,z_point);
}
}
}
void G4GDMLWriteSolids::
@@ -479,7 +530,7 @@ SphereWrite(xercesc::DOMElement* solElement, const G4Sphere* const sphere)
xercesc::DOMElement* sphereElement = NewElement("sphere");
sphereElement->setAttributeNode(NewAttribute("name",name));
sphereElement->setAttributeNode(NewAttribute("rmin",
sphere->GetInsideRadius()/mm));
sphere->GetInnerRadius()/mm));
sphereElement->setAttributeNode(NewAttribute("rmax",
sphere->GetOuterRadius()/mm));
sphereElement->setAttributeNode(NewAttribute("startphi",
@@ -872,6 +923,16 @@ ZplaneWrite(xercesc::DOMElement* element, const G4double& z,
element->appendChild(zplaneElement);
}
void G4GDMLWriteSolids::
RZPointWrite(xercesc::DOMElement* element, const G4double& r,
const G4double& z)
{
xercesc::DOMElement* rzpointElement = NewElement("rzpoint");
rzpointElement->setAttributeNode(NewAttribute("r",r/mm));
rzpointElement->setAttributeNode(NewAttribute("z",z/mm));
element->appendChild(rzpointElement);
}
void G4GDMLWriteSolids::
OpticalSurfaceWrite(xercesc::DOMElement* solElement,
const G4OpticalSurface* const surf)
@@ -944,6 +1005,9 @@ void G4GDMLWriteSolids::AddSolid(const G4VSolid* const solidPtr)
if (const G4Polycone* const polyconePtr
= dynamic_cast<const G4Polycone*>(solidPtr))
{ PolyconeWrite(solidsElement,polyconePtr); } else
if (const G4GenericPolycone* const genpolyconePtr
= dynamic_cast<const G4GenericPolycone*>(solidPtr))
{ GenericPolyconeWrite(solidsElement,genpolyconePtr); } else
if (const G4Polyhedra* const polyhedraPtr
= dynamic_cast<const G4Polyhedra*>(solidPtr))
{ PolyhedraWrite(solidsElement,polyhedraPtr); } else
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4GDMLWriteStructure.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
// class G4GDMLWriteStructure Implementation
//
+1 -1
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// $Id: G4STRead.cc 68053 2013-03-13 14:39:51Z gcosmo $
//
// class G4STRead Implementation
//