Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PVReplica.hh File Reference

Go to the source code of this file.

Classes

class  G4ReplicaData

Typedefs

using G4PVRManager = G4GeomSplitter<G4ReplicaData>

Functions

 G4PVReplica (const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0.)
 G4PVReplica represents many touchable detector elements differing only in their positioning. The elements' positions are calculated by means of a simple linear formula, and the elements completely fill the containing mother volume.
 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=default
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)
 G4PVReplica (const G4String &pName, G4int nReplicas, EAxis pAxis, G4LogicalVolume *pLogical, G4LogicalVolume *pMotherLogical)

Variables

EAxis faxis
G4int fnReplicas
G4double fwidth
G4double foffset

Typedef Documentation

◆ G4PVRManager

Implementation detail for use of G4ReplicaData objects.

Definition at line 61 of file G4PVReplica.hh.

Function Documentation

◆ G4PVReplica() [1/5]

G4PVReplica::G4PVReplica ( __void__ & a)

Fake default constructor for usage restricted to direct object persistency for clients requiring preallocation of memory for persistifiable objects.

Definition at line 249 of file G4PVReplica.cc.

251{
252 instanceID = subInstanceManager.CreateSubInstance();
253}
EAxis faxis
G4int fnReplicas
G4double fwidth
G4double foffset
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
@ kZAxis
Definition geomdefs.hh:57

◆ G4PVReplica() [2/5]

G4PVReplica ( const G4PVReplica & )
delete

Copy constructor and assignment operator not allowed.

◆ G4PVReplica() [3/5]

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

Constructor for derived type(s): PVParameterised, PVDivision, ... Does not set mother or register in mother volume – leaves it to derived type.

Definition at line 135 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}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector

◆ G4PVReplica() [4/5]

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

G4PVReplica represents many touchable detector elements differing only in their positioning. The elements' positions are calculated by means of a simple linear formula, and the elements completely fill the containing mother volume.

Replication may occur along:

o Cartesian axes (kXAxis,kYAxis,kZAxis)

The replications, of specified width have coordinates of form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1 for the case of kXAxis, and are unrotated.

o Radial axis (cylindrical polar) (kRho)

The replications are cons/tubs sections, centred on the origin and are unrotated. They have radii of width*n+offset to width*(n+1)+offset where n=0..nReplicas-1

o Phi axis (cylindrical polar) (kPhi) The replications are `phi sections' or wedges, and of cons/tubs form They have phi of offset+n*width to offset+(n+1)*width where n=0..nReplicas-1 */

class G4PVReplica : public G4VPhysicalVolume { public:

/** Replicates the volume 'nReplicas' times along the specified axis within the mother volume 'pMother' and filling completely the mother.

Parameters
[in]pNameThe volume name.
[in]pLogicalPointer to the logical volume of the replica.
[in]pMotherPointer to the logical volume of the mother.
[in]pAxisThe axis along which do the replication.
[in]nReplicasThe number of copies to replicate.
[in]widthThe witdh of the replicated object along the axis.
[in]offsetThe optional offset distance from mother's border.

Definition at line 89 of file G4PVReplica.cc.

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

Referenced by G4tgbVolume::ConstructG4PhysVol(), G3Division::CreatePVReplica(), G4PVDivision(), G4PVDivision(), G4PVDivision(), G4PVDivision(), G4PVReplica(), G4ReplicatedSlice(), G4ReplicatedSlice(), G4ReplicatedSlice(), G4ReplicatedSlice(), G4ReplicatedSlice(), G4ReplicatedSlice(), InitialiseWorker(), operator=(), G4ReflectionFactory::Replicate(), G4ScoringBox::SetupGeometry(), G4ScoringCylinder::SetupGeometry(), and TerminateWorker().

◆ G4PVReplica() [5/5]

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

Similar to the constructor above, except for the mother pointer's type being here a G4VPhysicalVolume.

Parameters
[in]pNameThe volume name.
[in]pLogicalPointer to the logical volume of the replica.
[in]pMotherPointer to the physical volume of the mother.
[in]pAxisThe axis along which do the replication.
[in]nReplicasThe number of copies to replicate.
[in]widthThe witdh of the replicated object along the axis.
[in]offsetThe optional offset distance from mother's border.

Definition at line 44 of file G4PVReplica.cc.

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

◆ GetCopyNo()

G4int GetCopyNo ( ) const
override

Accessor/modifier for optional handling of the copy-number.

Referenced by G4PhysicalVolumeModel::G4PhysicalVolumeModel(), and G4PhysicalVolumeModel::GetCurrentTag().

◆ GetInstanceID()

G4int GetInstanceID ( ) const
inline

Returns the MT instance ID.

Definition at line 216 of file G4PVReplica.hh.

216{ return instanceID; }

◆ GetMultiplicity()

G4int GetMultiplicity ( ) const
override

Returns the number of replications.

◆ GetParameterisation()

G4VPVParameterisation * GetParameterisation ( ) const
override

◆ GetRegularStructureId()

G4int GetRegularStructureId ( ) const
override

◆ GetReplicationData()

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

Fills arguments with the attributes from the base replica.

Parameters
[in,out]axisAxis of parameterisation returned.
[in,out]nReplicasThe number of replica copies.
[in,out]widthWidth of the replica object.
[in,out]offsetPotential offset in replication.
[in,out]consumingFlag of replica characterisation (always true for pure replicas).

◆ InitialiseWorker()

void InitialiseWorker ( G4PVReplica * pMasterObject)

This method is similar to the constructor. It is used by each worker thread to achieve the partial effect as that of the master thread.

◆ IsMany()

G4bool IsMany ( ) const
override

Not used.

◆ IsParameterised()

G4bool IsParameterised ( ) const
override

Returns false and nullptr.

◆ IsRegularStructure()

G4bool IsRegularStructure ( ) const
override

Accessors for specialised geometries.

◆ IsReplicated()

G4bool IsReplicated ( ) const
override

Returns true.

◆ operator=()

G4PVReplica & operator= ( const G4PVReplica & )
delete

◆ SetCopyNo()

◆ SetRegularStructureId()

virtual void SetRegularStructureId ( G4int code)
virtual

Sets a unique code for each type of regular structure.

Note
It must be called only during detector construction. It can also be used to prepare any corresponding special navigation 'conditions'.

◆ TerminateWorker()

void TerminateWorker ( G4PVReplica * pMasterObject)

This method is similar to the destructor. It is used by each worker thread to achieve the partial effect as that of the master thread.

◆ VolumeType()

EVolume VolumeType ( ) const
override

Returns the volume type characterisation.

◆ ~G4PVReplica()

~G4PVReplica ( )
overridedefault

Default Destructor.

Variable Documentation

◆ faxis

EAxis faxis
protected

Definition at line 264 of file G4PVReplica.hh.

◆ fnReplicas

G4int fnReplicas
protected

Definition at line 265 of file G4PVReplica.hh.

◆ foffset

G4double foffset
protected

Definition at line 266 of file G4PVReplica.hh.

◆ fwidth

G4double fwidth
protected

Definition at line 266 of file G4PVReplica.hh.