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.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /persistency/ascii/include/G4tgbVolumeMgr.hh (Version 11.3.0) and /persistency/ascii/include/G4tgbVolumeMgr.hh (Version 10.7.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4tgbVolumeMgr                                  26 // G4tgbVolumeMgr
 27 //                                                 27 //
 28 // Class description:                              28 // Class description:
 29 //                                                 29 //
 30 // Class to manage volumes: G4VSolids, G4Logic     30 // Class to manage volumes: G4VSolids, G4LogicalVolumes, G4VPhysicalVolumes.
 31 // It is a singleton, accesed always through c     31 // It is a singleton, accesed always through calls to GetInstance().
 32                                                    32 
 33 // Author: P.Arce, CIEMAT (November 2007)          33 // Author: P.Arce, CIEMAT (November 2007)
 34 // -------------------------------------------     34 // --------------------------------------------------------------------
 35 #ifndef G4tgbVolumeMgr_hh                          35 #ifndef G4tgbVolumeMgr_hh
 36 #define G4tgbVolumeMgr_hh 1                        36 #define G4tgbVolumeMgr_hh 1
 37                                                    37 
 38 #include "globals.hh"                              38 #include "globals.hh"
 39                                                    39 
 40 #include <string>                                  40 #include <string>
 41 #include <vector>                                  41 #include <vector>
 42 #include <map>                                     42 #include <map>
 43                                                    43 
 44 #include "G4VSolid.hh"                             44 #include "G4VSolid.hh"
 45 #include "G4LogicalVolume.hh"                      45 #include "G4LogicalVolume.hh"
 46 #include "G4VPhysicalVolume.hh"                    46 #include "G4VPhysicalVolume.hh"
 47                                                    47 
 48 class G4tgbVolume;                                 48 class G4tgbVolume;
 49 class G4tgrVolume;                                 49 class G4tgrVolume;
 50 class G4tgbDetectorBuilder;                        50 class G4tgbDetectorBuilder;
 51                                                    51 
 52 using G4mssvol = std::map<G4String, G4tgbVolum     52 using G4mssvol = std::map<G4String, G4tgbVolume*>;
 53 using G4mmssol = std::multimap<G4String, G4VSo     53 using G4mmssol = std::multimap<G4String, G4VSolid*>;
 54 using G4mmslv = std::multimap<G4String, G4Logi     54 using G4mmslv = std::multimap<G4String, G4LogicalVolume*>;
 55 using G4mmspv = std::multimap<G4String, G4VPhy     55 using G4mmspv = std::multimap<G4String, G4VPhysicalVolume*>;
 56 using G4mlvlv = std::map<G4LogicalVolume*, G4L     56 using G4mlvlv = std::map<G4LogicalVolume*, G4LogicalVolume*>;
 57 using G4mpvpv = std::map<G4VPhysicalVolume*, G     57 using G4mpvpv = std::map<G4VPhysicalVolume*, G4VPhysicalVolume*>;
 58                                                    58 
 59 class G4tgbVolumeMgr                               59 class G4tgbVolumeMgr
 60 {                                                  60 {
 61   public:                                          61   public:
 62                                                    62 
 63     G4tgbVolumeMgr();                              63     G4tgbVolumeMgr();
 64     ~G4tgbVolumeMgr();                             64     ~G4tgbVolumeMgr();
 65                                                    65 
 66     static G4tgbVolumeMgr* GetInstance();          66     static G4tgbVolumeMgr* GetInstance();
 67       // Get the only instance                     67       // Get the only instance
 68                                                    68 
 69     void AddTextFile(const G4String& fname);       69     void AddTextFile(const G4String& fname);
 70     G4VPhysicalVolume* ReadAndConstructDetecto     70     G4VPhysicalVolume* ReadAndConstructDetector();
 71                                                    71 
 72     void CopyVolumes();                            72     void CopyVolumes();
 73       // Build a G4tgbVolume per each G4tgbVol     73       // Build a G4tgbVolume per each G4tgbVolume
 74                                                    74 
 75     G4tgbVolume* FindVolume(const G4String& vo     75     G4tgbVolume* FindVolume(const G4String& volname);
 76       // Find a G4tgbVolume by name                76       // Find a G4tgbVolume by name
 77                                                    77 
 78     void RegisterMe(const G4tgbVolume* vol);       78     void RegisterMe(const G4tgbVolume* vol);
 79       // Register a G4tgbVolume                    79       // Register a G4tgbVolume
 80     void RegisterMe(const G4VSolid* solid);        80     void RegisterMe(const G4VSolid* solid);
 81       // Register a G4VSolid                       81       // Register a G4VSolid
 82     void RegisterMe(const G4LogicalVolume* lv)     82     void RegisterMe(const G4LogicalVolume* lv);
 83       // Register a G4LogicalVolume                83       // Register a G4LogicalVolume
 84     void RegisterMe(const G4VPhysicalVolume* p     84     void RegisterMe(const G4VPhysicalVolume* pv);
 85       // Register a G4VPhysicalVolume              85       // Register a G4VPhysicalVolume
 86     void RegisterChildParentLVs(const G4Logica     86     void RegisterChildParentLVs(const G4LogicalVolume* logvol,
 87                                 const G4Logica     87                                 const G4LogicalVolume* parentLV);
 88       // Register a child and its parent LV        88       // Register a child and its parent LV
 89                                                    89 
 90     G4VSolid* FindG4Solid(const G4String& name     90     G4VSolid* FindG4Solid(const G4String& name);
 91       // Find if solid already exists, compari     91       // Find if solid already exists, comparing the name and all parameters
 92       // (could be checked before creating it,     92       // (could be checked before creating it, but it would be quite
 93       // complicated, because it would have to     93       // complicated, because it would have to compare the parameters, and
 94       // they depend on the type of solid)         94       // they depend on the type of solid)
 95                                                    95 
 96     G4LogicalVolume* FindG4LogVol(const G4Stri     96     G4LogicalVolume* FindG4LogVol(const G4String& theName,
 97                                   const G4bool     97                                   const G4bool bExists = false);
 98       // Find a G4LogicalVolume if it already      98       // Find a G4LogicalVolume if it already exists
 99                                                    99 
100     G4VPhysicalVolume* FindG4PhysVol(const G4S    100     G4VPhysicalVolume* FindG4PhysVol(const G4String& theName,
101                                      const G4b    101                                      const G4bool bExists = false);
102       // Find a G4VPhysicalVolume if it alread    102       // Find a G4VPhysicalVolume if it already exists
103                                                   103 
104     G4VPhysicalVolume* GetTopPhysVol();           104     G4VPhysicalVolume* GetTopPhysVol();
105       // Get the top PV in the hierarchy tree:    105       // Get the top PV in the hierarchy tree: calls topLV, because
106       // physicalvolumes are not placed until     106       // physicalvolumes are not placed until geometry is initialized
107                                                   107 
108     G4LogicalVolume* GetTopLogVol();              108     G4LogicalVolume* GetTopLogVol();
109       // Get the top LV in the hierarchy tree     109       // Get the top LV in the hierarchy tree
110                                                   110 
111     void BuildPhysVolTree();                      111     void BuildPhysVolTree();
112                                                   112 
113     // Dumping methods                            113     // Dumping methods
114                                                   114 
115     void DumpSummary();                           115     void DumpSummary();
116     void DumpG4LogVolTree();                      116     void DumpG4LogVolTree();
117     void DumpG4LogVolLeaf(const G4LogicalVolum    117     void DumpG4LogVolLeaf(const G4LogicalVolume* lv, unsigned int leafDepth);
118     void DumpG4PhysVolTree();                     118     void DumpG4PhysVolTree();
119     void DumpG4PhysVolLeaf(const G4VPhysicalVo    119     void DumpG4PhysVolLeaf(const G4VPhysicalVolume* pv, unsigned int leafDepth);
120     void DumpG4SolidList();                       120     void DumpG4SolidList();
121                                                   121 
122     const std::multimap<G4String, G4VSolid*>&     122     const std::multimap<G4String, G4VSolid*>& GetSolids() const
123     {                                             123     {
124       return theSolids;                           124       return theSolids;
125     }                                             125     }
126     void SetDetectorBuilder(G4tgbDetectorBuild    126     void SetDetectorBuilder(G4tgbDetectorBuilder* db)
127     {                                             127     {
128       theDetectorBuilder = db;                    128       theDetectorBuilder = db;
129     }                                             129     }
130     G4tgbDetectorBuilder* GetDetectorBuilder()    130     G4tgbDetectorBuilder* GetDetectorBuilder() const
131     {                                             131     {
132       return theDetectorBuilder;                  132       return theDetectorBuilder;
133     }                                             133     }
134                                                   134 
135   private:                                        135   private:
136                                                   136 
137     static G4ThreadLocal G4tgbVolumeMgr* theIn    137     static G4ThreadLocal G4tgbVolumeMgr* theInstance;
138                                                   138 
139     G4mssvol theVolumeList;                       139     G4mssvol theVolumeList;
140       // Map of G4tgbVolume's: G4String is the    140       // Map of G4tgbVolume's: G4String is the G4tgbVolume name,
141       // G4tgbVolume* the pointer to it.          141       // G4tgbVolume* the pointer to it.
142                                                   142 
143     G4mmssol theSolids;                           143     G4mmssol theSolids;
144       // Solids container                         144       // Solids container
145                                                   145 
146     G4mmslv theLVs;                               146     G4mmslv theLVs;
147       // Logical volume container                 147       // Logical volume container
148     G4mmspv thePVs;                               148     G4mmspv thePVs;
149       // Physical volume container                149       // Physical volume container
150                                                   150 
151     G4mlvlv theLVTree;                            151     G4mlvlv theLVTree;
152       // Logical volume tree for navigation (f    152       // Logical volume tree for navigation (from parent to children):
153       // first is parent, then child              153       // first is parent, then child
154     G4mlvlv theLVInvTree;                         154     G4mlvlv theLVInvTree;
155       // Logical volume tree for inverse navig    155       // Logical volume tree for inverse navigation (from children to parent):
156       // first is child, then parent              156       // first is child, then parent
157                                                   157 
158     G4mpvpv thePVTree;                            158     G4mpvpv thePVTree;
159       // Physical volume tree for navigation (    159       // Physical volume tree for navigation (from parent to children):
160       // first is parent, then child              160       // first is parent, then child
161     G4mpvpv thePVInvTree;                         161     G4mpvpv thePVInvTree;
162       // Physical volume tree for inverse navi    162       // Physical volume tree for inverse navigation (from children to parents):
163       // first is child, then parent              163       // first is child, then parent
164                                                   164 
165     G4tgbDetectorBuilder* theDetectorBuilder =    165     G4tgbDetectorBuilder* theDetectorBuilder = nullptr;
166 };                                                166 };
167                                                   167 
168 #endif                                            168 #endif
169                                                   169