Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
+28 -2
View File
@@ -1,4 +1,4 @@
$Id: History 104834 2017-06-21 08:42:45Z gcosmo $
$Id: History 106390 2017-10-09 09:42:18Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,8 +17,34 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
02 October 2017 Witek Pokorski (gdml-V10-03-09)
- Added handling of null pointer to material in case of parallel geometries
15 September 2017 Soon Yung Jun (gdml-V10-03-08)
- use GetPropertyMap and GetConstPropertyMap instead of GetPropertiesMap
and GetPropertiesCMap in G4GDMLWriteMaterials and G4GDMLWriteSolids
11 September 2017 Soon Yung Jun (gdml-V10-03-07)
- corresponding updates due to changes in G4MaterialPropertiesTable maps
in G4GDMLWriteMaterials and G4GDMLWriteSolids
23 August 2017 Gabriele Cosmo (gdml-V10-03-06)
- Handle all possible variants for G4TwistedTubs, included asymmetric ones.
Updated TwistedtubsRead/Write() in G4GDMLRead/WriteSolids accordingly.
Extended schema for coping with all possible parameters for G4TwistedTubs
shape (updated file gdml_solids.xsd). New GDML schema version 3.1.6.
Thanks to Yimin Wang (MIT) for reporting this.
17 August 2017 Gabriele Cosmo (gdml-V10-03-05)
- Fix in G4GDMLWriteSolids::TwistedtubsWrite() to correctly export
end-inner/outer radii for G4TwistedTubs shape.
13 July 2017 Gabriele Cosmo (gdml-V10-03-04)
- Added commands to G4GDMLMessenger for enable/disable stripping of names
for reading and for appending or not pointers to names for writing.
20 June 2017 Witek Pokorski (gdml-V10-03-03)
- added optical surface properties to the schema
- Added optical surface properties to the schema
12 June 2017 Gabriele Cosmo (gdml-V10-03-02)
- Added ability to export limited number of levels in the geometry hierarchy,
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLMessenger.hh 96673 2016-04-29 12:08:20Z gcosmo $
// $Id: G4GDMLMessenger.hh 105114 2017-07-13 09:49:54Z gcosmo $
//
//
// class G4GDMLMessenger
@@ -74,6 +74,10 @@ class G4GDMLMessenger : public G4UImessenger
G4UIcmdWithABool* RegionCmd;
G4UIcmdWithABool* EcutsCmd;
G4UIcmdWithABool* SDCmd;
G4UIcmdWithABool* StripCmd;
G4UIcmdWithABool* AppendCmd;
G4bool pFlag; // Append pointers to names flag
};
#endif
+1 -1
View File
@@ -198,7 +198,7 @@
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute fixed="3.1.5" name="version" type="xs:string">
<xs:attribute fixed="3.1.6" name="version" type="xs:string">
<xs:annotation>
<xs:documentation>The GDML Schema version consists of 3 digits X.Y.Z
where these mean:
+22 -10
View File
@@ -430,21 +430,33 @@
<xs:element name="twistedtubs" substitutionGroup="Solid">
<xs:annotation>
<xs:documentation>CSG twisted tube segement solid described by
twistedangle twist angle
endinnerrad inside radius at end of segment
endouterrad outside radius at end of segment
zlen z length of segment
phi phi angle of a segment </xs:documentation>
<xs:documentation>CSG twisted tube segment solid described by
twistedangle twist angle (constructors 1,2,3,4)
endinnerrad inside radius at end of segment (constructors 1,2)
endouterrad outside radius at end of segment (constructors 1,2)
midinnerrad inner radius at z=0 (constructors 3,4)
midouterrad outer radius at z=0 (constructors 3,4)
negativeEndz -ve z endplate (constructors 3,4)
positiveEndz +ve z endplate (constructors 3,4)
zlen z length of segment (constructors 1,2)
nseg number of segments in totalPhi (constructors 2,4)
totphi total angle of all segments (constructors 2,4)
phi phi angle of a segment (constructors 1,3)</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="SolidType">
<xs:attribute name="twistedangle" type="ExpressionOrIDREFType" use="required"></xs:attribute>
<xs:attribute name="endinnerrad" type="ExpressionOrIDREFType" use="required"></xs:attribute>
<xs:attribute name="endouterrad" type="ExpressionOrIDREFType" use="required"></xs:attribute>
<xs:attribute name="zlen" type="ExpressionOrIDREFType" use="required"></xs:attribute>
<xs:attribute name="phi" type="ExpressionOrIDREFType" use="required"></xs:attribute>
<xs:attribute default="0.0" name="endinnerrad" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0.0" name="endouterrad" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0.0" name="midinnerrad" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0.0" name="midouterrad" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0.0" name="negativeEndz" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0.0" name="positiveEndz" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0.0" name="zlen" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0" name="nseg" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0.0" name="totphi" type="ExpressionOrIDREFType"></xs:attribute>
<xs:attribute default="0.0" name="phi" type="ExpressionOrIDREFType"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
+31 -3
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLMessenger.cc 96673 2016-04-29 12:08:20Z gcosmo $
// $Id: G4GDMLMessenger.cc 105114 2017-07-13 09:49:54Z gcosmo $
//
//
// class G4GDMLMessenger Implementation
@@ -46,7 +46,7 @@
#include "G4SolidStore.hh"
G4GDMLMessenger::G4GDMLMessenger(G4GDMLParser* myPars)
: myParser(myPars), topvol(0)
: myParser(myPars), topvol(0), pFlag(true)
{
persistencyDir = new G4UIdirectory("/persistency/");
persistencyDir->SetGuidance("UI commands specific to persistency.");
@@ -68,6 +68,20 @@ G4GDMLMessenger::G4GDMLMessenger(G4GDMLParser* myPars)
WriterCmd->SetParameterName("filename",false);
WriterCmd->AvailableForStates(G4State_Idle);
StripCmd = new G4UIcmdWithABool("/persistency/gdml/strip_pointers",this);
StripCmd->SetGuidance("Enable/disable stripping of pointers on names");
StripCmd->SetGuidance("when reading a GDML file.");
StripCmd->SetParameterName("strip_pointers",true);
StripCmd->SetDefaultValue(true);
StripCmd->AvailableForStates(G4State_Idle);
AppendCmd = new G4UIcmdWithABool("/persistency/gdml/add_pointers",this);
AppendCmd->SetGuidance("Enable/disable appending of pointers to names");
AppendCmd->SetGuidance("when writing a GDML file.");
AppendCmd->SetParameterName("append_pointers",true);
AppendCmd->SetDefaultValue(true);
AppendCmd->AvailableForStates(G4State_Idle);
RegionCmd = new G4UIcmdWithABool("/persistency/gdml/export_regions",this);
RegionCmd->SetGuidance("Enable export of geometrical regions");
RegionCmd->SetGuidance("for storing production cuts.");
@@ -108,10 +122,24 @@ G4GDMLMessenger::~G4GDMLMessenger()
delete SDCmd;
delete persistencyDir;
delete gdmlDir;
delete StripCmd;
delete AppendCmd;
}
void G4GDMLMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == StripCmd )
{
G4bool mode = StripCmd->GetNewBoolValue(newValue);
myParser->SetStripFlag(mode);
}
if( command == AppendCmd )
{
pFlag = AppendCmd->GetNewBoolValue(newValue);
myParser->SetAddPointerToName(pFlag);
}
if( command == ReaderCmd )
{
G4GeometryManager::GetInstance()->OpenGeometry();
@@ -144,7 +172,7 @@ void G4GDMLMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
if( command == WriterCmd )
{
myParser->Write(newValue, topvol);
myParser->Write(newValue, topvol, pFlag);
}
if( command == ClearCmd )
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GDMLReadSolids.cc 103463 2017-04-11 07:22:55Z gcosmo $
// $Id: G4GDMLReadSolids.cc 105857 2017-08-24 07:52:24Z gcosmo $
//
// class G4GDMLReadSolids Implementation
//
@@ -2290,6 +2290,12 @@ TwistedtubsRead(const xercesc::DOMElement* const twistedtubsElement)
G4double endouterrad = 0.0;
G4double zlen = 0.0;
G4double phi = 0.0;
G4double totphi = 0.0;
G4double midinnerrad = 0.0;
G4double midouterrad = 0.0;
G4double positiveEndz = 0.0;
G4double negativeEndz = 0.0;
G4int nseg = 0;
const xercesc::DOMNamedNodeMap* const attributes
= twistedtubsElement->getAttributes();
@@ -2329,6 +2335,12 @@ TwistedtubsRead(const xercesc::DOMElement* const twistedtubsElement)
if (attName=="endinnerrad") { endinnerrad=eval.Evaluate(attValue); } else
if (attName=="endouterrad") { endouterrad=eval.Evaluate(attValue); } else
if (attName=="zlen") { zlen = eval.Evaluate(attValue); } else
if (attName=="midinnerrad") { midinnerrad=eval.Evaluate(attValue); } else
if (attName=="midouterrad") { midouterrad=eval.Evaluate(attValue); } else
if (attName=="negativeEndz") { negativeEndz = eval.Evaluate(attValue); } else
if (attName=="positiveEndz") { positiveEndz = eval.Evaluate(attValue); } else
if (attName=="nseg") { nseg = eval.Evaluate(attValue); } else
if (attName=="totphi") { totphi = eval.Evaluate(attValue); } else
if (attName=="phi") { phi = eval.Evaluate(attValue); }
}
@@ -2336,9 +2348,29 @@ TwistedtubsRead(const xercesc::DOMElement* const twistedtubsElement)
endinnerrad *= lunit;
endouterrad *= lunit;
zlen *= 0.5*lunit;
midinnerrad *= lunit;
midouterrad *= lunit;
positiveEndz *= lunit;
negativeEndz *= lunit;
phi *= aunit;
totphi *= aunit;
new G4TwistedTubs(name,twistedangle,endinnerrad,endouterrad,zlen,phi);
if (zlen != 0.0)
{
if (nseg != 0)
new G4TwistedTubs(name,twistedangle,endinnerrad,endouterrad,zlen,nseg,totphi);
else
new G4TwistedTubs(name,twistedangle,endinnerrad,endouterrad,zlen,phi);
}
else
{
if (nseg != 0)
new G4TwistedTubs(name,twistedangle,midinnerrad,midouterrad,
negativeEndz,positiveEndz,nseg,totphi);
else
new G4TwistedTubs(name,twistedangle,midinnerrad,midouterrad,
negativeEndz,positiveEndz,phi);
}
}
G4TwoVector G4GDMLReadSolids::
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteMaterials.cc 70764 2013-06-05 12:54:37Z gcosmo $
// $Id: G4GDMLWriteMaterials.cc 106194 2017-09-19 04:05:34Z gcosmo $
//
// class G4GDMLWriteMaterials Implementation
//
@@ -230,41 +230,50 @@ void G4GDMLWriteMaterials::PropertyWrite(xercesc::DOMElement* matElement,
{
xercesc::DOMElement* propElement;
G4MaterialPropertiesTable* ptable = mat->GetMaterialPropertiesTable();
const std::map< G4String, G4PhysicsOrderedFreeVector*,
std::less<G4String> >* pmap = ptable->GetPropertiesMap();
const std::map< G4String, G4double,
std::less<G4String> >* cmap = ptable->GetPropertiesCMap();
std::map< G4String, G4PhysicsOrderedFreeVector*,
std::less<G4String> >::const_iterator mpos;
std::map< G4String, G4double,
std::less<G4String> >::const_iterator cpos;
const std::map< G4MPindex, G4PhysicsOrderedFreeVector*,
std::less<G4MPindex> >* pmap = ptable->GetPropertyMap();
const std::map< G4MCPindex, G4double,
std::less<G4MCPindex> >* cmap = ptable->GetConstPropertyMap();
std::map< G4MPindex, G4PhysicsOrderedFreeVector*,
std::less<G4MPindex> >::const_iterator mpos;
std::map< G4MCPindex, G4double,
std::less<G4MCPindex> >::const_iterator cpos;
for (mpos=pmap->begin(); mpos!=pmap->end(); mpos++)
{
propElement = NewElement("property");
propElement->setAttributeNode(NewAttribute("name", mpos->first));
propElement->setAttributeNode(NewAttribute("name",
G4MaterialPropertyName[mpos->first]));
propElement->setAttributeNode(NewAttribute("ref",
GenerateName(mpos->first, mpos->second)));
GenerateName(G4MaterialPropertyName[mpos->first], mpos->second)));
if (mpos->second)
{
PropertyVectorWrite(mpos->first, mpos->second);
PropertyVectorWrite(G4MaterialPropertyName[mpos->first], mpos->second);
matElement->appendChild(propElement);
}
else
{
G4String warn_message = "Null pointer for material property -"
+ mpos->first + "- of material -" + mat->GetName() + "- !";
+ G4MaterialPropertyName[mpos->first] + "- of material -"
+ mat->GetName() + "- !";
G4Exception("G4GDMLWriteMaterials::PropertyWrite()", "NullPointer",
JustWarning, warn_message);
continue;
}
}
for (cpos=cmap->begin(); cpos!=cmap->end(); cpos++)
{
propElement = NewElement("property");
propElement->setAttributeNode(NewAttribute("name", cpos->first));
propElement->setAttributeNode(NewAttribute("ref", cpos->first));
propElement->setAttributeNode(NewAttribute("name",
G4MaterialConstPropertyName[cpos->first]));
propElement->setAttributeNode(NewAttribute("ref",
G4MaterialConstPropertyName[cpos->first]));
xercesc::DOMElement* constElement = NewElement("constant");
constElement->setAttributeNode(NewAttribute("name", cpos->first));
constElement->setAttributeNode(NewAttribute("name",
G4MaterialConstPropertyName[cpos->first]));
constElement->setAttributeNode(NewAttribute("value", cpos->second));
defineElement->appendChild(constElement);
matElement->appendChild(propElement);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteSolids.cc 103463 2017-04-11 07:22:55Z gcosmo $
// $Id: G4GDMLWriteSolids.cc 106194 2017-09-19 04:05:34Z gcosmo $
//
// class G4GDMLWriteSolids Implementation
//
@@ -991,12 +991,14 @@ TwistedtubsWrite(xercesc::DOMElement* solElement,
twistedtubsElement->setAttributeNode(NewAttribute("name",name));
twistedtubsElement->setAttributeNode(NewAttribute("twistedangle",
twistedtubs->GetPhiTwist()/degree));
twistedtubsElement->setAttributeNode(NewAttribute("endinnerrad",
twistedtubsElement->setAttributeNode(NewAttribute("midinnerrad",
twistedtubs->GetInnerRadius()/mm));
twistedtubsElement->setAttributeNode(NewAttribute("endouterrad",
twistedtubsElement->setAttributeNode(NewAttribute("midouterrad",
twistedtubs->GetOuterRadius()/mm));
twistedtubsElement->setAttributeNode(NewAttribute("zlen",
2.0*twistedtubs->GetZHalfLength()/mm));
twistedtubsElement->setAttributeNode(NewAttribute("negativeEndz",
twistedtubs->GetEndZ(0)/mm));
twistedtubsElement->setAttributeNode(NewAttribute("positiveEndz",
twistedtubs->GetEndZ(1)/mm));
twistedtubsElement->setAttributeNode(NewAttribute("phi",
twistedtubs->GetDPhi()/degree));
twistedtubsElement->setAttributeNode(NewAttribute("aunit","deg"));
@@ -1054,29 +1056,32 @@ void G4GDMLWriteSolids::PropertyWrite(xercesc::DOMElement* optElement,
{
xercesc::DOMElement* propElement;
G4MaterialPropertiesTable* ptable = surf->GetMaterialPropertiesTable();
const std::map< G4String, G4PhysicsOrderedFreeVector*,
std::less<G4String> >* pmap = ptable->GetPropertiesMap();
const std::map< G4String, G4double,
std::less<G4String> >* cmap = ptable->GetPropertiesCMap();
std::map< G4String, G4PhysicsOrderedFreeVector*,
std::less<G4String> >::const_iterator mpos;
std::map< G4String, G4double,
std::less<G4String> >::const_iterator cpos;
const std::map< G4MPindex, G4PhysicsOrderedFreeVector*,
std::less<G4MPindex> >* pmap = ptable->GetPropertyMap();
const std::map< G4MCPindex, G4double,
std::less<G4MCPindex> >* cmap = ptable->GetConstPropertyMap();
std::map< G4MPindex, G4PhysicsOrderedFreeVector*,
std::less<G4MPindex> >::const_iterator mpos;
std::map< G4MCPindex, G4double,
std::less<G4MCPindex> >::const_iterator cpos;
for (mpos=pmap->begin(); mpos!=pmap->end(); mpos++)
{
propElement = NewElement("property");
propElement->setAttributeNode(NewAttribute("name", mpos->first));
propElement->setAttributeNode(NewAttribute("name",
G4MaterialPropertyName[mpos->first]));
propElement->setAttributeNode(NewAttribute("ref",
GenerateName(mpos->first, mpos->second)));
GenerateName(G4MaterialPropertyName[mpos->first],
mpos->second)));
if (mpos->second)
{
PropertyVectorWrite(mpos->first, mpos->second);
PropertyVectorWrite(G4MaterialPropertyName[mpos->first], mpos->second);
optElement->appendChild(propElement);
}
else
{
G4String warn_message = "Null pointer for material property -"
+ mpos->first + "- of optical surface -" + surf->GetName() + "- !";
+ G4MaterialPropertyName[mpos->first]
+ "- of optical surface -" + surf->GetName() + "- !";
G4Exception("G4GDMLWriteSolids::PropertyWrite()", "NullPointer",
JustWarning, warn_message);
continue;
@@ -1085,10 +1090,13 @@ void G4GDMLWriteSolids::PropertyWrite(xercesc::DOMElement* optElement,
for (cpos=cmap->begin(); cpos!=cmap->end(); cpos++)
{
propElement = NewElement("property");
propElement->setAttributeNode(NewAttribute("name", cpos->first));
propElement->setAttributeNode(NewAttribute("ref", cpos->first));
propElement->setAttributeNode(NewAttribute("name",
G4MaterialConstPropertyName[cpos->first]));
propElement->setAttributeNode(NewAttribute("ref",
G4MaterialConstPropertyName[cpos->first]));
xercesc::DOMElement* constElement = NewElement("constant");
constElement->setAttributeNode(NewAttribute("name", cpos->first));
constElement->setAttributeNode(NewAttribute("name",
G4MaterialConstPropertyName[cpos->first]));
constElement->setAttributeNode(NewAttribute("value", cpos->second));
defineElement->appendChild(constElement);
optElement->appendChild(propElement);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4GDMLWriteStructure.cc 104688 2017-06-12 12:16:28Z gcosmo $
// $Id: G4GDMLWriteStructure.cc 106390 2017-10-09 09:42:18Z gcosmo $
//
// class G4GDMLWriteStructure Implementation
//
@@ -448,12 +448,18 @@ TraverseVolumeTree(const G4LogicalVolume* const volumePtr, const G4int depth)
const G4String name
= GenerateName(tmplv->GetName(), tmplv);
const G4String materialref
= GenerateName(volumePtr->GetMaterial()->GetName(),
volumePtr->GetMaterial());
const G4String solidref
= GenerateName(solidPtr->GetName(),solidPtr);
G4String materialref = "NULL";
if(volumePtr->GetMaterial())
{
materialref = GenerateName(volumePtr->GetMaterial()->GetName(),
volumePtr->GetMaterial());
}
const G4String solidref
= GenerateName(solidPtr->GetName(),solidPtr);
xercesc::DOMElement* volumeElement = NewElement("volume");
volumeElement->setAttributeNode(NewAttribute("name",name));
xercesc::DOMElement* materialrefElement = NewElement("materialref");