Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParameterisationPolyhedraZ Class Reference

#include <G4ParameterisationPolyhedra.hh>

+ Inheritance diagram for G4ParameterisationPolyhedraZ:

Public Member Functions

 G4ParameterisationPolyhedraZ (EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *motherSolid, DivisionType divType)
 
 ~G4ParameterisationPolyhedraZ ()
 
void CheckParametersValidity ()
 
G4double GetMaxParameter () const
 
void ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const
 
void ComputeDimensions (G4Polyhedra &phedra, const G4int copyNo, const G4VPhysicalVolume *physVol) const
 
- Public Member Functions inherited from G4VParameterisationPolyhedra
 G4VParameterisationPolyhedra (EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *msolid, DivisionType divType)
 
virtual ~G4VParameterisationPolyhedra ()
 
- Public Member Functions inherited from G4VDivisionParameterisation
 G4VDivisionParameterisation (EAxis axis, G4int nDiv, G4double width, G4double offset, DivisionType divType, G4VSolid *motherSolid=nullptr)
 
virtual ~G4VDivisionParameterisation ()
 
virtual G4VSolidComputeSolid (const G4int, G4VPhysicalVolume *)
 
virtual void ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const =0
 
const G4StringGetType () const
 
EAxis GetAxis () const
 
G4int GetNoDiv () const
 
G4double GetWidth () const
 
G4double GetOffset () const
 
G4VSolidGetMotherSolid () const
 
void SetType (const G4String &type)
 
G4int VolumeFirstCopyNo () const
 
void SetHalfGap (G4double hg)
 
G4double GetHalfGap () const
 
- Public Member Functions inherited from G4VPVParameterisation
 G4VPVParameterisation ()=default
 
virtual ~G4VPVParameterisation ()=default
 
virtual void ComputeTransformation (const G4int, G4VPhysicalVolume *) const =0
 
virtual G4VSolidComputeSolid (const G4int, G4VPhysicalVolume *)
 
virtual G4MaterialComputeMaterial (const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr)
 
virtual G4bool IsNested () const
 
virtual G4VVolumeMaterialScannerGetMaterialScanner ()
 
virtual void ComputeDimensions (G4Box &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Tubs &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Trd &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Trap &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Cons &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Sphere &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Orb &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Ellipsoid &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Torus &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Para &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Polycone &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Polyhedra &, const G4int, const G4VPhysicalVolume *) const
 
virtual void ComputeDimensions (G4Hype &, const G4int, const G4VPhysicalVolume *) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VDivisionParameterisation
void ChangeRotMatrix (G4VPhysicalVolume *physVol, G4double rotZ=0.0) const
 
G4int CalculateNDiv (G4double motherDim, G4double width, G4double offset) const
 
G4double CalculateWidth (G4double motherDim, G4int nDiv, G4double offset) const
 
virtual void CheckParametersValidity ()
 
void CheckOffset (G4double maxPar)
 
void CheckNDivAndWidth (G4double maxPar)
 
virtual G4double GetMaxParameter () const =0
 
G4double OffsetZ () const
 
- Protected Attributes inherited from G4VDivisionParameterisation
G4String ftype
 
EAxis faxis
 
G4int fnDiv = 0
 
G4double fwidth = 0.0
 
G4double foffset = 0.0
 
DivisionType fDivisionType
 
G4VSolidfmotherSolid = nullptr
 
G4bool fReflectedSolid = false
 
G4bool fDeleteSolid = false
 
G4int theVoluFirstCopyNo = 1
 
G4double kCarTolerance
 
G4double fhgap = 0.0
 
- Static Protected Attributes inherited from G4VDivisionParameterisation
static G4ThreadLocal G4RotationMatrixfRot = nullptr
 
static const G4int verbose = 5
 

Detailed Description

Definition at line 181 of file G4ParameterisationPolyhedra.hh.

Constructor & Destructor Documentation

◆ G4ParameterisationPolyhedraZ()

