Geant4 10.7.0
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 ()
 
virtual ~G4VPVParameterisation ()
 
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:35
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 671 of file G4ParameterisationPolyhedra.cc.

674{
675 // Define division solid
676 //
677 G4PolyhedraHistorical origparam;
678 G4int nz = 2;
679 origparam.Num_z_planes = nz;
680 origparam.numSide = fOrigParamMother->numSide;
681 origparam.Start_angle = fOrigParamMother->Start_angle;
682 origparam.Opening_angle = fOrigParamMother->Opening_angle;
683
684 // Define division solid z sections
685 //
686 origparam.Z_values = new G4double[nz];
687 origparam.Rmin = new G4double[nz];
688 origparam.Rmax = new G4double[nz];
689 origparam.Z_values[0] = - fwidth/2.;
690 origparam.Z_values[1] = fwidth/2.;
691
692 if ( fDivisionType == DivNDIV )
693 {
694 // The position of the centre of copyNo-th mother polycone segment
695 //
696 G4double posi = ( fOrigParamMother->Z_values[copyNo]
697 + fOrigParamMother->Z_values[copyNo+1])/2;
698
699 origparam.Z_values[0] = fOrigParamMother->Z_values[copyNo] - posi;
700 origparam.Z_values[1] = fOrigParamMother->Z_values[copyNo+1] - posi;
701 origparam.Rmin[0] = fOrigParamMother->Rmin[copyNo];
702 origparam.Rmin[1] = fOrigParamMother->Rmin[copyNo+1];
703 origparam.Rmax[0] = fOrigParamMother->Rmax[copyNo];
704 origparam.Rmax[1] = fOrigParamMother->Rmax[copyNo+1];
705 }
706
708 {
709 if ( !fReflectedSolid )
710 {
711 origparam.Z_values[0] = -fwidth/2.;
712 origparam.Z_values[1] = fwidth/2.;
713
714 // The position of the centre of copyNo-th division
715 //
716 G4double posi = fOrigParamMother->Z_values[0]
717 + foffset + (2*copyNo + 1) * fwidth/2.;
718
719 // The first and last z sides z values
720 G4double zstart = posi - fwidth/2.;
721 G4double zend = posi + fwidth/2.;
722 origparam.Rmin[0] = GetRmin(zstart, fNSegment);
723 origparam.Rmax[0] = GetRmax(zstart, fNSegment);
724 origparam.Rmin[1] = GetRmin(zend, fNSegment);
725 origparam.Rmax[1] = GetRmax(zend, fNSegment);
726 }
727 else
728 {
729 origparam.Z_values[0] = fwidth/2.;
730 origparam.Z_values[1] = -fwidth/2.;
731
732 // The position of the centre of copyNo-th division
733 //
734 G4double posi = fOrigParamMother->Z_values[0]
735 - ( foffset + (2*copyNo + 1) * fwidth/2.);
736
737 // The first and last z sides z values
738 //
739 G4double zstart = posi + fwidth/2.;
740 G4double zend = posi - fwidth/2.;
741 origparam.Rmin[0] = GetRmin(zstart, fNSegment);
742 origparam.Rmax[0] = GetRmax(zstart, fNSegment);
743 origparam.Rmin[1] = GetRmin(zend, fNSegment);
744 origparam.Rmax[1] = GetRmax(zend, fNSegment);
745 }
746
747 // It can happen due to rounding errors
748 //
749 if ( origparam.Rmin[0] < 0.0 ) origparam.Rmin[0] = 0.0;
750 if ( origparam.Rmin[nz-1] < 0.0 ) origparam.Rmin[1] = 0.0;
751 }
752
753 phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers
754 phedra.Reset(); // reset to new solid parameters
755
756#ifdef G4DIVDEBUG
757 if( verbose >= 2 )
758 {
759 G4cout << "G4ParameterisationPolyhedraZ::ComputeDimensions()" << G4endl
760 << "-- Parametrised phedra copy-number: " << copyNo << G4endl;
761 phedra.DumpInfo();
762 }
763#endif
764}
void SetOriginalParameters(G4PolyhedraHistorical *pars)
G4bool Reset()
Definition: G4Polyhedra.cc:469
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 if ( fDivisionType == DivNDIV )
623 {
624 // The position of the centre of copyNo-th mother polycone segment
625
626 G4double posi = ( fOrigParamMother->Z_values[copyNo]
627 + fOrigParamMother->Z_values[copyNo+1])/2;
628 physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
629 }
630
632 {
633 // The position of the centre of copyNo-th division
634
635 G4double posi = fOrigParamMother->Z_values[0];
636
637 if ( !fReflectedSolid )
638 posi += foffset + (2*copyNo + 1) * fwidth/2.;
639 else
640 posi -= foffset + (2*copyNo + 1) * fwidth/2.;
641
642 physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
643 }
644
645 //----- calculate rotation matrix: unit
646
647#ifdef G4DIVDEBUG
648 if( verbose >= 2 )
649 {
650 G4cout << " G4ParameterisationPolyhedraZ - position: " << posi << G4endl
651 << " copyNo: " << copyNo << " - foffset: " << foffset/deg
652 << " - fwidth: " << fwidth/deg << G4endl;
653 }
654#endif
655
656 ChangeRotMatrix( physVol );
657
658#ifdef G4DIVDEBUG
659 if( verbose >= 2 )
660 {
661 G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraZ "
662 << copyNo << G4endl
663 << " Position: " << origin << " - Width: " << fwidth
664 << " - Axis: " << faxis << G4endl;
665 }
666#endif
667}
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: