Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4GDMLEvaluator.hh,v 1.10 2007/11/28 10:27:18 ztorzsok Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4GDMLEvaluator.hh,v 1.16 2008/07/16 15:46:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLEvaluator
@@ -42,24 +42,32 @@
#define _G4GDMLEVALUATOR_INCLUDED_
#include <CLHEP/Evaluator/Evaluator.h>
#include <vector>
#include "G4Types.hh"
#include "G4String.hh"
#include "G4Box.hh"
#include "globals.hh"
class G4GDMLEvaluator
{
public:
class G4GDMLEvaluator {
HepTool::Evaluator eval;
std::vector<G4String> variableList;
public:
G4GDMLEvaluator();
void defineConstant(const G4String&,G4double);
void defineVariable(const G4String&,G4double);
void setVariable(const G4String&,G4double);
void checkVariable(const G4String&);
void DefineConstant(const G4String&, G4double);
void DefineVariable(const G4String&, G4double);
void DefineMatrix(const G4String&, G4int, std::vector<G4double>);
void SetVariable(const G4String&, G4double);
G4bool IsVariable(const G4String&) const;
G4String SolveBrackets(const G4String&);
G4double Evaluate(const G4String&);
G4int EvaluateInteger(const G4String&);
G4double GetConstant(const G4String&);
G4double GetVariable(const G4String&);
private:
HepTool::Evaluator eval;
std::vector<G4String> variableList;
};
#endif
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLParameterisation.hh,v 1.10 2008/07/16 15:46:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLParameterisation
//
// Class description:
//
// GDML class for interpretation of parameterisations.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLPARAMETERISATION_INCLUDED_
#define _G4GDMLPARAMETERISATION_INCLUDED_
#include "G4VPVParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Box.hh"
#include "G4Trd.hh"
#include "G4Trap.hh"
#include "G4Cons.hh"
#include "G4Sphere.hh"
#include "G4Orb.hh"
#include "G4Torus.hh"
#include "G4Para.hh"
#include "G4Hype.hh"
#include "G4Tubs.hh"
#include "G4Polycone.hh"
#include "G4Polyhedra.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
#include <vector>
class G4GDMLParameterisation : public G4VPVParameterisation
{
public:
struct PARAMETER
{
G4RotationMatrix* pRot;
G4ThreeVector position;
G4double dimension[16];
PARAMETER() { memset(dimension,0,sizeof(dimension)); }
};
G4int GetSize() const;
void AddParameter(const PARAMETER&);
private:
void ComputeTransformation(const G4int,G4VPhysicalVolume*) const;
void ComputeDimensions(G4Box&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Trd&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Trap&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Cons&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Sphere&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Orb&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Torus&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Para&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Hype&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Tubs&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Polycone&,const G4int,const G4VPhysicalVolume*) const;
void ComputeDimensions(G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const;
private:
std::vector<PARAMETER> parameterList;
};
#endif
@@ -24,28 +24,97 @@
// ********************************************************************
//
//
// $Id: G4GDMLParser.hh,v 1.10 2007/11/30 11:58:46 ztorzsok Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4GDMLParser.hh,v 1.56 2008/12/04 08:31:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLParser
//
// Class description:
//
// GDML main parser.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLPARSER_INCLUDED_
#define _G4GDMLPARSER_INCLUDED_
#include "G4GDMLStructure.hh"
#include "G4GDMLReadStructure.hh"
#include "G4GDMLWriteStructure.hh"
#include "G4STRead.hh"
#define G4GDML_DEFAULT_SCHEMALOCATION G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
class G4GDMLParser
{
public: // with description
G4GDMLParser();
G4GDMLParser(G4GDMLReadStructure*);
~G4GDMLParser();
//
// Parser constructors & destructor
inline void Read(const G4String& filename, G4bool Validate=true);
//
// Imports geometry with world-volume, specified by the GDML filename
// in input. Validation against schema is activated by default.
inline void ReadModule(const G4String& filename, G4bool Validate=true);
//
// Imports a single GDML module, specified by the GDML filename
// in input. Validation against schema is activated by default.
inline void Write(const G4String& filename,
const G4VPhysicalVolume* const pvol = 0,
G4bool storeReferences = true,
const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
//
// Exports on a GDML file, specified by 'filename' a geometry tree
// starting from 'pvol' as top volume. Uniqueness of stored entities
// is guaranteed by storing pointer-references by default.
// Alternative path for the schema location can be specified; by default
// the URL to the GDML web site is used.
inline G4LogicalVolume* ParseST(const G4String& name,
G4Material* medium,
G4Material* solid);
//
// Imports a tessellated geometry stored as STEP-Tools files
// 'name.geom' and 'name.tree'. It returns a pointer of a generated
// mother volume with 'medium' material associated, including the
// imported tessellated geometry with 'solid' material associated.
// Methods for Reader
//
inline G4double GetConstant(const G4String& name);
inline G4double GetVariable(const G4String& name);
inline G4double GetQuantity(const G4String& name);
inline G4ThreeVector GetPosition(const G4String& name);
inline G4ThreeVector GetRotation(const G4String& name);
inline G4ThreeVector GetScale(const G4String& name);
inline G4GDMLMatrix GetMatrix(const G4String& name);
inline G4LogicalVolume* GetVolume(const G4String& name);
inline G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default");
inline G4GDMLAuxListType GetVolumeAuxiliaryInformation(const G4LogicalVolume* const logvol);
inline void StripNamePointers() const;
// Methods for Writer
//
inline void AddModule(const G4VPhysicalVolume* const physvol);
inline void AddModule(const G4int depth);
inline void SetAddPointerToName(G4bool set);
private:
G4GDMLReadStructure* reader;
G4GDMLWriteStructure* writer;
G4bool ucode;
class G4GDMLParser {
G4GDMLStructure structure;
public:
void Read(const G4String& fileName) { structure.Parse(fileName); }
G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default") { return structure.getTopVolume(setupName); }
};
#include "G4GDMLParser.icc"
#endif
@@ -0,0 +1,173 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLParser.icc,v 1.7 2008/11/20 15:33:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLParser inline methods
//
// -------------------------------------------------------------------------
inline
void G4GDMLParser::Read(const G4String& filename, G4bool Validate)
{
reader->Read(filename,Validate,false);
}
inline
void G4GDMLParser::ReadModule(const G4String& filename, G4bool Validate)
{
reader->Read(filename,Validate,true);
}
inline
void G4GDMLParser::Write(const G4String& filename,
const G4VPhysicalVolume* const pvol,
G4bool refs,
const G4String& SchemaLocation)
{
const G4int depth = 0;
G4LogicalVolume* lvol = 0;
if (!pvol)
{
G4VPhysicalVolume* worldPV = GetWorldVolume();
if (!worldPV)
{
G4Exception("G4DMLParser::Write()", "InvalidSetup", FatalException,
"Detector-Construction needs to be registered first!");
}
lvol = worldPV->GetLogicalVolume();
}
else
{
lvol = pvol->GetLogicalVolume();
}
writer->Write(filename,lvol,SchemaLocation,depth,refs);
}
inline
G4LogicalVolume* G4GDMLParser::ParseST(const G4String& filename,
G4Material* medium,
G4Material* solid)
{
G4STRead reader;
return reader.Read(filename, medium, solid);
}
//
// Methods for Reader
//
inline
G4double G4GDMLParser::GetConstant(const G4String& name)
{
return reader->GetConstant(name);
}
inline
G4double G4GDMLParser::GetVariable(const G4String& name)
{
return reader->GetVariable(name);
}
inline
G4double G4GDMLParser::GetQuantity(const G4String& name)
{
return reader->GetQuantity(name);
}
inline
G4ThreeVector G4GDMLParser::GetPosition(const G4String& name)
{
return reader->GetPosition(name);
}
inline
G4ThreeVector G4GDMLParser::GetRotation(const G4String& name)
{
return reader->GetRotation(name);
}
inline
G4ThreeVector G4GDMLParser::GetScale(const G4String& name)
{
return reader->GetScale(name);
}
inline
G4GDMLMatrix G4GDMLParser::GetMatrix(const G4String& name)
{
return reader->GetMatrix(name);
}
inline
G4LogicalVolume* G4GDMLParser::GetVolume(const G4String& name)
{
return reader->GetVolume(name);
}
inline
G4VPhysicalVolume* G4GDMLParser::GetWorldVolume(const G4String& setupName)
{
return reader->GetWorldVolume(setupName);
}
inline
G4GDMLAuxListType
G4GDMLParser::GetVolumeAuxiliaryInformation(const G4LogicalVolume* const logvol)
{
return reader->GetVolumeAuxiliaryInformation(logvol);
}
inline
void G4GDMLParser::StripNamePointers() const
{
reader->StripNames();
}
//
// Methods for Writer
//
inline
void G4GDMLParser::AddModule(const G4VPhysicalVolume* const physvol)
{
writer->AddModule(physvol);
}
inline
void G4GDMLParser::AddModule(const G4int depth)
{
writer->AddModule(depth);
}
inline
void G4GDMLParser::SetAddPointerToName(G4bool set)
{
writer->SetAddPointerToName(set);
}
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLRead.hh,v 1.26 2008/11/20 15:33:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4GDMLRead
//
// Class description:
//
// GDML reader.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLBASE_INCLUDED_
#define _G4GDMLBASE_INCLUDED_
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/dom/DOM.hpp>
#include "G4GDMLEvaluator.hh"
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4PVPlacement.hh"
#include <sstream>
class G4GDMLErrorHandler : public xercesc::ErrorHandler
{
G4bool Suppress;
public:
G4GDMLErrorHandler(const G4bool set) { Suppress = set; }
void warning(const xercesc::SAXParseException& exception)
{
if (Suppress) { return; }
char* message = xercesc::XMLString::transcode(exception.getMessage());
G4cout << "G4GDML: VALIDATION WARNING! " << message
<< " at line: " << exception.getLineNumber() << G4endl;
xercesc::XMLString::release(&message);
}
void error(const xercesc::SAXParseException& exception)
{
if (Suppress) { return; }
char* message = xercesc::XMLString::transcode(exception.getMessage());
G4cout << "G4GDML: VALIDATION ERROR! " << message
<< " at line: " << exception.getLineNumber() << G4endl;
xercesc::XMLString::release(&message);
}
void fatalError(const xercesc::SAXParseException& exception)
{
error(exception);
}
void resetErrors() {}
};
class G4GDMLRead
{
public: // with description
virtual void DefineRead(const xercesc::DOMElement* const)=0;
virtual void MaterialsRead(const xercesc::DOMElement* const)=0;
virtual void SetupRead(const xercesc::DOMElement* const)=0;
virtual void SolidsRead(const xercesc::DOMElement* const)=0;
virtual void Paramvol_contentRead(const xercesc::DOMElement* const)=0;
virtual void Volume_contentRead(const xercesc::DOMElement* const)=0;
virtual void StructureRead(const xercesc::DOMElement* const)=0;
//
// Pure virtual methods implemented in concrete reader plugin's classes
virtual void ExtensionRead(const xercesc::DOMElement* const);
//
// To be implemented in the client code for handling extensions
// to the GDML schema, identified with the tag "extension".
// The implementation should be placed inside a user-class
// inheriting from G4GDMLReadStructure and being registered
// as argument to G4GDMLParser.
virtual G4LogicalVolume* GetVolume(const G4String&) const=0;
virtual G4String GetSetup(const G4String&)=0;
//
// More pure virtual methods implemented in the reader plugin.
void Read(const G4String&, G4bool SetValidate, G4bool IsModule);
//
// Main method for reading GDML files.
void StripNames() const;
//
// Strip off pointers from entity IDs.
protected:
G4GDMLEvaluator eval;
G4bool Validate;
G4String Transcode(const XMLCh* const);
G4String GenerateName(const G4String& name, G4bool strip=false);
G4String Strip(const G4String&) const;
void StripName(G4String&) const;
void GeneratePhysvolName(const G4String&,G4VPhysicalVolume*);
void LoopRead(const xercesc::DOMElement* const,
void(G4GDMLRead::*)(const xercesc::DOMElement* const));
private:
G4int InLoop;
};
#endif
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// class G4GDMLReadDefine
//
// Class description:
//
// GDML class for positionings and transformations according to
// specifications in Geant4.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADDEFINE_INCLUDED_
#define _G4GDMLREADDEFINE_INCLUDED_
#include <map>
#include "G4ThreeVector.hh"
#include "G4GDMLRead.hh"
class G4GDMLMatrix
{
public:
G4GDMLMatrix();
G4GDMLMatrix(size_t rows0,size_t cols0);
~G4GDMLMatrix();
void Set(size_t r,size_t c,G4double a);
G4double Get(size_t r,size_t c) const;
size_t GetRows() const;
size_t GetCols() const;
private:
G4double *m;
size_t rows,cols;
};
class G4GDMLReadDefine : public G4GDMLRead
{
public:
G4double GetConstant(const G4String&);
G4double GetVariable(const G4String&);
G4double GetQuantity(const G4String&);
G4ThreeVector GetPosition(const G4String&);
G4ThreeVector GetRotation(const G4String&);
G4ThreeVector GetScale(const G4String&);
G4GDMLMatrix GetMatrix(const G4String&);
virtual void DefineRead(const xercesc::DOMElement* const);
protected:
G4RotationMatrix GetRotationMatrix(const G4ThreeVector&);
void VectorRead(const xercesc::DOMElement* const,G4ThreeVector&);
G4String RefRead(const xercesc::DOMElement* const);
void ConstantRead(const xercesc::DOMElement* const);
void MatrixRead(const xercesc::DOMElement* const);
void PositionRead(const xercesc::DOMElement* const);
void RotationRead(const xercesc::DOMElement* const);
void ScaleRead(const xercesc::DOMElement* const);
void VariableRead(const xercesc::DOMElement* const);
void QuantityRead(const xercesc::DOMElement* const);
protected:
std::map<G4String,G4double> quantityMap;
std::map<G4String,G4ThreeVector> positionMap;
std::map<G4String,G4ThreeVector> rotationMap;
std::map<G4String,G4ThreeVector> scaleMap;
std::map<G4String,G4GDMLMatrix> matrixMap;
};
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLReadMaterials.hh,v 1.9 2008/11/20 15:33:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLReadMaterials
//
// Class description:
//
// GDML class for loading isotopes, elements and materials according to
// specifications in Geant4.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADMATERIALS_INCLUDED_
#define _G4GDMLREADMATERIALS_INCLUDED_
#include "G4Element.hh"
#include "G4Isotope.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4GDMLReadDefine.hh"
class G4GDMLReadMaterials : public G4GDMLReadDefine
{
public:
G4Element* GetElement(const G4String&, G4bool verbose=true) const;
G4Isotope* GetIsotope(const G4String&, G4bool verbose=true) const;
G4Material* GetMaterial(const G4String&, G4bool verbose=true) const;
virtual void MaterialsRead(const xercesc::DOMElement* const);
protected:
G4double AtomRead(const xercesc::DOMElement* const);
G4int CompositeRead(const xercesc::DOMElement* const,G4String&);
G4double DRead(const xercesc::DOMElement* const);
G4double PRead(const xercesc::DOMElement* const);
G4double TRead(const xercesc::DOMElement* const);
void ElementRead(const xercesc::DOMElement* const);
G4double FractionRead(const xercesc::DOMElement* const,G4String&);
void IsotopeRead(const xercesc::DOMElement* const);
void MaterialRead(const xercesc::DOMElement* const);
void MixtureRead(const xercesc::DOMElement* const,G4Element*);
void MixtureRead(const xercesc::DOMElement* const,G4Material*);
void PropertyRead(const xercesc::DOMElement* const,G4Material*);
};
#endif
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLReadParamvol.hh,v 1.6 2008/11/20 15:33:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLReadParamvol
//
// Class description:
//
// GDML class for importing parameterised geometrical entities.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADPARAMVOL_INCLUDED_
#define _G4GDMLREADPARAMVOL_INCLUDED_
#include "G4LogicalVolume.hh"
#include "G4PVParameterised.hh"
#include "G4PVPlacement.hh"
#include "G4VPhysicalVolume.hh"
#include "G4GDMLParameterisation.hh"
#include "G4GDMLReadSetup.hh"
class G4GDMLReadParamvol : public G4GDMLReadSetup
{
public:
virtual void ParamvolRead(const xercesc::DOMElement* const,G4LogicalVolume*);
virtual void Paramvol_contentRead(const xercesc::DOMElement* const);
protected:
void Box_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Trd_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Trap_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Tube_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Cone_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Sphere_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Orb_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Torus_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Para_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void Hype_dimensionsRead(const xercesc::DOMElement* const,
G4GDMLParameterisation::PARAMETER&);
void ParameterisedRead(const xercesc::DOMElement* const);
void ParametersRead(const xercesc::DOMElement* const);
protected:
G4GDMLParameterisation* parameterisation;
};
#endif
@@ -24,36 +24,40 @@
// ********************************************************************
//
//
// $Id: G4GDMLSetup.hh,v 1.9 2007/11/29 13:13:06 ztorzsok Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4GDMLReadSetup.hh,v 1.5 2008/11/20 15:33:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLSetup
// class G4GDMLReadSetup
//
// Class description:
//
// GDML class for geometry setup of physical volumes.
// GDML class for geometry setup of solids.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLSETUP_INCLUDED_
#define _G4GDMLSETUP_INCLUDED_
#ifndef _G4GDMLREADSETUP_INCLUDED_
#define _G4GDMLREADSETUP_INCLUDED_
#include <map>
#include "G4String.hh"
#include "G4GDMLSolids.hh"
#include "G4GDMLReadSolids.hh"
class G4GDMLReadSetup : public G4GDMLReadSolids
{
public:
G4String GetSetup(const G4String&);
virtual void SetupRead(const xercesc::DOMElement* const element);
protected:
class G4GDMLSetup : public G4GDMLSolids {
private:
std::map<G4String,G4String> setupMap;
protected:
void setupRead(const xercesc::DOMElement* const element);
public:
G4String getSetup(const G4String&);
};
#endif
@@ -24,11 +24,11 @@
// ********************************************************************
//
//
// $Id: G4GDMLSolids.hh,v 1.16 2007/11/30 14:51:20 ztorzsok Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4GDMLReadSolids.hh,v 1.12 2008/11/21 09:32:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLSolids
// class G4GDMLReadSolids
//
// Class description:
//
@@ -38,18 +38,20 @@
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLSOLIDS_INCLUDED_
#define _G4GDMLSOLIDS_INCLUDED_
#ifndef _G4GDMLREADSOLIDS_INCLUDED_
#define _G4GDMLREADSOLIDS_INCLUDED_
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Ellipsoid.hh"
#include "G4EllipticalCone.hh"
#include "G4EllipticalTube.hh"
#include "G4ExtrudedSolid.hh"
#include "G4Hype.hh"
#include "G4IntersectionSolid.hh"
#include "G4Orb.hh"
#include "G4Para.hh"
#include "G4Paraboloid.hh"
#include "G4Polycone.hh"
#include "G4Polyhedra.hh"
#include "G4QuadrangularFacet.hh"
@@ -65,47 +67,61 @@
#include "G4Trd.hh"
#include "G4TriangularFacet.hh"
#include "G4Tubs.hh"
#include "G4TwistedBox.hh"
#include "G4TwistedTrap.hh"
#include "G4TwistedTrd.hh"
#include "G4TwistedTubs.hh"
#include "G4UnionSolid.hh"
#include "G4OpticalSurface.hh"
#include "G4SurfaceProperty.hh"
#include "G4GDMLMaterials.hh"
#include "G4GDMLReadMaterials.hh"
class G4GDMLSolids : public G4GDMLMaterials {
private:
class G4GDMLReadSolids : public G4GDMLReadMaterials
{
enum BooleanOp {UNION,SUBTRACTION,INTERSECTION};
typedef struct zplaneType { G4double rmin,rmax,z; };
typedef struct { G4double rmin,rmax,z; } zplaneType;
void booleanRead(const xercesc::DOMElement* const,const BooleanOp);
void boxRead(const xercesc::DOMElement* const);
void coneRead(const xercesc::DOMElement* const);
void ellipsoidRead(const xercesc::DOMElement* const);
void eltubeRead(const xercesc::DOMElement* const);
void hypeRead(const xercesc::DOMElement* const);
void loopRead(const xercesc::DOMElement* const);
void orbRead(const xercesc::DOMElement* const);
void paraRead(const xercesc::DOMElement* const);
void polyconeRead(const xercesc::DOMElement* const);
void polyhedraRead(const xercesc::DOMElement* const);
G4QuadrangularFacet* quadrangularRead(const xercesc::DOMElement* const);
G4String refRead(const xercesc::DOMElement* const);
void reflectedSolidRead(const xercesc::DOMElement* const);
G4ExtrudedSolid::ZSection sectionRead(const xercesc::DOMElement* const,G4double);
void sphereRead(const xercesc::DOMElement* const);
void tessellatedRead(const xercesc::DOMElement* const);
void tetRead(const xercesc::DOMElement* const);
void torusRead(const xercesc::DOMElement* const);
void trapRead(const xercesc::DOMElement* const);
void trdRead(const xercesc::DOMElement* const);
G4TriangularFacet* triangularRead(const xercesc::DOMElement* const);
void tubeRead(const xercesc::DOMElement* const);
G4TwoVector twoDimVertexRead(const xercesc::DOMElement* const,G4double);
void xtruRead(const xercesc::DOMElement* const);
zplaneType zplaneRead(const xercesc::DOMElement* const,G4double);
void solidsRead(const xercesc::DOMElement* const);
protected:
G4ThreeVector positionRead(const xercesc::DOMElement* const);
G4ThreeVector rotationRead(const xercesc::DOMElement* const);
G4ThreeVector scaleRead(const xercesc::DOMElement* const);
G4VSolid* getSolid(const G4String&) const;
public:
G4VSolid* GetSolid(const G4String&) const;
G4SurfaceProperty* GetSurfaceProperty(const G4String&) const;
virtual void SolidsRead(const xercesc::DOMElement* const);
protected:
void BooleanRead(const xercesc::DOMElement* const,const BooleanOp);
void BoxRead(const xercesc::DOMElement* const);
void ConeRead(const xercesc::DOMElement* const);
void ElconeRead(const xercesc::DOMElement* const);
void EllipsoidRead(const xercesc::DOMElement* const);
void EltubeRead(const xercesc::DOMElement* const);
void XtruRead(const xercesc::DOMElement* const);
void HypeRead(const xercesc::DOMElement* const);
void OrbRead(const xercesc::DOMElement* const);
void ParaRead(const xercesc::DOMElement* const);
void ParaboloidRead(const xercesc::DOMElement* const);
void PolyconeRead(const xercesc::DOMElement* const);
void PolyhedraRead(const xercesc::DOMElement* const);
G4QuadrangularFacet* QuadrangularRead(const xercesc::DOMElement* const);
void ReflectedSolidRead(const xercesc::DOMElement* const);
G4ExtrudedSolid::ZSection SectionRead(const xercesc::DOMElement* const,G4double);
void SphereRead(const xercesc::DOMElement* const);
void TessellatedRead(const xercesc::DOMElement* const);
void TetRead(const xercesc::DOMElement* const);
void TorusRead(const xercesc::DOMElement* const);
void TrapRead(const xercesc::DOMElement* const);
void TrdRead(const xercesc::DOMElement* const);
void TubeRead(const xercesc::DOMElement* const);
void TwistedboxRead(const xercesc::DOMElement* const);
void TwistedtrapRead(const xercesc::DOMElement* const);
void TwistedtrdRead(const xercesc::DOMElement* const);
void TwistedtubsRead(const xercesc::DOMElement* const);
G4TriangularFacet* TriangularRead(const xercesc::DOMElement* const);
G4TwoVector TwoDimVertexRead(const xercesc::DOMElement* const,G4double);
zplaneType ZplaneRead(const xercesc::DOMElement* const);
void OpticalsurfaceRead(const xercesc::DOMElement* const);
};
#endif
@@ -0,0 +1,105 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLReadStructure.hh,v 1.22 2008/11/20 15:33:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLReadStructure
//
// Class description:
//
// GDML class for import of structures.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLREADSTRUCTURE_INCLUDED_
#define _G4GDMLREADSTRUCTURE_INCLUDED_
#include "G4AssemblyVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4PVDivision.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SolidStore.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ReflectionFactory.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4PVDivisionFactory.hh"
#include "G4GDMLReadParamvol.hh"
struct G4GDMLAuxPairType
{
G4String type;
G4double value;
};
typedef std::vector<G4GDMLAuxPairType> G4GDMLAuxListType;
typedef std::map<const G4LogicalVolume*,G4GDMLAuxListType> G4GDMLAuxMapType;
class G4GDMLReadStructure : public G4GDMLReadParamvol
{
public:
G4VPhysicalVolume* GetPhysvol(const G4String&) const;
G4LogicalVolume* GetVolume(const G4String&) const;
G4GDMLAuxListType GetVolumeAuxiliaryInformation(const G4LogicalVolume* const);
G4VPhysicalVolume* GetWorldVolume(const G4String&);
virtual void VolumeRead(const xercesc::DOMElement* const);
virtual void Volume_contentRead(const xercesc::DOMElement* const);
virtual void StructureRead(const xercesc::DOMElement* const);
protected:
G4GDMLAuxPairType AuxiliaryRead(const xercesc::DOMElement* const);
void BordersurfaceRead(const xercesc::DOMElement* const);
void DivisionvolRead(const xercesc::DOMElement* const);
G4LogicalVolume* FileRead(const xercesc::DOMElement* const);
void PhysvolRead(const xercesc::DOMElement* const);
void ReplicavolRead(const xercesc::DOMElement* const, G4int number);
void ReplicaRead(const xercesc::DOMElement* const replicaElement,
G4LogicalVolume* logvol,G4int number);
EAxis AxisRead(const xercesc::DOMElement* const axisElement);
G4double QuantityRead(const xercesc::DOMElement* const readElement);
void SkinsurfaceRead(const xercesc::DOMElement* const);
protected:
G4GDMLAuxMapType auxMap;
G4LogicalVolume *pMotherLogical;
};
#endif
@@ -0,0 +1,107 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLWrite.hh,v 1.37 2008/08/19 15:03:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLWrite
//
// Class description:
//
// GDML writer.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITE_INCLUDED_
#define _G4GDMLWRITE_INCLUDED_
#include <sys/stat.h>
#include <iostream>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4PVDivision.hh"
class G4GDMLWrite
{
typedef std::map<const G4LogicalVolume*,G4Transform3D> VolumeMapType;
typedef std::map<const G4VPhysicalVolume*,G4String> PhysVolumeMapType;
typedef std::map<G4int,G4int> DepthMapType;
public: // without description
G4Transform3D Write(const G4String& filename,
const G4LogicalVolume* const topLog,
const G4String& schemaPath,
const G4int depth, G4bool storeReferences=true);
void AddModule(const G4VPhysicalVolume* const topVol);
void AddModule(const G4int depth);
static void SetAddPointerToName(G4bool);
protected:
G4String SchemaLocation;
VolumeMapType& VolumeMap();
G4String GenerateName(const G4String&,const void* const);
xercesc::DOMAttr* NewAttribute(const G4String&, const G4String&);
xercesc::DOMAttr* NewAttribute(const G4String&, const G4double&);
xercesc::DOMElement* NewElement(const G4String&);
virtual void DefineWrite(xercesc::DOMElement*)=0;
virtual void MaterialsWrite(xercesc::DOMElement*)=0;
virtual void SolidsWrite(xercesc::DOMElement*)=0;
virtual void StructureWrite(xercesc::DOMElement*)=0;
virtual G4Transform3D TraverseVolumeTree(const G4LogicalVolume* const,
const G4int)=0;
virtual void SetupWrite(xercesc::DOMElement*,
const G4LogicalVolume* const)=0;
G4String Modularize(const G4VPhysicalVolume* const topvol,
const G4int depth);
private:
G4bool FileExists(const G4String&) const;
PhysVolumeMapType& PvolumeMap();
DepthMapType& DepthMap();
private:
static G4bool addPointerToName;
xercesc::DOMDocument* doc;
XMLCh tempStr[100];
};
#endif
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLWriteDefine.hh,v 1.11 2008/07/16 15:46:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLWriteDefine
//
// Class description:
//
// GDML writer class for positionings and transformations.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITEDEFINE_INCLUDED_
#define _G4GDMLWRITEDEFINE_INCLUDED_
#include "G4GDMLWrite.hh"
#include <sstream>
class G4GDMLWriteDefine : public G4GDMLWrite
{
protected:
G4ThreeVector GetAngles(const G4RotationMatrix&);
void ScaleWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& scl)
{ Scale_vectorWrite(element,"scale",name,scl); }
void RotationWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& rot)
{ Rotation_vectorWrite(element,"rotation",name,rot); }
void PositionWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& pos)
{ Position_vectorWrite(element,"position",name,pos); }
void FirstrotationWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& rot)
{ Rotation_vectorWrite(element,"firstrotation",name,rot); }
void FirstpositionWrite(xercesc::DOMElement* element, const G4String& name,
const G4ThreeVector& pos)
{ Position_vectorWrite(element,"firstposition",name,pos); }
void AddPosition(const G4String& name,
const G4ThreeVector& pos)
{ Position_vectorWrite(defineElement,"position",name,pos); }
protected:
static const G4double kRelativePrecision;
static const G4double kAngularPrecision;
static const G4double kLinearPrecision;
private:
void Scale_vectorWrite(xercesc::DOMElement*, const G4String&,
const G4String&, const G4ThreeVector&);
void Rotation_vectorWrite(xercesc::DOMElement*, const G4String&,
const G4String&, const G4ThreeVector&);
void Position_vectorWrite(xercesc::DOMElement*, const G4String&,
const G4String&, const G4ThreeVector&);
void DefineWrite(xercesc::DOMElement*);
private:
xercesc::DOMElement* defineElement;
};
#endif
@@ -24,44 +24,55 @@
// ********************************************************************
//
//
// $Id: G4GDMLMaterials.hh,v 1.10 2007/11/30 11:58:46 ztorzsok Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4GDMLWriteMaterials.hh,v 1.12 2008/07/16 15:46:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLMaterials
// class G4GDMLWriteMaterials
//
// Class description:
//
// GDML class for loading isotopes, elements and materials according to
// specifications in Geant4.
// GDML class for writing materials definitions.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLMATERIALS_INCLUDED_
#define _G4GDMLMATERIALS_INCLUDED_
#include "G4GDMLDefine.hh"
#ifndef _G4GDMLWRITEMATERIALS_INCLUDED_
#define _G4GDMLWRITEMATERIALS_INCLUDED_
#include "G4Element.hh"
#include "G4Isotope.hh"
#include "G4Material.hh"
class G4GDMLMaterials : public G4GDMLDefine {
private:
G4double atomRead(const xercesc::DOMElement* const);
G4double DRead(const xercesc::DOMElement* const);
void elementRead(const xercesc::DOMElement* const);
G4double fractionRead(const xercesc::DOMElement* const,G4String&);
void isotopeRead(const xercesc::DOMElement* const);
void materialRead(const xercesc::DOMElement* const);
void mixtureRead(const xercesc::DOMElement* const,G4Element*);
void mixtureRead(const xercesc::DOMElement* const,G4Material*);
void materialsRead(const xercesc::DOMElement* const);
protected:
G4Isotope* getIsotope(const G4String&) const;
G4Material* getMaterial(const G4String&) const;
#include "G4GDMLWriteDefine.hh"
class G4GDMLWriteMaterials : public G4GDMLWriteDefine
{
protected:
void AddIsotope(const G4Isotope* const);
void AddElement(const G4Element* const);
void AddMaterial(const G4Material* const);
private:
void AtomWrite(xercesc::DOMElement*,const G4double&);
void DWrite(xercesc::DOMElement*,const G4double&);
void PWrite(xercesc::DOMElement*,const G4double&);
void TWrite(xercesc::DOMElement*,const G4double&);
void IsotopeWrite(const G4Isotope* const);
void ElementWrite(const G4Element* const);
void MaterialWrite(const G4Material* const);
void MaterialsWrite(xercesc::DOMElement*);
private:
std::vector<const G4Isotope*> isotopeList;
std::vector<const G4Element*> elementList;
std::vector<const G4Material*> materialList;
xercesc::DOMElement* materialsElement;
};
#endif
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLWriteParamvol.hh,v 1.10 2008/08/13 13:58:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLWriteParamvol
//
// Class description:
//
// GDML class for writing parameterised entities dimensions.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITEPARAMVOL_INCLUDED_
#define _G4GDMLWRITEPARAMVOL_INCLUDED_
#include "G4PVParameterised.hh"
#include "G4VPhysicalVolume.hh"
#include "G4GDMLWriteSetup.hh"
class G4GDMLWriteParamvol : public G4GDMLWriteSetup
{
protected:
void ParamvolWrite(xercesc::DOMElement*, const G4VPhysicalVolume* const);
private:
void Box_dimensionsWrite(xercesc::DOMElement*, const G4Box* const);
void Trd_dimensionsWrite(xercesc::DOMElement*, const G4Trd* const);
void Trap_dimensionsWrite(xercesc::DOMElement*, const G4Trap* const);
void Tube_dimensionsWrite(xercesc::DOMElement*, const G4Tubs* const);
void Cone_dimensionsWrite(xercesc::DOMElement*, const G4Cons* const);
void Sphere_dimensionsWrite(xercesc::DOMElement*, const G4Sphere* const);
void Orb_dimensionsWrite(xercesc::DOMElement*, const G4Orb* const);
void Torus_dimensionsWrite(xercesc::DOMElement*, const G4Torus* const);
void Para_dimensionsWrite(xercesc::DOMElement*, const G4Para* const);
void Hype_dimensionsWrite(xercesc::DOMElement*, const G4Hype* const);
void ParametersWrite(xercesc::DOMElement*,
const G4VPhysicalVolume* const, const G4int&);
void ParamvolAlgorithmWrite(xercesc::DOMElement* paramvolElement,
const G4VPhysicalVolume* const paramvol);
};
#endif
@@ -24,45 +24,30 @@
// ********************************************************************
//
//
// $Id: G4GDMLDefine.hh,v 1.11 2007/11/30 11:58:46 ztorzsok Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4GDMLWriteSetup.hh,v 1.7 2008/07/16 15:46:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLDefine
// class G4GDMLWriteSetup
//
// Class description:
//
// GDML class for positionings and transformations according to
// specifications in Geant4.
// GDML writer class for geometry setup of volumes.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLDEFINE_INCLUDED_
#define _G4GDMLDEFINE_INCLUDED_
#ifndef _G4GDMLWRITESETUP_INCLUDED_
#define _G4GDMLWRITESETUP_INCLUDED_
#include <map>
#include "G4GDMLWriteSolids.hh"
#include "G4ThreeVector.hh"
#include "G4GDMLBase.hh"
class G4GDMLWriteSetup : public G4GDMLWriteSolids
{
private:
class G4GDMLDefine : public G4GDMLBase {
private:
std::map<G4String,G4ThreeVector*> positionMap;
std::map<G4String,G4ThreeVector*> rotationMap;
std::map<G4String,G4ThreeVector*> scaleMap;
void constantRead(const xercesc::DOMElement* const);
void positionRead(const xercesc::DOMElement* const);
void rotationRead(const xercesc::DOMElement* const);
void scaleRead(const xercesc::DOMElement* const);
void variableRead(const xercesc::DOMElement* const);
void defineRead(const xercesc::DOMElement* const);
protected:
G4ThreeVector* getPosition(const G4String&);
G4ThreeVector* getRotation(const G4String&);
G4ThreeVector* getScale(const G4String&);
void SetupWrite(xercesc::DOMElement*, const G4LogicalVolume* const);
};
#endif
@@ -0,0 +1,118 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GDMLWriteSolids.hh,v 1.32 2008/11/21 09:32:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLWriteSolids
//
// Class description:
//
// GDML class for writing solids.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLWRITESOLIDS_INCLUDED_
#define _G4GDMLWRITESOLIDS_INCLUDED_
#include "G4BooleanSolid.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Ellipsoid.hh"
#include "G4EllipticalCone.hh"
#include "G4EllipticalTube.hh"
#include "G4ExtrudedSolid.hh"
#include "G4Hype.hh"
#include "G4Orb.hh"
#include "G4Para.hh"
#include "G4Paraboloid.hh"
#include "G4IntersectionSolid.hh"
#include "G4Polycone.hh"
#include "G4Polyhedra.hh"
#include "G4ReflectedSolid.hh"
#include "G4Sphere.hh"
#include "G4SubtractionSolid.hh"
#include "G4TessellatedSolid.hh"
#include "G4Tet.hh"
#include "G4Torus.hh"
#include "G4Trap.hh"
#include "G4Trd.hh"
#include "G4Tubs.hh"
#include "G4TwistedBox.hh"
#include "G4TwistedTrap.hh"
#include "G4TwistedTrd.hh"
#include "G4TwistedTubs.hh"
#include "G4UnionSolid.hh"
#include "G4GDMLWriteMaterials.hh"
class G4GDMLWriteSolids : public G4GDMLWriteMaterials
{
protected:
void AddSolid(const G4VSolid* const);
private:
void BooleanWrite(xercesc::DOMElement*, const G4BooleanSolid* const);
void BoxWrite(xercesc::DOMElement*, const G4Box* const);
void ConeWrite(xercesc::DOMElement*, const G4Cons* const);
void ElconeWrite(xercesc::DOMElement*, const G4EllipticalCone* const);
void EllipsoidWrite(xercesc::DOMElement*, const G4Ellipsoid* const);
void EltubeWrite(xercesc::DOMElement*, const G4EllipticalTube* const);
void XtruWrite(xercesc::DOMElement*, const G4ExtrudedSolid* const);
void HypeWrite(xercesc::DOMElement*, const G4Hype* const);
void OrbWrite(xercesc::DOMElement*, const G4Orb* const);
void ParaWrite(xercesc::DOMElement*, const G4Para* const);
void ParaboloidWrite(xercesc::DOMElement*, const G4Paraboloid* const);
void PolyconeWrite(xercesc::DOMElement*, const G4Polycone* const);
void PolyhedraWrite(xercesc::DOMElement*, const G4Polyhedra* const);
void SphereWrite(xercesc::DOMElement*, const G4Sphere* const);
void TessellatedWrite(xercesc::DOMElement*, const G4TessellatedSolid* const);
void TetWrite(xercesc::DOMElement*, const G4Tet* const);
void TorusWrite(xercesc::DOMElement*, const G4Torus* const);
void TrapWrite(xercesc::DOMElement*, const G4Trap* const);
void TrdWrite(xercesc::DOMElement*, const G4Trd* const);
void TubeWrite(xercesc::DOMElement*, const G4Tubs* const);
void TwistedboxWrite(xercesc::DOMElement*, const G4TwistedBox* const);
void TwistedtrapWrite(xercesc::DOMElement*, const G4TwistedTrap* const);
void TwistedtrdWrite(xercesc::DOMElement*, const G4TwistedTrd* const);
void TwistedtubsWrite(xercesc::DOMElement*, const G4TwistedTubs* const);
void ZplaneWrite(xercesc::DOMElement*, const G4double&,
const G4double&, const G4double&);
void SolidsWrite(xercesc::DOMElement*);
private:
std::vector<const G4VSolid*> solidList;
xercesc::DOMElement* solidsElement;
};
#endif
@@ -24,53 +24,53 @@
// ********************************************************************
//
//
// $Id: G4GDMLStructure.hh,v 1.16 2007/11/30 14:51:20 ztorzsok Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4GDMLWriteStructure.hh,v 1.34 2008/07/16 15:46:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4GDMLStructure
// class G4GDMLWriteStructure
//
// Class description:
//
// GDML class for loading physical volumes according to various
// specifications in Geant4.
// GDML class for export of structures.
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLSTRUCTURE_INCLUDED_
#define _G4GDMLSTRUCTURE_INCLUDED_
#ifndef _G4GDMLWRITESTRUCTURE_INCLUDED_
#define _G4GDMLWRITESTRUCTURE_INCLUDED_
#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4Material.hh"
#include "G4PVDivision.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SolidStore.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ReflectionFactory.hh"
#include "G4ReflectedSolid.hh"
#include "G4Transform3D.hh"
#include "G4GDMLSetup.hh"
#include "G4GDMLWriteParamvol.hh"
class G4GDMLStructure : public G4GDMLSetup {
private:
EAxis directionRead(const xercesc::DOMElement* const);
void divisionvolRead(const xercesc::DOMElement* const,G4LogicalVolume*);
G4LogicalVolume* fileRead(const xercesc::DOMElement* const);
void loopRead(const xercesc::DOMElement* const);
void paramvolRead(const xercesc::DOMElement* const,G4LogicalVolume*);
void physvolRead(const xercesc::DOMElement* const,G4LogicalVolume*);
G4double quantityRead(const xercesc::DOMElement* const);
G4String refRead(const xercesc::DOMElement* const);
void replicate_along_axisRead(const xercesc::DOMElement* const,G4double&,G4double&,EAxis&);
void replicavolRead(const xercesc::DOMElement* const,G4LogicalVolume*);
void volumeRead(const xercesc::DOMElement* const);
void volume_contentRead(const xercesc::DOMElement* const,G4LogicalVolume*);
void volume_loopRead(const xercesc::DOMElement* const,G4LogicalVolume*);
void structureRead(const xercesc::DOMElement* const);
protected:
G4LogicalVolume* getVolume(const G4String&) const;
class G4GDMLWriteStructure : public G4GDMLWriteParamvol
{
private:
void DivisionvolWrite(xercesc::DOMElement*,const G4PVDivision* const);
void PhysvolWrite(xercesc::DOMElement*,const G4VPhysicalVolume* const topVol,
const G4Transform3D& transform,
const G4String& moduleName);
void ReplicavolWrite(xercesc::DOMElement*,const G4VPhysicalVolume* const);
void StructureWrite(xercesc::DOMElement*);
G4Transform3D TraverseVolumeTree(const G4LogicalVolume* const topVol,
const G4int depth);
private:
xercesc::DOMElement* structureElement;
static const int maxReflections = 8; // Constant for limiting the number
// of displacements/reflections applied
// to a single solid
};
#endif
@@ -24,56 +24,60 @@
// ********************************************************************
//
//
// $Id: G4GDMLBase.hh,v 1.3 2007/11/30 11:58:46 ztorzsok Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4STRead.hh,v 1.3 2008/07/17 14:05:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4GDMLBase
//
// class G4STRead
//
// Class description:
//
// GDML class for import of triangularised geometry descriptions
// (.geom and .tree structures) generated out of STEP files from
// CAD systems (STWriter STEP Tool and similar...).
// History:
// - Created. Zoltan Torzsok, November 2007
// -------------------------------------------------------------------------
#ifndef _G4GDMLBASE_INCLUDED_
#define _G4GDMLBASE_INCLUDED_
#ifndef _G4STREAD_INCLUDED_
#define _G4STREAD_INCLUDED_
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/dom/DOM.hpp>
#include <sstream>
#include <fstream>
#include <vector>
#include <map>
#include "G4TessellatedSolid.hh"
#include "G4QuadrangularFacet.hh"
#include "G4TriangularFacet.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4VisAttributes.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4GDMLEvaluator.hh"
class G4STRead
{
public: // with description
class G4GDMLBase {
private:
xercesc::XercesDOMParser* parser; // This should be a static member
G4String prename;
protected:
G4GDMLEvaluator eval;
G4LogicalVolume* Read(const G4String&, G4Material* mediumMaterial,
G4Material* solidMaterial);
private:
G4String GenerateName(const G4String&);
void TessellatedRead(const std::string&);
void FacetRead(const std::string&);
void PhysvolRead(const std::string&);
void ReadGeom(const G4String&);
void ReadTree(const G4String&);
virtual void defineRead(const xercesc::DOMElement* const)=0;
virtual void materialsRead(const xercesc::DOMElement* const)=0;
virtual void solidsRead(const xercesc::DOMElement* const)=0;
virtual void structureRead(const xercesc::DOMElement* const)=0;
virtual void setupRead(const xercesc::DOMElement* const)=0;
private:
virtual G4LogicalVolume* getVolume(const G4String&) const=0;
virtual G4String getSetup(const G4String&)=0;
public:
G4GDMLBase();
~G4GDMLBase();
void Parse(const G4String& fileName);
G4PVPlacement* getTopVolume(const G4String& setupName);
G4Box* world_box;
G4ThreeVector world_extent;
G4Material* solid_material;
G4Material* medium_material;
G4LogicalVolume* world_volume;
std::vector<G4TessellatedSolid*> tessellatedList;
std::map<G4TessellatedSolid*,G4LogicalVolume*> volumeMap;
};
#endif