G4ParameterisationPolyhedraZ::G4ParameterisationPolyhedraZ ( EAxis  axis,
G4int  nCopies,
G4double  offset,
G4double  step,
G4VSolid motherSolid,
DivisionType  divType 
)

Definition at line 432 of file G4ParameterisationPolyhedra.cc.

436 : G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType ),
437 fOrigParamMother(((G4Polyhedra*)fmotherSolid)->GetOriginalParameters())
438{
440 SetType( "DivisionPolyhedraZ" );
441
442 if( divType == DivWIDTH )
443 {
444 fnDiv =
445 CalculateNDiv(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
446 - fOrigParamMother->Z_values[0] , width, offset);
447 }
448 else if( divType == DivNDIV )
449 {
450 fwidth =
451 CalculateNDiv(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
452 - fOrigParamMother->Z_values[0] , nDiv, offset);
453 }
454
455#ifdef G4DIVDEBUG
456 if( verbose >= 1 )
457 {
458 G4cout << " G4ParameterisationPolyhedraZ - # divisions " << fnDiv << " = "
459 << nDiv << G4endl
460 << " Offset " << foffset << " = " << offset << G4endl
461 << " Width " << fwidth << " = " << width << G4endl;
462 }
463#endif
464}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void SetType(const G4String &type)
G4int CalculateNDiv(G4double motherDim, G4double width, G4double offset) const

◆ ~G4ParameterisationPolyhedraZ()

G4ParameterisationPolyhedraZ::~G4ParameterisationPolyhedraZ ( )

Definition at line 467 of file G4ParameterisationPolyhedra.cc.

468{
469}

Member Function Documentation

◆ CheckParametersValidity()

void G4ParameterisationPolyhedraZ::CheckParametersValidity ( )
virtual

Reimplemented from G4VDivisionParameterisation.

Definition at line 516 of file G4ParameterisationPolyhedra.cc.

517{
519
520 // Division will be following the mother polyhedra segments
521 //
522 if( fDivisionType == DivNDIV )
523 {
524 if( fOrigParamMother->Num_z_planes-1 != fnDiv )
525 {
526 std::ostringstream message;
527 message << "Configuration not supported." << G4endl
528 << "Division along Z will be done splitting in the defined"
529 << G4endl
530 << "Z planes, i.e, the number of division would be :"
531 << fOrigParamMother->Num_z_planes-1 << " instead of "
532 << fnDiv << " !";
533 G4Exception("G4ParameterisationPolyhedraZ::CheckParametersValidity()",
534 "GeomDiv0001", FatalException, message);
535 }
536 }
537
538 // Division will be done within one polyhedra segment
539 // with applying given width and offset
540 //
542 {
543 // Check if divided region does not span over more
544 // than one z segment
545
546 G4int isegstart = -1; // number of the segment containing start position
547 G4int isegend = -1; // number of the segment containing end position
548
549 if ( !fReflectedSolid )
550 {
551 // The start/end position of the divided region
552 //
553 G4double zstart = fOrigParamMother->Z_values[0] + foffset;
554 G4double zend = fOrigParamMother->Z_values[0]
555 + foffset + fnDiv*fwidth;
556
557 G4int counter = 0;
558 while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 )
559 {
560 // first segment
561 if ( zstart >= fOrigParamMother->Z_values[counter] &&
562 zstart < fOrigParamMother->Z_values[counter+1] )
563 {
564 isegstart = counter;
565 }
566 // last segment
567 if ( zend > fOrigParamMother->Z_values[counter] &&
568 zend <= fOrigParamMother->Z_values[counter+1] )
569 {
570 isegend = counter;
571 }
572 ++counter;
573 } // Loop checking, 06.08.2015, G.Cosmo
574 }
575 else
576 {
577 // The start/end position of the divided region
578 //
579 G4double zstart = fOrigParamMother->Z_values[0] - foffset;
580 G4double zend = fOrigParamMother->Z_values[0]
581 - (foffset + fnDiv* fwidth);
582
583 G4int counter = 0;
584 while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 )
585 {
586 // first segment
587 if ( zstart <= fOrigParamMother->Z_values[counter] &&
588 zstart > fOrigParamMother->Z_values[counter+1] )
589 {
590 isegstart = counter;
591 }
592 // last segment
593 if ( zend < fOrigParamMother->Z_values[counter] &&
594 zend >= fOrigParamMother->Z_values[counter+1] )
595 {
596 isegend = counter;
597 }
598 ++counter;
599 } // Loop checking, 06.08.2015, G.Cosmo
600 }
601
602 if ( isegstart != isegend )
603 {
604 std::ostringstream message;
605 message << "Configuration not supported." << G4endl
606 << "Division with user defined width." << G4endl
607 << "Solid " << fmotherSolid->GetName() << G4endl
608 << "Divided region is not between two Z planes.";
609 G4Exception("G4ParameterisationPolyhedraZ::CheckParametersValidity()",
610 "GeomDiv0001", FatalException, message);
611 }
612
613 fNSegment = isegstart;
614 }
615}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4String GetName() const

