Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/persistency/ascii/src/G4tgrVolumeMgr.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/G4tgrVolumeMgr.cc (Version 11.3.0) and /persistency/ascii/src/G4tgrVolumeMgr.cc (Version 10.2.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 // G4tgrVolumeMgr implementation               << 
 27 //                                                 26 //
 28 // Author: P.Arce, CIEMAT (November 2007)      <<  27 // $Id: G4tgrVolumeMgr.cc 66872 2013-01-15 01:25:57Z japost $
 29 // ------------------------------------------- <<  28 //
                                                   >>  29 //
                                                   >>  30 // class G4tgrVolumeMgr
                                                   >>  31 
                                                   >>  32 // History:
                                                   >>  33 // - Created.                                 P.Arce, CIEMAT (November 2007)
                                                   >>  34 // -------------------------------------------------------------------------
 30                                                    35 
 31 #include "G4tgrVolumeMgr.hh"                       36 #include "G4tgrVolumeMgr.hh"
 32 #include "G4tgrUtils.hh"                           37 #include "G4tgrUtils.hh"
 33 #include "G4tgrMaterialFactory.hh"                 38 #include "G4tgrMaterialFactory.hh"
 34 #include "G4tgrRotationMatrixFactory.hh"           39 #include "G4tgrRotationMatrixFactory.hh"
 35 #include "G4tgrFileReader.hh"                      40 #include "G4tgrFileReader.hh"
 36 #include "G4tgrMessenger.hh"                       41 #include "G4tgrMessenger.hh"
 37 #include "G4tgrSolid.hh"                           42 #include "G4tgrSolid.hh"
 38 #include "G4tgrSolidBoolean.hh"                    43 #include "G4tgrSolidBoolean.hh"
 39 #include "G4tgrSolidMultiUnion.hh"             << 
 40 #include "G4tgrSolidScaled.hh"                 << 
 41                                                    44 
 42 G4ThreadLocal G4tgrVolumeMgr* G4tgrVolumeMgr:: << 
 43                                                    45 
 44 // ------------------------------------------- <<  46 G4ThreadLocal G4tgrVolumeMgr* G4tgrVolumeMgr::theInstance = 0;
                                                   >>  47 
                                                   >>  48 
                                                   >>  49 //-------------------------------------------------------------
 45 G4tgrVolumeMgr::G4tgrVolumeMgr()                   50 G4tgrVolumeMgr::G4tgrVolumeMgr()
 46 {                                                  51 {
 47 }                                                  52 }
 48                                                    53 
 49 // ------------------------------------------- <<  54 
                                                   >>  55 //-------------------------------------------------------------
 50 G4tgrVolumeMgr::~G4tgrVolumeMgr()                  56 G4tgrVolumeMgr::~G4tgrVolumeMgr()
 51 {                                              <<  57 { 
 52   delete theInstance;                              58   delete theInstance;
 53 }                                                  59 }
 54                                                    60 
 55 // ------------------------------------------- <<  61 
                                                   >>  62 //-------------------------------------------------------------
 56 G4tgrVolumeMgr* G4tgrVolumeMgr::GetInstance()      63 G4tgrVolumeMgr* G4tgrVolumeMgr::GetInstance()
 57 {                                                  64 {
 58   if(theInstance == nullptr)                   <<  65   if( !theInstance )
 59   {                                                66   {
 60     theInstance = new G4tgrVolumeMgr;              67     theInstance = new G4tgrVolumeMgr;
 61   }                                                68   }
 62   return theInstance;                              69   return theInstance;
 63 }                                                  70 }
 64                                                    71 
 65 // ------------------------------------------- <<  72 
 66 G4tgrSolid* G4tgrVolumeMgr::CreateSolid(const  <<  73 //-------------------------------------------------------------------
 67                                         G4bool <<  74 G4tgrSolid*
                                                   >>  75 G4tgrVolumeMgr::CreateSolid( const std::vector<G4String>& wl, G4bool bVOLUtag )
 68 {                                                  76 {
 69   G4tgrSolid* sol = FindSolid(wl[1]);          <<  77   G4tgrSolid* sol = FindSolid( wl[1] );
 70   if(sol != nullptr)                           <<  78   if( sol )
 71   {                                                79   {
 72     G4String ErrMessage = "Solid already exist     80     G4String ErrMessage = "Solid already exists... " + wl[1];
 73     G4Exception("G4tgrVolumeMgr::CreateSolid() <<  81     G4Exception("G4tgrVolumeMgr::CreateSolid()", "InvalidSetup",
 74                 ErrMessage);                   <<  82                 FatalException, ErrMessage);
 75   }                                            <<  83   } 
 76                                                <<  84   
 77   std::vector<G4String> wlc = wl;                  85   std::vector<G4String> wlc = wl;
 78   if(bVOLUtag)                                 <<  86   if( bVOLUtag )  { wlc.pop_back(); }
 79   {                                            << 
 80     wlc.pop_back();                            << 
 81   }                                            << 
 82                                                    87 
 83   G4String wl2 = wlc[2];                           88   G4String wl2 = wlc[2];
 84   for(G4int ii = 0; ii < (G4int)wl2.length();  <<  89   for( size_t ii = 0; ii < wl2.length(); ii++ )
 85   {                                                90   {
 86     wl2[ii] = (char)std::toupper(wl2[ii]);     <<  91     wl2[ii] = toupper( wl2[ii] );
 87   }                                                92   }
 88   if((wl2 == "UNION") || (wl2 == "SUBTRACTION" <<  93   if( (wl2 == "UNION") || (wl2 == "SUBTRACTION") || (wl2 == "INTERSECTION") )
 89   {                                                94   {
 90     //---------- Boolean solid                     95     //---------- Boolean solid
 91     //---------- Create G4tgrSolidBoolean and      96     //---------- Create G4tgrSolidBoolean and fill the solid params
 92     sol = new G4tgrSolidBoolean(wlc);          <<  97     sol = new G4tgrSolidBoolean( wlc );
 93   }                                            << 
 94   else if(wl2 == "SCALED")                     << 
 95   {                                            << 
 96     //---------- Create G4tgrSolidScaled and f << 
 97     sol = new G4tgrSolidScaled(wlc);           << 
 98   }                                            << 
 99   else if(wl2 == "MULTIUNION")                 << 
100   {                                            << 
101     //---------- Create G4tgrSolidMultiUnion a << 
102     sol = new G4tgrSolidMultiUnion(wlc);       << 
103   }                                                98   }
104   else                                             99   else
105   {                                               100   {
106     //---------- Create G4tgrSolidSimple and f    101     //---------- Create G4tgrSolidSimple and fill the solid params
107     sol = new G4tgrSolid(wlc);                 << 102     sol = new G4tgrSolid( wlc );
108   }                                               103   }
109                                                   104 
110   return sol;                                     105   return sol;
111 }                                                 106 }
112                                                   107 
113 // ------------------------------------------- << 108 //-------------------------------------------------------------------
114 void G4tgrVolumeMgr::RegisterMe(G4tgrSolid* so << 109 void G4tgrVolumeMgr::RegisterMe( G4tgrSolid* sol) 
115 {                                                 110 {
116   if(theG4tgrSolidMap.find(sol->GetName()) !=  << 111   if( theG4tgrSolidMap.find( sol->GetName() ) != theG4tgrSolidMap.end() )
117   {                                               112   {
118     G4String ErrMessage =                      << 113     G4String ErrMessage = "Cannot be two solids with the same name... "
119       "Cannot be two solids with the same name << 114                         + sol->GetName();
120     G4Exception("G4tgrVolumeMgr::RegisterMe()" << 115     G4Exception("G4tgrVolumeMgr::RegisterMe()", "InvalidSetup",
121                 ErrMessage);                   << 116                 FatalException, ErrMessage);
122   }                                               117   }
123   theG4tgrSolidMap.insert(G4mapssol::value_typ << 118   theG4tgrSolidMap.insert(G4mapssol::value_type(sol->GetName(), sol) ); 
124 }                                                 119 }
125                                                   120 
126 // ------------------------------------------- << 121 
127 void G4tgrVolumeMgr::UnRegisterMe(G4tgrSolid*  << 122 //-------------------------------------------------------------
                                                   >> 123 void G4tgrVolumeMgr::UnRegisterMe( G4tgrSolid* sol ) 
128 {                                                 124 {
129   if(theG4tgrSolidMap.find(sol->GetName()) !=  << 125   if( theG4tgrSolidMap.find( sol->GetName() ) != theG4tgrSolidMap.end() )
130   {                                            << 126   { 
131     G4String ErrMessage =                      << 127     G4String ErrMessage = "Cannot unregister a solid that is not registered... "
132       "Cannot unregister a solid that is not r << 128                         + sol->GetName();
133     G4Exception("G4tgrSolidMgr::unRegisterMe() << 129     G4Exception("G4tgrSolidMgr::unRegisterMe()", "InvalidSetup",
134                 ErrMessage);                   << 130                 FatalException, ErrMessage);
135   }                                               131   }
136   else                                            132   else
137   {                                               133   {
138     theG4tgrSolidMap.erase(theG4tgrSolidMap.fi << 134     theG4tgrSolidMap.erase( theG4tgrSolidMap.find( sol->GetName() ) ); 
139   }                                               135   }
140 }                                                 136 }
141                                                   137 
142 // ------------------------------------------- << 138 
143 void G4tgrVolumeMgr::RegisterMe(G4tgrVolume* v << 139 //-------------------------------------------------------------
                                                   >> 140 void G4tgrVolumeMgr::RegisterMe( G4tgrVolume* vol) 
144 {                                                 141 {
145   theG4tgrVolumeList.push_back(vol);           << 142   theG4tgrVolumeList.push_back( vol );
146   if(theG4tgrVolumeMap.find(vol->GetName()) != << 143   if( theG4tgrVolumeMap.find( vol->GetName() ) != theG4tgrVolumeMap.end() )
147   {                                               144   {
148     G4String ErrMessage =                      << 145     G4String ErrMessage = "Cannot be two volumes with the same name... "
149       "Cannot be two volumes with the same nam << 146                         + vol->GetName();
150     G4Exception("G4tgrVolumeMgr::RegisterMe()" << 147     G4Exception("G4tgrVolumeMgr::RegisterMe()", "InvalidSetup",
151                 ErrMessage);                   << 148                 FatalException, ErrMessage);
152   }                                               149   }
153   theG4tgrVolumeMap.insert(G4mapsvol::value_ty << 150   theG4tgrVolumeMap.insert(G4mapsvol::value_type(vol->GetName(), vol) ); 
154 }                                                 151 }
155                                                   152 
156 // ------------------------------------------- << 153 
157 void G4tgrVolumeMgr::UnRegisterMe(G4tgrVolume* << 154 //-------------------------------------------------------------
                                                   >> 155 void G4tgrVolumeMgr::UnRegisterMe( G4tgrVolume* vol ) 
158 {                                                 156 {
159   std::vector<G4tgrVolume*>::const_iterator it << 157   std::vector<G4tgrVolume*>::iterator ite;
160   for(ite = theG4tgrVolumeList.cbegin();       << 158   for(ite = theG4tgrVolumeList.begin(); ite != theG4tgrVolumeList.end(); ite++)
161       ite != theG4tgrVolumeList.cend(); ++ite) << 
162   {                                               159   {
163     if((*ite) == vol)                          << 160     if((*ite) == vol )  { break; }
164     {                                          << 
165       break;                                   << 
166     }                                          << 
167   }                                               161   }
168   if(ite == theG4tgrVolumeList.cend())         << 162   if( ite == theG4tgrVolumeList.end() )
169   {                                            << 163   { 
170     G4String ErrMessage =                      << 164     G4String ErrMessage = "Cannot unregister a volume not registered... "
171       "Cannot unregister a volume not register << 165                         + vol->GetName();
172     G4Exception("G4tgrVolumeMgr::unRegisterMe(    166     G4Exception("G4tgrVolumeMgr::unRegisterMe()", "InvalidSetup",
173                 FatalException, ErrMessage);      167                 FatalException, ErrMessage);
174   }                                               168   }
175   else                                            169   else
176   {                                               170   {
177     theG4tgrVolumeList.erase(ite);             << 171     theG4tgrVolumeList.erase( ite );
178   }                                               172   }
179   theG4tgrVolumeMap.erase(theG4tgrVolumeMap.fi << 173   theG4tgrVolumeMap.erase( theG4tgrVolumeMap.find( vol->GetName() ) ); 
180 }                                                 174 }
181                                                   175 
182 // ------------------------------------------- << 176 
183 void G4tgrVolumeMgr::RegisterParentChild(const << 177 //-------------------------------------------------------------
184                                          const << 178 
185 {                                              << 179 void G4tgrVolumeMgr::RegisterParentChild( const G4String& parentName,
186   theG4tgrVolumeTree.insert(G4mmapspl::value_t << 180                                           const G4tgrPlace* pl )
                                                   >> 181 { 
                                                   >> 182   theG4tgrVolumeTree.insert(G4mmapspl::value_type(parentName, pl) );
187 }                                                 183 }
188                                                   184 
189 // ------------------------------------------- << 
190 G4tgrSolid* G4tgrVolumeMgr::FindSolid(const G4 << 
191 {                                              << 
192   G4tgrSolid* vol = nullptr;                   << 
193                                                   185 
194   G4mapssol::const_iterator svite = theG4tgrSo << 186 //-------------------------------------------------------------
195   if(svite == theG4tgrSolidMap.cend())         << 187 G4tgrSolid* G4tgrVolumeMgr::FindSolid( const G4String& volname, G4bool exists )
                                                   >> 188 {
                                                   >> 189   G4tgrSolid* vol = 0;
                                                   >> 190   
                                                   >> 191   G4mapssol::iterator svite = theG4tgrSolidMap.find( volname );
                                                   >> 192   if( svite == theG4tgrSolidMap.end() )
196   {                                               193   {
197     if(exists)                                 << 194     if( exists )
198     {                                             195     {
199       for(svite = theG4tgrSolidMap.cbegin();   << 196       for( svite = theG4tgrSolidMap.begin();
200           svite != theG4tgrSolidMap.cend(); ++ << 197            svite != theG4tgrSolidMap.end(); svite++ ) 
201       {                                           198       {
202         G4cerr << " VOL:" << (*svite).first <<    199         G4cerr << " VOL:" << (*svite).first << G4endl;
203       }                                           200       }
204       G4String ErrMessage = "Solid not found..    201       G4String ErrMessage = "Solid not found... " + volname;
205       G4Exception("G4tgrVolumeMgr::FindSolid() << 202       G4Exception("G4tgrVolumeMgr::FindSolid()", "InvalidSetup",
206                   ErrMessage);                 << 203                   FatalException, ErrMessage);
207     }                                             204     }
208   }                                               205   }
209   else                                            206   else
210   {                                               207   {
211     vol = const_cast<G4tgrSolid*>((*svite).sec    208     vol = const_cast<G4tgrSolid*>((*svite).second);
212   }                                               209   }
213                                                   210 
214   return vol;                                     211   return vol;
215 }                                                 212 }
216                                                   213 
217 // ------------------------------------------- << 
218 G4tgrVolume* G4tgrVolumeMgr::FindVolume(const  << 
219 {                                              << 
220   G4tgrVolume* vol = nullptr;                  << 
221                                                   214 
222   G4mapsvol::const_iterator svite = theG4tgrVo << 215 //-------------------------------------------------------------
223   if(svite == theG4tgrVolumeMap.cend())        << 216 G4tgrVolume*
                                                   >> 217 G4tgrVolumeMgr::FindVolume( const G4String& volname, G4bool exists ) 
                                                   >> 218 {
                                                   >> 219   G4tgrVolume* vol = 0;
                                                   >> 220   
                                                   >> 221   G4mapsvol::iterator svite = theG4tgrVolumeMap.find( volname );
                                                   >> 222   if( svite == theG4tgrVolumeMap.end() )
224   {                                               223   {
225     if(exists)                                 << 224     if( exists )
226     {                                             225     {
227       for(svite = theG4tgrVolumeMap.cbegin();  << 226       for( svite = theG4tgrVolumeMap.begin();
228           svite != theG4tgrVolumeMap.cend(); + << 227            svite != theG4tgrVolumeMap.end(); svite++ )
229       {                                           228       {
230         G4cerr << " VOL:" << (*svite).first <<    229         G4cerr << " VOL:" << (*svite).first << G4endl;
231       }                                           230       }
232       G4String ErrMessage = "Volume not found.    231       G4String ErrMessage = "Volume not found... " + volname;
233       G4Exception("G4tgrVolumeMgr::FindVolume(    232       G4Exception("G4tgrVolumeMgr::FindVolume()", "InvalidSetup",
234                   FatalException, ErrMessage);    233                   FatalException, ErrMessage);
235     }                                             234     }
236     else                                          235     else
237     {                                             236     {
238       G4String WarMessage = "Volume does not e    237       G4String WarMessage = "Volume does not exists... " + volname;
239       G4Exception("G4tgrVolumeMgr::FindVolume( << 238       G4Exception("G4tgrVolumeMgr::FindVolume()", "SearchFailed",
240                   WarMessage);                 << 239                   JustWarning, WarMessage);
241     }                                             240     }
242   }                                               241   }
243   else                                            242   else
244   {                                               243   {
245     vol = const_cast<G4tgrVolume*>((*svite).se    244     vol = const_cast<G4tgrVolume*>((*svite).second);
246   }                                               245   }
247                                                   246 
248   return vol;                                     247   return vol;
249 }                                                 248 }
250                                                   249 
251 // ------------------------------------------- << 250 //-------------------------------------------------------------
252 std::vector<G4tgrVolume*> G4tgrVolumeMgr::Find << 251 std::vector<G4tgrVolume*>
253                                                << 252 G4tgrVolumeMgr::FindVolumes( const G4String& volname, G4bool exists ) 
254 {                                                 253 {
255   std::vector<G4tgrVolume*> vols;                 254   std::vector<G4tgrVolume*> vols;
256                                                << 255   
257   G4mapsvol::const_iterator svite;             << 256   G4mapsvol::iterator svite;
258   for(svite = theG4tgrVolumeMap.cbegin();      << 257   for( svite = theG4tgrVolumeMap.begin();
259       svite != theG4tgrVolumeMap.cend(); ++svi << 258        svite != theG4tgrVolumeMap.end(); svite++ )
260   {                                               259   {
261     if(G4tgrUtils::AreWordsEquivalent(volname, << 260     if( G4tgrUtils::AreWordsEquivalent( volname, (*svite).second->GetName()) )
262     {                                             261     {
263       vols.push_back(const_cast<G4tgrVolume*>( << 262       vols.push_back(const_cast<G4tgrVolume*>((*svite).second) );
264     }                                             263     }
265   }                                               264   }
266                                                   265 
267   if(vols.size() == 0)                         << 266   if( vols.size() == 0 ) 
268   {                                               267   {
269     if(exists)                                 << 268     if( exists )
270     {                                             269     {
271       for(svite = theG4tgrVolumeMap.cbegin();  << 270       for( svite = theG4tgrVolumeMap.begin();
272           svite != theG4tgrVolumeMap.cend(); + << 271            svite != theG4tgrVolumeMap.end(); svite++ )
273       {                                           272       {
274         G4cerr << " VOL:" << (*svite).first <<    273         G4cerr << " VOL:" << (*svite).first << G4endl;
275       }                                           274       }
276       G4String ErrMessage = "Volume not found.    275       G4String ErrMessage = "Volume not found... " + volname;
277       G4Exception("G4tgrVolumeMgr::FindVolumes    276       G4Exception("G4tgrVolumeMgr::FindVolumes()", "InvalidSetup",
278                   FatalException, ErrMessage);    277                   FatalException, ErrMessage);
279     }                                             278     }
280     else                                          279     else
281     {                                             280     {
282       G4String WarMessage = "Volume does not e    281       G4String WarMessage = "Volume does not exists... " + volname;
283       G4Exception("G4tgrVolumeMgr::FindVolumes << 282       G4Exception("G4tgrVolumeMgr::FindVolumes()", "SearchFailed",
284                   WarMessage);                 << 283                   JustWarning, WarMessage);
285     }                                             284     }
286   }                                               285   }
287                                                   286 
288   return vols;                                    287   return vols;
289 }                                                 288 }
290                                                   289 
291 // ------------------------------------------- << 290 
                                                   >> 291 //-------------------------------------------------------------
292 const G4tgrVolume* G4tgrVolumeMgr::GetTopVolum    292 const G4tgrVolume* G4tgrVolumeMgr::GetTopVolume()
293 {                                                 293 {
294   //--- Start from any G4tgrVolume and go upwa    294   //--- Start from any G4tgrVolume and go upwards until you get to the top.
295   //    Check that indeed all volumes drive to << 295   //    Check that indeed all volumes drive to the same top volume 
296                                                   296 
297   const G4tgrVolume* topVol = nullptr;         << 297   const G4tgrVolume* topVol = 0;
298   for(auto itetv = theG4tgrVolumeMap.cbegin(); << 298   G4mapsvol::const_iterator itetv;
299            itetv != theG4tgrVolumeMap.cend();  << 299   for( itetv = theG4tgrVolumeMap.begin();
                                                   >> 300        itetv != theG4tgrVolumeMap.end(); itetv++ )
300   {                                               301   {
301     const G4tgrVolume* vol = (*itetv).second;     302     const G4tgrVolume* vol = (*itetv).second;
302 #ifdef G4VERBOSE                                  303 #ifdef G4VERBOSE
303     if(G4tgrMessenger::GetVerboseLevel() >= 3) << 304     if( G4tgrMessenger::GetVerboseLevel() >= 3 )
304     {                                             305     {
305       G4cout << " G4tgrVolumeMgr::GetTopVolume << 306       G4cout << " G4tgrVolumeMgr::GetTopVolume() - Vol: "
306              << " no place = " << vol->GetPlac << 307              << vol->GetName() << " no place = "
                                                   >> 308              <<  vol->GetPlacements().size() << G4endl;
307     }                                             309     }
308 #endif                                            310 #endif
309                                                << 311       
310     while(vol->GetPlacements().size() != 0)    << 312     while( vol->GetPlacements().size() != 0 )
311     {                                             313     {
312       vol = FindVolume((*(vol->GetPlacements() << 314       vol = FindVolume((*(vol->GetPlacements()).begin())->GetParentName(), 1);
313 #ifdef G4VERBOSE                                  315 #ifdef G4VERBOSE
314       if(G4tgrMessenger::GetVerboseLevel() >=  << 316       if( G4tgrMessenger::GetVerboseLevel() >= 3 )
315       {                                           317       {
316         G4cout << " G4tgrVolumeMgr::GetTopVolu << 318         G4cout << " G4tgrVolumeMgr::GetTopVolume() - Vol: "
317                << " N place = " << vol->GetPla << 319                << vol->GetName()<< " N place = "
                                                   >> 320                <<  vol->GetPlacements().size() << G4endl;
318       }                                           321       }
319 #endif                                            322 #endif
320     }                                             323     }
321     if((topVol != nullptr) && (topVol != vol)  << 324     if ( (topVol != 0) && (topVol != vol)
322        (topVol->GetType() != "VOLDivision") && << 325       && (topVol->GetType() != "VOLDivision")
323        (vol->GetType() != "VOLDivision"))      << 326       && (vol->GetType() != "VOLDivision") ) 
324     {                                             327     {
325       G4Exception("G4tgrVolumeMgr::GetTopVolum    328       G4Exception("G4tgrVolumeMgr::GetTopVolume()",
326                   "Two world volumes found, se    329                   "Two world volumes found, second will be taken", JustWarning,
327                   (G4String("Both volumes are  << 330                   (G4String("Both volumes are at the top of a hierarchy: ")
328                    topVol->GetName() + " & " + << 331                    + topVol->GetName() + " & " + vol->GetName() ).c_str());
329                     .c_str());                 << 
330     }                                             332     }
331     topVol = vol;                                 333     topVol = vol;
332   }                                               334   }
333                                                   335 
334   return topVol;                                  336   return topVol;
335 }                                                 337 }
336                                                   338 
337 // ------------------------------------------- << 339 
                                                   >> 340 //-------------------------------------------------------------
338 std::pair<G4mmapspl::iterator, G4mmapspl::iter    341 std::pair<G4mmapspl::iterator, G4mmapspl::iterator>
339 G4tgrVolumeMgr::GetChildren(const G4String& na << 342 G4tgrVolumeMgr::GetChildren( const G4String& name )
340 {                                                 343 {
341   std::pair<G4mmapspl::iterator, G4mmapspl::it    344   std::pair<G4mmapspl::iterator, G4mmapspl::iterator> dite;
342   dite = theG4tgrVolumeTree.equal_range(name); << 345   dite = theG4tgrVolumeTree.equal_range( name );
343   return dite;                                    346   return dite;
344 }                                                 347 }
345                                                   348 
346 // ------------------------------------------- << 349 
                                                   >> 350 //-------------------------------------------------------------
347 void G4tgrVolumeMgr::DumpVolumeTree()             351 void G4tgrVolumeMgr::DumpVolumeTree()
348 {                                                 352 {
349   G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrVo    353   G4cout << " @@@@@@@@@@@@@@@@ DUMPING G4tgrVolume's Tree  " << G4endl;
350                                                   354 
351   const G4tgrVolume* vol = GetTopVolume();        355   const G4tgrVolume* vol = GetTopVolume();
352                                                   356 
353   DumpVolumeLeaf(vol, 0, 0);                   << 357   DumpVolumeLeaf( vol, 0, 0);
354 }                                                 358 }
355                                                   359 
356 // ------------------------------------------- << 360 
357 void G4tgrVolumeMgr::DumpVolumeLeaf(const G4tg << 361 //-------------------------------------------------------------
358                                     unsigned i << 362 void G4tgrVolumeMgr::DumpVolumeLeaf( const G4tgrVolume* vol,
                                                   >> 363                                      unsigned int copyNo,
                                                   >> 364                                      unsigned int leafDepth)
359 {                                                 365 {
360   for(std::size_t ii = 0; ii < leafDepth; ++ii << 366   for( size_t ii=0; ii < leafDepth; ii++ )
361   {                                               367   {
362     G4cout << "  ";                               368     G4cout << "  ";
363   }                                               369   }
364   G4cout << " VOL:(" << leafDepth << ")" << vo << 370   G4cout << " VOL:(" << leafDepth << ")" <<  vol->GetName()
365          << copyNo << G4endl;                  << 371          << "   copy No " << copyNo << G4endl;
366                                                   372 
367   //---------- construct the children of this     373   //---------- construct the children of this VOL
368   std::pair<G4mmapspl::iterator, G4mmapspl::it << 374   std::pair<G4mmapspl::iterator, G4mmapspl::iterator> children
369     GetChildren(vol->GetName());               << 375     = GetChildren( vol->GetName() );
370   G4mmapspl::const_iterator cite;              << 376   G4mmapspl::const_iterator cite; 
371                                                   377 
372   ++leafDepth;                                 << 378   leafDepth++;
373   for(cite = children.first; cite != children. << 379   for( cite = children.first; cite != children.second; cite++ )
374   {                                               380   {
375     //---- find G4tgrVolume pointed by G4tgrPl    381     //---- find G4tgrVolume pointed by G4tgrPlace
376     const G4tgrPlace* pla       = (*cite).seco << 382     const G4tgrPlace* pla = (*cite).second;
377     const G4tgrVolume* volchild = pla->GetVolu    383     const G4tgrVolume* volchild = pla->GetVolume();
378     //--- find copyNo                             384     //--- find copyNo
379     unsigned int cn = pla->GetCopyNo();           385     unsigned int cn = pla->GetCopyNo();
380     DumpVolumeLeaf(volchild, cn, leafDepth);   << 386     DumpVolumeLeaf( volchild, cn, leafDepth );
381   }                                               387   }
382 }                                                 388 }
383                                                   389 
384 // ------------------------------------------- << 390 
                                                   >> 391 //-------------------------------------------------------------
385 void G4tgrVolumeMgr::DumpSummary()                392 void G4tgrVolumeMgr::DumpSummary()
386 {                                                 393 {
387   //---------- Dump number of objects of each     394   //---------- Dump number of objects of each class
388   G4cout << " @@@@@@@@@@@@@@@@@@ Dumping Detec    395   G4cout << " @@@@@@@@@@@@@@@@@@ Dumping Detector Summary " << G4endl;
389   G4cout << " @@@ Geometry built inside world     396   G4cout << " @@@ Geometry built inside world volume: "
390          << GetTopVolume()->GetName() << G4end    397          << GetTopVolume()->GetName() << G4endl;
391   G4cout << " Number of G4tgrVolume's: " << th << 398   G4cout << " Number of G4tgrVolume's: "
                                                   >> 399          << theG4tgrVolumeMap.size() << G4endl;
                                                   >> 400   G4mapsvol::const_iterator cite;
392   unsigned int nPlace = 0;                        401   unsigned int nPlace = 0;
393   for(auto cite = theG4tgrVolumeMap.cbegin();  << 402   for( cite = theG4tgrVolumeMap.begin();
394       cite != theG4tgrVolumeMap.cend(); ++cite << 403        cite != theG4tgrVolumeMap.end(); cite++ )
395   {                                               404   {
396     nPlace += ((*cite).second)->GetPlacements(    405     nPlace += ((*cite).second)->GetPlacements().size();
397   }                                               406   }
398   G4cout << " Number of G4tgrPlace's: " << nPl    407   G4cout << " Number of G4tgrPlace's: " << nPlace << G4endl;
399                                                   408 
400   G4tgrMaterialFactory* matef = G4tgrMaterialF    409   G4tgrMaterialFactory* matef = G4tgrMaterialFactory::GetInstance();
401   G4cout << " Number of G4tgrIsotope's: " << m << 410   G4cout << " Number of G4tgrIsotope's: "
402          << G4endl;                            << 411          << matef->GetIsotopeList().size() << G4endl;
403   G4cout << " Number of G4tgrElement's: " << m << 412   G4cout << " Number of G4tgrElement's: "
404          << G4endl;                            << 413          << matef->GetElementList().size() << G4endl;
405   G4cout << " Number of G4tgrMaterial's: " <<  << 414   G4cout << " Number of G4tgrMaterial's: "
406          << G4endl;                            << 415          << matef->GetMaterialList().size() << G4endl;
407                                                   416 
408   G4tgrRotationMatrixFactory* rotmf = G4tgrRot    417   G4tgrRotationMatrixFactory* rotmf = G4tgrRotationMatrixFactory::GetInstance();
409   G4cout << " Number of G4tgrRotationMatrix's:    418   G4cout << " Number of G4tgrRotationMatrix's: "
410          << rotmf->GetRotMatList().size() << G    419          << rotmf->GetRotMatList().size() << G4endl;
411                                                   420 
                                                   >> 421 
412   //---------- Dump detail list of objects of     422   //---------- Dump detail list of objects of each class
413   DumpVolumeTree();                               423   DumpVolumeTree();
414                                                << 424   
415   matef->DumpIsotopeList();                       425   matef->DumpIsotopeList();
416   matef->DumpElementList();                       426   matef->DumpElementList();
417   matef->DumpMaterialList();                      427   matef->DumpMaterialList();
418   rotmf->DumpRotmList();                          428   rotmf->DumpRotmList();
419 }                                                 429 }
420                                                   430