117 for(
auto ite = pvstore->cbegin(); ite != pvstore->cend(); ++ite)
190 std::vector<G4VPhysicalVolume*> pvChildren =
GetPVChildren(lv);
191 for(
auto ite = pvChildren.cbegin(); ite != pvChildren.cend(); ++ite)
205 if(rotMat ==
nullptr)
216 G4cout <<
" G4tgbGeometryDumper::DumpPVPlacement() - Reflected volume: "
226 G4Rep3x3 rottemp(colx.
x(), coly.
x(), colz.
x(), colx.
y(), coly.
y(), colz.
y(),
227 colx.
z(), coly.
z(), colz.
z());
274 std::vector<G4double> newParams;
278 for(
G4int ii = 0; ii < nReplicas; ++ii)
365 if(ii == 0 || mate1st != newMate || params1st[0] != newParams[0])
373 lvName =
DumpLogVol(lv, extraName, newSolid, newMate);
411 "Unknown axis of replication for volume" + pv->
GetName();
412 G4Exception(
"G4tgbGeometryDumper::DumpPVReplica",
"Wrong axis ",
423 <<
" " << axisName <<
" " << nReplicas;
426 (*theFile) <<
" " << width <<
" " << offset <<
G4endl;
430 (*theFile) <<
" " << width /
deg <<
"*deg"
431 <<
" " << offset /
deg <<
"*deg" <<
G4endl;
452 lvName = lv->
GetName() + extraName;
501 (*theFile) <<
":MATE " <<
AddQuotes(mateName) <<
" " << mat->
GetZ() <<
" "
508 for(std::size_t ii = 0; ii < numElements; ++ii)
513 (*theFile) <<
":MIXT " <<
AddQuotes(mateName) <<
" " << density <<
" "
516 for(std::size_t ii = 0; ii < numElements; ++ii)
519 <<
" " << fractions[ii] <<
G4endl;
523 (*theFile) <<
":MATE_MEE " <<
AddQuotes(mateName) <<
" "
527 (*theFile) <<
":MATE_TEMPERATURE " <<
AddQuotes(mateName) <<
" "
530 (*theFile) <<
":MATE_PRESSURE " <<
AddQuotes(mateName) <<
" "
538 stateStr =
"Undefined";
551 (*theFile) <<
":MATE_STATE " <<
AddQuotes(mateName) <<
" " << stateStr
573 if(symbol ==
"" || symbol ==
" ")
578 if(
ele->GetNumberOfIsotopes() == 0)
581 <<
" " <<
ele->GetZ() <<
" " <<
ele->GetA() / (
g /
mole) <<
" "
587 for(std::size_t ii = 0; ii <
ele->GetNumberOfIsotopes(); ++ii)
592 (*theFile) <<
":ELEM_FROM_ISOT " <<
AddQuotes(elemName) <<
" "
593 <<
AddQuotes(symbol) <<
" " <<
ele->GetNumberOfIsotopes()
595 const G4double* fractions =
ele->GetRelativeAbundanceVector();
596 for(std::size_t ii = 0; ii <
ele->GetNumberOfIsotopes(); ++ii)
599 <<
" " << fractions[ii] <<
G4endl;
614 (*theFile) <<
":ISOT " <<
AddQuotes(isotName) <<
" " << isot->
GetZ() <<
" "
632 solidName = solid->
GetName() + extraName;
643 if(solidType ==
"UNIONSOLID")
647 else if(solidType ==
"SUBTRACTIONSOLID")
651 else if(solidType ==
"INTERSECTIONSOLID")
655 else if(solidType ==
"REFLECTEDSOLID")
658 if(solidrefl ==
nullptr)
660 G4Exception(
"G4tgbGeometryDumper::DumpSolid()",
"InvalidType",
667 else if(solidType ==
"MULTIUNION")
671 else if(solidType ==
"SCALEDSOLID")
677 (*theFile) <<
":SOLID " <<
AddQuotes(solidName) <<
" ";
678 (*theFile) <<
AddQuotes(solidType) <<
" ";
702 if(solid1Disp !=
nullptr)
750 std::vector<G4String> rotList;
751 for(
G4int iso = 0; iso < nSolids; iso++ ) {
754 rotList.push_back(rotName);
759 (*theFile) <<
":SOLID " <<
AddQuotes(bsoName) <<
" MULTIUNION "
762 for(
G4int iso = 0; iso < nSolids; iso++ ) {
766 (*theFile) <<
" " << solN->
GetName()
767 <<
" " <<
" " << rotList[iso]
786 (*theFile) <<
":SOLID " <<
AddQuotes(bsoName) <<
" SCALED "
787 << unscaledSolid->
GetName() <<
" "
788 << scaleTransf.
xx() <<
" "
789 << scaleTransf.
yy() <<
" "
798 for(std::size_t ii = 0; ii < params.size(); ++ii)
800 (*theFile) << params[ii] <<
" ";
808 std::vector<G4double> params;
813 if(solidType ==
"BOX")
815 const G4Box* sb =
dynamic_cast<const G4Box*
>(so);
823 else if(solidType ==
"TUBS")
835 else if(solidType ==
"TRAP")
842 params.push_back(symAxis.
theta() /
deg);
843 params.push_back(symAxis.
phi() /
deg);
854 else if(solidType ==
"TRD")
856 const G4Trd* tr =
dynamic_cast<const G4Trd*
>(so);
866 else if(solidType ==
"PARA")
876 params.push_back(symAxis.
theta() /
deg);
877 params.push_back(symAxis.
phi() /
deg);
880 else if(solidType ==
"CONS")
894 else if(solidType ==
"SPHERE")
897 if(sphere !=
nullptr)
907 else if(solidType ==
"ORB")
909 const G4Orb* orb =
dynamic_cast<const G4Orb*
>(so);
915 else if(solidType ==
"TORUS")
920 params.push_back(torus->
GetRmin());
921 params.push_back(torus->
GetRmax());
922 params.push_back(torus->
GetRtor());
927 else if(solidType ==
"POLYCONE")
935 if(angphi > 180 *
deg)
940 if(endphi > 180 *
deg)
944 params.push_back(angphi);
945 params.push_back(endphi - angphi);
948 params.push_back(ncor);
950 for(
G4int ii = 0; ii < ncor; ++ii)
957 else if(solidType ==
"GENERICPOLYCONE")
964 if(angphi > 180 *
deg)
969 if(endphi > 180 *
deg)
973 params.push_back(angphi);
974 params.push_back(endphi - angphi);
976 params.push_back(ncor);
978 for(
G4int ii = 0; ii < ncor; ++ii)
985 else if(solidType ==
"POLYHEDRA")
993 if(angphi > 180 *
deg)
998 params.push_back(angphi);
1001 params.push_back(ncor);
1003 for(
G4int ii = 0; ii < ncor; ++ii)
1010 else if(solidType ==
"ELLIPTICALTUBE")
1015 params.push_back(eltu->
GetDx());
1016 params.push_back(eltu->
GetDy());
1017 params.push_back(eltu->
GetDz());
1020 else if(solidType ==
"ELLIPSOID")
1032 else if(solidType ==
"ELLIPTICAL_CONE")
1039 params.push_back(elco->
GetZMax());
1043 else if(solidType ==
"HYPE")
1056 else if(solidType ==
"TWISTEDBOX")
1067 else if(solidType ==
"TWISTEDTRAP")
1070 if(ttrap !=
nullptr)
1085 else if(solidType ==
"TWISTEDTRD")
1098 else if(solidType ==
"TWISTEDTUBS")
1112 G4String ErrMessage =
"Solid type not supported, sorry... " + solidType;
1113 G4Exception(
"G4tgbGeometryDumper::DumpSolidParams()",
"NotImplemented",
1138 (*theFile) <<
":ROTM ";
1142 (*theFile) <<
AddQuotes(rotName) << std::setprecision(9) <<
" "
1151 (*theFile) <<
":ROTM ";
1169std::vector<G4VPhysicalVolume*>
1173 std::vector<G4VPhysicalVolume*> children;
1174 for(
auto ite = pvstore->cbegin(); ite != pvstore->cend(); ++ite)
1176 if((*ite)->GetMotherLogical() == lv)
1178 children.push_back(*ite);
1182 G4cout <<
" G4tgbGeometryDumper::GetPVChildren() - adding children: "
1195 G4String newsolidType = solidType.substr(2, solidType.length());
1196 for(std::size_t ii = 0; ii < newsolidType.length(); ++ii)
1198 newsolidType[ii] = toupper(newsolidType[ii]);
1200 return newsolidType;
1218 if(std::fabs(val) < precision)
1231 std::size_t siz = str.length();
1232 for(std::size_t ii = 0; ii < siz; ++ii)
1234 if(str.substr(ii, 1) ==
" ")
1265 name =
name.substr(0, irefl) +
"_REFL";
1277 std::map<G4String, G4Isotope*>::const_iterator ite;
1280 if(isot == (*ite).second)
1282 return (*ite).first;
1303 std::map<G4String, G4Isotope*>::const_iterator ite2 =
1307 isotName = newIsotName;
1314 isotName = newIsotName;
1328 TYP* obj, std::map<G4String, TYP*> objectsDumped)
1335 typename std::map<G4String, TYP*>::const_iterator ite;
1336 for(ite = objectsDumped.cbegin(); ite != objectsDumped.cend(); ++ite)
1338 if(obj == (*ite).second)
1340 return (*ite).first;
1347 ite = objectsDumped.find(objName);
1349 if(ite != objectsDumped.cend())
1351 TYP* objold = (*ite).second;
1358 typename std::map<G4String, TYP*>::const_iterator ite2 =
1359 objectsDumped.find(newObjName);
1360 if(ite2 == objectsDumped.cend())
1362 objName = newObjName;
1407 G4cout <<
" G4tgbGeometryDumper::CheckIfPhysVolExists() - " <<
name
1419 G4cerr <<
" G4tgbGeometryDumper::CheckIfPhysVolExists () -"
1420 <<
" Placement found but not same as before : " <<
name <<
G4endl;
1438 if((*ite).second->isNear(*rotm))
1440 rmName = (*ite).first;
1464 std::map<G4String, G4VSolid*>::const_iterator ite;
1467 if(solid == (*ite).second)
1469 return (*ite).first;
1475 G4Exception(
"G4tgbGeometryDumper::FindSolidName()",
"ReadError",
1478 return (*ite).first;
static const G4double pos
static const G4double ele
std::vector< const G4Element * > G4ElementVector
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4Isotope * > G4IsotopeVector
CLHEP::HepRotation G4RotationMatrix
static constexpr double kelvin
static constexpr double mole
static constexpr double cm3
static constexpr double atmosphere
static constexpr double eV
static constexpr double g
static constexpr double deg
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
HepRotation inverse() const
virtual const G4VSolid * GetConstituentSolid(G4int no) const
G4double GetYHalfLength() const
G4double GetZHalfLength() const
G4double GetXHalfLength() const
G4double GetOuterRadiusPlusZ() const
G4double GetStartPhiAngle() const
G4double GetDeltaPhiAngle() const
G4double GetInnerRadiusMinusZ() const
G4double GetInnerRadiusPlusZ() const
G4double GetOuterRadiusMinusZ() const
G4double GetZHalfLength() const
G4VSolid * GetConstituentMovedSolid() const
G4AffineTransform GetTransform() const
G4ThreeVector GetObjectTranslation() const
G4double GetSemiAxisMax(G4int i) const
G4double GetZTopCut() const
G4double GetZBottomCut() const
G4double GetSemiAxisX() const
G4double GetSemiAxisY() const
G4double GetZTopCut() const
G4double GetStartPhi() const
G4double GetEndPhi() const
G4int GetNumRZCorner() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4double GetInnerStereo() const
G4double GetZHalfLength() const
G4double GetOuterStereo() const
G4double GetOuterRadius() const
G4double GetInnerRadius() const
G4double GetMeanExcitationEnergy() const
const G4String & GetName() const
G4VSolid * GetSolid() const
G4Material * GetMaterial() const
const G4String & GetName() const
G4double GetPressure() const
G4double GetDensity() const
const G4ElementVector * GetElementVector() const
G4double GetTemperature() const
const G4double * GetFractionVector() const
G4IonisParamMat * GetIonisation() const
size_t GetNumberOfElements() const
const G4Transform3D & GetTransformation(G4int index) const
G4int GetNumberOfSolids() const
G4VSolid * GetSolid(G4int index) const
G4double GetRadius() const
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
G4VPVParameterisation * GetParameterisation() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
G4double GetTanAlpha() const
G4ThreeVector GetSymAxis() const
G4double GetYHalfLength() const
G4double GetZHalfLength() const
G4double GetXHalfLength() const
static G4PhysicalVolumeStore * GetInstance()
G4double GetEndPhi() const
G4double GetStartPhi() const
G4int GetNumRZCorner() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4int GetNumRZCorner() const
G4PolyhedraHistorical * GetOriginalParameters() const
G4PolyhedraSideRZ GetCorner(const G4int index) const
G4double GetStartPhi() const
G4VSolid * GetConstituentMovedSolid() const
G4bool IsReflected(G4LogicalVolume *lv) const
static G4ReflectionFactory * Instance()
G4VSolid * GetUnscaledSolid() const
G4Scale3D GetScaleTransform() const
G4double GetStartPhiAngle() const
G4double GetDeltaPhiAngle() const
G4double GetInnerRadius() const
G4double GetOuterRadius() const
G4double GetDeltaThetaAngle() const
G4double GetStartThetaAngle() const
G4double GetYHalfLength1() const
G4double GetTanAlpha2() const
G4double GetXHalfLength2() const
G4ThreeVector GetSymAxis() const
G4double GetXHalfLength4() const
G4double GetZHalfLength() const
G4double GetYHalfLength2() const
G4double GetTanAlpha1() const
G4double GetXHalfLength3() const
G4double GetXHalfLength1() const
G4double GetXHalfLength2() const
G4double GetYHalfLength2() const
G4double GetXHalfLength1() const
G4double GetYHalfLength1() const
G4double GetZHalfLength() const
G4double GetZHalfLength() const
G4double GetInnerRadius() const
G4double GetOuterRadius() const
G4double GetStartPhiAngle() const
G4double GetDeltaPhiAngle() const
G4double GetPhiTwist() const
G4double GetXHalfLength() const
G4double GetZHalfLength() const
G4double GetYHalfLength() const
G4double GetPolarAngleTheta() const
G4double GetAzimuthalAnglePhi() const
G4double GetTiltAngleAlpha() const
G4double GetZHalfLength() const
G4double GetX1HalfLength() const
G4double GetX2HalfLength() const
G4double GetX3HalfLength() const
G4double GetX4HalfLength() const
G4double GetY2HalfLength() const
G4double GetPhiTwist() const
G4double GetY1HalfLength() const
G4double GetX2HalfLength() const
G4double GetY2HalfLength() const
G4double GetY1HalfLength() const
G4double GetZHalfLength() const
G4double GetPhiTwist() const
G4double GetX1HalfLength() const
G4double GetOuterRadius() const
G4double GetZHalfLength() const
G4double GetPhiTwist() const
G4double GetInnerRadius() const
static G4String ConvertToString(G4bool boolVal)
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr)
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
G4LogicalVolume * GetMotherLogical() const
virtual G4bool IsReplicated() const =0
const G4RotationMatrix * GetRotation() const
const G4ThreeVector GetTranslation() const
G4LogicalVolume * GetLogicalVolume() const
virtual G4int GetCopyNo() const =0
const G4String & GetName() const
virtual G4bool IsParameterised() const =0
virtual G4GeometryType GetEntityType() const =0
static G4tgbGeometryDumper * GetInstance()
std::map< G4String, G4VSolid * > theSolids
static G4ThreadLocal G4tgbGeometryDumper * theInstance
G4double MatDeterminant(G4RotationMatrix *ro)
void DumpIsotope(G4Isotope *ele)
std::map< G4String, G4RotationMatrix * > theRotMats
G4String LookForExistingRotation(const G4RotationMatrix *rotm)
void DumpScaledVolume(G4VSolid *so)
void DumpGeometry(const G4String &fname)
G4String SubstituteRefl(G4String name)
G4String AddQuotes(const G4String &str)
std::map< G4String, G4Element * > theElements
G4String DumpLogVol(G4LogicalVolume *lv, const G4String &extraName="", G4VSolid *solid=nullptr, G4Material *mate=nullptr)
void DumpPhysVol(G4VPhysicalVolume *pv)
const G4String & FindSolidName(G4VSolid *solid)
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
void DumpBooleanVolume(const G4String &solidType, G4VSolid *so)
G4String GetTGSolidType(const G4String &solidtype)
G4String DumpMaterial(G4Material *mat)
std::vector< G4VPhysicalVolume * > GetPVChildren(G4LogicalVolume *lv)
void DumpPVReplica(G4PVReplica *pv, const G4String &lvName)
G4bool CheckIfLogVolExists(const G4String &name, G4LogicalVolume *pt)
void DumpPVParameterised(G4PVParameterised *pv)
G4String GetObjectName(TYP *obj, std::map< G4String, TYP * > objectsDumped)
void DumpMultiUnionVolume(G4VSolid *so)
G4VPhysicalVolume * GetTopPhysVol()
std::map< G4String, G4LogicalVolume * > theLogVols
G4bool CheckIfPhysVolExists(const G4String &name, G4VPhysicalVolume *)
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
G4double approxTo0(G4double val)
std::map< G4String, G4VPhysicalVolume * > thePhysVols
G4bool Same2G4Isotopes(G4Isotope *ele1, G4Isotope *ele2)
void DumpElement(G4Element *ele)
G4String GetIsotopeName(G4Isotope *)
G4String SupressRefl(G4String name)
std::map< G4String, G4Isotope * > theIsotopes
void DumpSolidParams(G4VSolid *so)
std::map< G4String, G4Material * > theMaterials
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
std::vector< G4double > GetSolidParams(const G4VSolid *so)
static G4int GetVerboseLevel()
const char * name(G4int ptype)