Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4tgbGeometryDumper Class Reference

#include <G4tgbGeometryDumper.hh>

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 ()
 

Detailed Description

Definition at line 56 of file G4tgbGeometryDumper.hh.

Constructor & Destructor Documentation

G4tgbGeometryDumper::~G4tgbGeometryDumper ( )

Definition at line 136 of file G4tgbGeometryDumper.cc.

137 {
138 }

Member Function Documentation

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

Definition at line 700 of file G4tgbGeometryDumper.cc.

References DumpRotationMatrix(), DumpSolid(), G4endl, G4DisplacedSolid::GetConstituentMovedSolid(), G4BooleanSolid::GetConstituentSolid(), G4DisplacedSolid::GetObjectTranslation(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by DumpSolid().

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
double x() const
CLHEP::HepRotation G4RotationMatrix
G4ThreeVector GetObjectTranslation() const
double z() const
bool G4bool
Definition: G4Types.hh:79
virtual const G4VSolid * GetConstituentSolid(G4int no) const
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
G4VSolid * GetConstituentMovedSolid() const
double y() const
#define G4endl
Definition: G4ios.hh:61
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
void G4tgbGeometryDumper::DumpElement ( G4Element ele)

Definition at line 580 of file G4tgbGeometryDumper.cc.

References DumpIsotope(), g(), G4endl, G4Element::GetA(), G4Element::GetIsotopeVector(), G4Element::GetNumberOfIsotopes(), G4Element::GetRelativeAbundanceVector(), G4Element::GetSymbol(), G4Element::GetZ(), python.hepunit::mole, and symbol.

Referenced by DumpMaterial().

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 }
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
G4String symbol
Definition: TRTMaterials.hh:40
std::vector< G4Isotope * > G4IsotopeVector
void DumpIsotope(G4Isotope *ele)
const G4String & GetSymbol() const
Definition: G4Element.hh:128
G4double GetZ() const
Definition: G4Element.hh:131
G4double GetA() const
Definition: G4Element.hh:138
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4tgbGeometryDumper::DumpGeometry ( const G4String fname)

Definition at line 101 of file G4tgbGeometryDumper.cc.

References DumpPhysVol(), and GetTopPhysVol().

Referenced by ExTGRunAction::BeginOfRunAction().

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()
void G4tgbGeometryDumper::DumpIsotope ( G4Isotope ele)

Definition at line 628 of file G4tgbGeometryDumper.cc.

References g(), G4endl, G4Isotope::GetA(), G4Isotope::GetN(), G4Isotope::GetZ(), and python.hepunit::mole.

Referenced by DumpElement().

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:5205
#define G4endl
Definition: G4ios.hh:61
G4String G4tgbGeometryDumper::DumpLogVol ( G4LogicalVolume lv,
G4String  extraName = "",
G4VSolid solid = 0,
G4Material mate = 0 
)

Definition at line 462 of file G4tgbGeometryDumper.cc.

References DumpMaterial(), DumpSolid(), G4endl, G4LogicalVolume::GetMaterial(), G4LogicalVolume::GetName(), and G4LogicalVolume::GetSolid().

Referenced by DumpPhysVol(), and DumpPVParameterised().

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 GetName() const
G4String DumpMaterial(G4Material *mat)
G4Material * GetMaterial() const
#define G4endl
Definition: G4ios.hh:61
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
G4VSolid * GetSolid() const
G4String G4tgbGeometryDumper::DumpMaterial ( G4Material mat)

Definition at line 502 of file G4tgbGeometryDumper.cc.

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

Referenced by DumpLogVol().

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 GetPressure() const
Definition: G4Material.hh:181
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:224
G4double GetZ() const
Definition: G4Material.cc:606
std::vector< G4Element * > G4ElementVector
G4State
Definition: G4Material.hh:114
G4double GetDensity() const
Definition: G4Material.hh:178
int atmosphere
Definition: hepunit.py:151
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4double GetA() const
Definition: G4Material.cc:619
G4double GetMeanExcitationEnergy() const
G4double GetTemperature() const
Definition: G4Material.hh:180
#define G4endl
Definition: G4ios.hh:61
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
G4State GetState() const
Definition: G4Material.hh:179
double G4double
Definition: G4Types.hh:76
const G4double * GetFractionVector() const
Definition: G4Material.hh:192
void DumpElement(G4Element *ele)
void G4tgbGeometryDumper::DumpPhysVol ( G4VPhysicalVolume pv)

Definition at line 141 of file G4tgbGeometryDumper.cc.

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

