Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4PVParameterised Class Reference

#include <G4PVParameterised.hh>

Inheritance diagram for G4PVParameterised:
Collaboration diagram for G4PVParameterised:

Public Member Functions

 G4PVParameterised (const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMotherLogical, const EAxis pAxis, const G4int nReplicas, G4VPVParameterisation *pParam, G4bool pSurfChk=false)
 
 G4PVParameterised (const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, G4VPVParameterisation *pParam, G4bool pSurfChk=false)
 
 G4PVParameterised (__void__ &)
 
virtual ~G4PVParameterised ()
 
G4bool IsParameterised () const
 
G4VPVParameterisationGetParameterisation () const
 
void GetReplicationData (EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
 
virtual void SetRegularStructureId (G4int Code)
 
G4bool CheckOverlaps (G4int res=1000, G4double tol=0., G4bool verbose=true, G4int maxErr=1)
 
- Public Member Functions inherited from G4PVReplica
 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 G4int GetMultiplicity () const
 
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
 
G4RotationMatrixGetObjectRotation () const
 
G4RotationMatrix GetObjectRotationValue () const
 
G4ThreeVector GetObjectTranslation () const
 
const G4RotationMatrixGetFrameRotation () const
 
G4ThreeVector GetFrameTranslation () const
 
const G4ThreeVectorGetTranslation () 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)
 
EVolume VolumeType () const
 
 G4VPhysicalVolume (__void__ &)
 
G4int GetInstanceID () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4PVReplica
static const G4PVRManagerGetSubInstanceManager ()
 
- Static Public Member Functions inherited from G4VPhysicalVolume
static const G4PVManagerGetSubInstanceManager ()
 
- Protected Member Functions inherited from G4VPhysicalVolume
void InitialiseWorker (G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
 
void TerminateWorker (G4VPhysicalVolume *pMasterObject)
 
- Protected Attributes inherited from G4PVReplica
EAxis faxis
 
G4int fnReplicas
 
G4double fwidth
 
G4double foffset
 
- Protected Attributes inherited from G4VPhysicalVolume
G4int instanceID
 
- Static Protected Attributes inherited from G4VPhysicalVolume
static G4GEOM_DLL G4PVManager subInstanceManager
 

Detailed Description

Definition at line 47 of file G4PVParameterised.hh.

Constructor & Destructor Documentation

G4PVParameterised::G4PVParameterised ( const G4String pName,
G4LogicalVolume pLogical,
G4LogicalVolume pMotherLogical,
const EAxis  pAxis,
const G4int  nReplicas,
G4VPVParameterisation pParam,
G4bool  pSurfChk = false 
)

Definition at line 78 of file G4PVParameterised.cc.

85  : G4PVReplica(pName, pLogical, pMotherLogical, pAxis, nReplicas, 0, 0),
86  fparam(pParam)
87 {
88  if (pSurfChk) { CheckOverlaps(); }
89 }
G4PVReplica(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0)
Definition: G4PVReplica.cc:87
G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int maxErr=1)

Here is the call graph for this function:

G4PVParameterised::G4PVParameterised ( const G4String pName,
G4LogicalVolume pLogical,
G4VPhysicalVolume pMother,
const EAxis  pAxis,
const G4int  nReplicas,
G4VPVParameterisation pParam,
G4bool  pSurfChk = false 
)

Definition at line 46 of file G4PVParameterised.cc.

53  : G4PVReplica(pName, pLogical, pMother, pAxis, nReplicas, 0, 0),
54  fparam(pParam)
55 {
56 #ifdef G4VERBOSE
57  if ((pMother) && (pMother->IsParameterised()))
58  {
59  std::ostringstream message, hint;
60  message << "A parameterised volume is being placed" << G4endl
61  << "inside another parameterised volume !";
62  hint << "To make sure that no overlaps are generated," << G4endl
63  << "you should verify the mother replicated shapes" << G4endl
64  << "are of the same type and dimensions." << G4endl
65  << " Mother physical volume: " << pMother->GetName() << G4endl
66  << " Parameterised volume: " << pName << G4endl
67  << " (To switch this warning off, compile with G4_NO_VERBOSE)";
68  G4Exception("G4PVParameterised::G4PVParameterised()", "GeomVol1002",
69  JustWarning, message, G4String(hint.str()));
70  }
71 #endif
72  if (pSurfChk) { CheckOverlaps(); }
73 }
G4PVReplica(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0)
Definition: G4PVReplica.cc:87
const G4String & GetName() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4bool IsParameterised() const =0
G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int maxErr=1)
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

G4PVParameterised::G4PVParameterised ( __void__ &  a)

Definition at line 95 of file G4PVParameterised.cc.

96  : G4PVReplica(a), fparam(0)
97 {
98 }
G4PVReplica(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0)
Definition: G4PVReplica.cc:87
G4PVParameterised::~G4PVParameterised ( )
virtual

Definition at line 103 of file G4PVParameterised.cc.

104 {
105 }

Member Function Documentation

G4bool G4PVParameterised::CheckOverlaps ( G4int  res = 1000,
G4double  tol = 0.,
G4bool  verbose = true,
G4int  maxErr = 1 
)
virtual

Reimplemented from G4VPhysicalVolume.

Definition at line 154 of file G4PVParameterised.cc.

156 {
157  if (res<=0) { return false; }
158 
159  G4int trials = 0;
160  G4bool retval = false;
161  G4VSolid *solidA = 0, *solidB = 0;
162  G4LogicalVolume *motherLog = GetMotherLogical();
163  G4VSolid *motherSolid = motherLog->GetSolid();
164  std::vector<G4ThreeVector> points;
165 
166  if (verbose)
167  {
168  G4cout << "Checking overlaps for parameterised volume "
169  << GetName() << " ... ";
170  }
171 
172  for (G4int i=0; i<GetMultiplicity(); i++)
173  {
174  solidA = fparam->ComputeSolid(i, this);
175  solidA->ComputeDimensions(fparam, i, this);
176  fparam->ComputeTransformation(i, this);
177 
178  // Create the transformation from daughter to mother
179  //
181 
182  // Generate random points on surface according to the given resolution,
183  // transform them to the mother's coordinate system and if no overlaps
184  // with the mother volume, cache them in a vector for later use with
185  // the daughters
186  //
187  for (G4int n=0; n<res; n++)
188  {
189  G4ThreeVector mp = Tm.TransformPoint(solidA->GetPointOnSurface());
190 
191  // Checking overlaps with the mother volume
192  //
193  if (motherSolid->Inside(mp)==kOutside)
194  {
195  G4double distin = motherSolid->DistanceToIn(mp);
196  if (distin > tol)
197  {
198  trials++; retval = true;
199  std::ostringstream message;
200  message << "Overlap with mother volume !" << G4endl
201  << " Overlap is detected for volume "
202  << GetName() << ", parameterised instance: " << i << G4endl
203  << " with its mother volume "
204  << motherLog->GetName() << G4endl
205  << " at mother local point " << mp << ", "
206  << "overlapping by at least: "
207  << G4BestUnit(distin, "Length");
208  if (trials>=maxErr)
209  {
210  message << G4endl
211  << "NOTE: Reached maximum fixed number -" << maxErr
212  << "- of overlaps reports for this volume !";
213  }
214  G4Exception("G4PVParameterised::CheckOverlaps()",
215  "GeomVol1002", JustWarning, message);
216  if (trials>=maxErr) { return true; }
217  }
218  }
219  points.push_back(mp);
220  }
221 
222  // Checking overlaps with each other parameterised instance
223  //
224  std::vector<G4ThreeVector>::iterator pos;
225  for (G4int j=i+1; j<GetMultiplicity(); j++)
226  {
227  solidB = fparam->ComputeSolid(j,this);
228  solidB->ComputeDimensions(fparam, j, this);
229  fparam->ComputeTransformation(j, this);
230 
231  // Create the transformation for daughter volume
232  //
234 
235  for (pos=points.begin(); pos!=points.end(); pos++)
236  {
237  // Transform each point according to daughter's frame
238  //
239  G4ThreeVector md = Td.Inverse().TransformPoint(*pos);
240 
241  if (solidB->Inside(md)==kInside)
242  {
243  G4double distout = solidB->DistanceToOut(md);
244  if (distout > tol)
245  {
246  trials++; retval = true;
247  std::ostringstream message;
248  message << "Overlap within parameterised volumes !" << G4endl
249  << " Overlap is detected for volume "
250  << GetName() << ", parameterised instance: " << i << G4endl
251  << " with parameterised volume instance: " << j
252  << G4endl
253  << " at local point " << md << ", "
254  << "overlapping by at least: "
255  << G4BestUnit(distout, "Length")
256  << ", related to volume instance: " << j << ".";
257  if (trials>=maxErr)
258  {
259  message << G4endl
260  << "NOTE: Reached maximum fixed number -" << maxErr
261  << "- of overlaps reports for this volume !";
262  }
263  G4Exception("G4PVParameterised::CheckOverlaps()",
264  "GeomVol1002", JustWarning, message);
265  if (trials>=maxErr) { return true; }
266  }
267  }
268  }
269  }
270  }
271  if (verbose)
272  {
273  G4cout << "OK! " << G4endl;
274  }
275 
276  return retval;
277 }
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition: G4VSolid.cc:138
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
G4VSolid * GetSolid() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4RotationMatrix * GetRotation() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
virtual EInside Inside(const G4ThreeVector &p) const =0
bool G4bool
Definition: G4Types.hh:79
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4LogicalVolume * GetMotherLogical() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4ThreeVector & GetTranslation() const
virtual G4ThreeVector GetPointOnSurface() const
Definition: G4VSolid.cc:153
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
virtual G4int GetMultiplicity() const
Definition: G4PVReplica.cc:225
#define G4endl
Definition: G4ios.hh:61
const G4String & GetName() const
double G4double
Definition: G4Types.hh:76
static const G4double pos

Here is the call graph for this function:

Here is the caller graph for this function:

G4VPVParameterisation * G4PVParameterised::GetParameterisation ( ) const
virtual

Reimplemented from G4PVReplica.

Definition at line 110 of file G4PVParameterised.cc.

111 {
112  return fparam;
113 }

Here is the caller graph for this function:

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

Reimplemented from G4PVReplica.

Definition at line 126 of file G4PVParameterised.cc.

131 {
132  axis = faxis;
133  nReplicas = fnReplicas;
134  width = fwidth;
135  offset = foffset;
136  consuming = false;
137 }
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:

G4bool G4PVParameterised::IsParameterised ( ) const
virtual

Reimplemented from G4PVReplica.

Definition at line 118 of file G4PVParameterised.cc.

119 {
120  return true;
121 }
void G4PVParameterised::SetRegularStructureId ( G4int  Code)
virtual

Reimplemented from G4PVReplica.

Definition at line 142 of file G4PVParameterised.cc.

143 {
145  // To undertake additional preparation, a derived volume must
146  // redefine this method, while calling also the above method.
147 }
virtual void SetRegularStructureId(G4int Code)
Definition: G4PVReplica.cc:253
#define Code
Definition: deflate.h:77

Here is the call graph for this function:


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