Geant4  10.02.p03
G4tgbGeometryDumper Class Reference

#include <G4tgbGeometryDumper.hh>

Collaboration diagram for G4tgbGeometryDumper:

Public Member Functions

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

Static Public Member Functions

static G4tgbGeometryDumperGetInstance ()
 

Private Member Functions

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

Private Attributes

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

Static Private Attributes

static G4ThreadLocal G4tgbGeometryDumpertheInstance = 0
 

Detailed Description

Definition at line 56 of file G4tgbGeometryDumper.hh.

Constructor & Destructor Documentation

◆ ~G4tgbGeometryDumper()

G4tgbGeometryDumper::~G4tgbGeometryDumper ( )

Definition at line 136 of file G4tgbGeometryDumper.cc.

137 {
138 }

◆ G4tgbGeometryDumper()

G4tgbGeometryDumper::G4tgbGeometryDumper ( )
private

Definition at line 84 of file G4tgbGeometryDumper.cc.

85  : theFile(0), theRotationNumber(0)
86 {
87 }
Here is the caller graph for this function:

Member Function Documentation

◆ AddQuotes()

G4String G4tgbGeometryDumper::AddQuotes ( const G4String str)
private

Definition at line 1115 of file G4tgbGeometryDumper.cc.

1116 {
1117  //--- look if there is a separating blank
1118 
1119  G4bool bBlank = FALSE;
1120  size_t siz = str.length();
1121  for( size_t ii = 0; ii < siz; ii++ )
1122  {
1123  if( str.substr(ii,1) == " " )
1124  {
1125  bBlank = TRUE;
1126  break;
1127  }
1128  }
1129  G4String str2 = str;
1130  if( bBlank )
1131  {
1132  str2 = G4String("\"") + str2 + G4String("\"");
1133  }
1134  return str2;
1135 }
bool G4bool
Definition: G4Types.hh:79
#define FALSE
Definition: globals.hh:52
#define TRUE
Definition: globals.hh:55
Here is the caller graph for this function:

◆ approxTo0()

G4double G4tgbGeometryDumper::approxTo0 ( G4double  val)
private

Definition at line 1104 of file G4tgbGeometryDumper.cc.

1105 {
1107  ->GetSurfaceTolerance();
1108 
1109  if( std::fabs(val) < precision ) { val = 0; }
1110  return val;
1111 }
G4double GetSurfaceTolerance() const
double G4double
Definition: G4Types.hh:76
static G4GeometryTolerance * GetInstance()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckIfLogVolExists()

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

Definition at line 1258 of file G4tgbGeometryDumper.cc.

1260 {
1261  if( theLogVols.find( name ) != theLogVols.end() )
1262  {
1263  G4LogicalVolume* lvnew = (*(theLogVols.find(name))).second;
1264  if( lvnew != pt )
1265  {
1266  /*
1267  //---- Reflected volumes are repeated
1268 
1269  G4ReflectionFactory* reffact = G4ReflectionFactory::Instance();
1270  if( !reffact->IsReflected( pt ) && !reffact->IsReflected( lvnew ) )
1271  {
1272  G4String ErrMessage = "LogVol found but not same as before: " + name;
1273  G4Exception("G4tgbGeometryDumper::CheckIfLogVolExists()",
1274  "InvalidSetup", FatalException, ErrMessage);
1275  }
1276  */
1277  }
1278  return 1;
1279  }
1280  else
1281  {
1282  return 0;
1283  }
1284 }
std::map< G4String, G4LogicalVolume * > theLogVols
Here is the caller graph for this function:

◆ CheckIfPhysVolExists()

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

Definition at line 1288 of file G4tgbGeometryDumper.cc.

1290 {
1291 #ifdef G4VERBOSE
1292  if( G4tgrMessenger::GetVerboseLevel() >= 1 )
1293  {
1294  G4cout << " G4tgbGeometryDumper::CheckIfPhysVolExists() - "
1295  << name << G4endl;
1296  }
1297 #endif
1298  if( thePhysVols.find( name ) != thePhysVols.end() )
1299  {
1300  if( (*(thePhysVols.find(name))).second != pt )
1301  {
1302  // G4String ErrMessage = "Placement found but not same as before: "
1303  // + name;
1304  // G4Exception("G4tgbGeometryDumper::CheckIfPhysVolExists()",
1305  // "InvalidSetup", FatalException, ErrMessage);
1306  G4cerr << " G4tgbGeometryDumper::CheckIfPhysVolExists () -"
1307  << " Placement found but not same as before : " << name << G4endl;
1308  }
1309  return 1;
1310  }
1311  else
1312  {
1313  return 0;
1314  }
1315 }
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
TMarker * pt
Definition: egs.C:25
std::map< G4String, G4VPhysicalVolume * > thePhysVols
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpBooleanVolume()

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

Definition at line 700 of file G4tgbGeometryDumper.cc.

702 {
703  G4BooleanSolid * bso = dynamic_cast < G4BooleanSolid * > (so);
704  if (!bso) { return; }
705  G4VSolid* solid0 = bso->GetConstituentSolid( 0 );
706  G4VSolid* solid1 = bso->GetConstituentSolid( 1 );
707  G4DisplacedSolid* solid1Disp = 0;
708  G4bool displaced = dynamic_cast<G4DisplacedSolid*>(solid1);
709  if( displaced )
710  {
711  solid1Disp = dynamic_cast<G4DisplacedSolid*>(solid1);
712  if (solid1Disp) { solid1 = solid1Disp->GetConstituentMovedSolid(); }
713  }
714  DumpSolid( solid0 );
715  DumpSolid( solid1 );
716 
717  G4String rotName;
719  if( displaced )
720  {
721  pos = solid1Disp->GetObjectTranslation(); // translation is of mother frame
722  rotName = DumpRotationMatrix( new G4RotationMatrix( (solid1Disp->
723  GetTransform().NetRotation()).inverse() ) );
724  }
725  else // no displacement
726  {
727  rotName = DumpRotationMatrix( new G4RotationMatrix );
728  pos = G4ThreeVector();
729  }
730 
731  G4String bsoName = GetObjectName(so,theSolids);
732  if( theSolids.find( bsoName ) != theSolids.end() ) return; // alredy dumped
733  G4String solid0Name = FindSolidName( solid0 );
734  G4String solid1Name = FindSolidName( solid1 );
735 
736  (*theFile) << ":SOLID "
737  << AddQuotes(bsoName) << " "
738  << AddQuotes(solidType) << " "
739  << AddQuotes(solid0Name) << " "
740  << AddQuotes(solid1Name) << " "
741  << AddQuotes(rotName) << " "
742  << approxTo0(pos.x()) << " "
743  << approxTo0(pos.y()) << " "
744  << approxTo0(pos.z()) << " " << G4endl;
745 
746  theSolids[bsoName] = bso;
747 }
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
const G4String & FindSolidName(G4VSolid *solid)
G4ThreeVector GetObjectTranslation() const
virtual const G4VSolid * GetConstituentSolid(G4int no) const
std::map< G4String, G4VSolid * > theSolids
G4String AddQuotes(const G4String &str)
bool G4bool
Definition: G4Types.hh:79
G4VSolid * GetConstituentMovedSolid() const
G4double approxTo0(G4double val)
double x() const
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
double y() const
double z() const
#define G4endl
Definition: G4ios.hh:61
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
static const G4double pos
G4String GetObjectName(TYP *obj, std::map< G4String, TYP *> objectsDumped)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpElement()

void G4tgbGeometryDumper::DumpElement ( G4Element ele)

Definition at line 580 of file G4tgbGeometryDumper.cc.

