Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4ParameterisationPolyconeZ Class Reference

#include <G4ParameterisationPolycone.hh>

Inheritance diagram for G4ParameterisationPolyconeZ:
G4VParameterisationPolycone G4VDivisionParameterisation G4VPVParameterisation

Public Member Functions

 G4ParameterisationPolyconeZ (EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *motherSolid, DivisionType divType)
 
 ~G4ParameterisationPolyconeZ ()
 
void CheckParametersValidity ()
 
G4double GetMaxParameter () const
 
void ComputeTransformation (const G4int copyNo, G4VPhysicalVolume *physVol) const
 
void ComputeDimensions (G4Polycone &pcone, const G4int copyNo, const G4VPhysicalVolume *physVol) const
 
- Public Member Functions inherited from G4VParameterisationPolycone
 G4VParameterisationPolycone (EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *msolid, DivisionType divType)
 
virtual ~G4VParameterisationPolycone ()
 
- Public Member Functions inherited from G4VDivisionParameterisation
 G4VDivisionParameterisation (EAxis axis, G4int nDiv, G4double width, G4double offset, DivisionType divType, G4VSolid *motherSolid=0)
 
virtual ~G4VDivisionParameterisation ()
 
virtual G4VSolidComputeSolid (const G4int, G4VPhysicalVolume *)
 
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 G4MaterialComputeMaterial (const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
 
virtual G4bool IsNested () const
 
virtual G4VVolumeMaterialScannerGetMaterialScanner ()
 

Additional Inherited Members

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

Detailed Description

Definition at line 180 of file G4ParameterisationPolycone.hh.

Constructor & Destructor Documentation

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

Definition at line 344 of file G4ParameterisationPolycone.cc.

References G4VDivisionParameterisation::CalculateNDiv(), CheckParametersValidity(), DivNDIV, DivWIDTH, G4VDivisionParameterisation::fnDiv, G4VDivisionParameterisation::foffset, G4VDivisionParameterisation::fwidth, G4cout, G4endl, G4PolyconeHistorical::Num_z_planes, G4VDivisionParameterisation::SetType(), G4VDivisionParameterisation::verbose, and G4PolyconeHistorical::Z_values.

347  : G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType ),
348  fNSegment(0),
349  fOrigParamMother(((G4Polycone*)fmotherSolid)->GetOriginalParameters())
350 {
351 
353  SetType( "DivisionPolyconeZ" );
354 
355  if( divType == DivWIDTH )
356  {
357  fnDiv =
358  CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
359  - fOrigParamMother->Z_values[0] , width, offset );
360  }
361  else if( divType == DivNDIV )
362  {
363  fwidth =
364  CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
365  - fOrigParamMother->Z_values[0] , nDiv, offset );
366  }
367 
368 #ifdef G4DIVDEBUG
369  if( verbose >= 1 )
370  {
371  G4cout << " G4ParameterisationPolyconeZ - # divisions " << fnDiv << " = "
372  << nDiv << G4endl
373  << " Offset " << foffset << " = " << offset << G4endl
374  << " Width " << fwidth << " = " << width << G4endl;
375  }
376 #endif
377 }
void SetType(const G4String &type)
#define width
G4GLOB_DLL std::ostream G4cout
G4VParameterisationPolycone(EAxis axis, G4int nCopies, G4double offset, G4double step, G4VSolid *msolid, DivisionType divType)
G4int CalculateNDiv(G4double motherDim, G4double width, G4double offset) const
#define G4endl
Definition: G4ios.hh:61
G4ParameterisationPolyconeZ::~G4ParameterisationPolyconeZ ( )

Definition at line 380 of file G4ParameterisationPolycone.cc.

381 {
382 }

Member Function Documentation

void G4ParameterisationPolyconeZ::CheckParametersValidity ( )
virtual

Reimplemented from G4VDivisionParameterisation.

Definition at line 429 of file G4ParameterisationPolycone.cc.

References G4VDivisionParameterisation::CheckParametersValidity(), DivNDIV, DivNDIVandWIDTH, DivWIDTH, FatalException, G4VDivisionParameterisation::fDivisionType, G4VDivisionParameterisation::fmotherSolid, G4VDivisionParameterisation::fnDiv, G4VDivisionParameterisation::foffset, G4VDivisionParameterisation::fReflectedSolid, G4VDivisionParameterisation::fwidth, G4endl, G4Exception(), G4VSolid::GetName(), G4PolyconeHistorical::Num_z_planes, and G4PolyconeHistorical::Z_values.

Referenced by G4ParameterisationPolyconeZ().

