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

#include <G4PVReplica.hh>

+ Inheritance diagram for G4PVReplica:

Public Member Functions

 G4PVReplica (const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0.)
 
 G4PVReplica (const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0.)
 
 G4PVReplica (__void__ &)
 
 G4PVReplica (const G4PVReplica &)=delete
 
G4PVReplicaoperator= (const G4PVReplica &)=delete
 
virtual ~G4PVReplica ()
 
virtual EVolume VolumeType () const
 
G4bool IsMany () const
 
G4bool IsReplicated () const
 
virtual G4int GetCopyNo () const
 
virtual void SetCopyNo (G4int CopyNo)
 
virtual G4bool IsParameterised () const
 
virtual G4VPVParameterisationGetParameterisation () const
 
virtual G4int GetMultiplicity () const
 
virtual void GetReplicationData (EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
 
virtual void SetRegularStructureId (G4int code)
 
G4bool IsRegularStructure () const
 
G4int GetRegularStructureId () const
 
G4int GetInstanceID () const
 
void InitialiseWorker (G4PVReplica *pMasterObject)
 
void TerminateWorker (G4PVReplica *pMasterObject)
 
- Public Member Functions inherited from G4VPhysicalVolume
 G4VPhysicalVolume (G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
 
virtual ~G4VPhysicalVolume ()
 
 G4VPhysicalVolume (const G4VPhysicalVolume &)=delete
 
G4VPhysicalVolumeoperator= (const G4VPhysicalVolume &)=delete
 
G4bool operator== (const G4VPhysicalVolume &p) const
 
G4RotationMatrixGetObjectRotation () const
 
G4RotationMatrix GetObjectRotationValue () const
 
G4ThreeVector GetObjectTranslation () const
 
const G4RotationMatrixGetFrameRotation () const
 
G4ThreeVector GetFrameTranslation () const
 
const G4ThreeVector GetTranslation () const
 
const G4RotationMatrixGetRotation () const
 
void SetTranslation (const G4ThreeVector &v)
 
G4RotationMatrixGetRotation ()
 
void SetRotation (G4RotationMatrix *)
 
G4LogicalVolumeGetLogicalVolume () const
 
void SetLogicalVolume (G4LogicalVolume *pLogical)
 
G4LogicalVolumeGetMotherLogical () const
 
void SetMotherLogical (G4LogicalVolume *pMother)
 
const G4StringGetName () const
 
void SetName (const G4String &pName)
 
virtual G4int GetMultiplicity () const
 
virtual EVolume VolumeType () const =0
 
virtual G4bool IsMany () const =0
 
virtual G4int GetCopyNo () const =0
 
virtual void SetCopyNo (G4int CopyNo)=0
 
virtual G4bool IsReplicated () const =0
 
virtual G4bool IsParameterised () const =0
 
virtual G4VPVParameterisationGetParameterisation () const =0
 
virtual void GetReplicationData (EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
 
virtual G4bool IsRegularStructure () const =0
 
virtual G4int GetRegularStructureId () const =0
 
virtual G4bool CheckOverlaps (G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
 
 G4VPhysicalVolume (__void__ &)
 
G4int GetInstanceID () const
 
EVolume DeduceVolumeType () const
 

Static Public Member Functions

static const G4PVRManagerGetSubInstanceManager ()
 
- Static Public Member Functions inherited from G4VPhysicalVolume
static const G4PVManagerGetSubInstanceManager ()
 
static void Clean ()
 

Protected Member Functions

 G4PVReplica (const G4String &pName, G4int nReplicas, EAxis pAxis, G4LogicalVolume *pLogical, G4LogicalVolume *pMotherLogical)
 
- Protected Member Functions inherited from G4VPhysicalVolume
void InitialiseWorker (G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
 
void TerminateWorker (G4VPhysicalVolume *pMasterObject)
 

Protected Attributes

EAxis faxis
 
G4int fnReplicas
 
G4double fwidth
 
G4double foffset
 
- Protected Attributes inherited from G4VPhysicalVolume
G4int instanceID
 

Additional Inherited Members

- Static Protected Attributes inherited from G4VPhysicalVolume
static G4GEOM_DLL G4PVManager subInstanceManager
 

Detailed Description

Definition at line 90 of file G4PVReplica.hh.

Constructor & Destructor Documentation

◆ G4PVReplica() [1/5]

G4PVReplica::G4PVReplica ( const G4String pName,
G4LogicalVolume pLogical,
G4LogicalVolume pMother,
const EAxis  pAxis,
const G4int  nReplicas,
const G4double  width,
const G4double  offset = 0. 
)

Definition at line 88 of file G4PVReplica.cc.

95 : G4VPhysicalVolume(nullptr, G4ThreeVector(), pName, pLogical, nullptr)
96{
97
98 instanceID = subInstanceManager.CreateSubInstance();
99
100 if (pMotherLogical == nullptr)
101 {
102 std::ostringstream message;
103 message << "NULL pointer specified as mother volume for "
104 << pName << ".";
105 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
106 FatalException, message);
107 return;
108 }
109 if (pLogical == pMotherLogical)
110 {
111 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
112 FatalException, "Cannot place a volume inside itself!");
113 return;
114 }
115
116 pMotherLogical->AddDaughter(this);
117 SetMotherLogical(pMotherLogical);
118 if (pMotherLogical->GetNoDaughters() != 1)
119 {
120 std::ostringstream message;
121 message << "Replica or parameterised volume must be the only daughter !"
122 << G4endl
123 << " Mother logical volume: " << pMotherLogical->GetName()
124 << G4endl
125 << " Replicated volume: " << pName;
126 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
127 FatalException, message);
128 return;
129 }
130 CheckAndSetParameters (pAxis, nReplicas, width, offset);
131}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
CLHEP::Hep3Vector G4ThreeVector
#define G4endl
Definition: G4ios.hh:57
G4int CreateSubInstance()
void SetMotherLogical(G4LogicalVolume *pMother)

◆ G4PVReplica() [2/5]

G4PVReplica::G4PVReplica ( const G4String pName,
G4LogicalVolume pLogical,
G4VPhysicalVolume pMother,
const EAxis  pAxis,
const G4int  nReplicas,
const G4double  width,
const G4double  offset = 0. 
)

Definition at line 43 of file G4PVReplica.cc.

50 : G4VPhysicalVolume(nullptr, G4ThreeVector(), pName, pLogical, pMother)
51{
52
53 instanceID = subInstanceManager.CreateSubInstance();
54
55 if ((pMother == nullptr) || (pMother->GetLogicalVolume() == nullptr))
56 {
57 std::ostringstream message;
58 message << "NULL pointer specified as mother volume." << G4endl
59 << "The world volume cannot be sliced or parameterised !";
60 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
61 FatalException, message);
62 return;
63 }
64 G4LogicalVolume* motherLogical = pMother->GetLogicalVolume();
65 if (pLogical == motherLogical)
66 {
67 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
68 FatalException, "Cannot place a volume inside itself!");
69 return;
70 }
71 SetMotherLogical(motherLogical);
72 motherLogical->AddDaughter(this);
73 if (motherLogical->GetNoDaughters() != 1)
74 {
75 std::ostringstream message;
76 message << "Replica or parameterised volume must be the only daughter !"
77 << G4endl
78 << " Mother physical volume: " << pMother->GetName() << G4endl
79 << " Replicated volume: " << pName;
80 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
81 FatalException, message);
82 return;
83 }
84 CheckAndSetParameters (pAxis, nReplicas, width, offset);
85}
void AddDaughter(G4VPhysicalVolume *p)
std::size_t GetNoDaughters() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const

