Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PVParameterised Class Reference

#include <G4PVParameterised.hh>

+ Inheritance 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)
 
- 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 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
 
- 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)
 
virtual G4int GetMultiplicity () const
 
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)
 
 G4VPhysicalVolume (__void__ &)
 

Additional Inherited Members

- Protected Attributes inherited from G4PVReplica
EAxis faxis
 
G4int fnReplicas
 
G4double fwidth
 
G4double foffset
 
G4int fcopyNo
 
- Protected Attributes inherited from G4VPhysicalVolume
G4RotationMatrixfrot
 
G4ThreeVector ftrans
 

Detailed Description

Definition at line 47 of file G4PVParameterised.hh.

Constructor & Destructor Documentation

◆ G4PVParameterised() [1/3]

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}
G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true)

◆ G4PVParameterised() [2/3]

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}
@ JustWarning
#define G4endl
Definition: G4ios.hh:52
const G4String & GetName() const
virtual G4bool IsParameterised() const =0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

◆ G4PVParameterised() [3/3]

G4PVParameterised::G4PVParameterised ( __void__ &  a)

Definition at line 95 of file G4PVParameterised.cc.

96 : G4PVReplica(a), fparam(0)
97{
98}

◆ ~G4PVParameterised()

G4PVParameterised::~G4PVParameterised ( )
virtual

Definition at line 103 of file G4PVParameterised.cc.

104{
105}

Member Function Documentation

◆ CheckOverlaps()

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

Reimplemented from G4VPhysicalVolume.

Definition at line 154 of file G4PVParameterised.cc.

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

Referenced by G4PVParameterised().

◆ GetParameterisation()

G4VPVParameterisation * G4PVParameterised::GetParameterisation ( ) const
virtual

Reimplemented from G4PVReplica.

Definition at line 110 of file G4PVParameterised.cc.

111{
112 return fparam;
113}

Referenced by G4tgbGeometryDumper::DumpPVParameterised().

◆ GetReplicationData()

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:136
G4int fnReplicas
Definition: G4PVReplica.hh:135
G4double foffset
Definition: G4PVReplica.hh:136

Referenced by G4tgbGeometryDumper::DumpPVParameterised().

◆ IsParameterised()

G4bool G4PVParameterised::IsParameterised ( ) const
virtual

Reimplemented from G4PVReplica.

Definition at line 118 of file G4PVParameterised.cc.

119{
120 return true;
121}

◆ SetRegularStructureId()

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:242
#define Code
Definition: deflate.h:70

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