42#ifndef G3G4_NO_REFLECTION
55 fNofDivisions(nofDivisions),
134 if (shape ==
"PARA") {
146 #ifndef G3G4_NO_REFLECTION
161 G4cout <<
"Create G4PVReplica name " <<
name <<
" logical volume name "
162 << lv->
GetName() <<
" mother logical volme name "
163 << mlv->
GetName() <<
" axis " <<
fAxis <<
" ndivisions "
168 #ifndef G3G4_NO_REFLECTION
182 G4String err_message =
"G3Division::" + where +
" for "
183 + what +
" is not implemented";
184 G4Exception(
"G3Division::Exception()",
"G3toG40004",
202 default:
G4Exception(
"G3Division::SetRangeAndAxis()",
"G3toG40005",
206 if ( shape ==
"BOX" ) {
210 else if ( shape ==
"TRD1" ) {
222 else if ( shape ==
"TRD2" ) {
233 else if ( shape ==
"TRAP" ) {
238 else if ( shape ==
"TUBE" ) {
254 else if ( shape ==
"TUBS" ) {
273 else if ( shape ==
"CONE" ) {
290 else if ( shape ==
"CONS" ) {
309 else if ( shape ==
"SPHE" ) {
326 else if ( shape ==
"PARA" ) {
330 else if ( shape ==
"PGON" ) {
355 rangelo[0] =
std::min(rangelo[0], Rmin[i]);
356 rangehi[0] =
std::max(rangehi[0], Rmax[i]);
357 rangelo[2] =
std::min(rangelo[2], DzArray[i]);
358 rangehi[2] =
std::max(rangehi[2], DzArray[i]);
361 assert(Rmin[i]>=0 && Rmax[i]>=Rmin[i]);
363 rangehi[1] = pPhi1 + dPhi;
376 else if ( shape ==
"PCON" ) {
401 rangelo[0] =
std::min(rangelo[0], Rmin[i]);
402 rangehi[0] =
std::max(rangehi[0], Rmax[i]);
403 rangelo[2] =
std::min(rangelo[2], DzArray[i]);
404 rangehi[2] =
std::max(rangehi[2], DzArray[i]);
407 assert(Rmin[i]>=0 && Rmax[i]>=Rmin[i]);
409 rangehi[1] = pPhi1 + dPhi;
422 else if ( shape ==
"ELTU" || shape ==
"HYPE" || shape ==
"GTRA" ||
427 Exception(
"SetRangeAndAxis",
"Unknown shape" + shape);
432 G4cout <<
"Shape " << shape <<
" SetRangeAndAxis: "
449 for (
G4int i=0; i<npar; ++i){
Rpar[i] = par[i];}
452 if ( shape ==
"BOX" ) {
456 else if ( shape ==
"TRD1" ) {
465 Rpar[0] = x1 + tn * (lo/
cm - z1);
466 Rpar[1] = x1 + tn * (hi/
cm - z1);
467 Rpar[3] = (hi - lo)/2./
cm;
468 pos[2] = (hi + lo)/2.;
471 else if ( shape ==
"TRD2" ) {
482 Rpar[0] = x1 + tn1 * (lo/
cm - z1);
483 Rpar[1] = x1 + tn1 * (hi/
cm - z1);
484 Rpar[2] = y1 + tn2 * (lo/
cm - z1);
485 Rpar[3] = y1 + tn2 * (hi/
cm - z1);
486 Rpar[4] = (hi - lo)/2./
cm;
487 pos[2] = (hi + lo)/2.;
490 else if ( shape ==
"TRAP" ) {
491 Exception(
"CreateEnvelope",
"TRAP-x,y,z");
493 else if ( shape ==
"TUBE" ) {
505 Rpar[2] = (hi - lo)/2./
cm;
506 pos [2] = (hi + lo)/2.;
509 else if ( shape ==
"TUBS" ) {
519 Rpar[2] = (hi - lo)/2./
cm;
520 pos [2] = (hi + lo)/2.;
523 else if ( shape ==
"CONE" ) {
538 Rpar[1] = rmin + tn1 * (lo/
cm - z1);
539 Rpar[3] = rmin + tn1 * (hi/
cm - z1);
540 Rpar[2] = rmax + tn2 * (lo/
cm - z1);
541 Rpar[4] = rmax + tn2 * (hi/
cm - z1);
542 Rpar[0] = (hi - lo)/2./
cm;
543 pos[2] = (hi + lo)/2.;
546 else if ( shape ==
"CONS" ) {
559 Rpar[1] = rmin + tn1 * (lo/
cm - z1);
560 Rpar[3] = rmin + tn1 * (hi/
cm - z1);
561 Rpar[2] = rmax + tn2 * (lo/
cm - z1);
562 Rpar[4] = rmax + tn2 * (hi/
cm - z1);
563 Rpar[0] = (hi - lo)/2./
cm;
564 pos[2] = (hi + lo)/2.;
567 else if ( shape ==
"SPHE" ) {
568 Exception(
"CreateEnvelope",
"SPHE-x,y,z");
570 else if ( shape ==
"PARA" ) {
571 Exception(
"CreateEnvelope",
"PARA-x,y,z");
573 else if ( shape ==
"PGON" ) {
583 else if ( shape ==
"PCON" ) {
594 Exception(
"CreateEnvelope",
"Unknown shape" + shape);
606 G3Pos* aG3Pos =
new G3Pos(motherName, 1, offset, 0, only);
619 for (
G4int i=0; i<npar; ++i){
Rpar[i] = par[i];}
628 if ( shape ==
"BOX" ) {
633 else if ( shape ==
"TRD1" ) {
641 else if ( shape ==
"TRD2" ) {
649 else if ( shape ==
"TRAP" ) {
657 else if ( shape ==
"TUBE" ) {
672 else if ( shape ==
"TUBS" ) {
686 else if ( shape ==
"CONE" ) {
700 else if ( shape ==
"CONS" ) {
713 else if (shape ==
"PARA") {
717 else if (
Rpar[4] == 0. &&
Rpar[5] == 0. ) {
729 else if (shape ==
"SPHE") {
732 else if ( shape ==
"PGON" ) {
742 else if ( shape ==
"PCON" ) {
753 Exception(
"CreateSolid",
"Unknown shape" + shape);
765 +
" has negative parameters.";
766 G4Exception(
"G3Division::CreateSolid()",
"G3toG40006",
849 if (ndvmx > 255) ndvmx = 255;
850 if (ndiv > ndvmx && ndvmx > 0 ) ndiv = ndvmx;
897 if (ndvmx > 255) ndvmx = 255;
898 if (ndiv > ndvmx && ndvmx > 0 ) ndiv = ndvmx;
G3VolTableEntry * G4CreateVTE(G4String vname, G4String shape, G4int nmed, G4double Rpar[], G4int npar)
G4VSolid * G3toG4MakeSolid(const G4String &vname, const G4String &shape, const G4double *Rpar, const G4int npar, G4bool &NegVolPars, G4bool &Deferred, G4bool *OKAxis)
G3G4DLL_API G4double Rpar[1000]
static const G4double pos
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static constexpr double cm
static constexpr double deg
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
G3Division(G3DivType type, G3VolTableEntry *vte, G3VolTableEntry *mvte, G4int nofDivision, G4int iaxis, G4int nmed, G4double c0, G4double step)
G3VolTableEntry * CreateEnvelope(G4String shape, G4double hi, G4double lo, G4double par[], G4int npar)
void CreateSolid(G4String shape, G4double par[], G4int npar)
void Exception(G4String where, G4String what)
void AddMother(G3VolTableEntry *aDaughter)
G3VolTableEntry * GetMasterClone()
void ReplaceDaughter(G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
void ReplaceMother(G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
void AddG3Pos(G3Pos *aG3Pos)
void SetHasNegPars(G4bool hasNegPars)
void SetNRpar(G4int npar, G4double *Rpar)
void AddDaughter(G3VolTableEntry *aDaughter)
G4LogicalVolume * GetLV()
void SetSolid(G4VSolid *solid)
G4VSolid * GetSolid() const
const G4String & GetName() const
static G4ReflectionFactory * Instance()
G4PhysicalVolumesPair Place(const G4Transform3D &transform3D, const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, G4bool isMany, G4int copyNo, G4bool surfCheck=false)
G4PhysicalVolumesPair Replicate(const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofReplicas, G4double width, G4double offset=0.)
static const G4double kInfinity
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
const char * name(G4int ptype)