Referenced by DumpGeometry().

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 }
G4String GetName() const
virtual G4bool IsReplicated() const =0
G4bool IsReflected(G4LogicalVolume *lv) const
static G4ReflectionFactory * Instance()
void DumpPVReplica(G4PVReplica *pv, const G4String &lvName)
void DumpPhysVol(G4VPhysicalVolume *pv)
bool G4bool
Definition: G4Types.hh:79
G4LogicalVolume * GetMotherLogical() const
virtual G4bool IsParameterised() const =0
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
G4LogicalVolume * GetLogicalVolume() const
void DumpPVParameterised(G4PVParameterised *pv)
G4String DumpLogVol(G4LogicalVolume *lv, G4String extraName="", G4VSolid *solid=0, G4Material *mate=0)
void G4tgbGeometryDumper::DumpPolySections ( G4int  zPlanes,
G4double z,
G4double rmin,
G4double rmax 
)
void G4tgbGeometryDumper::DumpPVParameterised ( G4PVParameterised pv)

Definition at line 269 of file G4tgbGeometryDumper.cc.

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

Referenced by DumpPhysVol().

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:76
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
G4String GetName() const
Definition: G4Box.hh:63
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
Definition: G4Tubs.hh:84
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
#define width
Definition: G4Trd.hh:71
virtual G4GeometryType GetEntityType() const =0
int G4int
Definition: G4Types.hh:78
G4VPVParameterisation * GetParameterisation() const
const G4String & GetName() const
Definition: G4Hype.hh:66
bool G4bool
Definition: G4Types.hh:79
Definition: G4Cons.hh:82
G4LogicalVolume * GetMotherLogical() const
Definition: G4Orb.hh:60
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
G4LogicalVolume * GetLogicalVolume() const
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
std::vector< G4double > GetSolidParams(const G4VSolid *so)
EAxis
Definition: geomdefs.hh:54
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
double G4double
Definition: G4Types.hh:76
G4String DumpLogVol(G4LogicalVolume *lv, G4String extraName="", G4VSolid *solid=0, G4Material *mate=0)
void G4tgbGeometryDumper::DumpPVPlacement ( G4VPhysicalVolume pv,
const G4String lvName,
G4int  copyNo = -999 
)

Definition at line 207 of file G4tgbGeometryDumper.cc.

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

Referenced by DumpPhysVol(), and DumpPVParameterised().

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 << " "
259  << SubstituteRefl(AddQuotes(pv->GetMotherLogical()->GetName()))
260  << " " << AddQuotes(rotName) << " "
261  << pos.x() << " " << pos.y() << " " << pos.z() << G4endl;
262 
263  thePhysVols[fullname] = pv;
264  }
265 }
const G4ThreeVector & GetTranslation() const
G4String GetName() const
double x() const
CLHEP::HepRotation G4RotationMatrix
Hep3Vector colX() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
G4bool IsReflected(G4LogicalVolume *lv) const
double z() const
static G4ReflectionFactory * Instance()
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
static G4int GetVerboseLevel()
G4LogicalVolume * GetMotherLogical() const
Hep3Vector colZ() const
Hep3Vector colY() const
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
G4LogicalVolume * GetLogicalVolume() const
virtual G4int GetCopyNo() const =0
double y() const
const G4RotationMatrix * GetRotation() const
#define G4endl
Definition: G4ios.hh:61
void G4tgbGeometryDumper::DumpPVReplica ( G4PVReplica pv,
const G4String lvName 
)

Definition at line 395 of file G4tgbGeometryDumper.cc.

References python.hepunit::deg, FatalException, G4endl, G4Exception(), G4VPhysicalVolume::GetMotherLogical(), G4VPhysicalVolume::GetName(), G4LogicalVolume::GetName(), G4PVReplica::GetReplicationData(), kPhi, kRadial3D, kRho, kUndefined, kXAxis, kYAxis, kZAxis, and width.

Referenced by DumpPhysVol().

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
G4String GetName() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
Definition: G4PVReplica.cc:236
#define width
int G4int
Definition: G4Types.hh:78
const G4String & GetName() const
bool G4bool
Definition: G4Types.hh:79
G4LogicalVolume * GetMotherLogical() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
EAxis
Definition: geomdefs.hh:54
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Definition: geomdefs.hh:54
G4String G4tgbGeometryDumper::DumpRotationMatrix ( G4RotationMatrix rotm)

Definition at line 1012 of file G4tgbGeometryDumper.cc.

