G4GDMLParser.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //
00030 // class G4GDMLParser
00031 //
00032 // Class description:
00033 //
00034 // GDML main parser.
00035 
00036 // History:
00037 // - Created.                                  Zoltan Torzsok, November 2007
00038 // -------------------------------------------------------------------------
00039  
00040 #ifndef _G4GDMLPARSER_INCLUDED_
00041 #define _G4GDMLPARSER_INCLUDED_
00042 
00043 #include "G4GDMLReadStructure.hh"
00044 #include "G4GDMLWriteStructure.hh"
00045 #include "G4STRead.hh"
00046 #include "G4GDMLMessenger.hh"
00047 
00048 #include "G4TransportationManager.hh"
00049 #include "G4Navigator.hh"
00050 
00051 
00052 #define G4GDML_DEFAULT_SCHEMALOCATION G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
00053 
00054 class G4GDMLParser
00055 {
00056   public:  // with description
00057 
00058    G4GDMLParser();
00059    G4GDMLParser(G4GDMLReadStructure*);
00060    G4GDMLParser(G4GDMLReadStructure*, G4GDMLWriteStructure*);
00061   ~G4GDMLParser();
00062      //
00063      // Parser constructors & destructor
00064 
00065    inline void Read(const G4String& filename, G4bool Validate=true);
00066      //
00067      // Imports geometry with world-volume, specified by the GDML filename
00068      // in input. Validation against schema is activated by default.
00069 
00070    inline void ReadModule(const G4String& filename, G4bool Validate=true);
00071      //
00072      // Imports a single GDML module, specified by the GDML filename
00073      // in input. Validation against schema is activated by default.
00074 
00075    inline void Write(const G4String& filename,
00076                      const G4VPhysicalVolume* pvol = 0,
00077                            G4bool storeReferences = true,
00078                      const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
00079      //
00080      // Exports on a GDML file, specified by 'filename' a geometry tree
00081      // starting from 'pvol' as top volume. Uniqueness of stored entities
00082      // is guaranteed by storing pointer-references by default.
00083      // Alternative path for the schema location can be specified; by default
00084      // the URL to the GDML web site is used.
00085 
00086    inline void Write(const G4String& filename,
00087                      const G4LogicalVolume* lvol,
00088                            G4bool storeReferences = true,
00089                      const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
00090      //
00091      // Exports on a GDML file, specified by 'filename' a geometry tree
00092      // starting from 'pvol' as top volume. Uniqueness of stored entities
00093      // is guaranteed by storing pointer-references by default.
00094      // Alternative path for the schema location can be specified; by default
00095      // the URL to the GDML web site is used. Same as method above except
00096      // that the logical volume must be provided here.
00097 
00098    inline G4LogicalVolume* ParseST(const G4String& name,
00099                                          G4Material* medium,
00100                                          G4Material* solid);
00101      //
00102      // Imports a tessellated geometry stored as STEP-Tools files
00103      // 'name.geom' and 'name.tree'. It returns a pointer of a generated
00104      // mother volume with 'medium' material associated, including the
00105      // imported tessellated geometry with 'solid' material associated.
00106 
00107    // Methods for Reader
00108    //
00109    inline G4bool IsValid(const G4String& name) const;
00110    inline G4double GetConstant(const G4String& name) const;
00111    inline G4double GetVariable(const G4String& name) const;
00112    inline G4double GetQuantity(const G4String& name) const;
00113    inline G4ThreeVector GetPosition(const G4String& name) const;
00114    inline G4ThreeVector GetRotation(const G4String& name) const;
00115    inline G4ThreeVector GetScale(const G4String& name) const;
00116    inline G4GDMLMatrix GetMatrix(const G4String& name) const;
00117    inline G4LogicalVolume* GetVolume(const G4String& name) const;
00118    inline G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default") const;
00119    inline G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume* logvol) const;
00120    inline const G4GDMLAuxMapType* GetAuxMap() const;
00121    inline void StripNamePointers() const;
00122    inline void SetStripFlag(G4bool);
00123    inline void SetOverlapCheck(G4bool);
00124    inline void Clear();                  // Clears the evaluator
00125 
00126    // Methods for Writer
00127    //
00128    inline void AddModule(const G4VPhysicalVolume* const physvol);
00129    inline void AddModule(const G4int depth);
00130    inline void SetAddPointerToName(G4bool set);
00131 
00132   private:
00133 
00134    G4GDMLReadStructure* reader;
00135    G4GDMLWriteStructure* writer;
00136    G4GDMLMessenger* messenger;
00137    G4bool urcode, uwcode, strip;
00138 
00139 };
00140 
00141 #include "G4GDMLParser.icc"
00142 
00143 #endif

Generated on Mon May 27 17:48:19 2013 for Geant4 by  doxygen 1.4.7