G4tgrVolumeMgr.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: G4tgrVolumeMgr.hh 69803 2013-05-15 15:24:50Z gcosmo $
00028 //
00029 //
00030 // class G4tgrVolumeMgr
00031 //
00032 // Class description:
00033 //
00034 // Class to manage the detector units. It is a singleton.
00035 
00036 // History:
00037 // - Created.                                 P.Arce, CIEMAT (November 2007)
00038 // -------------------------------------------------------------------------
00039 
00040 #ifndef G4tgrVolumeMgr_h
00041 #define G4tgrVolumeMgr_h
00042 
00043 #include "globals.hh"
00044 #include "G4tgrSolid.hh"
00045 #include "G4tgrVolume.hh"
00046 #include "G4tgrPlace.hh"
00047 #include "G4tgrIsotope.hh"
00048 #include "G4tgrElement.hh"
00049 #include "G4tgrMaterial.hh"
00050 #include "G4tgrRotationMatrix.hh"
00051 
00052 #include <map>
00053 
00054 typedef std::map< G4String, G4tgrSolid* > G4mapssol;
00055 typedef std::map< G4String, G4tgrVolume* > G4mapsvol;
00056 typedef std::multimap< G4String, const G4tgrPlace* > G4mmapspl;
00057 
00058 //----------------------------------------------------------------------------  
00059 class G4tgrVolumeMgr 
00060 { 
00061   public:  // with description  
00062 
00063     static G4tgrVolumeMgr* GetInstance();  
00064       // Get the only instance 
00065 
00066     G4tgrSolid* CreateSolid( const std::vector<G4String>& wl, G4bool bVOLUtag );
00067 
00068     void RegisterParentChild( const G4String& parentName,
00069                               const G4tgrPlace* pl );
00070       // Add to theG4tgrVolumeTree
00071 
00072     G4tgrSolid* FindSolid( const G4String& name, G4bool exists = false );
00073       // Find a G4tgrSolid with name 'name'. If it is not found:
00074       // if exists is true, exit; if exists is false, return 0
00075 
00076     G4tgrVolume* FindVolume( const G4String& volname, G4bool exists = false );
00077       // Find a G4tgrVolume with name 'volname'. If it is not found:
00078       // if exists is true, exit; if exists is false, return 0
00079 
00080     std::vector<G4tgrVolume*> FindVolumes( const G4String& volname,
00081                                                  G4bool exists ); 
00082       // Find all G4tgrVolume's with name 'volname'. '*' can be used in the 
00083       // name to mean 'any character' or 'any substring'. If it is not found:
00084       // if exists is true, exit; if exists is false, return 0
00085 
00086     const G4tgrVolume* GetTopVolume();  
00087       // Find the top of the volume tree
00088 
00089     std::pair<G4mmapspl::iterator, G4mmapspl::iterator>
00090     GetChildren( const G4String& name );
00091       // Find the list of G4tgrPlace children of G4tgrVolume 'name'
00092 
00093     void DumpSummary();
00094       // Dump summary
00095     void DumpVolumeTree();
00096       // Dump to cout the tree of G4tgrVolume's
00097     void DumpVolumeLeaf( const G4tgrVolume* vol, unsigned int copyNo,
00098                          unsigned int leafDepth);
00099       // Dump a G4tgrVolume indicating its copy no
00100       // and its depth (number of ancestors)
00101 
00102     void RegisterMe( G4tgrSolid* vol);
00103     void UnRegisterMe( G4tgrSolid* vol );
00104     void RegisterMe( G4tgrVolume* vol);
00105     void UnRegisterMe( G4tgrVolume* vol );
00106     void RegisterMe( G4tgrPlace* pl ) { theG4tgrPlaceList.push_back( pl ); }
00107     void RegisterMe( G4tgrIsotope* iso ) { theHgIsotList.push_back( iso ); }
00108     void RegisterMe( G4tgrElement* ele ) { theHgElemList.push_back( ele ); }
00109     void RegisterMe( G4tgrMaterial* mat ) { theHgMateList.push_back( mat ); }
00110     void RegisterMe( G4tgrRotationMatrix* rm ) { theHgRotMList.push_back(rm); }
00111 
00112     // Accessors
00113 
00114     const G4mapssol& GetSolidMap() {return theG4tgrSolidMap;}
00115     const G4mapsvol& GetVolumeMap() {return theG4tgrVolumeMap;}
00116     const G4mmapspl& GetVolumeTree() {return theG4tgrVolumeTree;}
00117     std::vector<G4tgrVolume*> GetVolumeList() {return theG4tgrVolumeList;}
00118     std::vector<G4tgrPlace*> GetDetPlaceList() {return theG4tgrPlaceList;}
00119     std::vector<G4tgrIsotope*> GetIsotopeList() {return theHgIsotList;}
00120     std::vector<G4tgrElement*> GetElementList() {return theHgElemList;}
00121     std::vector<G4tgrMaterial*> GetMaterialList() {return theHgMateList;}
00122     std::vector<G4tgrRotationMatrix*> GetRotMList() {return theHgRotMList;}
00123 
00124   private:
00125 
00126     G4tgrVolumeMgr();
00127    ~G4tgrVolumeMgr();
00128 
00129   private:
00130 
00131     G4mapssol theG4tgrSolidMap;
00132       // Map of G4tgrSolid's: G4String is the G4tgrSolid name,
00133       // G4tgrSolid* the pointer to it
00134 
00135     G4mapsvol theG4tgrVolumeMap;
00136       // Map of G4tgrVolume's: G4String is the G4tgrVolume name,
00137       // G4tgrVolume* the pointer to it
00138 
00139     G4mmapspl theG4tgrVolumeTree;
00140       // Hierarchy tree of G4tgrVolume's: G4String is the name
00141       // of the parent G4tgrVolume, G4tgrPlace* the pointers to children
00142 
00143     static G4tgrVolumeMgr* theInstance;
00144 
00145     std::vector<G4tgrVolume*> theG4tgrVolumeList;
00146     std::vector<G4tgrPlace*> theG4tgrPlaceList;
00147     std::vector<G4tgrIsotope*> theHgIsotList;
00148     std::vector<G4tgrElement*> theHgElemList;
00149     std::vector<G4tgrMaterial*> theHgMateList;
00150     std::vector<G4tgrRotationMatrix*> theHgRotMList;
00151 };
00152 
00153 #endif

Generated on Mon May 27 17:50:00 2013 for Geant4 by  doxygen 1.4.7