581 {
582  G4String elemName = GetObjectName(ele,theElements);
583 
584  if( theElements.find( elemName ) != theElements.end() ) // alredy dumped
585  {
586  return;
587  }
588 
589  //--- Add symbol name: Material mixtures store the components as elements
590  // (even if the input are materials), but without symbol
591  //
592  G4String symbol = ele->GetSymbol();
593  if( symbol == "" || symbol == " " )
594  {
595  symbol = elemName;
596  }
597 
598  if( ele->GetNumberOfIsotopes() == 0 )
599  {
600  (*theFile) << ":ELEM " << AddQuotes(elemName) << " "
601  << AddQuotes(symbol) << " " << ele->GetZ() << " "
602  << ele->GetA()/(g/mole) << " " << G4endl;
603  }
604  else
605  {
606  const G4IsotopeVector* isots = ele->GetIsotopeVector();
607  for (size_t ii = 0; ii < ele->GetNumberOfIsotopes(); ii++)
608  {
609  DumpIsotope( (*isots)[ii] );
610  }
611 
612  (*theFile) << ":ELEM_FROM_ISOT " << AddQuotes(elemName) << " "
613  << AddQuotes(symbol) << " " << ele->GetNumberOfIsotopes()
614  << G4endl;
615  const G4double* fractions = ele->GetRelativeAbundanceVector();
616  for (size_t ii = 0; ii < ele->GetNumberOfIsotopes(); ii++)
617  {
618  (*theFile) << " "
619  << AddQuotes(GetObjectName((*isots)[ii],theIsotopes)) << " "
620  << fractions[ii] << G4endl;
621  }
622  }
623  theElements[elemName] = ele;
624 }
G4String symbol
Definition: TRTMaterials.hh:40
G4double GetA() const
Definition: G4Element.hh:138
std::vector< G4Isotope * > G4IsotopeVector
void DumpIsotope(G4Isotope *ele)
std::map< G4String, G4Element * > theElements
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5206
G4String AddQuotes(const G4String &str)
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
std::map< G4String, G4Isotope * > theIsotopes
static const G4double ele
static const double mole
Definition: G4SIunits.hh:283
const G4String & GetSymbol() const
Definition: G4Element.hh:128
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double GetZ() const
Definition: G4Element.hh:131
G4String GetObjectName(TYP *obj, std::map< G4String, TYP *> objectsDumped)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpGeometry()

void G4tgbGeometryDumper::DumpGeometry ( const G4String fname)

Definition at line 101 of file G4tgbGeometryDumper.cc.

102 {
103  theFile = new std::ofstream(fname);
104 
106  DumpPhysVol( pv ); // dump volume and recursively it will dump all hierarchy
107 }
void DumpPhysVol(G4VPhysicalVolume *pv)
G4VPhysicalVolume * GetTopPhysVol()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpIsotope()

void G4tgbGeometryDumper::DumpIsotope ( G4Isotope ele)

Definition at line 628 of file G4tgbGeometryDumper.cc.

629 {
630  G4String isotName = GetObjectName(isot,theIsotopes);
631  if( theIsotopes.find( isotName ) != theIsotopes.end() ) // alredy dumped
632  {
633  return;
634  }
635 
636  (*theFile) << ":ISOT " << AddQuotes(isotName) << " "
637  << isot->GetZ() << " " << isot->GetN() << " "
638  << isot->GetA()/(g/mole) << " " << G4endl;
639 
640  theIsotopes[isotName] = isot;
641 }
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5206
G4String AddQuotes(const G4String &str)
std::map< G4String, G4Isotope * > theIsotopes
static const double mole
Definition: G4SIunits.hh:283
#define G4endl
Definition: G4ios.hh:61
G4String GetObjectName(TYP *obj, std::map< G4String, TYP *> objectsDumped)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpLogVol()

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

Definition at line 462 of file G4tgbGeometryDumper.cc.

464 {
465  G4String lvName;
466 
467  if( extraName == "" ) //--- take out the '_refl' in the name
468  {
469  lvName = GetObjectName(lv,theLogVols);
470  }
471  else
472  {
473  lvName = lv->GetName()+extraName;
474  }
475 
476  if( theLogVols.find( lvName ) != theLogVols.end() ) // alredy dumped
477  {
478  return lvName;
479  }
480 
481  if( !solid ) { solid = lv->GetSolid(); }
482 
483  //---- Dump solid
484  G4String solidName = DumpSolid( solid, extraName );
485 
486  //---- Dump material
487  if( !mate ) { mate = lv->GetMaterial(); }
488  G4String mateName = DumpMaterial( mate );
489 
490  //---- Dump logical volume (solid + material)
491  (*theFile) << ":VOLU " << SubstituteRefl(AddQuotes(lvName)) << " "
492  << SupressRefl(AddQuotes(solidName))
493  << " " << AddQuotes(mateName) << G4endl;
494 
495  theLogVols[lvName] = lv;
496 
497  return lvName;
498 }
G4String SupressRefl(G4String name)
G4String DumpMaterial(G4Material *mat)
G4Material * GetMaterial() const
std::map< G4String, G4LogicalVolume * > theLogVols
G4String AddQuotes(const G4String &str)
const G4String & GetName() const
G4String SubstituteRefl(G4String name)
#define G4endl
Definition: G4ios.hh:61
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
G4VSolid * GetSolid() const
G4String GetObjectName(TYP *obj, std::map< G4String, TYP *> objectsDumped)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpMaterial()

G4String G4tgbGeometryDumper::DumpMaterial ( G4Material mat)

Definition at line 502 of file G4tgbGeometryDumper.cc.

503 {
504  G4String mateName = GetObjectName(mat,theMaterials);
505  if( theMaterials.find( mateName ) != theMaterials.end() ) // alredy dumped
506  {
507  return mateName;
508  }
509 
510  size_t numElements = mat->GetNumberOfElements();
511  G4double density = mat->GetDensity()/g*cm3;
512 
513 
514  // start tag
515  //
516  if (numElements == 1)
517  {
518  (*theFile) << ":MATE " << AddQuotes(mateName) << " "
519  << mat->GetZ() << " " << mat->GetA()/(g/mole) << " "
520  << density << G4endl;
521  }
522  else
523  {
524  const G4ElementVector* elems = mat->GetElementVector();
525  const G4double* fractions = mat->GetFractionVector();
526  for (size_t ii = 0; ii < numElements; ii++)
527  {
528  DumpElement( (*elems)[ii] );
529  }
530 
531  (*theFile) << ":MIXT "<< AddQuotes(mateName) << " "
532  << density << " " << numElements << G4endl;
533  // close start element tag and get ready to do composit "parts"
534  for (size_t ii = 0; ii < numElements; ii++)
535  {
536  (*theFile) << " "
537  << AddQuotes(GetObjectName((*elems)[ii],theElements)) << " "
538  << fractions[ii] << G4endl;
539  }
540 
541  }
542 
543  (*theFile) << ":MATE_MEE " << AddQuotes(mateName) << " "
545  << "*eV" << G4endl;
546 
547  (*theFile) << ":MATE_TEMPERATURE " << AddQuotes(mateName) << " "
548  << mat->GetTemperature()/kelvin << "*kelvin" << G4endl;
549 
550  (*theFile) << ":MATE_PRESSURE " << AddQuotes(mateName) << " "
551  << mat->GetPressure()/atmosphere << "*atmosphere" << G4endl;
552 
553  G4State state = mat->GetState();
554  G4String stateStr;
555  switch (state) {
556  case kStateUndefined:
557  stateStr = "Undefined";
558  break;
559  case kStateSolid:
560  stateStr = "Solid";
561  break;
562  case kStateLiquid:
563  stateStr = "Liquid";
564  break;
565  case kStateGas:
566  stateStr = "Gas";
567  break;
568  }
569 
570  (*theFile) << ":MATE_STATE " << AddQuotes(mateName) << " "
571  << stateStr << G4endl;
572 
573  theMaterials[mateName] = mat;
574 
575  return mateName;
576 }
G4double GetZ() const
Definition: G4Material.cc:625
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:226
std::vector< G4Element * > G4ElementVector
G4State GetState() const
Definition: G4Material.hh:181
G4State
Definition: G4Material.hh:114
std::map< G4String, G4Material * > theMaterials
const G4double * GetFractionVector() const
Definition: G4Material.hh:194
G4double GetDensity() const
Definition: G4Material.hh:180
std::map< G4String, G4Element * > theElements
Float_t mat
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5206
G4String AddQuotes(const G4String &str)
G4double GetMeanExcitationEnergy() const
static const double cm3
Definition: G4SIunits.hh:120
G4double GetPressure() const
Definition: G4Material.hh:183
G4double GetA() const
Definition: G4Material.cc:638
G4double GetTemperature() const
Definition: G4Material.hh:182
static const double kelvin
Definition: G4SIunits.hh:278
static const double eV
Definition: G4SIunits.hh:212
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
static const double atmosphere
Definition: G4SIunits.hh:234
static const double mole
Definition: G4SIunits.hh:283
#define G4endl
Definition: G4ios.hh:61
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:190
double G4double
Definition: G4Types.hh:76
void DumpElement(G4Element *ele)
G4String GetObjectName(TYP *obj, std::map< G4String, TYP *> objectsDumped)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpPhysVol()

