Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4tgbGeometryDumper Class Reference

#include <G4tgbGeometryDumper.hh>

Public Member Functions

void DumpBooleanVolume (const G4String &solidType, G4VSolid *so)
 
void DumpElement (G4Element *ele)
 
void DumpGeometry (const G4String &fname)
 
void DumpIsotope (G4Isotope *ele)
 
G4String DumpLogVol (G4LogicalVolume *lv, const G4String &extraName="", G4VSolid *solid=nullptr, G4Material *mate=nullptr)
 
G4String DumpMaterial (G4Material *mat)
 
void DumpMultiUnionVolume (G4VSolid *so)
 
void DumpPhysVol (G4VPhysicalVolume *pv)
 
void DumpPolySections (G4int zPlanes, G4double *z, G4double *rmin, G4double *rmax)
 
void DumpPVParameterised (G4PVParameterised *pv)
 
void DumpPVPlacement (G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
 
void DumpPVReplica (G4PVReplica *pv, const G4String &lvName)
 
G4String DumpRotationMatrix (G4RotationMatrix *rotm)
 
void DumpScaledVolume (G4VSolid *so)
 
G4String DumpSolid (G4VSolid *solid, const G4String &extraName="")
 
void DumpSolidParams (G4VSolid *so)
 
std::vector< G4doubleGetSolidParams (const G4VSolid *so)
 
G4VPhysicalVolumeGetTopPhysVol ()
 
 ~G4tgbGeometryDumper ()
 

Static Public Member Functions

static G4tgbGeometryDumperGetInstance ()
 

Private Member Functions

G4String AddQuotes (const G4String &str)
 
G4double approxTo0 (G4double val)
 
G4bool CheckIfLogVolExists (const G4String &name, G4LogicalVolume *pt)
 
G4bool CheckIfPhysVolExists (const G4String &name, G4VPhysicalVolume *)
 
const G4StringFindSolidName (G4VSolid *solid)
 
 G4tgbGeometryDumper ()
 
G4String GetIsotopeName (G4Isotope *)
 
template<class TYP >
G4String GetObjectName (TYP *obj, std::map< G4String, TYP * > objectsDumped)
 
std::vector< G4VPhysicalVolume * > GetPVChildren (G4LogicalVolume *lv)
 
G4String GetTGSolidType (const G4String &solidtype)
 
G4String LookForExistingRotation (const G4RotationMatrix *rotm)
 
G4double MatDeterminant (G4RotationMatrix *ro)
 
G4bool Same2G4Isotopes (G4Isotope *ele1, G4Isotope *ele2)
 
G4String SubstituteRefl (G4String name)
 
G4String SupressRefl (G4String name)
 

Private Attributes

std::map< G4String, G4Element * > theElements
 
std::ofstream * theFile = nullptr
 
std::map< G4String, G4Isotope * > theIsotopes
 
std::map< G4String, G4LogicalVolume * > theLogVols
 
std::map< G4String, G4Material * > theMaterials
 
std::map< G4String, G4VPhysicalVolume * > thePhysVols
 
G4int theRotationNumber = 0
 
std::map< G4String, G4RotationMatrix * > theRotMats
 
std::map< G4String, G4VSolid * > theSolids
 

Static Private Attributes

static G4ThreadLocal G4tgbGeometryDumpertheInstance = nullptr
 

Detailed Description

Definition at line 53 of file G4tgbGeometryDumper.hh.

Constructor & Destructor Documentation

◆ ~G4tgbGeometryDumper()

G4tgbGeometryDumper::~G4tgbGeometryDumper ( )

Definition at line 131 of file G4tgbGeometryDumper.cc.

132{
133}

◆ G4tgbGeometryDumper()

G4tgbGeometryDumper::G4tgbGeometryDumper ( )
private

Definition at line 80 of file G4tgbGeometryDumper.cc.

81{
82}

Referenced by GetInstance().

Member Function Documentation

◆ AddQuotes()

G4String G4tgbGeometryDumper::AddQuotes ( const G4String str)
private

Definition at line 1226 of file G4tgbGeometryDumper.cc.

1227{
1228 //--- look if there is a separating blank
1229
1230 G4bool bBlank = FALSE;
1231 std::size_t siz = str.length();
1232 for(std::size_t ii = 0; ii < siz; ++ii)
1233 {
1234 if(str.substr(ii, 1) == " ")
1235 {
1236 bBlank = TRUE;
1237 break;
1238 }
1239 }
1240 G4String str2 = str;
1241 if(bBlank)
1242 {
1243 str2 = G4String("\"") + str2 + G4String("\"");
1244 }
1245 return str2;
1246}
bool G4bool
Definition: G4Types.hh:86
#define TRUE
Definition: Globals.hh:27
#define FALSE
Definition: Globals.hh:23

References FALSE, and TRUE.

Referenced by DumpBooleanVolume(), DumpElement(), DumpIsotope(), DumpLogVol(), DumpMaterial(), DumpMultiUnionVolume(), DumpPVPlacement(), DumpPVReplica(), DumpRotationMatrix(), DumpScaledVolume(), and DumpSolid().

◆ approxTo0()

G4double G4tgbGeometryDumper::approxTo0 ( G4double  val)
private

Definition at line 1213 of file G4tgbGeometryDumper.cc.

1214{
1215 G4double precision =
1217
1218 if(std::fabs(val) < precision)
1219 {
1220 val = 0.0;
1221 }
1222 return val;
1223}
double G4double
Definition: G4Types.hh:83
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()

References G4GeometryTolerance::GetInstance(), and G4GeometryTolerance::GetSurfaceTolerance().

Referenced by DumpBooleanVolume(), DumpMultiUnionVolume(), and DumpRotationMatrix().

◆ CheckIfLogVolExists()

G4bool G4tgbGeometryDumper::CheckIfLogVolExists ( const G4String name,
G4LogicalVolume pt 
)
private

Definition at line 1372 of file G4tgbGeometryDumper.cc.

1374{
1375 if(theLogVols.find(name) != theLogVols.cend())
1376 {
1377 G4LogicalVolume* lvnew = (*(theLogVols.find(name))).second;
1378 if(lvnew != pt)
1379 {
1380 /*
1381 //---- Reflected volumes are repeated
1382
1383 G4ReflectionFactory* reffact = G4ReflectionFactory::Instance();
1384 if( !reffact->IsReflected( pt ) && !reffact->IsReflected( lvnew ) )
1385 {
1386 G4String ErrMessage = "LogVol found but not same as before: " + name;
1387 G4Exception("G4tgbGeometryDumper::CheckIfLogVolExists()",
1388 "InvalidSetup", FatalException, ErrMessage);
1389 }
1390 */
1391 }
1392 return true;
1393 }
1394 else
1395 {
1396 return false;
1397 }
1398}
std::map< G4String, G4LogicalVolume * > theLogVols
const char * name(G4int ptype)

References G4InuclParticleNames::name(), and theLogVols.

Referenced by DumpPhysVol().

◆ CheckIfPhysVolExists()

G4bool G4tgbGeometryDumper::CheckIfPhysVolExists ( const G4String name,
G4VPhysicalVolume pt 
)
private

Definition at line 1401 of file G4tgbGeometryDumper.cc.

1403{
1404#ifdef G4VERBOSE
1406 {
1407 G4cout << " G4tgbGeometryDumper::CheckIfPhysVolExists() - " << name
1408 << G4endl;
1409 }
1410#endif
1411 if(thePhysVols.find(name) != thePhysVols.cend())
1412 {
1413 if((*(thePhysVols.find(name))).second != pt)
1414 {
1415 // G4String ErrMessage = "Placement found but not same as before: "
1416 // + name;
1417 // G4Exception("G4tgbGeometryDumper::CheckIfPhysVolExists()",
1418 // "InvalidSetup", FatalException, ErrMessage);
1419 G4cerr << " G4tgbGeometryDumper::CheckIfPhysVolExists () -"
1420 << " Placement found but not same as before : " << name << G4endl;
1421 }
1422 return true;
1423 }
1424 else
1425 {
1426 return false;
1427 }
1428}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
std::map< G4String, G4VPhysicalVolume * > thePhysVols
static G4int GetVerboseLevel()

References G4cerr, G4cout, G4endl, G4tgrMessenger::GetVerboseLevel(), G4InuclParticleNames::name(), and thePhysVols.

Referenced by DumpPVPlacement(), and DumpPVReplica().

◆ DumpBooleanVolume()

void G4tgbGeometryDumper::DumpBooleanVolume ( const G4String solidType,
G4VSolid so 
)

Definition at line 687 of file G4tgbGeometryDumper.cc.

689{
690 G4BooleanSolid* bso = dynamic_cast<G4BooleanSolid*>(so);
691 if(bso == nullptr)
692 {
693 return;
694 }
695 G4VSolid* solid0 = bso->GetConstituentSolid(0);
696 G4VSolid* solid1 = bso->GetConstituentSolid(1);
697 G4DisplacedSolid* solid1Disp = nullptr;
698 G4bool displaced = dynamic_cast<G4DisplacedSolid*>(solid1);
699 if(displaced)
700 {
701 solid1Disp = dynamic_cast<G4DisplacedSolid*>(solid1);
702 if(solid1Disp != nullptr)
703 {
704 solid1 = solid1Disp->GetConstituentMovedSolid();
705 }
706 else
707 {
708 return;
709 }
710 }
711 DumpSolid(solid0);
712 DumpSolid(solid1);
713
714 G4String rotName;
716 if(displaced)
717 {
718 pos = solid1Disp->GetObjectTranslation(); // translation is of mother frame
720 (solid1Disp->GetTransform().NetRotation()).inverse()));
721 }
722 else // no displacement
723 {
725 pos = G4ThreeVector();
726 }
727
728 G4String bsoName = GetObjectName(so, theSolids);
729 if(theSolids.find(bsoName) != theSolids.cend())
730 return; // alredy dumped
731 G4String solid0Name = FindSolidName(solid0);
732 G4String solid1Name = FindSolidName(solid1);
733
734 (*theFile) << ":SOLID " << AddQuotes(bsoName) << " " << AddQuotes(solidType)
735 << " " << AddQuotes(solid0Name) << " " << AddQuotes(solid1Name)
736 << " " << AddQuotes(rotName) << " " << approxTo0(pos.x()) << " "
737 << approxTo0(pos.y()) << " " << approxTo0(pos.z()) << " "
738 << G4endl;
739
740 theSolids[bsoName] = bso;
741}
static const G4double pos
CLHEP::HepRotation G4RotationMatrix
CLHEP::Hep3Vector G4ThreeVector
G4RotationMatrix NetRotation() const
virtual const G4VSolid * GetConstituentSolid(G4int no) const
G4VSolid * GetConstituentMovedSolid() const
G4AffineTransform GetTransform() const
G4ThreeVector GetObjectTranslation() const
std::map< G4String, G4VSolid * > theSolids
G4String AddQuotes(const G4String &str)
const G4String & FindSolidName(G4VSolid *solid)
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
G4String GetObjectName(TYP *obj, std::map< G4String, TYP * > objectsDumped)
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
G4double approxTo0(G4double val)

