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