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 // G4tgbGeometryDumper implementation << 27 // 26 // 28 // Author: P.Arce, CIEMAT (November 2007) << 27 // 29 // ------------------------------------------- << 28 // >> 29 // class G4tgbGeometryDumper >> 30 >> 31 // History: >> 32 // - Created. P.Arce, CIEMAT (November 2007) >> 33 // ------------------------------------------------------------------------- 30 34 31 #include "G4tgbGeometryDumper.hh" 35 #include "G4tgbGeometryDumper.hh" 32 36 33 #include "G4tgrMessenger.hh" 37 #include "G4tgrMessenger.hh" 34 38 35 #include "G4UIcommand.hh" 39 #include "G4UIcommand.hh" 36 #include "G4Material.hh" 40 #include "G4Material.hh" 37 #include "G4Element.hh" 41 #include "G4Element.hh" 38 #include "G4VSolid.hh" 42 #include "G4VSolid.hh" 39 #include "G4Box.hh" 43 #include "G4Box.hh" 40 #include "G4Tubs.hh" 44 #include "G4Tubs.hh" 41 #include "G4Cons.hh" 45 #include "G4Cons.hh" 42 #include "G4Trap.hh" 46 #include "G4Trap.hh" 43 #include "G4Sphere.hh" 47 #include "G4Sphere.hh" 44 #include "G4Orb.hh" 48 #include "G4Orb.hh" 45 #include "G4Trd.hh" 49 #include "G4Trd.hh" 46 #include "G4Para.hh" 50 #include "G4Para.hh" 47 #include "G4Torus.hh" 51 #include "G4Torus.hh" 48 #include "G4Hype.hh" 52 #include "G4Hype.hh" 49 #include "G4Polycone.hh" 53 #include "G4Polycone.hh" 50 #include "G4GenericPolycone.hh" 54 #include "G4GenericPolycone.hh" 51 #include "G4Polyhedra.hh" 55 #include "G4Polyhedra.hh" 52 #include "G4EllipticalTube.hh" 56 #include "G4EllipticalTube.hh" 53 #include "G4Ellipsoid.hh" 57 #include "G4Ellipsoid.hh" 54 #include "G4EllipticalCone.hh" 58 #include "G4EllipticalCone.hh" 55 #include "G4Hype.hh" 59 #include "G4Hype.hh" 56 #include "G4Tet.hh" 60 #include "G4Tet.hh" 57 #include "G4TwistedBox.hh" 61 #include "G4TwistedBox.hh" 58 #include "G4TwistedTrap.hh" 62 #include "G4TwistedTrap.hh" 59 #include "G4TwistedTrd.hh" 63 #include "G4TwistedTrd.hh" 60 #include "G4TwistedTubs.hh" 64 #include "G4TwistedTubs.hh" 61 #include "G4MultiUnion.hh" << 62 #include "G4ScaledSolid.hh" << 63 #include "G4PVPlacement.hh" 65 #include "G4PVPlacement.hh" 64 #include "G4PVParameterised.hh" 66 #include "G4PVParameterised.hh" 65 #include "G4PVReplica.hh" 67 #include "G4PVReplica.hh" 66 #include "G4BooleanSolid.hh" 68 #include "G4BooleanSolid.hh" 67 #include "G4ReflectionFactory.hh" 69 #include "G4ReflectionFactory.hh" 68 #include "G4ReflectedSolid.hh" 70 #include "G4ReflectedSolid.hh" 69 #include "G4LogicalVolumeStore.hh" 71 #include "G4LogicalVolumeStore.hh" 70 #include "G4PhysicalVolumeStore.hh" 72 #include "G4PhysicalVolumeStore.hh" 71 #include "G4GeometryTolerance.hh" 73 #include "G4GeometryTolerance.hh" 72 #include "G4VPVParameterisation.hh" 74 #include "G4VPVParameterisation.hh" 73 #include "G4SystemOfUnits.hh" 75 #include "G4SystemOfUnits.hh" 74 #include <iomanip> 76 #include <iomanip> 75 77 76 // ------------------------------------------- << 78 //------------------------------------------------------------------------ 77 G4ThreadLocal G4tgbGeometryDumper* G4tgbGeomet << 79 G4ThreadLocal G4tgbGeometryDumper* G4tgbGeometryDumper::theInstance = 0; 78 80 79 // ------------------------------------------- << 81 //------------------------------------------------------------------------ 80 G4tgbGeometryDumper::G4tgbGeometryDumper() 82 G4tgbGeometryDumper::G4tgbGeometryDumper() >> 83 : theFile(0), theRotationNumber(0) 81 { 84 { 82 } 85 } 83 86 84 // ------------------------------------------- << 87 //------------------------------------------------------------------------ 85 G4tgbGeometryDumper* G4tgbGeometryDumper::GetI 88 G4tgbGeometryDumper* G4tgbGeometryDumper::GetInstance() 86 { 89 { 87 if(theInstance == nullptr) << 90 if( theInstance == 0 ){ 88 { << 89 theInstance = new G4tgbGeometryDumper; 91 theInstance = new G4tgbGeometryDumper; 90 } 92 } >> 93 91 return theInstance; 94 return theInstance; >> 95 92 } 96 } 93 97 94 // ------------------------------------------- << 98 //------------------------------------------------------------------------ 95 void G4tgbGeometryDumper::DumpGeometry(const G << 99 void G4tgbGeometryDumper::DumpGeometry( const G4String& fname ) 96 { 100 { 97 theFile = new std::ofstream(fname); 101 theFile = new std::ofstream(fname); 98 102 99 G4VPhysicalVolume* pv = GetTopPhysVol(); 103 G4VPhysicalVolume* pv = GetTopPhysVol(); 100 DumpPhysVol(pv); // dump volume and recursi << 104 DumpPhysVol( pv ); // dump volume and recursively it will dump all hierarchy 101 } 105 } 102 106 103 // ------------------------------------------- << 107 //--------------------------------------------------------------------- 104 G4VPhysicalVolume* G4tgbGeometryDumper::GetTop 108 G4VPhysicalVolume* G4tgbGeometryDumper::GetTopPhysVol() 105 { 109 { 106 G4PhysicalVolumeStore* pvstore = G4PhysicalV 110 G4PhysicalVolumeStore* pvstore = G4PhysicalVolumeStore::GetInstance(); 107 G4VPhysicalVolume* pv = *(pvstore->cbegin()) << 111 G4PhysicalVolumeStore::const_iterator ite; 108 for(;;) << 112 G4VPhysicalVolume* pv = *(pvstore->begin()); >> 113 for( ;; ) 109 { 114 { 110 G4LogicalVolume* lv = pv->GetMotherLogical 115 G4LogicalVolume* lv = pv->GetMotherLogical(); 111 if(lv == 0) << 116 if( lv == 0 ) { break; } 112 { << 113 break; << 114 } << 115 117 116 //----- look for one PV of this LV 118 //----- look for one PV of this LV 117 for(auto ite = pvstore->cbegin(); ite != p << 119 for( ite = pvstore->begin(); ite != pvstore->end(); ite++ ) 118 { 120 { 119 pv = (*ite); 121 pv = (*ite); 120 if(pv->GetLogicalVolume() == lv) << 122 if( pv->GetLogicalVolume() == lv ) 121 { 123 { 122 break; 124 break; 123 } 125 } 124 } 126 } 125 } 127 } 126 128 127 return pv; 129 return pv; 128 } 130 } 129 131 130 // ------------------------------------------- << 132 >> 133 //------------------------------------------------------------------------ 131 G4tgbGeometryDumper::~G4tgbGeometryDumper() 134 G4tgbGeometryDumper::~G4tgbGeometryDumper() 132 { 135 { 133 } 136 } 134 137 135 // ------------------------------------------- << 138 //------------------------------------------------------------------------ 136 void G4tgbGeometryDumper::DumpPhysVol(G4VPhysi << 139 void G4tgbGeometryDumper::DumpPhysVol( G4VPhysicalVolume* pv ) 137 { 140 { >> 141 138 //--- Dump logical volume first 142 //--- Dump logical volume first 139 G4LogicalVolume* lv = pv->GetLogicalVolume() 143 G4LogicalVolume* lv = pv->GetLogicalVolume(); 140 144 141 G4ReflectionFactory* reffact = G4ReflectionF 145 G4ReflectionFactory* reffact = G4ReflectionFactory::Instance(); 142 146 143 //--- It is not needed to dump _refl volumes 147 //--- It is not needed to dump _refl volumes created when parent is reflected 144 // !!WARNING : it must be avoided to reflect 148 // !!WARNING : it must be avoided to reflect a volume hierarchy if children 145 // has also been reflected, as b 149 // has also been reflected, as both will have same name 146 150 147 if(reffact->IsReflected(lv) && reffact->IsRe << 151 if( reffact->IsReflected( lv ) 148 { << 152 && reffact->IsReflected( pv->GetMotherLogical() ) ) { return; } 149 return; << 150 } << 151 153 152 G4bool bVolExists = CheckIfLogVolExists(lv-> << 153 154 >> 155 G4bool bVolExists = CheckIfLogVolExists( lv->GetName(), lv ); >> 156 154 //---- Construct this PV 157 //---- Construct this PV 155 if(pv->GetMotherLogical() != nullptr) // no << 158 if( pv->GetMotherLogical() != 0 ) // not WORLD volume 156 { 159 { 157 if(!pv->IsReplicated()) << 160 if( !pv->IsReplicated() ) 158 { << 161 { 159 G4String lvName = lv->GetName(); 162 G4String lvName = lv->GetName(); 160 if(!bVolExists) << 163 if( !bVolExists ) 161 { 164 { 162 lvName = DumpLogVol(lv); << 165 lvName = DumpLogVol( lv ); 163 } 166 } 164 DumpPVPlacement(pv, lvName); << 167 DumpPVPlacement( pv, lvName ); 165 } << 168 } 166 else if(pv->IsParameterised()) << 169 else if( pv->IsParameterised() ) 167 { << 170 { 168 G4PVParameterised* pvparam = (G4PVParame << 171 G4PVParameterised* pvparam = (G4PVParameterised*)(pv); 169 DumpPVParameterised(pvparam); << 172 DumpPVParameterised( pvparam ); 170 } << 173 } 171 else << 174 else 172 { 175 { 173 G4String lvName = lv->GetName(); 176 G4String lvName = lv->GetName(); 174 if(!bVolExists) << 177 if( !bVolExists ) 175 { 178 { 176 lvName = DumpLogVol(lv); << 179 lvName = DumpLogVol( lv ); 177 } 180 } 178 G4PVReplica* pvrepl = (G4PVReplica*) (pv << 181 G4PVReplica* pvrepl = (G4PVReplica*)(pv); 179 DumpPVReplica(pvrepl, lvName); << 182 DumpPVReplica( pvrepl, lvName ); 180 } 183 } >> 184 181 } 185 } 182 else << 186 else 183 { 187 { 184 DumpLogVol(lv); << 188 DumpLogVol( lv ); 185 } 189 } 186 190 187 if(!bVolExists) << 191 if( !bVolExists ) 188 { 192 { 189 //---- Construct PV's who has this LV as m 193 //---- Construct PV's who has this LV as mother 190 std::vector<G4VPhysicalVolume*> pvChildren << 194 std::vector<G4VPhysicalVolume*> pvChildren = GetPVChildren( lv ); 191 for(auto ite = pvChildren.cbegin(); ite != << 195 std::vector<G4VPhysicalVolume*>::const_iterator ite; >> 196 for( ite = pvChildren.begin(); ite != pvChildren.end(); ite++ ) 192 { 197 { 193 DumpPhysVol(*ite); << 198 DumpPhysVol( *ite ); 194 } 199 } 195 } 200 } 196 } 201 } 197 202 198 // ------------------------------------------- << 203 //------------------------------------------------------------------------ 199 void G4tgbGeometryDumper::DumpPVPlacement(G4VP << 204 void 200 cons << 205 G4tgbGeometryDumper::DumpPVPlacement( G4VPhysicalVolume* pv, >> 206 const G4String& lvName, G4int copyNo ) 201 { 207 { 202 G4String pvName = pv->GetName(); 208 G4String pvName = pv->GetName(); 203 << 209 204 G4RotationMatrix* rotMat = pv->GetRotation() 210 G4RotationMatrix* rotMat = pv->GetRotation(); 205 if(rotMat == nullptr) << 211 if( !rotMat ) rotMat = new G4RotationMatrix(); 206 rotMat = new G4RotationMatrix(); << 212 207 << 208 //---- Check if it is reflected 213 //---- Check if it is reflected 209 G4ReflectionFactory* reffact = G4ReflectionF 214 G4ReflectionFactory* reffact = G4ReflectionFactory::Instance(); 210 G4LogicalVolume* lv = pv->GetLogica << 215 G4LogicalVolume* lv = pv->GetLogicalVolume(); 211 if(reffact->IsReflected(lv)) << 216 if( reffact->IsReflected( lv ) ) 212 { 217 { 213 #ifdef G4VERBOSE 218 #ifdef G4VERBOSE 214 if(G4tgrMessenger::GetVerboseLevel() >= 1) << 219 if( G4tgrMessenger::GetVerboseLevel() >= 1 ) 215 { << 220 { 216 G4cout << " G4tgbGeometryDumper::DumpPVP << 221 G4cout << " G4tgbGeometryDumper::DumpPVPlacement() - Reflected volume: " 217 << pv->GetName() << G4endl; << 222 << pv->GetName() << G4endl; 218 } << 223 } 219 #endif 224 #endif 220 G4ThreeVector colx = rotMat->colX(); 225 G4ThreeVector colx = rotMat->colX(); 221 G4ThreeVector coly = rotMat->colY(); 226 G4ThreeVector coly = rotMat->colY(); 222 G4ThreeVector colz = rotMat->colZ(); 227 G4ThreeVector colz = rotMat->colZ(); 223 // apply a Z reflection (reflection matrix 228 // apply a Z reflection (reflection matrix is decomposed in new 224 // reflection-free rotation + z-reflection 229 // reflection-free rotation + z-reflection) 225 colz *= -1.; 230 colz *= -1.; 226 G4Rep3x3 rottemp(colx.x(), coly.x(), colz. << 231 G4Rep3x3 rottemp(colx.x(),coly.x(),colz.x(), 227 colx.z(), coly.z(), colz. << 232 colx.y(),coly.y(),colz.y(), >> 233 colx.z(),coly.z(),colz.z()); 228 // matrix representation (inverted) 234 // matrix representation (inverted) 229 *rotMat = G4RotationMatrix(rottemp); 235 *rotMat = G4RotationMatrix(rottemp); 230 *rotMat = (*rotMat).inverse(); 236 *rotMat = (*rotMat).inverse(); 231 pvName += "_refl"; 237 pvName += "_refl"; 232 } 238 } 233 const G4String& rotName = DumpRotationMatri << 239 G4String rotName = DumpRotationMatrix( rotMat ); 234 G4ThreeVector pos = pv->GetTranslation(); 240 G4ThreeVector pos = pv->GetTranslation(); 235 241 236 if(copyNo == -999) // for parameterisations << 242 if( copyNo == -999 ) //for parameterisations copy number is provided 237 { 243 { 238 copyNo = pv->GetCopyNo(); 244 copyNo = pv->GetCopyNo(); 239 } 245 } 240 246 241 const G4String& fullname = pvName + "#" + G4 << 247 G4String fullname = pvName 242 + "/" + pv->GetMoth << 248 +"#"+G4UIcommand::ConvertToString(copyNo) 243 << 249 +"/"+pv->GetMotherLogical()->GetName(); 244 if(!CheckIfPhysVolExists(fullname, pv)) << 250 >> 251 if( !CheckIfPhysVolExists(fullname, pv )) 245 { 252 { 246 (*theFile) << ":PLACE " << SubstituteRefl( << 253 (*theFile) 247 << copyNo << " " << 254 << ":PLACE " 248 << SubstituteRefl(AddQuotes(pv- << 255 << SubstituteRefl(AddQuotes(lvName)) 249 << " " << AddQuotes(rotName) << << 256 << " " << copyNo << " " 250 << " " << pos.z() << G4endl; << 257 << SubstituteRefl(AddQuotes(pv->GetMotherLogical()->GetName())) 251 << 258 << " " << AddQuotes(rotName) << " " >> 259 << pos.x() << " " << pos.y() << " " << pos.z() << G4endl; >> 260 252 thePhysVols[fullname] = pv; 261 thePhysVols[fullname] = pv; 253 } 262 } 254 } 263 } 255 264 256 // ------------------------------------------- << 265 257 void G4tgbGeometryDumper::DumpPVParameterised( << 266 //------------------------------------------------------------------------ >> 267 void G4tgbGeometryDumper::DumpPVParameterised( G4PVParameterised* pv ) 258 { 268 { 259 G4String pvName = pv->GetName(); 269 G4String pvName = pv->GetName(); 260 << 270 261 EAxis axis; 271 EAxis axis; 262 G4int nReplicas; 272 G4int nReplicas; 263 G4double width; 273 G4double width; 264 G4double offset; 274 G4double offset; 265 G4bool consuming; 275 G4bool consuming; 266 pv->GetReplicationData(axis, nReplicas, widt 276 pv->GetReplicationData(axis, nReplicas, width, offset, consuming); 267 277 268 G4VPVParameterisation* param = pv->GetParame 278 G4VPVParameterisation* param = pv->GetParameterisation(); 269 279 270 G4LogicalVolume* lv = pv->GetLog << 280 G4LogicalVolume* lv = pv->GetLogicalVolume(); 271 G4VSolid* solid1st = param->Com << 281 G4VSolid* solid1st = param->ComputeSolid(0, pv); 272 G4Material* mate1st = param->Com << 282 G4Material* mate1st = param->ComputeMaterial(0, pv ); 273 std::vector<G4double> params1st = GetSolidPa << 283 std::vector<G4double> params1st = GetSolidParams( solid1st ); 274 std::vector<G4double> newParams; 284 std::vector<G4double> newParams; 275 G4VSolid* newSolid = solid1st; 285 G4VSolid* newSolid = solid1st; 276 G4String lvName; 286 G4String lvName; 277 << 287 278 for(G4int ii = 0; ii < nReplicas; ++ii) << 288 for( G4int ii = 0; ii < nReplicas; ii++ ) 279 { 289 { 280 G4Material* newMate = param->ComputeMateri << 290 G4Material* newMate = param->ComputeMaterial(ii, pv ); 281 if(solid1st->GetEntityType() == "G4Box") << 291 if( solid1st->GetEntityType() == "G4Box") 282 { 292 { 283 G4Box* box = (G4Box*) (solid1st); << 293 G4Box* box = (G4Box*)(solid1st); 284 param->ComputeDimensions(*box, ii, pv); << 294 param->ComputeDimensions(*box, ii, pv ); 285 newParams = GetSolidParams(box); << 295 newParams = GetSolidParams( box ); 286 newSolid = (G4VSolid*) box; << 296 newSolid = (G4VSolid*)box; 287 } << 297 } 288 else if(solid1st->GetEntityType() == "G4Tu << 298 else if( solid1st->GetEntityType() == "G4Tubs") 289 { 299 { 290 G4Tubs* tubs = (G4Tubs*) (solid1st); << 300 G4Tubs* tubs = (G4Tubs*)(solid1st); 291 param->ComputeDimensions(*tubs, ii, pv); << 301 param->ComputeDimensions(*tubs, ii, pv ); 292 newParams = GetSolidParams(tubs); << 302 newParams = GetSolidParams( tubs ); 293 newSolid = (G4VSolid*) tubs; << 303 newSolid = (G4VSolid*)tubs; 294 } 304 } 295 else if(solid1st->GetEntityType() == "G4Tr << 305 else if( solid1st->GetEntityType() == "G4Trd") 296 { 306 { 297 G4Trd* trd = (G4Trd*) (solid1st); << 307 G4Trd* trd = (G4Trd*)(solid1st); 298 param->ComputeDimensions(*trd, ii, pv); << 308 param->ComputeDimensions(*trd, ii, pv ); 299 newParams = GetSolidParams(trd); << 309 newParams = GetSolidParams( trd ); 300 newSolid = (G4VSolid*) trd; << 310 newSolid = (G4VSolid*)trd; 301 } 311 } 302 else if(solid1st->GetEntityType() == "G4Tr << 312 else if( solid1st->GetEntityType() == "G4Trap") 303 { 313 { 304 G4Trap* trap = (G4Trap*) (solid1st); << 314 G4Trap* trap = (G4Trap*)(solid1st); 305 param->ComputeDimensions(*trap, ii, pv); << 315 param->ComputeDimensions(*trap, ii, pv ); 306 newParams = GetSolidParams(trap); << 316 newParams = GetSolidParams( trap ); 307 newSolid = (G4VSolid*) trap; << 317 newSolid = (G4VSolid*)trap; 308 } 318 } 309 else if(solid1st->GetEntityType() == "G4Co << 319 else if( solid1st->GetEntityType() == "G4Cons") 310 { 320 { 311 G4Cons* cons = (G4Cons*) (solid1st); << 321 G4Cons* cons = (G4Cons*)(solid1st); 312 param->ComputeDimensions(*cons, ii, pv); << 322 param->ComputeDimensions(*cons, ii, pv ); 313 newParams = GetSolidParams(cons); << 323 newParams = GetSolidParams( cons ); 314 newSolid = (G4VSolid*) cons; << 324 newSolid = (G4VSolid*)cons; 315 } 325 } 316 else if(solid1st->GetEntityType() == "G4Sp << 326 else if( solid1st->GetEntityType() == "G4Sphere") 317 { 327 { 318 G4Sphere* sphere = (G4Sphere*) (solid1st << 328 G4Sphere* sphere = (G4Sphere*)(solid1st); 319 param->ComputeDimensions(*sphere, ii, pv << 329 param->ComputeDimensions(*sphere, ii, pv ); 320 newParams = GetSolidParams(sphere); << 330 newParams = GetSolidParams( sphere ); 321 newSolid = (G4VSolid*) sphere; << 331 newSolid = (G4VSolid*)sphere; 322 } 332 } 323 else if(solid1st->GetEntityType() == "G4Or << 333 else if( solid1st->GetEntityType() == "G4Orb") 324 { 334 { 325 G4Orb* orb = (G4Orb*) (solid1st); << 335 G4Orb* orb = (G4Orb*)(solid1st); 326 param->ComputeDimensions(*orb, ii, pv); << 336 param->ComputeDimensions(*orb, ii, pv ); 327 newParams = GetSolidParams(orb); << 337 newParams = GetSolidParams( orb ); 328 newSolid = (G4VSolid*) orb; << 338 newSolid = (G4VSolid*)orb; 329 } 339 } 330 else if(solid1st->GetEntityType() == "G4To << 340 else if( solid1st->GetEntityType() == "G4Torus") 331 { 341 { 332 G4Torus* torus = (G4Torus*) (solid1st); << 342 G4Torus* torus = (G4Torus*)(solid1st); 333 param->ComputeDimensions(*torus, ii, pv) << 343 param->ComputeDimensions(*torus, ii, pv ); 334 newParams = GetSolidParams(torus); << 344 newParams = GetSolidParams( torus ); 335 newSolid = (G4VSolid*) torus; << 345 newSolid = (G4VSolid*)torus; 336 } 346 } 337 else if(solid1st->GetEntityType() == "G4Pa << 347 else if( solid1st->GetEntityType() == "G4Para") 338 { 348 { 339 G4Para* para = (G4Para*) (solid1st); << 349 G4Para* para = (G4Para*)(solid1st); 340 param->ComputeDimensions(*para, ii, pv); << 350 param->ComputeDimensions(*para, ii, pv ); 341 newParams = GetSolidParams(para); << 351 newParams = GetSolidParams( para ); 342 newSolid = (G4VSolid*) para; << 352 newSolid = (G4VSolid*)para; 343 } 353 } 344 else if(solid1st->GetEntityType() == "G4Po << 354 else if( solid1st->GetEntityType() == "G4Polycone") 345 { 355 { 346 G4Polycone* polycone = (G4Polycone*) (so << 356 G4Polycone* polycone = (G4Polycone*)(solid1st); 347 param->ComputeDimensions(*polycone, ii, << 357 param->ComputeDimensions(*polycone, ii, pv ); 348 newParams = GetSolidParams(polycone); << 358 newParams = GetSolidParams( polycone ); 349 newSolid = (G4VSolid*) polycone; << 359 newSolid = (G4VSolid*)polycone; 350 } 360 } 351 else if(solid1st->GetEntityType() == "G4Po << 361 else if( solid1st->GetEntityType() == "G4Polyhedra") 352 { 362 { 353 G4Polyhedra* polyhedra = (G4Polyhedra*) << 363 G4Polyhedra* polyhedra = (G4Polyhedra*)(solid1st); 354 param->ComputeDimensions(*polyhedra, ii, << 364 param->ComputeDimensions(*polyhedra, ii, pv ); 355 newParams = GetSolidParams(polyhedra); << 365 newParams = GetSolidParams( polyhedra ); 356 newSolid = (G4VSolid*) polyhedra; << 366 newSolid = (G4VSolid*)polyhedra; 357 } 367 } 358 else if(solid1st->GetEntityType() == "G4Hy << 368 else if( solid1st->GetEntityType() == "G4Hype") 359 { 369 { 360 G4Hype* hype = (G4Hype*) (solid1st); << 370 G4Hype* hype = (G4Hype*)(solid1st); 361 param->ComputeDimensions(*hype, ii, pv); << 371 param->ComputeDimensions(*hype, ii, pv ); 362 newParams = GetSolidParams(hype); << 372 newParams = GetSolidParams( hype ); 363 newSolid = (G4VSolid*) hype; << 373 newSolid = (G4VSolid*)hype; 364 } 374 } 365 if(ii == 0 || mate1st != newMate || params << 375 if( ii == 0 || mate1st != newMate || params1st[0] != newParams[0] ) 366 { 376 { 367 G4String extraName = ""; 377 G4String extraName = ""; 368 if(ii != 0) << 378 if( ii != 0 ) 369 { 379 { 370 extraName = "#" + G4UIcommand::Convert << 380 extraName= "#"+G4UIcommand::ConvertToString(ii) 371 pv->GetMotherLogical()->Ge << 381 +"/"+pv->GetMotherLogical()->GetName(); 372 } 382 } 373 lvName = DumpLogVol(lv, extraName, newSo << 383 lvName = DumpLogVol( lv, extraName, newSolid, newMate ); 374 } 384 } 375 << 385 376 param->ComputeTransformation(ii, pv); 386 param->ComputeTransformation(ii, pv); 377 DumpPVPlacement(pv, lvName, ii); << 387 DumpPVPlacement( pv, lvName, ii ); 378 } 388 } 379 } 389 } 380 390 381 // ------------------------------------------- << 391 382 void G4tgbGeometryDumper::DumpPVReplica(G4PVRe << 392 //------------------------------------------------------------------------ >> 393 void G4tgbGeometryDumper::DumpPVReplica( G4PVReplica* pv, >> 394 const G4String& lvName ) 383 { 395 { 384 EAxis axis; 396 EAxis axis; 385 G4int nReplicas; 397 G4int nReplicas; 386 G4double width; 398 G4double width; 387 G4double offset; 399 G4double offset; 388 G4bool consuming; 400 G4bool consuming; 389 pv->GetReplicationData(axis, nReplicas, widt 401 pv->GetReplicationData(axis, nReplicas, width, offset, consuming); 390 G4String axisName; 402 G4String axisName; 391 switch(axis) << 403 switch (axis ) 392 { 404 { 393 case kXAxis: << 405 case kXAxis: 394 axisName = "X"; << 406 axisName = "X"; 395 break; << 407 break; 396 case kYAxis: << 408 case kYAxis: 397 axisName = "Y"; << 409 axisName = "Y"; 398 break; << 410 break; 399 case kZAxis: << 411 case kZAxis: 400 axisName = "Z"; << 412 axisName = "Z"; 401 break; << 413 break; 402 case kRho: << 414 case kRho: 403 axisName = "R"; << 415 axisName = "R"; 404 break; << 416 break; 405 case kPhi: << 417 case kPhi: 406 axisName = "PHI"; << 418 axisName = "PHI"; 407 break; << 419 break; 408 case kRadial3D: << 420 case kRadial3D: 409 case kUndefined: << 421 case kUndefined: 410 G4String ErrMessage = << 422 G4String ErrMessage = "Unknown axis of replication for volume" 411 "Unknown axis of replication for volum << 423 + pv->GetName(); 412 G4Exception("G4tgbGeometryDumper::DumpPV << 424 G4Exception("G4tgbGeometryDumper::DumpPVReplica", 413 FatalException, ErrMessage); << 425 "Wrong axis ", FatalException, ErrMessage); 414 break; << 426 break; 415 } 427 } 416 428 417 const G4String& fullname = lvName + "/" + pv << 429 G4String fullname = lvName 418 << 430 +"/"+pv->GetMotherLogical()->GetName(); 419 if(!CheckIfPhysVolExists(fullname, pv)) << 431 >> 432 if( !CheckIfPhysVolExists(fullname, pv )) 420 { 433 { 421 (*theFile) << ":REPL " << SubstituteRefl(A << 434 (*theFile) 422 << SubstituteRefl(AddQuotes(pv- << 435 << ":REPL " 423 << " " << axisName << " " << nR << 436 << SubstituteRefl(AddQuotes(lvName)) 424 if(axis != kPhi) << 437 << " " << SubstituteRefl(AddQuotes(pv->GetMotherLogical()->GetName())) 425 { << 438 << " " << axisName 426 (*theFile) << " " << width << " " << off << 439 << " " << nReplicas; 427 } << 440 if( axis != kPhi ) >> 441 { >> 442 (*theFile) >> 443 << " " << width >> 444 << " " << offset << G4endl; >> 445 } 428 else 446 else 429 { 447 { 430 (*theFile) << " " << width / deg << "*de << 448 (*theFile) 431 << " " << offset / deg << "*d << 449 << " " << width/deg << "*deg" >> 450 << " " << offset/deg << "*deg" << G4endl; 432 } 451 } 433 452 434 thePhysVols[fullname] = pv; 453 thePhysVols[fullname] = pv; 435 } 454 } 436 } 455 } 437 456 438 // ------------------------------------------- << 457 439 G4String G4tgbGeometryDumper::DumpLogVol(G4Log << 458 //------------------------------------------------------------------------ 440 const << 459 G4String 441 G4VSo << 460 G4tgbGeometryDumper::DumpLogVol( G4LogicalVolume* lv, G4String extraName, 442 G4Mat << 461 G4VSolid* solid, G4Material* mate ) 443 { 462 { 444 G4String lvName; 463 G4String lvName; 445 << 464 446 if(extraName == "") //--- take out the '_re << 465 if( extraName == "" ) //--- take out the '_refl' in the name 447 { 466 { 448 lvName = GetObjectName(lv, theLogVols); << 467 lvName = GetObjectName(lv,theLogVols); 449 } << 468 } 450 else << 469 else 451 { 470 { 452 lvName = lv->GetName() + extraName; << 471 lvName = lv->GetName()+extraName; 453 } 472 } 454 473 455 if(theLogVols.find(lvName) != theLogVols.cen << 474 if( theLogVols.find( lvName ) != theLogVols.end() ) // alredy dumped 456 { 475 { 457 return lvName; 476 return lvName; 458 } 477 } 459 478 460 if(solid == nullptr) << 479 if( !solid ) { solid = lv->GetSolid(); } 461 { << 462 solid = lv->GetSolid(); << 463 } << 464 480 465 //---- Dump solid << 481 //---- Dump solid 466 const G4String& solidName = DumpSolid(solid, << 482 G4String solidName = DumpSolid( solid, extraName ); 467 483 468 //---- Dump material 484 //---- Dump material 469 if(mate == nullptr) << 485 if( !mate ) { mate = lv->GetMaterial(); } 470 { << 486 G4String mateName = DumpMaterial( mate ); 471 mate = lv->GetMaterial(); << 472 } << 473 const G4String& mateName = DumpMaterial(mate << 474 487 475 //---- Dump logical volume (solid + material 488 //---- Dump logical volume (solid + material) 476 (*theFile) << ":VOLU " << SubstituteRefl(Add 489 (*theFile) << ":VOLU " << SubstituteRefl(AddQuotes(lvName)) << " " 477 << SupressRefl(AddQuotes(solidNam << 490 << SupressRefl(AddQuotes(solidName)) 478 << G4endl; << 491 << " " << AddQuotes(mateName) << G4endl; 479 492 480 theLogVols[lvName] = lv; 493 theLogVols[lvName] = lv; 481 494 482 return lvName; 495 return lvName; 483 } 496 } 484 497 485 // ------------------------------------------- << 498 486 G4String G4tgbGeometryDumper::DumpMaterial(G4M << 499 //------------------------------------------------------------------------ >> 500 G4String G4tgbGeometryDumper::DumpMaterial( G4Material* mat ) 487 { 501 { 488 const G4String& mateName = GetObjectName(mat << 502 G4String mateName = GetObjectName(mat,theMaterials); 489 if(theMaterials.find(mateName) != theMateria << 503 if( theMaterials.find( mateName ) != theMaterials.end() ) // alredy dumped 490 { 504 { 491 return mateName; 505 return mateName; 492 } 506 } 493 507 494 std::size_t numElements = mat->GetNumberOfEl << 508 size_t numElements = mat->GetNumberOfElements(); 495 G4double density = mat->GetDensity() / g * << 509 G4double density = mat->GetDensity()/g*cm3; 496 510 >> 511 497 // start tag 512 // start tag 498 // 513 // 499 if(numElements == 1) << 514 if (numElements == 1) 500 { 515 { 501 (*theFile) << ":MATE " << AddQuotes(mateNa << 516 (*theFile) << ":MATE " << AddQuotes(mateName) << " " 502 << mat->GetA() / (g / mole) << << 517 << mat->GetZ() << " " << mat->GetA()/(g/mole) << " " >> 518 << density << G4endl; 503 } 519 } 504 else 520 else 505 { 521 { 506 const G4ElementVector* elems = mat->GetEle 522 const G4ElementVector* elems = mat->GetElementVector(); 507 const G4double* fractions = mat->GetFra 523 const G4double* fractions = mat->GetFractionVector(); 508 for(std::size_t ii = 0; ii < numElements; << 524 for (size_t ii = 0; ii < numElements; ii++) 509 { 525 { 510 DumpElement(const_cast<G4Element*>((*ele << 526 DumpElement( (*elems)[ii] ); 511 } 527 } 512 528 513 (*theFile) << ":MIXT " << AddQuotes(mateNa << 529 (*theFile) << ":MIXT "<< AddQuotes(mateName) << " " 514 << numElements << G4endl; << 530 << density << " " << numElements << G4endl; 515 // close start element tag and get ready t 531 // close start element tag and get ready to do composit "parts" 516 for(std::size_t ii = 0; ii < numElements; << 532 for (size_t ii = 0; ii < numElements; ii++) 517 { 533 { 518 (*theFile) << " " << AddQuotes(GetObje << 534 (*theFile) << " " 519 << " " << fractions[ii] << G4 << 535 << AddQuotes(GetObjectName((*elems)[ii],theElements)) << " " >> 536 << fractions[ii] << G4endl; 520 } 537 } >> 538 521 } 539 } 522 540 523 (*theFile) << ":MATE_MEE " << AddQuotes(mate << 541 (*theFile) << ":MATE_MEE " << AddQuotes(mateName) << " " 524 << mat->GetIonisation()->GetMeanE << 542 << mat->GetIonisation()->GetMeanExcitationEnergy()/eV 525 << G4endl; << 543 << "*eV" << G4endl; 526 544 527 (*theFile) << ":MATE_TEMPERATURE " << AddQuo 545 (*theFile) << ":MATE_TEMPERATURE " << AddQuotes(mateName) << " " 528 << mat->GetTemperature() / kelvin << 546 << mat->GetTemperature()/kelvin << "*kelvin" << G4endl; 529 547 530 (*theFile) << ":MATE_PRESSURE " << AddQuotes 548 (*theFile) << ":MATE_PRESSURE " << AddQuotes(mateName) << " " 531 << mat->GetPressure() / atmospher << 549 << mat->GetPressure()/atmosphere << "*atmosphere" << G4endl; 532 550 533 G4State state = mat->GetState(); 551 G4State state = mat->GetState(); 534 G4String stateStr; << 552 G4String stateStr; 535 switch(state) << 553 switch (state) { 536 { << 554 case kStateUndefined: 537 case kStateUndefined: << 555 stateStr = "Undefined"; 538 stateStr = "Undefined"; << 556 break; 539 break; << 557 case kStateSolid: 540 case kStateSolid: << 558 stateStr = "Solid"; 541 stateStr = "Solid"; << 559 break; 542 break; << 560 case kStateLiquid: 543 case kStateLiquid: << 561 stateStr = "Liquid"; 544 stateStr = "Liquid"; << 562 break; 545 break; << 563 case kStateGas: 546 case kStateGas: << 564 stateStr = "Gas"; 547 stateStr = "Gas"; << 565 break; 548 break; << 566 } 549 } << 567 550 << 568 (*theFile) << ":MATE_STATE " << AddQuotes(mateName) << " " 551 (*theFile) << ":MATE_STATE " << AddQuotes(ma << 569 << stateStr << G4endl; 552 << G4endl; << 553 570 554 theMaterials[mateName] = mat; 571 theMaterials[mateName] = mat; 555 572 556 return mateName; 573 return mateName; 557 } 574 } 558 575 559 // ------------------------------------------- << 576 560 void G4tgbGeometryDumper::DumpElement(G4Elemen << 577 //------------------------------------------------------------------------ >> 578 void G4tgbGeometryDumper::DumpElement( G4Element* ele) 561 { 579 { 562 const G4String& elemName = GetObjectName(ele << 580 G4String elemName = GetObjectName(ele,theElements); 563 581 564 if(theElements.find(elemName) != theElements << 582 if( theElements.find( elemName ) != theElements.end() ) // alredy dumped 565 { 583 { 566 return; 584 return; 567 } 585 } 568 586 569 //--- Add symbol name: Material mixtures sto 587 //--- Add symbol name: Material mixtures store the components as elements 570 // (even if the input are materials), but 588 // (even if the input are materials), but without symbol 571 // 589 // 572 G4String symbol = ele->GetSymbol(); 590 G4String symbol = ele->GetSymbol(); 573 if(symbol == "" || symbol == " ") << 591 if( symbol == "" || symbol == " " ) 574 { 592 { 575 symbol = elemName; 593 symbol = elemName; 576 } 594 } 577 595 578 if(ele->GetNumberOfIsotopes() == 0) << 596 if( ele->GetNumberOfIsotopes() == 0 ) 579 { 597 { 580 (*theFile) << ":ELEM " << AddQuotes(elemNa << 598 (*theFile) << ":ELEM " << AddQuotes(elemName) << " " 581 << " " << ele->GetZ() << " " << << 599 << AddQuotes(symbol) << " " << ele->GetZ() << " " 582 << G4endl; << 600 << ele->GetA()/(g/mole) << " " << G4endl; 583 } << 601 } 584 else << 602 else 585 { 603 { 586 const G4IsotopeVector* isots = ele->GetIso 604 const G4IsotopeVector* isots = ele->GetIsotopeVector(); 587 for(std::size_t ii = 0; ii < ele->GetNumbe << 605 for (size_t ii = 0; ii < ele->GetNumberOfIsotopes(); ii++) 588 { 606 { 589 DumpIsotope((*isots)[ii]); << 607 DumpIsotope( (*isots)[ii] ); 590 } 608 } 591 609 592 (*theFile) << ":ELEM_FROM_ISOT " << AddQuo 610 (*theFile) << ":ELEM_FROM_ISOT " << AddQuotes(elemName) << " " 593 << AddQuotes(symbol) << " " << 611 << AddQuotes(symbol) << " " << ele->GetNumberOfIsotopes() 594 << G4endl; 612 << G4endl; 595 const G4double* fractions = ele->GetRelati << 613 const G4double* fractions = ele->GetRelativeAbundanceVector(); 596 for(std::size_t ii = 0; ii < ele->GetNumbe << 614 for (size_t ii = 0; ii < ele->GetNumberOfIsotopes(); ii++) 597 { 615 { 598 (*theFile) << " " << AddQuotes(GetObje << 616 (*theFile) << " " 599 << " " << fractions[ii] << G4 << 617 << AddQuotes(GetObjectName((*isots)[ii],theIsotopes)) << " " >> 618 << fractions[ii] << G4endl; 600 } 619 } 601 } 620 } 602 theElements[elemName] = ele; 621 theElements[elemName] = ele; 603 } 622 } 604 623 605 // ------------------------------------------- << 624 606 void G4tgbGeometryDumper::DumpIsotope(G4Isotop << 625 //------------------------------------------------------------------------ >> 626 void G4tgbGeometryDumper::DumpIsotope( G4Isotope* isot) 607 { 627 { 608 const G4String& isotName = GetObjectName(iso << 628 G4String isotName = GetObjectName(isot,theIsotopes); 609 if(theIsotopes.find(isotName) != theIsotopes << 629 if( theIsotopes.find( isotName ) != theIsotopes.end() ) // alredy dumped 610 { 630 { 611 return; 631 return; 612 } 632 } 613 633 614 (*theFile) << ":ISOT " << AddQuotes(isotName << 634 (*theFile) << ":ISOT " << AddQuotes(isotName) << " " 615 << isot->GetN() << " " << isot->G << 635 << isot->GetZ() << " " << isot->GetN() << " " 616 << G4endl; << 636 << isot->GetA()/(g/mole) << " " << G4endl; 617 637 618 theIsotopes[isotName] = isot; 638 theIsotopes[isotName] = isot; 619 } 639 } 620 640 621 // ------------------------------------------- << 641 622 G4String G4tgbGeometryDumper::DumpSolid(G4VSol << 642 //------------------------------------------------------------------------ 623 const << 643 G4String G4tgbGeometryDumper::DumpSolid( G4VSolid* solid, >> 644 const G4String& extraName ) 624 { 645 { 625 G4String solidName; 646 G4String solidName; 626 if(extraName == "") << 647 if( extraName == "" ) 627 { 648 { 628 solidName = GetObjectName(solid, theSolids << 649 solidName = GetObjectName(solid,theSolids); 629 } << 650 } 630 else << 651 else 631 { 652 { 632 solidName = solid->GetName() + extraName; << 653 solidName = solid->GetName()+extraName; 633 } 654 } 634 655 635 if(theSolids.find(solidName) != theSolids.ce << 656 if( theSolids.find( solidName ) != theSolids.end() ) // alredy dumped 636 { 657 { 637 return solidName; 658 return solidName; 638 } 659 } 639 660 640 G4String solidType = solid->GetEntityType(); 661 G4String solidType = solid->GetEntityType(); 641 solidType = GetTGSolidType(solidTyp << 662 solidType = GetTGSolidType( solidType ); 642 << 663 643 if(solidType == "UNIONSOLID") << 664 if (solidType == "UNIONSOLID") 644 { << 645 DumpBooleanVolume("UNION", solid); << 646 } << 647 else if(solidType == "SUBTRACTIONSOLID") << 648 { << 649 DumpBooleanVolume("SUBTRACTION", solid); << 650 } << 651 else if(solidType == "INTERSECTIONSOLID") << 652 { << 653 DumpBooleanVolume("INTERSECTION", solid); << 654 } << 655 else if(solidType == "REFLECTEDSOLID") << 656 { 665 { >> 666 DumpBooleanVolume( "UNION", solid ); >> 667 >> 668 } else if (solidType == "SUBTRACTIONSOLID") { >> 669 DumpBooleanVolume( "SUBTRACTION", solid ); >> 670 >> 671 } else if (solidType == "INTERSECTIONSOLID") { >> 672 DumpBooleanVolume( "INTERSECTION", solid ); >> 673 >> 674 } else if (solidType == "REFLECTEDSOLID") { 657 G4ReflectedSolid* solidrefl = dynamic_cast 675 G4ReflectedSolid* solidrefl = dynamic_cast<G4ReflectedSolid*>(solid); 658 if(solidrefl == nullptr) << 676 if (!solidrefl) 659 { 677 { 660 G4Exception("G4tgbGeometryDumper::DumpSo << 678 G4Exception("G4tgbGeometryDumper::DumpSolid()", 661 FatalException, "Invalid ref << 679 "InvalidType", FatalException, "Invalid reflected solid!"); 662 return solidName; 680 return solidName; 663 } 681 } 664 G4VSolid* solidori = solidrefl->GetConstit 682 G4VSolid* solidori = solidrefl->GetConstituentMovedSolid(); 665 DumpSolid(solidori); << 683 DumpSolid( solidori ); 666 } << 667 else if(solidType == "MULTIUNION") << 668 { << 669 DumpMultiUnionVolume(solid); << 670 } << 671 else if(solidType == "SCALEDSOLID") << 672 { << 673 DumpScaledVolume(solid); << 674 } 684 } 675 else 685 else 676 { 686 { 677 (*theFile) << ":SOLID " << AddQuotes(solid 687 (*theFile) << ":SOLID " << AddQuotes(solidName) << " "; 678 (*theFile) << AddQuotes(solidType) << " "; 688 (*theFile) << AddQuotes(solidType) << " "; 679 DumpSolidParams( solid ); 689 DumpSolidParams( solid ); 680 theSolids[solidName] = solid; 690 theSolids[solidName] = solid; 681 } 691 } 682 692 683 return solidName; 693 return solidName; 684 } 694 } 685 695 686 // ------------------------------------------- << 696 687 void G4tgbGeometryDumper::DumpBooleanVolume(co << 697 //------------------------------------------------------------------------ 688 G4 << 698 void G4tgbGeometryDumper::DumpBooleanVolume( const G4String& solidType, 689 { << 699 G4VSolid* so ) 690 G4BooleanSolid* bso = dynamic_cast<G4Boolean << 700 { 691 if(bso == nullptr) << 701 G4BooleanSolid * bso = dynamic_cast < G4BooleanSolid * > (so); 692 { << 702 if (!bso) { return; } 693 return; << 703 G4VSolid* solid0 = bso->GetConstituentSolid( 0 ); 694 } << 704 G4VSolid* solid1 = bso->GetConstituentSolid( 1 ); 695 G4VSolid* solid0 = bso->GetConst << 705 G4DisplacedSolid* solid1Disp = 0; 696 G4VSolid* solid1 = bso->GetConst << 706 G4bool displaced = dynamic_cast<G4DisplacedSolid*>(solid1); 697 G4DisplacedSolid* solid1Disp = nullptr; << 707 if( displaced ) 698 G4bool displaced = dynamic_cast< << 699 if(displaced) << 700 { 708 { 701 solid1Disp = dynamic_cast<G4DisplacedSolid 709 solid1Disp = dynamic_cast<G4DisplacedSolid*>(solid1); 702 if(solid1Disp != nullptr) << 710 if (solid1Disp) { solid1 = solid1Disp->GetConstituentMovedSolid(); } 703 { << 704 solid1 = solid1Disp->GetConstituentMoved << 705 } << 706 else << 707 { << 708 return; << 709 } << 710 } 711 } 711 DumpSolid(solid0); << 712 DumpSolid( solid0 ); 712 DumpSolid(solid1); << 713 DumpSolid( solid1 ); 713 714 714 G4String rotName; 715 G4String rotName; 715 G4ThreeVector pos; 716 G4ThreeVector pos; 716 if(displaced) << 717 if( displaced ) 717 { 718 { 718 pos = solid1Disp->GetObjectTranslation(); << 719 pos = solid1Disp->GetObjectTranslation(); // translation is of mother frame 719 rotName = DumpRotationMatrix(new G4Rotatio << 720 rotName = DumpRotationMatrix( new G4RotationMatrix( (solid1Disp-> 720 (solid1Disp->GetTransform().NetRotation( << 721 GetTransform().NetRotation()).inverse() ) ); 721 } 722 } 722 else // no displacement 723 else // no displacement 723 { 724 { 724 rotName = DumpRotationMatrix(new G4Rotatio << 725 rotName = DumpRotationMatrix( new G4RotationMatrix ); 725 pos = G4ThreeVector(); << 726 pos = G4ThreeVector(); 726 } 727 } 727 728 728 const G4String& bsoName = GetObjectName(so, << 729 G4String bsoName = GetObjectName(so,theSolids); 729 if(theSolids.find(bsoName) != theSolids.cend << 730 if( theSolids.find( bsoName ) != theSolids.end() ) return; // alredy dumped 730 const G4String& solid0Name = FindSolidName(s << 731 G4String solid0Name = FindSolidName( solid0 ); 731 const G4String& solid1Name = FindSolidName(s << 732 G4String solid1Name = FindSolidName( solid1 ); 732 << 733 733 (*theFile) << ":SOLID " << AddQuotes(bsoName << 734 (*theFile) << ":SOLID " 734 << " " << AddQuotes(solid0Name) < << 735 << AddQuotes(bsoName) << " " 735 << " " << AddQuotes(rotName) << " << 736 << AddQuotes(solidType) << " " 736 << approxTo0(pos.y()) << " " << a << 737 << AddQuotes(solid0Name) << " " 737 << G4endl; << 738 << AddQuotes(solid1Name) << " " >> 739 << AddQuotes(rotName) << " " >> 740 << approxTo0(pos.x()) << " " >> 741 << approxTo0(pos.y()) << " " >> 742 << approxTo0(pos.z()) << " " << G4endl; 738 743 739 theSolids[bsoName] = bso; 744 theSolids[bsoName] = bso; 740 } 745 } 741 746 742 // ------------------------------------------- << 743 void G4tgbGeometryDumper::DumpMultiUnionVolume << 744 { << 745 const G4MultiUnion* muun = dynamic_cast<cons << 746 if(muun != nullptr) << 747 { << 748 G4int nSolids = muun->GetNumberOfSolids( << 749 std::vector<G4String> rotList; << 750 for( G4int iso = 0; iso < nSolids; iso++ << 751 G4Transform3D trans = muun->GetTransformatio << 752 const G4String& rotName = DumpRotationMatrix << 753 rotList.push_back(rotName); << 754 G4VSolid* solN = muun->GetSolid(iso); << 755 DumpSolid(solN); << 756 } << 757 const G4String& bsoName = GetObjectName( << 758 (*theFile) << ":SOLID " << AddQuotes(bso << 759 << nSolids; << 760 << 761 for( G4int iso = 0; iso < nSolids; ++iso << 762 G4VSolid* solN = muun->GetSolid(iso); << 763 G4Transform3D trans = muun->GetTransformatio << 764 G4ThreeVector pos = trans.getTranslation(); << 765 (*theFile) << " " << solN->GetName() << 766 << " " << " " << rotList[iso] << 767 << " " << approxTo0(pos.x()) << 768 << " " << approxTo0(pos.y()) << 769 << " " << approxTo0(pos.z()); << 770 } << 771 (*theFile) << G4endl; << 772 << 773 } << 774 } << 775 << 776 // ------------------------------------------- << 777 void G4tgbGeometryDumper::DumpScaledVolume( G4 << 778 { << 779 const G4ScaledSolid* ssol = dynamic_cast<con << 780 if(ssol != nullptr) << 781 { << 782 G4VSolid* unscaledSolid = ssol->GetUnsca << 783 G4Scale3D scaleTransf = ssol->GetScaleTr << 784 G4String bsoName = GetObjectName(const_c << 785 (*theFile) << ":SOLID " << AddQuotes(bso << 786 << unscaledSolid->GetName() << " " << 787 << scaleTransf.xx() << " " << 788 << scaleTransf.yy() << " " << 789 << scaleTransf.zz() << G4endl; << 790 } << 791 } << 792 747 793 // ------------------------------------------- << 748 //------------------------------------------------------------------------ 794 void G4tgbGeometryDumper::DumpSolidParams(G4VS << 749 void G4tgbGeometryDumper::DumpSolidParams( G4VSolid * so) 795 { 750 { 796 std::vector<G4double> params = GetSolidParam << 751 std::vector<G4double> params = GetSolidParams( so ); 797 for(std::size_t ii = 0; ii < params.size(); << 752 for( size_t ii = 0 ; ii < params.size(); ii++ ) 798 { << 753 { 799 (*theFile) << params[ii] << " "; << 754 (*theFile) << params[ii] << " " ; 800 } 755 } 801 (*theFile) << G4endl; 756 (*theFile) << G4endl; 802 } 757 } 803 758 804 // ------------------------------------------- << 759 805 std::vector<G4double> G4tgbGeometryDumper::Get << 760 //------------------------------------------------------------------------ >> 761 std::vector<G4double> G4tgbGeometryDumper::GetSolidParams( const G4VSolid * so) 806 { 762 { 807 std::vector<G4double> params; 763 std::vector<G4double> params; 808 764 809 G4String solidType = so->GetEntityType(); 765 G4String solidType = so->GetEntityType(); 810 solidType = GetTGSolidType(solidTyp << 766 solidType = GetTGSolidType( solidType ); 811 767 812 if(solidType == "BOX") << 768 if (solidType == "BOX") { 813 { << 769 const G4Box * sb = dynamic_cast < const G4Box*>(so); 814 const G4Box* sb = dynamic_cast<const G4Box << 770 if (sb) { 815 if(sb != nullptr) << 771 params.push_back( sb->GetXHalfLength() ); 816 { << 772 params.push_back( sb->GetYHalfLength() ); 817 params.push_back(sb->GetXHalfLength()); << 773 params.push_back( sb->GetZHalfLength() ); 818 params.push_back(sb->GetYHalfLength()); << 774 } 819 params.push_back(sb->GetZHalfLength()); << 775 } else if (solidType == "TUBS") { 820 } << 776 const G4Tubs * tu = dynamic_cast < const G4Tubs * > (so); 821 } << 777 if (tu) { 822 else if(solidType == "TUBS") << 778 params.push_back( tu->GetInnerRadius() ); 823 { << 779 params.push_back( tu->GetOuterRadius() ); 824 const G4Tubs* tu = dynamic_cast<const G4Tu << 780 params.push_back( tu->GetZHalfLength() ); 825 if(tu != nullptr) << 781 params.push_back( tu->GetStartPhiAngle()/deg ); 826 { << 782 params.push_back( tu->GetDeltaPhiAngle()/deg ); 827 params.push_back(tu->GetInnerRadius()); << 783 } 828 params.push_back(tu->GetOuterRadius()); << 784 } else if (solidType == "TRAP") { 829 params.push_back(tu->GetZHalfLength()); << 785 const G4Trap * trp = dynamic_cast < const G4Trap * > (so); 830 params.push_back(tu->GetStartPhiAngle() << 786 if (trp) { 831 params.push_back(tu->GetDeltaPhiAngle() << 832 } << 833 } << 834 else if(solidType == "TRAP") << 835 { << 836 const G4Trap* trp = dynamic_cast<const G4T << 837 if(trp != nullptr) << 838 { << 839 G4ThreeVector symAxis(trp->GetSymAxis()) 787 G4ThreeVector symAxis(trp->GetSymAxis()); 840 params.push_back(trp->GetZHalfLength()); << 788 params.push_back( trp->GetZHalfLength() ); 841 params.push_back(symAxis.theta() / deg); << 789 params.push_back( symAxis.theta()/deg); 842 params.push_back(symAxis.phi() / deg); << 790 params.push_back( symAxis.phi()/deg); 843 params.push_back(trp->GetYHalfLength1()) << 791 params.push_back( trp->GetYHalfLength1() ); 844 params.push_back(trp->GetXHalfLength1()) << 792 params.push_back( trp->GetXHalfLength1() ); 845 params.push_back(trp->GetXHalfLength2()) << 793 params.push_back( trp->GetXHalfLength2() ); 846 params.push_back(std::atan(trp->GetTanAl << 794 params.push_back( std::atan(trp->GetTanAlpha1())/deg ); 847 params.push_back(trp->GetYHalfLength2()) << 795 params.push_back( trp->GetYHalfLength2() ); 848 params.push_back(trp->GetXHalfLength3()) << 796 params.push_back( trp->GetXHalfLength3() ); 849 params.push_back(trp->GetXHalfLength4()) << 797 params.push_back( trp->GetXHalfLength4() ); 850 params.push_back(std::atan(trp->GetTanAl << 798 params.push_back( std::atan(trp->GetTanAlpha2())/deg ); 851 } << 799 } 852 } << 800 } else if (solidType == "TRD") { 853 else if(solidType == "TRD") << 801 const G4Trd * tr = dynamic_cast < const G4Trd * > (so); 854 { << 802 if (tr) { 855 const G4Trd* tr = dynamic_cast<const G4Trd << 803 params.push_back( tr->GetXHalfLength1() ); 856 if(tr != nullptr) << 804 params.push_back( tr->GetXHalfLength2() ); 857 { << 805 params.push_back( tr->GetYHalfLength1() ); 858 params.push_back(tr->GetXHalfLength1()); << 806 params.push_back( tr->GetYHalfLength2() ); 859 params.push_back(tr->GetXHalfLength2()); << 807 params.push_back( tr->GetZHalfLength()); 860 params.push_back(tr->GetYHalfLength1()); << 808 } 861 params.push_back(tr->GetYHalfLength2()); << 809 } else if (solidType == "PARA") { 862 params.push_back(tr->GetZHalfLength()); << 810 const G4Para * para = dynamic_cast < const G4Para * > (so); 863 } << 811 if (para) { 864 } << 865 else if(solidType == "PARA") << 866 { << 867 const G4Para* para = dynamic_cast<const G4 << 868 if(para != nullptr) << 869 { << 870 G4ThreeVector symAxis(para->GetSymAxis() 812 G4ThreeVector symAxis(para->GetSymAxis()); 871 params.push_back(para->GetXHalfLength()) << 813 params.push_back( para->GetXHalfLength()); 872 params.push_back(para->GetYHalfLength()) << 814 params.push_back( para->GetYHalfLength()); 873 params.push_back(para->GetZHalfLength()) << 815 params.push_back( para->GetZHalfLength()); 874 params.push_back(std::atan(para->GetTanA << 816 params.push_back( std::atan(para->GetTanAlpha())/deg); 875 params.push_back(symAxis.theta() / deg); << 817 params.push_back( symAxis.theta()/deg); 876 params.push_back(symAxis.phi() / deg); << 818 params.push_back( symAxis.phi()/deg); 877 } << 819 } 878 } << 820 } else if (solidType == "CONS") { 879 else if(solidType == "CONS") << 821 const G4Cons * cn = dynamic_cast < const G4Cons * > (so); 880 { << 822 if (cn) { 881 const G4Cons* cn = dynamic_cast<const G4Co << 823 params.push_back( cn->GetInnerRadiusMinusZ() ); 882 if(cn != nullptr) << 824 params.push_back( cn->GetOuterRadiusMinusZ() ); 883 { << 825 params.push_back( cn->GetInnerRadiusPlusZ() ); 884 params.push_back(cn->GetInnerRadiusMinus << 826 params.push_back( cn->GetOuterRadiusPlusZ() ); 885 params.push_back(cn->GetOuterRadiusMinus << 827 params.push_back( cn->GetZHalfLength() ); 886 params.push_back(cn->GetInnerRadiusPlusZ << 828 params.push_back( cn->GetStartPhiAngle()/deg ); 887 params.push_back(cn->GetOuterRadiusPlusZ << 829 params.push_back( cn->GetDeltaPhiAngle()/deg ); 888 params.push_back(cn->GetZHalfLength()); << 830 } 889 params.push_back(cn->GetStartPhiAngle() << 831 } else if (solidType == "SPHERE") { 890 params.push_back(cn->GetDeltaPhiAngle() << 832 const G4Sphere * sphere = dynamic_cast < const G4Sphere * > (so); >> 833 if (sphere) { >> 834 params.push_back( sphere->GetInnerRadius()); >> 835 params.push_back( sphere->GetOuterRadius()); >> 836 params.push_back( sphere->GetStartPhiAngle()/deg); >> 837 params.push_back( sphere->GetDeltaPhiAngle()/deg); >> 838 params.push_back( sphere->GetStartThetaAngle()/deg); >> 839 params.push_back( sphere->GetDeltaThetaAngle()/deg); >> 840 } >> 841 } else if (solidType == "ORB") { >> 842 const G4Orb * orb = dynamic_cast < const G4Orb * > (so); >> 843 if (orb) { >> 844 params.push_back( orb->GetRadius()); >> 845 } >> 846 } else if (solidType == "TORUS") { >> 847 const G4Torus * torus = dynamic_cast < const G4Torus * > (so); >> 848 if (torus) { >> 849 params.push_back( torus->GetRmin()); >> 850 params.push_back( torus->GetRmax()); >> 851 params.push_back( torus->GetRtor()); >> 852 params.push_back( torus->GetSPhi()/deg); >> 853 params.push_back( torus->GetDPhi()/deg); 891 } 854 } 892 } << 855 } else if (solidType == "POLYCONE") { 893 else if(solidType == "SPHERE") << 894 { << 895 const G4Sphere* sphere = dynamic_cast<cons << 896 if(sphere != nullptr) << 897 { << 898 params.push_back(sphere->GetInnerRadius( << 899 params.push_back(sphere->GetOuterRadius( << 900 params.push_back(sphere->GetStartPhiAngl << 901 params.push_back(sphere->GetDeltaPhiAngl << 902 params.push_back(sphere->GetStartThetaAn << 903 params.push_back(sphere->GetDeltaThetaAn << 904 } << 905 } << 906 else if(solidType == "ORB") << 907 { << 908 const G4Orb* orb = dynamic_cast<const G4Or << 909 if(orb != nullptr) << 910 { << 911 params.push_back(orb->GetRadius()); << 912 } << 913 } << 914 else if(solidType == "TORUS") << 915 { << 916 const G4Torus* torus = dynamic_cast<const << 917 if(torus != nullptr) << 918 { << 919 params.push_back(torus->GetRmin()); << 920 params.push_back(torus->GetRmax()); << 921 params.push_back(torus->GetRtor()); << 922 params.push_back(torus->GetSPhi() / deg) << 923 params.push_back(torus->GetDPhi() / deg) << 924 } << 925 } << 926 else if(solidType == "POLYCONE") << 927 { << 928 //--- Dump RZ corners, as original paramet 856 //--- Dump RZ corners, as original parameters will not be present 929 // if it was build from RZ corners 857 // if it was build from RZ corners 930 const G4Polycone* plc = dynamic_cast<const << 858 const G4Polycone * plc = dynamic_cast < const G4Polycone * > (so); 931 if(plc != nullptr) << 859 if (plc) { 932 { << 860 G4double angphi = plc->GetStartPhi()/deg; 933 G4double angphi = plc->GetStartPhi() / d << 861 if( angphi > 180*deg ) { angphi -= 360*deg; } 934 if(angphi > 180 * deg) << 935 { << 936 angphi -= 360 * deg; << 937 } << 938 G4double endphi = plc->GetEndPhi() / deg << 939 if(endphi > 180 * deg) << 940 { << 941 endphi -= 360 * deg; << 942 } << 943 params.push_back(angphi); << 944 params.push_back(endphi - angphi); << 945 // params.push_back(plc->GetOrigina << 946 G4int ncor = plc->GetNumRZCorner(); 862 G4int ncor = plc->GetNumRZCorner(); 947 params.push_back(ncor); << 863 params.push_back( angphi ); 948 << 864 params.push_back( plc->GetOriginalParameters()->Opening_angle/deg ); 949 for(G4int ii = 0; ii < ncor; ++ii) << 865 params.push_back( ncor ); >> 866 >> 867 for( G4int ii = 0; ii < ncor; ii++ ) 950 { 868 { 951 params.push_back(plc->GetCorner(ii).r) << 869 params.push_back( plc->GetCorner(ii).r ); 952 params.push_back(plc->GetCorner(ii).z) << 870 params.push_back( plc->GetCorner(ii).z ); 953 } 871 } 954 } 872 } 955 } << 873 } else if (solidType == "GENERICPOLYCONE") { 956 else if(solidType == "GENERICPOLYCONE") << 957 { << 958 //--- Dump RZ corners 874 //--- Dump RZ corners 959 const G4GenericPolycone* plc = dynamic_cas << 875 const G4GenericPolycone * plc = 960 if(plc != nullptr) << 876 dynamic_cast < const G4GenericPolycone * > (so); 961 { << 877 if (plc) { 962 G4double angphi = plc->GetStartPhi() / d << 878 G4double angphi = plc->GetStartPhi()/deg; 963 if(angphi > 180 * deg) << 879 if( angphi > 180*deg ) { angphi -= 360*deg; } 964 { << 880 G4double endphi = plc->GetEndPhi()/deg; 965 angphi -= 360 * deg; << 881 if( endphi > 180*deg ) { endphi -= 360*deg; } 966 } << 967 G4double endphi = plc->GetEndPhi() / deg << 968 if(endphi > 180 * deg) << 969 { << 970 endphi -= 360 * deg; << 971 } << 972 params.push_back(angphi); << 973 params.push_back(endphi - angphi); << 974 G4int ncor = plc->GetNumRZCorner(); 882 G4int ncor = plc->GetNumRZCorner(); 975 params.push_back(ncor); << 883 params.push_back( angphi ); 976 << 884 params.push_back( endphi-angphi ); 977 for(G4int ii = 0; ii < ncor; ++ii) << 885 params.push_back( ncor ); >> 886 >> 887 for( G4int ii = 0; ii < ncor; ii++ ) 978 { 888 { 979 params.push_back(plc->GetCorner(ii).r) << 889 params.push_back( plc->GetCorner(ii).r ); 980 params.push_back(plc->GetCorner(ii).z) << 890 params.push_back( plc->GetCorner(ii).z ); 981 } 891 } 982 } 892 } 983 } << 893 } else if (solidType == "POLYHEDRA") { 984 else if(solidType == "POLYHEDRA") << 985 { << 986 //--- Dump RZ corners, as original paramet 894 //--- Dump RZ corners, as original parameters will not be present 987 // if it was build from RZ corners 895 // if it was build from RZ corners 988 const G4Polyhedra* ph = (dynamic_cast<cons << 896 const G4Polyhedra * ph = (dynamic_cast < const G4Polyhedra * > (so)); 989 if(ph != nullptr) << 897 if (ph) { 990 { << 898 G4double angphi = ph->GetStartPhi()/deg; 991 G4double angphi = ph->GetStartPhi() / de << 899 if( angphi > 180*deg ) angphi -= 360*deg; 992 if(angphi > 180 * deg) << 993 angphi -= 360 * deg; << 994 900 995 G4int ncor = ph->GetNumRZCorner(); 901 G4int ncor = ph->GetNumRZCorner(); >> 902 >> 903 params.push_back( angphi ); >> 904 params.push_back( ph->GetOriginalParameters()->Opening_angle/deg ); >> 905 params.push_back( ph->GetNumSide() ); >> 906 params.push_back( ncor ); 996 907 997 params.push_back(angphi); << 908 for( G4int ii = 0; ii < ncor; ii++ ) 998 params.push_back(ph->GetOriginalParamete << 999 params.push_back(ph->GetNumSide()); << 1000 params.push_back(ncor); << 1001 << 1002 for(G4int ii = 0; ii < ncor; ++ii) << 1003 { 909 { 1004 params.push_back(ph->GetCorner(ii).r) << 910 params.push_back( ph->GetCorner(ii).r ); 1005 params.push_back(ph->GetCorner(ii).z) << 911 params.push_back( ph->GetCorner(ii).z ); 1006 } 912 } 1007 } 913 } 1008 } << 914 } else if (solidType == "ELLIPTICALTUBE") { 1009 else if(solidType == "ELLIPTICALTUBE") << 915 const G4EllipticalTube * eltu = 1010 { << 916 dynamic_cast < const G4EllipticalTube * > (so); 1011 const G4EllipticalTube* eltu = dynamic_ca << 917 if (eltu) { 1012 if(eltu != nullptr) << 918 params.push_back( eltu->GetDx()); 1013 { << 919 params.push_back( eltu->GetDy()); 1014 params.push_back(eltu->GetDx()); << 920 params.push_back( eltu->GetDz()); 1015 params.push_back(eltu->GetDy()); << 921 } 1016 params.push_back(eltu->GetDz()); << 922 } else if (solidType == "ELLIPSOID" ){ 1017 } << 923 const G4Ellipsoid* dso = dynamic_cast < const G4Ellipsoid * > (so); 1018 } << 924 if (dso) { 1019 else if(solidType == "ELLIPSOID") << 925 params.push_back( dso->GetSemiAxisMax(0) ); 1020 { << 926 params.push_back( dso->GetSemiAxisMax(1) ); 1021 const G4Ellipsoid* dso = dynamic_cast<con << 927 params.push_back( dso->GetSemiAxisMax(2) ); 1022 if(dso != nullptr) << 928 params.push_back( dso->GetZBottomCut() ); 1023 { << 929 params.push_back( dso->GetZTopCut() ); 1024 params.push_back(dso->GetSemiAxisMax(0) << 930 } 1025 params.push_back(dso->GetSemiAxisMax(1) << 931 } else if (solidType == "ELLIPTICAL_CONE") { 1026 params.push_back(dso->GetSemiAxisMax(2) << 932 const G4EllipticalCone * elco = 1027 params.push_back(dso->GetZBottomCut()); << 933 dynamic_cast < const G4EllipticalCone * > (so); 1028 params.push_back(dso->GetZTopCut()); << 934 if (elco) { 1029 } << 935 params.push_back( elco-> GetSemiAxisX() ); 1030 } << 936 params.push_back( elco-> GetSemiAxisY() ); 1031 else if(solidType == "ELLIPTICAL_CONE") << 937 params.push_back( elco-> GetZMax() ); 1032 { << 938 params.push_back( elco-> GetZTopCut() ); 1033 const G4EllipticalCone* elco = dynamic_ca << 939 } 1034 if(elco != nullptr) << 940 } else if (solidType == "HYPE") { 1035 { << 941 const G4Hype* hype = dynamic_cast < const G4Hype * > (so); 1036 params.push_back(elco->GetSemiAxisX()); << 942 if (hype) { 1037 params.push_back(elco->GetSemiAxisY()); << 943 params.push_back( hype->GetInnerRadius()); 1038 params.push_back(elco->GetZMax()); << 944 params.push_back( hype->GetOuterRadius()); 1039 params.push_back(elco->GetZTopCut()); << 945 params.push_back( hype->GetInnerStereo()/deg); 1040 } << 946 params.push_back( hype->GetOuterStereo()/deg); 1041 } << 947 params.push_back( 2*hype->GetZHalfLength()); 1042 else if(solidType == "HYPE") << 948 } 1043 { << 949 // } else if( solidType == "TET" ) { 1044 const G4Hype* hype = dynamic_cast<const G << 950 1045 if(hype != nullptr) << 951 } else if( solidType == "TWISTEDBOX" ) { 1046 { << 952 const G4TwistedBox* tbox = dynamic_cast < const G4TwistedBox * > (so); 1047 params.push_back(hype->GetInnerRadius() << 953 if (tbox) { 1048 params.push_back(hype->GetOuterRadius() << 954 params.push_back( tbox->GetPhiTwist()/deg ); 1049 params.push_back(hype->GetInnerStereo() << 955 params.push_back( tbox->GetXHalfLength() ); 1050 params.push_back(hype->GetOuterStereo() << 956 params.push_back( tbox->GetYHalfLength() ); 1051 params.push_back(2 * hype->GetZHalfLeng << 957 params.push_back( tbox->GetZHalfLength() ); 1052 } << 958 } 1053 // } else if( solidType == "TET" ) { << 959 } else if( solidType == "TWISTEDTRAP" ) { 1054 } << 960 const G4TwistedTrap * ttrap = dynamic_cast < const G4TwistedTrap * > (so); 1055 else if(solidType == "TWISTEDBOX") << 961 if (ttrap) { 1056 { << 962 params.push_back( ttrap->GetPhiTwist()/deg ); 1057 const G4TwistedBox* tbox = dynamic_cast<c << 963 params.push_back( ttrap->GetZHalfLength() ); 1058 if(tbox != nullptr) << 964 params.push_back( ttrap->GetPolarAngleTheta()/deg ); 1059 { << 965 params.push_back( ttrap->GetAzimuthalAnglePhi()/deg ); 1060 params.push_back(tbox->GetPhiTwist() / << 966 params.push_back( ttrap->GetY1HalfLength() ); 1061 params.push_back(tbox->GetXHalfLength() << 967 params.push_back( ttrap->GetX1HalfLength() ); 1062 params.push_back(tbox->GetYHalfLength() << 968 params.push_back( ttrap->GetX2HalfLength() ); 1063 params.push_back(tbox->GetZHalfLength() << 969 params.push_back( ttrap->GetY2HalfLength() ); 1064 } << 970 params.push_back( ttrap->GetX3HalfLength() ); 1065 } << 971 params.push_back( ttrap->GetX4HalfLength() ); 1066 else if(solidType == "TWISTEDTRAP") << 972 params.push_back( ttrap->GetTiltAngleAlpha()/deg ); 1067 { << 973 } 1068 const G4TwistedTrap* ttrap = dynamic_cast << 974 } else if( solidType == "TWISTEDTRD" ) { 1069 if(ttrap != nullptr) << 975 const G4TwistedTrd * ttrd = dynamic_cast < const G4TwistedTrd * > (so); 1070 { << 976 if (ttrd) { 1071 params.push_back(ttrap->GetPhiTwist() / << 977 params.push_back( ttrd->GetX1HalfLength()); 1072 params.push_back(ttrap->GetZHalfLength( << 978 params.push_back( ttrd->GetX2HalfLength() ); 1073 params.push_back(ttrap->GetPolarAngleTh << 979 params.push_back( ttrd->GetY1HalfLength() ); 1074 params.push_back(ttrap->GetAzimuthalAng << 980 params.push_back( ttrd->GetY2HalfLength() ); 1075 params.push_back(ttrap->GetY1HalfLength << 981 params.push_back( ttrd->GetZHalfLength() ); 1076 params.push_back(ttrap->GetX1HalfLength << 982 params.push_back( ttrd->GetPhiTwist()/deg ); 1077 params.push_back(ttrap->GetX2HalfLength << 983 } 1078 params.push_back(ttrap->GetY2HalfLength << 984 } else if( solidType == "TWISTEDTUBS" ) { 1079 params.push_back(ttrap->GetX3HalfLength << 985 const G4TwistedTubs * ttub = dynamic_cast < const G4TwistedTubs * > (so); 1080 params.push_back(ttrap->GetX4HalfLength << 986 if (ttub) { 1081 params.push_back(ttrap->GetTiltAngleAlp << 987 params.push_back( ttub->GetInnerRadius() ); 1082 } << 988 params.push_back( ttub->GetOuterRadius() ); 1083 } << 989 params.push_back( ttub->GetZHalfLength() ); 1084 else if(solidType == "TWISTEDTRD") << 990 params.push_back( ttub->GetDPhi()/deg ); 1085 { << 991 params.push_back( ttub->GetPhiTwist()/deg ); 1086 const G4TwistedTrd* ttrd = dynamic_cast<c << 1087 if(ttrd != nullptr) << 1088 { << 1089 params.push_back(ttrd->GetX1HalfLength( << 1090 params.push_back(ttrd->GetX2HalfLength( << 1091 params.push_back(ttrd->GetY1HalfLength( << 1092 params.push_back(ttrd->GetY2HalfLength( << 1093 params.push_back(ttrd->GetZHalfLength() << 1094 params.push_back(ttrd->GetPhiTwist() / << 1095 } << 1096 } << 1097 else if(solidType == "TWISTEDTUBS") << 1098 { << 1099 const G4TwistedTubs* ttub = dynamic_cast< << 1100 if(ttub != nullptr) << 1101 { << 1102 params.push_back(ttub->GetInnerRadius() << 1103 params.push_back(ttub->GetOuterRadius() << 1104 params.push_back(ttub->GetZHalfLength() << 1105 params.push_back(ttub->GetDPhi() / deg) << 1106 params.push_back(ttub->GetPhiTwist() / << 1107 } 992 } 1108 } 993 } 1109 else 994 else 1110 { 995 { 1111 const G4String& ErrMessage = "Solid type << 996 G4String ErrMessage = "Solid type not supported, sorry... " + solidType; 1112 G4Exception("G4tgbGeometryDumper::DumpSol << 997 G4Exception("G4tgbGeometryDumpe::DumpSolidParams()", 1113 FatalException, ErrMessage); << 998 "NotImplemented", FatalException, ErrMessage); 1114 } 999 } 1115 << 1000 1116 return params; 1001 return params; 1117 } << 1002 } >> 1003 1118 1004 1119 // ------------------------------------------ << 1005 //------------------------------------------------------------------------ 1120 G4String G4tgbGeometryDumper::DumpRotationMat << 1006 G4String G4tgbGeometryDumper::DumpRotationMatrix( G4RotationMatrix* rotm ) 1121 { 1007 { 1122 if(rotm == nullptr) << 1008 if (!rotm) { rotm = new G4RotationMatrix(); } 1123 { << 1124 rotm = new G4RotationMatrix(); << 1125 } << 1126 1009 1127 G4double de = MatDeterminant(rotm); << 1010 G4double de = MatDeterminant(rotm); 1128 G4String rotName = LookForExistingRotation( << 1011 G4String rotName = LookForExistingRotation( rotm ); 1129 if(rotName != "") << 1012 if( rotName != "" ) { return rotName; } 1130 { << 1131 return rotName; << 1132 } << 1133 1013 1134 G4ThreeVector v(1., 1., 1.); << 1014 G4ThreeVector v(1.,1.,1.); 1135 if(de < -0.9) // a reflection .... << 1015 if (de < -0.9 ) // a reflection .... 1136 { 1016 { 1137 (*theFile) << ":ROTM "; 1017 (*theFile) << ":ROTM "; 1138 rotName = "RRM"; 1018 rotName = "RRM"; 1139 rotName += G4UIcommand::ConvertToString(t 1019 rotName += G4UIcommand::ConvertToString(theRotationNumber++); 1140 << 1020 1141 (*theFile) << AddQuotes(rotName) << std:: << 1021 (*theFile) << AddQuotes(rotName) << std::setprecision(9) << " " 1142 << approxTo0(rotm->xx()) << " << 1022 << approxTo0(rotm->xx()) << " " 1143 << approxTo0(rotm->zx()) << " << 1023 << approxTo0(rotm->yx()) << " " 1144 << approxTo0(rotm->yy()) << " << 1024 << approxTo0(rotm->zx()) << " " 1145 << approxTo0(rotm->xz()) << " << 1025 << approxTo0(rotm->xy()) << " " 1146 << approxTo0(rotm->zz()) << G4 << 1026 << approxTo0(rotm->yy()) << " " >> 1027 << approxTo0(rotm->zy()) << " " >> 1028 << approxTo0(rotm->xz()) << " " >> 1029 << approxTo0(rotm->yz()) << " " >> 1030 << approxTo0(rotm->zz()) << G4endl; 1147 } 1031 } 1148 else if(de > 0.9) // a rotation .... << 1032 else if(de > 0.9 ) // a rotation .... 1149 { 1033 { 1150 (*theFile) << ":ROTM "; 1034 (*theFile) << ":ROTM "; 1151 rotName = "RM"; 1035 rotName = "RM"; 1152 rotName += G4UIcommand::ConvertToString(t 1036 rotName += G4UIcommand::ConvertToString(theRotationNumber++); 1153 << 1037 1154 (*theFile) << AddQuotes(rotName) << " " < << 1038 (*theFile) << AddQuotes(rotName) << " " 1155 << " " << approxTo0(rotm->phiX << 1039 << approxTo0(rotm->thetaX()/deg) << " " 1156 << approxTo0(rotm->thetaY() / << 1040 << approxTo0(rotm->phiX()/deg) << " " 1157 << approxTo0(rotm->phiY() / de << 1041 << approxTo0(rotm->thetaY()/deg) << " " 1158 << approxTo0(rotm->thetaZ() / << 1042 << approxTo0(rotm->phiY()/deg) << " " 1159 << approxTo0(rotm->phiZ() / de << 1043 << approxTo0(rotm->thetaZ()/deg) << " " >> 1044 << approxTo0(rotm->phiZ()/deg) << G4endl; 1160 } 1045 } 1161 << 1046 1162 theRotMats[rotName] = rotm; 1047 theRotMats[rotName] = rotm; 1163 1048 1164 return rotName; 1049 return rotName; 1165 } 1050 } 1166 1051 1167 // ------------------------------------------ << 1052 >> 1053 //------------------------------------------------------------------------ 1168 std::vector<G4VPhysicalVolume*> 1054 std::vector<G4VPhysicalVolume*> 1169 G4tgbGeometryDumper::GetPVChildren(G4LogicalV << 1055 G4tgbGeometryDumper::GetPVChildren( G4LogicalVolume* lv ) 1170 { 1056 { 1171 G4PhysicalVolumeStore* pvstore = G4Physical 1057 G4PhysicalVolumeStore* pvstore = G4PhysicalVolumeStore::GetInstance(); >> 1058 G4PhysicalVolumeStore::const_iterator ite; 1172 std::vector<G4VPhysicalVolume*> children; 1059 std::vector<G4VPhysicalVolume*> children; 1173 for(auto ite = pvstore->cbegin(); ite != pv << 1060 for( ite = pvstore->begin(); ite != pvstore->end(); ite++ ) 1174 { 1061 { 1175 if((*ite)->GetMotherLogical() == lv) << 1062 if( (*ite)->GetMotherLogical() == lv ) 1176 { 1063 { 1177 children.push_back(*ite); << 1064 children.push_back( *ite ); 1178 #ifdef G4VERBOSE 1065 #ifdef G4VERBOSE 1179 if(G4tgrMessenger::GetVerboseLevel() >= << 1066 if( G4tgrMessenger::GetVerboseLevel() >= 1 ) 1180 { 1067 { 1181 G4cout << " G4tgbGeometryDumper::GetP 1068 G4cout << " G4tgbGeometryDumper::GetPVChildren() - adding children: " 1182 << (*ite)->GetName() << " of " << 1069 << (*ite)->GetName() << " of " << lv->GetName() << G4endl; 1183 } 1070 } 1184 #endif 1071 #endif 1185 } 1072 } 1186 } 1073 } 1187 1074 1188 return children; 1075 return children; 1189 } 1076 } 1190 1077 1191 // ------------------------------------------ << 1078 1192 G4String G4tgbGeometryDumper::GetTGSolidType( << 1079 //------------------------------------------------------------------------ >> 1080 G4String G4tgbGeometryDumper::GetTGSolidType( const G4String& solidType ) 1193 { 1081 { 1194 G4String newsolidType = solidType.substr(2, << 1082 G4String newsolidType = solidType.substr(2,solidType.length() ); 1195 for(G4int ii = 0; ii < (G4int)newsolidType. << 1083 for( size_t ii = 0; ii < newsolidType.length(); ii++ ) 1196 { 1084 { 1197 newsolidType[ii] = (char)std::toupper(new << 1085 newsolidType[ii] = toupper(newsolidType[ii] ); 1198 } 1086 } 1199 return newsolidType; 1087 return newsolidType; 1200 } 1088 } 1201 1089 1202 // ------------------------------------------ << 1090 1203 G4double G4tgbGeometryDumper::MatDeterminant( << 1091 //------------------------------------------------------------------------ >> 1092 G4double G4tgbGeometryDumper::MatDeterminant(G4RotationMatrix * ro) 1204 { 1093 { 1205 G4Rep3x3 r = ro->rep3x3(); << 1094 G4Rep3x3 r = ro->rep3x3(); 1206 return r.xx_ * (r.yy_ * r.zz_ - r.zy_ * r.y << 1095 return r.xx_*(r.yy_*r.zz_ - r.zy_*r.yz_) 1207 r.yx_ * (r.xy_ * r.zz_ - r.zy_ * r.x << 1096 - r.yx_*(r.xy_*r.zz_ - r.zy_*r.xz_) 1208 r.zx_ * (r.xy_ * r.yz_ - r.yy_ * r.x << 1097 + r.zx_*(r.xy_*r.yz_ - r.yy_*r.xz_); 1209 } 1098 } 1210 1099 1211 // ------------------------------------------ << 1100 1212 G4double G4tgbGeometryDumper::approxTo0(G4dou << 1101 //----------------------------------------------------------------------- >> 1102 G4double G4tgbGeometryDumper::approxTo0( G4double val ) 1213 { 1103 { 1214 G4double precision = << 1104 G4double precision = G4GeometryTolerance::GetInstance() 1215 G4GeometryTolerance::GetInstance()->GetSu << 1105 ->GetSurfaceTolerance(); 1216 1106 1217 if(std::fabs(val) < precision) << 1107 if( std::fabs(val) < precision ) { val = 0; } 1218 { << 1219 val = 0.0; << 1220 } << 1221 return val; 1108 return val; 1222 } 1109 } 1223 1110 1224 // ------------------------------------------ << 1111 1225 G4String G4tgbGeometryDumper::AddQuotes(const << 1112 //----------------------------------------------------------------------- >> 1113 G4String G4tgbGeometryDumper::AddQuotes( const G4String& str ) 1226 { 1114 { 1227 //--- look if there is a separating blank 1115 //--- look if there is a separating blank 1228 1116 1229 G4bool bBlank = FALSE; 1117 G4bool bBlank = FALSE; 1230 std::size_t siz = str.length(); << 1118 size_t siz = str.length(); 1231 for(std::size_t ii = 0; ii < siz; ++ii) << 1119 for( size_t ii = 0; ii < siz; ii++ ) 1232 { 1120 { 1233 if(str.substr(ii, 1) == " ") << 1121 if( str.substr(ii,1) == " " ) 1234 { 1122 { 1235 bBlank = TRUE; 1123 bBlank = TRUE; 1236 break; 1124 break; 1237 } 1125 } 1238 } 1126 } 1239 G4String str2 = str; 1127 G4String str2 = str; 1240 if(bBlank) << 1128 if( bBlank ) 1241 { 1129 { 1242 str2 = G4String("\"") + str2 + G4String(" 1130 str2 = G4String("\"") + str2 + G4String("\""); 1243 } 1131 } 1244 return str2; 1132 return str2; 1245 } 1133 } 1246 1134 1247 // ------------------------------------------ << 1135 1248 G4String G4tgbGeometryDumper::SupressRefl(G4S << 1136 //------------------------------------------------------------------------ >> 1137 G4String G4tgbGeometryDumper::SupressRefl( G4String name ) 1249 { 1138 { 1250 std::size_t irefl = name.rfind("_refl"); << 1139 G4int irefl = name.rfind("_refl"); 1251 if(irefl != G4String::npos) << 1140 if( irefl != -1 ) 1252 { 1141 { 1253 name = name.substr(0, irefl); << 1142 name = name.substr( 0, irefl ); 1254 } 1143 } 1255 return name; 1144 return name; 1256 } 1145 } 1257 1146 1258 // ------------------------------------------ << 1147 //------------------------------------------------------------------------ 1259 G4String G4tgbGeometryDumper::SubstituteRefl( << 1148 G4String G4tgbGeometryDumper::SubstituteRefl( G4String name ) 1260 { 1149 { 1261 std::size_t irefl = name.rfind("_refl"); << 1150 G4int irefl = name.rfind("_refl"); 1262 if(irefl != G4String::npos) << 1151 if( irefl != -1 ) 1263 { 1152 { 1264 name = name.substr(0, irefl) + "_REFL"; << 1153 name = name.substr( 0, irefl ) + "_REFL"; 1265 } 1154 } 1266 return name; 1155 return name; 1267 } 1156 } 1268 1157 1269 // ------------------------------------------ << 1158 1270 G4String G4tgbGeometryDumper::GetIsotopeName( << 1159 //------------------------------------------------------------------------ >> 1160 G4String G4tgbGeometryDumper::GetIsotopeName( G4Isotope* isot ) 1271 { 1161 { 1272 G4String isotName = isot->GetName(); 1162 G4String isotName = isot->GetName(); 1273 // first look if this is isotope is already 1163 // first look if this is isotope is already dumped, 1274 // with original isotope name or new one 1164 // with original isotope name or new one 1275 // 1165 // 1276 std::map<G4String, G4Isotope*>::const_itera << 1166 std::map<G4String,G4Isotope*>::const_iterator ite; 1277 for(ite = theIsotopes.cbegin(); ite != theI << 1167 for( ite = theIsotopes.begin(); ite != theIsotopes.end(); ite++ ) 1278 { 1168 { 1279 if(isot == (*ite).second) << 1169 if( isot == (*ite).second ) { return (*ite).first; } 1280 { << 1281 return (*ite).first; << 1282 } << 1283 } 1170 } 1284 1171 1285 // Now look if there is another isotope dum 1172 // Now look if there is another isotope dumped with same name, 1286 // and if found add _N to the name 1173 // and if found add _N to the name 1287 // 1174 // 1288 ite = theIsotopes.find(isotName); << 1175 ite = theIsotopes.find( isotName ); 1289 if(ite != theIsotopes.cend()) // Isotope f << 1176 if( ite != theIsotopes.end() ) // Isotope found with same name 1290 { 1177 { 1291 G4Isotope* isotold = (*ite).second; 1178 G4Isotope* isotold = (*ite).second; 1292 if(isot != isotold) // new isotope it is << 1179 if( isot != isotold ) // new isotope it is not the really 1293 { // the same one as i << 1180 { // the same one as isotope found 1294 if(!Same2G4Isotopes(isot, isotold)) << 1181 if( !Same2G4Isotopes(isot, isotold)) 1295 { // if the two have sam << 1182 { // if the two have same data, use the old one 1296 G4int ii = 2; // G4Nist does names i << 1183 G4int ii = 2; // G4Nist does names isotopes of same element 1297 // with same name << 1184 // with same name 1298 for(;; ++ii) << 1185 for(;;ii++) 1299 { 1186 { 1300 const G4String& newIsotName = << 1187 G4String newIsotName = isotName + "_" 1301 isotName + "_" + G4UIcommand::Con << 1188 + G4UIcommand::ConvertToString(ii); 1302 std::map<G4String, G4Isotope*>::con << 1189 std::map<G4String,G4Isotope*>::const_iterator ite2 = 1303 theIsotopes.find(newIsotName); << 1190 theIsotopes.find( newIsotName ); 1304 if(ite2 == theIsotopes.cend()) << 1191 if( ite2 == theIsotopes.end() ) 1305 { 1192 { 1306 isotName = newIsotName; 1193 isotName = newIsotName; 1307 break; 1194 break; 1308 } 1195 } 1309 else 1196 else 1310 { 1197 { 1311 if(Same2G4Isotopes(isot, (*ite2). << 1198 if( Same2G4Isotopes( isot, (*ite2).second ) ) 1312 { 1199 { 1313 isotName = newIsotName; 1200 isotName = newIsotName; 1314 break; 1201 break; 1315 } 1202 } 1316 } 1203 } 1317 } 1204 } 1318 } 1205 } 1319 } 1206 } 1320 } 1207 } 1321 return isotName; 1208 return isotName; 1322 } 1209 } 1323 1210 1324 // ------------------------------------------ << 1211 1325 template <class TYP> << 1212 //------------------------------------------------------------------------ 1326 G4String G4tgbGeometryDumper::GetObjectName( << 1213 template< class TYP > G4String G4tgbGeometryDumper:: 1327 TYP* obj, std::map<G4String, TYP*> objectsD << 1214 GetObjectName( TYP* obj, std::map<G4String,TYP*> objectsDumped ) 1328 { 1215 { 1329 G4String objName = obj->GetName(); 1216 G4String objName = obj->GetName(); 1330 1217 1331 // first look if this is objecy is already 1218 // first look if this is objecy is already dumped, 1332 // with original object name or new one 1219 // with original object name or new one 1333 // 1220 // 1334 typename std::map<G4String, TYP*>::const_it << 1221 typename std::map<G4String,TYP*>::const_iterator ite; 1335 for(ite = objectsDumped.cbegin(); ite != ob << 1222 for( ite = objectsDumped.begin(); ite != objectsDumped.end(); ite++ ) 1336 { 1223 { 1337 if(obj == (*ite).second) << 1224 if( obj == (*ite).second ) { return (*ite).first; } 1338 { << 1339 return (*ite).first; << 1340 } << 1341 } 1225 } 1342 1226 1343 // Now look if there is another object dump 1227 // Now look if there is another object dumped with same name, 1344 // and if found add _N to the name 1228 // and if found add _N to the name 1345 // 1229 // 1346 ite = objectsDumped.find(objName); << 1230 ite = objectsDumped.find( objName ); 1347 1231 1348 if(ite != objectsDumped.cend()) // Object << 1232 if( ite != objectsDumped.end() ) // Object found with same name 1349 { 1233 { 1350 TYP* objold = (*ite).second; 1234 TYP* objold = (*ite).second; 1351 if(obj != objold) // new object it is no << 1235 if( obj != objold ) // new object it is not the really 1352 { // the same one as obj << 1236 { // the same one as object found 1353 G4int ii = 2; 1237 G4int ii = 2; 1354 for(;; ++ii) << 1238 for(;;ii++) 1355 { 1239 { 1356 const G4String& newObjName = objName << 1240 G4String newObjName = objName + "_" + G4UIcommand::ConvertToString(ii); 1357 typename std::map<G4String, TYP*>::co << 1241 typename std::map<G4String,TYP*>::const_iterator ite2 = 1358 objectsDumped.find(newObjName); << 1242 objectsDumped.find( newObjName ); 1359 if(ite2 == objectsDumped.cend()) << 1243 if( ite2 == objectsDumped.end() ) 1360 { 1244 { 1361 objName = newObjName; 1245 objName = newObjName; 1362 break; 1246 break; 1363 } 1247 } 1364 } 1248 } 1365 } 1249 } 1366 } 1250 } 1367 return objName; 1251 return objName; 1368 } 1252 } 1369 1253 1370 // ------------------------------------------ << 1254 1371 G4bool G4tgbGeometryDumper::CheckIfLogVolExis << 1255 //------------------------------------------------------------------------ 1372 << 1256 G4bool G4tgbGeometryDumper::CheckIfLogVolExists( const G4String& name, >> 1257 G4LogicalVolume* pt ) 1373 { 1258 { 1374 if(theLogVols.find(name) != theLogVols.cend << 1259 if( theLogVols.find( name ) != theLogVols.end() ) 1375 { 1260 { 1376 G4LogicalVolume* lvnew = (*(theLogVols.fi 1261 G4LogicalVolume* lvnew = (*(theLogVols.find(name))).second; 1377 if(lvnew != pt) << 1262 if( lvnew != pt ) 1378 { 1263 { 1379 /* 1264 /* 1380 //---- Reflected volumes are repeated 1265 //---- Reflected volumes are repeated 1381 1266 1382 G4ReflectionFactory* reffact = G4Reflec 1267 G4ReflectionFactory* reffact = G4ReflectionFactory::Instance(); 1383 if( !reffact->IsReflected( pt ) && !ref 1268 if( !reffact->IsReflected( pt ) && !reffact->IsReflected( lvnew ) ) 1384 { 1269 { 1385 G4String ErrMessage = "LogVol found b 1270 G4String ErrMessage = "LogVol found but not same as before: " + name; 1386 G4Exception("G4tgbGeometryDumper::Che 1271 G4Exception("G4tgbGeometryDumper::CheckIfLogVolExists()", 1387 "InvalidSetup", FatalExce 1272 "InvalidSetup", FatalException, ErrMessage); 1388 } 1273 } 1389 */ 1274 */ 1390 } 1275 } 1391 return true; << 1276 return 1; 1392 } 1277 } 1393 else 1278 else 1394 { 1279 { 1395 return false; << 1280 return 0; 1396 } 1281 } 1397 } 1282 } 1398 1283 1399 // ------------------------------------------ << 1284 1400 G4bool G4tgbGeometryDumper::CheckIfPhysVolExi << 1285 //----------------------------------------------------------------------- 1401 << 1286 G4bool G4tgbGeometryDumper::CheckIfPhysVolExists( const G4String& name, >> 1287 G4VPhysicalVolume* pt ) 1402 { 1288 { 1403 #ifdef G4VERBOSE 1289 #ifdef G4VERBOSE 1404 if(G4tgrMessenger::GetVerboseLevel() >= 1) << 1290 if( G4tgrMessenger::GetVerboseLevel() >= 1 ) 1405 { 1291 { 1406 G4cout << " G4tgbGeometryDumper::CheckIfP << 1292 G4cout << " G4tgbGeometryDumper::CheckIfPhysVolExists() - " 1407 << G4endl; << 1293 << name << G4endl; 1408 } 1294 } 1409 #endif 1295 #endif 1410 if(thePhysVols.find(name) != thePhysVols.ce << 1296 if( thePhysVols.find( name ) != thePhysVols.end() ) 1411 { 1297 { 1412 if((*(thePhysVols.find(name))).second != << 1298 if( (*(thePhysVols.find(name))).second != pt ) 1413 { 1299 { 1414 // G4String ErrMessage = "Placement fou 1300 // G4String ErrMessage = "Placement found but not same as before: " 1415 // + name; 1301 // + name; 1416 // G4Exception("G4tgbGeometryDumper::Ch 1302 // G4Exception("G4tgbGeometryDumper::CheckIfPhysVolExists()", 1417 // "InvalidSetup", FatalExc 1303 // "InvalidSetup", FatalException, ErrMessage); 1418 G4cerr << " G4tgbGeometryDumper::CheckI 1304 G4cerr << " G4tgbGeometryDumper::CheckIfPhysVolExists () -" 1419 << " Placement found but not sam 1305 << " Placement found but not same as before : " << name << G4endl; 1420 } 1306 } 1421 return true; << 1307 return 1; 1422 } 1308 } 1423 else 1309 else 1424 { 1310 { 1425 return false; << 1311 return 0; 1426 } 1312 } 1427 } 1313 } 1428 1314 1429 // ------------------------------------------ << 1315 >> 1316 //----------------------------------------------------------------------- 1430 G4String 1317 G4String 1431 G4tgbGeometryDumper::LookForExistingRotation( << 1318 G4tgbGeometryDumper::LookForExistingRotation( const G4RotationMatrix* rotm ) 1432 { 1319 { 1433 G4String rmName = ""; 1320 G4String rmName = ""; 1434 1321 1435 for(auto ite = theRotMats.cbegin(); ite != << 1322 std::map<G4String,G4RotationMatrix*>::const_iterator ite; >> 1323 for( ite = theRotMats.begin(); ite != theRotMats.end(); ite++ ) 1436 { 1324 { 1437 if((*ite).second->isNear(*rotm)) << 1325 if( (*ite).second->isNear( *rotm ) ) 1438 { 1326 { 1439 rmName = (*ite).first; 1327 rmName = (*ite).first; 1440 break; 1328 break; 1441 } 1329 } 1442 } 1330 } 1443 return rmName; 1331 return rmName; 1444 } 1332 } 1445 1333 1446 // ------------------------------------------ << 1334 1447 G4bool G4tgbGeometryDumper::Same2G4Isotopes(G << 1335 //------------------------------------------------------------------------ 1448 { << 1336 G4bool 1449 if((isot1->GetZ() != isot2->GetZ()) || (iso << 1337 G4tgbGeometryDumper::Same2G4Isotopes( G4Isotope* isot1, G4Isotope* isot2 ) 1450 (isot1->GetA() != isot2->GetA())) << 1338 { >> 1339 if ( (isot1->GetZ() != isot2->GetZ()) >> 1340 || (isot1->GetN() != isot2->GetN()) >> 1341 || (isot1->GetA() != isot2->GetA()) ) 1451 { 1342 { 1452 return false; << 1343 return 0; 1453 } 1344 } 1454 else 1345 else 1455 { 1346 { 1456 return true; << 1347 return 1; 1457 } 1348 } 1458 } 1349 } 1459 1350 1460 // ------------------------------------------ << 1351 1461 const G4String& G4tgbGeometryDumper::FindSoli << 1352 //------------------------------------------------------------------------ >> 1353 const G4String& G4tgbGeometryDumper::FindSolidName( G4VSolid* solid ) 1462 { 1354 { 1463 std::map<G4String, G4VSolid*>::const_iterat << 1355 std::map<G4String,G4VSolid*>::const_iterator ite; 1464 for(ite = theSolids.cbegin(); ite != theSol << 1356 for( ite = theSolids.begin(); ite != theSolids.end(); ite++ ) 1465 { 1357 { 1466 if(solid == (*ite).second) << 1358 if( solid == (*ite).second ) { return (*ite).first; } 1467 { << 1468 return (*ite).first; << 1469 } << 1470 } 1359 } 1471 1360 1472 if(ite == theSolids.cend()) << 1361 if( ite == theSolids.end() ) 1473 { 1362 { 1474 G4Exception("G4tgbGeometryDumper::FindSol 1363 G4Exception("G4tgbGeometryDumper::FindSolidName()", "ReadError", 1475 FatalException, "Programming 1364 FatalException, "Programming error."); 1476 } 1365 } 1477 return (*ite).first; 1366 return (*ite).first; 1478 } 1367 } 1479 1368