References AddQuotes(), approxTo0(), DumpRotationMatrix(), DumpSolid(), FindSolidName(), G4endl, G4DisplacedSolid::GetConstituentMovedSolid(), G4BooleanSolid::GetConstituentSolid(), GetObjectName(), G4DisplacedSolid::GetObjectTranslation(), G4DisplacedSolid::GetTransform(), G4AffineTransform::NetRotation(), pos, and theSolids.

Referenced by DumpSolid().

◆ DumpElement()

void G4tgbGeometryDumper::DumpElement ( G4Element ele)

Definition at line 560 of file G4tgbGeometryDumper.cc.

561{
563
564 if(theElements.find(elemName) != theElements.cend()) // alredy dumped
565 {
566 return;
567 }
568
569 //--- Add symbol name: Material mixtures store the components as elements
570 // (even if the input are materials), but without symbol
571 //
572 G4String symbol = ele->GetSymbol();
573 if(symbol == "" || symbol == " ")
574 {
575 symbol = elemName;
576 }
577
578 if(ele->GetNumberOfIsotopes() == 0)
579 {
580 (*theFile) << ":ELEM " << AddQuotes(elemName) << " " << AddQuotes(symbol)
581 << " " << ele->GetZ() << " " << ele->GetA() / (g / mole) << " "
582 << G4endl;
583 }
584 else
585 {
586 const G4IsotopeVector* isots = ele->GetIsotopeVector();
587 for(std::size_t ii = 0; ii < ele->GetNumberOfIsotopes(); ++ii)
588 {
589 DumpIsotope((*isots)[ii]);
590 }
591
592 (*theFile) << ":ELEM_FROM_ISOT " << AddQuotes(elemName) << " "
593 << AddQuotes(symbol) << " " << ele->GetNumberOfIsotopes()
594 << G4endl;
595 const G4double* fractions = ele->GetRelativeAbundanceVector();
596 for(std::size_t ii = 0; ii < ele->GetNumberOfIsotopes(); ++ii)
597 {
598 (*theFile) << " " << AddQuotes(GetObjectName((*isots)[ii], theIsotopes))
599 << " " << fractions[ii] << G4endl;
600 }
601 }
602 theElements[elemName] = ele;
603}
static const G4double ele
std::vector< G4Isotope * > G4IsotopeVector
static constexpr double mole
Definition: G4SIunits.hh:279
static constexpr double g
Definition: G4SIunits.hh:168
void DumpIsotope(G4Isotope *ele)
std::map< G4String, G4Element * > theElements
std::map< G4String, G4Isotope * > theIsotopes

References AddQuotes(), DumpIsotope(), ele, g, G4endl, GetObjectName(), mole, theElements, and theIsotopes.

Referenced by DumpMaterial().

◆ DumpGeometry()

void G4tgbGeometryDumper::DumpGeometry ( const G4String fname)

Definition at line 95 of file G4tgbGeometryDumper.cc.

96{
97 theFile = new std::ofstream(fname);
98
100 DumpPhysVol(pv); // dump volume and recursively it will dump all hierarchy
101}
void DumpPhysVol(G4VPhysicalVolume *pv)
G4VPhysicalVolume * GetTopPhysVol()
string fname
Definition: test.py:308

References DumpPhysVol(), test::fname, GetTopPhysVol(), and theFile.

◆ DumpIsotope()

void G4tgbGeometryDumper::DumpIsotope ( G4Isotope ele)

Definition at line 606 of file G4tgbGeometryDumper.cc.

607{
608 G4String isotName = GetObjectName(isot, theIsotopes);
609 if(theIsotopes.find(isotName) != theIsotopes.cend()) // alredy dumped
610 {
611 return;
612 }
613
614 (*theFile) << ":ISOT " << AddQuotes(isotName) << " " << isot->GetZ() << " "
615 << isot->GetN() << " " << isot->GetA() / (g / mole) << " "
616 << G4endl;
617
618 theIsotopes[isotName] = isot;
619}

References AddQuotes(), g, G4endl, G4Isotope::GetA(), G4Isotope::GetN(), GetObjectName(), G4Isotope::GetZ(), mole, and theIsotopes.

Referenced by DumpElement().

◆ DumpLogVol()

G4String G4tgbGeometryDumper::DumpLogVol ( G4LogicalVolume lv,
const G4String extraName = "",
G4VSolid solid = nullptr,
G4Material mate = nullptr 
)

Definition at line 439 of file G4tgbGeometryDumper.cc.

443{
444 G4String lvName;
445
446 if(extraName == "") //--- take out the '_refl' in the name
447 {
448 lvName = GetObjectName(lv, theLogVols);
449 }
450 else
451 {
452 lvName = lv->GetName() + extraName;
453 }
454
455 if(theLogVols.find(lvName) != theLogVols.cend()) // alredy dumped
456 {
457 return lvName;
458 }
459
460 if(solid == nullptr)
461 {
462 solid = lv->GetSolid();
463 }
464
465 //---- Dump solid
466 G4String solidName = DumpSolid(solid, extraName);
467
468 //---- Dump material
469 if(mate == nullptr)
470 {
471 mate = lv->GetMaterial();
472 }
473 G4String mateName = DumpMaterial(mate);
474
475 //---- Dump logical volume (solid + material)
476 (*theFile) << ":VOLU " << SubstituteRefl(AddQuotes(lvName)) << " "
477 << SupressRefl(AddQuotes(solidName)) << " " << AddQuotes(mateName)
478 << G4endl;
479
480 theLogVols[lvName] = lv;
481
482 return lvName;
483}
G4VSolid * GetSolid() const
G4Material * GetMaterial() const
const G4String & GetName() const
G4String SubstituteRefl(G4String name)
G4String DumpMaterial(G4Material *mat)
G4String SupressRefl(G4String name)

References AddQuotes(), DumpMaterial(), DumpSolid(), G4endl, G4LogicalVolume::GetMaterial(), G4LogicalVolume::GetName(), GetObjectName(), G4LogicalVolume::GetSolid(), SubstituteRefl(), SupressRefl(), and theLogVols.

Referenced by DumpPhysVol(), and DumpPVParameterised().

◆ DumpMaterial()

G4String G4tgbGeometryDumper::DumpMaterial ( G4Material mat)

Definition at line 486 of file G4tgbGeometryDumper.cc.

487{
488 G4String mateName = GetObjectName(mat, theMaterials);
489 if(theMaterials.find(mateName) != theMaterials.cend()) // alredy dumped
490 {
491 return mateName;
492 }
493
494 std::size_t numElements = mat->GetNumberOfElements();
495 G4double density = mat->GetDensity() / g * cm3;
496
497 // start tag
498 //
499 if(numElements == 1)
500 {
501 (*theFile) << ":MATE " << AddQuotes(mateName) << " " << mat->GetZ() << " "
502 << mat->GetA() / (g / mole) << " " << density << G4endl;
503 }
504 else
505 {
506 const G4ElementVector* elems = mat->GetElementVector();
507 const G4double* fractions = mat->GetFractionVector();
508 for(std::size_t ii = 0; ii < numElements; ++ii)
509 {
510 DumpElement(const_cast<G4Element*>((*elems)[ii]));
511 }
512
513 (*theFile) << ":MIXT " << AddQuotes(mateName) << " " << density << " "
514 << numElements << G4endl;
515 // close start element tag and get ready to do composit "parts"
516 for(std::size_t ii = 0; ii < numElements; ++ii)
517 {
518 (*theFile) << " " << AddQuotes(GetObjectName(const_cast<G4Element*>((*elems)[ii]), theElements))
519 << " " << fractions[ii] << G4endl;
520 }
521 }
522
523 (*theFile) << ":MATE_MEE " << AddQuotes(mateName) << " "
524 << mat->GetIonisation()->GetMeanExcitationEnergy() / eV << "*eV"
525 << G4endl;
526
527 (*theFile) << ":MATE_TEMPERATURE " << AddQuotes(mateName) << " "
528 << mat->GetTemperature() / kelvin << "*kelvin" << G4endl;
529
530 (*theFile) << ":MATE_PRESSURE " << AddQuotes(mateName) << " "
531 << mat->GetPressure() / atmosphere << "*atmosphere" << G4endl;
532
533 G4State state = mat->GetState();
534 G4String stateStr;
535 switch(state)
536 {
537 case kStateUndefined:
538 stateStr = "Undefined";
539 break;
540 case kStateSolid:
541 stateStr = "Solid";
542 break;
543 case kStateLiquid:
544 stateStr = "Liquid";
545 break;
546 case kStateGas:
547 stateStr = "Gas";
548 break;
549 }
550
551 (*theFile) << ":MATE_STATE " << AddQuotes(mateName) << " " << stateStr
552 << G4endl;
553
554 theMaterials[mateName] = mat;
555
556 return mateName;
557}
std::vector< const G4Element * > G4ElementVector
G4State
Definition: G4Material.hh:111
@ kStateSolid
Definition: G4Material.hh:111
@ kStateLiquid
Definition: G4Material.hh:111
@ kStateGas
Definition: G4Material.hh:111
@ kStateUndefined
Definition: G4Material.hh:111
static constexpr double kelvin
Definition: G4SIunits.hh:274
static constexpr double cm3
Definition: G4SIunits.hh:101
static constexpr double atmosphere
Definition: G4SIunits.hh:225
static constexpr double eV
Definition: G4SIunits.hh:201
G4double GetMeanExcitationEnergy() const
G4double GetPressure() const
Definition: G4Material.hh:179
G4double GetDensity() const
Definition: G4Material.hh:176
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:186
G4State GetState() const
Definition: G4Material.hh:177
G4double GetTemperature() const
Definition: G4Material.hh:178
G4double GetZ() const
Definition: G4Material.cc:736
const G4double * GetFractionVector() const
Definition: G4Material.hh:190
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:222
size_t GetNumberOfElements() const
Definition: G4Material.hh:182
G4double GetA() const
Definition: G4Material.cc:750
void DumpElement(G4Element *ele)
std::map< G4String, G4Material * > theMaterials

