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

G4ParameterisationBoxZ represents the parameterised positioning equivalent to dividing a G4Box along Z axis. More...

#include <G4ParameterisationBox.hh>

Inheritance diagram for G4ParameterisationBoxZ:

Public Member Functions

 G4ParameterisationBoxZ (EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *pSolid, DivisionType divType)
 ~G4ParameterisationBoxZ () override
G4double GetMaxParameter () const override
void ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const override
void ComputeDimensions (G4Box &box, const G4int copyNo, const G4VPhysicalVolume *physVol) const override
Public Member Functions inherited from G4VParameterisationBox
 G4VParameterisationBox (EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *pSolid, DivisionType divType)
 ~G4VParameterisationBox () override
Public Member Functions inherited from G4VDivisionParameterisation
 G4VDivisionParameterisation (EAxis axis, G4int nDiv, G4double width, G4double offset, DivisionType divType, G4VSolid *motherSolid=nullptr)
 ~G4VDivisionParameterisation () override
G4VSolidComputeSolid (const G4int, G4VPhysicalVolume *pv) override
const G4StringGetType () const
EAxis GetAxis () const
G4int GetNoDiv () const
G4double GetWidth () const
G4double GetOffset () const
G4VSolidGetMotherSolid () const
void SetType (const G4String &type)
void SetHalfGap (G4double hg)
G4double GetHalfGap () const
Public Member Functions inherited from G4VPVParameterisation
 G4VPVParameterisation ()=default
virtual ~G4VPVParameterisation ()=default
virtual G4MaterialComputeMaterial (const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr)
virtual G4bool IsNested () const
virtual G4VVolumeMaterialScannerGetMaterialScanner ()

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)
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
G4double kCarTolerance
G4double fhgap = 0.0
Static Protected Attributes inherited from G4VDivisionParameterisation
static G4ThreadLocal G4RotationMatrixfRot = nullptr
static const G4int verbose = 5

Detailed Description

G4ParameterisationBoxZ represents the parameterised positioning equivalent to dividing a G4Box along Z axis.

Definition at line 231 of file G4ParameterisationBox.hh.

Constructor & Destructor Documentation

◆ G4ParameterisationBoxZ()

G4ParameterisationBoxZ::G4ParameterisationBoxZ ( EAxis axis,
G4int nCopies,
G4double offset,
G4double step,
G4VSolid * pSolid,
DivisionType divType )

Initialises a parameterised box along Z axis.

Parameters
[in]axisThe axis along which apply the parameterisation.
[in]nCopiesThe total number of divided copies.
[in]offsetPotential initial offset along the axis.
[in]stepThe width of the divided entity.
[in]pSolidPointer to the original shape to parameterise.
[in]divTypeString identifier for the kind of division.

Definition at line 267 of file G4ParameterisationBox.cc.

271 : G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
272{
274 SetType( "DivisionBoxZ" );
275
276 auto mbox = (G4Box*)(fmotherSolid);
277 if( divType == DivWIDTH )
278 {
279 fnDiv = CalculateNDiv( 2*mbox->GetZHalfLength(), width, offset );
280 }
281 else if ( divType == DivNDIV )
282 {
283 fwidth = CalculateWidth( 2*mbox->GetZHalfLength(), nDiv, offset );
284 }
285#ifdef G4DIVDEBUG
286 if( verbose >= 1 )
287 {
288 G4cout << " G4ParameterisationBoxZ - no divisions " << fnDiv << " = "
289 << nDiv << ". Offset " << foffset << " = " << offset
290 << ". Width " << fwidth << " = " << width << G4endl;
291 }
292#endif
293}
G4ThreadLocal T * G4GeomSplitter< T >::offset
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
void SetType(const G4String &type)
G4double CalculateWidth(G4double motherDim, G4int nDiv, G4double offset) const
G4int CalculateNDiv(G4double motherDim, G4double width, G4double offset) const
G4VParameterisationBox(EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *pSolid, DivisionType divType)
const axis_t axis_to_type< N >::axis
Definition pugixml.cc:9668

◆ ~G4ParameterisationBoxZ()

G4ParameterisationBoxZ::~G4ParameterisationBoxZ ( )
overridedefault

Default Destructor.

Member Function Documentation

◆ ComputeDimensions()

void G4ParameterisationBoxZ::ComputeDimensions ( G4Box & ,
const G4int ,
const G4VPhysicalVolume *  ) const
overridevirtual

Dispatch methods for the specific solids where parameterisation is allowed.

Reimplemented from G4VPVParameterisation.

Definition at line 342 of file G4ParameterisationBox.cc.

345{
346 auto msol = (G4Box*)(fmotherSolid);
347
348 G4double pDx = msol->GetXHalfLength();
349 G4double pDy = msol->GetYHalfLength();
350 G4double pDz = fwidth/2. - fhgap;
351
352 box.SetXHalfLength( pDx );
353 box.SetYHalfLength( pDy );
354 box.SetZHalfLength( pDz );
355
356#ifdef G4DIVDEBUG
357 if( verbose >= 2 )
358 {
359 G4cout << " G4ParameterisationBoxZ::ComputeDimensions()" << G4endl
360 << " pDx: " << pDz << G4endl;
361 box.DumpInfo();
362 }
363#endif
364}
double G4double
Definition G4Types.hh:83

◆ ComputeTransformation()

void G4ParameterisationBoxZ::ComputeTransformation ( const G4int copyNo,
G4VPhysicalVolume * physVol ) const
overridevirtual

Concrete methods implementing the parameterisation.

Implements G4VDivisionParameterisation.

Definition at line 307 of file G4ParameterisationBox.cc.

309{
310 auto msol = (G4Box*)(fmotherSolid );
311 G4double mdz = msol->GetZHalfLength();
312
313 //----- translation
314 G4ThreeVector origin(0.,0.,0.);
315 G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
316
317 if( faxis == kZAxis )
318 {
319 origin.setZ( posi );
320 }
321 else
322 {
323 std::ostringstream message;
324 message << "Only axes along Z are allowed ! Axis: " << faxis;
325 G4Exception("G4ParameterisationBoxZ::ComputeTransformation()",
326 "GeomDiv0002", FatalException, message);
327 }
328#ifdef G4DIVDEBUG
329 if( verbose >= 2 )
330 {
331 G4cout << std::setprecision(8) << " G4ParameterisationBoxZ: "
332 << copyNo << G4endl
333 << " Position " << origin << " Axis " << faxis << G4endl;
334 }
335#endif
336 //----- set translation
337 physVol->SetTranslation( origin );
338}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
void SetTranslation(const G4ThreeVector &v)
@ kZAxis
Definition geomdefs.hh:57

◆ GetMaxParameter()

G4double G4ParameterisationBoxZ::GetMaxParameter ( ) const
overridevirtual

Returns the max width along Z.

Returns
The maximum width of the solid to divide along the Z axis.

Implements G4VDivisionParameterisation.

Definition at line 299 of file G4ParameterisationBox.cc.

300{
301 auto msol = (G4Box*)(fmotherSolid);
302 return 2*msol->GetZHalfLength();
303}

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