void G4tgbGeometryDumper::DumpPhysVol ( G4VPhysicalVolume pv)

Definition at line 141 of file G4tgbGeometryDumper.cc.

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

◆ DumpPolySections()

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

◆ DumpPVParameterised()

void G4tgbGeometryDumper::DumpPVParameterised ( G4PVParameterised pv)

Definition at line 269 of file G4tgbGeometryDumper.cc.

270 {
271  G4String pvName = pv->GetName();
272 
273  EAxis axis;
274  G4int nReplicas;
275  G4double width;
276  G4double offset;
277  G4bool consuming;
278  pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
279 
281 
282  G4LogicalVolume* lv = pv->GetLogicalVolume();
283  G4VSolid* solid1st = param->ComputeSolid(0, pv);
284  G4Material* mate1st = param->ComputeMaterial(0, pv );
285  std::vector<G4double> params1st = GetSolidParams( solid1st );
286  std::vector<G4double> newParams;
287  G4VSolid* newSolid = solid1st;
288  G4String lvName;
289 
290  for( G4int ii = 0; ii < nReplicas; ii++ )
291  {
292  G4Material* newMate = param->ComputeMaterial(ii, pv );
293  if( solid1st->GetEntityType() == "G4Box")
294  {
295  G4Box* box = (G4Box*)(solid1st);
296  param->ComputeDimensions(*box, ii, pv );
297  newParams = GetSolidParams( box );
298  newSolid = (G4VSolid*)box;
299  }
300  else if( solid1st->GetEntityType() == "G4Tubs")
301  {
302  G4Tubs* tubs = (G4Tubs*)(solid1st);
303  param->ComputeDimensions(*tubs, ii, pv );
304  newParams = GetSolidParams( tubs );
305  newSolid = (G4VSolid*)tubs;
306  }
307  else if( solid1st->GetEntityType() == "G4Trd")
308  {
309  G4Trd* trd = (G4Trd*)(solid1st);
310  param->ComputeDimensions(*trd, ii, pv );
311  newParams = GetSolidParams( trd );
312  newSolid = (G4VSolid*)trd;
313  }
314  else if( solid1st->GetEntityType() == "G4Trap")
315  {
316  G4Trap* trap = (G4Trap*)(solid1st);
317  param->ComputeDimensions(*trap, ii, pv );
318  newParams = GetSolidParams( trap );
319  newSolid = (G4VSolid*)trap;
320  }
321  else if( solid1st->GetEntityType() == "G4Cons")
322  {
323  G4Cons* cons = (G4Cons*)(solid1st);
324  param->ComputeDimensions(*cons, ii, pv );
325  newParams = GetSolidParams( cons );
326  newSolid = (G4VSolid*)cons;
327  }
328  else if( solid1st->GetEntityType() == "G4Sphere")
329  {
330  G4Sphere* sphere = (G4Sphere*)(solid1st);
331  param->ComputeDimensions(*sphere, ii, pv );
332  newParams = GetSolidParams( sphere );
333  newSolid = (G4VSolid*)sphere;
334  }
335  else if( solid1st->GetEntityType() == "G4Orb")
336  {
337  G4Orb* orb = (G4Orb*)(solid1st);
338  param->ComputeDimensions(*orb, ii, pv );
339  newParams = GetSolidParams( orb );
340  newSolid = (G4VSolid*)orb;
341  }
342  else if( solid1st->GetEntityType() == "G4Torus")
343  {
344  G4Torus* torus = (G4Torus*)(solid1st);
345  param->ComputeDimensions(*torus, ii, pv );
346  newParams = GetSolidParams( torus );
347  newSolid = (G4VSolid*)torus;
348  }
349  else if( solid1st->GetEntityType() == "G4Para")
350  {
351  G4Para* para = (G4Para*)(solid1st);
352  param->ComputeDimensions(*para, ii, pv );
353  newParams = GetSolidParams( para );
354  newSolid = (G4VSolid*)para;
355  }
356  else if( solid1st->GetEntityType() == "G4Polycone")
357  {
358  G4Polycone* polycone = (G4Polycone*)(solid1st);
359  param->ComputeDimensions(*polycone, ii, pv );
360  newParams = GetSolidParams( polycone );
361  newSolid = (G4VSolid*)polycone;
362  }
363  else if( solid1st->GetEntityType() == "G4Polyhedra")
364  {
365  G4Polyhedra* polyhedra = (G4Polyhedra*)(solid1st);
366  param->ComputeDimensions(*polyhedra, ii, pv );
367  newParams = GetSolidParams( polyhedra );
368  newSolid = (G4VSolid*)polyhedra;
369  }
370  else if( solid1st->GetEntityType() == "G4Hype")
371  {
372  G4Hype* hype = (G4Hype*)(solid1st);
373  param->ComputeDimensions(*hype, ii, pv );
374  newParams = GetSolidParams( hype );
375  newSolid = (G4VSolid*)hype;
376  }
377  if( ii == 0 || mate1st != newMate || params1st[0] != newParams[0] )
378  {
379  G4String extraName = "";
380  if( ii != 0 )
381  {
382  extraName= "#"+G4UIcommand::ConvertToString(ii)
383  +"/"+pv->GetMotherLogical()->GetName();
384  }
385  lvName = DumpLogVol( lv, extraName, newSolid, newMate );
386  }
387 
388  param->ComputeTransformation(ii, pv);
389  DumpPVPlacement( pv, lvName, ii );
390  }
391 }
Definition: G4Para.hh:77
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
G4VPVParameterisation * GetParameterisation() const
Definition: G4Box.hh:64
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
Definition: G4Tubs.hh:85
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
#define width
Definition: G4Trd.hh:72
virtual G4GeometryType GetEntityType() const =0
int G4int
Definition: G4Types.hh:78
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
const G4String & GetName() const
Definition: G4Hype.hh:67
bool G4bool
Definition: G4Types.hh:79
Definition: G4Cons.hh:83
Definition: G4Orb.hh:61
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
const G4String & GetName() const
std::vector< G4double > GetSolidParams(const G4VSolid *so)
EAxis
Definition: geomdefs.hh:54
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
G4LogicalVolume * GetMotherLogical() const
double G4double
Definition: G4Types.hh:76
G4LogicalVolume * GetLogicalVolume() const
G4String DumpLogVol(G4LogicalVolume *lv, G4String extraName="", G4VSolid *solid=0, G4Material *mate=0)
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpPVPlacement()

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

