57   return (stat(fname.c_str(),&FileInfo) == 0); 
    91                              xercesc::DOMElement* element)
    93   for(std::vector<G4GDMLAuxStructType>::const_iterator
    94       iaux = auxInfoList->begin(); iaux != auxInfoList->end(); iaux++ )
    96     xercesc::DOMElement* auxiliaryElement = 
NewElement(
"auxiliary");
    97     element->appendChild(auxiliaryElement);
    99     auxiliaryElement->setAttributeNode(
NewAttribute(
"auxtype", (*iaux).type));
   100     auxiliaryElement->setAttributeNode(
NewAttribute(
"auxvalue", (*iaux).value));
   101     if (((*iaux).unit)!=
"")
   103       auxiliaryElement->setAttributeNode(
NewAttribute(
"auxunit", (*iaux).unit));
   106     if (iaux->auxList)  { 
AddAuxInfo(iaux->auxList, auxiliaryElement); }
   126    std::stringstream stream; stream << 
name;
   131    nameOut.erase(std::remove(nameOut.begin(),nameOut.end(),
' '),nameOut.end());
   139    xercesc::XMLString::transcode(name,
tempStr,9999);
   140    xercesc::DOMAttr* att = 
doc->createAttribute(
tempStr);
   141    xercesc::XMLString::transcode(value,
tempStr,9999);
   149    xercesc::XMLString::transcode(name,
tempStr,9999);
   150    xercesc::DOMAttr* att = 
doc->createAttribute(
tempStr);
   151    std::ostringstream ostream;
   152    ostream.precision(15);
   155    xercesc::XMLString::transcode(str,
tempStr,9999);
   162    xercesc::XMLString::transcode(name,
tempStr,9999);
   175    if (depth==0) { 
G4cout << 
"G4GDML: Writing '" << fname << 
"'..." << 
G4endl; }
   176    else   { 
G4cout << 
"G4GDML: Writing module '" << fname << 
"'..." << 
G4endl; }
   180      G4String ErrorMessage = 
"File '"+fname+
"' already exists!";
   181      G4Exception(
"G4GDMLWrite::Write()", 
"InvalidSetup",
   188    xercesc::XMLString::transcode(
"LS", 
tempStr, 9999);
   189      xercesc::DOMImplementationRegistry::getDOMImplementation(
tempStr);
   190    xercesc::XMLString::transcode(
"Range", 
tempStr, 9999);
   191    xercesc::DOMImplementation* impl =
   192      xercesc::DOMImplementationRegistry::getDOMImplementation(
tempStr);
   193    xercesc::XMLString::transcode(
"gdml", 
tempStr, 9999);
   195    xercesc::DOMElement* gdml = 
doc->getDocumentElement();
   197 #if XERCES_VERSION_MAJOR >= 3   199     xercesc::DOMLSSerializer* writer =
   200       ((xercesc::DOMImplementationLS*)impl)->createLSSerializer();
   202     xercesc::DOMConfiguration *dc = writer->getDomConfig();
   203     dc->setParameter(xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, 
true);
   207    xercesc::DOMWriter* writer =
   208      ((xercesc::DOMImplementationLS*)impl)->createDOMWriter();
   210    if (writer->canSetFeature(xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, 
true))
   211        writer->setFeature(xercesc::XMLUni::fgDOMWRTFormatPrettyPrint, 
true);
   216                           "http://www.w3.org/2001/XMLSchema-instance"));
   217    gdml->setAttributeNode(
NewAttribute(
"xsi:noNamespaceSchemaLocation",
   231    xercesc::XMLFormatTarget *myFormTarget =
   232      new xercesc::LocalFileFormatTarget(fname.c_str());
   236 #if XERCES_VERSION_MAJOR >= 3   238       xercesc::DOMLSOutput *theOutput =
   239         ((xercesc::DOMImplementationLS*)impl)->createLSOutput();
   240       theOutput->setByteStream(myFormTarget);
   241       writer->write(
doc, theOutput);
   243       writer->writeNode(myFormTarget, *
doc);
   246    catch (
const xercesc::XMLException& toCatch)
   248       char* message = xercesc::XMLString::transcode(toCatch.getMessage());
   249       G4cout << 
"G4GDML: Exception message is: " << message << 
G4endl;
   250       xercesc::XMLString::release(&message);
   253    catch (
const xercesc::DOMException& toCatch)
   255       char* message = xercesc::XMLString::transcode(toCatch.msg);
   256       G4cout << 
"G4GDML: Exception message is: " << message << 
G4endl;
   257       xercesc::XMLString::release(&message);
   271      G4cout << 
"G4GDML: Writing '" << fname << 
"' done !" << 
G4endl;
   275      G4cout << 
"G4GDML: Writing module '" << fname << 
"' done !" << 
G4endl;
   284    G4cout << 
"G4GDML: Adding module '" << fname << 
"'..." << 
G4endl;
   289                  "Invalid NULL pointer is specified for modularization!");
   292    if (dynamic_cast<const G4PVDivision*>(physvol))
   295                  "It is not possible to modularize by divisionvol!");
   301                  "It is not possible to modularize by parameterised volume!");
   307                  "It is not possible to modularize by replicated volume!");
   319                  "Depth must be a positive number!");
   324                  "Adding module(s) at this depth is already requested!");
   339      std::stringstream stream;
   340      stream << 