References AddQuotes(), atmosphere, cm3, DumpElement(), eV, g, G4endl, G4Material::GetA(), G4Material::GetDensity(), G4Material::GetElementVector(), G4Material::GetFractionVector(), G4Material::GetIonisation(), G4IonisParamMat::GetMeanExcitationEnergy(), G4Material::GetNumberOfElements(), GetObjectName(), G4Material::GetPressure(), G4Material::GetState(), G4Material::GetTemperature(), G4Material::GetZ(), kelvin, kStateGas, kStateLiquid, kStateSolid, kStateUndefined, mole, theElements, and theMaterials.

Referenced by DumpLogVol().

◆ DumpMultiUnionVolume()

void G4tgbGeometryDumper::DumpMultiUnionVolume ( G4VSolid so)

Definition at line 744 of file G4tgbGeometryDumper.cc.

745{
746 const G4MultiUnion* muun = dynamic_cast<const G4MultiUnion*>(so);
747 if(muun != nullptr)
748 {
749 G4int nSolids = muun->GetNumberOfSolids();
750 std::vector<G4String> rotList;
751 for( G4int iso = 0; iso < nSolids; iso++ ) {
752 G4Transform3D trans = muun->GetTransformation(iso);
754 rotList.push_back(rotName);
755 G4VSolid* solN = muun->GetSolid(iso);
756 DumpSolid(solN);
757 }
758 G4String bsoName = GetObjectName(const_cast<G4VSolid*>(so), theSolids);
759 (*theFile) << ":SOLID " << AddQuotes(bsoName) << " MULTIUNION "
760 << nSolids;
761
762 for( G4int iso = 0; iso < nSolids; iso++ ) {
763 G4VSolid* solN = muun->GetSolid(iso);
764 G4Transform3D trans = muun->GetTransformation(iso);
765 G4ThreeVector pos = trans.getTranslation(); // translation is of mother frame
766 (*theFile) << " " << solN->GetName()
767 << " " << " " << rotList[iso]
768 << " " << approxTo0(pos.x())
769 << " " << approxTo0(pos.y())
770 << " " << approxTo0(pos.z());
771 }
772 (*theFile) << G4endl;
773
774 }
775}
int G4int
Definition: G4Types.hh:85
const G4Transform3D & GetTransformation(G4int index) const
G4int GetNumberOfSolids() const
G4VSolid * GetSolid(G4int index) const
G4String GetName() const
CLHEP::HepRotation getRotation() const
CLHEP::Hep3Vector getTranslation() const

References AddQuotes(), approxTo0(), DumpRotationMatrix(), DumpSolid(), G4endl, G4VSolid::GetName(), G4MultiUnion::GetNumberOfSolids(), GetObjectName(), HepGeom::Transform3D::getRotation(), G4MultiUnion::GetSolid(), G4MultiUnion::GetTransformation(), HepGeom::Transform3D::getTranslation(), pos, and theSolids.

Referenced by DumpSolid().

◆ DumpPhysVol()

void G4tgbGeometryDumper::DumpPhysVol ( G4VPhysicalVolume pv)

Definition at line 136 of file G4tgbGeometryDumper.cc.

137{
138 //--- Dump logical volume first
140
142
143 //--- It is not needed to dump _refl volumes created when parent is reflected
144 // !!WARNING : it must be avoided to reflect a volume hierarchy if children
145 // has also been reflected, as both will have same name
146
147 if(reffact->IsReflected(lv) && reffact->IsReflected(pv->GetMotherLogical()))
148 {
149 return;
150 }
151
152 G4bool bVolExists = CheckIfLogVolExists(lv->GetName(), lv);
153
154 //---- Construct this PV
155 if(pv->GetMotherLogical() != nullptr) // not WORLD volume
156 {
157 if(!pv->IsReplicated())
158 {
159 G4String lvName = lv->GetName();
160 if(!bVolExists)
161 {
162 lvName = DumpLogVol(lv);
163 }
164 DumpPVPlacement(pv, lvName);
165 }
166 else if(pv->IsParameterised())
167 {
168 G4PVParameterised* pvparam = (G4PVParameterised*) (pv);
169 DumpPVParameterised(pvparam);
170 }
171 else
172 {
173 G4String lvName = lv->GetName();
174 if(!bVolExists)
175 {
176 lvName = DumpLogVol(lv);
177 }
178 G4PVReplica* pvrepl = (G4PVReplica*) (pv);
179 DumpPVReplica(pvrepl, lvName);
180 }
181 }
182 else
183 {
184 DumpLogVol(lv);
185 }
186
187 if(!bVolExists)
188 {
189 //---- Construct PV's who has this LV as mother
190 std::vector<G4VPhysicalVolume*> pvChildren = GetPVChildren(lv);
191 for(auto ite = pvChildren.cbegin(); ite != pvChildren.cend(); ++ite)
192 {
193 DumpPhysVol(*ite);
194 }
195 }
196}
G4bool IsReflected(G4LogicalVolume *lv) const
static G4ReflectionFactory * Instance()
G4LogicalVolume * GetMotherLogical() const
virtual G4bool IsReplicated() const =0
G4LogicalVolume * GetLogicalVolume() const
virtual G4bool IsParameterised() const =0
G4String DumpLogVol(G4LogicalVolume *lv, const G4String &extraName="", G4VSolid *solid=nullptr, G4Material *mate=nullptr)
std::vector< G4VPhysicalVolume * > GetPVChildren(G4LogicalVolume *lv)
void DumpPVReplica(G4PVReplica *pv, const G4String &lvName)
G4bool CheckIfLogVolExists(const G4String &name, G4LogicalVolume *pt)
void DumpPVParameterised(G4PVParameterised *pv)
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)

