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 // $Id: F04DetectorConstruction.cc 78551 2014-01-07 09:45:08Z gcosmo $ 26 // 27 // 27 /// \file field/field04/src/F04DetectorConstru 28 /// \file field/field04/src/F04DetectorConstruction.cc 28 /// \brief Implementation of the F04DetectorCo 29 /// \brief Implementation of the F04DetectorConstruction class 29 // 30 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 33 #include "F04DetectorConstruction.hh" << 34 #include "globals.hh" 34 35 >> 36 #include "F04DetectorConstruction.hh" 35 #include "F04DetectorMessenger.hh" 37 #include "F04DetectorMessenger.hh" 36 #include "F04FocusSolenoid.hh" << 37 #include "F04GlobalField.hh" << 38 #include "F04Materials.hh" << 39 #include "F04SimpleSolenoid.hh" << 40 38 41 #include "G4AutoDelete.hh" << 39 #include "G4Tubs.hh" 42 #include "G4GeometryManager.hh" << 43 #include "G4LogicalVolume.hh" 40 #include "G4LogicalVolume.hh" 44 #include "G4LogicalVolumeStore.hh" << 41 #include "G4PVPlacement.hh" >> 42 45 #include "G4Material.hh" 43 #include "G4Material.hh" 46 #include "G4NistManager.hh" 44 #include "G4NistManager.hh" 47 #include "G4PVPlacement.hh" << 45 48 #include "G4PhysicalConstants.hh" << 46 #include "F04GlobalField.hh" >> 47 >> 48 #include "G4GeometryManager.hh" >> 49 #include "G4SolidStore.hh" >> 50 #include "G4LogicalVolumeStore.hh" 49 #include "G4PhysicalVolumeStore.hh" 51 #include "G4PhysicalVolumeStore.hh" 50 #include "G4RotationMatrix.hh" << 52 51 #include "G4RunManager.hh" 53 #include "G4RunManager.hh" 52 #include "G4SolidStore.hh" << 54 53 #include "G4StateManager.hh" << 55 #include "G4PhysicalConstants.hh" 54 #include "G4SystemOfUnits.hh" 56 #include "G4SystemOfUnits.hh" 55 #include "G4Tubs.hh" << 57 56 #include "globals.hh" << 58 #include "F04Materials.hh" >> 59 >> 60 #include "G4RotationMatrix.hh" >> 61 >> 62 #include "F04SimpleSolenoid.hh" >> 63 #include "F04FocusSolenoid.hh" >> 64 >> 65 #include "G4AutoDelete.hh" 57 66 58 //....oooOO0OOooo........oooOO0OOooo........oo 67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 68 60 F04DetectorConstruction::F04DetectorConstructi 69 F04DetectorConstruction::F04DetectorConstruction() >> 70 : G4VUserDetectorConstruction(), >> 71 fDetectorMessenger(0), >> 72 fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0), >> 73 fSolidTarget(0), fLogicTarget(0), fPhysiTarget(0), >> 74 fSolidDegrader(0), fLogicDegrader(0), fPhysiDegrader(0), >> 75 fSolidCaptureMgnt(0), fLogicCaptureMgnt(0), fPhysiCaptureMgnt(0), >> 76 fSolidTransferMgnt(0), fLogicTransferMgnt(0), fPhysiTransferMgnt(0), >> 77 fWorldMaterial(0), fTargetMaterial(0), fDegraderMaterial(0) 61 { 78 { >> 79 fWorldSizeZ = 50.*m; >> 80 fWorldSizeR = 5.*m; >> 81 >> 82 fTargetRadius = 0.4*cm; >> 83 fTargetThickness = 16.0*cm; >> 84 62 SetTargetAngle(170); 85 SetTargetAngle(170); 63 SetCaptureMgntB1(2.5 * tesla); << 64 SetCaptureMgntB2(5.0 * tesla); << 65 SetTransferMgntB(5.0 * tesla); << 66 86 67 fDegraderPos = -fTransferMgntLength / 2. + f << 87 fDegraderRadius = 30.0*cm; >> 88 fDegraderThickness = 0.1*cm; >> 89 >> 90 fCaptureMgntRadius = 0.6*m; >> 91 fCaptureMgntLength = 4.0*m; >> 92 >> 93 SetCaptureMgntB1(2.5*tesla); >> 94 SetCaptureMgntB2(5.0*tesla); >> 95 >> 96 fTransferMgntRadius = 0.3*m; >> 97 fTransferMgntLength = 15.0*m; >> 98 >> 99 SetTransferMgntB(5.0*tesla); >> 100 >> 101 fDegraderPos = -fTransferMgntLength/2. + fDegraderThickness/2.; 68 102 69 fDetectorMessenger = new F04DetectorMessenge 103 fDetectorMessenger = new F04DetectorMessenger(this); 70 } 104 } 71 105 72 //....oooOO0OOooo........oooOO0OOooo........oo 106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 73 107 74 F04DetectorConstruction::~F04DetectorConstruct 108 F04DetectorConstruction::~F04DetectorConstruction() 75 { 109 { 76 delete fDetectorMessenger; 110 delete fDetectorMessenger; 77 } 111 } 78 112 79 //....oooOO0OOooo........oooOO0OOooo........oo 113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 80 114 81 G4VPhysicalVolume* F04DetectorConstruction::Co 115 G4VPhysicalVolume* F04DetectorConstruction::Construct() 82 { 116 { >> 117 83 if (fPhysiWorld) { 118 if (fPhysiWorld) { 84 G4GeometryManager::GetInstance()->OpenGeom << 119 G4GeometryManager::GetInstance()->OpenGeometry(); 85 G4PhysicalVolumeStore::GetInstance()->Clea << 120 G4PhysicalVolumeStore::GetInstance()->Clean(); 86 G4LogicalVolumeStore::GetInstance()->Clean << 121 G4LogicalVolumeStore::GetInstance()->Clean(); 87 G4SolidStore::GetInstance()->Clean(); << 122 G4SolidStore::GetInstance()->Clean(); 88 } 123 } 89 124 90 fMaterials = F04Materials::GetInstance(); 125 fMaterials = F04Materials::GetInstance(); 91 126 92 DefineMaterials(); 127 DefineMaterials(); 93 128 94 return ConstructDetector(); 129 return ConstructDetector(); 95 } 130 } 96 131 97 //....oooOO0OOooo........oooOO0OOooo........oo 132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 98 133 99 void F04DetectorConstruction::DefineMaterials( 134 void F04DetectorConstruction::DefineMaterials() 100 { 135 { 101 // define materials for the experiment << 136 //define materials for the experiment 102 137 103 fVacuum = fMaterials->GetMaterial("G4_Galact 138 fVacuum = fMaterials->GetMaterial("G4_Galactic"); 104 139 105 fWorldMaterial = fMaterials->GetMaterial("G4 << 140 fWorldMaterial = fMaterials->GetMaterial("G4_AIR"); 106 fDegraderMaterial = fMaterials->GetMaterial( 141 fDegraderMaterial = fMaterials->GetMaterial("G4_Pb"); 107 fTargetMaterial = fMaterials->GetMaterial("G << 142 fTargetMaterial = fMaterials->GetMaterial("G4_W"); 108 } 143 } 109 144 110 //....oooOO0OOooo........oooOO0OOooo........oo 145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 111 146 112 G4VPhysicalVolume* F04DetectorConstruction::Co 147 G4VPhysicalVolume* F04DetectorConstruction::ConstructDetector() 113 { 148 { 114 fSolidWorld = new G4Tubs("World", 0., GetWor << 149 fSolidWorld = new G4Tubs("World", 115 << 150 0.,GetWorldSizeR(),GetWorldSizeZ()/2.,0.,twopi); 116 fLogicWorld = new G4LogicalVolume(fSolidWorl << 151 117 << 152 fLogicWorld = new G4LogicalVolume(fSolidWorld, 118 fPhysiWorld = << 153 GetWorldMaterial(), 119 new G4PVPlacement(nullptr, G4ThreeVector() << 154 "World"); >> 155 >> 156 fPhysiWorld = new G4PVPlacement(0, >> 157 G4ThreeVector(), >> 158 "World", >> 159 fLogicWorld, >> 160 0, >> 161 false, >> 162 0); 120 163 121 // Capture Magnet 164 // Capture Magnet 122 165 123 fSolidCaptureMgnt = << 166 fSolidCaptureMgnt = new G4Tubs("CaptureMgnt", 124 new G4Tubs("CaptureMgnt", 0., GetCaptureMg << 167 0.,GetCaptureMgntRadius(), 125 << 168 GetCaptureMgntLength()/2.,0.,twopi); 126 fLogicCaptureMgnt = new G4LogicalVolume(fSol << 169 >> 170 fLogicCaptureMgnt = new G4LogicalVolume(fSolidCaptureMgnt, >> 171 fVacuum, >> 172 "CaptureMgnt"); 127 173 128 fCaptureMgntCenter = G4ThreeVector(); 174 fCaptureMgntCenter = G4ThreeVector(); 129 175 130 fPhysiCaptureMgnt = new G4PVPlacement(nullpt << 176 fPhysiCaptureMgnt = new G4PVPlacement(0, 131 fLogic << 177 fCaptureMgntCenter, >> 178 "CaptureMgnt", >> 179 fLogicCaptureMgnt, >> 180 fPhysiWorld, >> 181 false, >> 182 0); 132 183 133 // Transfer Magnet 184 // Transfer Magnet 134 185 135 fSolidTransferMgnt = new G4Tubs("TransferMgn << 186 fSolidTransferMgnt = new G4Tubs("TransferMgnt", 136 GetTransferM << 187 0.,GetTransferMgntRadius(), >> 188 GetTransferMgntLength()/2.,0.,twopi); 137 189 138 fLogicTransferMgnt = new G4LogicalVolume(fSo << 190 fLogicTransferMgnt = new G4LogicalVolume(fSolidTransferMgnt, >> 191 fVacuum, >> 192 "TransferMgnt"); 139 193 140 G4double z = GetCaptureMgntLength() / 2. + G << 194 G4double z = GetCaptureMgntLength()/2. + GetTransferMgntLength()/2. 141 G4double x = GetTransferMgntPos() / 2.; << 195 + GetTransferMgntPos(); >> 196 G4double x = GetTransferMgntPos()/2.; 142 197 143 fTransferMgntCenter = G4ThreeVector(x, 0., z << 198 fTransferMgntCenter = G4ThreeVector(x,0.,z); 144 199 145 auto g4rot = new G4RotationMatrix(); << 200 G4RotationMatrix* g4rot = new G4RotationMatrix(); 146 *g4rot = StringToRotationMatrix("Y30,X10"); 201 *g4rot = StringToRotationMatrix("Y30,X10"); 147 *g4rot = g4rot->inverse(); 202 *g4rot = g4rot->inverse(); 148 if (*g4rot == G4RotationMatrix()) g4rot = nu << 203 if (*g4rot == G4RotationMatrix()) g4rot = NULL; 149 204 150 fPhysiTransferMgnt = new G4PVPlacement(g4rot << 205 fPhysiTransferMgnt = new G4PVPlacement(g4rot, 151 fLogi << 206 fTransferMgntCenter, >> 207 "TransferMgnt", >> 208 fLogicTransferMgnt, >> 209 fPhysiWorld, >> 210 false, >> 211 0); 152 212 153 // Test Plane 213 // Test Plane 154 214 155 auto solidTestPlane = new G4Tubs("TestPlane" << 215 G4Tubs* solidTestPlane = new G4Tubs("TestPlane", 156 << 216 0.,GetTransferMgntRadius(), 157 auto logicTestPlane = new G4LogicalVolume(so << 217 1.*mm,0.,twopi); 158 << 218 159 z = GetTransferMgntLength() / 2. - 1. * mm; << 219 G4LogicalVolume* logicTestPlane = new G4LogicalVolume(solidTestPlane, 160 << 220 fVacuum, 161 G4ThreeVector testPlaneCenter = G4ThreeVecto << 221 "TestPlane"); 162 << 222 163 new G4PVPlacement(nullptr, testPlaneCenter, << 223 z = GetTransferMgntLength()/2. - 1.*mm; 164 false, 0); << 224 >> 225 G4ThreeVector testPlaneCenter = G4ThreeVector(0.,0.,z); >> 226 >> 227 new G4PVPlacement(0, >> 228 testPlaneCenter, >> 229 "TestPlane", >> 230 logicTestPlane, >> 231 fPhysiTransferMgnt, >> 232 false, >> 233 0); 165 234 166 // Target 235 // Target 167 236 168 if (GetTargetThickness() > 0.) { << 237 if (GetTargetThickness() > 0.) 169 fSolidTarget = << 238 { 170 new G4Tubs("Target", 0., GetTargetRadius << 239 fSolidTarget = new G4Tubs("Target", 171 << 240 0.,GetTargetRadius(), 172 fLogicTarget = new G4LogicalVolume(fSolidT << 241 GetTargetThickness()/2.,0.,twopi); 173 << 242 174 G4int i = GetTargetAngle(); << 243 fLogicTarget = new G4LogicalVolume(fSolidTarget, 175 << 244 GetTargetMaterial(), 176 G4String angle = std::to_string(i); << 245 "Target"); 177 G4StrUtil::strip(angle); << 246 178 angle = "Y" + angle; << 247 G4int i = GetTargetAngle(); 179 << 248 180 g4rot = new G4RotationMatrix(); << 249 char c[4]; 181 *g4rot = StringToRotationMatrix(angle); << 250 sprintf(c,"%d",i); 182 *g4rot = g4rot->inverse(); << 251 G4String angle = c; 183 if (*g4rot == G4RotationMatrix()) g4rot = << 252 angle = angle.strip(G4String::both,' '); 184 << 253 angle = "Y" + angle; 185 G4ThreeVector targetCenter(0., 0., GetTarg << 254 186 << 255 g4rot = new G4RotationMatrix(); 187 fPhysiTarget = << 256 *g4rot = StringToRotationMatrix(angle); 188 new G4PVPlacement(g4rot, targetCenter, " << 257 *g4rot = g4rot->inverse(); >> 258 if (*g4rot == G4RotationMatrix()) g4rot = NULL; >> 259 >> 260 G4ThreeVector targetCenter(0.,0.,GetTargetPos()); >> 261 >> 262 fPhysiTarget = new G4PVPlacement(g4rot, >> 263 targetCenter, >> 264 "Target", >> 265 fLogicTarget, >> 266 fPhysiCaptureMgnt, >> 267 false, >> 268 0); 189 } 269 } 190 270 191 // Degrader 271 // Degrader 192 272 193 if (GetDegraderThickness() > 0.) { << 273 if (GetDegraderThickness() > 0.) 194 fSolidDegrader = << 274 { 195 new G4Tubs("Degrader", 0., GetDegraderRa << 275 fSolidDegrader = new G4Tubs("Degrader", 196 << 276 0., GetDegraderRadius(), 197 fLogicDegrader = new G4LogicalVolume(fSoli << 277 GetDegraderThickness()/2., 0.,twopi); 198 << 278 199 G4ThreeVector degraderCenter = G4ThreeVect << 279 fLogicDegrader = new G4LogicalVolume(fSolidDegrader, 200 << 280 GetDegraderMaterial(), 201 fPhysiDegrader = new G4PVPlacement(nullptr << 281 "Degrader"); 202 fPhysiT << 282 >> 283 G4ThreeVector degraderCenter = G4ThreeVector(0.,0.,GetDegraderPos()); >> 284 >> 285 fPhysiDegrader = new G4PVPlacement(0, >> 286 degraderCenter, >> 287 "Degrader", >> 288 fLogicDegrader, >> 289 fPhysiTransferMgnt, >> 290 false, >> 291 0); 203 } 292 } 204 293 205 return fPhysiWorld; 294 return fPhysiWorld; 206 } 295 } 207 296 208 //....oooOO0OOooo........oooOO0OOooo........oo 297 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 209 298 210 void F04DetectorConstruction::SetWorldMaterial 299 void F04DetectorConstruction::SetWorldMaterial(const G4String materialChoice) 211 { 300 { 212 G4Material* pttoMaterial = G4NistManager::In << 301 G4Material* pttoMaterial = >> 302 G4NistManager::Instance()->FindOrBuildMaterial(materialChoice); 213 303 214 if (pttoMaterial != fWorldMaterial) { 304 if (pttoMaterial != fWorldMaterial) { 215 if (pttoMaterial) { << 305 if ( pttoMaterial ) { 216 fWorldMaterial = pttoMaterial; << 306 fWorldMaterial = pttoMaterial; 217 G4RunManager::GetRunManager()->PhysicsHa << 307 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 218 } << 308 } else { 219 else { << 309 G4cout << "\n--> WARNING from SetWorldMaterial : " 220 G4cout << "\n--> WARNING from SetWorldMa << 310 << materialChoice << " not found" << G4endl; 221 << G4endl; << 311 } 222 } << 223 } 312 } 224 } 313 } 225 314 226 //....oooOO0OOooo........oooOO0OOooo........oo 315 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 227 316 228 void F04DetectorConstruction::SetTargetMateria 317 void F04DetectorConstruction::SetTargetMaterial(const G4String materialChoice) 229 { 318 { 230 G4Material* pttoMaterial = G4NistManager::In << 319 G4Material* pttoMaterial = >> 320 G4NistManager::Instance()->FindOrBuildMaterial(materialChoice); 231 321 232 if (pttoMaterial != fTargetMaterial) { 322 if (pttoMaterial != fTargetMaterial) { 233 if (pttoMaterial) { << 323 if ( pttoMaterial ) { 234 fTargetMaterial = pttoMaterial; << 324 fTargetMaterial = pttoMaterial; 235 G4RunManager::GetRunManager()->PhysicsHa << 325 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 236 } << 326 } else { 237 else { << 327 G4cout << "\n--> WARNING from SetTargetMaterial : " 238 G4cout << "\n--> WARNING from SetTarget << 328 << materialChoice << " not found" << G4endl; 239 << G4endl; << 329 } 240 } << 241 } 330 } 242 } 331 } 243 332 244 //....oooOO0OOooo........oooOO0OOooo........oo 333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 245 334 246 void F04DetectorConstruction::SetDegraderMater 335 void F04DetectorConstruction::SetDegraderMaterial(const G4String materialChoice) 247 336 248 { 337 { 249 G4Material* pttoMaterial = G4NistManager::In << 338 G4Material* pttoMaterial = >> 339 G4NistManager::Instance()->FindOrBuildMaterial(materialChoice); 250 340 251 if (pttoMaterial != fDegraderMaterial) { 341 if (pttoMaterial != fDegraderMaterial) { 252 if (pttoMaterial) { << 342 if ( pttoMaterial ) { 253 fDegraderMaterial = pttoMaterial; << 343 fDegraderMaterial = pttoMaterial; 254 G4RunManager::GetRunManager()->PhysicsHa << 344 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 255 } << 345 } else { 256 else { << 346 G4cout << "\n--> WARNING from SetDegraderMaterial : " 257 G4cout << "\n--> WARNING from SetDegrade << 347 << materialChoice << " not found" << G4endl; 258 << G4endl; << 348 } 259 } << 260 } 349 } 261 } 350 } 262 351 263 //....oooOO0OOooo........oooOO0OOooo........oo 352 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 264 353 265 void F04DetectorConstruction::SetWorldSizeZ(G4 354 void F04DetectorConstruction::SetWorldSizeZ(G4double val) 266 { 355 { 267 fWorldSizeZ = val; 356 fWorldSizeZ = val; 268 if (G4StateManager::GetStateManager()->GetCu << 357 G4RunManager::GetRunManager()->ReinitializeGeometry(); 269 G4RunManager::GetRunManager()->GeometryHas << 270 } 358 } 271 359 272 //....oooOO0OOooo........oooOO0OOooo........oo 360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 273 361 274 void F04DetectorConstruction::SetWorldSizeR(G4 362 void F04DetectorConstruction::SetWorldSizeR(G4double val) 275 { 363 { 276 fWorldSizeR = val; 364 fWorldSizeR = val; 277 if (G4StateManager::GetStateManager()->GetCu << 365 G4RunManager::GetRunManager()->ReinitializeGeometry(); 278 G4RunManager::GetRunManager()->GeometryHas << 279 } 366 } 280 367 281 //....oooOO0OOooo........oooOO0OOooo........oo 368 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 282 369 283 void F04DetectorConstruction::SetCaptureMgntRa 370 void F04DetectorConstruction::SetCaptureMgntRadius(G4double val) 284 { 371 { 285 fCaptureMgntRadius = val; 372 fCaptureMgntRadius = val; 286 if (G4StateManager::GetStateManager()->GetCu << 373 G4RunManager::GetRunManager()->ReinitializeGeometry(); 287 G4RunManager::GetRunManager()->GeometryHas << 288 } 374 } 289 375 290 //....oooOO0OOooo........oooOO0OOooo........oo 376 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 291 377 292 void F04DetectorConstruction::SetCaptureMgntLe 378 void F04DetectorConstruction::SetCaptureMgntLength(G4double val) 293 { 379 { 294 fCaptureMgntLength = val; 380 fCaptureMgntLength = val; 295 if (G4StateManager::GetStateManager()->GetCu << 381 G4RunManager::GetRunManager()->ReinitializeGeometry(); 296 G4RunManager::GetRunManager()->GeometryHas << 297 } 382 } 298 383 299 //....oooOO0OOooo........oooOO0OOooo........oo 384 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 300 385 301 void F04DetectorConstruction::SetCaptureMgntB1 386 void F04DetectorConstruction::SetCaptureMgntB1(G4double val) 302 { 387 { 303 fCaptureMgntB1 = val; 388 fCaptureMgntB1 = val; 304 if (G4StateManager::GetStateManager()->GetCu << 389 G4RunManager::GetRunManager()->ReinitializeGeometry(); 305 G4RunManager::GetRunManager()->GeometryHas << 306 } 390 } 307 391 308 //....oooOO0OOooo........oooOO0OOooo........oo 392 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 309 393 310 void F04DetectorConstruction::SetCaptureMgntB2 394 void F04DetectorConstruction::SetCaptureMgntB2(G4double val) 311 { 395 { 312 fCaptureMgntB2 = val; 396 fCaptureMgntB2 = val; 313 if (G4StateManager::GetStateManager()->GetCu << 397 G4RunManager::GetRunManager()->ReinitializeGeometry(); 314 G4RunManager::GetRunManager()->GeometryHas << 315 } 398 } 316 399 317 //....oooOO0OOooo........oooOO0OOooo........oo 400 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 318 401 319 void F04DetectorConstruction::SetTransferMgntR 402 void F04DetectorConstruction::SetTransferMgntRadius(G4double val) 320 { 403 { 321 fTransferMgntRadius = val; 404 fTransferMgntRadius = val; 322 if (G4StateManager::GetStateManager()->GetCu << 405 G4RunManager::GetRunManager()->ReinitializeGeometry(); 323 G4RunManager::GetRunManager()->GeometryHas << 324 } 406 } 325 407 326 //....oooOO0OOooo........oooOO0OOooo........oo 408 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 327 409 328 void F04DetectorConstruction::SetTransferMgntL 410 void F04DetectorConstruction::SetTransferMgntLength(G4double val) 329 { 411 { 330 fTransferMgntLength = val; 412 fTransferMgntLength = val; 331 if (G4StateManager::GetStateManager()->GetCu << 413 G4RunManager::GetRunManager()->ReinitializeGeometry(); 332 G4RunManager::GetRunManager()->GeometryHas << 333 } 414 } 334 415 335 //....oooOO0OOooo........oooOO0OOooo........oo 416 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 336 417 337 void F04DetectorConstruction::SetTransferMgntB 418 void F04DetectorConstruction::SetTransferMgntB(G4double val) 338 { 419 { 339 fTransferMgntB = val; 420 fTransferMgntB = val; 340 if (G4StateManager::GetStateManager()->GetCu << 421 G4RunManager::GetRunManager()->ReinitializeGeometry(); 341 G4RunManager::GetRunManager()->GeometryHas << 342 } 422 } 343 423 344 //....oooOO0OOooo........oooOO0OOooo........oo 424 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 345 425 346 void F04DetectorConstruction::SetTransferMgntP 426 void F04DetectorConstruction::SetTransferMgntPos(G4double val) 347 { 427 { 348 fTransferMgntPos = val; 428 fTransferMgntPos = val; 349 if (G4StateManager::GetStateManager()->GetCu << 429 G4RunManager::GetRunManager()->ReinitializeGeometry(); 350 G4RunManager::GetRunManager()->GeometryHas << 351 } 430 } 352 431 353 //....oooOO0OOooo........oooOO0OOooo........oo 432 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 354 433 355 void F04DetectorConstruction::SetTargetRadius( 434 void F04DetectorConstruction::SetTargetRadius(G4double val) 356 { 435 { 357 fTargetRadius = val; 436 fTargetRadius = val; 358 if (G4StateManager::GetStateManager()->GetCu << 437 G4RunManager::GetRunManager()->ReinitializeGeometry(); 359 G4RunManager::GetRunManager()->GeometryHas << 360 } 438 } 361 439 362 //....oooOO0OOooo........oooOO0OOooo........oo 440 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 363 441 364 void F04DetectorConstruction::SetTargetThickne 442 void F04DetectorConstruction::SetTargetThickness(G4double val) 365 { 443 { 366 fTargetThickness = val; 444 fTargetThickness = val; 367 if (G4StateManager::GetStateManager()->GetCu << 445 G4RunManager::GetRunManager()->ReinitializeGeometry(); 368 G4RunManager::GetRunManager()->GeometryHas << 369 } 446 } 370 447 371 //....oooOO0OOooo........oooOO0OOooo........oo 448 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 372 449 373 void F04DetectorConstruction::SetTargetPos(G4d 450 void F04DetectorConstruction::SetTargetPos(G4double val) 374 { 451 { 375 fTargetPos = val; 452 fTargetPos = val; 376 if (G4StateManager::GetStateManager()->GetCu << 453 G4RunManager::GetRunManager()->ReinitializeGeometry(); 377 G4RunManager::GetRunManager()->GeometryHas << 378 } 454 } 379 455 380 //....oooOO0OOooo........oooOO0OOooo........oo 456 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 381 457 382 void F04DetectorConstruction::SetTargetAngle(G 458 void F04DetectorConstruction::SetTargetAngle(G4int val) 383 { 459 { 384 fTargetAngle = val; 460 fTargetAngle = val; 385 if (G4StateManager::GetStateManager()->GetCu << 461 G4RunManager::GetRunManager()->ReinitializeGeometry(); 386 G4RunManager::GetRunManager()->GeometryHas << 387 } 462 } 388 463 389 //....oooOO0OOooo........oooOO0OOooo........oo 464 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 390 465 391 void F04DetectorConstruction::SetDegraderRadiu 466 void F04DetectorConstruction::SetDegraderRadius(G4double val) 392 { 467 { 393 fDegraderRadius = val; 468 fDegraderRadius = val; 394 if (G4StateManager::GetStateManager()->GetCu << 469 G4RunManager::GetRunManager()->ReinitializeGeometry(); 395 G4RunManager::GetRunManager()->GeometryHas << 396 } 470 } 397 471 398 //....oooOO0OOooo........oooOO0OOooo........oo 472 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 399 473 400 void F04DetectorConstruction::SetDegraderThick 474 void F04DetectorConstruction::SetDegraderThickness(G4double val) 401 { 475 { 402 fDegraderThickness = val; 476 fDegraderThickness = val; 403 if (G4StateManager::GetStateManager()->GetCu << 477 G4RunManager::GetRunManager()->ReinitializeGeometry(); 404 G4RunManager::GetRunManager()->GeometryHas << 405 } 478 } 406 479 407 //....oooOO0OOooo........oooOO0OOooo........oo 480 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 408 481 409 void F04DetectorConstruction::SetDegraderPos(G 482 void F04DetectorConstruction::SetDegraderPos(G4double val) 410 { 483 { 411 fDegraderPos = val; 484 fDegraderPos = val; 412 if (G4StateManager::GetStateManager()->GetCu << 485 G4RunManager::GetRunManager()->ReinitializeGeometry(); 413 G4RunManager::GetRunManager()->GeometryHas << 414 } 486 } 415 487 416 //....oooOO0OOooo........oooOO0OOooo........oo 488 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 417 489 418 void F04DetectorConstruction::ConstructSDandFi 490 void F04DetectorConstruction::ConstructSDandField() 419 { 491 { 420 if (!fFieldSetUp.Get()) { 492 if (!fFieldSetUp.Get()) { 421 F04GlobalField* field = F04GlobalField::Ge << 493 F04GlobalField* field = F04GlobalField::GetObject(this); 422 G4AutoDelete::Register(field); // Kernel << 494 G4AutoDelete::Register(field); // Kernel will delete the F04GlobalField 423 fFieldSetUp.Put(field); << 495 fFieldSetUp.Put(field); 424 } 496 } 425 } 497 } 426 498 427 //....oooOO0OOooo........oooOO0OOooo........oo 499 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 428 500 429 G4RotationMatrix F04DetectorConstruction::Stri << 501 G4RotationMatrix >> 502 F04DetectorConstruction::StringToRotationMatrix(G4String rotation) 430 { 503 { 431 // We apply successive rotations OF THE OBJE 504 // We apply successive rotations OF THE OBJECT around the FIXED 432 // axes of the parent's local coordinates; r 505 // axes of the parent's local coordinates; rotations are applied 433 // left-to-right (rotation="r1,r2,r3" => r1 506 // left-to-right (rotation="r1,r2,r3" => r1 then r2 then r3). 434 507 435 G4RotationMatrix rot; 508 G4RotationMatrix rot; 436 509 437 unsigned int place = 0; 510 unsigned int place = 0; 438 511 439 while (place < rotation.size()) { 512 while (place < rotation.size()) { 440 G4double angle; << 513 441 char* p(nullptr); << 514 G4double angle; 442 G4String current = rotation.substr(place + << 515 char* p(0); 443 angle = strtod(current.c_str(), &p) * deg; << 516 G4String current=rotation.substr(place+1); 444 << 517 angle = strtod(current.c_str(),&p) * deg; 445 if (!p || (*p != ',' && *p != '\0')) { << 518 446 G4cerr << "Invalid rotation specificatio << 519 if (!p || (*p != ',' && *p != '\0')) { 447 << 520 G4cerr << "Invalid rotation specification: " << 448 return rot; << 521 rotation.c_str() << G4endl; 449 } << 522 450 << 523 return rot; 451 G4RotationMatrix thisRotation; << 524 } 452 << 525 453 switch (rotation.substr(place, 1).c_str()[ << 526 G4RotationMatrix thisRotation; 454 case 'X': << 527 455 case 'x': << 528 switch(rotation.substr(place,1).c_str()[0]) { 456 thisRotation = G4RotationMatrix(CLHEP: << 529 case 'X': case 'x': 457 break; << 530 thisRotation = G4RotationMatrix(CLHEP::HepRotationX(angle)); 458 case 'Y': << 531 break; 459 case 'y': << 532 case 'Y': case 'y': 460 thisRotation = G4RotationMatrix(CLHEP: << 533 thisRotation = G4RotationMatrix(CLHEP::HepRotationY(angle)); 461 break; << 534 break; 462 case 'Z': << 535 case 'Z': case 'z': 463 case 'z': << 536 thisRotation = G4RotationMatrix(CLHEP::HepRotationZ(angle)); 464 thisRotation = G4RotationMatrix(CLHEP: << 537 break; 465 break; << 538 default: 466 default: << 539 G4cerr << " Invalid rotation specification: " 467 G4cerr << " Invalid rotation specifica << 540 << rotation << G4endl; 468 return rot; << 541 return rot; 469 } << 542 } 470 << 543 471 rot = thisRotation * rot; << 544 rot = thisRotation * rot; 472 place = rotation.find(',', place); << 545 place = rotation.find(',',place); 473 if (place > rotation.size()) break; << 546 if (place > rotation.size()) break; 474 ++place; << 547 ++place; 475 } 548 } 476 549 477 return rot; 550 return rot; >> 551 478 } 552 } 479 553