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