85 : theFile(0), theRotationNumber(0)
103 theFile =
new std::ofstream(fname);
113 G4PhysicalVolumeStore::const_iterator ite;
118 if( lv == 0 ) {
break; }
121 for( ite = pvstore->begin(); ite != pvstore->end(); ite++ )
196 std::vector<G4VPhysicalVolume*> pvChildren =
GetPVChildren( lv );
197 std::vector<G4VPhysicalVolume*>::const_iterator ite;
198 for( ite = pvChildren.begin(); ite != pvChildren.end(); ite++ )
223 G4cout <<
" G4tgbGeometryDumper::DumpPVPlacement() - Reflected volume: "
233 G4Rep3x3 rottemp(colx.x(),coly.x(),colz.x(),
234 colx.y(),coly.y(),colz.y(),
235 colx.z(),coly.z(),colz.z());
238 *rotMat = (*rotMat).inverse();
258 <<
" " << copyNo <<
" "
261 << pos.x() <<
" " << pos.y() <<
" " << pos.z() <<
G4endl;
286 std::vector<G4double> newParams;
290 for(
G4int ii = 0; ii < nReplicas; ii++ )
377 if( ii == 0 || mate1st != newMate || params1st[0] != newParams[0] )
385 lvName =
DumpLogVol( lv, extraName, newSolid, newMate );
424 G4String ErrMessage =
"Unknown axis of replication for volume"
446 <<
" " << offset <<
G4endl;
451 <<
" " << width/
deg <<
"*deg"
452 <<
" " << offset/
deg <<
"*deg" <<
G4endl;
467 if( extraName ==
"" )
473 lvName = lv->
GetName()+extraName;
481 if( !solid ) { solid = lv->
GetSolid(); }
516 if (numElements == 1)
518 (*theFile) <<
":MATE " <<
AddQuotes(mateName) <<
" "
526 for (
size_t ii = 0; ii < numElements; ii++)
531 (*theFile) <<
":MIXT "<<
AddQuotes(mateName) <<
" "
532 << density <<
" " << numElements <<
G4endl;
534 for (
size_t ii = 0; ii < numElements; ii++)
538 << fractions[ii] <<
G4endl;
543 (*theFile) <<
":MATE_MEE " <<
AddQuotes(mateName) <<
" "
547 (*theFile) <<
":MATE_TEMPERATURE " <<
AddQuotes(mateName) <<
" "
550 (*theFile) <<
":MATE_PRESSURE " <<
AddQuotes(mateName) <<
" "
557 stateStr =
"Undefined";
570 (*theFile) <<
":MATE_STATE " <<
AddQuotes(mateName) <<
" "
593 if( symbol ==
"" || symbol ==
" " )
600 (*theFile) <<
":ELEM " <<
AddQuotes(elemName) <<
" "
612 (*theFile) <<
":ELEM_FROM_ISOT " <<
AddQuotes(elemName) <<
" "
620 << fractions[ii] <<
G4endl;
636 (*theFile) <<
":ISOT " <<
AddQuotes(isotName) <<
" "
637 << isot->
GetZ() <<
" " << isot->
GetN() <<
" "
649 if( extraName ==
"" )
655 solidName = solid->
GetName()+extraName;
666 if (solidType ==
"UNIONSOLID")
670 }
else if (solidType ==
"SUBTRACTIONSOLID") {
673 }
else if (solidType ==
"INTERSECTIONSOLID") {
676 }
else if (solidType ==
"REFLECTEDSOLID") {
689 (*theFile) <<
":SOLID " <<
AddQuotes(solidName) <<
" ";
690 (*theFile) <<
AddQuotes(solidType) <<
" ";
704 if (!bso) {
return; }
723 GetTransform().NetRotation()).inverse() ) );
736 (*theFile) <<
":SOLID "
754 for(
size_t ii = 0 ; ii < params.size(); ii++ )
756 (*theFile) << params[ii] <<
" " ;
765 std::vector<G4double> params;
770 if (solidType ==
"BOX") {
771 const G4Box * sb = dynamic_cast <
const G4Box*>(so);
777 }
else if (solidType ==
"TUBS") {
778 const G4Tubs * tu = dynamic_cast <
const G4Tubs * > (so);
786 }
else if (solidType ==
"TRAP") {
787 const G4Trap * trp = dynamic_cast <
const G4Trap * > (so);
793 params.push_back( theta );
794 params.push_back( phi);
804 }
else if (solidType ==
"TRD") {
805 const G4Trd * tr = dynamic_cast <
const G4Trd * > (so);
813 }
else if (solidType ==
"PARA") {
814 const G4Para * para = dynamic_cast <
const G4Para * > (so);
824 params.push_back( phi/
deg);
826 }
else if (solidType ==
"CONS") {
827 const G4Cons * cn = dynamic_cast <
const G4Cons * > (so);
837 }
else if (solidType ==
"SPHERE") {
847 }
else if (solidType ==
"ORB") {
848 const G4Orb * orb = dynamic_cast <
const G4Orb * > (so);
852 }
else if (solidType ==
"TORUS") {
855 params.push_back( torus->
GetRmin());
856 params.push_back( torus->
GetRmax());
857 params.push_back( torus->
GetRtor());
861 }
else if (solidType ==
"POLYCONE") {
867 if( angphi > 180*
deg ) { angphi -= 360*
deg; }
869 params.push_back( angphi );
871 params.push_back( ncor );
873 for(
G4int ii = 0; ii < ncor; ii++ )
879 }
else if (solidType ==
"GENERICPOLYCONE") {
885 if( angphi > 180*
deg ) { angphi -= 360*
deg; }
887 if( endphi > 180*
deg ) { endphi -= 360*
deg; }
889 params.push_back( angphi );
890 params.push_back( endphi-angphi );
891 params.push_back( ncor );
893 for(
G4int ii = 0; ii < ncor; ii++ )
899 }
else if (solidType ==
"POLYHEDRA") {
905 if( angphi > 180*
deg ) angphi -= 360*
deg;
909 params.push_back( angphi );
912 params.push_back( ncor );
914 for(
G4int ii = 0; ii < ncor; ii++ )
920 }
else if (solidType ==
"ELLIPTICALTUBE") {
924 params.push_back( eltu->
GetDx());
925 params.push_back( eltu->
GetDy());
926 params.push_back( eltu->
GetDz());
928 }
else if (solidType ==
"ELLIPSOID" ){
937 }
else if (solidType ==
"ELLIPTICAL_CONE") {
941 params.push_back( elco-> GetSemiAxisX() );
942 params.push_back( elco-> GetSemiAxisY() );
943 params.push_back( elco-> GetZMax() );
944 params.push_back( elco-> GetZTopCut() );
946 }
else if (solidType ==
"HYPE") {
947 const G4Hype* hype = dynamic_cast <
const G4Hype * > (so);
957 }
else if( solidType ==
"TWISTEDBOX" ) {
965 }
else if( solidType ==
"TWISTEDTRAP" ) {
980 }
else if( solidType ==
"TWISTEDTRD" ) {
990 }
else if( solidType ==
"TWISTEDTUBS" ) {
1002 G4String ErrMessage =
"Solid type not supported, sorry... " + solidType;
1003 G4Exception(
"G4tgbGeometryDumpe::DumpSolidParams()",
1018 if( rotName !=
"" ) {
return rotName; }
1023 (*theFile) <<
":ROTM ";
1027 (*theFile) <<
AddQuotes(rotName) << std::setprecision(9) <<
" "
1040 (*theFile) <<
":ROTM ";
1060 std::vector<G4VPhysicalVolume*>
1064 G4PhysicalVolumeStore::const_iterator ite;
1065 std::vector<G4VPhysicalVolume*> children;
1066 for( ite = pvstore->begin(); ite != pvstore->end(); ite++ )
1068 if( (*ite)->GetMotherLogical() == lv )
1070 children.push_back( *ite );
1074 G4cout <<
" G4tgbGeometryDumper::GetPVChildren() - adding children: "
1088 G4String newsolidType = solidType.substr(2,solidType.length() );
1089 for(
size_t ii = 0; ii < newsolidType.length(); ii++ )
1091 newsolidType[ii] = toupper(newsolidType[ii] );
1093 return newsolidType;
1101 return r.xx_*(r.yy_*r.zz_ - r.zy_*r.yz_)
1102 - r.yx_*(r.xy_*r.zz_ - r.zy_*r.xz_)
1103 + r.zx_*(r.xy_*r.yz_ - r.yy_*r.xz_);
1113 if( std::fabs(val) < precision ) { val = 0; }
1124 size_t siz = str.length();
1125 for(
size_t ii = 0; ii < siz; ii++ )
1127 if( str.substr(ii,1) ==
" " )
1145 G4int irefl = name.rfind(
"_refl");
1148 name = name.substr( 0, irefl );
1156 G4int irefl = name.rfind(
"_refl");
1159 name = name.substr( 0, irefl ) +
"_REFL";
1172 std::map<G4String,G4Isotope*>::const_iterator ite;
1175 if( isot == (*ite).second ) {
return (*ite).
first; }
1185 if( isot != isotold )
1193 G4String newIsotName = isotName +
"_"
1195 std::map<G4String,G4Isotope*>::const_iterator ite2 =
1199 isotName = newIsotName;
1206 isotName = newIsotName;
1227 typename std::map<G4String,TYP*>::const_iterator ite;
1228 for( ite = objectsDumped.begin(); ite != objectsDumped.end(); ite++ )
1230 if( obj == (*ite).second ) {
return (*ite).
first; }
1236 ite = objectsDumped.find( objName );
1238 if( ite != objectsDumped.end() )
1240 TYP* objold = (*ite).second;
1247 typename std::map<G4String,TYP*>::const_iterator ite2 =
1248 objectsDumped.find( newObjName );
1249 if( ite2 == objectsDumped.end() )
1251 objName = newObjName;
1298 G4cout <<
" G4tgbGeometryDumper::CheckIfPhysVolExists() - "
1310 G4cerr <<
" G4tgbGeometryDumper::CheckIfPhysVolExists () -"
1311 <<
" Placement found but not same as before : " << name <<
G4endl;
1328 std::map<G4String,G4RotationMatrix*>::const_iterator ite;
1331 if( (*ite).second->isNear( *rotm ) )
1333 rmName = (*ite).
first;
1345 if ( (isot1->
GetZ() != isot2->
GetZ())
1346 || (isot1->
GetN() != isot2->
GetN())
1347 || (isot1->
GetA() != isot2->
GetA()) )
1361 std::map<G4String,G4VSolid*>::const_iterator ite;
1364 if( solid == (*ite).second ) {
return (*ite).
first; }
1369 G4Exception(
"G4tgbGeometryDumper::FindSolidName()",
"ReadError",
1372 return (*ite).first;
G4ThreeVector GetSymAxis() const
G4double GetPressure() const
size_t GetNumberOfIsotopes() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4double GetXHalfLength4() const
G4IonisParamMat * GetIonisation() const
G4double GetXHalfLength() const
G4double GetOuterStereo() const
G4String SupressRefl(G4String name)
G4double GetX1HalfLength() const
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
std::vector< G4Isotope * > G4IsotopeVector
G4double GetY1HalfLength() const
G4double GetPolarAngleTheta() const
const G4String & GetName() const
G4double GetYHalfLength2() const
const G4ThreeVector & GetTranslation() const
std::vector< G4Element * > G4ElementVector
G4double GetYHalfLength1() const
G4double GetInnerStereo() const
CLHEP::Hep3Vector G4ThreeVector
G4double GetInnerRadius() const
CLHEP::HepRotation G4RotationMatrix
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
void DumpIsotope(G4Isotope *ele)
virtual G4bool IsReplicated() const =0
G4String DumpMaterial(G4Material *mat)
const G4String & FindSolidName(G4VSolid *solid)
G4String LookForExistingRotation(const G4RotationMatrix *rotm)
G4Material * GetMaterial() const
const G4String & GetSymbol() const
G4int GetNumRZCorner() const
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
void DumpSolidParams(G4VSolid *so)
G4double GetZTopCut() const
G4double GetZHalfLength() const
G4double GetSurfaceTolerance() const
G4double GetZHalfLength() const
std::map< G4String, G4Material * > theMaterials
G4double GetDensity() const
static G4String ConvertToString(G4bool boolVal)
G4double GetZBottomCut() const
std::map< G4String, G4Element * > theElements
G4double GetOuterRadiusMinusZ() const
G4double GetX2HalfLength() const
G4double GetInnerRadius() const
virtual G4GeometryType GetEntityType() const =0
G4double GetZHalfLength() const
G4double GetDeltaPhiAngle() const
const G4ElementVector * GetElementVector() const
CLHEP::HepRep3x3 G4Rep3x3
G4double GetZHalfLength() const
G4double GetSemiAxisMax(G4int i) const
G4bool IsReflected(G4LogicalVolume *lv) const
G4ThreeVector GetObjectTranslation() const
G4double GetXHalfLength2() const
std::map< G4String, G4LogicalVolume * > theLogVols
static G4ReflectionFactory * Instance()
static G4ThreadLocal G4tgbGeometryDumper * theInstance
G4double GetZHalfLength() const
G4double GetZHalfLength() const
std::vector< G4VPhysicalVolume * > GetPVChildren(G4LogicalVolume *lv)
void DumpPVReplica(G4PVReplica *pv, const G4String &lvName)
G4double GetEndPhi() const
G4double GetTanAlpha2() const
G4int GetNumRZCorner() const
void DumpPhysVol(G4VPhysicalVolume *pv)
G4double GetPhiTwist() const
G4bool CheckIfLogVolExists(const G4String &name, G4LogicalVolume *pt)
static G4PhysicalVolumeStore * GetInstance()
G4double GetY1HalfLength() const
G4double GetXHalfLength2() const
G4double GetRadius() const
void DumpGeometry(const G4String &fname)
G4bool Same2G4Isotopes(G4Isotope *ele1, G4Isotope *ele2)
std::map< G4String, G4VSolid * > theSolids
G4String AddQuotes(const G4String &str)
G4VPVParameterisation * GetParameterisation() const
G4double GetXHalfLength1() const
G4GLOB_DLL std::ostream G4cout
G4double GetDeltaPhiAngle() const
G4double GetStartThetaAngle() const
const G4String & GetName() const
G4double GetXHalfLength3() const
static G4int GetVerboseLevel()
G4double GetY2HalfLength() const
G4String GetTGSolidType(const G4String &solidtype)
G4String GetObjectName(TYP *obj, std::map< G4String, TYP * > objectsDumped)
G4double GetX3HalfLength() const
G4double GetPhiTwist() const
G4double * GetRelativeAbundanceVector() const
G4double GetYHalfLength() const
G4double GetStartPhiAngle() const
G4double GetYHalfLength2() const
G4double GetOuterRadius() const
G4double GetStartPhiAngle() const
G4double GetStartPhi() const
G4double GetInnerRadiusPlusZ() const
G4LogicalVolume * GetMotherLogical() const
G4bool CheckIfPhysVolExists(const G4String &name, G4VPhysicalVolume *)
G4double GetInnerRadius() const
G4PolyconeHistorical * GetOriginalParameters() const
G4double GetStartPhi() const
G4VSolid * GetConstituentMovedSolid() const
G4double GetXHalfLength() const
G4double GetInnerRadius() const
G4double approxTo0(G4double val)
virtual const G4VSolid * GetConstituentSolid(G4int no) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const double kelvin
virtual G4bool IsParameterised() const =0
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
G4double GetX4HalfLength() const
std::map< G4String, G4Isotope * > theIsotopes
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
G4double GetYHalfLength() const
G4IsotopeVector * GetIsotopeVector() const
G4String SubstituteRefl(G4String name)
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
G4double GetZHalfLength() const
G4LogicalVolume * GetLogicalVolume() const
std::map< G4String, G4VPhysicalVolume * > thePhysVols
G4double GetTanAlpha() const
void DumpBooleanVolume(const G4String &solidType, G4VSolid *so)
static G4tgbGeometryDumper * GetInstance()
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
G4VSolid * GetConstituentMovedSolid() const
std::vector< G4double > GetSolidParams(const G4VSolid *so)
void DumpPVParameterised(G4PVParameterised *pv)
G4VPhysicalVolume * GetTopPhysVol()
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
virtual G4int GetCopyNo() const =0
static const G4double ele
static const double atmosphere
const G4RotationMatrix * GetRotation() const
G4PolyhedraHistorical * GetOriginalParameters() const
G4double GetZHalfLength() const
G4double GetZHalfLength() const
G4String GetIsotopeName(G4Isotope *)
G4ThreeVector GetSymAxis() const
G4double MatDeterminant(G4RotationMatrix *ro)
G4double GetZHalfLength() const
G4double GetMeanExcitationEnergy() const
G4double GetAzimuthalAnglePhi() const
G4double GetTemperature() const
G4double GetStartPhi() const
G4double GetXHalfLength1() const
size_t GetNumberOfElements() const
G4double GetOuterRadius() const
G4double GetStartPhiAngle() const
G4PolyhedraSideRZ GetCorner(const G4int index) const
G4double GetYHalfLength1() const
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
G4double GetPhiTwist() const
std::map< G4String, G4RotationMatrix * > theRotMats
G4double GetInnerRadiusMinusZ() const
G4double GetTanAlpha1() const
const G4double * GetFractionVector() const
G4int GetNumRZCorner() const
G4double GetDeltaThetaAngle() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4double GetX1HalfLength() const
G4double GetTiltAngleAlpha() const
G4double GetX2HalfLength() const
G4double GetOuterRadiusPlusZ() const
G4double GetZHalfLength() const
G4double GetOuterRadius() const
G4double GetXHalfLength() const
static const G4double pos
static G4GeometryTolerance * GetInstance()
G4double GetPhiTwist() const
G4VSolid * GetSolid() const
G4double GetOuterRadius() const
G4GLOB_DLL std::ostream G4cerr
G4String DumpLogVol(G4LogicalVolume *lv, G4String extraName="", G4VSolid *solid=0, G4Material *mate=0)
G4double GetY2HalfLength() const
void DumpElement(G4Element *ele)
G4double GetDeltaPhiAngle() const
G4double GetYHalfLength() const