43 #ifndef G3G4_NO_REFLECTION
56 fNofDivisions(nofDivisions),
135 if (shape ==
"PARA") {
144 if (position.y()!=0.)
145 position.setX(position.y()*((
G4Para*)lv->
GetSolid())->GetTanAlpha());
147 #ifndef G3G4_NO_REFLECTION
162 G4cout <<
"Create G4PVReplica name " << name <<
" logical volume name "
163 << lv->
GetName() <<
" mother logical volme name "
164 << mlv->
GetName() <<
" axis " <<
fAxis <<
" ndivisions "
169 #ifndef G3G4_NO_REFLECTION
183 G4String err_message =
"G3Division::" + where +
" for "
184 + what +
" is not implemented";
185 G4Exception(
"G3Division::Exception()",
"G3toG40004",
203 default:
G4Exception(
"G3Division::SetRangeAndAxis()",
"G3toG40005",
207 if ( shape ==
"BOX" ) {
211 else if ( shape ==
"TRD1" ) {
223 else if ( shape ==
"TRD2" ) {
234 else if ( shape ==
"TRAP" ) {
239 else if ( shape ==
"TUBE" ) {
255 else if ( shape ==
"TUBS" ) {
274 else if ( shape ==
"CONE" ) {
291 else if ( shape ==
"CONS" ) {
310 else if ( shape ==
"SPHE" ) {
327 else if ( shape ==
"PARA" ) {
331 else if ( shape ==
"PGON" ) {
353 DzArray[i] = Rpar[i4]*
cm;
354 Rmin[i] = Rpar[i5]*
cm;
355 Rmax[i] = Rpar[i6]*
cm;
356 rangelo[0] =
std::min(rangelo[0], Rmin[i]);
357 rangehi[0] =
std::max(rangehi[0], Rmax[i]);
358 rangelo[2] =
std::min(rangelo[2], DzArray[i]);
359 rangehi[2] =
std::max(rangehi[2], DzArray[i]);
362 assert(Rmin[i]>=0 && Rmax[i]>=Rmin[i]);
364 rangehi[1] = pPhi1 + dPhi;
377 else if ( shape ==
"PCON" ) {
399 DzArray[i] = Rpar[i4]*
cm;
400 Rmin[i] = Rpar[i5]*
cm;
401 Rmax[i] = Rpar[i6]*
cm;
402 rangelo[0] =
std::min(rangelo[0], Rmin[i]);
403 rangehi[0] =
std::max(rangehi[0], Rmax[i]);
404 rangelo[2] =
std::min(rangelo[2], DzArray[i]);
405 rangehi[2] =
std::max(rangehi[2], DzArray[i]);
408 assert(Rmin[i]>=0 && Rmax[i]>=Rmin[i]);
410 rangehi[1] = pPhi1 + dPhi;
423 else if ( shape ==
"ELTU" || shape ==
"HYPE" || shape ==
"GTRA" ||
428 Exception(
"SetRangeAndAxis",
"Unknown shape" + shape);
433 G4cout <<
"Shape " << shape <<
" SetRangeAndAxis: "
450 for (
G4int i=0; i<npar; ++i){ Rpar[i] = par[i];}
453 if ( shape ==
"BOX" ) {
455 pos [
fIAxis-1] = (hi + lo)/2.;
457 else if ( shape ==
"TRD1" ) {
464 tn = (Rpar[1] - Rpar[0])/(2.* Rpar[3]);
465 x1 = Rpar[0]; z1 = -Rpar[3];
466 Rpar[0] = x1 + tn * (lo/
cm - z1);
467 Rpar[1] = x1 + tn * (hi/
cm - z1);
468 Rpar[3] = (hi - lo)/2./
cm;
469 pos[2] = (hi + lo)/2.;
472 else if ( shape ==
"TRD2" ) {
480 tn1 = (Rpar[1] - Rpar[0])/(2.* Rpar[4]);
481 tn2 = (Rpar[3] - Rpar[2])/(2.* Rpar[4]);
482 x1 = Rpar[0]; y1 = Rpar[2]; z1 = -Rpar[3];
483 Rpar[0] = x1 + tn1 * (lo/
cm - z1);
484 Rpar[1] = x1 + tn1 * (hi/
cm - z1);
485 Rpar[2] = y1 + tn2 * (lo/
cm - z1);
486 Rpar[3] = y1 + tn2 * (hi/
cm - z1);
487 Rpar[4] = (hi - lo)/2./
cm;
488 pos[2] = (hi + lo)/2.;
491 else if ( shape ==
"TRAP" ) {
492 Exception(
"CreateEnvelope",
"TRAP-x,y,z");
494 else if ( shape ==
"TUBE" ) {
506 Rpar[2] = (hi - lo)/2./
cm;
507 pos [2] = (hi + lo)/2.;
510 else if ( shape ==
"TUBS" ) {
520 Rpar[2] = (hi - lo)/2./
cm;
521 pos [2] = (hi + lo)/2.;
524 else if ( shape ==
"CONE" ) {
536 tn1 = (Rpar[3] - Rpar[1])/(2.* Rpar[0]);
537 tn2 = (Rpar[4] - Rpar[2])/(2.* Rpar[0]);
538 rmin = Rpar[1]; rmax = Rpar[2]; z1 = -Rpar[0];
539 Rpar[1] = rmin + tn1 * (lo/
cm - z1);
540 Rpar[3] = rmin + tn1 * (hi/
cm - z1);
541 Rpar[2] = rmax + tn2 * (lo/
cm - z1);
542 Rpar[4] = rmax + tn2 * (hi/
cm - z1);
543 Rpar[0] = (hi - lo)/2./
cm;
544 pos[2] = (hi + lo)/2.;
547 else if ( shape ==
"CONS" ) {
557 tn1 = (Rpar[3] - Rpar[1])/(2.* Rpar[0]);
558 tn2 = (Rpar[4] - Rpar[2])/(2.* Rpar[0]);
559 rmin = Rpar[1]; rmax = Rpar[2]; z1 = -Rpar[0];
560 Rpar[1] = rmin + tn1 * (lo/
cm - z1);
561 Rpar[3] = rmin + tn1 * (hi/
cm - z1);
562 Rpar[2] = rmax + tn2 * (lo/
cm - z1);
563 Rpar[4] = rmax + tn2 * (hi/
cm - z1);
564 Rpar[0] = (hi - lo)/2./
cm;
565 pos[2] = (hi + lo)/2.;
568 else if ( shape ==
"SPHE" ) {
569 Exception(
"CreateEnvelope",
"SPHE-x,y,z");
571 else if ( shape ==
"PARA" ) {
572 Exception(
"CreateEnvelope",
"PARA-x,y,z");
574 else if ( shape ==
"PGON" ) {
584 else if ( shape ==
"PCON" ) {
595 Exception(
"CreateEnvelope",
"Unknown shape" + shape);
607 G3Pos* aG3Pos =
new G3Pos(motherName, 1, offset, 0, only);
620 for (
G4int i=0; i<npar; ++i){ Rpar[i] = par[i];}
629 if ( shape ==
"BOX" ) {
634 else if ( shape ==
"TRD1" ) {
642 else if ( shape ==
"TRD2" ) {
650 else if ( shape ==
"TRAP" ) {
658 else if ( shape ==
"TUBE" ) {
673 else if ( shape ==
"TUBS" ) {
687 else if ( shape ==
"CONE" ) {
701 else if ( shape ==
"CONS" ) {
714 else if (shape ==
"PARA") {
718 else if ( Rpar[4] == 0. && Rpar[5] == 0. ) {
730 else if (shape ==
"SPHE") {
733 else if ( shape ==
"PGON" ) {
743 else if ( shape ==
"PCON" ) {
754 Exception(
"CreateSolid",
"Unknown shape" + shape);
766 +
" has negative parameters.";
767 G4Exception(
"G3Division::CreateSolid()",
"G3toG40006",
850 if (ndvmx > 255) ndvmx = 255;
851 if (ndiv > ndvmx && ndvmx > 0 ) ndiv = ndvmx;
898 if (ndvmx > 255) ndvmx = 255;
899 if (ndiv > ndvmx && ndvmx > 0 ) ndiv = ndvmx;
G3G4DLL_API G4double Rpar[1000]
void Exception(G4String where, G4String what)
void CreateSolid(G4String shape, G4double par[], G4int npar)
static const G4double kInfinity
CLHEP::Hep3Vector G4ThreeVector
G3VolTableEntry * GetMasterClone()
G4LogicalVolume * GetLV()
G4VSolid * GetSolid() const
G4PhysicalVolumesPair Replicate(const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofReplicas, G4double width, G4double offset=0)
const char * name(G4int ptype)
static G4ReflectionFactory * Instance()
G4GLOB_DLL std::ostream G4cout
G4PhysicalVolumesPair Place(const G4Transform3D &transform3D, const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, G4bool isMany, G4int copyNo, G4bool surfCheck=false)
G3VolTableEntry * CreateEnvelope(G4String shape, G4double hi, G4double lo, G4double par[], G4int npar)
void SetNRpar(G4int npar, G4double *Rpar)
static constexpr double cm
G3Division(G3DivType type, G3VolTableEntry *vte, G3VolTableEntry *mvte, G4int nofDivision, G4int iaxis, G4int nmed, G4double c0, G4double step)
void SetHasNegPars(G4bool hasNegPars)
void SetSolid(G4VSolid *solid)
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)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void AddG3Pos(G3Pos *aG3Pos)
void AddMother(G3VolTableEntry *aDaughter)
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
void ReplaceMother(G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
void ReplaceDaughter(G3VolTableEntry *vteOld, G3VolTableEntry *vteNew)
const G4String & GetName() const
static constexpr double deg
static const G4double pos
void AddDaughter(G3VolTableEntry *aDaughter)