Referenced by G4ParameterisationPolyhedraZ().

◆ ComputeDimensions()

void G4ParameterisationPolyhedraZ::ComputeDimensions ( G4Polyhedra phedra,
const G4int  copyNo,
const G4VPhysicalVolume physVol 
) const
virtual

Reimplemented from G4VPVParameterisation.

Definition at line 672 of file G4ParameterisationPolyhedra.cc.

675{
676 // Define division solid
677 //
678 G4PolyhedraHistorical origparam;
679 G4int nz = 2;
680 origparam.Num_z_planes = nz;
681 origparam.numSide = fOrigParamMother->numSide;
682 origparam.Start_angle = fOrigParamMother->Start_angle;
683 origparam.Opening_angle = fOrigParamMother->Opening_angle;
684
685 // Define division solid z sections
686 //
687 origparam.Z_values = new G4double[nz];
688 origparam.Rmin = new G4double[nz];
689 origparam.Rmax = new G4double[nz];
690 origparam.Z_values[0] = - fwidth/2.;
691 origparam.Z_values[1] = fwidth/2.;
692
693 if ( fDivisionType == DivNDIV )
694 {
695 // The position of the centre of copyNo-th mother polycone segment
696 //
697 G4double posi = ( fOrigParamMother->Z_values[copyNo]
698 + fOrigParamMother->Z_values[copyNo+1])/2;
699
700 origparam.Z_values[0] = fOrigParamMother->Z_values[copyNo] - posi;
701 origparam.Z_values[1] = fOrigParamMother->Z_values[copyNo+1] - posi;
702 origparam.Rmin[0] = fOrigParamMother->Rmin[copyNo];
703 origparam.Rmin[1] = fOrigParamMother->Rmin[copyNo+1];
704 origparam.Rmax[0] = fOrigParamMother->Rmax[copyNo];
705 origparam.Rmax[1] = fOrigParamMother->Rmax[copyNo+1];
706 }
707
709 {
710 if ( !fReflectedSolid )
711 {
712 origparam.Z_values[0] = -fwidth/2.;
713 origparam.Z_values[1] = fwidth/2.;
714
715 // The position of the centre of copyNo-th division
716 //
717 G4double posi = fOrigParamMother->Z_values[0]
718 + foffset + (2*copyNo + 1) * fwidth/2.;
719
720 // The first and last z sides z values
721 G4double zstart = posi - fwidth/2.;
722 G4double zend = posi + fwidth/2.;
723 origparam.Rmin[0] = GetRmin(zstart, fNSegment);
724 origparam.Rmax[0] = GetRmax(zstart, fNSegment);
725 origparam.Rmin[1] = GetRmin(zend, fNSegment);
726 origparam.Rmax[1] = GetRmax(zend, fNSegment);
727 }
728 else
729 {
730 origparam.Z_values[0] = fwidth/2.;
731 origparam.Z_values[1] = -fwidth/2.;
732
733 // The position of the centre of copyNo-th division
734 //
735 G4double posi = fOrigParamMother->Z_values[0]
736 - ( foffset + (2*copyNo + 1) * fwidth/2.);
737
738 // The first and last z sides z values
739 //
740 G4double zstart = posi + fwidth/2.;
741 G4double zend = posi - fwidth/2.;
742 origparam.Rmin[0] = GetRmin(zstart, fNSegment);
743 origparam.Rmax[0] = GetRmax(zstart, fNSegment);
744 origparam.Rmin[1] = GetRmin(zend, fNSegment);
745 origparam.Rmax[1] = GetRmax(zend, fNSegment);
746 }
747
748 // It can happen due to rounding errors
749 //
750 if ( origparam.Rmin[0] < 0.0 ) origparam.Rmin[0] = 0.0;
751 if ( origparam.Rmin[nz-1] < 0.0 ) origparam.Rmin[1] = 0.0;
752 }
753
754 phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers
755 phedra.Reset(); // reset to new solid parameters
756
757#ifdef G4DIVDEBUG
758 if( verbose >= 2 )
759 {
760 G4cout << "G4ParameterisationPolyhedraZ::ComputeDimensions()" << G4endl
761 << "-- Parametrised phedra copy-number: " << copyNo << G4endl;
762 phedra.DumpInfo();
763 }
764#endif
765}
void SetOriginalParameters(G4PolyhedraHistorical *pars)
G4bool Reset()
Definition: G4Polyhedra.cc:463
void DumpInfo() const

