Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file DicomPhantomZSliceHeader.cc 27 /// \file DicomPhantomZSliceHeader.cc 28 /// \brief Implementation of the DicomPhantomZ 28 /// \brief Implementation of the DicomPhantomZSliceHeader class 29 // 29 // 30 30 31 #include "DicomPhantomZSliceHeader.hh" << 31 #include "globals.hh" 32 << 33 #include "G4GeometryTolerance.hh" << 34 #include "G4LogicalVolume.hh" 32 #include "G4LogicalVolume.hh" 35 #include "G4Material.hh" << 36 #include "G4MaterialTable.hh" 33 #include "G4MaterialTable.hh" >> 34 #include "G4Material.hh" >> 35 #include "G4GeometryTolerance.hh" 37 #include "G4NistManager.hh" 36 #include "G4NistManager.hh" 38 #include "globals.hh" << 37 >> 38 #include "DicomPhantomZSliceHeader.hh" 39 39 40 //....oooOO0OOooo........oooOO0OOooo........oo 40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.. 41 DicomPhantomZSliceHeader::DicomPhantomZSliceHe 41 DicomPhantomZSliceHeader::DicomPhantomZSliceHeader(const G4String& fname) 42 : fNoVoxelsX(0), << 42 : fNoVoxelX(0),fNoVoxelY(0),fNoVoxelZ(0), 43 fNoVoxelsY(0), << 43 fMinX(0),fMinY(0),fMinZ(0), 44 fNoVoxelsZ(0), << 44 fMaxX(0),fMaxY(0),fMaxZ(0), 45 fMinX(0), << 45 fFilename(fname),fSliceLocation(0) 46 fMinY(0), << 46 { 47 fMinZ(0), << 47 48 fMaxX(0), << 48 } 49 fMaxY(0), << 50 fMaxZ(0), << 51 fFilename(fname), << 52 fSliceLocation(0) << 53 {} << 54 49 55 //....oooOO0OOooo........oooOO0OOooo........oo 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.. 56 DicomPhantomZSliceHeader::~DicomPhantomZSliceH << 51 DicomPhantomZSliceHeader::~DicomPhantomZSliceHeader() >> 52 { >> 53 >> 54 } 57 55 58 //....oooOO0OOooo........oooOO0OOooo........oo 56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo... 59 DicomPhantomZSliceHeader::DicomPhantomZSliceHe << 57 DicomPhantomZSliceHeader::DicomPhantomZSliceHeader( std::ifstream& fin ) 60 { 58 { 61 //----- Read material indices and names << 59 //----- Read material indices and names 62 G4int nmate; << 60 G4int nmate; 63 G4String mateindex; << 61 G4String mateindex; 64 G4String matename; << 62 G4String matename; 65 fin >> nmate; << 63 fin >> nmate; 66 #ifdef G4VERBOSE 64 #ifdef G4VERBOSE 67 G4cout << " DicomPhantomZSliceHeader reading << 65 G4cout << " DicomPhantomZSliceHeader reading number of materials " >> 66 << nmate << G4endl; 68 #endif 67 #endif 69 68 70 for (G4int im = 0; im < nmate; im++) { << 69 for( G4int im = 0; im < nmate; im++ ){ 71 fin >> mateindex >> matename; << 70 fin >> mateindex >> matename; 72 #ifdef G4VERBOSE 71 #ifdef G4VERBOSE 73 // G4cout << " DicomPhantomZSliceHeader re << 72 //G4cout << " DicomPhantomZSliceHeader reading material " 74 // << im << " : "<< mateindex << " " << << 73 // << im << " : "<< mateindex << " " << matename << G4endl; 75 #endif 74 #endif 76 75 77 if (!CheckMaterialExists(matename)) { << 76 if( ! CheckMaterialExists( matename ) ) { 78 G4Exception("DicomPhantomZSliceHeader::D << 77 G4Exception("DicomPhantomZSliceHeader::DicomPhantomZSliceHeader", 79 "A material is found in file << 78 "A material is found in file that is not built in the C++ code", 80 FatalErrorInArgument, matena << 79 FatalErrorInArgument, matename.c_str()); 81 } << 80 } 82 81 83 fMaterialNames.push_back(matename); << 82 fMaterialNames.push_back(matename); 84 } << 83 } 85 84 86 //----- Read number of voxels << 85 //----- Read number of voxels 87 fin >> fNoVoxelsX >> fNoVoxelsY >> fNoVoxels << 86 fin >> fNoVoxelX >> fNoVoxelY >> fNoVoxelZ; 88 #ifdef G4VERBOSE 87 #ifdef G4VERBOSE 89 G4cout << " Number of voxels " << fNoVoxelsX << 88 G4cout << " Number of voxels " << fNoVoxelX << " " << fNoVoxelY >> 89 << " " << fNoVoxelZ << G4endl; 90 #endif 90 #endif 91 91 92 //----- Read minimal and maximal extensions << 92 //----- Read minimal and maximal extensions (= walls of phantom) 93 fin >> fMinX >> fMaxX; << 93 fin >> fMinX >> fMaxX; 94 fin >> fMinY >> fMaxY; << 94 fin >> fMinY >> fMaxY; 95 fin >> fMinZ >> fMaxZ; << 95 fin >> fMinZ >> fMaxZ; 96 #ifdef G4VERBOSE 96 #ifdef G4VERBOSE 97 G4cout << " Extension in X " << fMinX << " " << 97 G4cout << " Extension in X " << fMinX << " " << fMaxX << G4endl 98 << " " << fMaxY << G4endl << " Extens << 98 << " Extension in Y " << fMinY << " " << fMaxY << G4endl >> 99 << " Extension in Z " << fMinZ << " " << fMaxZ << G4endl; 99 #endif 100 #endif 100 101 101 fSliceLocation = 0.5 * (fMinZ + fMaxZ); << 102 fSliceLocation = 0.5*(fMinZ + fMaxZ); 102 } 103 } 103 104 104 //....oooOO0OOooo........oooOO0OOooo........oo 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 105 G4bool DicomPhantomZSliceHeader::CheckMaterial 106 G4bool DicomPhantomZSliceHeader::CheckMaterialExists(const G4String& mateName) 106 { 107 { 107 const G4MaterialTable* matTab = G4Material:: << 108 const G4MaterialTable* matTab = G4Material::GetMaterialTable(); 108 std::vector<G4Material*>::const_iterator mat << 109 std::vector<G4Material*>::const_iterator matite; 109 for (matite = matTab->begin(); matite != mat << 110 for( matite = matTab->begin(); matite != matTab->end(); ++matite ) { 110 if ((*matite)->GetName() == mateName) { << 111 if( (*matite)->GetName() == mateName ) { return true; } >> 112 } >> 113 >> 114 G4Material* g4mate = G4NistManager::Instance()->FindOrBuildMaterial(mateName); >> 115 if( g4mate ) { >> 116 return false; >> 117 } else { 111 return true; 118 return true; 112 } 119 } 113 } << 114 120 115 G4Material* g4mate = G4NistManager::Instance << 116 if (g4mate) { << 117 return false; << 118 } << 119 else { << 120 return true; << 121 } << 122 } 121 } 123 122 124 //....oooOO0OOooo........oooOO0OOooo........oo 123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 125 void DicomPhantomZSliceHeader::operator+=(cons << 124 void DicomPhantomZSliceHeader::operator+=( const DicomPhantomZSliceHeader& rhs) 126 { 125 { 127 *this = *this + rhs; << 126 *this = *this + rhs; 128 } 127 } 129 128 130 //....oooOO0OOooo........oooOO0OOooo........oo 129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.. 131 DicomPhantomZSliceHeader DicomPhantomZSliceHea << 130 DicomPhantomZSliceHeader DicomPhantomZSliceHeader::operator+( >> 131 const DicomPhantomZSliceHeader& rhs ) 132 { 132 { 133 //----- Check that both slices has the same << 133 //----- Check that both slices has the same dimensions 134 if (fNoVoxelsX != rhs.GetNoVoxelsX() || fNoV << 134 if( fNoVoxelX != rhs.GetNoVoxelX() 135 G4cerr << "DicomPhantomZSliceHeader error << 135 || fNoVoxelY != rhs.GetNoVoxelY() ) { >> 136 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:\ 136 !!! Different number of voxels: " 137 !!! Different number of voxels: " 137 << " X= " << fNoVoxelsX << " =? " << 138 << " X= " << fNoVoxelX << " =? " << rhs.GetNoVoxelX() 138 << " =? " << rhs.GetNoVoxelsY() << << 139 << " Y= " << fNoVoxelY << " =? " << rhs.GetNoVoxelY() 139 << G4endl; << 140 << " Z= " << fNoVoxelZ << " =? " << rhs.GetNoVoxelZ() 140 G4Exception("DicomPhantomZSliceHeader::Dic << 141 << G4endl; 141 } << 142 G4Exception("DicomPhantomZSliceHeader::DicomPhantomZSliceHeader", 142 //----- Check that both slices has the same << 143 "",FatalErrorInArgument,""); 143 if (fMinX != rhs.GetMinX() || fMaxX != rhs.G << 144 } 144 || fMaxY != rhs.GetMaxY()) << 145 //----- Check that both slices has the same extensions 145 { << 146 if( fMinX != rhs.GetMinX() || fMaxX != rhs.GetMaxX() 146 G4cerr << "DicomPhantomZSliceHeader error << 147 || fMinY != rhs.GetMinY() || fMaxY != rhs.GetMaxY() ) { >> 148 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:\ 147 !!! Different extensions: " 149 !!! Different extensions: " 148 << " Xmin= " << fMinX << " =? " << << 150 << " Xmin= " << fMinX << " =? " << rhs.GetMinX() 149 << rhs.GetMaxX() << " Ymin= " << f << 151 << " Xmax= " << fMaxX << " =? " << rhs.GetMaxX() 150 << " =? " << rhs.GetMaxY() << G4end << 152 << " Ymin= " << fMinY << " =? " << rhs.GetMinY() 151 G4Exception("DicomPhantomZSliceHeader::ope << 153 << " Ymax= " << fMaxY << " =? " << rhs.GetMaxY() 152 } << 154 << G4endl; >> 155 G4Exception("DicomPhantomZSliceHeader::operator+","", >> 156 FatalErrorInArgument,""); >> 157 } 153 158 154 //----- Check that both slices have the same << 159 //----- Check that both slices have the same materials 155 std::vector<G4String> fMaterialNames2 = rhs. << 160 std::vector<G4String> fMaterialNames2 = rhs.GetMaterialNames(); 156 if (fMaterialNames.size() != fMaterialNames2 << 161 if( fMaterialNames.size() != fMaterialNames2.size() ) { 157 G4cerr << "DicomPhantomZSliceHeader error << 162 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:\ 158 !!! Different number of materials: " << 163 !!! Different number of materials: " << fMaterialNames.size() << " =? " 159 << fMaterialNames.size() << " =? " << 164 << fMaterialNames2.size() << G4endl; 160 G4Exception("DicomPhantomZSliceHeader::ope << 165 G4Exception("DicomPhantomZSliceHeader::operator+","", 161 } << 166 FatalErrorInArgument,""); 162 for (unsigned int ii = 0; ii < fMaterialName << 167 } 163 if (fMaterialNames[ii] != fMaterialNames2[ << 168 for( unsigned int ii = 0; ii < fMaterialNames.size(); ii++ ) { 164 G4cerr << "DicomPhantomZSliceHeader erro << 169 if( fMaterialNames[ii] != fMaterialNames2[ii] ) { 165 !!! Different material number " << 170 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:\ 166 << ii << " : " << fMaterialNames[ << 171 !!! Different material number " << ii << " : " 167 G4Exception("DicomPhantomZSliceHeader::o << 172 << fMaterialNames[ii] << " =? " >> 173 << fMaterialNames2[ii] << G4endl; >> 174 G4Exception("DicomPhantomZSliceHeader::operator+","", >> 175 FatalErrorInArgument,""); >> 176 } 168 } 177 } 169 } << 170 178 171 //----- Check that the slices are contiguous << 179 //----- Check that the slices are contiguous in Z 172 if (std::fabs(fMinZ - rhs.GetMaxZ()) > G4Geo << 180 if( std::fabs( fMinZ - rhs.GetMaxZ() ) > 173 && std::fabs(fMaxZ - rhs.GetMinZ()) << 181 G4GeometryTolerance::GetInstance()->GetRadialTolerance() && 174 > G4GeometryTolerance::GetInstance( << 182 std::fabs( fMaxZ - rhs.GetMinZ() ) > 175 { << 183 G4GeometryTolerance::GetInstance()->GetRadialTolerance() ){ 176 G4cerr << "DicomPhantomZSliceHeader error << 184 G4cerr << "DicomPhantomZSliceHeader error adding two slice headers:!!!\ 177 Slices are not contiguous in Z " 185 Slices are not contiguous in Z " 178 << " Zmin= " << fMinZ << " & " << << 186 << " Zmin= " << fMinZ << " & " << rhs.GetMinZ() 179 << rhs.GetMaxZ() << G4endl; << 187 << " Zmax= " << fMaxZ << " & " << rhs.GetMaxZ() 180 G4Exception("DicomPhantomZSliceHeader::ope << 188 << G4endl; 181 } << 189 G4Exception("DicomPhantomZSliceHeader::operator+","", >> 190 FatalErrorInArgument,""); >> 191 } 182 192 183 //----- Build slice header copying first one << 193 //----- Build slice header copying first one 184 DicomPhantomZSliceHeader temp(*this); << 194 DicomPhantomZSliceHeader temp( *this ); 185 195 186 //----- Add data from second slice header << 196 //----- Add data from second slice header 187 temp.SetMinZ(std::min(fMinZ, rhs.GetMinZ())) << 197 temp.SetMinZ( std::min( fMinZ, rhs.GetMinZ() ) ); 188 temp.SetMaxZ(std::max(fMaxZ, rhs.GetMaxZ())) << 198 temp.SetMaxZ( std::max( fMaxZ, rhs.GetMaxZ() ) ); 189 temp.SetNoVoxelsZ(fNoVoxelsZ + rhs.GetNoVoxe << 199 temp.SetNoVoxelZ( fNoVoxelZ + rhs.GetNoVoxelZ() ); 190 200 191 return temp; << 201 return temp; 192 } 202 } 193 203 194 //....oooOO0OOooo........oooOO0OOooo........oo 204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.. 195 void DicomPhantomZSliceHeader::DumpToFile() 205 void DicomPhantomZSliceHeader::DumpToFile() 196 { 206 { 197 G4cout << "DicomPhantomZSliceHeader::Dumping << 198 // sleep(5); << 199 207 >> 208 G4cout << "DicomPhantomZSliceHeader::Dumping Z Slice data to " >> 209 << fFilename << "..." << G4endl; >> 210 //sleep(5); >> 211 200 // May seen counter-intuitive (dumping to f 212 // May seen counter-intuitive (dumping to file you are reading from), but 201 // the reason for this is modification slic 213 // the reason for this is modification slice spacing 202 if (fMateIDs.size() == 0 || fValues.size() = << 214 if(fMateIDs.size() == 0 || fValues.size() == 0) { ReadDataFromFile(); } 203 ReadDataFromFile(); << 215 204 } << 216 205 << 206 std::ofstream out; 217 std::ofstream out; 207 out.open(fFilename.c_str()); 218 out.open(fFilename.c_str()); 208 << 219 209 if (!out) { << 220 if(!out) { 210 G4String descript = "DicomPhantomZSliceHea << 221 G4String descript = "DicomPhantomZSliceHeader::DumpToFile: could not open " 211 G4Exception(descript.c_str(), "", FatalExc << 222 +fFilename; >> 223 G4Exception(descript.c_str(),"", FatalException, ""); 212 } 224 } 213 << 225 214 out << fMaterialNames.size() << std::endl; 226 out << fMaterialNames.size() << std::endl; 215 for (unsigned int i = 0; i < fMaterialNames. << 227 for(unsigned int i = 0; i < fMaterialNames.size(); ++i) { 216 out << i << " " << fMaterialNames.at(i) << 228 out << i << " " << fMaterialNames.at(i) << std::endl; 217 } 229 } 218 << 230 219 out << fNoVoxelsX << " " << fNoVoxelsY << " << 231 out << fNoVoxelX << " " << fNoVoxelY << " " << fNoVoxelZ << std::endl; 220 out << fMinX << " " << fMaxX << std::endl; 232 out << fMinX << " " << fMaxX << std::endl; 221 out << fMinY << " " << fMaxY << std::endl; 233 out << fMinY << " " << fMaxY << std::endl; 222 out << fMinZ << " " << fMaxZ << std::endl; 234 out << fMinZ << " " << fMaxZ << std::endl; 223 << 235 224 for (unsigned int i = 0; i < fMateIDs.size() << 236 for(unsigned int i = 0; i < fMateIDs.size(); ++i) 225 Print(out, fMateIDs.at(i), " "); << 237 { Print(out,fMateIDs.at(i)," "); } 226 } << 238 227 << 239 for(unsigned int i = 0; i < fValues.size(); ++i) 228 for (unsigned int i = 0; i < fValues.size(); << 240 { Print(out,fValues.at(i)," ",6); } 229 Print(out, fValues.at(i), " ", 6); << 241 230 } << 231 << 232 out.close(); 242 out.close(); >> 243 233 } 244 } 234 245 235 //....oooOO0OOooo........oooOO0OOooo........oo 246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 236 void DicomPhantomZSliceHeader::ReadDataFromFil 247 void DicomPhantomZSliceHeader::ReadDataFromFile() 237 { 248 { 238 std::ifstream in; 249 std::ifstream in; 239 in.open(fFilename.c_str()); 250 in.open(fFilename.c_str()); 240 << 251 241 if (!in) { << 252 if(!in) { 242 G4String descript = "DicomPhantomZSliceHea << 253 G4String descript = "DicomPhantomZSliceHeader::DumpToFile: could not open " 243 G4Exception(descript.c_str(), "", FatalExc << 254 +fFilename; >> 255 G4Exception(descript.c_str(),"", FatalException, ""); 244 } 256 } 245 << 257 246 G4int nMaterials; 258 G4int nMaterials; 247 in >> nMaterials; 259 in >> nMaterials; 248 << 260 249 fMaterialNames.resize(nMaterials, ""); << 261 fMaterialNames.resize(nMaterials,""); 250 for (G4int i = 0; i < nMaterials; ++i) { << 262 for(G4int i = 0; i < nMaterials; ++i) { 251 G4String str1, str2; 263 G4String str1, str2; 252 in >> str1 >> str2; 264 in >> str1 >> str2; 253 if (!IsInteger(str1)) { << 265 if(!IsInteger(str1)) { 254 G4String descript = "String : " + str1 + 266 G4String descript = "String : " + str1 + " supposed to be integer"; 255 G4Exception( << 267 G4Exception("DicomPhantomZSliceHeader::ReadDataFromFile - error in \ 256 "DicomPhantomZSliceHeader::ReadDataFro << 268 formatting: missing material index","", FatalException,descript.c_str()); 257 formatting: missing material index", << 258 "", FatalException, descript.c_str()); << 259 } 269 } 260 G4int index = G4s2n<G4int>(str1); 270 G4int index = G4s2n<G4int>(str1); 261 if (index > nMaterials || index < 0) { << 271 if(index > nMaterials || index < 0) { 262 G4String descript = "Index : " + str1; 272 G4String descript = "Index : " + str1; 263 G4Exception( << 273 G4Exception("DicomPhantomZSliceHeader::ReadDataFromFile - error:\ 264 "DicomPhantomZSliceHeader::ReadDataFro << 274 bad material index","", FatalException,descript.c_str()); 265 bad material index", << 266 "", FatalException, descript.c_str()); << 267 } 275 } 268 fMaterialNames[index] = str2; 276 fMaterialNames[index] = str2; 269 } 277 } 270 << 278 271 in >> fNoVoxelsX >> fNoVoxelsY >> fNoVoxelsZ << 279 in >> fNoVoxelX >> fNoVoxelY >> fNoVoxelZ; 272 << 280 273 G4double tmpMinX, tmpMinY, tmpMinZ; 281 G4double tmpMinX, tmpMinY, tmpMinZ; 274 G4double tmpMaxX, tmpMaxY, tmpMaxZ; 282 G4double tmpMaxX, tmpMaxY, tmpMaxZ; 275 << 283 276 in >> tmpMinX >> tmpMaxX; 284 in >> tmpMinX >> tmpMaxX; 277 in >> tmpMinY >> tmpMaxY; 285 in >> tmpMinY >> tmpMaxY; 278 in >> tmpMinZ >> tmpMaxZ; 286 in >> tmpMinZ >> tmpMaxZ; 279 << 287 280 fMinX = << 288 fMinX = (CheckConsistency(tmpMinX,fMinX,"Min X value")) ? 281 (CheckConsistency(tmpMinX, fMinX, "Min X v << 289 fMinX : ((fMinX == 0) ? tmpMinX : fMinX); 282 fMaxX = << 290 fMaxX = (CheckConsistency(tmpMaxX,fMaxX,"Max X value")) ? 283 (CheckConsistency(tmpMaxX, fMaxX, "Max X v << 291 fMaxX : ((fMaxX == 0) ? tmpMaxX : fMaxX); 284 << 292 285 fMinY = << 293 fMinY = (CheckConsistency(tmpMinY,fMinY,"Min Y value")) ? 286 (CheckConsistency(tmpMinY, fMinY, "Min Y v << 294 fMinY : ((fMinY == 0) ? tmpMinY : fMinY); 287 fMaxY = << 295 fMaxY = (CheckConsistency(tmpMaxY,fMaxY,"Max Y value")) ? 288 (CheckConsistency(tmpMaxY, fMaxY, "Max Y v << 296 fMaxY : ((fMaxY == 0) ? tmpMaxY : fMaxY); 289 << 297 290 fMinZ = << 298 fMinZ = (CheckConsistency(tmpMinZ,fMinZ,"Min Z value")) ? 291 (CheckConsistency(tmpMinZ, fMinZ, "Min Z v << 299 fMinZ : ((fMinZ == 0) ? tmpMinZ : fMinZ); 292 fMaxZ = << 300 fMaxZ = (CheckConsistency(tmpMaxZ,fMaxZ,"Max Z value")) ? 293 (CheckConsistency(tmpMaxZ, fMaxZ, "Max Z v << 301 fMaxZ : ((fMaxZ == 0) ? tmpMaxZ : fMaxZ); 294 << 302 295 fMateIDs.clear(); 303 fMateIDs.clear(); 296 fValues.clear(); 304 fValues.clear(); 297 fMateIDs.resize(fNoVoxelsY * fNoVoxelsZ, std << 305 fMateIDs.resize(fNoVoxelY*fNoVoxelZ,std::vector<G4int>(fNoVoxelX,0)); 298 fValues.resize(fNoVoxelsY * fNoVoxelsZ, std: << 306 fValues.resize(fNoVoxelY*fNoVoxelZ,std::vector<G4double>(fNoVoxelX,0.)); 299 for (G4int k = 0; k < fNoVoxelsZ; ++k) { << 307 for(G4int k = 0; k < fNoVoxelZ; ++k) { 300 for (G4int j = 0; j < fNoVoxelsY; ++j) { << 308 for(G4int j = 0; j < fNoVoxelY; ++j) { 301 for (G4int i = 0; i < fNoVoxelsX; ++i) { << 309 for(G4int i = 0; i < fNoVoxelX; ++i) { 302 G4int tmpMateID; 310 G4int tmpMateID; 303 in >> tmpMateID; 311 in >> tmpMateID; 304 G4int row = j * (k + 1); << 312 G4int row = j*(k+1); 305 fMateIDs[row][i] = tmpMateID; 313 fMateIDs[row][i] = tmpMateID; 306 } 314 } 307 } 315 } 308 } 316 } 309 << 317 310 for (G4int k = 0; k < fNoVoxelsZ; ++k) { << 318 for(G4int k = 0; k < fNoVoxelZ; ++k) { 311 for (G4int j = 0; j < fNoVoxelsY; ++j) { << 319 for(G4int j = 0; j < fNoVoxelY; ++j) { 312 for (G4int i = 0; i < fNoVoxelsX; ++i) { << 320 for(G4int i = 0; i < fNoVoxelX; ++i) { 313 G4double tmpValue; 321 G4double tmpValue; 314 in >> tmpValue; 322 in >> tmpValue; 315 G4int row = j * (k + 1); << 323 G4int row = j*(k+1); 316 fValues[row][i] = tmpValue; 324 fValues[row][i] = tmpValue; 317 } 325 } 318 } 326 } 319 } 327 } 320 << 328 321 in.close(); 329 in.close(); 322 } 330 } 323 //....oooOO0OOooo........oooOO0OOooo........oo 331 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 324 332