Import Geant4 10.7.2 source tree
This commit is contained in:
@@ -15,6 +15,10 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
27 March 2021 - G.Cosmo (ascii-V10-06-03)
|
||||
- Fixed definition of generic polyhedra in G4tgbVolume::FindOrConstructG4Solid()
|
||||
for POLYHEDRA tag. Based on findings in GitHub PR#24 by P.Heidary.
|
||||
|
||||
8 October 2020 - G.Cosmo (ascii-V10-06-02)
|
||||
- Minor c++11 review. Code cleanup and formatting.
|
||||
|
||||
|
||||
@@ -429,11 +429,11 @@ G4VSolid* G4tgbVolume::FindOrConstructG4Solid(const G4tgrSolid* sol)
|
||||
G4bool genericPoly = false;
|
||||
if(solParam.size() == 4 + nplanes * 3)
|
||||
{
|
||||
genericPoly = true;
|
||||
genericPoly = false;
|
||||
}
|
||||
else if(solParam.size() == 4 + nplanes * 2)
|
||||
{
|
||||
genericPoly = false;
|
||||
genericPoly = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -16,6 +16,23 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
21 May 2021 Gabriele Cosmo (gdml-V10-06-07)
|
||||
- G4GDMLReadSolids: updated optical surface properties based on relatively
|
||||
recent introduction of DAVIS interface.
|
||||
Addressing problem report #2371.
|
||||
|
||||
17 March 2021 Witek Pokorski
|
||||
- Solves the problem #2343 of not all assemblies being written out to the GDML file.
|
||||
Fix provided by Laurie Nevay.
|
||||
|
||||
16 March 2021 Witek Pokorski
|
||||
- Solves the problem #2342 of multiUnion and assembly write creating degenerated names
|
||||
(position, rotation and nodes). Fix provided by Laurie Nevay.
|
||||
|
||||
4 March 2021 Witek Pokorski
|
||||
- Removed the hardcoded size 10000 in G4GDMLWrite causing the values in GDML truncated.
|
||||
Adressing problem report #2336. Fix by Tao Lin.
|
||||
|
||||
3 February 2021 Gabriele Cosmo (gdml-V10-06-06)
|
||||
- Fixed parsing of regions in G4GDMLParser::ImportRegions().
|
||||
Allow for proper deletion of meta-data lists in destructor.
|
||||
|
||||
@@ -132,7 +132,7 @@ class G4GDMLWrite
|
||||
xercesc::DOMDocument* doc = nullptr;
|
||||
xercesc::DOMElement* extElement = nullptr;
|
||||
xercesc::DOMElement* userinfoElement = nullptr;
|
||||
XMLCh tempStr[10000];
|
||||
|
||||
G4GDMLAuxListType auxList;
|
||||
G4bool overwriteOutputFile = false;
|
||||
};
|
||||
|
||||
@@ -3654,6 +3654,10 @@ void G4GDMLReadSolids::OpticalSurfaceRead(
|
||||
{
|
||||
model = LUT;
|
||||
}
|
||||
else if((smodel == "DAVIS") || (smodel == "3"))
|
||||
{
|
||||
model = DAVIS;
|
||||
}
|
||||
else
|
||||
{
|
||||
model = dichroic;
|
||||
@@ -3775,10 +3779,46 @@ void G4GDMLReadSolids::OpticalSurfaceRead(
|
||||
{
|
||||
finish = groundvm2000air;
|
||||
}
|
||||
else
|
||||
else if((sfinish == "groundvm2000glue") || (sfinish == "29"))
|
||||
{
|
||||
finish = groundvm2000glue;
|
||||
}
|
||||
else if((sfinish == "Rough_LUT") || (sfinish == "30"))
|
||||
{
|
||||
finish = Rough_LUT;
|
||||
}
|
||||
else if((sfinish == "RoughTeflon_LUT") || (sfinish == "31"))
|
||||
{
|
||||
finish = RoughTeflon_LUT;
|
||||
}
|
||||
else if((sfinish == "RoughESR_LUT") || (sfinish == "32"))
|
||||
{
|
||||
finish = RoughESR_LUT;
|
||||
}
|
||||
else if((sfinish == "RoughESRGrease_LUT") || (sfinish == "33"))
|
||||
{
|
||||
finish = RoughESRGrease_LUT;
|
||||
}
|
||||
else if((sfinish == "Polished_LUT") || (sfinish == "34"))
|
||||
{
|
||||
finish = Polished_LUT;
|
||||
}
|
||||
else if((sfinish == "PolishedTeflon_LUT") || (sfinish == "35"))
|
||||
{
|
||||
finish = PolishedTeflon_LUT;
|
||||
}
|
||||
else if((sfinish == "PolishedESR_LUT") || (sfinish == "36"))
|
||||
{
|
||||
finish = PolishedESR_LUT;
|
||||
}
|
||||
else if((sfinish == "PolishedESRGrease_LUT") || (sfinish == "37"))
|
||||
{
|
||||
finish = PolishedESRGrease_LUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
finish = Detector_LUT;
|
||||
}
|
||||
|
||||
if((stype == "dielectric_metal") || (stype == "0"))
|
||||
{
|
||||
@@ -3792,11 +3832,15 @@ void G4GDMLReadSolids::OpticalSurfaceRead(
|
||||
{
|
||||
type = dielectric_LUT;
|
||||
}
|
||||
else if((stype == "dielectric_dichroic") || (stype == "3"))
|
||||
else if((stype == "dielectric_LUTDAVIS") || (stype == "3"))
|
||||
{
|
||||
type = dielectric_LUTDAVIS;
|
||||
}
|
||||
else if((stype == "dielectric_dichroic") || (stype == "4"))
|
||||
{
|
||||
type = dielectric_dichroic;
|
||||
}
|
||||
else if((stype == "firsov") || (stype == "4"))
|
||||
else if((stype == "firsov") || (stype == "5"))
|
||||
{
|
||||
type = firsov;
|
||||
}
|
||||
|
||||
@@ -155,10 +155,15 @@ G4String G4GDMLWrite::GenerateName(const G4String& name, const void* const ptr)
|
||||
xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
|
||||
const G4String& value)
|
||||
{
|
||||
xercesc::XMLString::transcode(name, tempStr, 9999);
|
||||
XMLCh* tempStr = NULL;
|
||||
tempStr = xercesc::XMLString::transcode(name);
|
||||
xercesc::DOMAttr* att = doc->createAttribute(tempStr);
|
||||
xercesc::XMLString::transcode(value, tempStr, 9999);
|
||||
xercesc::XMLString::release(&tempStr);
|
||||
|
||||
tempStr = xercesc::XMLString::transcode(value);
|
||||
att->setValue(tempStr);
|
||||
xercesc::XMLString::release(&tempStr);
|
||||
|
||||
return att;
|
||||
}
|
||||
|
||||
@@ -166,22 +171,32 @@ xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
|
||||
xercesc::DOMAttr* G4GDMLWrite::NewAttribute(const G4String& name,
|
||||
const G4double& value)
|
||||
{
|
||||
xercesc::XMLString::transcode(name, tempStr, 9999);
|
||||
XMLCh* tempStr = NULL;
|
||||
tempStr = xercesc::XMLString::transcode(name);
|
||||
xercesc::DOMAttr* att = doc->createAttribute(tempStr);
|
||||
xercesc::XMLString::release(&tempStr);
|
||||
|
||||
std::ostringstream ostream;
|
||||
ostream.precision(15);
|
||||
ostream << value;
|
||||
G4String str = ostream.str();
|
||||
xercesc::XMLString::transcode(str, tempStr, 9999);
|
||||
|
||||
tempStr = xercesc::XMLString::transcode(str);
|
||||
att->setValue(tempStr);
|
||||
xercesc::XMLString::release(&tempStr);
|
||||
|
||||
return att;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
xercesc::DOMElement* G4GDMLWrite::NewElement(const G4String& name)
|
||||
{
|
||||
xercesc::XMLString::transcode(name, tempStr, 9999);
|
||||
return doc->createElement(tempStr);
|
||||
XMLCh* tempStr = NULL;
|
||||
tempStr = xercesc::XMLString::transcode(name);
|
||||
xercesc::DOMElement* elem = doc->createElement(tempStr);
|
||||
xercesc::XMLString::release(&tempStr);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -212,13 +227,17 @@ G4Transform3D G4GDMLWrite::Write(const G4String& fname,
|
||||
VolumeMap().clear(); // The module map is global for all modules,
|
||||
// so clear it only at once!
|
||||
|
||||
xercesc::XMLString::transcode("LS", tempStr, 9999);
|
||||
XMLCh* tempStr = NULL;
|
||||
tempStr = xercesc::XMLString::transcode("LS");
|
||||
xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
|
||||
xercesc::XMLString::transcode("Range", tempStr, 9999);
|
||||
xercesc::XMLString::release(&tempStr);
|
||||
tempStr = xercesc::XMLString::transcode("Range");
|
||||
xercesc::DOMImplementation* impl =
|
||||
xercesc::DOMImplementationRegistry::getDOMImplementation(tempStr);
|
||||
xercesc::XMLString::transcode("gdml", tempStr, 9999);
|
||||
xercesc::XMLString::release(&tempStr);
|
||||
tempStr = xercesc::XMLString::transcode("gdml");
|
||||
doc = impl->createDocument(0, tempStr, 0);
|
||||
xercesc::XMLString::release(&tempStr);
|
||||
xercesc::DOMElement* gdml = doc->getDocumentElement();
|
||||
|
||||
#if XERCES_VERSION_MAJOR >= 3
|
||||
|
||||
@@ -116,19 +116,19 @@ void G4GDMLWriteSolids::MultiUnionWrite(xercesc::DOMElement* solElement,
|
||||
xercesc::DOMElement* solidElement = NewElement("solid");
|
||||
solidElement->setAttributeNode(NewAttribute("ref", solidref));
|
||||
xercesc::DOMElement* multiUnionNodeElement = NewElement("multiUnionNode");
|
||||
multiUnionNodeElement->setAttributeNode(NewAttribute("name", nodeName));
|
||||
multiUnionNodeElement->setAttributeNode(NewAttribute("name", name+"_"+nodeName));
|
||||
multiUnionNodeElement->appendChild(solidElement); // Append solid to node
|
||||
if((std::fabs(pos.x()) > kLinearPrecision) ||
|
||||
(std::fabs(pos.y()) > kLinearPrecision) ||
|
||||
(std::fabs(pos.z()) > kLinearPrecision))
|
||||
{
|
||||
PositionWrite(multiUnionNodeElement, name + "_pos", pos);
|
||||
PositionWrite(multiUnionNodeElement,name+"_"+nodeName+"_pos",pos);
|
||||
}
|
||||
if((std::fabs(rot.x()) > kAngularPrecision) ||
|
||||
(std::fabs(rot.y()) > kAngularPrecision) ||
|
||||
(std::fabs(rot.z()) > kAngularPrecision))
|
||||
{
|
||||
RotationWrite(multiUnionNodeElement, name + "_rot", rot);
|
||||
RotationWrite(multiUnionNodeElement,name+"_"+nodeName+"_rot",rot);
|
||||
}
|
||||
multiUnionElement->appendChild(multiUnionNodeElement); // Append node
|
||||
}
|
||||
|
||||
@@ -303,14 +303,14 @@ void G4GDMLWriteStructure::AssemblyWrite(xercesc::DOMElement* volumeElement,
|
||||
std::fabs(pos.y()) > kLinearPrecision ||
|
||||
std::fabs(pos.z()) > kLinearPrecision)
|
||||
{
|
||||
PositionWrite(physvolElement, "Position_" + std::to_string(i5), pos);
|
||||
PositionWrite(physvolElement,name+"_position_" + std::to_string(i5), pos);
|
||||
}
|
||||
|
||||
if(std::fabs(rot.x()) > kAngularPrecision ||
|
||||
std::fabs(rot.y()) > kAngularPrecision ||
|
||||
std::fabs(rot.z()) > kAngularPrecision)
|
||||
{
|
||||
RotationWrite(physvolElement, "Rotation_" + std::to_string(i5), rot);
|
||||
RotationWrite(physvolElement,name+"_rotation_" + std::to_string(i5), rot);
|
||||
}
|
||||
++vit;
|
||||
}
|
||||
@@ -610,7 +610,7 @@ G4Transform3D G4GDMLWriteStructure::TraverseVolumeTree(
|
||||
daughterCount = 0;
|
||||
}
|
||||
|
||||
std::vector<G4int> addedImprints;
|
||||
std::map<G4int, std::vector<G4int> > assemblyIDToAddedImprints;
|
||||
|
||||
for(G4int i = 0; i < daughterCount; ++i) // Traverse all the children!
|
||||
{
|
||||
@@ -693,6 +693,7 @@ G4Transform3D G4GDMLWriteStructure::TraverseVolumeTree(
|
||||
{
|
||||
AssemblyWrite(structureElement, assemblyID);
|
||||
addedAssemblies.push_back(assemblyID);
|
||||
assemblyIDToAddedImprints[assemblyID] = std::vector<G4int>();
|
||||
}
|
||||
|
||||
// 2) add the assembly (as physical volume) to the mother volume
|
||||
@@ -701,10 +702,11 @@ G4Transform3D G4GDMLWriteStructure::TraverseVolumeTree(
|
||||
|
||||
// here I need a check if assembly has been already added to the
|
||||
// mother volume
|
||||
if(std::find(addedImprints.cbegin(), addedImprints.cend(),
|
||||
imprintID) == addedImprints.cend())
|
||||
std::vector<G4int>& addedImprints2 = assemblyIDToAddedImprints[assemblyID];
|
||||
if(std::find(addedImprints2.cbegin(), addedImprints2.cend(),
|
||||
imprintID) == addedImprints2.cend())
|
||||
{
|
||||
G4String imprintname = "Imprint_" + std::to_string(imprintID);
|
||||
G4String imprintname = "Imprint_" + std::to_string(imprintID) + "_";
|
||||
imprintname = GenerateName(imprintname, physvol);
|
||||
|
||||
// I need to get those two from the container of imprints from
|
||||
@@ -757,7 +759,7 @@ G4Transform3D G4GDMLWriteStructure::TraverseVolumeTree(
|
||||
|
||||
volumeElement->appendChild(physvolElement);
|
||||
//
|
||||
addedImprints.push_back(imprintID);
|
||||
addedImprints2.push_back(imprintID);
|
||||
}
|
||||
}
|
||||
else // not part of assembly, so a normal physical volume
|
||||
|
||||
Reference in New Issue
Block a user