◆ ComputeTransformation()

void G4ParameterisationPolyhedraZ::ComputeTransformation ( const G4int  copyNo,
G4VPhysicalVolume physVol 
) const
virtual

Implements G4VDivisionParameterisation.

Definition at line 619 of file G4ParameterisationPolyhedra.cc.

621{
622 G4double posi;
623 if ( fDivisionType == DivNDIV )
624 {
625 // The position of the centre of copyNo-th mother polycone segment
626
627 posi = ( fOrigParamMother->Z_values[copyNo]
628 + fOrigParamMother->Z_values[copyNo+1])/2;
629 physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
630 }
631
633 {
634 // The position of the centre of copyNo-th division
635
636 posi = fOrigParamMother->Z_values[0];
637
638 if ( !fReflectedSolid )
639 posi += foffset + (2*copyNo + 1) * fwidth/2.;
640 else
641 posi -= foffset + (2*copyNo + 1) * fwidth/2.;
642
643 physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
644 }
645
646 //----- calculate rotation matrix: unit
647
648#ifdef G4DIVDEBUG
649 if( verbose >= 2 )
650 {
651 G4cout << " G4ParameterisationPolyhedraZ - position: " << posi << G4endl
652 << " copyNo: " << copyNo << " - foffset: " << foffset/CLHEP::deg
653 << " - fwidth: " << fwidth/CLHEP::deg << G4endl;
654 }
655#endif
656
657 ChangeRotMatrix( physVol );
658
659#ifdef G4DIVDEBUG
660 if( verbose >= 2 )
661 {
662 G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraZ "
663 << copyNo << G4endl
664 << " Position: (0,0,0) - Width: " << fwidth
665 << " - Axis: " << faxis << G4endl;
666 }
667#endif
668}
CLHEP::Hep3Vector G4ThreeVector
void ChangeRotMatrix(G4VPhysicalVolume *physVol, G4double rotZ=0.0) const
void SetTranslation(const G4ThreeVector &v)

◆ GetMaxParameter()

G4double G4ParameterisationPolyhedraZ::GetMaxParameter ( ) const
virtual

Implements G4VDivisionParameterisation.

Definition at line 509 of file G4ParameterisationPolyhedra.cc.

510{
511 return std::abs(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
512 -fOrigParamMother->Z_values[0]);
513}

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