◆ G4PVReplica() [3/5]

G4PVReplica::G4PVReplica ( __void__ &  a)

Definition at line 249 of file G4PVReplica.cc.

251{
252 instanceID = subInstanceManager.CreateSubInstance();
253}
G4double fwidth
Definition: G4PVReplica.hh:187
G4int fnReplicas
Definition: G4PVReplica.hh:186
G4double foffset
Definition: G4PVReplica.hh:187
@ kZAxis
Definition: geomdefs.hh:57

◆ G4PVReplica() [4/5]

G4PVReplica::G4PVReplica ( const G4PVReplica )
delete

◆ ~G4PVReplica()

G4PVReplica::~G4PVReplica ( )
virtual

Definition at line 256 of file G4PVReplica.cc.

257{
258}

◆ G4PVReplica() [5/5]

G4PVReplica::G4PVReplica ( const G4String pName,
G4int  nReplicas,
EAxis  pAxis,
G4LogicalVolume pLogical,
G4LogicalVolume pMotherLogical 
)
protected

Definition at line 134 of file G4PVReplica.cc.

140 : G4VPhysicalVolume(nullptr, G4ThreeVector(), pName, pLogical, nullptr)
141{
142 // Constructor for derived type(s)
143 // Does not set mother volume or register this one in mother volume
144 // ( To allow the correct type to be found in mother->AddDaughter )
145
146 instanceID = subInstanceManager.CreateSubInstance();
147
148 if (pMotherLogical == nullptr)
149 {
150 std::ostringstream message;
151 message << "NULL pointer specified as mother volume for "
152 << pName << ".";
153 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
154 FatalException, message);
155 return;
156 }
157 if (pLogical == pMotherLogical)
158 {
159 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
160 FatalException, "Cannot place a volume inside itself!");
161 return;
162 }
163 CheckOnlyDaughter(pMotherLogical);
164 /***
165 if (pMotherLogical->GetNoDaughters() != 0)
166 {
167 std::ostringstream message;
168 message << "Replica or parameterised volume must be the only daughter !"
169 << G4endl
170 << " Mother logical volume: " << pMotherLogical->GetName()
171 << G4endl
172 << " Replicated volume: " << pName;
173 G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
174 FatalException, message);
175 return;
176 }
177 **/
178 CheckAndSetParameters (pAxis, nReplicas, 0.0, 0.0);
179}

