Geant4 11.2.2
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
 
 ~G4PVReplica () override
 
EVolume VolumeType () const override
 
G4bool IsMany () const override
 
G4bool IsReplicated () const override
 
G4int GetCopyNo () const override
 
void SetCopyNo (G4int CopyNo) override
 
G4bool IsParameterised () const override
 
G4VPVParameterisationGetParameterisation () const override
 
G4int GetMultiplicity () const override
 
void GetReplicationData (EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const override
 
virtual void SetRegularStructureId (G4int code)
 
G4bool IsRegularStructure () const override
 
G4int GetRegularStructureId () const override
 
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 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 89 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)
CLHEP::Hep3Vector G4ThreeVector
#define G4endl
Definition G4ios.hh:67
G4int CreateSubInstance()
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
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 248 of file G4PVReplica.cc.

250{
251 instanceID = subInstanceManager.CreateSubInstance();
252}
G4double fwidth
G4double foffset
@ kZAxis
Definition geomdefs.hh:57

◆ G4PVReplica() [4/5]

G4PVReplica::G4PVReplica ( const G4PVReplica & )
delete

◆ ~G4PVReplica()

G4PVReplica::~G4PVReplica ( )
overridedefault

◆ 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.

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

Member Function Documentation

◆ GetCopyNo()

G4int G4PVReplica::GetCopyNo ( ) const
overridevirtual

Implements G4VPhysicalVolume.

Definition at line 264 of file G4PVReplica.cc.

265{
266 return G4MT_copyNo;
267}
#define G4MT_copyNo

◆ GetInstanceID()

G4int G4PVReplica::GetInstanceID ( ) const
inline

Definition at line 148 of file G4PVReplica.hh.

148{ return instanceID; }

◆ GetMultiplicity()

G4int G4PVReplica::GetMultiplicity ( ) const
overridevirtual

Reimplemented from G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 294 of file G4PVReplica.cc.

295{
296 return fnReplicas;
297}

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

◆ GetParameterisation()

G4VPVParameterisation * G4PVReplica::GetParameterisation ( ) const
overridevirtual

Implements G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 288 of file G4PVReplica.cc.

289{
290 return nullptr;
291}

◆ GetRegularStructureId()

G4int G4PVReplica::GetRegularStructureId ( ) const
overridevirtual

Implements G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 326 of file G4PVReplica.cc.

327{
328 return fRegularVolsId;
329}

◆ GetReplicationData()

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

Implements G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 306 of file G4PVReplica.cc.

311{
312 axis = faxis;
313 nReplicas = fnReplicas;
314 width = fwidth;
315 offset = foffset;
316 consuming = true;
317}

Referenced by G4tgbGeometryDumper::DumpPVReplica().

◆ GetSubInstanceManager()

const G4PVRManager & G4PVReplica::GetSubInstanceManager ( )
static

Definition at line 340 of file G4PVReplica.cc.

341{
342 return subInstanceManager;
343}

Referenced by G4GeometryWorkspace::G4GeometryWorkspace().

◆ InitialiseWorker()

void G4PVReplica::InitialiseWorker ( G4PVReplica * pMasterObject)

Definition at line 352 of file G4PVReplica.cc.

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

◆ IsMany()

G4bool G4PVReplica::IsMany ( ) const
overridevirtual

Implements G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 258 of file G4PVReplica.cc.

259{
260 return false;
261}

◆ IsParameterised()

G4bool G4PVReplica::IsParameterised ( ) const
overridevirtual

Implements G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 282 of file G4PVReplica.cc.

283{
284 return false;
285}

◆ IsRegularStructure()

G4bool G4PVReplica::IsRegularStructure ( ) const
overridevirtual

Implements G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 320 of file G4PVReplica.cc.

321{
322 return (fRegularVolsId != 0);
323}

◆ IsReplicated()

G4bool G4PVReplica::IsReplicated ( ) const
overridevirtual

Implements G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 276 of file G4PVReplica.cc.

277{
278 return true;
279}

◆ operator=()

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

◆ SetCopyNo()

void G4PVReplica::SetCopyNo ( G4int CopyNo)
overridevirtual

Implements G4VPhysicalVolume.

Definition at line 270 of file G4PVReplica.cc.

271{
272 G4MT_copyNo = newCopyNo;
273}

◆ SetRegularStructureId()

void G4PVReplica::SetRegularStructureId ( G4int code)
virtual

Reimplemented in G4PVParameterised.

Definition at line 332 of file G4PVReplica.cc.

333{
334 fRegularVolsId = code;
335}

Referenced by G4PVParameterised::SetRegularStructureId().

◆ TerminateWorker()

void G4PVReplica::TerminateWorker ( G4PVReplica * pMasterObject)

Definition at line 397 of file G4PVReplica.cc.

398{
399 if ( faxis==kPhi )
400 {
401 delete GetRotation();
402 }
403}
const G4RotationMatrix * GetRotation() const

◆ VolumeType()

EVolume G4PVReplica::VolumeType ( ) const
overridevirtual

Implements G4VPhysicalVolume.

Reimplemented in G4ReplicatedSlice.

Definition at line 300 of file G4PVReplica.cc.

301{
302 return kReplica;
303}
@ 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 186 of file G4PVReplica.hh.

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

◆ fwidth

G4double G4PVReplica::fwidth
protected

Definition at line 186 of file G4PVReplica.hh.

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


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