G4tgbGeometryDumper.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 // class G4tgbGeometryDumper
00028 //
00029 // Class description:
00030 //
00031 // Class for dumping the whole geometry.
00032 
00033 // History:
00034 // - Created.                                 P.Arce, CIEMAT (November 2007)
00035 // -------------------------------------------------------------------------
00036 
00037 #ifndef G4tgbGeometryDumper_HH
00038 #define G4tgbGeometryDumper_HH
00039 
00040 #include "globals.hh"
00041 #include "G4RotationMatrix.hh"
00042 
00043 #include <fstream>
00044 #include <map>
00045 #include <vector>
00046 
00047 class G4Material;
00048 class G4Element;
00049 class G4Isotope;
00050 class G4VSolid;
00051 class G4LogicalVolume;
00052 class G4VPhysicalVolume;
00053 class G4PVParameterised;
00054 class G4PVReplica;
00055 
00056 class G4tgbGeometryDumper
00057 {
00058 
00059   public:  // with description
00060 
00061     static G4tgbGeometryDumper* GetInstance();
00062     ~G4tgbGeometryDumper();
00063 
00064     void DumpGeometry(const G4String& fname );
00065     G4VPhysicalVolume* GetTopPhysVol();
00066     void DumpPhysVol( G4VPhysicalVolume* pv );
00067     void DumpPVPlacement( G4VPhysicalVolume* pv, const G4String& lvName,
00068                           G4int copyNo = -999 );
00069     void DumpPVParameterised( G4PVParameterised* pv );
00070     void DumpPVReplica( G4PVReplica* pv, const G4String& lvName );
00071     G4String DumpLogVol( G4LogicalVolume* lv, G4String extraName = "",
00072                          G4VSolid* solid = 0, G4Material* mate = 0);
00073     G4String DumpMaterial( G4Material* mat );
00074     void DumpElement( G4Element* ele);
00075     void DumpIsotope( G4Isotope* ele);
00076     G4String DumpSolid( G4VSolid* solid, const G4String& extraName = "" );
00077     void DumpBooleanVolume( const G4String& solidType, G4VSolid* so );
00078     void DumpSolidParams(G4VSolid * so);
00079     std::vector<G4double> GetSolidParams( const G4VSolid * so);
00080     void DumpPolySections(G4int zPlanes, G4double* z,
00081                           G4double *rmin, G4double *rmax);
00082     G4String DumpRotationMatrix( G4RotationMatrix* rotm );
00083 
00084   private:
00085 
00086     G4tgbGeometryDumper();
00087 
00088   private:
00089 
00090     std::vector<G4VPhysicalVolume*> GetPVChildren( G4LogicalVolume* lv );
00091     G4String GetTGSolidType( const G4String& solidtype );
00092     G4double MatDeterminant(G4RotationMatrix * ro) ;
00093     G4double approxTo0( G4double val );
00094     G4String AddQuotes( const G4String& str );
00095 
00096     G4String GetIsotopeName( G4Isotope* );
00097     template< class TYP> G4String GetObjectName( TYP* obj,
00098                          std::map<G4String,TYP*> objectsDumped );
00099     G4bool CheckIfLogVolExists( const G4String& name, G4LogicalVolume* pt );
00100     G4bool CheckIfPhysVolExists( const G4String& name, G4VPhysicalVolume* );
00101     G4String LookForExistingRotation( const G4RotationMatrix* rotm );
00102     G4String SupressRefl( G4String name );
00103     G4String SubstituteRefl( G4String name );
00104     G4bool Same2G4Isotopes( G4Isotope* ele1, G4Isotope* ele2 );
00105     const G4String& FindSolidName( G4VSolid* solid );
00106 
00107   private:
00108 
00109     static G4tgbGeometryDumper* theInstance;
00110 
00111     std::ofstream* theFile;
00112 
00113     std::map<G4String,G4Material*> theMaterials;
00114     std::map<G4String,G4Element*> theElements;
00115     std::map<G4String,G4Isotope*> theIsotopes;
00116     std::map<G4String,G4VSolid*> theSolids;
00117     std::map<G4String,G4LogicalVolume*> theLogVols;
00118     std::map<G4String,G4VPhysicalVolume*> thePhysVols;
00119     std::map<G4String,G4RotationMatrix*> theRotMats;
00120 
00121     G4int theRotationNumber;
00122 };
00123 
00124 #endif

Generated on Mon May 27 17:49:57 2013 for Geant4 by  doxygen 1.4.7