Member Function Documentation

◆ GetCopyNo()

G4int G4PVReplica::GetCopyNo ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 267 of file G4PVReplica.cc.

268{
269 return G4MT_copyNo;
270}
#define G4MT_copyNo
Definition: G4PVReplica.cc:38

◆ GetInstanceID()

G4int G4PVReplica::GetInstanceID ( ) const
inline

Definition at line 149 of file G4PVReplica.hh.

149{ return instanceID; }

◆ GetMultiplicity()

G4int G4PVReplica::GetMultiplicity ( ) const
virtual

Reimplemented from G4VPhysicalVolume.

Reimplemented in G4PVDivision, and G4ReplicatedSlice.

Definition at line 297 of file G4PVReplica.cc.

298{
299 return fnReplicas;
300}

Referenced by G4PVParameterised::CheckOverlaps(), and G4LogicalVolumeModel::DescribeYourselfTo().

◆ GetParameterisation()

G4VPVParameterisation * G4PVReplica::GetParameterisation ( ) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVDivision, G4ReplicatedSlice, and G4PVParameterised.

Definition at line 291 of file G4PVReplica.cc.

292{
293 return nullptr;
294}

◆ GetRegularStructureId()

G4int G4PVReplica::GetRegularStructureId ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 329 of file G4PVReplica.cc.

330{
331 return fRegularVolsId;
332}

◆ GetReplicationData()

void G4PVReplica::GetReplicationData ( EAxis axis,
G4int nReplicas,
G4double width,
G4double offset,
G4bool consuming 
) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVDivision, G4ReplicatedSlice, and G4PVParameterised.

Definition at line 309 of file G4PVReplica.cc.

314{
315 axis = faxis;
316 nReplicas = fnReplicas;
317 width = fwidth;
318 offset = foffset;
319 consuming = true;
320}

Referenced by G4tgbGeometryDumper::DumpPVReplica().

◆ GetSubInstanceManager()

const G4PVRManager & G4PVReplica::GetSubInstanceManager ( )
static

Definition at line 343 of file G4PVReplica.cc.

344{
345 return subInstanceManager;
346}

Referenced by G4GeometryWorkspace::G4GeometryWorkspace().

◆ InitialiseWorker()

void G4PVReplica::InitialiseWorker ( G4PVReplica pMasterObject)

Definition at line 355 of file G4PVReplica.cc.