"depth" << depth << 
"_module" << 
DepthMap()[depth] << 
".gdml";
 
virtual void ExtensionWrite(xercesc::DOMElement *)
 
void AddAuxiliary(G4GDMLAuxStructType myaux)
 
void AddAuxInfo(G4GDMLAuxListType *auxInfoList, xercesc::DOMElement *element)
 
xercesc::DOMDocument * doc
 
virtual G4bool IsReplicated() const =0
 
G4bool FileExists(const G4String &) const
 
PhysVolumeMapType & PvolumeMap()
 
xercesc::DOMElement * NewElement(const G4String &)
 
G4bool contains(const std::string &) const
 
DepthMapType & DepthMap()
 
std::map< const G4VPhysicalVolume *, G4String > PhysVolumeMapType
 
G4String Modularize(const G4VPhysicalVolume *const topvol, const G4int depth)
 
G4Transform3D Write(const G4String &filename, const G4LogicalVolume *const topLog, const G4String &schemaPath, const G4int depth, G4bool storeReferences=true)
 
virtual void SetupWrite(xercesc::DOMElement *, const G4LogicalVolume *const)=0
 
G4GLOB_DLL std::ostream G4cout
 
virtual void StructureWrite(xercesc::DOMElement *)=0
 
virtual void DefineWrite(xercesc::DOMElement *)=0
 
virtual void MaterialsWrite(xercesc::DOMElement *)=0
 
G4String GenerateName(const G4String &, const void *const)
 
static void SetAddPointerToName(G4bool)
 
static G4bool addPointerToName
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
virtual G4bool IsParameterised() const =0
 
const G4String & GetName() const
 
void AddModule(const G4VPhysicalVolume *const topVol)
 
xercesc::DOMAttr * NewAttribute(const G4String &, const G4String &)
 
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
 
virtual G4Transform3D TraverseVolumeTree(const G4LogicalVolume *const, const G4int)=0
 
virtual void UserinfoWrite(xercesc::DOMElement *)
 
virtual void SolidsWrite(xercesc::DOMElement *)=0
 
virtual void AddExtension(xercesc::DOMElement *, const G4LogicalVolume *const)
 
static MCTruthManager * instance
 
G4GDMLAuxListType auxList
 
std::map< G4int, G4int > DepthMapType
 
virtual void SurfacesWrite()=0
 
VolumeMapType & VolumeMap()
 
std::map< const G4LogicalVolume *, G4Transform3D > VolumeMapType
 
xercesc::DOMElement * userinfoElement