References G4UIcommand::ConvertToString(), python.hepunit::deg, G4endl, CLHEP::HepRotation::phiX(), CLHEP::HepRotation::phiY(), CLHEP::HepRotation::phiZ(), CLHEP::HepRotation::thetaX(), CLHEP::HepRotation::thetaY(), CLHEP::HepRotation::thetaZ(), test::v, 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(), and DumpPVPlacement().

1013 {
1014  if (!rotm) { rotm = new G4RotationMatrix(); }
1015 
1016  G4double de = MatDeterminant(rotm);
1017  G4String rotName = LookForExistingRotation( rotm );
1018  if( rotName != "" ) { return rotName; }
1019 
1020  G4ThreeVector v(1.,1.,1.);
1021  if (de < -0.9 ) // a reflection ....
1022  {
1023  (*theFile) << ":ROTM ";
1024  rotName = "RRM";
1025  rotName += G4UIcommand::ConvertToString(theRotationNumber++);
1026 
1027  (*theFile) << AddQuotes(rotName) << std::setprecision(9) << " "
1028  << approxTo0(rotm->xx()) << " "
1029  << approxTo0(rotm->yx()) << " "
1030  << approxTo0(rotm->zx()) << " "
1031  << approxTo0(rotm->xy()) << " "
1032  << approxTo0(rotm->yy()) << " "
1033  << approxTo0(rotm->zy()) << " "
1034  << approxTo0(rotm->xz()) << " "
1035  << approxTo0(rotm->yz()) << " "
1036  << approxTo0(rotm->zz()) << G4endl;
1037  }
1038  else if(de > 0.9 ) // a rotation ....
1039  {
1040  (*theFile) << ":ROTM ";
1041  rotName = "RM";
1042  rotName += G4UIcommand::ConvertToString(theRotationNumber++);
1043 
1044  (*theFile) << AddQuotes(rotName) << " "
1045  << approxTo0(rotm->thetaX()/deg) << " "
1046  << approxTo0(rotm->phiX()/deg) << " "
1047  << approxTo0(rotm->thetaY()/deg) << " "
1048  << approxTo0(rotm->phiY()/deg) << " "
1049  << approxTo0(rotm->thetaZ()/deg) << " "
1050  << approxTo0(rotm->phiZ()/deg) << G4endl;
1051  }
1052 
1053  theRotMats[rotName] = rotm;
1054 
1055  return rotName;
1056 }
double xx() const
double thetaX() const
Definition: Rotation.cc:141
CLHEP::HepRotation G4RotationMatrix
double yy() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
double xz() const
double zx() const
double phiY() const
Definition: Rotation.cc:133
double yz() const
double phiX() const
Definition: Rotation.cc:129
double thetaY() const
Definition: Rotation.cc:145
double thetaZ() const
Definition: Rotation.cc:149
double phiZ() const
Definition: Rotation.cc:137
double zy() const
#define G4endl
Definition: G4ios.hh:61
double yx() const
double G4double
Definition: G4Types.hh:76
double zz() const
double xy() const
G4String G4tgbGeometryDumper::DumpSolid ( G4VSolid solid,
const G4String extraName = "" 
)

Definition at line 645 of file G4tgbGeometryDumper.cc.

References DumpBooleanVolume(), DumpSolidParams(), FatalException, G4Exception(), G4ReflectedSolid::GetConstituentMovedSolid(), G4VSolid::GetEntityType(), and G4VSolid::GetName().

Referenced by DumpBooleanVolume(), and DumpLogVol().

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 }
G4String GetName() const
void DumpSolidParams(G4VSolid *so)
virtual G4GeometryType GetEntityType() const =0
G4VSolid * GetConstituentMovedSolid() const
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="")
void G4tgbGeometryDumper::DumpSolidParams ( G4VSolid so)

Definition at line 751 of file G4tgbGeometryDumper.cc.

References G4endl, and GetSolidParams().

Referenced by DumpSolid().

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
G4tgbGeometryDumper * G4tgbGeometryDumper::GetInstance ( void  )
static

Definition at line 90 of file G4tgbGeometryDumper.cc.

Referenced by ExTGRunAction::BeginOfRunAction().

91 {
92  if( theInstance == 0 ){
93  theInstance = new G4tgbGeometryDumper;
94  }
95 
96  return theInstance;
97 
98 }
std::vector< G4double > G4tgbGeometryDumper::GetSolidParams ( const G4VSolid so)

Definition at line 763 of file G4tgbGeometryDumper.cc.

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

Referenced by DumpPVParameterised(), and DumpSolidParams().

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

Definition at line 110 of file G4tgbGeometryDumper.cc.

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

Referenced by DumpGeometry().

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

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