430 {
432 
433  // Division will be following the mother polycone segments
434  if( fDivisionType == DivNDIV ) {
435  if( fnDiv > fOrigParamMother->Num_z_planes-1 ) {
436  std::ostringstream error;
437  error << "Configuration not supported." << G4endl
438  << "Division along Z will be done by splitting in the defined"
439  << G4endl
440  << "Z planes, i.e, the number of division would be: "
441  << fOrigParamMother->Num_z_planes-1
442  << ", instead of: " << fnDiv << " !";
443  G4Exception("G4ParameterisationPolyconeZ::CheckParametersValidity()",
444  "GeomDiv0001", FatalException, error);
445  }
446  }
447 
448  // Division will be done within one polycone segment
449  // with applying given width and offset
451  // Check if divided region does not span over more
452  // than one z segment
453 
454  G4int isegstart = -1; // number of the segment containing start position
455  G4int isegend = -1; // number of the segment containing end position
456 
457  if ( ! fReflectedSolid ) {
458  // The start/end position of the divided region
459  G4double zstart
460  = fOrigParamMother->Z_values[0] + foffset;
461  G4double zend
462  = fOrigParamMother->Z_values[0] + foffset + fnDiv* fwidth;
463 
464  G4int counter = 0;
465  while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
466  // first segment
467  if ( zstart >= fOrigParamMother->Z_values[counter] &&
468  zstart < fOrigParamMother->Z_values[counter+1] ) {
469  isegstart = counter;
470  }
471  // last segment
472  if ( zend > fOrigParamMother->Z_values[counter] &&
473  zend <= fOrigParamMother->Z_values[counter+1] ) {
474  isegend = counter;
475  }
476  ++counter;
477  }
478  }
479  else {
480  // The start/end position of the divided region
481  G4double zstart
482  = fOrigParamMother->Z_values[0] - foffset;
483  G4double zend
484  = fOrigParamMother->Z_values[0] - ( foffset + fnDiv* fwidth);
485 
486  G4int counter = 0;
487  while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
488  // first segment
489  if ( zstart <= fOrigParamMother->Z_values[counter] &&
490  zstart > fOrigParamMother->Z_values[counter+1] ) {
491  isegstart = counter;
492  }
493  // last segment
494  if ( zend < fOrigParamMother->Z_values[counter] &&
495  zend >= fOrigParamMother->Z_values[counter+1] ) {
496  isegend = counter;
497  }
498  ++counter;
499  }
500  }
501 
502 
503  if ( isegstart != isegend ) {
504  std::ostringstream message;
505  message << "Condiguration not supported." << G4endl
506  << "Division with user defined width." << G4endl
507  << "Solid " << fmotherSolid->GetName() << G4endl
508  << "Divided region is not between two z planes.";
509  G4Exception("G4ParameterisationPolyconeZ::CheckParametersValidity()",
510  "GeomDiv0001", FatalException, message);
511  }
512 
513  fNSegment = isegstart;
514  }
515 }
G4String GetName() const
int G4int
Definition: G4Types.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4ParameterisationPolyconeZ::ComputeDimensions ( G4Polycone pcone,
const G4int  copyNo,
const G4VPhysicalVolume physVol 
) const
virtual

Reimplemented from G4VPVParameterisation.

Definition at line 569 of file G4ParameterisationPolycone.cc.

References DivNDIV, DivNDIVandWIDTH, DivWIDTH, G4VSolid::DumpInfo(), G4VDivisionParameterisation::fDivisionType, G4VDivisionParameterisation::foffset, G4VDivisionParameterisation::fReflectedSolid, G4VDivisionParameterisation::fwidth, G4cout, G4endl, G4PolyconeHistorical::Num_z_planes, G4PolyconeHistorical::Opening_angle, G4Polycone::Reset(), G4PolyconeHistorical::Rmax, G4PolyconeHistorical::Rmin, G4Polycone::SetOriginalParameters(), G4PolyconeHistorical::Start_angle, G4VDivisionParameterisation::verbose, and G4PolyconeHistorical::Z_values.