Definition at line 207 of file G4tgbGeometryDumper.cc.

209 {
210  G4String pvName = pv->GetName();
211 
212  G4RotationMatrix* rotMat = pv->GetRotation();
213  if( !rotMat ) rotMat = new G4RotationMatrix();
214 
215  //---- Check if it is reflected
217  G4LogicalVolume* lv = pv->GetLogicalVolume();
218  if( reffact->IsReflected( lv ) )
219  {
220 #ifdef G4VERBOSE
222  {
223  G4cout << " G4tgbGeometryDumper::DumpPVPlacement() - Reflected volume: "
224  << pv->GetName() << G4endl;
225  }
226 #endif
227  G4ThreeVector colx = rotMat->colX();
228  G4ThreeVector coly = rotMat->colY();
229  G4ThreeVector colz = rotMat->colZ();
230  // apply a Z reflection (reflection matrix is decomposed in new
231  // reflection-free rotation + z-reflection)
232  colz *= -1.;
233  G4Rep3x3 rottemp(colx.x(),coly.x(),colz.x(),
234  colx.y(),coly.y(),colz.y(),
235  colx.z(),coly.z(),colz.z());
236  // matrix representation (inverted)
237  *rotMat = G4RotationMatrix(rottemp);
238  *rotMat = (*rotMat).inverse();
239  pvName += "_refl";
240  }
241  G4String rotName = DumpRotationMatrix( rotMat );
243 
244  if( copyNo == -999 ) //for parameterisations copy number is provided
245  {
246  copyNo = pv->GetCopyNo();
247  }
248 
249  G4String fullname = pvName
250  +"#"+G4UIcommand::ConvertToString(copyNo)
251  +"/"+pv->GetMotherLogical()->GetName();
252 
253  if( !CheckIfPhysVolExists(fullname, pv ))
254  {
255  (*theFile)
256  << ":PLACE "
257  << SubstituteRefl(AddQuotes(lvName))
258  << " " << copyNo << " "
260  << " " << AddQuotes(rotName) << " "
261  << pos.x() << " " << pos.y() << " " << pos.z() << G4endl;
262 
263  thePhysVols[fullname] = pv;
264  }
265 }
const G4RotationMatrix * GetRotation() const
CLHEP::HepRotation G4RotationMatrix
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
Hep3Vector colZ() const
G4bool IsReflected(G4LogicalVolume *lv) const
static G4ReflectionFactory * Instance()
G4String AddQuotes(const G4String &str)
Hep3Vector colY() const
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
const G4String & GetName() const
G4bool CheckIfPhysVolExists(const G4String &name, G4VPhysicalVolume *)
double x() const
const G4String & GetName() const
G4String SubstituteRefl(G4String name)
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
std::map< G4String, G4VPhysicalVolume * > thePhysVols
double y() const
virtual G4int GetCopyNo() const =0
Hep3Vector colX() const
double z() const
G4LogicalVolume * GetMotherLogical() const
#define G4endl
Definition: G4ios.hh:61
G4LogicalVolume * GetLogicalVolume() const
const G4ThreeVector & GetTranslation() const
static const G4double pos
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpPVReplica()

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

Definition at line 395 of file G4tgbGeometryDumper.cc.

