Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/persistency/ascii/src/G4tgbVolumeMgr.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.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/src/G4tgbVolumeMgr.cc (Version 11.3.0) and /persistency/ascii/src/G4tgbVolumeMgr.cc (Version 9.3)


  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 implementation               << 
 27 //                                                 26 //
 28 // Author: P.Arce, CIEMAT (November 2007)      <<  27 // $Id: G4tgbVolumeMgr.cc,v 1.5 2008/12/18 12:59:44 gunter Exp $
 29 // ------------------------------------------- <<  28 // GEANT4 tag $Name: geant4-09-02 $
                                                   >>  29 //
                                                   >>  30 //
                                                   >>  31 // class G4tgbVolumeMgr
 30                                                    32 
 31 #include "G4tgbVolumeMgr.hh"                   <<  33 // History:
                                                   >>  34 // - Created.                                 P.Arce, CIEMAT (November 2007)
                                                   >>  35 // -------------------------------------------------------------------------
 32                                                    36 
 33 #include "G4SystemOfUnits.hh"                  << 
 34 #include "G4tgbVolume.hh"                          37 #include "G4tgbVolume.hh"
                                                   >>  38 #include "G4tgbVolumeMgr.hh"
 35 #include "G4tgbMaterialMgr.hh"                     39 #include "G4tgbMaterialMgr.hh"
 36 #include "G4tgbRotationMatrixMgr.hh"               40 #include "G4tgbRotationMatrixMgr.hh"
 37                                                    41 
 38 #include "G4tgrVolumeMgr.hh"                       42 #include "G4tgrVolumeMgr.hh"
 39 #include "G4tgrFileReader.hh"                      43 #include "G4tgrFileReader.hh"
 40 #include "G4tgrUtils.hh"                           44 #include "G4tgrUtils.hh"
 41                                                    45 
 42 #include "G4VSolid.hh"                             46 #include "G4VSolid.hh"
 43 #include "G4PhysicalVolumeStore.hh"                47 #include "G4PhysicalVolumeStore.hh"
 44 #include "G4ReflectionFactory.hh"                  48 #include "G4ReflectionFactory.hh"
 45 #include "G4tgrMessenger.hh"                       49 #include "G4tgrMessenger.hh"
 46 #include "G4tgbDetectorBuilder.hh"                 50 #include "G4tgbDetectorBuilder.hh"
 47                                                    51 
 48 G4ThreadLocal G4tgbVolumeMgr* G4tgbVolumeMgr:: <<  52 G4tgbVolumeMgr* G4tgbVolumeMgr::theInstance = 0;
 49                                                    53 
 50 // ------------------------------------------- <<  54 //---------------------------------------------------------------------
 51 G4tgbVolumeMgr::G4tgbVolumeMgr()               <<  55 G4tgbVolumeMgr::G4tgbVolumeMgr() 
 52 {                                                  56 {
 53   G4ReflectionFactory::Instance()->SetScalePre <<  57   G4ReflectionFactory::Instance()->SetScalePrecision(1.E-6*mm);
 54   // NOTE: problems building matrices with not <<  58     // NOTE: problems building matrices with not enough figures,
 55   // like  :ROTM RR30 0.866025 0.5 0. -0.5 0.8 <<  59     // like  :ROTM RR30 0.866025 0.5 0. -0.5 0.866025 0. 0. 0 -1
 56   theDetectorBuilder = new G4tgbDetectorBuilde     60   theDetectorBuilder = new G4tgbDetectorBuilder();
 57 }                                                  61 }
 58                                                    62 
 59 // ------------------------------------------- <<  63 
                                                   >>  64 //---------------------------------------------------------------------
 60 G4tgbVolumeMgr::~G4tgbVolumeMgr()                  65 G4tgbVolumeMgr::~G4tgbVolumeMgr()
 61 {                                                  66 {
 62   delete theDetectorBuilder;                       67   delete theDetectorBuilder;
 63   delete theInstance;                              68   delete theInstance;
 64 }                                                  69 }
 65                                                    70 
 66 // ------------------------------------------- <<  71 
                                                   >>  72 //---------------------------------------------------------------------
 67 G4tgbVolumeMgr* G4tgbVolumeMgr::GetInstance()      73 G4tgbVolumeMgr* G4tgbVolumeMgr::GetInstance()
 68 {                                                  74 {
 69   if(theInstance == nullptr)                   <<  75   if( !theInstance )
 70   {                                                76   {
 71     theInstance = new G4tgbVolumeMgr();            77     theInstance = new G4tgbVolumeMgr();
 72   }                                                78   }
 73   return theInstance;                              79   return theInstance;
 74 }                                                  80 }
 75                                                    81 
 76 // ------------------------------------------- <<  82 
 77 void G4tgbVolumeMgr::AddTextFile(const G4Strin <<  83 //---------------------------------------------------------------------
                                                   >>  84 void G4tgbVolumeMgr::AddTextFile( const G4String& fname ) 
 78 {                                                  85 {
 79   G4tgrFileReader::GetInstance()->AddTextFile( <<  86   G4tgrFileReader::GetInstance()->AddTextFile( fname );
 80 }                                                  87 }
 81                                                    88 
 82 // ------------------------------------------- <<  89 
                                                   >>  90 //---------------------------------------------------------------------
 83 G4VPhysicalVolume* G4tgbVolumeMgr::ReadAndCons     91 G4VPhysicalVolume* G4tgbVolumeMgr::ReadAndConstructDetector()
 84 {                                                  92 {
 85   const G4tgrVolume* tgrVoltop = theDetectorBu     93   const G4tgrVolume* tgrVoltop = theDetectorBuilder->ReadDetector();
 86   return theDetectorBuilder->ConstructDetector     94   return theDetectorBuilder->ConstructDetector(tgrVoltop);
 87 }                                                  95 }
 88                                                    96 
 89 // ------------------------------------------- <<  97 
 90 void G4tgbVolumeMgr::RegisterMe(const G4tgbVol <<  98 //---------------------------------------------------------------------
                                                   >>  99 void G4tgbVolumeMgr::RegisterMe( const G4tgbVolume* vol )
 91 {                                                 100 {
 92   theVolumeList.insert(                        << 101   theVolumeList.insert( G4mssvol::value_type( vol->GetName(),
 93     G4mssvol::value_type(vol->GetName(), const << 102                         const_cast<G4tgbVolume*>(vol) ) );
 94 }                                                 103 }
 95                                                   104 
 96 // ------------------------------------------- << 105 
 97 void G4tgbVolumeMgr::RegisterMe(const G4VSolid << 106 //---------------------------------------------------------------------
                                                   >> 107 void G4tgbVolumeMgr::RegisterMe( const G4VSolid* solid )
 98 {                                                 108 {
 99   theSolids.insert(                            << 109   theSolids.insert( G4mmssol::value_type( solid->GetName(),
100     G4mmssol::value_type(solid->GetName(), con << 110                     const_cast<G4VSolid*>(solid) ) );
101 }                                                 111 }
102                                                   112 
103 // ------------------------------------------- << 113 
104 void G4tgbVolumeMgr::RegisterMe(const G4Logica << 114 //---------------------------------------------------------------------
                                                   >> 115 void G4tgbVolumeMgr::RegisterMe( const G4LogicalVolume* lv )
105 {                                                 116 {
106   theLVs.insert(                               << 117   theLVs.insert( G4mmslv::value_type( lv->GetName(),
107     G4mmslv::value_type(lv->GetName(), const_c << 118                  const_cast<G4LogicalVolume*>(lv) ) );
108                                                   119 
109 #ifdef G4VERBOSE                                  120 #ifdef G4VERBOSE
110   if(G4tgrMessenger::GetVerboseLevel() >= 2)   << 121   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
111   {                                               122   {
112     G4cout << " G4tgbVolumeMgr::RegisterMe() -    123     G4cout << " G4tgbVolumeMgr::RegisterMe() - Logical volume registered: "
113            << lv->GetName() << G4endl;         << 124            << lv->GetName() << G4endl; 
114   }                                               125   }
115 #endif                                            126 #endif
116 }                                                 127 }
117                                                   128 
118 // ------------------------------------------- << 129 //---------------------------------------------------------------------
119 void G4tgbVolumeMgr::RegisterMe(const G4VPhysi << 130 void G4tgbVolumeMgr::RegisterMe( const G4VPhysicalVolume* pv )
120 {                                                 131 {
121   thePVs.insert(                               << 132   thePVs.insert( G4mmspv::value_type( pv->GetName(),
122     G4mmspv::value_type(pv->GetName(), const_c << 133                  const_cast<G4VPhysicalVolume*>(pv) ) );
123 }                                                 134 }
124                                                   135 
125 // ------------------------------------------- << 136 
126 void G4tgbVolumeMgr::RegisterChildParentLVs(co << 137 //---------------------------------------------------------------------
127                                             co << 138 void G4tgbVolumeMgr::RegisterChildParentLVs( const G4LogicalVolume* logvol,
                                                   >> 139                                              const G4LogicalVolume* parentLV )
128 {                                                 140 {
129   theLVInvTree[const_cast<G4LogicalVolume*>(lo    141   theLVInvTree[const_cast<G4LogicalVolume*>(logvol)] =
130     const_cast<G4LogicalVolume*>(parentLV);       142     const_cast<G4LogicalVolume*>(parentLV);
131   theLVTree[const_cast<G4LogicalVolume*>(paren    143   theLVTree[const_cast<G4LogicalVolume*>(parentLV)] =
132     const_cast<G4LogicalVolume*>(logvol);         144     const_cast<G4LogicalVolume*>(logvol);
133 }                                                 145 }
134                                                   146 
135 // ------------------------------------------- << 147 //---------------------------------------------------------------------
136 void G4tgbVolumeMgr::CopyVolumes()                148 void G4tgbVolumeMgr::CopyVolumes()
137 {                                                 149 {
138   //--------- Loop G4tgbVolume's and create a     150   //--------- Loop G4tgbVolume's and create a G4tgbVolume for each DetUnit
                                                   >> 151   G4mapsvol::iterator cite;
139   G4mapsvol vollist = G4tgrVolumeMgr::GetInsta    152   G4mapsvol vollist = G4tgrVolumeMgr::GetInstance()->GetVolumeMap();
140   for(auto cite = vollist.cbegin(); cite != vo << 153   for(cite = vollist.begin(); cite != vollist.end(); cite++)
141   {                                               154   {
142     G4tgrVolume* tgrvol = const_cast<G4tgrVolu << 155     G4tgrVolume* tgrvol = const_cast<G4tgrVolume*>( (*cite).second );
143     G4tgbVolume* svol   = new G4tgbVolume(tgrv << 156     G4tgbVolume* svol = new G4tgbVolume( tgrvol );
144     RegisterMe(svol);                          << 157     RegisterMe( svol );
145   }                                               158   }
146 }                                                 159 }
147                                                   160 
148 // ------------------------------------------- << 161 
149 G4tgbVolume* G4tgbVolumeMgr::FindVolume(const  << 162 //---------------------------------------------------------------------
                                                   >> 163 G4tgbVolume* G4tgbVolumeMgr::FindVolume( const G4String& volname)
150 {                                                 164 {
151   G4mssvol::const_iterator cite = theVolumeLis << 165   G4mssvol::const_iterator cite = theVolumeList.find( volname );
152   if(cite == theVolumeList.cend())             << 166   if( cite == theVolumeList.end() )
153   {                                               167   {
154     G4String ErrMessage = "G4tgbVolume not fou    168     G4String ErrMessage = "G4tgbVolume not found: " + volname + " !";
155     G4Exception("G4tgbVolumeMgr::FindVolume()" << 169     G4Exception("G4tgbVolumeMgr::FindVolume()", "InvalidSetup",
156                 ErrMessage);                   << 170                 FatalException, ErrMessage);
157     return nullptr;                            << 
158   }                                            << 
159   else                                         << 
160   {                                            << 
161     return (*cite).second;                     << 
162   }                                               171   }
                                                   >> 172   return (*cite).second;
163 }                                                 173 }
164                                                   174 
165 // ------------------------------------------- << 175 
166 G4VSolid* G4tgbVolumeMgr::FindG4Solid(const G4 << 176 //---------------------------------------------------------------------
                                                   >> 177 G4VSolid* G4tgbVolumeMgr::FindG4Solid( const G4String& name )
167 {                                                 178 {
168 #ifdef G4VERBOSE                                  179 #ifdef G4VERBOSE
169   if(G4tgrMessenger::GetVerboseLevel() >= 2)   << 180   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
170   {                                               181   {
171     G4cout << " G4tgbVolumeMgr::FindG4Solid()     182     G4cout << " G4tgbVolumeMgr::FindG4Solid() - " << name << G4endl;
172   }                                               183   }
173 #endif                                            184 #endif
174                                                   185 
175   G4VSolid* oldSolid = nullptr;                << 186   G4VSolid* oldSolid = 0;
                                                   >> 187   G4mmssol::const_iterator mmsscite;
176   std::pair<G4mmssol::iterator, G4mmssol::iter    188   std::pair<G4mmssol::iterator, G4mmssol::iterator> mmssdi;
177   mmssdi = theSolids.equal_range(name);        << 189   mmssdi = theSolids.equal_range( name );
178                                                << 
179   if(mmssdi.first != mmssdi.second)            << 
180   {  // check there is a solid found           << 
181     G4mmssol::const_iterator mmsscite = mmssdi << 
182                                                   190 
                                                   >> 191   for( mmsscite = mmssdi.first; mmsscite != mmssdi.second; mmsscite++ )
                                                   >> 192   {
183 #ifdef G4VERBOSE                                  193 #ifdef G4VERBOSE
184     if(G4tgrMessenger::GetVerboseLevel() >= 2) << 194   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
185     {                                          << 195   {
186       G4cout << " G4tgbVolumeMgr::FindG4Solid( << 196     G4cout << " G4tgbVolumeMgr::FindG4Solid() - Solid finding "
187              << G4endl;                        << 197            << name << G4endl; 
188     }                                          << 198   }
189 #endif                                            199 #endif
190     /*                                            200     /*
191        G4VSolid overwrites the operator== comp    201        G4VSolid overwrites the operator== comparing the addresses
192        => this cannot be used !!                  202        => this cannot be used !!
193        Then just compare solids by name =>> PO    203        Then just compare solids by name =>> POSP tag cannot be used
194        for the moment ...                         204        for the moment ...
195          if( solid == *( (*mmsscite).second )     205          if( solid == *( (*mmsscite).second ) )
196          {                                        206          {
197            oldSolid = (*mmsscite).second;         207            oldSolid = (*mmsscite).second;
198            break;                                 208            break;
199          }                                        209          }
200        until we write operator== for each soli    210        until we write operator== for each solid type, we take a solid
201        with the same name (therefore we will n    211        with the same name (therefore we will not allow two solids with
202        equal name and different parameters (PO    212        equal name and different parameters (POSP) )
203     */                                            213     */
204     oldSolid = (*mmsscite).second;                214     oldSolid = (*mmsscite).second;
205 #ifdef G4VERBOSE                                  215 #ifdef G4VERBOSE
206     if(G4tgrMessenger::GetVerboseLevel() >= 1) << 216   if( G4tgrMessenger::GetVerboseLevel() >= 1 )
207     {                                          << 217   {
208       G4cout << " G4tgbVolumeMgr::FindG4Solid( << 218     G4cout << " G4tgbVolumeMgr::FindG4Solid() - Solid already found "
209              << G4endl;                        << 219            << name << G4endl; 
210     }                                          << 220   }
211 #endif                                            221 #endif
                                                   >> 222     break;
212   }                                               223   }
213                                                << 224  
214 #ifdef G4VERBOSE                                  225 #ifdef G4VERBOSE
215   if(G4tgrMessenger::GetVerboseLevel() >= 2)   << 226   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
216   {                                               227   {
217     G4cout << " G4tgbVolumeMgr::FindG4Solid()  << 228     G4cout << " G4tgbVolumeMgr::FindG4Solid() - Old solid: "
218            << G4endl;                          << 229            << oldSolid << G4endl;
219   }                                               230   }
220 #endif                                            231 #endif
221                                                << 
222   return oldSolid;                                232   return oldSolid;
223 }                                                 233 }
224                                                   234 
225 // ------------------------------------------- << 235 
226 G4LogicalVolume* G4tgbVolumeMgr::FindG4LogVol( << 236 //---------------------------------------------------------------------
227                                                << 237 G4LogicalVolume*
                                                   >> 238 G4tgbVolumeMgr::FindG4LogVol( const G4String& name, const G4bool exists )
228 {                                                 239 {
229   G4mmslv::const_iterator mscite = theLVs.find << 240   G4mmslv::const_iterator mscite = theLVs.find( name );
230   if(mscite == theLVs.cend())                  << 241   if( mscite == theLVs.end() )
231   {                                               242   {
232     if(exists)                                 << 243     if( exists )
233     {                                             244     {
234       G4String ErrMessage = "Logical volume na    245       G4String ErrMessage = "Logical volume name " + name + " not found !";
235       G4Exception("G4tgbVolumeMgr::FindG4LogVo    246       G4Exception("G4tgbVolumeMgr::FindG4LogVol()", "InvalidSetup",
236                   FatalException, ErrMessage);    247                   FatalException, ErrMessage);
237     }                                             248     }
238     return nullptr;                            << 249     return 0;
239   }                                               250   }
240   else                                            251   else
241   {                                               252   {
242     return (*mscite).second;                      253     return (*mscite).second;
243   }                                               254   }
244 }                                                 255 }
245                                                   256 
246 // ------------------------------------------- << 257 //---------------------------------------------------------------------
247 G4VPhysicalVolume* G4tgbVolumeMgr::FindG4PhysV << 258 G4VPhysicalVolume*
248                                                << 259 G4tgbVolumeMgr::FindG4PhysVol( const G4String& name, const G4bool exists )
249 {                                                 260 {
250   G4mmspv::const_iterator mscite = thePVs.find << 261   G4mmspv::const_iterator mscite = thePVs.find( name );
251   if(mscite == thePVs.cend())                  << 262   if( mscite == thePVs.end() )
252   {                                               263   {
253     if(exists)                                 << 264     if( exists )
254     {                                             265     {
255       G4String ErrMessage = "Physical volume n    266       G4String ErrMessage = "Physical volume name " + name + " not found !";
256       G4Exception("G4tgbVolumeMgr::FindG4PhysV    267       G4Exception("G4tgbVolumeMgr::FindG4PhysVol()", "InvalidSetup",
257                   FatalException, ErrMessage);    268                   FatalException, ErrMessage);
258     }                                             269     }
259     return nullptr;                            << 270     return 0;
260   }                                               271   }
261   else                                            272   else
262   {                                               273   {
263     return (*mscite).second;                      274     return (*mscite).second;
264   }                                               275   }
265 }                                                 276 }
266                                                   277 
267 // ------------------------------------------- << 278 
                                                   >> 279 //---------------------------------------------------------------------
268 G4VPhysicalVolume* G4tgbVolumeMgr::GetTopPhysV    280 G4VPhysicalVolume* G4tgbVolumeMgr::GetTopPhysVol()
269 {                                                 281 {
270   G4LogicalVolume* lv   = GetTopLogVol();      << 282   G4LogicalVolume* lv = GetTopLogVol(); 
271   G4VPhysicalVolume* pv = (*(thePVs.find(lv->G << 283   G4VPhysicalVolume* pv = ( *(thePVs.find( lv->GetName() )) ).second;
272                                                   284 
273 #ifdef G4VERBOSE                                  285 #ifdef G4VERBOSE
274   if(G4tgrMessenger::GetVerboseLevel() >= 2)   << 286   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
275   {                                               287   {
276     G4cout << " G4tgbVolumeMgr::GetTopPhysVol( << 288     G4cout << " G4tgbVolumeMgr::GetTopPhysVol() - pv: "
277            << G4endl;                          << 289            << pv->GetName() << G4endl;
278   }                                               290   }
279 #endif                                            291 #endif
280                                                   292 
281   return pv;                                      293   return pv;
282 }                                                 294 }
283                                                   295 
284 // ------------------------------------------- << 296 
                                                   >> 297 //---------------------------------------------------------------------
285 G4LogicalVolume* G4tgbVolumeMgr::GetTopLogVol(    298 G4LogicalVolume* G4tgbVolumeMgr::GetTopLogVol()
286 {                                                 299 {
287   //----------- Start from any G4LogicalVolume    300   //----------- Start from any G4LogicalVolume, because if you go upwards
288   //            you will always end at the top << 301   //            you will always end at the top  
289 #ifdef G4VERBOSE                                  302 #ifdef G4VERBOSE
290   if(G4tgrMessenger::GetVerboseLevel() >= 2)   << 303   if( G4tgrMessenger::GetVerboseLevel() >= 2 )
291   {                                               304   {
292     G4cout << " G4tgbVolumeMgr::GetTopLogVol t    305     G4cout << " G4tgbVolumeMgr::GetTopLogVol theLVInvTresize "
293            << theLVInvTree.size() << G4endl;      306            << theLVInvTree.size() << G4endl;
294   }                                               307   }
295 #endif                                            308 #endif
296   if(theLVInvTree.size() == 0)                 << 309   if(  theLVInvTree.size() == 0 ) 
297   {                                            << 310   { 
298     G4Exception("G4tgbVolumeMgr::GetTopLogVol(    311     G4Exception("G4tgbVolumeMgr::GetTopLogVol()", "InvalidSetup",
299                 FatalException, "theLVInvTree     312                 FatalException, "theLVInvTree has no elements.");
300   }                                               313   }
301   G4LogicalVolume* lv = (*(theLVInvTree.begin(    314   G4LogicalVolume* lv = (*(theLVInvTree.begin())).second;
302                                                   315 
303   //------- if first element is the top LV, it    316   //------- if first element is the top LV, its parent is 0
304   if(lv == nullptr)                            << 317   if( lv == 0 ) 
305   {                                               318   {
306     lv = (*(theLVInvTree.begin())).first;         319     lv = (*(theLVInvTree.begin())).first;
307   }                                            << 320   } 
308   else                                         << 321   else 
309   {                                               322   {
310     while((*(theLVInvTree.find(lv))).second != << 323     while( (*(theLVInvTree.find( lv ))).second != 0) 
311     {                                             324     {
312       //---------- get parent of first positio    325       //---------- get parent of first position
313       lv = (*(theLVInvTree.find(lv))).second;  << 326       lv = (*(theLVInvTree.find( lv ))).second;
314 #ifdef G4VERBOSE                                  327 #ifdef G4VERBOSE
315       if(G4tgrMessenger::GetVerboseLevel() >=  << 328       if( G4tgrMessenger::GetVerboseLevel() >= 2 )
316       {                                           329       {
317         G4cout << " G4tgbVolumeMgr::GetTopPhys << 330         G4cout << " G4tgbVolumeMgr::GetTopPhysVol: lv "
318                << G4endl;                      << 331                << lv->GetName() << G4endl;
319       }                                           332       }
320 #endif                                            333 #endif
321     }                                             334     }
322   }                                               335   }
323                                                << 336   
324   return lv;                                      337   return lv;
325 }                                                 338 }
326                                                   339 
327 // ------------------------------------------- << 340   
                                                   >> 341 //---------------------------------------------------------------------
328 void G4tgbVolumeMgr::BuildPhysVolTree()           342 void G4tgbVolumeMgr::BuildPhysVolTree()
329 {                                                 343 {
330   /*                                           << 344 /*
331     G4PhysicalVolumeStore* pvs = G4PhysicalVol << 345   G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance();
332     for( auto cite = pvs->cbegin(); cite != pv << 346   std::vector<G4VPhysicalVolume*>::iterator cite;
333     {                                          << 347   for( cite = pvs->begin(); cite != pvs->end(); cite++ )
334       thePVTree[ *cite ] = (*cite)->GetMother( << 348   {
335       thePVInvTree[ (*cite)->GetMother() ] = * << 349     thePVTree[ *cite ] = (*cite)->GetMother();
336     }                                          << 350     thePVInvTree[ (*cite)->GetMother() ] = *cite;
337   */                                           << 351   }
                                                   >> 352 */
338 }                                                 353 }
                                                   >> 354  
339                                                   355 
340 // ------------------------------------------- << 356 //---------------------------------------------------------------------
341 void G4tgbVolumeMgr::DumpSummary()                357 void G4tgbVolumeMgr::DumpSummary()
342 {                                                 358 {
343   //---------- Dump number of objects of each     359   //---------- Dump number of objects of each class
344   G4cout << " @@@@@@@@@@@@@ Dumping Geant4 geo    360   G4cout << " @@@@@@@@@@@@@ Dumping Geant4 geometry objects Summary " << G4endl;
345   G4cout << " @@@ Geometry built inside world     361   G4cout << " @@@ Geometry built inside world volume: "
346          << GetTopPhysVol()->GetName() << G4en    362          << GetTopPhysVol()->GetName() << G4endl;
347   G4cout << " Number of G4VSolid's: " << theSo    363   G4cout << " Number of G4VSolid's: " << theSolids.size() << G4endl;
348   G4cout << " Number of G4LogicalVolume's: " <    364   G4cout << " Number of G4LogicalVolume's: " << theLVs.size() << G4endl;
349   G4cout << " Number of G4VPhysicalVolume's: "    365   G4cout << " Number of G4VPhysicalVolume's: " << thePVs.size() << G4endl;
350                                                   366 
351   G4tgbMaterialMgr* mateMgr = G4tgbMaterialMgr    367   G4tgbMaterialMgr* mateMgr = G4tgbMaterialMgr::GetInstance();
352   G4cout << " Number of G4Isotope's: " << mate << 368   G4cout << " Number of G4Isotope's: "
353          << G4endl;                            << 369          << mateMgr->GetG4IsotopeList().size() << G4endl;
354   G4cout << " Number of G4Element's: " << mate << 370   G4cout << " Number of G4Element's: "
355          << G4endl;                            << 371          << mateMgr->GetG4ElementList().size() << G4endl;
356   G4cout << " Number of G4Material's: " << mat << 372   G4cout << " Number of G4Material's: "
357          << G4endl;                            << 373          << mateMgr->GetG4MaterialList().size() << G4endl;
358                                                   374 
359   G4tgbRotationMatrixMgr* rotmMgr = G4tgbRotat    375   G4tgbRotationMatrixMgr* rotmMgr = G4tgbRotationMatrixMgr::GetInstance();
360   G4cout << " Number of G4RotationMatrix's: "     376   G4cout << " Number of G4RotationMatrix's: "
361          << rotmMgr->GetG4RotMatList().size()     377          << rotmMgr->GetG4RotMatList().size() << G4endl;
362                                                   378 
363   //---------- Dump list of objects of each cl    379   //---------- Dump list of objects of each class
364   DumpG4SolidList();                              380   DumpG4SolidList();
365   DumpG4LogVolTree();                             381   DumpG4LogVolTree();
366   DumpG4PhysVolTree();                            382   DumpG4PhysVolTree();
367 }                                                 383 }
368                                                   384 
369 // ------------------------------------------- << 385 
                                                   >> 386 //---------------------------------------------------------------------
370 void G4tgbVolumeMgr::DumpG4SolidList()            387 void G4tgbVolumeMgr::DumpG4SolidList()
371 {                                                 388 {
372   for(auto cite = theSolids.cbegin(); cite !=  << 389   G4mmssol::const_iterator cite;
                                                   >> 390   for( cite = theSolids.begin(); cite != theSolids.end(); cite++)
373   {                                               391   {
374     G4cout << "G4SOLID: " << (*cite).second->G << 392     G4cout << "G4SOLID: " << (*cite).second->GetName()
375            << (*cite).second->GetEntityType()  << 393            << " of type " << (*cite).second->GetEntityType() << G4endl;
376   }                                               394   }
377 }                                              << 395 } 
                                                   >> 396 
378                                                   397 
379 //--------------------------------------------    398 //---------------------------------------------------------------------
380 void G4tgbVolumeMgr::DumpG4LogVolTree()           399 void G4tgbVolumeMgr::DumpG4LogVolTree()
381 {                                                 400 {
382   G4cout << " @@@@@@@@@@@@@ DUMPING G4LogicalV    401   G4cout << " @@@@@@@@@@@@@ DUMPING G4LogicalVolume's Tree  " << G4endl;
383                                                << 402   
384   G4LogicalVolume* lv = GetTopLogVol();           403   G4LogicalVolume* lv = GetTopLogVol();
385                                                << 404   
386   DumpG4LogVolLeaf(lv, 0);                        405   DumpG4LogVolLeaf(lv, 0);
387 }                                                 406 }
388                                                   407 
                                                   >> 408 
389 //--------------------------------------------    409 //---------------------------------------------------------------------
390 void G4tgbVolumeMgr::DumpG4LogVolLeaf(const G4 << 410 void G4tgbVolumeMgr::DumpG4LogVolLeaf( const G4LogicalVolume* lv,
391                                       unsigned << 411                                        unsigned int leafDepth)
392 {                                                 412 {
393   for(std::size_t ii = 0; ii < leafDepth; ++ii << 413   for( size_t ii=0; ii < leafDepth; ii++ )
394   {                                               414   {
395     G4cout << "  ";                               415     G4cout << "  ";
396   }                                               416   }
397   G4cout << " LV:(" << leafDepth << ")" << lv-    417   G4cout << " LV:(" << leafDepth << ")" << lv->GetName() << G4endl;
398                                                << 418   
399   //---------- construct the children of this     419   //---------- construct the children of this volume
400   // G4LogicalVolume* lvnc = const_cast<G4Logi << 420   G4LogicalVolume* lvnc = const_cast<G4LogicalVolume*>(lv);
401   // std::pair<G4mlvlv::iterator, G4mlvlv::ite << 421   std::pair<G4mlvlv::iterator, G4mlvlv::iterator> children
402   //   = theLVTree.equal_range( lvnc );        << 422     = theLVTree.equal_range( lvnc );
403   //                                           << 423   
404   // G4mlvlv::iterator cite;                   << 424   G4mlvlv::iterator cite; 
405                                                << 425   
406   ++leafDepth;                                 << 426   leafDepth++;
407   // for( cite = children.first; cite != child << 427   // for( cite = children.first; cite != children.second; cite++ )
408   // {                                            428   // {
409   //  DumpG4LVLeaf( (*cite)->second, leafDepth    429   //  DumpG4LVLeaf( (*cite)->second, leafDepth );
410   // }                                         << 430   // } 
411 }                                                 431 }
412                                                   432 
413 // ------------------------------------------- << 433 
                                                   >> 434 
                                                   >> 435 //---------------------------------------------------------------------
414 void G4tgbVolumeMgr::DumpG4PhysVolTree()          436 void G4tgbVolumeMgr::DumpG4PhysVolTree()
415 {                                                 437 {
416   G4cout << " @@@@@@@@@@@@@ DUMPING G4Physical    438   G4cout << " @@@@@@@@@@@@@ DUMPING G4PhysicalVolume's Tree  " << G4endl;
417                                                   439 
418   G4VPhysicalVolume* pv = GetTopPhysVol();        440   G4VPhysicalVolume* pv = GetTopPhysVol();
419                                                   441 
420   DumpG4PhysVolLeaf(pv, 0);                       442   DumpG4PhysVolLeaf(pv, 0);
421 }                                                 443 }
422                                                   444 
423 // ------------------------------------------- << 445 
424 void G4tgbVolumeMgr::DumpG4PhysVolLeaf(const G << 446 //---------------------------------------------------------------------
425                                        unsigne << 447 void G4tgbVolumeMgr::DumpG4PhysVolLeaf( const G4VPhysicalVolume* pv,
                                                   >> 448                                         unsigned int leafDepth)
426 {                                                 449 {
427   for(std::size_t ii = 0; ii < leafDepth; ++ii << 450   for( size_t ii=0; ii < leafDepth; ii++ )
428   {                                               451   {
429     G4cout << "  ";                               452     G4cout << "  ";
430   }                                               453   }
431   G4cout << " PV:(" << leafDepth << ")" << pv-    454   G4cout << " PV:(" << leafDepth << ")" << pv->GetName() << G4endl;
432                                                   455 
433   //---------- construct the children of this     456   //---------- construct the children of this PV
434   // G4VPhysicalVolume* pvnc = const_cast<G4VP << 457   G4VPhysicalVolume* pvnc = const_cast<G4VPhysicalVolume*>(pv);
435   // std::pair<G4mpvpv::iterator, G4mpvpv::ite << 458   std::pair<G4mpvpv::iterator, G4mpvpv::iterator> children
436   //  = thePVTree.equal_range( pvnc );         << 459     = thePVTree.equal_range( pvnc );
437   //                                           << 460 
438   // G4mpvpv::iterator cite;                   << 461   G4mpvpv::iterator cite; 
439                                                   462 
440   ++leafDepth;                                 << 463   leafDepth++;
441   // for( cite = children.first; cite != child << 464   // for( cite = children.first; cite != children.second; cite++ )
442   // {                                            465   // {
443   //  DumpG4PVLeaf( (*cite)->second, leafDepth    466   //  DumpG4PVLeaf( (*cite)->second, leafDepth );
444   // }                                            467   // }
445 }                                                 468 }
446                                                   469