References CheckIfLogVolExists(), DumpLogVol(), DumpPhysVol(), DumpPVParameterised(), DumpPVPlacement(), DumpPVReplica(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetMotherLogical(), G4LogicalVolume::GetName(), GetPVChildren(), G4ReflectionFactory::Instance(), G4VPhysicalVolume::IsParameterised(), G4ReflectionFactory::IsReflected(), and G4VPhysicalVolume::IsReplicated().

Referenced by DumpGeometry(), and DumpPhysVol().

◆ DumpPolySections()

void G4tgbGeometryDumper::DumpPolySections ( G4int  zPlanes,
G4double z,
G4double rmin,
G4double rmax 
)

◆ DumpPVParameterised()

void G4tgbGeometryDumper::DumpPVParameterised ( G4PVParameterised pv)

Definition at line 257 of file G4tgbGeometryDumper.cc.

258{
259 G4String pvName = pv->GetName();
260
261 EAxis axis;
262 G4int nReplicas;
263 G4double width;
264 G4double offset;
265 G4bool consuming;
266 pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
267
269
271 G4VSolid* solid1st = param->ComputeSolid(0, pv);
272 G4Material* mate1st = param->ComputeMaterial(0, pv);
273 std::vector<G4double> params1st = GetSolidParams(solid1st);
274 std::vector<G4double> newParams;
275 G4VSolid* newSolid = solid1st;
276 G4String lvName;
277
278 for(G4int ii = 0; ii < nReplicas; ++ii)
279 {
280 G4Material* newMate = param->ComputeMaterial(ii, pv);
281 if(solid1st->GetEntityType() == "G4Box")
282 {
283 G4Box* box = (G4Box*) (solid1st);
284 param->ComputeDimensions(*box, ii, pv);
285 newParams = GetSolidParams(box);
286 newSolid = (G4VSolid*) box;
287 }
288 else if(solid1st->GetEntityType() == "G4Tubs")
289 {
290 G4Tubs* tubs = (G4Tubs*) (solid1st);
291 param->ComputeDimensions(*tubs, ii, pv);
292 newParams = GetSolidParams(tubs);
293 newSolid = (G4VSolid*) tubs;
294 }
295 else if(solid1st->GetEntityType() == "G4Trd")
296 {
297 G4Trd* trd = (G4Trd*) (solid1st);
298 param->ComputeDimensions(*trd, ii, pv);
299 newParams = GetSolidParams(trd);
300 newSolid = (G4VSolid*) trd;
301 }
302 else if(solid1st->GetEntityType() == "G4Trap")
303 {
304 G4Trap* trap = (G4Trap*) (solid1st);
305 param->ComputeDimensions(*trap, ii, pv);
306 newParams = GetSolidParams(trap);
307 newSolid = (G4VSolid*) trap;
308 }
309 else if(solid1st->GetEntityType() == "G4Cons")
310 {
311 G4Cons* cons = (G4Cons*) (solid1st);
312 param->ComputeDimensions(*cons, ii, pv);
313 newParams = GetSolidParams(cons);
314 newSolid = (G4VSolid*) cons;
315 }
316 else if(solid1st->GetEntityType() == "G4Sphere")
317 {
318 G4Sphere* sphere = (G4Sphere*) (solid1st);
319 param->ComputeDimensions(*sphere, ii, pv);
320 newParams = GetSolidParams(sphere);
321 newSolid = (G4VSolid*) sphere;
322 }
323 else if(solid1st->GetEntityType() == "G4Orb")
324 {
325 G4Orb* orb = (G4Orb*) (solid1st);
326 param->ComputeDimensions(*orb, ii, pv);
327 newParams = GetSolidParams(orb);
328 newSolid = (G4VSolid*) orb;
329 }
330 else if(solid1st->GetEntityType() == "G4Torus")
331 {
332 G4Torus* torus = (G4Torus*) (solid1st);
333 param->ComputeDimensions(*torus, ii, pv);
334 newParams = GetSolidParams(torus);
335 newSolid = (G4VSolid*) torus;
336 }
337 else if(solid1st->GetEntityType() == "G4Para")
338 {
339 G4Para* para = (G4Para*) (solid1st);
340 param->ComputeDimensions(*para, ii, pv);
341 newParams = GetSolidParams(para);
342 newSolid = (G4VSolid*) para;
343 }
344 else if(solid1st->GetEntityType() == "G4Polycone")
345 {
346 G4Polycone* polycone = (G4Polycone*) (solid1st);
347 param->ComputeDimensions(*polycone, ii, pv);
348 newParams = GetSolidParams(polycone);
349 newSolid = (G4VSolid*) polycone;
350 }
351 else if(solid1st->GetEntityType() == "G4Polyhedra")
352 {
353 G4Polyhedra* polyhedra = (G4Polyhedra*) (solid1st);
354 param->ComputeDimensions(*polyhedra, ii, pv);
355 newParams = GetSolidParams(polyhedra);
356 newSolid = (G4VSolid*) polyhedra;
357 }
358 else if(solid1st->GetEntityType() == "G4Hype")
359 {
360 G4Hype* hype = (G4Hype*) (solid1st);
361 param->ComputeDimensions(*hype, ii, pv);
362 newParams = GetSolidParams(hype);
363 newSolid = (G4VSolid*) hype;
364 }
365 if(ii == 0 || mate1st != newMate || params1st[0] != newParams[0])
366 {
367 G4String extraName = "";
368 if(ii != 0)
369 {
370 extraName = "#" + G4UIcommand::ConvertToString(ii) + "/" +
371 pv->GetMotherLogical()->GetName();
372 }
373 lvName = DumpLogVol(lv, extraName, newSolid, newMate);
374 }
375
376 param->ComputeTransformation(ii, pv);
377 DumpPVPlacement(pv, lvName, ii);
378 }
379}
Definition: G4Box.hh:56
Definition: G4Cons.hh:78
Definition: G4Hype.hh:69
Definition: G4Orb.hh:56
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
G4VPVParameterisation * GetParameterisation() const
Definition: G4Para.hh:79
Definition: G4Trd.hh:63
Definition: G4Tubs.hh:75
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445
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
const G4String & GetName() const
virtual G4GeometryType GetEntityType() const =0
std::vector< G4double > GetSolidParams(const G4VSolid *so)
EAxis
Definition: geomdefs.hh:54

References G4VPVParameterisation::ComputeDimensions(), G4VPVParameterisation::ComputeMaterial(), G4VPVParameterisation::ComputeSolid(), G4VPVParameterisation::ComputeTransformation(), G4UIcommand::ConvertToString(), DumpLogVol(), DumpPVPlacement(), G4VSolid::GetEntityType(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetMotherLogical(), G4LogicalVolume::GetName(), G4VPhysicalVolume::GetName(), G4PVParameterised::GetParameterisation(), G4PVParameterised::GetReplicationData(), and GetSolidParams().

Referenced by DumpPhysVol().

◆ DumpPVPlacement()

void G4tgbGeometryDumper::DumpPVPlacement ( G4VPhysicalVolume pv,
const G4String lvName,
G4int  copyNo = -999 
)

Definition at line 199 of file G4tgbGeometryDumper.cc.

201{
202 G4String pvName = pv->GetName();
203
204 G4RotationMatrix* rotMat = pv->GetRotation();
205 if(rotMat == nullptr)
206 rotMat = new G4RotationMatrix();
207
208 //---- Check if it is reflected
211 if(reffact->IsReflected(lv))
212 {
213#ifdef G4VERBOSE
215 {
216 G4cout << " G4tgbGeometryDumper::DumpPVPlacement() - Reflected volume: "
217 << pv->GetName() << G4endl;
218 }
219#endif
220 G4ThreeVector colx = rotMat->colX();
221 G4ThreeVector coly = rotMat->colY();
222 G4ThreeVector colz = rotMat->colZ();
223 // apply a Z reflection (reflection matrix is decomposed in new
224 // reflection-free rotation + z-reflection)
225 colz *= -1.;
226 G4Rep3x3 rottemp(colx.x(), coly.x(), colz.x(), colx.y(), coly.y(), colz.y(),
227 colx.z(), coly.z(), colz.z());
228 // matrix representation (inverted)
229 *rotMat = G4RotationMatrix(rottemp);
230 *rotMat = (*rotMat).inverse();
231 pvName += "_refl";
232 }
233 G4String rotName = DumpRotationMatrix(rotMat);
235
236 if(copyNo == -999) // for parameterisations copy number is provided
237 {
238 copyNo = pv->GetCopyNo();
239 }
240
241 G4String fullname = pvName + "#" + G4UIcommand::ConvertToString(copyNo) +
242 "/" + pv->GetMotherLogical()->GetName();
243
244 if(!CheckIfPhysVolExists(fullname, pv))
245 {
246 (*theFile) << ":PLACE " << SubstituteRefl(AddQuotes(lvName)) << " "
247 << copyNo << " "
249 << " " << AddQuotes(rotName) << " " << pos.x() << " " << pos.y()
250 << " " << pos.z() << G4endl;
251
252 thePhysVols[fullname] = pv;
253 }
254}
double z() const
double x() const
double y() const
Hep3Vector colX() const
HepRotation inverse() const
Hep3Vector colY() const
Hep3Vector colZ() const
const G4RotationMatrix * GetRotation() const
const G4ThreeVector GetTranslation() const
virtual G4int GetCopyNo() const =0
G4bool CheckIfPhysVolExists(const G4String &name, G4VPhysicalVolume *)

References AddQuotes(), CheckIfPhysVolExists(), CLHEP::HepRotation::colX(), CLHEP::HepRotation::colY(), CLHEP::HepRotation::colZ(), G4UIcommand::ConvertToString(), DumpRotationMatrix(), G4cout, G4endl, G4VPhysicalVolume::GetCopyNo(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetMotherLogical(), G4LogicalVolume::GetName(), G4VPhysicalVolume::GetName(), G4VPhysicalVolume::GetRotation(), G4VPhysicalVolume::GetTranslation(), G4tgrMessenger::GetVerboseLevel(), G4ReflectionFactory::Instance(), CLHEP::HepRotation::inverse(), G4ReflectionFactory::IsReflected(), pos, SubstituteRefl(), thePhysVols, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by DumpPhysVol(), and DumpPVParameterised().

◆ DumpPVReplica()

void G4tgbGeometryDumper::DumpPVReplica ( G4PVReplica pv,
const G4String lvName 
)

Definition at line 382 of file G4tgbGeometryDumper.cc.

383{
384 EAxis axis;
385 G4int nReplicas;
386 G4double width;
387 G4double offset;
388 G4bool consuming;
389 pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
390 G4String axisName;
391 switch(axis)
392 {
393 case kXAxis:
394 axisName = "X";
395 break;
396 case kYAxis:
397 axisName = "Y";
398 break;
399 case kZAxis:
400 axisName = "Z";
401 break;
402 case kRho:
403 axisName = "R";
404 break;
405 case kPhi:
406 axisName = "PHI";
407 break;
408 case kRadial3D:
409 case kUndefined:
410 G4String ErrMessage =
411 "Unknown axis of replication for volume" + pv->GetName();
412 G4Exception("G4tgbGeometryDumper::DumpPVReplica", "Wrong axis ",
413 FatalException, ErrMessage);
414 break;
415 }
416
417 G4String fullname = lvName + "/" + pv->GetMotherLogical()->GetName();
418
419 if(!CheckIfPhysVolExists(fullname, pv))
420 {
421 (*theFile) << ":REPL " << SubstituteRefl(AddQuotes(lvName)) << " "
423 << " " << axisName << " " << nReplicas;
424 if(axis != kPhi)
425 {
426 (*theFile) << " " << width << " " << offset << G4endl;
427 }
428 else
429 {
430 (*theFile) << " " << width / deg << "*deg"
431 << " " << offset / deg << "*deg" << G4endl;
432 }
433
434 thePhysVols[fullname] = pv;
435 }
436}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static constexpr double deg
Definition: G4SIunits.hh:132
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
Definition: G4PVReplica.cc:309
@ kPhi
Definition: geomdefs.hh:60
@ kYAxis
Definition: geomdefs.hh:56
@ kRadial3D
Definition: geomdefs.hh:59
@ kXAxis
Definition: geomdefs.hh:55
@ kZAxis
Definition: geomdefs.hh:57
@ kUndefined
Definition: geomdefs.hh:61
@ kRho
Definition: geomdefs.hh:58

References AddQuotes(), CheckIfPhysVolExists(), deg, FatalException, G4endl, G4Exception(), G4VPhysicalVolume::GetMotherLogical(), G4LogicalVolume::GetName(), G4VPhysicalVolume::GetName(), G4PVReplica::GetReplicationData(), kPhi, kRadial3D, kRho, kUndefined, kXAxis, kYAxis, kZAxis, SubstituteRefl(), and thePhysVols.

Referenced by DumpPhysVol().

◆ DumpRotationMatrix()

G4String G4tgbGeometryDumper::DumpRotationMatrix ( G4RotationMatrix rotm)

Definition at line 1121 of file G4tgbGeometryDumper.cc.

1122{
1123 if(rotm == nullptr)
1124 {
1125 rotm = new G4RotationMatrix();
1126 }
1127
1128 G4double de = MatDeterminant(rotm);
1129 G4String rotName = LookForExistingRotation(rotm);
1130 if(rotName != "")
1131 {
1132 return rotName;
1133 }
1134
1135 G4ThreeVector v(1., 1., 1.);
1136 if(de < -0.9) // a reflection ....
1137 {
1138 (*theFile) << ":ROTM ";
1139 rotName = "RRM";
1141
1142 (*theFile) << AddQuotes(rotName) << std::setprecision(9) << " "
1143 << approxTo0(rotm->xx()) << " " << approxTo0(rotm->yx()) << " "
1144 << approxTo0(rotm->zx()) << " " << approxTo0(rotm->xy()) << " "
1145 << approxTo0(rotm->yy()) << " " << approxTo0(rotm->zy()) << " "
1146 << approxTo0(rotm->xz()) << " " << approxTo0(rotm->yz()) << " "
1147 << approxTo0(rotm->zz()) << G4endl;
1148 }
1149 else if(de > 0.9) // a rotation ....
1150 {
1151 (*theFile) << ":ROTM ";
1152 rotName = "RM";
1154
1155 (*theFile) << AddQuotes(rotName) << " " << approxTo0(rotm->thetaX() / deg)
1156 << " " << approxTo0(rotm->phiX() / deg) << " "
1157 << approxTo0(rotm->thetaY() / deg) << " "
1158 << approxTo0(rotm->phiY() / deg) << " "
1159 << approxTo0(rotm->thetaZ() / deg) << " "
1160 << approxTo0(rotm->phiZ() / deg) << G4endl;
1161 }
1162
1163 theRotMats[rotName] = rotm;
1164
1165 return rotName;
1166}
double zz() const
double yz() const
double zx() const
double thetaY() const
Definition: Rotation.cc:140
double phiY() const
Definition: Rotation.cc:128
double yx() const
double zy() const
double thetaX() const
Definition: Rotation.cc:136
double xx() const
double phiX() const
Definition: Rotation.cc:124
double yy() const
double xz() const
double thetaZ() const
Definition: Rotation.cc:144
double xy() const
double phiZ() const
Definition: Rotation.cc:132
G4double MatDeterminant(G4RotationMatrix *ro)
std::map< G4String, G4RotationMatrix * > theRotMats
G4String LookForExistingRotation(const G4RotationMatrix *rotm)

References AddQuotes(), approxTo0(), G4UIcommand::ConvertToString(), deg, G4endl, LookForExistingRotation(), MatDeterminant(), CLHEP::HepRotation::phiX(), CLHEP::HepRotation::phiY(), CLHEP::HepRotation::phiZ(), theRotationNumber, theRotMats, CLHEP::HepRotation::thetaX(), CLHEP::HepRotation::thetaY(), CLHEP::HepRotation::thetaZ(), CLHEP::HepRotation::xx(), CLHEP::HepRotation::xy(), CLHEP::HepRotation::xz(), CLHEP::HepRotation::yx(), CLHEP::HepRotation::yy(), CLHEP::HepRotation::yz(), CLHEP::HepRotation::zx(), CLHEP::HepRotation::zy(), and CLHEP::HepRotation::zz().

Referenced by DumpBooleanVolume(), DumpMultiUnionVolume(), and DumpPVPlacement().

◆ DumpScaledVolume()

void G4tgbGeometryDumper::DumpScaledVolume ( G4VSolid so)

Definition at line 778 of file G4tgbGeometryDumper.cc.

779{
780 const G4ScaledSolid* ssol = dynamic_cast<const G4ScaledSolid*>(so);
781 if(ssol != nullptr)
782 {
783 G4VSolid* unscaledSolid = ssol->GetUnscaledSolid();
784 G4Scale3D scaleTransf = ssol->GetScaleTransform();
785 G4String bsoName = GetObjectName(const_cast<G4VSolid*>(so), theSolids);
786 (*theFile) << ":SOLID " << AddQuotes(bsoName) << " SCALED "
787 << unscaledSolid->GetName() << " "
788 << scaleTransf.xx() << " "
789 << scaleTransf.yy() << " "
790 << scaleTransf.zz() << G4endl;
791 }
792}
G4VSolid * GetUnscaledSolid() const
G4Scale3D GetScaleTransform() const
double zz() const
Definition: Transform3D.h:281
double xx() const
Definition: Transform3D.h:257
double yy() const
Definition: Transform3D.h:269

References AddQuotes(), G4endl, G4VSolid::GetName(), GetObjectName(), G4ScaledSolid::GetScaleTransform(), G4ScaledSolid::GetUnscaledSolid(), theSolids, HepGeom::Transform3D::xx(), HepGeom::Transform3D::yy(), and HepGeom::Transform3D::zz().

Referenced by DumpSolid().

◆ DumpSolid()

G4String G4tgbGeometryDumper::DumpSolid ( G4VSolid solid,
const G4String extraName = "" 
)

Definition at line 622 of file G4tgbGeometryDumper.cc.

624{
625 G4String solidName;
626 if(extraName == "")
627 {
628 solidName = GetObjectName(solid, theSolids);
629 }
630 else
631 {
632 solidName = solid->GetName() + extraName;
633 }
634
635 if(theSolids.find(solidName) != theSolids.cend()) // alredy dumped
636 {
637 return solidName;
638 }
639
640 G4String solidType = solid->GetEntityType();
641 solidType = GetTGSolidType(solidType);
642
643 if(solidType == "UNIONSOLID")
644 {
645 DumpBooleanVolume("UNION", solid);
646 }
647 else if(solidType == "SUBTRACTIONSOLID")
648 {
649 DumpBooleanVolume("SUBTRACTION", solid);
650 }
651 else if(solidType == "INTERSECTIONSOLID")
652 {
653 DumpBooleanVolume("INTERSECTION", solid);
654 }
655 else if(solidType == "REFLECTEDSOLID")
656 {
657 G4ReflectedSolid* solidrefl = dynamic_cast<G4ReflectedSolid*>(solid);
658 if(solidrefl == nullptr)
659 {
660 G4Exception("G4tgbGeometryDumper::DumpSolid()", "InvalidType",
661 FatalException, "Invalid reflected solid!");
662 return solidName;
663 }
664 G4VSolid* solidori = solidrefl->GetConstituentMovedSolid();
665 DumpSolid(solidori);
666 }
667 else if(solidType == "MULTIUNION")
668 {
670 }
671 else if(solidType == "SCALEDSOLID")
672 {
673 DumpScaledVolume(solid);
674 }
675 else
676 {
677 (*theFile) << ":SOLID " << AddQuotes(solidName) << " ";
678 (*theFile) << AddQuotes(solidType) << " ";
679 DumpSolidParams( solid );
680 theSolids[solidName] = solid;
681 }
682
683 return solidName;
684}
G4VSolid * GetConstituentMovedSolid() const
void DumpScaledVolume(G4VSolid *so)
void DumpBooleanVolume(const G4String &solidType, G4VSolid *so)
G4String GetTGSolidType(const G4String &solidtype)
void DumpMultiUnionVolume(G4VSolid *so)
void DumpSolidParams(G4VSolid *so)

References AddQuotes(), DumpBooleanVolume(), DumpMultiUnionVolume(), DumpScaledVolume(), DumpSolid(), DumpSolidParams(), FatalException, G4Exception(), G4ReflectedSolid::GetConstituentMovedSolid(), G4VSolid::GetEntityType(), G4VSolid::GetName(), GetObjectName(), GetTGSolidType(), and theSolids.

Referenced by DumpBooleanVolume(), DumpLogVol(), DumpMultiUnionVolume(), and DumpSolid().

◆ DumpSolidParams()

void G4tgbGeometryDumper::DumpSolidParams ( G4VSolid so)

Definition at line 795 of file G4tgbGeometryDumper.cc.

796{
797 std::vector<G4double> params = GetSolidParams(so);
798 for(std::size_t ii = 0; ii < params.size(); ++ii)
799 {
800 (*theFile) << params[ii] << " ";
801 }
802 (*theFile) << G4endl;
803}

References G4endl, and GetSolidParams().

Referenced by DumpSolid().

◆ FindSolidName()

const G4String & G4tgbGeometryDumper::FindSolidName ( G4VSolid solid)
private

Definition at line 1462 of file G4tgbGeometryDumper.cc.

1463{
1464 std::map<G4String, G4VSolid*>::const_iterator ite;
1465 for(ite = theSolids.cbegin(); ite != theSolids.cend(); ++ite)
1466 {
1467 if(solid == (*ite).second)
1468 {
1469 return (*ite).first;
1470 }
1471 }
1472
1473 if(ite == theSolids.cend())
1474 {
1475 G4Exception("G4tgbGeometryDumper::FindSolidName()", "ReadError",
1476 FatalException, "Programming error.");
1477 }
1478 return (*ite).first;
1479}

References FatalException, G4Exception(), and theSolids.

Referenced by DumpBooleanVolume().

◆ GetInstance()

G4tgbGeometryDumper * G4tgbGeometryDumper::GetInstance ( )
static

Definition at line 85 of file G4tgbGeometryDumper.cc.

86{
87 if(theInstance == nullptr)
88 {
90 }
91 return theInstance;
92}
static G4ThreadLocal G4tgbGeometryDumper * theInstance

References G4tgbGeometryDumper(), and theInstance.

◆ GetIsotopeName()

G4String G4tgbGeometryDumper::GetIsotopeName ( G4Isotope isot)
private

Definition at line 1271 of file G4tgbGeometryDumper.cc.

1272{
1273 G4String isotName = isot->GetName();
1274 // first look if this is isotope is already dumped,
1275 // with original isotope name or new one
1276 //
1277 std::map<G4String, G4Isotope*>::const_iterator ite;
1278 for(ite = theIsotopes.cbegin(); ite != theIsotopes.cend(); ++ite)
1279 {
1280 if(isot == (*ite).second)
1281 {
1282 return (*ite).first;
1283 }
1284 }
1285
1286 // Now look if there is another isotope dumped with same name,
1287 // and if found add _N to the name
1288 //
1289 ite = theIsotopes.find(isotName);
1290 if(ite != theIsotopes.cend()) // Isotope found with same name
1291 {
1292 G4Isotope* isotold = (*ite).second;
1293 if(isot != isotold) // new isotope it is not the really
1294 { // the same one as isotope found
1295 if(!Same2G4Isotopes(isot, isotold))
1296 { // if the two have same data, use the old one
1297 G4int ii = 2; // G4Nist does names isotopes of same element
1298 // with same name
1299 for(;; ++ii)
1300 {
1301 G4String newIsotName =
1302 isotName + "_" + G4UIcommand::ConvertToString(ii);
1303 std::map<G4String, G4Isotope*>::const_iterator ite2 =
1304 theIsotopes.find(newIsotName);
1305 if(ite2 == theIsotopes.cend())
1306 {
1307 isotName = newIsotName;
1308 break;
1309 }
1310 else
1311 {
1312 if(Same2G4Isotopes(isot, (*ite2).second))
1313 {
1314 isotName = newIsotName;
1315 break;
1316 }
1317 }
1318 }
1319 }
1320 }
1321 }
1322 return isotName;
1323}
const G4String & GetName() const
Definition: G4Isotope.hh:87
G4bool Same2G4Isotopes(G4Isotope *ele1, G4Isotope *ele2)

References G4UIcommand::ConvertToString(), G4Isotope::GetName(), Same2G4Isotopes(), and theIsotopes.

◆ GetObjectName()

template<class TYP >
G4String G4tgbGeometryDumper::GetObjectName ( TYP *  obj,
std::map< G4String, TYP * >  objectsDumped 
)
private

Definition at line 1327 of file G4tgbGeometryDumper.cc.

1329{
1330 G4String objName = obj->GetName();
1331
1332 // first look if this is objecy is already dumped,
1333 // with original object name or new one
1334 //
1335 typename std::map<G4String, TYP*>::const_iterator ite;
1336 for(ite = objectsDumped.cbegin(); ite != objectsDumped.cend(); ++ite)
1337 {
1338 if(obj == (*ite).second)
1339 {
1340 return (*ite).first;
1341 }
1342 }
1343
1344 // Now look if there is another object dumped with same name,
1345 // and if found add _N to the name
1346 //
1347 ite = objectsDumped.find(objName);
1348
1349 if(ite != objectsDumped.cend()) // Object found with same name
1350 {
1351 TYP* objold = (*ite).second;
1352 if(obj != objold) // new object it is not the really
1353 { // the same one as object found
1354 G4int ii = 2;
1355 for(;; ++ii)
1356 {
1357 G4String newObjName = objName + "_" + G4UIcommand::ConvertToString(ii);
1358 typename std::map<G4String, TYP*>::const_iterator ite2 =
1359 objectsDumped.find(newObjName);
1360 if(ite2 == objectsDumped.cend())
1361 {
1362 objName = newObjName;
1363 break;
1364 }
1365 }
1366 }
1367 }
1368 return objName;
1369}

References G4UIcommand::ConvertToString().

Referenced by DumpBooleanVolume(), DumpElement(), DumpIsotope(), DumpLogVol(), DumpMaterial(), DumpMultiUnionVolume(), DumpScaledVolume(), and DumpSolid().

◆ GetPVChildren()

std::vector< G4VPhysicalVolume * > G4tgbGeometryDumper::GetPVChildren ( G4LogicalVolume lv)
private

Definition at line 1170 of file G4tgbGeometryDumper.cc.

1171{
1173 std::vector<G4VPhysicalVolume*> children;
1174 for(auto ite = pvstore->cbegin(); ite != pvstore->cend(); ++ite)
1175 {
1176 if((*ite)->GetMotherLogical() == lv)
1177 {
1178 children.push_back(*ite);
1179#ifdef G4VERBOSE
1181 {
1182 G4cout << " G4tgbGeometryDumper::GetPVChildren() - adding children: "
1183 << (*ite)->GetName() << " of " << lv->GetName() << G4endl;
1184 }
1185#endif
1186 }
1187 }
1188
1189 return children;
1190}
static G4PhysicalVolumeStore * GetInstance()

References G4cout, G4endl, G4PhysicalVolumeStore::GetInstance(), G4LogicalVolume::GetName(), and G4tgrMessenger::GetVerboseLevel().

Referenced by DumpPhysVol().

◆ GetSolidParams()

std::vector< G4double > G4tgbGeometryDumper::GetSolidParams ( const G4VSolid so)

Definition at line 806 of file G4tgbGeometryDumper.cc.

807{
808 std::vector<G4double> params;
809
810 G4String solidType = so->GetEntityType();
811 solidType = GetTGSolidType(solidType);
812
813 if(solidType == "BOX")
814 {
815 const G4Box* sb = dynamic_cast<const G4Box*>(so);
816 if(sb != nullptr)
817 {
818 params.push_back(sb->GetXHalfLength());
819 params.push_back(sb->GetYHalfLength());
820 params.push_back(sb->GetZHalfLength());
821 }
822 }
823 else if(solidType == "TUBS")
824 {
825 const G4Tubs* tu = dynamic_cast<const G4Tubs*>(so);
826 if(tu != nullptr)
827 {
828 params.push_back(tu->GetInnerRadius());
829 params.push_back(tu->GetOuterRadius());
830 params.push_back(tu->GetZHalfLength());
831 params.push_back(tu->GetStartPhiAngle() / deg);
832 params.push_back(tu->GetDeltaPhiAngle() / deg);
833 }
834 }
835 else if(solidType == "TRAP")
836 {
837 const G4Trap* trp = dynamic_cast<const G4Trap*>(so);
838 if(trp != nullptr)
839 {
840 G4ThreeVector symAxis(trp->GetSymAxis());
841 params.push_back(trp->GetZHalfLength());
842 params.push_back(symAxis.theta() / deg);
843 params.push_back(symAxis.phi() / deg);
844 params.push_back(trp->GetYHalfLength1());
845 params.push_back(trp->GetXHalfLength1());
846 params.push_back(trp->GetXHalfLength2());
847 params.push_back(std::atan(trp->GetTanAlpha1()) / deg);
848 params.push_back(trp->GetYHalfLength2());
849 params.push_back(trp->GetXHalfLength3());
850 params.push_back(trp->GetXHalfLength4());
851 params.push_back(std::atan(trp->GetTanAlpha2()) / deg);
852 }
853 }
854 else if(solidType == "TRD")
855 {
856 const G4Trd* tr = dynamic_cast<const G4Trd*>(so);
857 if(tr != nullptr)
858 {
859 params.push_back(tr->GetXHalfLength1());
860 params.push_back(tr->GetXHalfLength2());
861 params.push_back(tr->GetYHalfLength1());
862 params.push_back(tr->GetYHalfLength2());
863 params.push_back(tr->GetZHalfLength());
864 }
865 }
866 else if(solidType == "PARA")
867 {
868 const G4Para* para = dynamic_cast<const G4Para*>(so);
869 if(para != nullptr)
870 {
871 G4ThreeVector symAxis(para->GetSymAxis());
872 params.push_back(para->GetXHalfLength());
873 params.push_back(para->GetYHalfLength());
874 params.push_back(para->GetZHalfLength());
875 params.push_back(std::atan(para->GetTanAlpha()) / deg);
876 params.push_back(symAxis.theta() / deg);
877 params.push_back(symAxis.phi() / deg);
878 }
879 }
880 else if(solidType == "CONS")
881 {
882 const G4Cons* cn = dynamic_cast<const G4Cons*>(so);
883 if(cn != nullptr)
884 {
885 params.push_back(cn->GetInnerRadiusMinusZ());
886 params.push_back(cn->GetOuterRadiusMinusZ());
887 params.push_back(cn->GetInnerRadiusPlusZ());
888 params.push_back(cn->GetOuterRadiusPlusZ());
889 params.push_back(cn->GetZHalfLength());
890 params.push_back(cn->GetStartPhiAngle() / deg);
891 params.push_back(cn->GetDeltaPhiAngle() / deg);
892 }
893 }
894 else if(solidType == "SPHERE")
895 {
896 const G4Sphere* sphere = dynamic_cast<const G4Sphere*>(so);
897 if(sphere != nullptr)
898 {
899 params.push_back(sphere->GetInnerRadius());
900 params.push_back(sphere->GetOuterRadius());
901 params.push_back(sphere->GetStartPhiAngle() / deg);
902 params.push_back(sphere->GetDeltaPhiAngle() / deg);
903 params.push_back(sphere->GetStartThetaAngle() / deg);
904 params.push_back(sphere->GetDeltaThetaAngle() / deg);
905 }
906 }
907 else if(solidType == "ORB")
908 {
909 const G4Orb* orb = dynamic_cast<const G4Orb*>(so);
910 if(orb != nullptr)
911 {
912 params.push_back(orb->GetRadius());
913 }
914 }
915 else if(solidType == "TORUS")
916 {
917 const G4Torus* torus = dynamic_cast<const G4Torus*>(so);
918 if(torus != nullptr)
919 {
920 params.push_back(torus->GetRmin());
921 params.push_back(torus->GetRmax());
922 params.push_back(torus->GetRtor());
923 params.push_back(torus->GetSPhi() / deg);
924 params.push_back(torus->GetDPhi() / deg);
925 }
926 }
927 else if(solidType == "POLYCONE")
928 {
929 //--- Dump RZ corners, as original parameters will not be present
930 // if it was build from RZ corners
931 const G4Polycone* plc = dynamic_cast<const G4Polycone*>(so);
932 if(plc != nullptr)
933 {
934 G4double angphi = plc->GetStartPhi() / deg;
935 if(angphi > 180 * deg)
936 {
937 angphi -= 360 * deg;
938 }
939 G4double endphi = plc->GetEndPhi() / deg;
940 if(endphi > 180 * deg)
941 {
942 endphi -= 360 * deg;
943 }
944 params.push_back(angphi);
945 params.push_back(endphi - angphi);
946 // params.push_back(plc->GetOriginalParameters()->Opening_angle / deg);
947 G4int ncor = plc->GetNumRZCorner();
948 params.push_back(ncor);
949
950 for(G4int ii = 0; ii < ncor; ++ii)
951 {
952 params.push_back(plc->GetCorner(ii).r);
953 params.push_back(plc->GetCorner(ii).z);
954 }
955 }
956 }
957 else if(solidType == "GENERICPOLYCONE")
958 {
959 //--- Dump RZ corners
960 const G4GenericPolycone* plc = dynamic_cast<const G4GenericPolycone*>(so);
961 if(plc != nullptr)
962 {
963 G4double angphi = plc->GetStartPhi() / deg;
964 if(angphi > 180 * deg)
965 {
966 angphi -= 360 * deg;
967 }
968 G4double endphi = plc->GetEndPhi() / deg;
969 if(endphi > 180 * deg)
970 {
971 endphi -= 360 * deg;
972 }
973 params.push_back(angphi);
974 params.push_back(endphi - angphi);
975 G4int ncor = plc->GetNumRZCorner();
976 params.push_back(ncor);
977
978 for(G4int ii = 0; ii < ncor; ++ii)
979 {
980 params.push_back(plc->GetCorner(ii).r);
981 params.push_back(plc->GetCorner(ii).z);
982 }
983 }
984 }
985 else if(solidType == "POLYHEDRA")
986 {
987 //--- Dump RZ corners, as original parameters will not be present
988 // if it was build from RZ corners
989 const G4Polyhedra* ph = (dynamic_cast<const G4Polyhedra*>(so));
990 if(ph != nullptr)
991 {
992 G4double angphi = ph->GetStartPhi() / deg;
993 if(angphi > 180 * deg)
994 angphi -= 360 * deg;
995
996 G4int ncor = ph->GetNumRZCorner();
997
998 params.push_back(angphi);
999 params.push_back(ph->GetOriginalParameters()->Opening_angle / deg);
1000 params.push_back(ph->GetNumSide());
1001 params.push_back(ncor);
1002
1003 for(G4int ii = 0; ii < ncor; ++ii)
1004 {
1005 params.push_back(ph->GetCorner(ii).r);
1006 params.push_back(ph->GetCorner(ii).z);
1007 }
1008 }
1009 }
1010 else if(solidType == "ELLIPTICALTUBE")
1011 {
1012 const G4EllipticalTube* eltu = dynamic_cast<const G4EllipticalTube*>(so);
1013 if(eltu != nullptr)
1014 {
1015 params.push_back(eltu->GetDx());
1016 params.push_back(eltu->GetDy());
1017 params.push_back(eltu->GetDz());
1018 }
1019 }
1020 else if(solidType == "ELLIPSOID")
1021 {
1022 const G4Ellipsoid* dso = dynamic_cast<const G4Ellipsoid*>(so);
1023 if(dso != nullptr)
1024 {
1025 params.push_back(dso->GetSemiAxisMax(0));
1026 params.push_back(dso->GetSemiAxisMax(1));
1027 params.push_back(dso->GetSemiAxisMax(2));
1028 params.push_back(dso->GetZBottomCut());
1029 params.push_back(dso->GetZTopCut());
1030 }
1031 }
1032 else if(solidType == "ELLIPTICAL_CONE")
1033 {
1034 const G4EllipticalCone* elco = dynamic_cast<const G4EllipticalCone*>(so);
1035 if(elco != nullptr)
1036 {
1037 params.push_back(elco->GetSemiAxisX());
1038 params.push_back(elco->GetSemiAxisY());
1039 params.push_back(elco->GetZMax());
1040 params.push_back(elco->GetZTopCut());
1041 }
1042 }
1043 else if(solidType == "HYPE")
1044 {
1045 const G4Hype* hype = dynamic_cast<const G4Hype*>(so);
1046 if(hype != nullptr)
1047 {
1048 params.push_back(hype->GetInnerRadius());
1049 params.push_back(hype->GetOuterRadius());
1050 params.push_back(hype->GetInnerStereo() / deg);
1051 params.push_back(hype->GetOuterStereo() / deg);
1052 params.push_back(2 * hype->GetZHalfLength());
1053 }
1054 // } else if( solidType == "TET" ) {
1055 }
1056 else if(solidType == "TWISTEDBOX")
1057 {
1058 const G4TwistedBox* tbox = dynamic_cast<const G4TwistedBox*>(so);
1059 if(tbox != nullptr)
1060 {
1061 params.push_back(tbox->GetPhiTwist() / deg);
1062 params.push_back(tbox->GetXHalfLength());
1063 params.push_back(tbox->GetYHalfLength());
1064 params.push_back(tbox->GetZHalfLength());
1065 }
1066 }
1067 else if(solidType == "TWISTEDTRAP")
1068 {
1069 const G4TwistedTrap* ttrap = dynamic_cast<const G4TwistedTrap*>(so);
1070 if(ttrap != nullptr)
1071 {
1072 params.push_back(ttrap->GetPhiTwist() / deg);
1073 params.push_back(ttrap->GetZHalfLength());
1074 params.push_back(ttrap->GetPolarAngleTheta() / deg);
1075 params.push_back(ttrap->GetAzimuthalAnglePhi() / deg);
1076 params.push_back(ttrap->GetY1HalfLength());
1077 params.push_back(ttrap->GetX1HalfLength());
1078 params.push_back(ttrap->GetX2HalfLength());
1079 params.push_back(ttrap->GetY2HalfLength());
1080 params.push_back(ttrap->GetX3HalfLength());
1081 params.push_back(ttrap->GetX4HalfLength());
1082 params.push_back(ttrap->GetTiltAngleAlpha() / deg);
1083 }
1084 }
1085 else if(solidType == "TWISTEDTRD")
1086 {
1087 const G4TwistedTrd* ttrd = dynamic_cast<const G4TwistedTrd*>(so);
1088 if(ttrd != nullptr)
1089 {
1090 params.push_back(ttrd->GetX1HalfLength());
1091 params.push_back(ttrd->GetX2HalfLength());
1092 params.push_back(ttrd->GetY1HalfLength());
1093 params.push_back(ttrd->GetY2HalfLength());
1094 params.push_back(ttrd->GetZHalfLength());
1095 params.push_back(ttrd->GetPhiTwist() / deg);
1096 }
1097 }
1098 else if(solidType == "TWISTEDTUBS")
1099 {
1100 const G4TwistedTubs* ttub = dynamic_cast<const G4TwistedTubs*>(so);
1101 if(ttub != nullptr)
1102 {
1103 params.push_back(ttub->GetInnerRadius());
1104 params.push_back(ttub->GetOuterRadius());
1105 params.push_back(ttub->GetZHalfLength());
1106 params.push_back(ttub->GetDPhi() / deg);
1107 params.push_back(ttub->GetPhiTwist() / deg);
1108 }
1109 }
1110 else
1111 {
1112 G4String ErrMessage = "Solid type not supported, sorry... " + solidType;
1113 G4Exception("G4tgbGeometryDumper::DumpSolidParams()", "NotImplemented",
1114 FatalException, ErrMessage);
1115 }
1116
1117 return params;
1118}
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
G4double GetSemiAxisMax(G4int i) const
G4double GetZTopCut() const
G4double GetZBottomCut() const
G4double GetSemiAxisX() const
G4double GetSemiAxisY() const
G4double GetZMax() const
G4double GetZTopCut() const
G4double GetDy() const
G4double GetDx() const
G4double GetDz() const
G4double GetStartPhi() const
G4double GetEndPhi() const
G4int GetNumRZCorner() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4double GetInnerStereo() const
G4double GetZHalfLength() const
G4double GetOuterStereo() const
G4double GetOuterRadius() const
G4double GetInnerRadius() const
G4double GetRadius() const
G4double GetTanAlpha() const
G4ThreeVector GetSymAxis() const
G4double GetYHalfLength() const
G4double GetZHalfLength() const
G4double GetXHalfLength() const
G4double GetEndPhi() const
G4double GetStartPhi() const
G4int GetNumRZCorner() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4int GetNumRZCorner() const
G4int GetNumSide() const
G4PolyhedraHistorical * GetOriginalParameters() const
G4PolyhedraSideRZ GetCorner(const G4int index) const
G4double GetStartPhi() const
G4double GetStartPhiAngle() const
G4double GetDeltaPhiAngle() const
G4double GetInnerRadius() const
G4double GetOuterRadius() const
G4double GetDeltaThetaAngle() const
G4double GetStartThetaAngle() const
G4double GetDPhi() const
G4double GetRmin() const
G4double GetRtor() const
G4double GetRmax() const
G4double GetSPhi() 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
Definition: G4TwistedBox.hh:65
G4double GetXHalfLength() const
Definition: G4TwistedBox.hh:62
G4double GetZHalfLength() const
Definition: G4TwistedBox.hh:64
G4double GetYHalfLength() const
Definition: G4TwistedBox.hh:63
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
Definition: G4TwistedTrd.hh:67
G4double GetY2HalfLength() const
Definition: G4TwistedTrd.hh:69
G4double GetY1HalfLength() const
Definition: G4TwistedTrd.hh:68
G4double GetZHalfLength() const
Definition: G4TwistedTrd.hh:70
G4double GetPhiTwist() const
Definition: G4TwistedTrd.hh:71
G4double GetX1HalfLength() const
Definition: G4TwistedTrd.hh:66
G4double GetOuterRadius() const
G4double GetZHalfLength() const
G4double GetPhiTwist() const
G4double GetInnerRadius() const
G4double GetDPhi() const

References deg, FatalException, G4Exception(), G4TwistedTrap::GetAzimuthalAnglePhi(), G4Polyhedra::GetCorner(), G4GenericPolycone::GetCorner(), G4Polycone::GetCorner(), G4Cons::GetDeltaPhiAngle(), G4Sphere::GetDeltaPhiAngle(), G4Tubs::GetDeltaPhiAngle(), G4Sphere::GetDeltaThetaAngle(), G4Torus::GetDPhi(), G4TwistedTubs::GetDPhi(), G4EllipticalTube::GetDx(), G4EllipticalTube::GetDy(), G4EllipticalTube::GetDz(), G4GenericPolycone::GetEndPhi(), G4Polycone::GetEndPhi(), G4VSolid::GetEntityType(), G4Sphere::GetInnerRadius(), G4Tubs::GetInnerRadius(), G4Hype::GetInnerRadius(), G4TwistedTubs::GetInnerRadius(), G4Cons::GetInnerRadiusMinusZ(), G4Cons::GetInnerRadiusPlusZ(), G4Hype::GetInnerStereo(), G4GenericPolycone::GetNumRZCorner(), G4Polycone::GetNumRZCorner(), G4Polyhedra::GetNumRZCorner(), G4Polyhedra::GetNumSide(), G4Polyhedra::GetOriginalParameters(), G4Sphere::GetOuterRadius(), G4Tubs::GetOuterRadius(), G4Hype::GetOuterRadius(), G4TwistedTubs::GetOuterRadius(), G4Cons::GetOuterRadiusMinusZ(), G4Cons::GetOuterRadiusPlusZ(), G4Hype::GetOuterStereo(), G4TwistedBox::GetPhiTwist(), G4TwistedTrap::GetPhiTwist(), G4TwistedTrd::GetPhiTwist(), G4TwistedTubs::GetPhiTwist(), G4TwistedTrap::GetPolarAngleTheta(), G4Orb::GetRadius(), G4Torus::GetRmax(), G4Torus::GetRmin(), G4Torus::GetRtor(), G4Ellipsoid::GetSemiAxisMax(), G4EllipticalCone::GetSemiAxisX(), G4EllipticalCone::GetSemiAxisY(), G4Torus::GetSPhi(), G4GenericPolycone::GetStartPhi(), G4Polycone::GetStartPhi(), G4Polyhedra::GetStartPhi(), G4Cons::GetStartPhiAngle(), G4Sphere::GetStartPhiAngle(), G4Tubs::GetStartPhiAngle(), G4Sphere::GetStartThetaAngle(), G4Para::GetSymAxis(), G4Trap::GetSymAxis(), G4Para::GetTanAlpha(), G4Trap::GetTanAlpha1(), G4Trap::GetTanAlpha2(), GetTGSolidType(), G4TwistedTrap::GetTiltAngleAlpha(), G4TwistedTrap::GetX1HalfLength(), G4TwistedTrd::GetX1HalfLength(), G4TwistedTrap::GetX2HalfLength(), G4TwistedTrd::GetX2HalfLength(), G4TwistedTrap::GetX3HalfLength(), G4TwistedTrap::GetX4HalfLength(), G4Box::GetXHalfLength(), G4Para::GetXHalfLength(), G4TwistedBox::GetXHalfLength(), G4Trap::GetXHalfLength1(), G4Trd::GetXHalfLength1(), G4Trap::GetXHalfLength2(), G4Trd::GetXHalfLength2(), G4Trap::GetXHalfLength3(), G4Trap::GetXHalfLength4(), G4TwistedTrap::GetY1HalfLength(), G4TwistedTrd::GetY1HalfLength(), G4TwistedTrap::GetY2HalfLength(), G4TwistedTrd::GetY2HalfLength(), G4Box::GetYHalfLength(), G4Para::GetYHalfLength(), G4TwistedBox::GetYHalfLength(), G4Trap::GetYHalfLength1(), G4Trd::GetYHalfLength1(), G4Trap::GetYHalfLength2(), G4Trd::GetYHalfLength2(), G4Ellipsoid::GetZBottomCut(), G4Box::GetZHalfLength(), G4Cons::GetZHalfLength(), G4Para::GetZHalfLength(), G4Trap::GetZHalfLength(), G4Trd::GetZHalfLength(), G4Tubs::GetZHalfLength(), G4Hype::GetZHalfLength(), G4TwistedBox::GetZHalfLength(), G4TwistedTrap::GetZHalfLength(), G4TwistedTrd::GetZHalfLength(), G4TwistedTubs::GetZHalfLength(), G4EllipticalCone::GetZMax(), G4Ellipsoid::GetZTopCut(), G4EllipticalCone::GetZTopCut(), G4PolyhedraHistorical::Opening_angle, CLHEP::Hep3Vector::phi(), G4PolyconeSideRZ::r, G4PolyhedraSideRZ::r, CLHEP::Hep3Vector::theta(), G4PolyconeSideRZ::z, and G4PolyhedraSideRZ::z.

Referenced by DumpPVParameterised(), and DumpSolidParams().

◆ GetTGSolidType()

G4String G4tgbGeometryDumper::GetTGSolidType ( const G4String solidtype)
private

Definition at line 1193 of file G4tgbGeometryDumper.cc.

1194{
1195 G4String newsolidType = solidType.substr(2, solidType.length());
1196 for(std::size_t ii = 0; ii < newsolidType.length(); ++ii)
1197 {
1198 newsolidType[ii] = toupper(newsolidType[ii]);
1199 }
1200 return newsolidType;
1201}

Referenced by DumpSolid(), and GetSolidParams().

◆ GetTopPhysVol()

G4VPhysicalVolume * G4tgbGeometryDumper::GetTopPhysVol ( )

Definition at line 104 of file G4tgbGeometryDumper.cc.

105{
107 G4VPhysicalVolume* pv = *(pvstore->cbegin());
108 for(;;)
109 {
111 if(lv == 0)
112 {
113 break;
114 }
115
116 //----- look for one PV of this LV
117 for(auto ite = pvstore->cbegin(); ite != pvstore->cend(); ++ite)
118 {
119 pv = (*ite);
120 if(pv->GetLogicalVolume() == lv)
121 {
122 break;
123 }
124 }
125 }
126
127 return pv;
128}

References G4PhysicalVolumeStore::GetInstance(), G4VPhysicalVolume::GetLogicalVolume(), and G4VPhysicalVolume::GetMotherLogical().

Referenced by DumpGeometry().

◆ LookForExistingRotation()

G4String G4tgbGeometryDumper::LookForExistingRotation ( const G4RotationMatrix rotm)
private

Definition at line 1432 of file G4tgbGeometryDumper.cc.

1433{
1434 G4String rmName = "";
1435
1436 for(auto ite = theRotMats.cbegin(); ite != theRotMats.cend(); ++ite)
1437 {
1438 if((*ite).second->isNear(*rotm))
1439 {
1440 rmName = (*ite).first;
1441 break;
1442 }
1443 }
1444 return rmName;
1445}

References theRotMats.

Referenced by DumpRotationMatrix().

◆ MatDeterminant()

G4double G4tgbGeometryDumper::MatDeterminant ( G4RotationMatrix ro)
private

◆ Same2G4Isotopes()

G4bool G4tgbGeometryDumper::Same2G4Isotopes ( G4Isotope ele1,
G4Isotope ele2 
)
private

Definition at line 1448 of file G4tgbGeometryDumper.cc.

1449{
1450 if((isot1->GetZ() != isot2->GetZ()) || (isot1->GetN() != isot2->GetN()) ||
1451 (isot1->GetA() != isot2->GetA()))
1452 {
1453 return false;
1454 }
1455 else
1456 {
1457 return true;
1458 }
1459}

References G4Isotope::GetA(), G4Isotope::GetN(), and G4Isotope::GetZ().

Referenced by GetIsotopeName().

◆ SubstituteRefl()

G4String G4tgbGeometryDumper::SubstituteRefl ( G4String  name)
private

Definition at line 1260 of file G4tgbGeometryDumper.cc.

1261{
1262 G4int irefl = name.rfind("_refl");
1263 if(irefl != -1)
1264 {
1265 name = name.substr(0, irefl) + "_REFL";
1266 }
1267 return name;
1268}

References G4InuclParticleNames::name().

Referenced by DumpLogVol(), DumpPVPlacement(), and DumpPVReplica().

◆ SupressRefl()

G4String G4tgbGeometryDumper::SupressRefl ( G4String  name)
private

Definition at line 1249 of file G4tgbGeometryDumper.cc.

1250{
1251 G4int irefl = name.rfind("_refl");
1252 if(irefl != -1)
1253 {
1254 name = name.substr(0, irefl);
1255 }
1256 return name;
1257}

References G4InuclParticleNames::name().

Referenced by DumpLogVol().

Field Documentation

◆ theElements

std::map<G4String, G4Element*> G4tgbGeometryDumper::theElements
private

Definition at line 110 of file G4tgbGeometryDumper.hh.

Referenced by DumpElement(), and DumpMaterial().

◆ theFile

std::ofstream* G4tgbGeometryDumper::theFile = nullptr
private

Definition at line 107 of file G4tgbGeometryDumper.hh.

Referenced by DumpGeometry().

◆ theInstance

G4ThreadLocal G4tgbGeometryDumper * G4tgbGeometryDumper::theInstance = nullptr
staticprivate

Definition at line 105 of file G4tgbGeometryDumper.hh.

Referenced by GetInstance().

◆ theIsotopes

std::map<G4String, G4Isotope*> G4tgbGeometryDumper::theIsotopes
private

Definition at line 111 of file G4tgbGeometryDumper.hh.

Referenced by DumpElement(), DumpIsotope(), and GetIsotopeName().

◆ theLogVols

std::map<G4String, G4LogicalVolume*> G4tgbGeometryDumper::theLogVols
private

Definition at line 113 of file G4tgbGeometryDumper.hh.

Referenced by CheckIfLogVolExists(), and DumpLogVol().

◆ theMaterials

std::map<G4String, G4Material*> G4tgbGeometryDumper::theMaterials
private

Definition at line 109 of file G4tgbGeometryDumper.hh.

Referenced by DumpMaterial().

◆ thePhysVols

std::map<G4String, G4VPhysicalVolume*> G4tgbGeometryDumper::thePhysVols
private

Definition at line 114 of file G4tgbGeometryDumper.hh.

Referenced by CheckIfPhysVolExists(), DumpPVPlacement(), and DumpPVReplica().

◆ theRotationNumber

G4int G4tgbGeometryDumper::theRotationNumber = 0
private

Definition at line 117 of file G4tgbGeometryDumper.hh.

Referenced by DumpRotationMatrix().

◆ theRotMats

std::map<G4String, G4RotationMatrix*> G4tgbGeometryDumper::theRotMats
private

Definition at line 115 of file G4tgbGeometryDumper.hh.

Referenced by DumpRotationMatrix(), and LookForExistingRotation().

◆ theSolids

std::map<G4String, G4VSolid*> G4tgbGeometryDumper::theSolids
private

The documentation for this class was generated from the following files: