Geant4  10.02.p03
G4PVReplica Class Reference

#include <G4PVReplica.hh>

Inheritance diagram for G4PVReplica:
Collaboration 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__ &)
 
virtual ~G4PVReplica ()
 
G4bool IsMany () const
 
G4bool IsReplicated () const
 
virtual G4int GetCopyNo () const
 
virtual void SetCopyNo (G4int CopyNo)
 
virtual G4bool IsParameterised () const
 
virtual G4VPVParameterisation * GetParameterisation () 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 ()
 
G4bool operator== (const G4VPhysicalVolume &p) const
 
G4RotationMatrix * GetObjectRotation () const
 
G4RotationMatrix GetObjectRotationValue () const
 
G4ThreeVector GetObjectTranslation () const
 
const G4RotationMatrix * GetFrameRotation () const
 
G4ThreeVector GetFrameTranslation () const
 
const G4ThreeVector & GetTranslation () const
 
const G4RotationMatrix * GetRotation () const
 
void SetTranslation (const G4ThreeVector &v)
 
G4RotationMatrix * GetRotation ()
 
void SetRotation (G4RotationMatrix *)
 
G4LogicalVolume * GetLogicalVolume () const
 
void SetLogicalVolume (G4LogicalVolume *pLogical)
 
G4LogicalVolume * GetMotherLogical () const
 
void SetMotherLogical (G4LogicalVolume *pMother)
 
const G4String & GetName () const
 
void SetName (const G4String &pName)
 
EVolume VolumeType () const
 
