83 : theFile(0), theRotationNumber(0)
101 theFile =
new std::ofstream(fname);
111 G4PhysicalVolumeStore::const_iterator ite;
116 if( lv == 0 ) {
break; }
119 for( ite = pvstore->begin(); ite != pvstore->end(); ite++ )
194 std::vector<G4VPhysicalVolume*> pvChildren =
GetPVChildren( lv );
195 std::vector<G4VPhysicalVolume*>::const_iterator ite;
196 for( ite = pvChildren.begin(); ite != pvChildren.end(); ite++ )
221 G4cout <<
" G4tgbGeometryDumper::DumpPVPlacement() - Reflected volume: "
232 colx.
y(),coly.
y(),colz.
y(),
233 colx.
z(),coly.
z(),colz.
z());
236 *rotMat = (*rotMat).inverse();
256 <<
" " << copyNo <<
" "
259 << pos.
x() <<
" " << pos.
y() <<
" " << pos.
z() <<
G4endl;
284 std::vector<G4double> newParams;
288 for(
G4int ii = 0; ii < nReplicas; ii++ )
375 if( ii == 0 || mate1st != newMate || params1st[0] != newParams[0] )
383 lvName =
DumpLogVol( lv, extraName, newSolid, newMate );
422 G4String ErrMessage =
"Unknown axis of replication for volume"
444 <<
" " << offset <<
G4endl;
449 <<
" " << width/
deg <<
"*deg"
450 <<
" " << offset/
deg <<
"*deg" <<
G4endl;
465 if( extraName ==
"" )
471 lvName = lv->
GetName()+extraName;
479 if( !solid ) { solid = lv->
GetSolid(); }
514 if (numElements == 1)
516 (*theFile) <<
":MATE " <<
AddQuotes(mateName) <<
" "
524 for (
size_t ii = 0; ii < numElements; ii++)
529 (*theFile) <<
":MIXT "<<
AddQuotes(mateName) <<
" "
530 << density <<
" " << numElements <<
G4endl;
532 for (
size_t ii = 0; ii < numElements; ii++)
536 << fractions[ii] <<
G4endl;
541 (*theFile) <<
":MATE_MEE " <<
AddQuotes(mateName) <<
" "
545 (*theFile) <<
":MATE_TEMPERATURE " <<
AddQuotes(mateName) <<
" "
548 (*theFile) <<
":MATE_PRESSURE " <<
AddQuotes(mateName) <<
" "
555 stateStr =
"Undefined";
568 (*theFile) <<
":MATE_STATE " <<
AddQuotes(mateName) <<
" "
591 if( symbol ==
"" || symbol ==
" " )
598 (*theFile) <<
":ELEM " <<
AddQuotes(elemName) <<
" "
610 (*theFile) <<
":ELEM_FROM_ISOT " <<
AddQuotes(elemName) <<
" "
618 << fractions[ii] <<
G4endl;
634 (*theFile) <<
":ISOT " <<
AddQuotes(isotName) <<
" "
635 << isot->
GetZ() <<
" " << isot->
GetN() <<
" "
647 if( extraName ==
"" )
653 solidName = solid->
GetName()+extraName;
664 if (solidType ==
"UNIONSOLID")
668 }
else if (solidType ==
"SUBTRACTIONSOLID") {
671 }
else if (solidType ==
"INTERSECTIONSOLID") {
674 }
else if (solidType ==
"REFLECTEDSOLID") {
687 (*theFile) <<
":SOLID " <<
AddQuotes(solidName) <<
" ";
688 (*theFile) <<
AddQuotes(solidType) <<
" ";
702 if (!bso) {
return; }
721 GetTransform().NetRotation()).inverse() ) );
734 (*theFile) <<
":SOLID "
752 for(
size_t ii = 0 ; ii < params.size(); ii++ )
754 (*theFile) << params[ii] <<
" " ;
763 std::vector<G4double> params;
768 if (solidType ==
"BOX") {
769 const G4Box * sb = dynamic_cast <
const G4Box*>(so);
775 }
else if (solidType ==
"TUBS") {
776 const G4Tubs * tu = dynamic_cast <
const G4Tubs * > (so);
784 }
else if (solidType ==
"TRAP") {
785 const G4Trap * trp = dynamic_cast <
const G4Trap * > (so);
789 params.push_back( symAxis.theta()/
deg);
790 params.push_back( symAxis.phi()/
deg);
800 }
else if (solidType ==
"TRD") {
801 const G4Trd * tr = dynamic_cast <
const G4Trd * > (so);
809 }
else if (solidType ==
"PARA") {
810 const G4Para * para = dynamic_cast <
const G4Para * > (so);
817 params.push_back( symAxis.theta()/
deg);
818 params.push_back( symAxis.phi()/
deg);
820 }
else if (solidType ==
"CONS") {
821 const G4Cons * cn = dynamic_cast <
const G4Cons * > (so);
831 }
else if (solidType ==
"SPHERE") {
841 }
else if (solidType ==
"ORB") {
842 const G4Orb * orb = dynamic_cast <
const G4Orb * > (so);
846 }
else if (solidType ==
"TORUS") {
849 params.push_back( torus->
GetRmin());
850 params.push_back( torus->
GetRmax());
851 params.push_back( torus->
GetRtor());
855 }
else if (solidType ==
"POLYCONE") {
861 if( angphi > 180*
deg ) { angphi -= 360*
deg; }
863 params.push_back( angphi );
865 params.push_back( ncor );
867 for(
G4int ii = 0; ii < ncor; ii++ )
873 }
else if (solidType ==
"GENERICPOLYCONE") {
879 if( angphi > 180*
deg ) { angphi -= 360*
deg; }
881 if( endphi > 180*
deg ) { endphi -= 360*
deg; }
883 params.push_back( angphi );
884 params.push_back( endphi-angphi );
885 params.push_back( ncor );
887 for(
G4int ii = 0; ii < ncor; ii++ )
893 }
else if (solidType ==
"POLYHEDRA") {
899 if( angphi > 180*
deg ) angphi -= 360*
deg;
903 params.push_back( angphi );
906 params.push_back( ncor );
908 for(
G4int ii = 0; ii < ncor; ii++ )
914 }
else if (solidType ==
"ELLIPTICALTUBE") {
918 params.push_back( eltu->
GetDx());
919 params.push_back( eltu->
GetDy());
920 params.push_back( eltu->
GetDz());
922 }
else if (solidType ==
"ELLIPSOID" ){
931 }
else if (solidType ==
"ELLIPTICAL_CONE") {
935 params.push_back( elco-> GetSemiAxisX() );
936 params.push_back( elco-> GetSemiAxisY() );
937 params.push_back( elco-> GetZMax() );
938 params.push_back( elco-> GetZTopCut() );
940 }
else if (solidType ==
"HYPE") {
941 const G4Hype* hype = dynamic_cast <
const G4Hype * > (so);
951 }
else if( solidType ==
"TWISTEDBOX" ) {
959 }
else if( solidType ==
"TWISTEDTRAP" ) {
974 }
else if( solidType ==
"TWISTEDTRD" ) {
984 }
else if( solidType ==
"TWISTEDTUBS" ) {
996 G4String ErrMessage =
"Solid type not supported, sorry... " + solidType;
997 G4Exception(
"G4tgbGeometryDumpe::DumpSolidParams()",
1012 if( rotName !=
"" ) {
return rotName; }
1017 (*theFile) <<
":ROTM ";
1021 (*theFile) <<
AddQuotes(rotName) << std::setprecision(9) <<
" "
1034 (*theFile) <<
":ROTM ";
1054 std::vector<G4VPhysicalVolume*>
1058 G4PhysicalVolumeStore::const_iterator ite;
1059 std::vector<G4VPhysicalVolume*> children;
1060 for( ite = pvstore->begin(); ite != pvstore->end(); ite++ )
1062 if( (*ite)->GetMotherLogical() == lv )
1064 children.push_back( *ite );
1068 G4cout <<
" G4tgbGeometryDumper::GetPVChildren() - adding children: "
1082 G4String newsolidType = solidType.substr(2,solidType.length() );
1083 for(
size_t ii = 0; ii < newsolidType.length(); ii++ )
1085 newsolidType[ii] = toupper(newsolidType[ii] );
1087 return newsolidType;
1107 if( std::fabs(val) < precision ) { val = 0; }
1118 size_t siz = str.length();
1119 for(
size_t ii = 0; ii < siz; ii++ )
1121 if( str.substr(ii,1) ==
" " )
1139 G4int irefl = name.rfind(
"_refl");
1142 name = name.substr( 0, irefl );
1150 G4int irefl = name.rfind(
"_refl");
1153 name = name.substr( 0, irefl ) +
"_REFL";
1166 std::map<G4String,G4Isotope*>::const_iterator ite;
1169 if( isot == (*ite).second ) {
return (*ite).
first; }
1179 if( isot != isotold )
1187 G4String newIsotName = isotName +
"_"
1189 std::map<G4String,G4Isotope*>::const_iterator ite2 =
1193 isotName = newIsotName;
1200 isotName = newIsotName;
1221 typename std::map<G4String,TYP*>::const_iterator ite;
1222 for( ite = objectsDumped.begin(); ite != objectsDumped.end(); ite++ )
1224 if( obj == (*ite).second ) {
return (*ite).
first; }
1230 ite = objectsDumped.find( objName );
1232 if( ite != objectsDumped.end() )
1234 TYP* objold = (*ite).second;
1241 typename std::map<G4String,TYP*>::const_iterator ite2 =
1242 objectsDumped.find( newObjName );
1243 if( ite2 == objectsDumped.end() )
1245 objName = newObjName;
1292 G4cout <<
" G4tgbGeometryDumper::CheckIfPhysVolExists() - "
1304 G4cerr <<
" G4tgbGeometryDumper::CheckIfPhysVolExists () -"
1305 <<
" Placement found but not same as before : " << name <<
G4endl;
1322 std::map<G4String,G4RotationMatrix*>::const_iterator ite;
1325 if( (*ite).second->isNear( *rotm ) )
1327 rmName = (*ite).
first;
1339 if ( (isot1->
GetZ() != isot2->
GetZ())
1340 || (isot1->
GetN() != isot2->
GetN())
1341 || (isot1->
GetA() != isot2->
GetA()) )
1355 std::map<G4String,G4VSolid*>::const_iterator ite;
1358 if( solid == (*ite).second ) {
return (*ite).
first; }
1363 G4Exception(
"G4tgbGeometryDumper::FindSolidName()",
"ReadError",
1366 return (*ite).first;