00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "G4tgrVolumeAssembly.hh"
00037 #include "G4tgrUtils.hh"
00038 #include "G4tgrVolumeMgr.hh"
00039 #include "G4tgrPlaceSimple.hh"
00040 #include "G4tgrPlaceDivRep.hh"
00041 #include "G4tgrPlaceParameterisation.hh"
00042 #include "G4tgrFileReader.hh"
00043 #include "G4tgrMessenger.hh"
00044
00045
00046 G4tgrVolumeAssembly::G4tgrVolumeAssembly()
00047 {
00048 }
00049
00050
00051
00052 G4tgrVolumeAssembly::~G4tgrVolumeAssembly()
00053 {
00054 }
00055
00056
00057
00058 G4tgrVolumeAssembly::G4tgrVolumeAssembly( const std::vector<G4String>& wl )
00059 {
00060 theType = "VOLAssembly";
00061
00062
00063 theName = G4tgrUtils::GetString( wl[1] );
00064
00065 G4int nVol = G4tgrUtils::GetInt( wl[2] );
00066
00067 G4tgrUtils::CheckWLsize( wl, 3+nVol*5, WLSIZE_GE,
00068 "G4tgrVolumeAssembly::G4tgrVolumeAssembly" );
00069
00070
00071 for(G4int ii=0; ii<nVol*5; ii+=5)
00072 {
00073 #ifdef G4VERBOSE
00074 if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00075 {
00076 G4cout << " G4tgrVolumeAssembly::G4tgrVolumeAssembly() -"
00077 << " Adding component: " << ii << " - " << wl[ii+3] << G4endl;
00078 }
00079 #endif
00080 theComponentNames.push_back(G4tgrUtils::GetString( wl[3+ii+0]));
00081 theComponentRMs.push_back(G4tgrUtils::GetString( wl[3+ii+1]));
00082 theComponentPos.push_back(G4ThreeVector(G4tgrUtils::GetDouble(wl[3+ii+2]),
00083 G4tgrUtils::GetDouble(wl[3+ii+3]),
00084 G4tgrUtils::GetDouble(wl[3+ii+4])));
00085 }
00086 theVisibility = 1;
00087 theRGBColour = new G4double[4];
00088 for (size_t ii=0; ii<4; ii++) { theRGBColour[ii] = -1.; }
00089
00090 theSolid = 0;
00091
00092 #ifdef G4VERBOSE
00093 if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00094 {
00095 G4cout << " Created " << *this << G4endl;
00096 }
00097 #endif
00098
00099 }
00100
00101
00102
00103 G4tgrPlace* G4tgrVolumeAssembly::AddPlace( const std::vector<G4String>& wl )
00104 {
00105
00106 G4tgrUtils::CheckWLsize( wl, 7, WLSIZE_EQ, " G4tgrVolumeAssembly::AddPlace");
00107
00108
00109 G4tgrPlaceSimple* pl = new G4tgrPlaceSimple( wl );
00110
00111 pl->SetVolume( this );
00112 thePlacements.push_back( pl );
00113
00114 #ifdef G4VERBOSE
00115 if( G4tgrMessenger::GetVerboseLevel() >= 2 )
00116 {
00117 G4cout << " New placement: " << thePlacements.size()
00118 << " added for Volume " << theName
00119 << " inside " << pl->GetParentName()
00120 << " type " << pl->GetType() << G4endl;
00121 }
00122 #endif
00123
00124 G4tgrVolumeMgr::GetInstance()->RegisterParentChild( pl->GetParentName(), pl );
00125
00126 return pl;
00127 }
00128
00129
00130
00131 std::ostream& operator<<(std::ostream& os, const G4tgrVolumeAssembly& obj)
00132 {
00133 os << "G4tgrVolumeAssembly= " << obj.theName;
00134
00135 for( size_t ii = 0; ii < obj.theComponentNames.size(); ii++ )
00136 {
00137 os << obj.theComponentNames[ii] << " RotMatName= "
00138 << obj.theComponentRMs[ii] << " Position= "
00139 << obj.theComponentPos[ii].x() << " "
00140 << obj.theComponentPos[ii].y() << " "
00141 << obj.theComponentPos[ii].z();
00142 }
00143 os << G4endl;
00144
00145 return os;
00146 }