Geant4 10.7.0
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 113 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 83 of file G4PVReplica.cc.

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

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

◆ G4PVReplica() [3/5]

G4PVReplica::G4PVReplica ( __void__ &  a)

Definition at line 242 of file G4PVReplica.cc.

244{
245 instanceID = subInstanceManager.CreateSubInstance();
246 G4MT_copyNo = -1;
247}
G4double fwidth
Definition: G4PVReplica.hh:208
G4int fnReplicas
Definition: G4PVReplica.hh:207
G4double foffset
Definition: G4PVReplica.hh:208
@ kZAxis
Definition: geomdefs.hh:57

◆ G4PVReplica() [4/5]

G4PVReplica::G4PVReplica ( const G4PVReplica )
delete

◆ ~G4PVReplica()

G4PVReplica::~G4PVReplica ( )
virtual

Definition at line 249 of file G4PVReplica.cc.

250{
251 if ( faxis==kPhi )
252 {
253 delete GetRotation();
254 }
255}
const G4RotationMatrix * GetRotation() const
@ kPhi
Definition: geomdefs.hh:60

◆ G4PVReplica() [5/5]

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

Definition at line 129 of file G4PVReplica.cc.

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

Member Function Documentation

◆ GetCopyNo()

G4int G4PVReplica::GetCopyNo ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 262 of file G4PVReplica.cc.

263{
264 return G4MT_copyNo;
265}

◆ GetInstanceID()

G4int G4PVReplica::GetInstanceID ( ) const
inline

Definition at line 172 of file G4PVReplica.hh.

172{ return instanceID; }

◆ GetMultiplicity()

G4int G4PVReplica::GetMultiplicity ( ) const
virtual

Reimplemented from G4VPhysicalVolume.

Definition at line 287 of file G4PVReplica.cc.

288{
289 return fnReplicas;
290}

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

◆ GetParameterisation()

G4VPVParameterisation * G4PVReplica::GetParameterisation ( ) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVParameterised.

Definition at line 282 of file G4PVReplica.cc.

283{
284 return nullptr;
285}

◆ GetRegularStructureId()

G4int G4PVReplica::GetRegularStructureId ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 315 of file G4PVReplica.cc.

316{
317 return fRegularVolsId;
318}

◆ GetReplicationData()

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

Implements G4VPhysicalVolume.

Reimplemented in G4PVParameterised.

Definition at line 297 of file G4PVReplica.cc.

302{
303 axis = faxis;
304 nReplicas = fnReplicas;
305 width = fwidth;
306 offset = foffset;
307 consuming = true;
308}

Referenced by G4tgbGeometryDumper::DumpPVReplica().

◆ GetSubInstanceManager()

const G4PVRManager & G4PVReplica::GetSubInstanceManager ( )
static

Definition at line 327 of file G4PVReplica.cc.

328{
329 return subInstanceManager;
330}

Referenced by G4GeometryWorkspace::G4GeometryWorkspace().

◆ InitialiseWorker()

void G4PVReplica::InitialiseWorker ( G4PVReplica pMasterObject)

Definition at line 338 of file G4PVReplica.cc.

339{
340
341 G4VPhysicalVolume::InitialiseWorker( pMasterObject, nullptr, G4ThreeVector());
342 subInstanceManager.SlaveCopySubInstanceArray();
343 G4MT_copyNo = -1;
344
345 // This call causes "self-assignment" of the input paramters
346 // Issue reported by DRD since TerminateWorker below can be called
347 // at the same time by another thread
348 // What we need here is the splic-class component of this funciton
349 // that is copied here
350 // CheckAndSetParameters (faxis, fnReplicas, fwidth, foffset);
351
352 // Create rotation matrix for phi axis case & check axis is valid
353 //
354 G4RotationMatrix* pRMat = nullptr;
355 switch (faxis)
356 {
357 case kPhi:
358 pRMat = new G4RotationMatrix();
359 if (pRMat == nullptr)
360 {
361 G4Exception("G4PVReplica::InitialiseWorker(...)", "GeomVol0003",
362 FatalException, "Rotation matrix allocation failed.");
363 }
364 SetRotation(pRMat);
365 break;
366 case kRho:
367 case kXAxis:
368 case kYAxis:
369 case kZAxis:
370 case kUndefined:
371 break;
372 default:
373 G4Exception("G4PVReplica::InitialiseWorker(...)", "GeomVol0002",
374 FatalException, "Unknown axis of replication.");
375 break;
376 }
377}
CLHEP::HepRotation G4RotationMatrix
void SlaveCopySubInstanceArray()
void SetRotation(G4RotationMatrix *)
void InitialiseWorker(G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
@ 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 257 of file G4PVReplica.cc.

258{
259 return false;
260}

◆ IsParameterised()

G4bool G4PVReplica::IsParameterised ( ) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVParameterised.

Definition at line 277 of file G4PVReplica.cc.

278{
279 return false;
280}

Referenced by G4GeometryWorkspace::InitialisePhysicalVolumes().

◆ IsRegularStructure()

G4bool G4PVReplica::IsRegularStructure ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 310 of file G4PVReplica.cc.

311{
312 return (fRegularVolsId != 0);
313}

◆ IsReplicated()

G4bool G4PVReplica::IsReplicated ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 272 of file G4PVReplica.cc.

273{
274 return true;
275}

◆ operator=()

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

◆ SetCopyNo()

void G4PVReplica::SetCopyNo ( G4int  CopyNo)
virtual

Implements G4VPhysicalVolume.

Definition at line 267 of file G4PVReplica.cc.

268{
269 G4MT_copyNo = newCopyNo;
270}

◆ SetRegularStructureId()

void G4PVReplica::SetRegularStructureId ( G4int  code)
virtual

Reimplemented in G4PVParameterised.

Definition at line 320 of file G4PVReplica.cc.

321{
322 fRegularVolsId = code;
323}
Definition: inftrees.h:24

Referenced by G4PVParameterised::SetRegularStructureId().

◆ TerminateWorker()

void G4PVReplica::TerminateWorker ( G4PVReplica pMasterObject)

Definition at line 383 of file G4PVReplica.cc.

384{
385 if ( faxis==kPhi )
386 {
387 delete GetRotation();
388 }
389}

Referenced by G4GeometryWorkspace::DestroyWorkspace().

◆ VolumeType()

EVolume G4PVReplica::VolumeType ( ) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVParameterised.

Definition at line 292 of file G4PVReplica.cc.

293{
294 return kReplica;
295}
@ 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 208 of file G4PVReplica.hh.

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

◆ fwidth

G4double G4PVReplica::fwidth
protected

Definition at line 208 of file G4PVReplica.hh.

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


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