Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ParameterisationPolyconeZ Class Reference

#include <G4ParameterisationPolycone.hh>

Inheritance diagram for G4ParameterisationPolyconeZ:
Collaboration diagram for G4ParameterisationPolyconeZ:

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
G4RotationMatrix
fRot = 0
 
static const 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 352 of file G4ParameterisationPolycone.cc.

355  : G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType ),
356  fNSegment(0),
357  fOrigParamMother(((G4Polycone*)fmotherSolid)->GetOriginalParameters())
358 {
359 
361  SetType( "DivisionPolyconeZ" );
362 
363  if( divType == DivWIDTH )
364  {
365  fnDiv =
366  CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
367  - fOrigParamMother->Z_values[0] , width, offset );
368  }
369  else if( divType == DivNDIV )
370  {
371  fwidth =
372  CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
373  - fOrigParamMother->Z_values[0] , nDiv, offset );
374  }
375 
376 #ifdef G4DIVDEBUG
377  if( verbose >= 1 )
378  {
379  G4cout << " G4ParameterisationPolyconeZ - # divisions " << fnDiv << " = "
380  << nDiv << G4endl
381  << " Offset " << foffset << " = " << offset << G4endl
382  << " Width " << fwidth << " = " << width << G4endl;
383  }
384 #endif
385 }
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

Here is the call graph for this function:

G4ParameterisationPolyconeZ::~G4ParameterisationPolyconeZ ( )

Definition at line 388 of file G4ParameterisationPolycone.cc.

389 {
390 }

Member Function Documentation

void G4ParameterisationPolyconeZ::CheckParametersValidity ( )
virtual

Reimplemented from G4VDivisionParameterisation.

Definition at line 437 of file G4ParameterisationPolycone.cc.

438 {
440 
441  // Division will be following the mother polycone segments
442  if( fDivisionType == DivNDIV ) {
443  if( fnDiv > fOrigParamMother->Num_z_planes-1 ) {
444  std::ostringstream error;
445  error << "Configuration not supported." << G4endl
446  << "Division along Z will be done by splitting in the defined"
447  << G4endl
448  << "Z planes, i.e, the number of division would be: "
449  << fOrigParamMother->Num_z_planes-1
450  << ", instead of: " << fnDiv << " !";
451  G4Exception("G4ParameterisationPolyconeZ::CheckParametersValidity()",
452  "GeomDiv0001", FatalException, error);
453  }
454  }
455 
456  // Division will be done within one polycone segment
457  // with applying given width and offset
459  // Check if divided region does not span over more
460  // than one z segment
461 
462  G4int isegstart = -1; // number of the segment containing start position
463  G4int isegend = -1; // number of the segment containing end position
464 
465  if ( ! fReflectedSolid ) {
466  // The start/end position of the divided region
467  G4double zstart
468  = fOrigParamMother->Z_values[0] + foffset;
469  G4double zend
470  = fOrigParamMother->Z_values[0] + foffset + fnDiv* fwidth;
471 
472  G4int counter = 0;
473  while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
474  // first segment
475  if ( zstart >= fOrigParamMother->Z_values[counter] &&
476  zstart < fOrigParamMother->Z_values[counter+1] ) {
477  isegstart = counter;
478  }
479  // last segment
480  if ( zend > fOrigParamMother->Z_values[counter] &&
481  zend <= fOrigParamMother->Z_values[counter+1] ) {
482  isegend = counter;
483  }
484  ++counter;
485  } // Loop checking, 06.08.2015, G.Cosmo
486  }
487  else {
488  // The start/end position of the divided region
489  G4double zstart
490  = fOrigParamMother->Z_values[0] - foffset;
491  G4double zend
492  = fOrigParamMother->Z_values[0] - ( foffset + fnDiv* fwidth);
493 
494  G4int counter = 0;
495  while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
496  // first segment
497  if ( zstart <= fOrigParamMother->Z_values[counter] &&
498  zstart > fOrigParamMother->Z_values[counter+1] ) {
499  isegstart = counter;
500  }
501  // last segment
502  if ( zend < fOrigParamMother->Z_values[counter] &&
503  zend >= fOrigParamMother->Z_values[counter+1] ) {
504  isegend = counter;
505  }
506  ++counter;
507  } // Loop checking, 06.08.2015, G.Cosmo
508  }
509 
510 
511  if ( isegstart != isegend ) {
512  std::ostringstream message;
513  message << "Condiguration not supported." << G4endl
514  << "Division with user defined width." << G4endl
515  << "Solid " << fmotherSolid->GetName() << G4endl
516  << "Divided region is not between two z planes.";
517  G4Exception("G4ParameterisationPolyconeZ::CheckParametersValidity()",
518  "GeomDiv0001", FatalException, message);
519  }
520 
521  fNSegment = isegstart;
522  }
523 }
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
static PROLOG_HANDLER error
Definition: xmlrole.cc:112
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ParameterisationPolyconeZ::ComputeDimensions ( G4Polycone pcone,
const G4int  copyNo,
const G4VPhysicalVolume physVol 
) const
virtual

Reimplemented from G4VPVParameterisation.

Definition at line 577 of file G4ParameterisationPolycone.cc.

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

Here is the call graph for this function:

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

Implements G4VDivisionParameterisation.

Definition at line 528 of file G4ParameterisationPolycone.cc.

529 {
530  if ( fDivisionType == DivNDIV ) {
531  // The position of the centre of copyNo-th mother polycone segment
532  G4double posi
533  = ( fOrigParamMother->Z_values[copyNo]
534  + fOrigParamMother->Z_values[copyNo+1])/2;
535  physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
536  }
537 
539  // The position of the centre of copyNo-th division
540  G4double posi = fOrigParamMother->Z_values[0];
541 
542  if ( ! fReflectedSolid )
543  posi += foffset + (2*copyNo + 1) * fwidth/2.;
544  else
545  posi -= foffset + (2*copyNo + 1) * fwidth/2.;
546 
547  physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
548  }
549 
550  //----- calculate rotation matrix: unit
551 
552 #ifdef G4DIVDEBUG
553  if( verbose >= 2 )
554  {
555  G4cout << " G4ParameterisationPolyconeZ - position: " << posi << G4endl
556  << " copyNo: " << copyNo << " - foffset: " << foffset/deg
557  << " - fwidth: " << fwidth/deg << G4endl;
558  }
559 #endif
560 
561  ChangeRotMatrix( physVol );
562 
563 #ifdef G4DIVDEBUG
564  if( verbose >= 2 )
565  {
566  G4cout << std::setprecision(8) << " G4ParameterisationPolyconeZ "
567  << copyNo << G4endl
568  << " Position: " << origin << " - Width: " << fwidth
569  << " - Axis: " << faxis << G4endl;
570  }
571 #endif
572 }
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
static constexpr double deg
Definition: G4SIunits.hh:152

Here is the call graph for this function:

G4double G4ParameterisationPolyconeZ::GetMaxParameter ( ) const
virtual

Implements G4VDivisionParameterisation.

Definition at line 430 of file G4ParameterisationPolycone.cc.

431 {
432  return std::abs (fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
433  -fOrigParamMother->Z_values[0]);
434 }

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