Geant4_10
G4tgbGeometryDumper.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4tgbGeometryDumper.cc 77346 2013-11-22 16:01:16Z gcosmo $
28 // GEANT4 tag $Name: $
29 //
30 //
31 // class G4tgbGeometryDumper
32 
33 // History:
34 // - Created. P.Arce, CIEMAT (November 2007)
35 // -------------------------------------------------------------------------
36 
37 #include "G4tgbGeometryDumper.hh"
38 
39 #include "G4tgrMessenger.hh"
40 
41 #include "G4SystemOfUnits.hh"
42 #include "G4UIcommand.hh"
43 #include "G4Material.hh"
44 #include "G4Element.hh"
45 #include "G4VSolid.hh"
46 #include "G4Box.hh"
47 #include "G4Tubs.hh"
48 #include "G4Cons.hh"
49 #include "G4Trap.hh"
50 #include "G4Sphere.hh"
51 #include "G4Orb.hh"
52 #include "G4Trd.hh"
53 #include "G4Para.hh"
54 #include "G4Torus.hh"
55 #include "G4Hype.hh"
56 #include "G4Polycone.hh"
57 #include "G4GenericPolycone.hh"
58 #include "G4Polyhedra.hh"
59 #include "G4EllipticalTube.hh"
60 #include "G4Ellipsoid.hh"
61 #include "G4EllipticalCone.hh"
62 #include "G4Hype.hh"
63 #include "G4Tet.hh"
64 #include "G4TwistedBox.hh"
65 #include "G4TwistedTrap.hh"
66 #include "G4TwistedTrd.hh"
67 #include "G4TwistedTubs.hh"
68 #include "G4PVPlacement.hh"
69 #include "G4PVParameterised.hh"
70 #include "G4PVReplica.hh"
71 #include "G4BooleanSolid.hh"
72 #include "G4ReflectionFactory.hh"
73 #include "G4ReflectedSolid.hh"
74 #include "G4LogicalVolumeStore.hh"
75 #include "G4PhysicalVolumeStore.hh"
76 #include "G4GeometryTolerance.hh"
77 #include "G4VPVParameterisation.hh"
78 #include <iomanip>
79 
80 //------------------------------------------------------------------------
81 G4ThreadLocal G4tgbGeometryDumper* G4tgbGeometryDumper::theInstance = 0;
82 
83 //------------------------------------------------------------------------
84 G4tgbGeometryDumper::G4tgbGeometryDumper()
85  : theFile(0), theRotationNumber(0)
86 {
87 }
88 
89 //------------------------------------------------------------------------
91 {
92  if( theInstance == 0 ){
93  theInstance = new G4tgbGeometryDumper;
94  }
95 
96  return theInstance;
97 
98 }
99 
100 //------------------------------------------------------------------------
102 {
103  theFile = new std::ofstream(fname);
104 
106  DumpPhysVol( pv ); // dump volume and recursively it will dump all hierarchy
107 }
108 
109 //---------------------------------------------------------------------
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 }
133 
134 
135 //------------------------------------------------------------------------
137 {
138 }
139 
140 //------------------------------------------------------------------------
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 }
204 
205 //------------------------------------------------------------------------
206 void
208  const G4String& lvName, G4int copyNo )
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 );
242  G4ThreeVector pos = pv->GetTranslation();
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 }
266 
267 
268 //------------------------------------------------------------------------
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 }
392 
393 
394 //------------------------------------------------------------------------
396  const G4String& lvName )
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 }
458 
459 
460 //------------------------------------------------------------------------
461 G4String
463  G4VSolid* solid, G4Material* mate )
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 }
499 
500 
501 //------------------------------------------------------------------------
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 }
577 
578 
579 //------------------------------------------------------------------------
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 }
625 
626 
627 //------------------------------------------------------------------------
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 }
642 
643 
644 //------------------------------------------------------------------------
646  const G4String& extraName )
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 }
697 
698 
699 //------------------------------------------------------------------------
701  G4VSolid* so )
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;
718  G4ThreeVector pos;
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 }
748 
749 
750 //------------------------------------------------------------------------
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 }
760 
761 
762 //------------------------------------------------------------------------
763 std::vector<G4double> G4tgbGeometryDumper::GetSolidParams( const G4VSolid * so)
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 }
1009 
1010 
1011 //------------------------------------------------------------------------
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 }
1057 
1058 
1059 //------------------------------------------------------------------------
1060 std::vector<G4VPhysicalVolume*>
1061 G4tgbGeometryDumper::GetPVChildren( G4LogicalVolume* lv )
1062 {
1064  G4PhysicalVolumeStore::const_iterator ite;
1065  std::vector<G4VPhysicalVolume*> children;
1066  for( ite = pvstore->begin(); ite != pvstore->end(); ite++ )
1067  {
1068  if( (*ite)->GetMotherLogical() == lv )
1069  {
1070  children.push_back( *ite );
1071 #ifdef G4VERBOSE
1072  if( G4tgrMessenger::GetVerboseLevel() >= 1 )
1073  {
1074  G4cout << " G4tgbGeometryDumper::GetPVChildren() - adding children: "
1075  << (*ite)->GetName() << " of " << lv->GetName() << G4endl;
1076  }
1077 #endif
1078  }
1079  }
1080 
1081  return children;
1082 }
1083 
1084 
1085 //------------------------------------------------------------------------
1086 G4String G4tgbGeometryDumper::GetTGSolidType( const G4String& solidType )
1087 {
1088  G4String newsolidType = solidType.substr(2,solidType.length() );
1089  for( size_t ii = 0; ii < newsolidType.length(); ii++ )
1090  {
1091  newsolidType[ii] = toupper(newsolidType[ii] );
1092  }
1093  return newsolidType;
1094 }
1095 
1096 
1097 //------------------------------------------------------------------------
1098 G4double G4tgbGeometryDumper::MatDeterminant(G4RotationMatrix * ro)
1099 {
1100  G4Rep3x3 r = ro->rep3x3();
1101  return r.xx_*(r.yy_*r.zz_ - r.zy_*r.yz_)
1102  - r.yx_*(r.xy_*r.zz_ - r.zy_*r.xz_)
1103  + r.zx_*(r.xy_*r.yz_ - r.yy_*r.xz_);
1104 }
1105 
1106 
1107 //-----------------------------------------------------------------------
1108 G4double G4tgbGeometryDumper::approxTo0( G4double val )
1109 {
1111  ->GetSurfaceTolerance();
1112 
1113  if( std::fabs(val) < precision ) { val = 0; }
1114  return val;
1115 }
1116 
1117 
1118 //-----------------------------------------------------------------------
1119 G4String G4tgbGeometryDumper::AddQuotes( const G4String& str )
1120 {
1121  //--- look if there is a separating blank
1122 
1123  G4bool bBlank = FALSE;
1124  size_t siz = str.length();
1125  for( size_t ii = 0; ii < siz; ii++ )
1126  {
1127  if( str.substr(ii,1) == " " )
1128  {
1129  bBlank = TRUE;
1130  break;
1131  }
1132  }
1133  G4String str2 = str;
1134  if( bBlank )
1135  {
1136  str2 = G4String("\"") + str2 + G4String("\"");
1137  }
1138  return str2;
1139 }
1140 
1141 
1142 //------------------------------------------------------------------------
1143 G4String G4tgbGeometryDumper::SupressRefl( G4String name )
1144 {
1145  G4int irefl = name.rfind("_refl");
1146  if( irefl != -1 )
1147  {
1148  name = name.substr( 0, irefl );
1149  }
1150  return name;
1151 }
1152 
1153 //------------------------------------------------------------------------
1154 G4String G4tgbGeometryDumper::SubstituteRefl( G4String name )
1155 {
1156  G4int irefl = name.rfind("_refl");
1157  if( irefl != -1 )
1158  {
1159  name = name.substr( 0, irefl ) + "_REFL";
1160  }
1161  return name;
1162 }
1163 
1164 
1165 //------------------------------------------------------------------------
1166 G4String G4tgbGeometryDumper::GetIsotopeName( G4Isotope* isot )
1167 {
1168  G4String isotName = isot->GetName();
1169  // first look if this is isotope is already dumped,
1170  // with original isotope name or new one
1171  //
1172  std::map<G4String,G4Isotope*>::const_iterator ite;
1173  for( ite = theIsotopes.begin(); ite != theIsotopes.end(); ite++ )
1174  {
1175  if( isot == (*ite).second ) { return (*ite).first; }
1176  }
1177 
1178  // Now look if there is another isotope dumped with same name,
1179  // and if found add _N to the name
1180  //
1181  ite = theIsotopes.find( isotName );
1182  if( ite != theIsotopes.end() ) // Isotope found with same name
1183  {
1184  G4Isotope* isotold = (*ite).second;
1185  if( isot != isotold ) // new isotope it is not the really
1186  { // the same one as isotope found
1187  if( !Same2G4Isotopes(isot, isotold))
1188  { // if the two have same data, use the old one
1189  G4int ii = 2; // G4Nist does names isotopes of same element
1190  // with same name
1191  for(;;ii++)
1192  {
1193  G4String newIsotName = isotName + "_"
1195  std::map<G4String,G4Isotope*>::const_iterator ite2 =
1196  theIsotopes.find( newIsotName );
1197  if( ite2 == theIsotopes.end() )
1198  {
1199  isotName = newIsotName;
1200  break;
1201  }
1202  else
1203  {
1204  if( Same2G4Isotopes( isot, (*ite2).second ) )
1205  {
1206  isotName = newIsotName;
1207  break;
1208  }
1209  }
1210  }
1211  }
1212  }
1213  }
1214  return isotName;
1215 }
1216 
1217 
1218 //------------------------------------------------------------------------
1219 template< class TYP > G4String G4tgbGeometryDumper::
1220 GetObjectName( TYP* obj, std::map<G4String,TYP*> objectsDumped )
1221 {
1222  G4String objName = obj->GetName();
1223 
1224  // first look if this is objecy is already dumped,
1225  // with original object name or new one
1226  //
1227  typename std::map<G4String,TYP*>::const_iterator ite;
1228  for( ite = objectsDumped.begin(); ite != objectsDumped.end(); ite++ )
1229  {
1230  if( obj == (*ite).second ) { return (*ite).first; }
1231  }
1232 
1233  // Now look if there is another object dumped with same name,
1234  // and if found add _N to the name
1235  //
1236  ite = objectsDumped.find( objName );
1237 
1238  if( ite != objectsDumped.end() ) // Object found with same name
1239  {
1240  TYP* objold = (*ite).second;
1241  if( obj != objold ) // new object it is not the really
1242  { // the same one as object found
1243  G4int ii = 2;
1244  for(;;ii++)
1245  {
1246  G4String newObjName = objName + "_" + G4UIcommand::ConvertToString(ii);
1247  typename std::map<G4String,TYP*>::const_iterator ite2 =
1248  objectsDumped.find( newObjName );
1249  if( ite2 == objectsDumped.end() )
1250  {
1251  objName = newObjName;
1252  break;
1253  }
1254  }
1255  }
1256  }
1257  return objName;
1258 }
1259 
1260 
1261 //------------------------------------------------------------------------
1262 G4bool G4tgbGeometryDumper::CheckIfLogVolExists( const G4String& name,
1263  G4LogicalVolume* pt )
1264 {
1265  if( theLogVols.find( name ) != theLogVols.end() )
1266  {
1267  G4LogicalVolume* lvnew = (*(theLogVols.find(name))).second;
1268  if( lvnew != pt )
1269  {
1270  /*
1271  //---- Reflected volumes are repeated
1272 
1273  G4ReflectionFactory* reffact = G4ReflectionFactory::Instance();
1274  if( !reffact->IsReflected( pt ) && !reffact->IsReflected( lvnew ) )
1275  {
1276  G4String ErrMessage = "LogVol found but not same as before: " + name;
1277  G4Exception("G4tgbGeometryDumper::CheckIfLogVolExists()",
1278  "InvalidSetup", FatalException, ErrMessage);
1279  }
1280  */
1281  }
1282  return 1;
1283  }
1284  else
1285  {
1286  return 0;
1287  }
1288 }
1289 
1290 
1291 //-----------------------------------------------------------------------
1292 G4bool G4tgbGeometryDumper::CheckIfPhysVolExists( const G4String& name,
1293  G4VPhysicalVolume* pt )
1294 {
1295 #ifdef G4VERBOSE
1296  if( G4tgrMessenger::GetVerboseLevel() >= 1 )
1297  {
1298  G4cout << " G4tgbGeometryDumper::CheckIfPhysVolExists() - "
1299  << name << G4endl;
1300  }
1301 #endif
1302  if( thePhysVols.find( name ) != thePhysVols.end() )
1303  {
1304  if( (*(thePhysVols.find(name))).second != pt )
1305  {
1306  // G4String ErrMessage = "Placement found but not same as before: "
1307  // + name;
1308  // G4Exception("G4tgbGeometryDumper::CheckIfPhysVolExists()",
1309  // "InvalidSetup", FatalException, ErrMessage);
1310  G4cerr << " G4tgbGeometryDumper::CheckIfPhysVolExists () -"
1311  << " Placement found but not same as before : " << name << G4endl;
1312  }
1313  return 1;
1314  }
1315  else
1316  {
1317  return 0;
1318  }
1319 }
1320 
1321 
1322 //-----------------------------------------------------------------------
1323 G4String
1324 G4tgbGeometryDumper::LookForExistingRotation( const G4RotationMatrix* rotm )
1325 {
1326  G4String rmName = "";
1327 
1328  std::map<G4String,G4RotationMatrix*>::const_iterator ite;
1329  for( ite = theRotMats.begin(); ite != theRotMats.end(); ite++ )
1330  {
1331  if( (*ite).second->isNear( *rotm ) )
1332  {
1333  rmName = (*ite).first;
1334  break;
1335  }
1336  }
1337  return rmName;
1338 }
1339 
1340 
1341 //------------------------------------------------------------------------
1342 G4bool
1343 G4tgbGeometryDumper::Same2G4Isotopes( G4Isotope* isot1, G4Isotope* isot2 )
1344 {
1345  if ( (isot1->GetZ() != isot2->GetZ())
1346  || (isot1->GetN() != isot2->GetN())
1347  || (isot1->GetA() != isot2->GetA()) )
1348  {
1349  return 0;
1350  }
1351  else
1352  {
1353  return 1;
1354  }
1355 }
1356 
1357 
1358 //------------------------------------------------------------------------
1359 const G4String& G4tgbGeometryDumper::FindSolidName( G4VSolid* solid )
1360 {
1361  std::map<G4String,G4VSolid*>::const_iterator ite;
1362  for( ite = theSolids.begin(); ite != theSolids.end(); ite++ )
1363  {
1364  if( solid == (*ite).second ) { return (*ite).first; }
1365  }
1366 
1367  if( ite == theSolids.end() )
1368  {
1369  G4Exception("G4tgbGeometryDumper::FindSolidName()", "ReadError",
1370  FatalException, "Programming error.");
1371  }
1372  return (*ite).first;
1373 }
G4ThreeVector GetSymAxis() const
G4double GetSPhi() const
G4double GetPressure() const
Definition: G4Material.hh:181
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:158
Definition: geomdefs.hh:54
G4PolyconeSideRZ GetCorner(G4int index) const
G4String GetName() const
G4double GetXHalfLength4() const
G4IonisParamMat * GetIonisation() const
Definition: G4Material.hh:224
G4double GetXHalfLength() const
G4double GetA() const
Definition: G4Isotope.hh:97
G4double GetOuterStereo() const
Definition: G4Para.hh:76
double xx() const
G4double GetX1HalfLength() const
Definition: G4TwistedTrd.hh:77
G4String symbol
Definition: TRTMaterials.hh:40
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
G4double GetZ() const
Definition: G4Material.cc:606
std::vector< G4Isotope * > G4IsotopeVector
G4double GetY1HalfLength() const
Definition: G4TwistedTrd.hh:79
G4double GetPolarAngleTheta() const
const G4String & GetName() const
Definition: G4Isotope.hh:88
G4double GetYHalfLength2() const
const G4ThreeVector & GetTranslation() const
std::vector< G4Element * > G4ElementVector
G4double GetYHalfLength1() const
G4double GetInnerStereo() const
G4String GetName() const
G4double GetDy() const
CLHEP::Hep3Vector G4ThreeVector
G4double GetInnerRadius() const
double thetaX() const
Definition: Rotation.cc:141
double x() const
CLHEP::HepRotation G4RotationMatrix
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
Definition: G4PVReplica.cc:236
void DumpIsotope(G4Isotope *ele)
Hep3Vector colX() const
virtual G4bool IsReplicated() const =0
G4String DumpMaterial(G4Material *mat)
G4State
Definition: G4Material.hh:114
G4int first(char) const
G4Material * GetMaterial() const
Definition: G4Box.hh:63
const G4String & GetSymbol() const
Definition: G4Element.hh:128
G4int GetNumRZCorner() const
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
void DumpSolidParams(G4VSolid *so)
G4double GetZTopCut() const
G4double GetZHalfLength() const
Definition: G4Tubs.hh:84
G4double GetSurfaceTolerance() const
G4double GetZ() const
Definition: G4Element.hh:131
G4double GetZHalfLength() const
G4double GetDensity() const
Definition: G4Material.hh:178
int atmosphere
Definition: hepunit.py:151
double yy() const
G4double GetRmax() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
#define width
G4double GetZBottomCut() const
const XML_Char * name
Definition: expat.h:151
double xz() const
G4double GetOuterRadiusMinusZ() const
Definition: G4Trd.hh:71
G4double GetX2HalfLength() const
Definition: G4TwistedTrd.hh:78
G4double GetInnerRadius() const
virtual G4GeometryType GetEntityType() const =0
#define G4ThreadLocal
Definition: tls.hh:52
G4double GetZHalfLength() const
G4double GetA() const
Definition: G4Element.hh:138
G4double GetDeltaPhiAngle() const
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:188
int G4int
Definition: G4Types.hh:78
G4double GetZHalfLength() const
double zx() const
G4double GetSemiAxisMax(G4int i) const
G4bool IsReflected(G4LogicalVolume *lv) const
G4ThreeVector GetObjectTranslation() const
G4double GetXHalfLength2() const
double z() const
double phiY() const
Definition: Rotation.cc:133
static G4ReflectionFactory * Instance()
G4double GetZHalfLength() const
Definition: G4TwistedTrd.hh:81
G4double GetRtor() const
G4double GetZHalfLength() const
Definition: G4TwistedBox.hh:75
void DumpPVReplica(G4PVReplica *pv, const G4String &lvName)
G4double GetEndPhi() const
G4double GetTanAlpha2() const
G4int GetNumRZCorner() const
void DumpPhysVol(G4VPhysicalVolume *pv)
G4double GetPhiTwist() const
Float_t mat
Definition: plot.C:40
static G4PhysicalVolumeStore * GetInstance()
G4double GetY1HalfLength() const
G4double GetXHalfLength2() const
G4double GetRadius() const
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
void DumpGeometry(const G4String &fname)
G4int GetNumSide() const
double yz() const
G4VPVParameterisation * GetParameterisation() const
G4double GetXHalfLength1() const
G4double GetDz() const
G4int GetN() const
Definition: G4Isotope.hh:94
G4GLOB_DLL std::ostream G4cout
G4double GetDeltaPhiAngle() const
G4double GetStartThetaAngle() const
G4double GetRmin() const
const G4String & GetName() const
G4double GetXHalfLength3() const
static G4int GetVerboseLevel()
Definition: G4Hype.hh:66
bool G4bool
Definition: G4Types.hh:79
G4double GetY2HalfLength() const
Definition: G4TwistedTrd.hh:80
double phiX() const
Definition: Rotation.cc:129
double thetaY() const
Definition: Rotation.cc:145
Definition: G4Cons.hh:82
#define FALSE
Definition: globals.hh:52
G4double GetX3HalfLength() const
G4double GetPhiTwist() const
Definition: G4TwistedTrd.hh:82
G4double GetDPhi() const
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:166
G4double GetYHalfLength() const
#define TRUE
Definition: globals.hh:55
G4double GetStartPhiAngle() const
G4double GetYHalfLength2() const
G4double GetOuterRadius() const
G4double GetStartPhiAngle() const
G4double GetStartPhi() const
G4double GetInnerRadiusPlusZ() const
G4LogicalVolume * GetMotherLogical() const
G4double GetDPhi() const
G4double GetInnerRadius() const
G4PolyconeHistorical * GetOriginalParameters() const
G4double GetStartPhi() const
Hep3Vector colZ() const
G4double GetDx() const
Definition: G4Orb.hh:60
G4VSolid * GetConstituentMovedSolid() const
tuple v
Definition: test.py:18
G4double GetXHalfLength() const
G4double GetInnerRadius() const
virtual const G4VSolid * GetConstituentSolid(G4int no) const
TMarker * pt
Definition: egs.C:22
Hep3Vector colY() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4bool IsParameterised() const =0
double theta() const
G4double GetA() const
Definition: G4Material.cc:619
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
G4double GetX4HalfLength() const
HepRep3x3 rep3x3() const
G4int GetZ() const
Definition: G4Isotope.hh:91
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
G4double GetYHalfLength() const
Definition: G4TwistedBox.hh:74
double thetaZ() const
Definition: Rotation.cc:149
jump r
Definition: plot.C:36
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:162
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
G4double GetZHalfLength() const
G4LogicalVolume * GetLogicalVolume() const
G4double GetTanAlpha() const
void DumpBooleanVolume(const G4String &solidType, G4VSolid *so)
double phiZ() const
Definition: Rotation.cc:137
static G4tgbGeometryDumper * GetInstance()
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
double zy() const
G4VSolid * GetConstituentMovedSolid() const
std::vector< G4double > GetSolidParams(const G4VSolid *so)
void DumpPVParameterised(G4PVParameterised *pv)
EAxis
Definition: geomdefs.hh:54
G4VPhysicalVolume * GetTopPhysVol()
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
virtual G4int GetCopyNo() const =0
double y() const
const G4RotationMatrix * GetRotation() const
G4PolyhedraHistorical * GetOriginalParameters() const
G4double GetZHalfLength() const
G4double GetZHalfLength() const
G4ThreeVector GetSymAxis() const
G4double GetZHalfLength() const
G4double GetMeanExcitationEnergy() const
G4double GetAzimuthalAnglePhi() const
G4double GetTemperature() const
Definition: G4Material.hh:180
G4double GetStartPhi() const
#define G4endl
Definition: G4ios.hh:61
G4double GetXHalfLength1() const
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
string fname
Definition: test.py:308
G4double GetOuterRadius() const
G4double GetStartPhiAngle() const
G4PolyhedraSideRZ GetCorner(const G4int index) const
G4double GetYHalfLength1() const
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
G4State GetState() const
Definition: G4Material.hh:179
double yx() const
double G4double
Definition: G4Types.hh:76
G4double GetPhiTwist() const
Definition: G4TwistedBox.hh:76
Definition: geomdefs.hh:54
G4double GetInnerRadiusMinusZ() const
UBox box
Definition: UPolycone.cc:32
G4double GetTanAlpha1() const
const G4double * GetFractionVector() const
Definition: G4Material.hh:192
G4int GetNumRZCorner() const
G4double GetDeltaThetaAngle() const
G4PolyconeSideRZ GetCorner(G4int index) const
G4double GetX1HalfLength() const
G4double GetTiltAngleAlpha() const
G4double GetX2HalfLength() const
G4double GetOuterRadiusPlusZ() const
double zz() const
G4double GetZHalfLength() const
G4double GetOuterRadius() const
G4double GetXHalfLength() const
Definition: G4TwistedBox.hh:73
static G4GeometryTolerance * GetInstance()
G4double GetPhiTwist() const
G4VSolid * GetSolid() const
double xy() const
G4double GetOuterRadius() const
G4GLOB_DLL std::ostream G4cerr
G4String DumpLogVol(G4LogicalVolume *lv, G4String extraName="", G4VSolid *solid=0, G4Material *mate=0)
G4double GetY2HalfLength() const
void DumpElement(G4Element *ele)
G4double GetDeltaPhiAngle() const
G4double GetYHalfLength() const