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