397 {
398  EAxis axis;
399  G4int nReplicas;
400  G4double width;
401  G4double offset;
402  G4bool consuming;
403  pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
404  G4String axisName;
405  switch (axis )
406  {
407  case kXAxis:
408  axisName = "X";
409  break;
410  case kYAxis:
411  axisName = "Y";
412  break;
413  case kZAxis:
414  axisName = "Z";
415  break;
416  case kRho:
417  axisName = "R";
418  break;
419  case kPhi:
420  axisName = "PHI";
421  break;
422  case kRadial3D:
423  case kUndefined:
424  G4String ErrMessage = "Unknown axis of replication for volume"
425  + pv->GetName();
426  G4Exception("G4tgbGeometryDumper::DumpPVReplica",
427  "Wrong axis ", FatalException, ErrMessage);
428  break;
429  }
430 
431  G4String fullname = lvName
432  +"/"+pv->GetMotherLogical()->GetName();
433 
434  if( !CheckIfPhysVolExists(fullname, pv ))
435  {
436  (*theFile)
437  << ":REPL "
438  << SubstituteRefl(AddQuotes(lvName))
439  << " " << SubstituteRefl(AddQuotes(pv->GetMotherLogical()->GetName()))
440  << " " << axisName
441  << " " << nReplicas;
442  if( axis != kPhi )
443  {
444  (*theFile)
445  << " " << width
446  << " " << offset << G4endl;
447  }
448  else
449  {
450  (*theFile)
451  << " " << width/deg << "*deg"
452  << " " << offset/deg << "*deg" << G4endl;
453  }
454 
455  thePhysVols[fullname] = pv;
456  }
457 }
Definition: geomdefs.hh:54
#define width
int G4int
Definition: G4Types.hh:78
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
Definition: G4PVReplica.cc:230
G4String AddQuotes(const G4String &str)
const G4String & GetName() const
static const double deg
Definition: G4SIunits.hh:151
bool G4bool
Definition: G4Types.hh:79
G4bool CheckIfPhysVolExists(const G4String &name, G4VPhysicalVolume *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetName() const
G4String SubstituteRefl(G4String name)
std::map< G4String, G4VPhysicalVolume * > thePhysVols
EAxis
Definition: geomdefs.hh:54
G4LogicalVolume * GetMotherLogical() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Definition: geomdefs.hh:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpRotationMatrix()

G4String G4tgbGeometryDumper::DumpRotationMatrix ( G4RotationMatrix rotm)

Definition at line 1008 of file G4tgbGeometryDumper.cc.

1009 {
1010  if (!rotm) { rotm = new G4RotationMatrix(); }
1011 
1012  G4double de = MatDeterminant(rotm);
1013  G4String rotName = LookForExistingRotation( rotm );
1014  if( rotName != "" ) { return rotName; }
1015 
1016  G4ThreeVector v(1.,1.,1.);
1017  if (de < -0.9 ) // a reflection ....
1018  {
1019  (*theFile) << ":ROTM ";
1020  rotName = "RRM";
1022 
1023  (*theFile) << AddQuotes(rotName) << std::setprecision(9) << " "
1024  << approxTo0(rotm->xx()) << " "
1025  << approxTo0(rotm->yx()) << " "
1026  << approxTo0(rotm->zx()) << " "
1027  << approxTo0(rotm->xy()) << " "
1028  << approxTo0(rotm->yy()) << " "
1029  << approxTo0(rotm->zy()) << " "
1030  << approxTo0(rotm->xz()) << " "
1031  << approxTo0(rotm->yz()) << " "
1032  << approxTo0(rotm->zz()) << G4endl;
1033  }
1034  else if(de > 0.9 ) // a rotation ....
1035  {
1036  (*theFile) << ":ROTM ";
1037  rotName = "RM";
1039 
1040  (*theFile) << AddQuotes(rotName) << " "
1041  << approxTo0(rotm->thetaX()/deg) << " "
1042  << approxTo0(rotm->phiX()/deg) << " "
1043  << approxTo0(rotm->thetaY()/deg) << " "
1044  << approxTo0(rotm->phiY()/deg) << " "
1045  << approxTo0(rotm->thetaZ()/deg) << " "
1046  << approxTo0(rotm->phiZ()/deg) << G4endl;
1047  }
1048 
1049  theRotMats[rotName] = rotm;
1050 
1051  return rotName;
1052 }
double phiX() const
Definition: Rotation.cc:129
double thetaX() const
Definition: Rotation.cc:141
CLHEP::HepRotation G4RotationMatrix
G4String LookForExistingRotation(const G4RotationMatrix *rotm)
double xy() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
G4String AddQuotes(const G4String &str)
double xz() const
double zz() const
static const double deg
Definition: G4SIunits.hh:151
double phiY() const
Definition: Rotation.cc:133
double yz() const
double yy() const
G4double approxTo0(G4double val)
double zx() const
double zy() const
G4double MatDeterminant(G4RotationMatrix *ro)
double thetaY() const
Definition: Rotation.cc:145
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
std::map< G4String, G4RotationMatrix * > theRotMats
double yx() const
double phiZ() const
Definition: Rotation.cc:137
double thetaZ() const
Definition: Rotation.cc:149
double xx() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpSolid()

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

Definition at line 645 of file G4tgbGeometryDumper.cc.

647 {
648  G4String solidName;
649  if( extraName == "" )
650  {
651  solidName = GetObjectName(solid,theSolids);
652  }
653  else
654  {
655  solidName = solid->GetName()+extraName;
656  }
657 
658  if( theSolids.find( solidName ) != theSolids.end() ) // alredy dumped
659  {
660  return solidName;
661  }
662 
663  G4String solidType = solid->GetEntityType();
664  solidType = GetTGSolidType( solidType );
665 
666  if (solidType == "UNIONSOLID")
667  {
668  DumpBooleanVolume( "UNION", solid );
669 
670  } else if (solidType == "SUBTRACTIONSOLID") {
671  DumpBooleanVolume( "SUBTRACTION", solid );
672 
673  } else if (solidType == "INTERSECTIONSOLID") {
674  DumpBooleanVolume( "INTERSECTION", solid );
675 
676  } else if (solidType == "REFLECTEDSOLID") {
677  G4ReflectedSolid* solidrefl = dynamic_cast<G4ReflectedSolid*>(solid);
678  if (!solidrefl)
679  {
680  G4Exception("G4tgbGeometryDumper::DumpSolid()",
681  "InvalidType", FatalException, "Invalid reflected solid!");
682  return solidName;
683  }
684  G4VSolid* solidori = solidrefl->GetConstituentMovedSolid();
685  DumpSolid( solidori );
686  }
687  else
688  {
689  (*theFile) << ":SOLID " << AddQuotes(solidName) << " ";
690  (*theFile) << AddQuotes(solidType) << " ";
691  DumpSolidParams( solid );
692  theSolids[solidName] = solid;
693  }
694 
695  return solidName;
696 }
void DumpSolidParams(G4VSolid *so)
virtual G4GeometryType GetEntityType() const =0
G4VSolid * GetConstituentMovedSolid() const
G4String GetName() const
std::map< G4String, G4VSolid * > theSolids
G4String AddQuotes(const G4String &str)
G4String GetTGSolidType(const G4String &solidtype)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void DumpBooleanVolume(const G4String &solidType, G4VSolid *so)
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
G4String GetObjectName(TYP *obj, std::map< G4String, TYP *> objectsDumped)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpSolidParams()

void G4tgbGeometryDumper::DumpSolidParams ( G4VSolid so)

Definition at line 751 of file G4tgbGeometryDumper.cc.

752 {
753  std::vector<G4double> params = GetSolidParams( so );
754  for( size_t ii = 0 ; ii < params.size(); ii++ )
755  {
756  (*theFile) << params[ii] << " " ;
757  }
758  (*theFile) << G4endl;
759 }
std::vector< G4double > GetSolidParams(const G4VSolid *so)
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindSolidName()

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

Definition at line 1355 of file G4tgbGeometryDumper.cc.

1356 {
1357  std::map<G4String,G4VSolid*>::const_iterator ite;
1358  for( ite = theSolids.begin(); ite != theSolids.end(); ite++ )
1359  {
1360  if( solid == (*ite).second ) { return (*ite).first; }
1361  }
1362 
1363  if( ite == theSolids.end() )
1364  {
1365  G4Exception("G4tgbGeometryDumper::FindSolidName()", "ReadError",
1366  FatalException, "Programming error.");
1367  }
1368  return (*ite).first;
1369 }
std::map< G4String, G4VSolid * > theSolids
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInstance()

G4tgbGeometryDumper * G4tgbGeometryDumper::GetInstance ( void  )
static

Definition at line 90 of file G4tgbGeometryDumper.cc.

91 {
92  if( theInstance == 0 ){
94  }
95 
96  return theInstance;
97 
98 }
static G4ThreadLocal G4tgbGeometryDumper * theInstance
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetIsotopeName()

G4String G4tgbGeometryDumper::GetIsotopeName ( G4Isotope isot)
private

Definition at line 1162 of file G4tgbGeometryDumper.cc.

1163 {
1164  G4String isotName = isot->GetName();
1165  // first look if this is isotope is already dumped,
1166  // with original isotope name or new one
1167  //
1168  std::map<G4String,G4Isotope*>::const_iterator ite;
1169  for( ite = theIsotopes.begin(); ite != theIsotopes.end(); ite++ )
1170  {
1171  if( isot == (*ite).second ) { return (*ite).first; }
1172  }
1173 
1174  // Now look if there is another isotope dumped with same name,
1175  // and if found add _N to the name
1176  //
1177  ite = theIsotopes.find( isotName );
1178  if( ite != theIsotopes.end() ) // Isotope found with same name
1179  {
1180  G4Isotope* isotold = (*ite).second;
1181  if( isot != isotold ) // new isotope it is not the really
1182  { // the same one as isotope found
1183  if( !Same2G4Isotopes(isot, isotold))
1184  { // if the two have same data, use the old one
1185  G4int ii = 2; // G4Nist does names isotopes of same element
1186  // with same name
1187  for(;;ii++)
1188  {
1189  G4String newIsotName = isotName + "_"
1191  std::map<G4String,G4Isotope*>::const_iterator ite2 =
1192  theIsotopes.find( newIsotName );
1193  if( ite2 == theIsotopes.end() )
1194  {
1195  isotName = newIsotName;
1196  break;
1197  }
1198  else
1199  {
1200  if( Same2G4Isotopes( isot, (*ite2).second ) )
1201  {
1202  isotName = newIsotName;
1203  break;
1204  }
1205  }
1206  }
1207  }
1208  }
1209  }
1210  return isotName;
1211 }
G4int first(char) const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
int G4int
Definition: G4Types.hh:78
G4bool Same2G4Isotopes(G4Isotope *ele1, G4Isotope *ele2)
std::map< G4String, G4Isotope * > theIsotopes
const G4String & GetName() const
Definition: G4Isotope.hh:88
Here is the call graph for this function:

◆ GetObjectName()

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

Definition at line 1216 of file G4tgbGeometryDumper.cc.

1217 {
1218  G4String objName = obj->GetName();
1219 
1220  // first look if this is objecy is already dumped,
1221  // with original object name or new one
1222  //
1223  typename std::map<G4String,TYP*>::const_iterator ite;
1224  for( ite = objectsDumped.begin(); ite != objectsDumped.end(); ite++ )
1225  {
1226  if( obj == (*ite).second ) { return (*ite).first; }
1227  }
1228 
1229  // Now look if there is another object dumped with same name,
1230  // and if found add _N to the name
1231  //
1232  ite = objectsDumped.find( objName );
1233 
1234  if( ite != objectsDumped.end() ) // Object found with same name
1235  {
1236  TYP* objold = (*ite).second;
1237  if( obj != objold ) // new object it is not the really
1238  { // the same one as object found
1239  G4int ii = 2;
1240  for(;;ii++)
1241  {
1242  G4String newObjName = objName + "_" + G4UIcommand::ConvertToString(ii);
1243  typename std::map<G4String,TYP*>::const_iterator ite2 =
1244  objectsDumped.find( newObjName );
1245  if( ite2 == objectsDumped.end() )
1246  {
1247  objName = newObjName;
1248  break;
1249  }
1250  }
1251  }
1252  }
1253  return objName;
1254 }
G4int first(char) const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
int G4int
Definition: G4Types.hh:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPVChildren()

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

Definition at line 1057 of file G4tgbGeometryDumper.cc.

1058 {
1060  G4PhysicalVolumeStore::const_iterator ite;
1061  std::vector<G4VPhysicalVolume*> children;
1062  for( ite = pvstore->begin(); ite != pvstore->end(); ite++ )
1063  {
1064  if( (*ite)->GetMotherLogical() == lv )
1065  {
1066  children.push_back( *ite );
1067 #ifdef G4VERBOSE
1068  if( G4tgrMessenger::GetVerboseLevel() >= 1 )
1069  {
1070  G4cout << " G4tgbGeometryDumper::GetPVChildren() - adding children: "
1071  << (*ite)->GetName() << " of " << lv->GetName() << G4endl;
1072  }
1073 #endif
1074  }
1075  }
1076 
1077  return children;
1078 }
static G4PhysicalVolumeStore * GetInstance()
G4GLOB_DLL std::ostream G4cout
static G4int GetVerboseLevel()
const G4String & GetName() const
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSolidParams()

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

Definition at line 763 of file G4tgbGeometryDumper.cc.

764 {
765  std::vector<G4double> params;
766 
767  G4String solidType = so->GetEntityType();
768  solidType = GetTGSolidType( solidType );
769 
770  if (solidType == "BOX") {
771  const G4Box * sb = dynamic_cast < const G4Box*>(so);
772  if (sb) {
773  params.push_back( sb->GetXHalfLength() );
774  params.push_back( sb->GetYHalfLength() );
775  params.push_back( sb->GetZHalfLength() );
776  }
777  } else if (solidType == "TUBS") {
778  const G4Tubs * tu = dynamic_cast < const G4Tubs * > (so);
779  if (tu) {
780  params.push_back( tu->GetInnerRadius() );
781  params.push_back( tu->GetOuterRadius() );
782  params.push_back( tu->GetZHalfLength() );
783  params.push_back( tu->GetStartPhiAngle()/deg );
784  params.push_back( tu->GetDeltaPhiAngle()/deg );
785  }
786  } else if (solidType == "TRAP") {
787  const G4Trap * trp = dynamic_cast < const G4Trap * > (so);
788  if (trp) {
789  G4ThreeVector symAxis(trp->GetSymAxis());
790  params.push_back( trp->GetZHalfLength() );
791  params.push_back( symAxis.theta()/deg);
792  params.push_back( symAxis.phi()/deg);
793  params.push_back( trp->GetYHalfLength1() );
794  params.push_back( trp->GetXHalfLength1() );
795  params.push_back( trp->GetXHalfLength2() );
796  params.push_back( std::atan(trp->GetTanAlpha1())/deg );
797  params.push_back( trp->GetYHalfLength2() );
798  params.push_back( trp->GetXHalfLength3() );
799  params.push_back( trp->GetXHalfLength4() );
800  params.push_back( std::atan(trp->GetTanAlpha2())/deg );
801  }
802  } else if (solidType == "TRD") {
803  const G4Trd * tr = dynamic_cast < const G4Trd * > (so);
804  if (tr) {
805  params.push_back( tr->GetXHalfLength1() );
806  params.push_back( tr->GetXHalfLength2() );
807  params.push_back( tr->GetYHalfLength1() );
808  params.push_back( tr->GetYHalfLength2() );
809  params.push_back( tr->GetZHalfLength());
810  }
811  } else if (solidType == "PARA") {
812  const G4Para * para = dynamic_cast < const G4Para * > (so);
813  if (para) {
814  G4ThreeVector symAxis(para->GetSymAxis());
815  params.push_back( para->GetXHalfLength());
816  params.push_back( para->GetYHalfLength());
817  params.push_back( para->GetZHalfLength());
818  params.push_back( std::atan(para->GetTanAlpha())/deg);
819  params.push_back( symAxis.theta()/deg);
820  params.push_back( symAxis.phi()/deg);
821  }
822  } else if (solidType == "CONS") {
823  const G4Cons * cn = dynamic_cast < const G4Cons * > (so);
824  if (cn) {
825  params.push_back( cn->GetInnerRadiusMinusZ() );
826  params.push_back( cn->GetOuterRadiusMinusZ() );
827  params.push_back( cn->GetInnerRadiusPlusZ() );
828  params.push_back( cn->GetOuterRadiusPlusZ() );
829  params.push_back( cn->GetZHalfLength() );
830  params.push_back( cn->GetStartPhiAngle()/deg );
831  params.push_back( cn->GetDeltaPhiAngle()/deg );
832  }
833  } else if (solidType == "SPHERE") {
834  const G4Sphere * sphere = dynamic_cast < const G4Sphere * > (so);
835  if (sphere) {
836  params.push_back( sphere->GetInnerRadius());
837  params.push_back( sphere->GetOuterRadius());
838  params.push_back( sphere->GetStartPhiAngle()/deg);
839  params.push_back( sphere->GetDeltaPhiAngle()/deg);
840  params.push_back( sphere->GetStartThetaAngle()/deg);
841  params.push_back( sphere->GetDeltaThetaAngle()/deg);
842  }
843  } else if (solidType == "ORB") {
844  const G4Orb * orb = dynamic_cast < const G4Orb * > (so);
845  if (orb) {
846  params.push_back( orb->GetRadius());
847  }
848  } else if (solidType == "TORUS") {
849  const G4Torus * torus = dynamic_cast < const G4Torus * > (so);
850  if (torus) {
851  params.push_back( torus->GetRmin());
852  params.push_back( torus->GetRmax());
853  params.push_back( torus->GetRtor());
854  params.push_back( torus->GetSPhi()/deg);
855  params.push_back( torus->GetDPhi()/deg);
856  }
857  } else if (solidType == "POLYCONE") {
858  //--- Dump RZ corners, as original parameters will not be present
859  // if it was build from RZ corners
860  const G4Polycone * plc = dynamic_cast < const G4Polycone * > (so);
861  if (plc) {
862  G4double angphi = plc->GetStartPhi()/deg;
863  if( angphi > 180*deg ) { angphi -= 360*deg; }
864  G4int ncor = plc->GetNumRZCorner();
865  params.push_back( angphi );
866  params.push_back( plc->GetOriginalParameters()->Opening_angle/deg );
867  params.push_back( ncor );
868 
869  for( G4int ii = 0; ii < ncor; ii++ )
870  {
871  params.push_back( plc->GetCorner(ii).r );
872  params.push_back( plc->GetCorner(ii).z );
873  }
874  }
875  } else if (solidType == "GENERICPOLYCONE") {
876  //--- Dump RZ corners
877  const G4GenericPolycone * plc =
878  dynamic_cast < const G4GenericPolycone * > (so);
879  if (plc) {
880  G4double angphi = plc->GetStartPhi()/deg;
881  if( angphi > 180*deg ) { angphi -= 360*deg; }
882  G4double endphi = plc->GetEndPhi()/deg;
883  if( endphi > 180*deg ) { endphi -= 360*deg; }
884  G4int ncor = plc->GetNumRZCorner();
885  params.push_back( angphi );
886  params.push_back( endphi-angphi );
887  params.push_back( ncor );
888 
889  for( G4int ii = 0; ii < ncor; ii++ )
890  {
891  params.push_back( plc->GetCorner(ii).r );
892  params.push_back( plc->GetCorner(ii).z );
893  }
894  }
895  } else if (solidType == "POLYHEDRA") {
896  //--- Dump RZ corners, as original parameters will not be present
897  // if it was build from RZ corners
898  const G4Polyhedra * ph = (dynamic_cast < const G4Polyhedra * > (so));
899  if (ph) {
900  G4double angphi = ph->GetStartPhi()/deg;
901  if( angphi > 180*deg ) angphi -= 360*deg;
902 
903  G4int ncor = ph->GetNumRZCorner();
904 
905  params.push_back( angphi );
906  params.push_back( ph->GetOriginalParameters()->Opening_angle/deg );
907  params.push_back( ph->GetNumSide() );
908  params.push_back( ncor );
909 
910  for( G4int ii = 0; ii < ncor; ii++ )
911  {
912  params.push_back( ph->GetCorner(ii).r );
913  params.push_back( ph->GetCorner(ii).z );
914  }
915  }
916  } else if (solidType == "ELLIPTICALTUBE") {
917  const G4EllipticalTube * eltu =
918  dynamic_cast < const G4EllipticalTube * > (so);
919  if (eltu) {
920  params.push_back( eltu->GetDx());
921  params.push_back( eltu->GetDy());
922  params.push_back( eltu->GetDz());
923  }
924  } else if (solidType == "ELLIPSOID" ){
925  const G4Ellipsoid* dso = dynamic_cast < const G4Ellipsoid * > (so);
926  if (dso) {
927  params.push_back( dso->GetSemiAxisMax(0) );
928  params.push_back( dso->GetSemiAxisMax(1) );
929  params.push_back( dso->GetSemiAxisMax(2) );
930  params.push_back( dso->GetZBottomCut() );
931  params.push_back( dso->GetZTopCut() );
932  }
933  } else if (solidType == "ELLIPTICAL_CONE") {
934  const G4EllipticalCone * elco =
935  dynamic_cast < const G4EllipticalCone * > (so);
936  if (elco) {
937  params.push_back( elco-> GetSemiAxisX() );
938  params.push_back( elco-> GetSemiAxisY() );
939  params.push_back( elco-> GetZMax() );
940  params.push_back( elco-> GetZTopCut() );
941  }
942  } else if (solidType == "HYPE") {
943  const G4Hype* hype = dynamic_cast < const G4Hype * > (so);
944  if (hype) {
945  params.push_back( hype->GetInnerRadius());
946  params.push_back( hype->GetOuterRadius());
947  params.push_back( hype->GetInnerStereo()/deg);
948  params.push_back( hype->GetOuterStereo()/deg);
949  params.push_back( 2*hype->GetZHalfLength());
950  }
951 // } else if( solidType == "TET" ) {
952 
953  } else if( solidType == "TWISTEDBOX" ) {
954  const G4TwistedBox* tbox = dynamic_cast < const G4TwistedBox * > (so);
955  if (tbox) {
956  params.push_back( tbox->GetPhiTwist()/deg );
957  params.push_back( tbox->GetXHalfLength() );
958  params.push_back( tbox->GetYHalfLength() );
959  params.push_back( tbox->GetZHalfLength() );
960  }
961  } else if( solidType == "TWISTEDTRAP" ) {
962  const G4TwistedTrap * ttrap = dynamic_cast < const G4TwistedTrap * > (so);
963  if (ttrap) {
964  params.push_back( ttrap->GetPhiTwist()/deg );
965  params.push_back( ttrap->GetZHalfLength() );
966  params.push_back( ttrap->GetPolarAngleTheta()/deg );
967  params.push_back( ttrap->GetAzimuthalAnglePhi()/deg );
968  params.push_back( ttrap->GetY1HalfLength() );
969  params.push_back( ttrap->GetX1HalfLength() );
970  params.push_back( ttrap->GetX2HalfLength() );
971  params.push_back( ttrap->GetY2HalfLength() );
972  params.push_back( ttrap->GetX3HalfLength() );
973  params.push_back( ttrap->GetX4HalfLength() );
974  params.push_back( ttrap->GetTiltAngleAlpha()/deg );
975  }
976  } else if( solidType == "TWISTEDTRD" ) {
977  const G4TwistedTrd * ttrd = dynamic_cast < const G4TwistedTrd * > (so);
978  if (ttrd) {
979  params.push_back( ttrd->GetX1HalfLength());
980  params.push_back( ttrd->GetX2HalfLength() );
981  params.push_back( ttrd->GetY1HalfLength() );
982  params.push_back( ttrd->GetY2HalfLength() );
983  params.push_back( ttrd->GetZHalfLength() );
984  params.push_back( ttrd->GetPhiTwist()/deg );
985  }
986  } else if( solidType == "TWISTEDTUBS" ) {
987  const G4TwistedTubs * ttub = dynamic_cast < const G4TwistedTubs * > (so);
988  if (ttub) {
989  params.push_back( ttub->GetInnerRadius() );
990  params.push_back( ttub->GetOuterRadius() );
991  params.push_back( ttub->GetZHalfLength() );
992  params.push_back( ttub->GetDPhi()/deg );
993  params.push_back( ttub->GetPhiTwist()/deg );
994  }
995  }
996  else
997  {
998  G4String ErrMessage = "Solid type not supported, sorry... " + solidType;
999  G4Exception("G4tgbGeometryDumpe::DumpSolidParams()",
1000  "NotImplemented", FatalException, ErrMessage);
1001  }
1002 
1003  return params;
1004 }
G4double GetPolarAngleTheta() const
G4double GetX2HalfLength() const
G4double GetXHalfLength1() const
Definition: G4Para.hh:77
G4double GetStartPhi() const
G4double GetOuterRadius() const
G4double GetSemiAxisMax(G4int i) const
G4int GetNumRZCorner() const
G4ThreeVector GetSymAxis() const
G4double GetZHalfLength() const
G4double GetOuterRadiusPlusZ() const
G4double GetStartPhiAngle() const
G4double GetZHalfLength() const
G4double GetDx() const
G4double GetDeltaPhiAngle() const
G4double GetStartThetaAngle() const
G4double GetY2HalfLength() const
G4double GetYHalfLength1() const
G4double GetX2HalfLength() const
Definition: G4TwistedTrd.hh:78
Definition: G4Box.hh:64
G4double GetStartPhi() const
G4double GetRmax() const
G4double GetInnerRadiusMinusZ() const
G4double GetXHalfLength() const
Definition: G4TwistedBox.hh:73
Definition: G4Tubs.hh:85
G4ThreeVector GetSymAxis() const
G4double GetXHalfLength3() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4double GetXHalfLength4() const
G4double GetRtor() const
G4double GetZBottomCut() const
Definition: G4Trd.hh:72
G4double GetStartPhi() const
virtual G4GeometryType GetEntityType() const =0
G4double GetYHalfLength2() const
G4int GetNumSide() const
G4double GetX1HalfLength() const
int G4int
Definition: G4Types.hh:78
G4double GetZHalfLength() const
G4double GetZHalfLength() const
G4double GetZHalfLength() const
G4double GetXHalfLength() const
G4double GetDz() const
G4double GetDPhi() const
G4double GetPhiTwist() const
G4double GetRmin() const
G4PolyhedraHistorical * GetOriginalParameters() const
G4double GetYHalfLength1() const
G4double GetXHalfLength2() const
G4double GetZHalfLength() const
static const double deg
Definition: G4SIunits.hh:151
Definition: G4Hype.hh:67
G4double GetYHalfLength() const
Definition: G4TwistedBox.hh:74
G4double GetRadius() const
G4double GetInnerRadius() const
G4double GetTanAlpha() const
G4double GetY1HalfLength() const
G4double GetZHalfLength() const
G4double GetInnerStereo() const
G4double GetTiltAngleAlpha() const
G4double GetPhiTwist() const
Definition: G4TwistedBox.hh:76
G4String GetTGSolidType(const G4String &solidtype)
Definition: G4Cons.hh:83
G4double GetDPhi() const
G4double GetY2HalfLength() const
Definition: G4TwistedTrd.hh:80
G4double GetPhiTwist() const
G4double GetOuterRadius() const
G4double GetXHalfLength() const
G4double GetXHalfLength2() const
G4PolyconeHistorical * GetOriginalParameters() const
Definition: G4Orb.hh:61
G4double GetInnerRadiusPlusZ() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double GetZHalfLength() const
Definition: G4TwistedTrd.hh:81
G4double GetStartPhiAngle() const
G4double GetYHalfLength() const
G4double GetOuterStereo() const
G4double GetInnerRadius() const
G4double GetOuterRadius() const
G4double GetDeltaPhiAngle() const
G4double GetZHalfLength() const
Definition: G4TwistedBox.hh:75
G4PolyhedraSideRZ GetCorner(const G4int index) const
G4double GetOuterRadiusMinusZ() const
G4double GetXHalfLength1() const
G4double GetX3HalfLength() const
G4double GetTanAlpha2() const
G4double GetDeltaThetaAngle() const
G4double GetX1HalfLength() const
Definition: G4TwistedTrd.hh:77
G4int GetNumRZCorner() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4double GetX4HalfLength() const
G4double GetInnerRadius() const
G4double GetYHalfLength() const
G4double GetY1HalfLength() const
Definition: G4TwistedTrd.hh:79
G4double GetInnerRadius() const
G4double GetStartPhiAngle() const
G4double GetZTopCut() const
G4double GetYHalfLength2() const
double G4double
Definition: G4Types.hh:76
G4double GetZHalfLength() const
G4double GetSPhi() const
G4double GetDy() const
G4double GetAzimuthalAnglePhi() const
G4double GetZHalfLength() const
G4double GetDeltaPhiAngle() const
G4double GetTanAlpha1() const
G4double GetPhiTwist() const
Definition: G4TwistedTrd.hh:82
G4int GetNumRZCorner() const
G4double GetOuterRadius() const
G4double GetEndPhi() const
Here is the caller graph for this function:

◆ GetTGSolidType()

G4String G4tgbGeometryDumper::GetTGSolidType ( const G4String solidtype)
private

Definition at line 1082 of file G4tgbGeometryDumper.cc.

1083 {
1084  G4String newsolidType = solidType.substr(2,solidType.length() );
1085  for( size_t ii = 0; ii < newsolidType.length(); ii++ )
1086  {
1087  newsolidType[ii] = toupper(newsolidType[ii] );
1088  }
1089  return newsolidType;
1090 }
Here is the caller graph for this function:

◆ GetTopPhysVol()

G4VPhysicalVolume * G4tgbGeometryDumper::GetTopPhysVol ( )

Definition at line 110 of file G4tgbGeometryDumper.cc.

111 {
113  G4PhysicalVolumeStore::const_iterator ite;
114  G4VPhysicalVolume* pv = *(pvstore->begin());
115  for( ;; )
116  {
117  G4LogicalVolume* lv = pv->GetMotherLogical();
118  if( lv == 0 ) { break; }
119 
120  //----- look for one PV of this LV
121  for( ite = pvstore->begin(); ite != pvstore->end(); ite++ )
122  {
123  pv = (*ite);
124  if( pv->GetLogicalVolume() == lv )
125  {
126  break;
127  }
128  }
129  }
130 
131  return pv;
132 }
static G4PhysicalVolumeStore * GetInstance()
G4LogicalVolume * GetMotherLogical() const
G4LogicalVolume * GetLogicalVolume() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LookForExistingRotation()

G4String G4tgbGeometryDumper::LookForExistingRotation ( const G4RotationMatrix rotm)
private

Definition at line 1320 of file G4tgbGeometryDumper.cc.

1321 {
1322  G4String rmName = "";
1323 
1324  std::map<G4String,G4RotationMatrix*>::const_iterator ite;
1325  for( ite = theRotMats.begin(); ite != theRotMats.end(); ite++ )
1326  {
1327  if( (*ite).second->isNear( *rotm ) )
1328  {
1329  rmName = (*ite).first;
1330  break;
1331  }
1332  }
1333  return rmName;
1334 }
G4int first(char) const
std::map< G4String, G4RotationMatrix * > theRotMats
Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatDeterminant()

G4double G4tgbGeometryDumper::MatDeterminant ( G4RotationMatrix ro)
private

Definition at line 1094 of file G4tgbGeometryDumper.cc.

1095 {
1096  G4Rep3x3 r = ro->rep3x3();
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_);
1100 }
HepRep3x3 rep3x3() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Same2G4Isotopes()

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

