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
+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");