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 /// \file electromagnetic/TestEm9/src/Detector << 27 /// \brief Implementation of the DetectorConst << 28 // 26 // >> 27 // $Id: DetectorConstruction.cc,v 1.11 2008/04/07 18:09:05 vnivanch Exp $ >> 28 // GEANT4 tag $Name: geant4-09-02 $ 29 // 29 // 30 // 30 // 31 ////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////// 32 // 32 // 33 // TestEm9: Crystal calorimeter 33 // TestEm9: Crystal calorimeter 34 // 34 // 35 // Created: 31.01.03 V.Ivanchenko 35 // Created: 31.01.03 V.Ivanchenko 36 // 36 // 37 // Modified: 37 // Modified: 38 // 38 // 39 ////////////////////////////////////////////// 39 //////////////////////////////////////////////////////////////////////// 40 // 40 // 41 41 >> 42 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 //....oooOO0OOooo........oooOO0OOooo........oo 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 45 45 #include "DetectorConstruction.hh" 46 #include "DetectorConstruction.hh" 46 << 47 #include "DetectorMessenger.hh" 47 #include "DetectorMessenger.hh" 48 48 49 #include "G4Box.hh" 49 #include "G4Box.hh" 50 #include "G4Colour.hh" << 51 #include "G4GeometryManager.hh" << 52 #include "G4LogicalVolume.hh" 50 #include "G4LogicalVolume.hh" 53 #include "G4LogicalVolumeStore.hh" << 54 #include "G4NistManager.hh" << 55 #include "G4PVPlacement.hh" 51 #include "G4PVPlacement.hh" 56 #include "G4PVReplica.hh" 52 #include "G4PVReplica.hh" 57 #include "G4PhysicalVolumeStore.hh" << 53 58 #include "G4ProductionCuts.hh" << 54 #include "G4TransportationManager.hh" >> 55 >> 56 #include "G4GeometryManager.hh" >> 57 #include "G4RunManager.hh" 59 #include "G4Region.hh" 58 #include "G4Region.hh" 60 #include "G4RegionStore.hh" 59 #include "G4RegionStore.hh" 61 #include "G4RunManager.hh" << 60 #include "G4ProductionCuts.hh" >> 61 #include "G4PhysicalVolumeStore.hh" >> 62 #include "G4LogicalVolumeStore.hh" 62 #include "G4SolidStore.hh" 63 #include "G4SolidStore.hh" 63 #include "G4SystemOfUnits.hh" << 64 #include "G4NistManager.hh" 64 #include "G4TransportationManager.hh" << 65 65 #include "G4UnitsTable.hh" << 66 #include "G4VisAttributes.hh" 66 #include "G4VisAttributes.hh" >> 67 #include "G4Colour.hh" >> 68 >> 69 #include "G4UnitsTable.hh" 67 #include "G4ios.hh" 70 #include "G4ios.hh" 68 71 69 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 70 73 71 DetectorConstruction::DetectorConstruction() 74 DetectorConstruction::DetectorConstruction() 72 : G4VUserDetectorConstruction(), << 75 : G4VUserDetectorConstruction() 73 fCalMaterial(0), << 76 { 74 fVertMaterial(0), << 77 detectorMessenger = new DetectorMessenger(this); 75 fAbsMaterial(0), << 76 fWorldMaterial(0), << 77 fYorkMaterial(0), << 78 fLogicWorld(0), << 79 fLogicCal(0), << 80 fLogicA1(0), << 81 fLogicA2(0), << 82 fLogicA3(0), << 83 fLogicA4(0), << 84 fVertexRegion(0), << 85 fMuonRegion(0), << 86 fVertexDetectorCuts(0), << 87 fMuonDetectorCuts(0), << 88 fDetectorMessenger(0) << 89 { << 90 fDetectorMessenger = new DetectorMessenger(t << 91 << 92 fEcalLength = 36. * cm; << 93 fEcalWidth = 6. * cm; << 94 fVertexLength = 3. * cm; << 95 fPadLength = 0.1 * mm; << 96 fPadWidth = 0.02 * mm; << 97 fAbsLength = 2. * mm; << 98 fWorldZ = 0.0; << 99 fLogicWorld = 0; << 100 fLogicCal = 0; << 101 fLogicA1 = 0; << 102 fLogicA2 = 0; << 103 fLogicA3 = 0; << 104 fLogicA4 = 0; << 105 fVertexRegion = 0; << 106 fMuonRegion = 0; << 107 78 >> 79 ecalLength = 36.*cm; >> 80 ecalWidth = 6.*cm; >> 81 vertexLength = 3.*cm; >> 82 padLength = 0.1*mm; >> 83 padWidth = 0.02*mm; >> 84 absLength = 2.*mm; >> 85 vertexRegion = 0; >> 86 muonRegion = 0; >> 87 logicWorld = 0; >> 88 logicCal = 0; >> 89 logicA1 = 0; 108 DefineMaterials(); 90 DefineMaterials(); 109 fVertexDetectorCuts = new G4ProductionCuts() << 91 vertexDetectorCuts = new G4ProductionCuts(); 110 fMuonDetectorCuts = new G4ProductionCuts(); << 92 muonDetectorCuts = new G4ProductionCuts(); 111 } 93 } 112 94 113 //....oooOO0OOooo........oooOO0OOooo........oo 95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 114 96 115 DetectorConstruction::~DetectorConstruction() 97 DetectorConstruction::~DetectorConstruction() 116 { << 98 { 117 delete fDetectorMessenger; << 99 delete detectorMessenger; 118 delete fVertexDetectorCuts; << 100 delete vertexDetectorCuts; 119 delete fMuonDetectorCuts; << 101 delete muonDetectorCuts; 120 } 102 } 121 103 122 //....oooOO0OOooo........oooOO0OOooo........oo 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 123 105 124 G4VPhysicalVolume* DetectorConstruction::Const 106 G4VPhysicalVolume* DetectorConstruction::Construct() 125 { 107 { 126 return ConstructVolumes(); 108 return ConstructVolumes(); 127 } 109 } 128 110 129 //....oooOO0OOooo........oooOO0OOooo........oo 111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 130 112 131 void DetectorConstruction::DefineMaterials() 113 void DetectorConstruction::DefineMaterials() 132 { 114 { 133 // Default materials 115 // Default materials 134 116 135 G4NistManager* man = G4NistManager::Instance 117 G4NistManager* man = G4NistManager::Instance(); 136 // man->SetVerbose(1); 118 // man->SetVerbose(1); 137 fWorldMaterial = man->FindOrBuildMaterial("G << 119 worldMaterial = man->FindOrBuildMaterial("G4_AIR"); 138 fAbsMaterial = man->FindOrBuildMaterial("G4_ << 120 absMaterial = man->FindOrBuildMaterial("G4_Al"); 139 fVertMaterial = man->FindOrBuildMaterial("G4 << 121 vertMaterial = man->FindOrBuildMaterial("G4_Si"); 140 fYorkMaterial = man->FindOrBuildMaterial("G4 << 122 yorkMaterial = man->FindOrBuildMaterial("G4_Fe"); 141 fCalMaterial = man->FindOrBuildMaterial("G4_ << 123 calMaterial = man->FindOrBuildMaterial("G4_CESIUM_IODIDE"); 142 } 124 } 143 125 144 //....oooOO0OOooo........oooOO0OOooo........oo 126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 145 127 146 G4VPhysicalVolume* DetectorConstruction::Const 128 G4VPhysicalVolume* DetectorConstruction::ConstructVolumes() 147 { 129 { 148 // Cleanup old geometry 130 // Cleanup old geometry 149 131 150 G4GeometryManager::GetInstance()->OpenGeomet 132 G4GeometryManager::GetInstance()->OpenGeometry(); 151 133 152 if (G4NistManager::Instance()->GetVerbose() << 134 if(G4NistManager::Instance()->GetVerbose() > 0) 153 G4cout << *(G4Material::GetMaterialTable() 135 G4cout << *(G4Material::GetMaterialTable()) << G4endl; 154 136 155 if (fVertexRegion) { << 137 if(vertexRegion) { 156 delete fVertexRegion; << 138 delete vertexRegion; 157 delete fMuonRegion; << 139 delete muonRegion; 158 } 140 } 159 fVertexRegion = new G4Region("VertexDetector << 141 vertexRegion = new G4Region("VertexDetector"); 160 fVertexRegion->SetProductionCuts(fVertexDete << 142 vertexRegion->SetProductionCuts(vertexDetectorCuts); 161 143 162 fMuonRegion = new G4Region("MuonDetector"); << 144 muonRegion = new G4Region("MuonDetector"); 163 fMuonRegion->SetProductionCuts(fMuonDetector << 145 muonRegion->SetProductionCuts(muonDetectorCuts); 164 146 165 G4SolidStore::GetInstance()->Clean(); 147 G4SolidStore::GetInstance()->Clean(); 166 G4LogicalVolumeStore::GetInstance()->Clean() 148 G4LogicalVolumeStore::GetInstance()->Clean(); 167 G4PhysicalVolumeStore::GetInstance()->Clean( 149 G4PhysicalVolumeStore::GetInstance()->Clean(); 168 150 169 if (fVertexLength < fPadLength * 5.0) fVerte << 151 if(vertexLength < padLength*5.0) vertexLength = padLength*5.0; 170 G4double gap = 0.01 * mm; << 152 G4double gap = 0.01*mm; 171 G4double biggap = 2. * cm; << 153 G4double biggap = 2.*cm; 172 G4double york = 10. * cm; << 154 G4double york = 10.*cm; 173 << 155 174 fWorldZ = 2. * fVertexLength + 3. * fAbsLeng << 156 worldZ = 2.*vertexLength + 3.*absLength + 0.5*(ecalLength + york) + biggap*2.; 175 << 157 176 G4double worldX = fEcalWidth * 3.0; << 158 G4double worldX = ecalWidth*3.0; 177 G4double vertexZ = -fWorldZ + fVertexLength << 159 G4double vertexZ= -worldZ + vertexLength*2.0 + absLength + biggap; 178 G4double absZ2 = -fWorldZ + fVertexLength * << 160 G4double absZ2 = -worldZ + vertexLength*4.0 + absLength*3.5 + biggap; 179 G4double ecalZ = << 161 G4double ecalZ = -worldZ + vertexLength*4.0 + absLength*4.0 + ecalLength*0.5 180 -fWorldZ + fVertexLength * 4.0 + fAbsLengt << 162 + 2.*biggap; 181 G4double yorkZ = << 163 G4double yorkZ = -worldZ + vertexLength*4.0 + absLength*5.0 + ecalLength 182 -fWorldZ + fVertexLength * 4.0 + fAbsLengt << 164 + york*0.5 + 3.*biggap; 183 165 184 // 166 // 185 // World 167 // World 186 // 168 // 187 G4Box* solidW = new G4Box("World", worldX, w << 169 G4Box* solidW = new G4Box("World",worldX,worldX,worldZ); 188 fLogicWorld = new G4LogicalVolume(solidW, fW << 170 logicWorld = new G4LogicalVolume( solidW,worldMaterial,"World"); 189 G4VPhysicalVolume* world = << 171 G4VPhysicalVolume* world = new G4PVPlacement(0,G4ThreeVector(), 190 new G4PVPlacement(0, G4ThreeVector(), "Wor << 172 "World",logicWorld,0,false,0); 191 173 192 // 174 // 193 // Ecal 175 // Ecal 194 // 176 // 195 G4Box* solidE = new G4Box("VolE", worldX, wo << 177 G4Box* solidE = new G4Box("VolE",worldX,worldX,ecalLength*0.5 + gap); 196 G4LogicalVolume* logicECal = new G4LogicalVo << 178 logicECal = new G4LogicalVolume( solidE,worldMaterial,"VolE"); 197 G4VPhysicalVolume* physE = << 179 G4VPhysicalVolume* physE = new G4PVPlacement(0,G4ThreeVector(0.,0.,ecalZ), 198 new G4PVPlacement(0, G4ThreeVector(0., 0., << 180 "VolE",logicECal,world,false,0); 199 181 200 G4Box* solidC = new G4Box("Ecal", fEcalWidth << 182 G4Box* solidC = new G4Box("Ecal",ecalWidth*0.5,ecalWidth*0.5,ecalLength*0.5); 201 fLogicCal = new G4LogicalVolume(solidC, fCal << 183 logicCal = new G4LogicalVolume( solidC,calMaterial,"Ecal"); 202 184 203 G4cout << "Ecal is " << G4BestUnit(fEcalLeng << 185 G4cout << "Ecal is " << G4BestUnit(ecalLength,"Length") 204 << G4endl; << 186 << " of " << calMaterial->GetName() << G4endl; 205 187 206 // Crystals 188 // Crystals 207 189 208 G4double x0 = -(fEcalWidth + gap) * 2.0; << 190 G4double x0 = -(ecalWidth + gap)*2.0; 209 G4double y = x0; << 191 G4double y = x0; 210 G4double x; 192 G4double x; 211 G4int k = 0; 193 G4int k = 0; 212 G4int i, j; << 194 G4VPhysicalVolume* pv; >> 195 G4int i,j; 213 196 214 for (i = 0; i < 5; i++) { << 197 for (i=0; i<5; i++) { 215 x = x0; << 198 x = x0; 216 for (j = 0; j < 5; j++) { << 199 for (j=0; j<5; j++) { 217 new G4PVPlacement(0, G4ThreeVector(x, y, << 200 >> 201 pv = new G4PVPlacement(0,G4ThreeVector(x,y,0.),"Ecal",logicCal, >> 202 physE,false,k); 218 k++; 203 k++; 219 x += fEcalWidth + gap; << 204 x += ecalWidth + gap; 220 } 205 } 221 y += fEcalWidth + gap; << 206 y += ecalWidth + gap; 222 } 207 } 223 208 224 // Absorber << 209 //Absorber 225 210 226 G4Box* solidA = new G4Box("Abso", worldX, wo << 211 G4Box* solidA = new G4Box("Abso",worldX,worldX,absLength*0.5); 227 fLogicA2 = new G4LogicalVolume(solidA, fAbsM << 212 logicA2 = new G4LogicalVolume( solidA,absMaterial,"Abs2"); 228 new G4PVPlacement(0, G4ThreeVector(0., 0., a << 213 pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,absZ2), 229 << 214 "Abs2",logicA2,world,false,0); 230 G4cout << "Absorber is " << G4BestUnit(fAbsL << 215 231 << G4endl; << 216 G4cout << "Absorber is " << G4BestUnit(absLength,"Length") 232 << 217 << " of " << absMaterial->GetName() << G4endl; 233 // York << 218 234 << 219 //York 235 G4Box* solidYV = new G4Box("VolY", worldX, w << 220 236 G4LogicalVolume* logicYV = new G4LogicalVolu << 221 G4Box* solidYV = new G4Box("VolY",worldX,worldX,york*0.5+absLength); 237 G4VPhysicalVolume* physYV = << 222 logicYV = new G4LogicalVolume( solidYV,yorkMaterial,"VolY"); 238 new G4PVPlacement(0, G4ThreeVector(0., 0., << 223 G4VPhysicalVolume* physYV = new G4PVPlacement(0,G4ThreeVector(0.,0.,yorkZ), 239 << 224 "VolY",logicYV,world,false,0); 240 G4Box* solidY = new G4Box("York", worldX, wo << 225 241 G4LogicalVolume* logicY = new G4LogicalVolum << 226 G4Box* solidY = new G4Box("York",worldX,worldX,york*0.5); 242 new G4PVPlacement(0, G4ThreeVector(), "York" << 227 logicY = new G4LogicalVolume( solidY,yorkMaterial,"York"); 243 << 228 pv = new G4PVPlacement(0,G4ThreeVector(), 244 fLogicA3 = new G4LogicalVolume(solidA, fAbsM << 229 "York",logicY,physYV,false,0); 245 fLogicA4 = new G4LogicalVolume(solidA, fAbsM << 230 246 << 231 logicA3 = new G4LogicalVolume( solidA,absMaterial,"Abs3"); 247 new G4PVPlacement(0, G4ThreeVector(0., 0., - << 232 logicA4 = new G4LogicalVolume( solidA,absMaterial,"Abs4"); 248 false, 0); << 233 249 new G4PVPlacement(0, G4ThreeVector(0., 0., ( << 234 pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,-(york+absLength)*0.5), 250 false, 0); << 235 "Abs3",logicA3,physYV,false,0); 251 << 236 pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,(york+absLength)*0.5), 252 // Vertex volume << 237 "Abs4",logicA4,physYV,false,0); 253 G4Box* solidVV = new G4Box("VolV", worldX, w << 238 254 G4LogicalVolume* logicVV = new G4LogicalVolu << 239 //Vertex volume 255 G4VPhysicalVolume* physVV = << 240 G4Box* solidVV = new G4Box("VolV",worldX,worldX,vertexLength*2.+absLength+gap); 256 new G4PVPlacement(0, G4ThreeVector(0., 0., << 241 logicVV = new G4LogicalVolume( solidVV,worldMaterial,"VolV"); 257 << 242 G4VPhysicalVolume* physVV = new G4PVPlacement(0,G4ThreeVector(0.,0.,vertexZ), 258 // Absorber << 243 "VolV",logicVV,world,false,0); 259 fLogicA1 = new G4LogicalVolume(solidA, fAbsM << 244 260 new G4PVPlacement(0, G4ThreeVector(0., 0., f << 245 //Absorber 261 fLogicA1, physVV, false, 0 << 246 logicA1 = new G4LogicalVolume( solidA,absMaterial,"Abs1"); 262 << 247 pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,vertexLength*2.-absLength*0.5), 263 // Vertex << 248 "Abs1",logicA1,physVV,false,0); 264 G4double vertWidth = fEcalWidth / 5.; << 249 265 G4int npads = (G4int)(vertWidth / fPadWidth) << 250 //Vertex 266 // G4cout << " vertWidth= " << vertWidth << << 251 G4double vertWidth = ecalWidth/5.; 267 // << " npads= " << npads << G4endl << 252 G4int npads = (G4int)(vertWidth/padWidth); 268 // insure beam to hit a middle of central p << 253 npads = (npads/2)*2 + 1; 269 npads = (npads / 2) * 2 + 1; << 254 x0 = -0.5*padWidth*((G4double)(npads-1)); 270 x0 = -0.5 * (fPadWidth + vertWidth); << 255 G4double x1 = std::fabs(x0) + 0.5*padWidth + gap; 271 G4double x1 = 0.5 * vertWidth + gap; << 256 G4double z = -(vertexLength+absLength); 272 G4double z = -(fVertexLength + fAbsLength); << 273 257 274 G4Box* solidVD = new G4Box("VertDet", x1, fE << 258 G4Box* solidVD = new G4Box("VertDet",x1,ecalWidth*0.5+gap,padLength*0.5); 275 G4LogicalVolume* logicVD = new G4LogicalVolu << 259 logicVD = new G4LogicalVolume( solidVD,vertMaterial,"VertDet"); 276 logicVD->SetSolid(solidVD); 260 logicVD->SetSolid(solidVD); 277 261 278 G4Box* solidV = new G4Box("Vert", fPadWidth << 262 G4Box* solidV = new G4Box("Vert",padWidth*0.5,ecalWidth*0.5,padLength*0.5); 279 G4LogicalVolume* logicV = new G4LogicalVolum << 263 logicV = new G4LogicalVolume( solidV,vertMaterial,"Vert"); 280 264 281 for (i = 0; i < 3; i++) { << 265 for (i=0; i<3; i++) { 282 new G4PVPlacement(0, G4ThreeVector(0., 0., << 266 pv = new G4PVPlacement(0,G4ThreeVector(0.,0.,z),"VertDet",logicVD, 283 z += fVertexLength; << 267 physVV,false,i); >> 268 z += vertexLength; 284 } 269 } 285 x = x0; 270 x = x0; 286 271 287 for (j = 0; j < npads; j++) { << 272 for (j=0; j<npads; j++) { 288 new G4PVPlacement(0, G4ThreeVector(x, 0., << 273 289 x += fPadWidth; << 274 pv = new G4PVPlacement(0,G4ThreeVector(x,0.,0.),logicV,"Vert",logicVD, >> 275 false,k); >> 276 x += padWidth; 290 } 277 } 291 278 292 G4cout << "Vertex is " << G4BestUnit(fVertex << 279 G4cout << "Vertex is " << G4BestUnit(vertexLength,"Length") 293 << G4BestUnit(fPadLength, "Length") < << 280 << " of 3 layers of Si of " << G4BestUnit(padLength,"Length") >> 281 << " npads= " << npads >> 282 << G4endl; 294 283 295 // Define region for the vertex detector 284 // Define region for the vertex detector 296 fVertexRegion->AddRootLogicalVolume(logicVV) << 285 vertexRegion->AddRootLogicalVolume(logicVV); 297 fVertexRegion->AddRootLogicalVolume(fLogicA3 << 286 vertexRegion->AddRootLogicalVolume(logicA3); 298 287 299 // Define region for the muon detector 288 // Define region for the muon detector 300 fMuonRegion->AddRootLogicalVolume(logicYV); << 289 muonRegion->AddRootLogicalVolume(logicYV); 301 290 302 // color regions 291 // color regions 303 logicVV->SetVisAttributes(G4VisAttributes::G << 292 logicVV-> SetVisAttributes(G4VisAttributes::Invisible); 304 logicV->SetVisAttributes(G4VisAttributes::Ge << 293 logicV-> SetVisAttributes(G4VisAttributes::Invisible); 305 logicECal->SetVisAttributes(G4VisAttributes: << 294 logicECal-> SetVisAttributes(G4VisAttributes::Invisible); 306 logicYV->SetVisAttributes(G4VisAttributes::G << 295 logicYV-> SetVisAttributes(G4VisAttributes::Invisible); 307 296 308 G4VisAttributes* regWcolor = new G4VisAttrib 297 G4VisAttributes* regWcolor = new G4VisAttributes(G4Colour(0.3, 0.3, 0.3)); 309 fLogicWorld->SetVisAttributes(regWcolor); << 298 logicWorld->SetVisAttributes(regWcolor); 310 299 311 G4VisAttributes* regVcolor = new G4VisAttrib 300 G4VisAttributes* regVcolor = new G4VisAttributes(G4Colour(0., 0.3, 0.7)); 312 logicVD->SetVisAttributes(regVcolor); 301 logicVD->SetVisAttributes(regVcolor); 313 302 314 G4VisAttributes* regCcolor = new G4VisAttrib 303 G4VisAttributes* regCcolor = new G4VisAttributes(G4Colour(0., 0.7, 0.3)); 315 fLogicCal->SetVisAttributes(regCcolor); << 304 logicCal->SetVisAttributes(regCcolor); 316 305 317 G4VisAttributes* regAcolor = new G4VisAttrib 306 G4VisAttributes* regAcolor = new G4VisAttributes(G4Colour(1., 0.5, 0.5)); 318 fLogicA1->SetVisAttributes(regAcolor); << 307 logicA1->SetVisAttributes(regAcolor); 319 fLogicA2->SetVisAttributes(regAcolor); << 308 logicA2->SetVisAttributes(regAcolor); 320 fLogicA3->SetVisAttributes(regAcolor); << 309 logicA3->SetVisAttributes(regAcolor); 321 fLogicA4->SetVisAttributes(regAcolor); << 310 logicA4->SetVisAttributes(regAcolor); 322 311 323 G4VisAttributes* regMcolor = new G4VisAttrib 312 G4VisAttributes* regMcolor = new G4VisAttributes(G4Colour(1., 1., 0.)); 324 logicY->SetVisAttributes(regMcolor); 313 logicY->SetVisAttributes(regMcolor); 325 314 326 // always return world 315 // always return world 327 G4cout << "### New geometry is constructed" 316 G4cout << "### New geometry is constructed" << G4endl; 328 << 317 329 return world; 318 return world; 330 } 319 } 331 320 332 //....oooOO0OOooo........oooOO0OOooo........oo 321 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 333 322 334 void DetectorConstruction::SetEcalMaterial(con 323 void DetectorConstruction::SetEcalMaterial(const G4String& mat) 335 { 324 { 336 // search the material by its name 325 // search the material by its name 337 G4Material* pttoMaterial = G4NistManager::In << 326 G4Material* pttoMaterial = 338 if (pttoMaterial && pttoMaterial != fCalMate << 327 G4NistManager::Instance()->FindOrBuildMaterial(mat, false); 339 fCalMaterial = pttoMaterial; << 328 if (pttoMaterial) { 340 if (fLogicCal) { << 329 calMaterial = pttoMaterial; 341 fLogicCal->SetMaterial(fCalMaterial); << 330 if(logicCal) { >> 331 logicCal->SetMaterial(calMaterial); 342 G4RunManager::GetRunManager()->PhysicsHa 332 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 343 } 333 } 344 } 334 } 345 } 335 } 346 336 347 //....oooOO0OOooo........oooOO0OOooo........oo 337 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 348 338 349 void DetectorConstruction::SetAbsMaterial(cons 339 void DetectorConstruction::SetAbsMaterial(const G4String& mat) 350 { 340 { 351 // search the material by its name 341 // search the material by its name 352 G4Material* pttoMaterial = G4NistManager::In << 342 G4Material* pttoMaterial = 353 if (pttoMaterial && pttoMaterial != fAbsMate << 343 G4NistManager::Instance()->FindOrBuildMaterial(mat, false); 354 fAbsMaterial = pttoMaterial; << 344 if (pttoMaterial) { 355 if (fLogicA1) { << 345 absMaterial = pttoMaterial; 356 fLogicA1->SetMaterial(fAbsMaterial); << 346 if(logicA1) { 357 fLogicA2->SetMaterial(fAbsMaterial); << 347 logicA1->SetMaterial(absMaterial); 358 fLogicA3->SetMaterial(fAbsMaterial); << 348 logicA2->SetMaterial(absMaterial); 359 fLogicA4->SetMaterial(fAbsMaterial); << 349 logicA3->SetMaterial(absMaterial); >> 350 logicA4->SetMaterial(absMaterial); 360 G4RunManager::GetRunManager()->PhysicsHa 351 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 361 } 352 } 362 } 353 } 363 } 354 } 364 355 365 //....oooOO0OOooo........oooOO0OOooo........oo 356 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 366 357 367 void DetectorConstruction::UpdateGeometry() 358 void DetectorConstruction::UpdateGeometry() 368 { 359 { 369 G4RunManager::GetRunManager()->PhysicsHasBee 360 G4RunManager::GetRunManager()->PhysicsHasBeenModified(); 370 G4RunManager::GetRunManager()->DefineWorldVo 361 G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes()); 371 } 362 } 372 363 373 //....oooOO0OOooo........oooOO0OOooo........oo 364 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 374 365 375 void DetectorConstruction::SetEcalLength(G4dou << 366 void DetectorConstruction::SetEcalLength (G4double val) 376 { 367 { 377 if (val > 0.0) { << 368 if(val > 0.0) { 378 fEcalLength = val; << 369 ecalLength = val; 379 G4RunManager::GetRunManager()->GeometryHas 370 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 380 } 371 } 381 } 372 } 382 373 383 //....oooOO0OOooo........oooOO0OOooo........oo 374 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 384 375 385 void DetectorConstruction::SetEcalWidth(G4doub << 376 void DetectorConstruction::SetEcalWidth (G4double val) 386 { 377 { 387 if (val > 0.0) { << 378 if(val > 0.0) { 388 fEcalWidth = val; << 379 ecalWidth = val; 389 G4RunManager::GetRunManager()->GeometryHas 380 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 390 } 381 } 391 } 382 } 392 383 393 //....oooOO0OOooo........oooOO0OOooo........oo 384 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 394 385 395 void DetectorConstruction::SetVertexLength(G4d << 386 void DetectorConstruction::SetVertexLength (G4double val) 396 { 387 { 397 if (val > 0.0) { << 388 if(val > 0.0) { 398 fVertexLength = val; << 389 vertexLength = val; 399 G4RunManager::GetRunManager()->GeometryHas 390 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 400 } 391 } 401 } 392 } 402 393 403 //....oooOO0OOooo........oooOO0OOooo........oo 394 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 404 395 405 void DetectorConstruction::SetPadLength(G4doub << 396 void DetectorConstruction::SetPadLength (G4double val) 406 { 397 { 407 if (val > 0.0) { << 398 if(val > 0.0) { 408 fPadLength = val; << 399 padLength = val; 409 G4RunManager::GetRunManager()->GeometryHas 400 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 410 } 401 } 411 } 402 } 412 403 413 //....oooOO0OOooo........oooOO0OOooo........oo 404 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 414 405 415 void DetectorConstruction::SetPadWidth(G4doubl << 406 void DetectorConstruction::SetPadWidth (G4double val) 416 { 407 { 417 if (val > 0.0) { << 408 if(val > 0.0) { 418 fPadWidth = val; << 409 padWidth = val; 419 G4RunManager::GetRunManager()->GeometryHas 410 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 420 } 411 } 421 } 412 } 422 413 423 //....oooOO0OOooo........oooOO0OOooo........oo 414 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 424 415 425 void DetectorConstruction::SetAbsLength(G4doub << 416 void DetectorConstruction::SetAbsLength(G4double val) 426 { 417 { 427 if (val > 0.0) { << 418 if(val > 0.0) { 428 fAbsLength = val; << 419 absLength = val; 429 G4RunManager::GetRunManager()->GeometryHas 420 G4RunManager::GetRunManager()->GeometryHasBeenModified(); 430 } 421 } 431 } 422 } 432 423 433 //....oooOO0OOooo........oooOO0OOooo........oo 424 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 434 425