Definition at line 1339 of file G4tgbGeometryDumper.cc.

1340 {
1341  if ( (isot1->GetZ() != isot2->GetZ())
1342  || (isot1->GetN() != isot2->GetN())
1343  || (isot1->GetA() != isot2->GetA()) )
1344  {
1345  return 0;
1346  }
1347  else
1348  {
1349  return 1;
1350  }
1351 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SubstituteRefl()

G4String G4tgbGeometryDumper::SubstituteRefl ( G4String  name)
private

Definition at line 1150 of file G4tgbGeometryDumper.cc.

1151 {
1152  G4int irefl = name.rfind("_refl");
1153  if( irefl != -1 )
1154  {
1155  name = name.substr( 0, irefl ) + "_REFL";
1156  }
1157  return name;
1158 }
G4String name
Definition: TRTMaterials.hh:40
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

◆ SupressRefl()

G4String G4tgbGeometryDumper::SupressRefl ( G4String  name)
private

Definition at line 1139 of file G4tgbGeometryDumper.cc.

1140 {
1141  G4int irefl = name.rfind("_refl");
1142  if( irefl != -1 )
1143  {
1144  name = name.substr( 0, irefl );
1145  }
1146  return name;
1147 }
G4String name
Definition: TRTMaterials.hh:40
int G4int
Definition: G4Types.hh:78
Here is the caller graph for this function:

Member Data Documentation

◆ theElements

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

Definition at line 114 of file G4tgbGeometryDumper.hh.

◆ theFile

std::ofstream* G4tgbGeometryDumper::theFile
private

Definition at line 111 of file G4tgbGeometryDumper.hh.

◆ theInstance

G4ThreadLocal G4tgbGeometryDumper * G4tgbGeometryDumper::theInstance = 0
staticprivate

Definition at line 109 of file G4tgbGeometryDumper.hh.

◆ theIsotopes

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

Definition at line 115 of file G4tgbGeometryDumper.hh.

◆ theLogVols

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

Definition at line 117 of file G4tgbGeometryDumper.hh.

◆ theMaterials

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

Definition at line 113 of file G4tgbGeometryDumper.hh.

◆ thePhysVols

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

Definition at line 118 of file G4tgbGeometryDumper.hh.

◆ theRotationNumber

G4int G4tgbGeometryDumper::theRotationNumber
private

Definition at line 121 of file G4tgbGeometryDumper.hh.

◆ theRotMats

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

Definition at line 119 of file G4tgbGeometryDumper.hh.

◆ theSolids

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

Definition at line 116 of file G4tgbGeometryDumper.hh.


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