00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // 00030 // G4NavigationHistory Implementation 00031 // 00032 // Author: P.Kent, August 96 00033 // 00034 // ---------------------------------------------------------------------- 00035 00036 #include "G4NavigationHistory.hh" 00037 #include "G4ios.hh" 00038 00039 #ifndef WIN32 00040 // Initialise static data for the specialized memory pool 00041 // for the internal STL vector of histories ... 00042 // 00043 G4ChunkIndexType* G4AllocStats::allocStat = 0; 00044 G4int G4AllocStats::totSpace = 0; 00045 G4int G4AllocStats::numCat = 0; 00046 #endif 00047 00048 G4NavigationHistory::G4NavigationHistory() 00049 : fNavHistory(kHistoryMax), fStackDepth(0) 00050 { 00051 Clear(); 00052 } 00053 00054 G4NavigationHistory::G4NavigationHistory(const G4NavigationHistory &h) 00055 : fNavHistory(h.fNavHistory), fStackDepth(h.fStackDepth) 00056 { 00057 } 00058 00059 G4NavigationHistory::~G4NavigationHistory() 00060 { 00061 } 00062 00063 std::ostream& 00064 operator << (std::ostream& os, const G4NavigationHistory& nav) 00065 { 00066 G4cout << "History depth=" << nav.GetDepth() << G4endl; 00067 for ( G4int i=0; i<=nav.GetDepth(); i++ ) 00068 { 00069 os << "Level=["<<i<<"]: "; 00070 if( nav.GetVolume(i) != 0 ) 00071 { 00072 os << "Phys Name=["<< nav.GetVolume(i)->GetName() 00073 << "] Type=["; 00074 switch(nav.GetVolumeType(i)) 00075 { 00076 case kNormal: 00077 os << "N"; 00078 break; 00079 case kReplica: 00080 os << "R" << nav.GetReplicaNo(i); 00081 break; 00082 case kParameterised: 00083 os << "P" << nav.GetReplicaNo(i); 00084 break; 00085 } 00086 os << "]"; 00087 } 00088 else 00089 { 00090 os << "Phys = <Null>"; 00091 } 00092 os << G4endl; 00093 } 00094 return os; 00095 }