Geant4  10.02.p03
DicomNestedPhantomParameterisation Class Reference

Implements a G4VNestedParameterisation. More...

#include <DicomNestedPhantomParameterisation.hh>

Inheritance diagram for DicomNestedPhantomParameterisation:
Collaboration diagram for DicomNestedPhantomParameterisation:

Public Member Functions

 DicomNestedPhantomParameterisation (const G4ThreeVector &voxelSize, std::vector< G4Material *> &mat, G4int fnZ_=0, G4int fnY_=0, G4int fnX_=0)
 
 ~DicomNestedPhantomParameterisation ()
 
G4Material * ComputeMaterial (G4VPhysicalVolume *currentVol, const G4int repNo, const G4VTouchable *parentTouch)
 
G4int GetNumberOfMaterials () const
 
G4Material * GetMaterial (G4int idx) const
 
unsigned int GetMaterialIndex (unsigned int nx, unsigned int ny, unsigned int nz) const
 
unsigned int GetMaterialIndex (unsigned int copyNo) const
 
void SetMaterialIndices (size_t *matInd)
 
void SetNoVoxel (unsigned int nx, unsigned int ny, unsigned int nz)
 
void ComputeTransformation (const G4int no, G4VPhysicalVolume *currentPV) const
 
void ComputeDimensions (G4Box &, const G4int, const G4VPhysicalVolume *) const
 
- Public Member Functions inherited from G4VNestedParameterisation
 G4VNestedParameterisation ()
 
virtual ~G4VNestedParameterisation ()
 
virtual G4VSolid * ComputeSolid (const G4int no, G4VPhysicalVolume *thisVol)
 
G4Material * ComputeMaterial (const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=0)
 
virtual G4bool IsNested () const
 
virtual G4VVolumeMaterialScanner * GetMaterialScanner ()
 
- Public Member Functions inherited from G4VPVParameterisation
 G4VPVParameterisation ()
 
virtual ~G4VPVParameterisation ()
 
- Public Member Functions inherited from G4VVolumeMaterialScanner
 G4VVolumeMaterialScanner ()
 
virtual ~G4VVolumeMaterialScanner ()
 

