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);
791 params.push_back( symAxis.theta()/
deg);
792 params.push_back( symAxis.phi()/
deg);
802 }
else if (solidType ==
"TRD") {
803 const G4Trd * tr = dynamic_cast <
const G4Trd * > (so);
811 }
else if (solidType ==
"PARA") {
812 const G4Para * para = dynamic_cast <
const G4Para * > (so);
819 params.push_back( symAxis.theta()/
deg);
820 params.push_back( symAxis.phi()/
deg);
822 }
else if (solidType ==
"CONS") {
823 const G4Cons * cn = dynamic_cast <
const G4Cons * > (so);
833 }
else if (solidType ==
"SPHERE") {
843 }
else if (solidType ==
"ORB") {
844 const G4Orb * orb = dynamic_cast <
const G4Orb * > (so);
848 }
else if (solidType ==
"TORUS") {
851 params.push_back( torus->
GetRmin());
852 params.push_back( torus->
GetRmax());
853 params.push_back( torus->
GetRtor());
857 }
else if (solidType ==
"POLYCONE") {
863 if( angphi > 180*
deg ) { angphi -= 360*
deg; }
865 params.push_back( angphi );
867 params.push_back( ncor );
869 for(
G4int ii = 0; ii < ncor; ii++ )
875 }
else if (solidType ==
"GENERICPOLYCONE") {
881 if( angphi > 180*
deg ) { angphi -= 360*
deg; }
883 if( endphi > 180*
deg ) { endphi -= 360*
deg; }
885 params.push_back( angphi );
886 params.push_back( endphi-angphi );
887 params.push_back( ncor );
889 for(
G4int ii = 0; ii < ncor; ii++ )
895 }
else if (solidType ==
"POLYHEDRA") {
901 if( angphi > 180*
deg ) angphi -= 360*
deg;
905 params.push_back( angphi );
908 params.push_back( ncor );
910 for(
G4int ii = 0; ii < ncor; ii++ )
916 }
else if (solidType ==
"ELLIPTICALTUBE") {
920 params.push_back( eltu->
GetDx());
921 params.push_back( eltu->
GetDy());
922 params.push_back( eltu->
GetDz());
924 }
else if (solidType ==
"ELLIPSOID" ){
933 }
else if (solidType ==
"ELLIPTICAL_CONE") {
937 params.push_back( elco-> GetSemiAxisX() );
938 params.push_back( elco-> GetSemiAxisY() );
939 params.push_back( elco-> GetZMax() );
940 params.push_back( elco-> GetZTopCut() );
942 }
else if (solidType ==
"HYPE") {
943 const G4Hype* hype = dynamic_cast <
const G4Hype * > (so);
953 }
else if( solidType ==
"TWISTEDBOX" ) {
961 }
else if( solidType ==
"TWISTEDTRAP" ) {
976 }
else if( solidType ==
"TWISTEDTRD" ) {
986 }
else if( solidType ==
"TWISTEDTUBS" ) {
998 G4String ErrMessage =
"Solid type not supported, sorry... " + solidType;
999 G4Exception(
"G4tgbGeometryDumpe::DumpSolidParams()",
1014 if( rotName !=
"" ) {
return rotName; }
1019 (*theFile) <<
":ROTM ";
1023 (*theFile) <<
AddQuotes(rotName) << std::setprecision(9) <<
" "
1036 (*theFile) <<
":ROTM ";
1056 std::vector<G4VPhysicalVolume*>
1060 G4PhysicalVolumeStore::const_iterator ite;
1061 std::vector<G4VPhysicalVolume*> children;
1062 for( ite = pvstore->begin(); ite != pvstore->end(); ite++ )
1064 if( (*ite)->GetMotherLogical() == lv )
1066 children.push_back( *ite );
1070 G4cout <<
" G4tgbGeometryDumper::GetPVChildren() - adding children: "
1084 G4String newsolidType = solidType.substr(2,solidType.length() );
1085 for(
size_t ii = 0; ii < newsolidType.length(); ii++ )
1087 newsolidType[ii] = toupper(newsolidType[ii] );
1089 return newsolidType;
1097 return r.xx_*(r.yy_*r.zz_ - r.zy_*r.yz_)
1098 - r.yx_*(r.xy_*r.zz_ - r.zy_*r.xz_)
1099 + r.zx_*(r.xy_*r.yz_ - r.yy_*r.xz_);
1109 if( std::fabs(val) < precision ) { val = 0; }
1120 size_t siz = str.length();
1121 for(
size_t ii = 0; ii < siz; ii++ )
1123 if( str.substr(ii,1) ==
" " )
1141 G4int irefl = name.rfind(
"_refl");
1144 name = name.substr( 0, irefl );
1152 G4int irefl = name.rfind(
"_refl");
1155 name = name.substr( 0, irefl ) +
"_REFL";
1168 std::map<G4String,G4Isotope*>::const_iterator ite;
1171 if( isot == (*ite).second ) {
return (*ite).
first; }
1181 if( isot != isotold )
1189 G4String newIsotName = isotName +
"_"
1191 std::map<G4String,G4Isotope*>::const_iterator ite2 =
1195 isotName = newIsotName;
1202 isotName = newIsotName;
1223 typename std::map<G4String,TYP*>::const_iterator ite;
1224 for( ite = objectsDumped.begin(); ite != objectsDumped.end(); ite++ )
1226 if( obj == (*ite).second ) {
return (*ite).
first; }
1232 ite = objectsDumped.find( objName );
1234 if( ite != objectsDumped.end() )
1236 TYP* objold = (*ite).second;
1243 typename std::map<G4String,TYP*>::const_iterator ite2 =
1244 objectsDumped.find( newObjName );
1245 if( ite2 == objectsDumped.end() )
1247 objName = newObjName;
1294 G4cout <<
" G4tgbGeometryDumper::CheckIfPhysVolExists() - "
1306 G4cerr <<
" G4tgbGeometryDumper::CheckIfPhysVolExists () -"
1307 <<
" Placement found but not same as before : " << name <<
G4endl;
1324 std::map<G4String,G4RotationMatrix*>::const_iterator ite;
1327 if( (*ite).second->isNear( *rotm ) )
1329 rmName = (*ite).
first;
1341 if ( (isot1->
GetZ() != isot2->
GetZ())
1342 || (isot1->
GetN() != isot2->
GetN())
1343 || (isot1->
GetA() != isot2->
GetA()) )
1357 std::map<G4String,G4VSolid*>::const_iterator ite;
1360 if( solid == (*ite).second ) {
return (*ite).
first; }
1365 G4Exception(
"G4tgbGeometryDumper::FindSolidName()",
"ReadError",
1368 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
G4Material * GetMaterial() const
const G4String & GetName() const
G4double GetYHalfLength2() 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)
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
G4VSolid * GetSolid() const
static G4String ConvertToString(G4bool boolVal)
G4double GetZBottomCut() const
std::map< G4String, G4Element * > theElements
const char * name(G4int ptype)
G4double GetOuterRadiusMinusZ() const
const G4RotationMatrix * GetRotation() const
G4double GetX2HalfLength() const
static constexpr double g
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
static constexpr double eV
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
static constexpr double kelvin
static constexpr double cm3
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)
virtual G4bool IsParameterised() const =0
const G4ThreeVector & GetTranslation() const
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
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="")
const G4String & GetName() const
G4double GetPhiTwist() const
std::map< G4String, G4RotationMatrix * > theRotMats
G4double GetInnerRadiusMinusZ() const
static constexpr double deg
G4double GetTanAlpha1() const
const G4double * GetFractionVector() const
G4int GetNumRZCorner() const
G4double GetDeltaThetaAngle() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4double GetX1HalfLength() const
static constexpr double atmosphere
G4double GetTiltAngleAlpha() const
G4double GetX2HalfLength() const
static constexpr double mole
G4double GetOuterRadiusPlusZ() const
G4double GetZHalfLength() const
G4double GetOuterRadius() const
G4double GetXHalfLength() const
static const G4double pos
static G4GeometryTolerance * GetInstance()
G4double GetPhiTwist() 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