571 {
572 
573  // Define division solid
574  G4PolyconeHistorical origparam;
575  G4int nz = 2;
576  origparam.Num_z_planes = nz;
577  origparam.Start_angle = fOrigParamMother->Start_angle;
578  origparam.Opening_angle = fOrigParamMother->Opening_angle;
579 
580  // Define division solid z sections
581  origparam.Z_values = new G4double[nz];
582  origparam.Rmin = new G4double[nz];
583  origparam.Rmax = new G4double[nz];
584 
585  if ( fDivisionType == DivNDIV ) {
586  // The position of the centre of copyNo-th mother polycone segment
587  G4double posi = (fOrigParamMother->Z_values[copyNo]
588  + fOrigParamMother->Z_values[copyNo+1])/2;
589 
590  origparam.Z_values[0] = fOrigParamMother->Z_values[copyNo] - posi;
591  origparam.Z_values[1] = fOrigParamMother->Z_values[copyNo+1] - posi;
592  origparam.Rmin[0] = fOrigParamMother->Rmin[copyNo];
593  origparam.Rmin[1] = fOrigParamMother->Rmin[copyNo+1];
594  origparam.Rmax[0] = fOrigParamMother->Rmax[copyNo];
595  origparam.Rmax[1] = fOrigParamMother->Rmax[copyNo+1];
596  }
597 
599  if ( ! fReflectedSolid ) {
600  origparam.Z_values[0] = - fwidth/2.;
601  origparam.Z_values[1] = fwidth/2.;
602 
603  // The position of the centre of copyNo-th division
604  G4double posi
605  = fOrigParamMother->Z_values[0] + foffset + (2*copyNo + 1) * fwidth/2.;
606 
607  // The first and last z sides z values
608  G4double zstart = posi - fwidth/2.;
609  G4double zend = posi + fwidth/2.;
610  origparam.Rmin[0] = GetRmin(zstart, fNSegment);
611  origparam.Rmax[0] = GetRmax(zstart, fNSegment);
612  origparam.Rmin[1] = GetRmin(zend, fNSegment);
613  origparam.Rmax[1] = GetRmax(zend, fNSegment);
614  }
615  else {
616  origparam.Z_values[0] = fwidth/2.;
617  origparam.Z_values[1] = - fwidth/2.;
618 
619  // The position of the centre of copyNo-th division
620  G4double posi
621  = fOrigParamMother->Z_values[0] - ( foffset + (2*copyNo + 1) * fwidth/2.);
622 
623  // The first and last z sides z values
624  G4double zstart = posi + fwidth/2.;
625  G4double zend = posi - fwidth/2.;
626  origparam.Rmin[0] = GetRmin(zstart, fNSegment);
627  origparam.Rmax[0] = GetRmax(zstart, fNSegment);
628  origparam.Rmin[1] = GetRmin(zend, fNSegment);
629  origparam.Rmax[1] = GetRmax(zend, fNSegment);
630  }
631 
632  // It can happen due to rounding errors
633  if ( origparam.Rmin[0] < 0.0 ) origparam.Rmin[0] = 0.0;
634  if ( origparam.Rmin[nz-1] < 0.0 ) origparam.Rmin[1] = 0.0;
635  }
636 
637  pcone.SetOriginalParameters(&origparam); // copy values & transfer pointers
638  pcone.Reset(); // reset to new solid parameters
639 
640 #ifdef G4DIVDEBUG
641  if( verbose >= 2 )
642  {
643  G4cout << "G4ParameterisationPolyconeZ::ComputeDimensions()" << G4endl
644  << "-- Parametrised pcone copy-number: " << copyNo << G4endl;
645  pcone.DumpInfo();
646  }
647 #endif
648 }
int G4int
Definition: G4Types.hh:78
void DumpInfo() const
G4GLOB_DLL std::ostream G4cout
void SetOriginalParameters(G4PolyconeHistorical *pars)
G4bool Reset()
Definition: G4Polycone.cc:437
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4ParameterisationPolyconeZ::ComputeTransformation ( const G4int  copyNo,
G4VPhysicalVolume physVol 
) const
virtual

Implements G4VDivisionParameterisation.

Definition at line 520 of file G4ParameterisationPolycone.cc.

References G4VDivisionParameterisation::ChangeRotMatrix(), python.hepunit::deg, DivNDIV, DivNDIVandWIDTH, DivWIDTH, G4VDivisionParameterisation::faxis, G4VDivisionParameterisation::fDivisionType, G4VDivisionParameterisation::foffset, G4VDivisionParameterisation::fReflectedSolid, G4VDivisionParameterisation::fwidth, G4cout, G4endl, G4VPhysicalVolume::SetTranslation(), G4VDivisionParameterisation::verbose, and G4PolyconeHistorical::Z_values.

521 {
522  if ( fDivisionType == DivNDIV ) {
523  // The position of the centre of copyNo-th mother polycone segment
524  G4double posi
525  = ( fOrigParamMother->Z_values[copyNo]
526  + fOrigParamMother->Z_values[copyNo+1])/2;
527  physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
528  }
529 
531  // The position of the centre of copyNo-th division
532  G4double posi = fOrigParamMother->Z_values[0];
533 
534  if ( ! fReflectedSolid )
535  posi += foffset + (2*copyNo + 1) * fwidth/2.;
536  else
537  posi -= foffset + (2*copyNo + 1) * fwidth/2.;
538 
539  physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
540  }
541 
542  //----- calculate rotation matrix: unit
543 
544 #ifdef G4DIVDEBUG
545  if( verbose >= 2 )
546  {
547  G4cout << " G4ParameterisationPolyconeZ - position: " << posi << G4endl
548  << " copyNo: " << copyNo << " - foffset: " << foffset/deg
549  << " - fwidth: " << fwidth/deg << G4endl;
550  }
551 #endif
552 
553  ChangeRotMatrix( physVol );
554 
555 #ifdef G4DIVDEBUG
556  if( verbose >= 2 )
557  {
558  G4cout << std::setprecision(8) << " G4ParameterisationPolyconeZ "
559  << copyNo << G4endl
560  << " Position: " << origin << " - Width: " << fwidth
561  << " - Axis: " << faxis << G4endl;
562  }
563 #endif
564 }
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
void ChangeRotMatrix(G4VPhysicalVolume *physVol, G4double rotZ=0.) const
void SetTranslation(const G4ThreeVector &v)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4double G4ParameterisationPolyconeZ::GetMaxParameter ( ) const
virtual

Implements G4VDivisionParameterisation.

Definition at line 422 of file G4ParameterisationPolycone.cc.

References G4PolyconeHistorical::Num_z_planes, and G4PolyconeHistorical::Z_values.

423 {
424  return std::abs (fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
425  -fOrigParamMother->Z_values[0]);
426 }

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