Private Member Functions

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 (G4Sphere &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Ellipsoid &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Orb &, 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 (G4Tubs &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Polycone &, const G4int, const G4VPhysicalVolume *) const
 
void ComputeDimensions (G4Polyhedra &, const G4int, const G4VPhysicalVolume *) const
 
void ReadColourData ()
 

Private Attributes

G4double fdX
 
G4double fdY
 
G4double fdZ
 
G4int fnX
 
G4int fnY
 
G4int fnZ
 
std::vector< G4Material * > fMaterials
 
size_t * fMaterialIndices
 
std::map< G4String, G4VisAttributes * > fColours
 
std::vector< G4double > fpZ
 

Detailed Description

Implements a G4VNestedParameterisation.

Definition at line 66 of file DicomNestedPhantomParameterisation.hh.

Constructor & Destructor Documentation

◆ DicomNestedPhantomParameterisation()

DicomNestedPhantomParameterisation::DicomNestedPhantomParameterisation ( const G4ThreeVector &  voxelSize,
std::vector< G4Material *> &  mat,
G4int  fnZ_ = 0,
G4int  fnY_ = 0,
G4int  fnX_ = 0 
)

Definition at line 46 of file DicomNestedPhantomParameterisation.cc.

Here is the call graph for this function:

◆ ~DicomNestedPhantomParameterisation()

DicomNestedPhantomParameterisation::~DicomNestedPhantomParameterisation ( )

Definition at line 60 of file DicomNestedPhantomParameterisation.cc.

61 {
62 }

Member Function Documentation

◆ ComputeDimensions() [1/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Box &  box,
const G4int  ,
const G4VPhysicalVolume *   
) const
virtual

Reimplemented from G4VNestedParameterisation.

Definition at line 207 of file DicomNestedPhantomParameterisation.cc.

208 {
209  box.SetXHalfLength(fdX);
210  box.SetYHalfLength(fdY);
211  box.SetZHalfLength(fdZ);
212 }
void SetZHalfLength(G4double dz)
Definition: G4Box.cc:171
void SetYHalfLength(G4double dy)
Definition: G4Box.cc:151
void SetXHalfLength(G4double dx)
Definition: G4Box.cc:131
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeDimensions() [2/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Trd &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 102 of file DicomNestedPhantomParameterisation.hh.

103  {}

◆ ComputeDimensions() [3/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Trap &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 104 of file DicomNestedPhantomParameterisation.hh.

105  {}

◆ ComputeDimensions() [4/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Cons &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 106 of file DicomNestedPhantomParameterisation.hh.

107  {}

◆ ComputeDimensions() [5/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Sphere &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 108 of file DicomNestedPhantomParameterisation.hh.

109  {}

◆ ComputeDimensions() [6/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Ellipsoid &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 110 of file DicomNestedPhantomParameterisation.hh.

111  {}

◆ ComputeDimensions() [7/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Orb &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 112 of file DicomNestedPhantomParameterisation.hh.

113  {}

◆ ComputeDimensions() [8/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Torus &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 114 of file DicomNestedPhantomParameterisation.hh.

115  {}

◆ ComputeDimensions() [9/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Para &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 116 of file DicomNestedPhantomParameterisation.hh.

117  {}

◆ ComputeDimensions() [10/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Hype &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 118 of file DicomNestedPhantomParameterisation.hh.

119  {}

◆ ComputeDimensions() [11/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Tubs &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 120 of file DicomNestedPhantomParameterisation.hh.

121  {}

◆ ComputeDimensions() [12/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Polycone &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 122 of file DicomNestedPhantomParameterisation.hh.

123  {}

◆ ComputeDimensions() [13/13]

void DicomNestedPhantomParameterisation::ComputeDimensions ( G4Polyhedra &  ,
const G4int  ,
const G4VPhysicalVolume *   
) const
inlineprivatevirtual

Reimplemented from G4VNestedParameterisation.

Definition at line 124 of file DicomNestedPhantomParameterisation.hh.

125  {}
Here is the call graph for this function:

◆ ComputeMaterial()

G4Material * DicomNestedPhantomParameterisation::ComputeMaterial ( G4VPhysicalVolume *  currentVol,
const G4int  repNo,
const G4VTouchable *  parentTouch 
)
virtual

Implements G4VNestedParameterisation.

Definition at line 122 of file DicomNestedPhantomParameterisation.cc.

124 {
125 
126  // protection for initialization and vis at idle state
127  //
128  if(parentTouch==0) return fMaterials[0];
129 
130  // Copy number of voxels.
131  // Copy number of X and Y are obtained from replication number.
132  // Copy nymber of Z is the copy number of current voxel.
133  G4int ix = parentTouch->GetReplicaNumber(0);
134  G4int iy = parentTouch->GetReplicaNumber(1);
135 
136  G4int copyID = ix + fnX*iy + fnX*fnY*iz;
137 
138  unsigned int matIndex = GetMaterialIndex(copyID);
139  static G4Material* mate = 0;
140  mate = fMaterials[matIndex];
141 
142  if(false && physVol && G4VVisManager::GetConcreteInstance()) {
143  G4String mateName = fMaterials.at(matIndex)->GetName();
144  std::string::size_type iuu = mateName.find("__");
145  if( iuu != std::string::npos ) {
146  mateName = mateName.substr( 0, iuu );
147  }
148 
149  if(0 < fColours.count(mateName)) {
150  physVol->GetLogicalVolume()->
151  SetVisAttributes(fColours.find(mateName)->second);
152  } else {
153  physVol->GetLogicalVolume()->
154  SetVisAttributes(fColours.begin()->second);
155  }
156  }
157 
158  return mate;
159 }
static G4VVisManager * GetConcreteInstance()
unsigned int GetMaterialIndex(unsigned int nx, unsigned int ny, unsigned int nz) const
int G4int
Definition: G4Types.hh:78
virtual G4int GetReplicaNumber(G4int depth=0) const
Definition: G4VTouchable.cc:58
std::map< G4String, G4VisAttributes * > fColours
G4double iz
Definition: TRTMaterials.hh:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeTransformation()

void DicomNestedPhantomParameterisation::ComputeTransformation ( const G4int  no,
G4VPhysicalVolume *  currentPV 
) const
virtual

Implements G4VNestedParameterisation.

Definition at line 193 of file DicomNestedPhantomParameterisation.cc.

194 {
195  // Position of voxels.
196  // x and y positions are already defined in DetectorConstruction by using
197  // replicated volume. Here only we need to define is z positions of voxels.
198  physVol->SetTranslation(G4ThreeVector(0.,0.,(2.*static_cast<double>(copyNo)
199  +1.)*fdZ - fdZ*fnZ));
200 }
CLHEP::Hep3Vector G4ThreeVector
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMaterial()

G4Material * DicomNestedPhantomParameterisation::GetMaterial ( G4int  idx) const
virtual

Implements G4VNestedParameterisation.

Definition at line 184 of file DicomNestedPhantomParameterisation.cc.

185 {
186  return fMaterials[i];
187 }
Here is the call graph for this function:

◆ GetMaterialIndex() [1/2]

unsigned int DicomNestedPhantomParameterisation::GetMaterialIndex ( unsigned int  nx,
unsigned int  ny,
unsigned int  nz 
) const
Here is the caller graph for this function:

◆ GetMaterialIndex() [2/2]

unsigned int DicomNestedPhantomParameterisation::GetMaterialIndex ( unsigned int  copyNo) const

Definition at line 163 of file DicomNestedPhantomParameterisation.cc.

164 {
165  //return *(fMaterialIndices+copyNo);
166  return fMaterialIndices[copyNo];
167 }

◆ GetNumberOfMaterials()

G4int DicomNestedPhantomParameterisation::GetNumberOfMaterials ( ) const
virtual

Implements G4VNestedParameterisation.

Definition at line 174 of file DicomNestedPhantomParameterisation.cc.

175 {
176  return fMaterials.size();
177 }

◆ ReadColourData()

void DicomNestedPhantomParameterisation::ReadColourData ( )
private

Definition at line 65 of file DicomNestedPhantomParameterisation.cc.

66 {
67  //----- Add a G4VisAttributes for materials not defined in file;
68  /*G4VisAttributes* blankAtt = new G4VisAttributes;
69  blankAtt->SetVisibility( FALSE );
70  fColours["Default"] = blankAtt;
71 
72  G4String colourFile = "ColourMap.dat";
73 
74  //----- Read file
75  std::ifstream fin(colourFile.c_str());
76  G4int nMate;
77  G4String mateName;
78  G4double cred, cgreen, cblue, copacity;
79  fin >> nMate;
80  for( G4int ii = 0; ii < nMate; ii++ ){
81  fin >> mateName >> cred >> cgreen >> cblue >> copacity;
82  G4Colour colour( cred, cgreen, cblue, copacity );
83  G4VisAttributes* visAtt = (copacity > 0.) ?
84  (new G4VisAttributes( colour )) :
85  (new G4VisAttributes(G4VisAttributes::Invisible));
86  //visAtt->SetForceSolid(true);
87  fColours[mateName] = visAtt;
88  }*/
89 
90  //----- Add a G4VisAttributes for materials not defined in file;
91  G4VisAttributes* blankAtt = new G4VisAttributes;
92  blankAtt->SetVisibility( FALSE );
93  fColours["Default"] = blankAtt;
94 
95  //----- Read file
96  G4String colourFile = "ColourMap.dat";
97  std::ifstream fin(colourFile.c_str());
98  G4int nMate;
99  G4String mateName;
100  G4double cred, cgreen, cblue, copacity;
101  fin >> nMate;
102  for( G4int ii = 0; ii < nMate; ii++ ){
103  fin >> mateName >> cred >> cgreen >> cblue >> copacity;
104  G4Colour colour( cred, cgreen, cblue, copacity );
105  G4VisAttributes* visAtt = new G4VisAttributes( colour );
106  //visAtt->SetForceSolid(true);
107  fColours[mateName] = visAtt;
108  }
109 }
TString fin
void SetVisibility(G4bool)
int G4int
Definition: G4Types.hh:78
std::map< G4String, G4VisAttributes * > fColours
#define FALSE
Definition: globals.hh:52
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetMaterialIndices()

void DicomNestedPhantomParameterisation::SetMaterialIndices ( size_t *  matInd)
inline

Definition at line 88 of file DicomNestedPhantomParameterisation.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetNoVoxel()

void DicomNestedPhantomParameterisation::SetNoVoxel ( unsigned int  nx,
unsigned int  ny,
unsigned int  nz 
)

Definition at line 113 of file DicomNestedPhantomParameterisation.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fColours

std::map<G4String,G4VisAttributes*> DicomNestedPhantomParameterisation::fColours
private

Definition at line 137 of file DicomNestedPhantomParameterisation.hh.

◆ fdX

G4double DicomNestedPhantomParameterisation::fdX
private

Definition at line 133 of file DicomNestedPhantomParameterisation.hh.

◆ fdY

G4double DicomNestedPhantomParameterisation::fdY
private

Definition at line 133 of file DicomNestedPhantomParameterisation.hh.

◆ fdZ

G4double DicomNestedPhantomParameterisation::fdZ
private

Definition at line 133 of file DicomNestedPhantomParameterisation.hh.

◆ fMaterialIndices

size_t* DicomNestedPhantomParameterisation::fMaterialIndices
private

Definition at line 136 of file DicomNestedPhantomParameterisation.hh.

◆ fMaterials

std::vector<G4Material*> DicomNestedPhantomParameterisation::fMaterials
private

Definition at line 135 of file DicomNestedPhantomParameterisation.hh.

◆ fnX

G4int DicomNestedPhantomParameterisation::fnX
private

Definition at line 134 of file DicomNestedPhantomParameterisation.hh.

◆ fnY

G4int DicomNestedPhantomParameterisation::fnY
private

Definition at line 134 of file DicomNestedPhantomParameterisation.hh.

◆ fnZ

G4int DicomNestedPhantomParameterisation::fnZ
private

Definition at line 134 of file DicomNestedPhantomParameterisation.hh.

◆ fpZ

std::vector<G4double> DicomNestedPhantomParameterisation::fpZ
private

Definition at line 138 of file DicomNestedPhantomParameterisation.hh.


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