virtual G4bool CheckOverlaps (G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
 
 G4VPhysicalVolume (__void__ &)
 
G4int GetInstanceID () const
 

Static Public Member Functions

static const G4PVRManager & GetSubInstanceManager ()
 
- Static Public Member Functions inherited from G4VPhysicalVolume
static const G4PVManager & GetSubInstanceManager ()
 

Protected Attributes

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

Private Member Functions

void CheckAndSetParameters (const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset)
 
 G4PVReplica (const G4PVReplica &)
 
G4PVReplica & operator= (const G4PVReplica &)
 

Private Attributes

G4int fRegularStructureCode
 
G4int fRegularVolsId
 
G4int instanceID
 

Static Private Attributes

static G4GEOM_DLL G4PVRManager subInstanceManager
 

Additional Inherited Members

- Protected Member Functions inherited from G4VPhysicalVolume
void InitialiseWorker (G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
 
void TerminateWorker (G4VPhysicalVolume *pMasterObject)
 
- Static Protected Attributes inherited from G4VPhysicalVolume
static G4GEOM_DLL G4PVManager subInstanceManager
 

Detailed Description

Definition at line 119 of file G4PVReplica.hh.

Constructor & Destructor Documentation

◆ G4PVReplica() [1/4]

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 87 of file G4PVReplica.cc.

94  : G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fRegularVolsId(0)
95 {
96 
98  G4MT_copyNo = -1;
99 
100  if (!pMotherLogical)
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  pMotherLogical->AddDaughter(this);
116  SetMotherLogical(pMotherLogical);
117  if (pMotherLogical->GetNoDaughters() != 1)
118  {
119  std::ostringstream message;
120  message << "Replica or parameterised volume must be the only daughter !"
121  << G4endl
122  << " Mother logical volume: " << pMotherLogical->GetName()
123  << G4endl
124  << " Replicated volume: " << pName;
125  G4Exception("G4PVReplica::G4PVReplica()", "GeomVol0002",
126  FatalException, message);
127  return;
128  }
129  CheckAndSetParameters (pAxis, nReplicas, width, offset);
130 }
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
CLHEP::Hep3Vector G4ThreeVector
#define width
static G4GEOM_DLL G4PVRManager subInstanceManager
Definition: G4PVReplica.hh:210
G4int CreateSubInstance()
G4int fRegularVolsId
Definition: G4PVReplica.hh:206
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4int instanceID
Definition: G4PVReplica.hh:208
void CheckAndSetParameters(const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset)
Definition: G4PVReplica.cc:132
#define G4endl
Definition: G4ios.hh:61
void SetMotherLogical(G4LogicalVolume *pMother)
#define G4MT_copyNo
Definition: G4PVReplica.hh:117
Here is the call graph for this function:

◆ G4PVReplica() [2/4]

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 40 of file G4PVReplica.cc.

47  : G4VPhysicalVolume(0, G4ThreeVector(), pName, pLogical, pMother),
49 {
50 
52 
53  G4MT_copyNo = -1;
54 
55  if ((!pMother) || (!pMother->GetLogicalVolume()))
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 }
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
CLHEP::Hep3Vector G4ThreeVector
G4int GetNoDaughters() const
#define width
static G4GEOM_DLL G4PVRManager subInstanceManager
Definition: G4PVReplica.hh:210
G4int CreateSubInstance()
G4int fRegularVolsId
Definition: G4PVReplica.hh:206
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetName() const
G4int instanceID
Definition: G4PVReplica.hh:208
void CheckAndSetParameters(const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset)
Definition: G4PVReplica.cc:132
#define G4endl
Definition: G4ios.hh:61
void SetMotherLogical(G4LogicalVolume *pMother)
#define G4MT_copyNo
Definition: G4PVReplica.hh:117
void AddDaughter(G4VPhysicalVolume *p)
G4LogicalVolume * GetLogicalVolume() const
Here is the call graph for this function:

◆ G4PVReplica() [3/4]

G4PVReplica::G4PVReplica ( __void__ &  a)

Definition at line 179 of file G4PVReplica.cc.

182 {
184  G4MT_copyNo = -1;
185 }
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
G4double fwidth
Definition: G4PVReplica.hh:201
static G4GEOM_DLL G4PVRManager subInstanceManager
Definition: G4PVReplica.hh:210
G4int CreateSubInstance()
G4double foffset
Definition: G4PVReplica.hh:201
G4int fRegularVolsId
Definition: G4PVReplica.hh:206
G4int fnReplicas
Definition: G4PVReplica.hh:200
G4int fRegularStructureCode
Definition: G4PVReplica.hh:205
G4int instanceID
Definition: G4PVReplica.hh:208
#define G4MT_copyNo
Definition: G4PVReplica.hh:117
Here is the call graph for this function:

◆ ~G4PVReplica()

G4PVReplica::~G4PVReplica ( )
virtual

Definition at line 187 of file G4PVReplica.cc.

188 {
189  if ( faxis==kPhi )
190  {
191  delete GetRotation();
192  }
193 }
Definition: geomdefs.hh:54
const G4RotationMatrix * GetRotation() const
Here is the call graph for this function:

◆ G4PVReplica() [4/4]

G4PVReplica::G4PVReplica ( const G4PVReplica &  )
private

Member Function Documentation

◆ CheckAndSetParameters()

void G4PVReplica::CheckAndSetParameters ( const EAxis  pAxis,
const G4int  nReplicas,
const G4double  width,
const G4double  offset 
)
private

Definition at line 132 of file G4PVReplica.cc.

136 {
137  if (nReplicas<1)
138  {
139  G4Exception("G4PVReplica::CheckAndSetParameters()", "GeomVol0002",
140  FatalException, "Illegal number of replicas.");
141  }
142  fnReplicas=nReplicas;
143  if (width<0)
144  {
145  G4Exception("G4PVReplica::CheckAndSetParameters()", "GeomVol0002",
146  FatalException, "Width must be positive.");
147  }
148  fwidth = width;
149  foffset = offset;
150  faxis = pAxis;
151 
152  // Create rotation matrix for phi axis case & check axis is valid
153  //
154  G4RotationMatrix* pRMat=0;
155  switch (faxis)
156  {
157  case kPhi:
158  pRMat=new G4RotationMatrix();
159  if (!pRMat)
160  {
161  G4Exception("G4PVReplica::CheckAndSetParameters()", "GeomVol0003",
162  FatalException, "Rotation matrix allocation failed.");
163  }
164  SetRotation(pRMat);
165  break;
166  case kRho:
167  case kXAxis:
168  case kYAxis:
169  case kZAxis:
170  case kUndefined:
171  break;
172  default:
173  G4Exception("G4PVReplica::CheckAndSetParameters()", "GeomVol0002",
174  FatalException, "Unknown axis of replication.");
175  break;
176  }
177 }
Definition: geomdefs.hh:54
CLHEP::HepRotation G4RotationMatrix
#define width
G4double fwidth
Definition: G4PVReplica.hh:201
void SetRotation(G4RotationMatrix *)
G4double foffset
Definition: G4PVReplica.hh:201
G4int fnReplicas
Definition: G4PVReplica.hh:200
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Definition: geomdefs.hh:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCopyNo()

G4int G4PVReplica::GetCopyNo ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 200 of file G4PVReplica.cc.

201 {
202  return G4MT_copyNo;
203 }
#define G4MT_copyNo
Definition: G4PVReplica.hh:117

◆ GetInstanceID()

G4int G4PVReplica::GetInstanceID ( ) const
inline

Definition at line 176 of file G4PVReplica.hh.

176 { return instanceID; }
G4int instanceID
Definition: G4PVReplica.hh:208

◆ GetMultiplicity()

G4int G4PVReplica::GetMultiplicity ( ) const
virtual

Reimplemented from G4VPhysicalVolume.

Definition at line 225 of file G4PVReplica.cc.

226 {
227  return fnReplicas;
228 }
G4int fnReplicas
Definition: G4PVReplica.hh:200
Here is the caller graph for this function:

◆ GetParameterisation()

G4VPVParameterisation * G4PVReplica::GetParameterisation ( ) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVParameterised.

Definition at line 220 of file G4PVReplica.cc.

221 {
222  return 0;
223 }

◆ GetRegularStructureId()

G4int G4PVReplica::GetRegularStructureId ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 248 of file G4PVReplica.cc.

249 {
250  return fRegularVolsId;
251 }
G4int fRegularVolsId
Definition: G4PVReplica.hh:206

◆ GetReplicationData()

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

Implements G4VPhysicalVolume.

Reimplemented in G4PVParameterised.

Definition at line 230 of file G4PVReplica.cc.

235 {
236  axis = faxis;
237  nReplicas = fnReplicas;
238  width = fwidth;
239  offset = foffset;
240  consuming = true;
241 }
#define width
G4double fwidth
Definition: G4PVReplica.hh:201
G4double foffset
Definition: G4PVReplica.hh:201
G4int fnReplicas
Definition: G4PVReplica.hh:200
Here is the caller graph for this function:

◆ GetSubInstanceManager()

const G4PVRManager & G4PVReplica::GetSubInstanceManager ( )
static

Definition at line 260 of file G4PVReplica.cc.

261 {
262  return subInstanceManager;
263 }
static G4GEOM_DLL G4PVRManager subInstanceManager
Definition: G4PVReplica.hh:210
Here is the caller graph for this function:

◆ InitialiseWorker()

void G4PVReplica::InitialiseWorker ( G4PVReplica *  pMasterObject)

Definition at line 271 of file G4PVReplica.cc.

272 {
273 
276  G4MT_copyNo = -1;
277 
278  // This call causes "self-assignment" of the input paramters
279  // Issue reported by DRD since TerminateWorker below can be called
280  // at the same time by another thread
281  // What we need here is the splic-class component of this funciton
282  // that is copied here
283  // CheckAndSetParameters (faxis, fnReplicas, fwidth, foffset);
284 
285  // Create rotation matrix for phi axis case & check axis is valid
286  //
287  G4RotationMatrix* pRMat=0;
288  switch (faxis)
289  {
290  case kPhi:
291  pRMat=new G4RotationMatrix();
292  if (!pRMat)
293  {
294  G4Exception("G4PVReplica::InitialiseWorker(...)", "GeomVol0003",
295  FatalException, "Rotation matrix allocation failed.");
296  }
297  SetRotation(pRMat);
298  break;
299  case kRho:
300  case kXAxis:
301  case kYAxis:
302  case kZAxis:
303  case kUndefined:
304  break;
305  default:
306  G4Exception("G4PVReplica::InitialiseWorker(...)", "GeomVol0002",
307  FatalException, "Unknown axis of replication.");
308  break;
309  }
310 }
Definition: geomdefs.hh:54
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
static G4GEOM_DLL G4PVRManager subInstanceManager
Definition: G4PVReplica.hh:210
void SetRotation(G4RotationMatrix *)
void InitialiseWorker(G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
void SlaveCopySubInstanceArray()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Definition: geomdefs.hh:54
#define G4MT_copyNo
Definition: G4PVReplica.hh:117
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsMany()

G4bool G4PVReplica::IsMany ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 195 of file G4PVReplica.cc.

196 {
197  return false;
198 }

◆ IsParameterised()

G4bool G4PVReplica::IsParameterised ( ) const
virtual

Implements G4VPhysicalVolume.

Reimplemented in G4PVParameterised.

Definition at line 215 of file G4PVReplica.cc.

216 {
217  return false;
218 }
Here is the caller graph for this function:

◆ IsRegularStructure()

G4bool G4PVReplica::IsRegularStructure ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 243 of file G4PVReplica.cc.

244 {
245  return (fRegularVolsId!=0);
246 }
G4int fRegularVolsId
Definition: G4PVReplica.hh:206

◆ IsReplicated()

G4bool G4PVReplica::IsReplicated ( ) const
virtual

Implements G4VPhysicalVolume.

Definition at line 210 of file G4PVReplica.cc.

211 {
212  return true;
213 }

◆ operator=()

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

◆ SetCopyNo()

void G4PVReplica::SetCopyNo ( G4int  CopyNo)
virtual

Implements G4VPhysicalVolume.

Definition at line 205 of file G4PVReplica.cc.

206 {
207  G4MT_copyNo = newCopyNo;
208 }
#define G4MT_copyNo
Definition: G4PVReplica.hh:117

◆ SetRegularStructureId()

void G4PVReplica::SetRegularStructureId ( G4int  Code)
virtual

Reimplemented in G4PVParameterised.

Definition at line 253 of file G4PVReplica.cc.

254 {
256 }
G4int fRegularVolsId
Definition: G4PVReplica.hh:206
#define Code
Definition: deflate.h:77
Here is the caller graph for this function:

◆ TerminateWorker()

void G4PVReplica::TerminateWorker ( G4PVReplica *  pMasterObject)

Definition at line 316 of file G4PVReplica.cc.

317 {
318  if ( faxis==kPhi )
319  {
320  delete GetRotation();
321  }
322 }
Definition: geomdefs.hh:54
const G4RotationMatrix * GetRotation() const
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ faxis

EAxis G4PVReplica::faxis
protected

Definition at line 199 of file G4PVReplica.hh.

◆ fnReplicas

G4int G4PVReplica::fnReplicas
protected

Definition at line 200 of file G4PVReplica.hh.

◆ foffset

G4double G4PVReplica::foffset
protected

Definition at line 201 of file G4PVReplica.hh.

◆ fRegularStructureCode

G4int G4PVReplica::fRegularStructureCode
private

Definition at line 205 of file G4PVReplica.hh.

◆ fRegularVolsId

G4int G4PVReplica::fRegularVolsId
private

Definition at line 206 of file G4PVReplica.hh.

◆ fwidth

G4double G4PVReplica::fwidth
protected

Definition at line 201 of file G4PVReplica.hh.

◆ instanceID

G4int G4PVReplica::instanceID
private

Definition at line 208 of file G4PVReplica.hh.

◆ subInstanceManager

G4PVRManager G4PVReplica::subInstanceManager
staticprivate

Definition at line 210 of file G4PVReplica.hh.


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