356{
357
358 G4VPhysicalVolume::InitialiseWorker( pMasterObject, nullptr, G4ThreeVector());
359 subInstanceManager.SlaveCopySubInstanceArray();
360 G4MT_copyNo = -1;
361
362 // This call causes "self-assignment" of the input parameters
363 // Issue reported by DRD since TerminateWorker() below can be called
364 // at the same time by another thread.
365 // What we need here is the split-class component of CheckAndSetParameters()
366 // funciton copied here.
367
368 // Create rotation matrix for phi axis case & check axis is valid
369 //
370 G4RotationMatrix* pRMat = nullptr;
371 switch (faxis)
372 {
373 case kPhi:
374 pRMat = new G4RotationMatrix();
375 if (pRMat == nullptr)
376 {
377 G4Exception("G4PVReplica::InitialiseWorker(...)", "GeomVol0003",
378 FatalException, "Rotation matrix allocation failed.");
379 }
380 SetRotation(pRMat);
381 break;
382 case kRho:
383 case kXAxis:
384 case kYAxis:
385 case kZAxis:
386 case kUndefined:
387 break;
388 default:
389 G4Exception("G4PVReplica::InitialiseWorker(...)", "GeomVol0002",
390 FatalException, "Unknown axis of replication.");
391 break;
392 }
393}
CLHEP::HepRotation G4RotationMatrix
void SlaveCopySubInstanceArray()
void SetRotation(G4RotationMatrix *)
void InitialiseWorker(G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
@ kPhi
Definition: geomdefs.hh:60
@ kYAxis
Definition: geomdefs.hh:56
@ kXAxis
Definition: geomdefs.hh:55
@ kUndefined
Definition: geomdefs.hh:61
@ kRho
Definition: geomdefs.hh:58

Referenced by G4GeometryWorkspace::InitialisePhysicalVolumes().

◆ IsMany()

G4bool G4PVReplica::IsMany ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 261 of file G4PVReplica.cc.

262{
263 return false;
264}

◆ IsParameterised()

G4bool G4PVReplica::IsParameterised ( ) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVDivision, G4ReplicatedSlice, and G4PVParameterised.

Definition at line 285 of file G4PVReplica.cc.

286{
287 return false;
288}

◆ IsRegularStructure()

G4bool G4PVReplica::IsRegularStructure ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 323 of file G4PVReplica.cc.

324{
325 return (fRegularVolsId != 0);
326}

◆ IsReplicated()

G4bool G4PVReplica::IsReplicated ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 279 of file G4PVReplica.cc.

280{
281 return true;
282}

◆ operator=()

G4PVReplica & G4PVReplica::operator= ( const G4PVReplica )
delete

◆ SetCopyNo()

void G4PVReplica::SetCopyNo ( G4int  CopyNo)
virtual

Implements G4VPhysicalVolume.

Definition at line 273 of file G4PVReplica.cc.

274{
275 G4MT_copyNo = newCopyNo;
276}

◆ SetRegularStructureId()

void G4PVReplica::SetRegularStructureId ( G4int  code)
virtual

Reimplemented in G4PVParameterised.

Definition at line 335 of file G4PVReplica.cc.

336{
337 fRegularVolsId = code;
338}
Definition: inftrees.h:24

Referenced by G4PVParameterised::SetRegularStructureId().

◆ TerminateWorker()

void G4PVReplica::TerminateWorker ( G4PVReplica pMasterObject)

Definition at line 400 of file G4PVReplica.cc.

401{
402 if ( faxis==kPhi )
403 {
404 delete GetRotation();
405 }
406}
const G4RotationMatrix * GetRotation() const

Referenced by G4GeometryWorkspace::DestroyWorkspace().

◆ VolumeType()

EVolume G4PVReplica::VolumeType ( ) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVDivision, G4ReplicatedSlice, and G4PVParameterised.

Definition at line 303 of file G4PVReplica.cc.

304{
305 return kReplica;
306}
@ kReplica
Definition: geomdefs.hh:85

Member Data Documentation

◆ faxis

EAxis G4PVReplica::faxis
protected

◆ fnReplicas

G4int G4PVReplica::fnReplicas
protected

◆ foffset

G4double G4PVReplica::foffset
protected

Definition at line 187 of file G4PVReplica.hh.

Referenced by G4PVParameterised::GetReplicationData(), and GetReplicationData().

◆ fwidth

G4double G4PVReplica::fwidth
protected

Definition at line 187 of file G4PVReplica.hh.

Referenced by G4PVParameterised::GetReplicationData(), and GetReplicationData().


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