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 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/ICRP110_HumanPhantoms/src/ICRP110PhantomNestedParameterisation.cc (Version 11.3.0) and /examples/advanced/ICRP110_HumanPhantoms/src/ICRP110PhantomNestedParameterisation.cc (Version 5.2.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 // Code developed by:                             
 27 // S.Guatelli, M. Large and A. Malaroda, Unive    
 28 //                                                
 29 // Code based on the Geant4 extended example D    
 30 //                                                
 31 //                                                
 32                                                   
 33 #include "ICRP110PhantomNestedParameterisation    
 34 #include "G4VPhysicalVolume.hh"                   
 35 #include "G4VTouchable.hh"                        
 36 #include "G4ThreeVector.hh"                       
 37 #include "G4Box.hh"                               
 38 #include "G4LogicalVolume.hh"                     
 39 #include "G4Material.hh"                          
 40 #include "G4VisAttributes.hh"                     
 41 #include "G4VVisManager.hh"                       
 42                                                   
 43 ICRP110PhantomNestedParameterisation::            
 44 ICRP110PhantomNestedParameterisation(const G4T    
 45                                    std::vector    
 46                                   G4int fnX_,     
 47 :                                                 
 48   fdX(halfVoxelSize.x()), fdY(halfVoxelSize.y(    
 49   fnX(fnX_), fnY(fnY_), fnZ(fnZ_), // number o    
 50   fMaterials(mat), // vector of defined materi    
 51   fMaterialIndices(nullptr) // vector which as    
 52 {                                                 
 53  ReadColourData();//Define the color of each m    
 54                   // from ColourMap.dat           
 55 }                                                 
 56                                                   
 57 ICRP110PhantomNestedParameterisation::~ICRP110    
 58 {}                                                
 59                                                   
 60 void ICRP110PhantomNestedParameterisation::Rea    
 61 {                                                 
 62     // By default the tissues are not visible.    
 63     // the visualisation attributes are define    
 64     // ColourMap.dat                              
 65     auto blankAtt = new G4VisAttributes;          
 66     blankAtt->SetVisibility( FALSE );             
 67     fColours["Default"] = blankAtt;               
 68                                                   
 69     G4String colourFile = "ColourMap.dat";        
 70     G4cout << "Phantom Material Colours set vi    
 71                                                   
 72     std::ifstream fin(colourFile.c_str());        
 73     G4int nMate;                                  
 74     G4String mateName;                            
 75     G4double cred, cgreen, cblue, copacity;       
 76     fin >> nMate;                                 
 77     G4VisAttributes* visAtt=nullptr;              
 78                                                   
 79     for( G4int ii = 0; ii < nMate; ii++ ){        
 80         fin >> mateName >> cred >> cgreen >> c    
 81         G4Colour colour( cred, cgreen, cblue,     
 82         visAtt = new G4VisAttributes( colour )    
 83         visAtt->SetForceSolid(true);              
 84         fColours[mateName] = visAtt;              
 85        // G4cout << mateName << " colour set :    
 86     }                                             
 87 }                                                 
 88                                                   
 89 void ICRP110PhantomNestedParameterisation::       
 90 SetNoVoxel( G4int nx, G4int ny, G4int nz )        
 91 {                                                 
 92   fnX = nx;                                       
 93   fnY = ny;                                       
 94   fnZ = nz;                                       
 95 }                                                 
 96                                                   
 97 G4Material* ICRP110PhantomNestedParameterisati    
 98 ComputeMaterial(G4VPhysicalVolume* physVol, co    
 99                 const G4VTouchable* parentTouc    
100 {                                                 
101     // protection for initialization and vis a    
102     //                                            
103     if(parentTouch == nullptr)                    
104         return fMaterials[0];                     
105                                                   
106     // Copy number of voxels.                     
107     // Copy number of X and Y are obtained fro    
108     // Copy number of Z is the copy number of     
109                                                   
110     G4int ix = parentTouch -> GetReplicaNumber    
111     G4int iy = parentTouch -> GetReplicaNumber    
112                                                   
113     G4int copyID = ix + fnX*iy + fnX*fnY*iz;      
114     //G4cout << "ix: "<< ix << ", iy: " << iy     
115     //G4cout << "copyID from the Nested Param:    
116                                                   
117     //The copyID identifies the voxel             
118     std::size_t matIndex = GetMaterialIndex(co    
119     G4Material* mate = fMaterials[matIndex];      
120                                                   
121     if(true && physVol && G4VVisManager::GetCo    
122         G4String mateName = fMaterials.at(matI    
123         std::string::size_type iuu = mateName.    
124                                                   
125         if( iuu != std::string::npos ) {          
126             mateName = mateName.substr( 0, iuu    
127         }                                         
128                                                   
129         if(0 < fColours.count(mateName)) {        
130             physVol -> GetLogicalVolume() ->      
131             SetVisAttributes(fColours.find(mat    
132         }                                         
133         else {                                    
134             physVol->GetLogicalVolume() ->        
135             SetVisAttributes(fColours.begin()     
136         }                                         
137     }                                             
138   physVol -> GetLogicalVolume()->SetMaterial(m    
139                                                   
140     return mate;                                  
141 }                                                 
142                                                   
143 G4int ICRP110PhantomNestedParameterisation::Ge    
144 {                                                 
145   return fMaterialIndices[copyNo];                
146 }                                                 
147                                                   
148 G4int ICRP110PhantomNestedParameterisation::Ge    
149 {                                                 
150     return fMaterials.size();                     
151 }                                                 
152                                                   
153 G4Material* ICRP110PhantomNestedParameterisati    
154 {                                                 
155     return fMaterials[i];                         
156 }                                                 
157                                                   
158 void ICRP110PhantomNestedParameterisation::       
159 ComputeTransformation(const G4int copyNo, G4VP    
160 {                                                 
161     // Position of voxels.                        
162     // x and y positions are already defined i    
163     // replicated volume. Hre we define the po    
164                                                   
165     physVol -> SetTranslation(G4ThreeVector(0.    
166                                                   
167 }                                                 
168                                                   
169 void ICRP110PhantomNestedParameterisation::       
170 ComputeDimensions( G4Box& box, const G4int, co    
171 {                                                 
172     box.SetXHalfLength(fdX);                      
173     box.SetYHalfLength(fdY);                      
174     box.SetZHalfLength(fdZ);                      
175 }                                                 
176