Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PartialPhantomParameterisation Class Reference

#include <G4PartialPhantomParameterisation.hh>

Inheritance diagram for G4PartialPhantomParameterisation:
Collaboration diagram for G4PartialPhantomParameterisation:

Public Member Functions

 G4PartialPhantomParameterisation ()
 
 ~G4PartialPhantomParameterisation ()
 
void ComputeTransformation (const G4int, G4VPhysicalVolume *) const
 
G4MaterialComputeMaterial (const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
 
G4int GetReplicaNo (const G4ThreeVector &localPoint, const G4ThreeVector &localDir)
 
G4ThreeVector GetTranslation (const G4int copyNo) const
 
size_t GetMaterialIndex (size_t nx, size_t ny, size_t nz) const
 
size_t GetMaterialIndex (size_t copyNo) const
 
G4MaterialGetMaterial (size_t nx, size_t ny, size_t nz) const
 
G4MaterialGetMaterial (size_t copyNo) const
 
void SetFilledIDs (std::multimap< G4int, G4int > fid)
 
void SetFilledMins (std::map< G4int, std::map< G4int, G4int > > fmins)
 
void BuildContainerWalls ()
 
- Public Member Functions inherited from G4PhantomParameterisation
 G4PhantomParameterisation ()
 
 ~G4PhantomParameterisation ()
 
virtual G4VSolidComputeSolid (const G4int, G4VPhysicalVolume *)
 
void ComputeDimensions (G4Box &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Tubs &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Trd &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Trap &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Cons &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Orb &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Sphere &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Ellipsoid &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Torus &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Para &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Hype &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Polycone &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Polyhedra &, const G4int, const G4VPhysicalVolume *) const
 
void BuildContainerSolid (G4VPhysicalVolume *pPhysicalVol)
 
void BuildContainerSolid (G4VSolid *pMotherSolid)
 
void SetMaterials (std::vector< G4Material * > &mates)
 
void SetMaterialIndices (size_t *matInd)
 
void SetVoxelDimensions (G4double halfx, G4double halfy, G4double halfz)
 
void SetNoVoxel (size_t nx, size_t ny, size_t nz)
 
G4double GetVoxelHalfX () const
 
G4double GetVoxelHalfY () const
 
G4double GetVoxelHalfZ () const
 
size_t GetNoVoxelX () const
 
size_t GetNoVoxelY () const
 
size_t GetNoVoxelZ () const
 
size_t GetNoVoxel () const
 
std::vector< G4Material * > GetMaterials () const
 
size_t * GetMaterialIndices () const
 
G4VSolidGetContainerSolid () const
 
G4ThreeVector GetTranslation (const G4int copyNo) const
 
G4bool SkipEqualMaterials () const
 
void SetSkipEqualMaterials (G4bool skip)
 
size_t GetMaterialIndex (size_t nx, size_t ny, size_t nz) const
 
size_t GetMaterialIndex (size_t copyNo) const
 
G4MaterialGetMaterial (size_t nx, size_t ny, size_t nz) const
 
G4MaterialGetMaterial (size_t copyNo) const
 
void CheckVoxelsFillContainer (G4double contX, G4double contY, G4double contZ) const
 
- Public Member Functions inherited from G4VPVParameterisation
 G4VPVParameterisation ()
 
virtual ~G4VPVParameterisation ()
 
virtual G4bool IsNested () const
 
virtual G4VVolumeMaterialScannerGetMaterialScanner ()
 

Additional Inherited Members

- Protected Attributes inherited from G4PhantomParameterisation
G4double fVoxelHalfX
 
G4double fVoxelHalfY
 
G4double fVoxelHalfZ
 
size_t fNoVoxelX
 
size_t fNoVoxelY
 
size_t fNoVoxelZ
 
size_t fNoVoxelXY
 
size_t fNoVoxel
 
std::vector< G4Material * > fMaterials
 
size_t * fMaterialIndices
 
G4VSolidfContainerSolid
 
G4double fContainerWallX
 
G4double fContainerWallY
 
G4double fContainerWallZ
 
G4double kCarTolerance
 
G4bool bSkipEqualMaterials
 

Detailed Description

Definition at line 57 of file G4PartialPhantomParameterisation.hh.

Constructor & Destructor Documentation

G4PartialPhantomParameterisation::G4PartialPhantomParameterisation ( )
G4PartialPhantomParameterisation::~G4PartialPhantomParameterisation ( )

Definition at line 56 of file G4PartialPhantomParameterisation.cc.

57 {
58 }

Member Function Documentation

G4Material * G4PartialPhantomParameterisation::ComputeMaterial ( const G4int  repNo,
G4VPhysicalVolume currentVol,
const G4VTouchable parentTouch = 0 
)
virtual

Reimplemented from G4PhantomParameterisation.

Definition at line 91 of file G4PartialPhantomParameterisation.cc.

92 {
93  CheckCopyNo( copyNo );
94  size_t matIndex = GetMaterialIndex(copyNo);
95 
96  return fMaterials[ matIndex ];
97 }
size_t GetMaterialIndex(size_t nx, size_t ny, size_t nz) const
std::vector< G4Material * > fMaterials

Here is the call graph for this function:

void G4PartialPhantomParameterisation::ComputeTransformation ( const G4int  copyNo,
G4VPhysicalVolume physVol 
) const
virtual

Reimplemented from G4PhantomParameterisation.

Definition at line 62 of file G4PartialPhantomParameterisation.cc.

63 {
64  // Voxels cannot be rotated, return translation
65  //
66  G4ThreeVector trans = GetTranslation( copyNo );
67  physVol->SetTranslation( trans );
68 }
void SetTranslation(const G4ThreeVector &v)
G4ThreeVector GetTranslation(const G4int copyNo) const

Here is the call graph for this function:

G4Material * G4PartialPhantomParameterisation::GetMaterial ( size_t  nx,
size_t  ny,
size_t  nz 
) const

Definition at line 123 of file G4PartialPhantomParameterisation.cc.

124 {
125  return fMaterials[GetMaterialIndex(nx,ny,nz)];
126 }
size_t GetMaterialIndex(size_t nx, size_t ny, size_t nz) const
std::vector< G4Material * > fMaterials

Here is the call graph for this function:

G4Material * G4PartialPhantomParameterisation::GetMaterial ( size_t  copyNo) const

Definition at line 131 of file G4PartialPhantomParameterisation.cc.

132 {
133  return fMaterials[GetMaterialIndex(copyNo)];
134 }
size_t GetMaterialIndex(size_t nx, size_t ny, size_t nz) const
std::vector< G4Material * > fMaterials

Here is the call graph for this function:

size_t G4PartialPhantomParameterisation::GetMaterialIndex ( size_t  nx,
size_t  ny,
size_t  nz 
) const

Definition at line 114 of file G4PartialPhantomParameterisation.cc.

115 {
116  size_t copyNo = nx + fNoVoxelX*ny + fNoVoxelXY*nz;
117  return GetMaterialIndex( copyNo );
118 }
size_t GetMaterialIndex(size_t nx, size_t ny, size_t nz) const

Here is the caller graph for this function:

size_t G4PartialPhantomParameterisation::GetMaterialIndex ( size_t  copyNo) const

Definition at line 102 of file G4PartialPhantomParameterisation.cc.

103 {
104  CheckCopyNo( copyNo );
105 
106  if( !fMaterialIndices ) { return 0; }
107 
108  return *(fMaterialIndices+copyNo);
109 }
G4int G4PartialPhantomParameterisation::GetReplicaNo ( const G4ThreeVector localPoint,
const G4ThreeVector localDir 
)
virtual

Reimplemented from G4PhantomParameterisation.

Definition at line 165 of file G4PartialPhantomParameterisation.cc.

166 {
167  // Check the voxel numbers corresponding to localPoint
168  // When a particle is on a surface, it may be between -kCarTolerance and
169  // +kCartolerance. By a simple distance as:
170  // G4int nx = G4int( (localPoint.x()+)/fVoxelHalfX/2.);
171  // those between -kCartolerance and 0 will be placed on voxel N-1 and those
172  // between 0 and kCarTolerance on voxel N.
173  // To avoid precision problems place the tracks that are on the surface on
174  // voxel N-1 if they have negative direction and on voxel N if they have
175  // positive direction.
176  // Add +kCarTolerance so that they are first placed on voxel N, and then
177  // if the direction is negative substract 1
178 
179  G4double fx = (localPoint.x()+fContainerWallX+kCarTolerance)/(fVoxelHalfX*2.);
180  G4int nx = G4int(fx);
181 
182  G4double fy = (localPoint.y()+fContainerWallY+kCarTolerance)/(fVoxelHalfY*2.);
183  G4int ny = G4int(fy);
184 
185  G4double fz = (localPoint.z()+fContainerWallZ+kCarTolerance)/(fVoxelHalfZ*2.);
186  G4int nz = G4int(fz);
187 
188  // If it is on the surface side, check the direction: if direction is
189  // negative place it on the previous voxel (if direction is positive it is
190  // already in the next voxel...).
191  // Correct also cases where n = -1 or n = fNoVoxel. It is always traced to be
192  // due to multiple scattering: track is entering a voxel but multiple
193  // scattering changes the angle towards outside
194  //
195  if( fx - nx < kCarTolerance/fVoxelHalfX )
196  {
197  if( localDir.x() < 0 )
198  {
199  if( nx != 0 )
200  {
201  nx -= 1;
202  }
203  }
204  else
205  {
206  if( nx == G4int(fNoVoxelX) )
207  {
208  nx -= 1;
209  }
210  }
211  }
212  if( fy - ny < kCarTolerance/fVoxelHalfY )
213  {
214  if( localDir.y() < 0 )
215  {
216  if( ny != 0 )
217  {
218  ny -= 1;
219  }
220  }
221  else
222  {
223  if( ny == G4int(fNoVoxelY) )
224  {
225  ny -= 1;
226  }
227  }
228  }
229  if( fz - nz < kCarTolerance/fVoxelHalfZ )
230  {
231  if( localDir.z() < 0 )
232  {
233  if( nz != 0 )
234  {
235  nz -= 1;
236  }
237  }
238  else
239  {
240  if( nz == G4int(fNoVoxelZ) )
241  {
242  nz -= 1;
243  }
244  }
245  }
246 
247  // Check if there are still errors
248  //
249  G4bool isOK = true;
250  if( nx < 0 )
251  {
252  nx = 0;
253  isOK = false;
254  }
255  else if( nx >= G4int(fNoVoxelX) )
256  {
257  nx = fNoVoxelX-1;
258  isOK = false;
259  }
260  if( ny < 0 )
261  {
262  ny = 0;
263  isOK = false;
264  }
265  else if( ny >= G4int(fNoVoxelY) )
266  {
267  ny = fNoVoxelY-1;
268  isOK = false;
269  }
270  if( nz < 0 )
271  {
272  nz = 0;
273  isOK = false;
274  }
275  else if( nz >= G4int(fNoVoxelZ) )
276  {
277  nz = fNoVoxelZ-1;
278  isOK = false;
279  }
280  if( !isOK )
281  {
282  std::ostringstream message;
283  message << "Corrected the copy number! It was negative or too big."
284  << G4endl
285  << " LocalPoint: " << localPoint << G4endl
286  << " LocalDir: " << localDir << G4endl
287  << " Voxel container size: " << fContainerWallX
288  << " " << fContainerWallY << " " << fContainerWallZ << G4endl
289  << " LocalPoint - wall: "
290  << localPoint.x()-fContainerWallX << " "
291  << localPoint.y()-fContainerWallY << " "
292  << localPoint.z()-fContainerWallZ;
293  G4Exception("G4PartialPhantomParameterisation::GetReplicaNo()",
294  "GeomNav1002", JustWarning, message);
295  }
296 
297  G4int nyz = nz*fNoVoxelY+ny;
298  std::multimap<G4int,G4int>::iterator ite = fFilledIDs.begin();
299 /*
300  for( ite = fFilledIDs.begin(); ite != fFilledIDs.end(); ite++ )
301  {
302  G4cout << " G4PartialPhantomParameterisation::GetReplicaNo filled "
303  << (*ite).first << " , " << (*ite).second << std::endl;
304  }
305 */
306  ite = fFilledIDs.begin();
307 
308  advance(ite,nyz);
309  std::multimap<G4int,G4int>::iterator iteant = ite; iteant--;
310  G4int copyNo = (*iteant).first + 1 + ( nx - (*ite).second );
311 /*
312  G4cout << " G4PartialPhantomParameterisation::GetReplicaNo getting copyNo "
313  << copyNo << " nyz " << nyz << " (*iteant).first "
314  << (*iteant).first << " (*ite).second " << (*ite).second << G4endl;
315 
316  G4cout << " G4PartialPhantomParameterisation::GetReplicaNo " << copyNo
317  << " nx " << nx << " ny " << ny << " nz " << nz
318  << " localPoint " << localPoint << " localDir " << localDir << G4endl;
319 */
320  return copyNo;
321 }
double x() const
int G4int
Definition: G4Types.hh:78
double z() const
bool G4bool
Definition: G4Types.hh:79
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double y() const
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4ThreeVector G4PartialPhantomParameterisation::GetTranslation ( const G4int  copyNo) const

Definition at line 73 of file G4PartialPhantomParameterisation.cc.

74 {
75  CheckCopyNo( copyNo );
76 
77  size_t nx;
78  size_t ny;
79  size_t nz;
80  ComputeVoxelIndices( copyNo, nx, ny, nz );
81 
82  G4ThreeVector trans( (2*nx+1)*fVoxelHalfX - fContainerWallX,
83  (2*ny+1)*fVoxelHalfY - fContainerWallY,
84  (2*nz+1)*fVoxelHalfZ - fContainerWallZ);
85  return trans;
86 }

Here is the caller graph for this function:

void G4PartialPhantomParameterisation::SetFilledIDs ( std::multimap< G4int, G4int fid)
inline

Definition at line 83 of file G4PartialPhantomParameterisation.hh.

83  {
84  fFilledIDs = fid;
85  }
void G4PartialPhantomParameterisation::SetFilledMins ( std::map< G4int, std::map< G4int, G4int > >  fmins)
inline

Definition at line 87 of file G4PartialPhantomParameterisation.hh.

87  {
88  fFilledMins = fmins;
89  }

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