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 biasing/ReverseMC01/src/RMC01Detecto 26 /// \file biasing/ReverseMC01/src/RMC01DetectorConstruction.cc 27 /// \brief Implementation of the RMC01Detector 27 /// \brief Implementation of the RMC01DetectorConstruction class 28 // 28 // >> 29 // $Id$ 29 // 30 // 30 ////////////////////////////////////////////// 31 ////////////////////////////////////////////////////////////// 31 // Class Name: RMC01DetectorConstr 32 // Class Name: RMC01DetectorConstruction 32 // Author: L. Desorgher 33 // Author: L. Desorgher 33 // Organisation: SpaceIT GmbH 34 // Organisation: SpaceIT GmbH 34 // Contract: ESA contract 21435/ 35 // Contract: ESA contract 21435/08/NL/AT 35 // Customer: ESA/ESTEC 36 // Customer: ESA/ESTEC 36 ////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////// 37 38 38 //....oooOO0OOooo........oooOO0OOooo........oo 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 39 //....oooOO0OOooo........oooOO0OOooo........oo 40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 40 41 41 #include "RMC01DetectorConstruction.hh" 42 #include "RMC01DetectorConstruction.hh" 42 << 43 #include "RMC01DetectorMessenger.hh" 43 #include "RMC01DetectorMessenger.hh" 44 #include "RMC01SD.hh" << 45 44 46 #include "G4Box.hh" << 47 #include "G4Colour.hh" << 48 #include "G4GeometryManager.hh" << 49 #include "G4LogicalVolume.hh" << 50 #include "G4LogicalVolumeStore.hh" << 51 #include "G4Material.hh" 45 #include "G4Material.hh" >> 46 #include "G4Box.hh" 52 #include "G4Orb.hh" 47 #include "G4Orb.hh" >> 48 #include "G4Tubs.hh" >> 49 #include "G4LogicalVolume.hh" 53 #include "G4PVPlacement.hh" 50 #include "G4PVPlacement.hh" 54 #include "G4PhysicalConstants.hh" << 51 #include "G4GeometryManager.hh" 55 #include "G4PhysicalVolumeStore.hh" 52 #include "G4PhysicalVolumeStore.hh" 56 #include "G4RunManager.hh" << 53 #include "G4LogicalVolumeStore.hh" 57 #include "G4SDManager.hh" << 58 #include "G4SolidStore.hh" 54 #include "G4SolidStore.hh" 59 #include "G4SystemOfUnits.hh" << 60 #include "G4Tubs.hh" << 61 #include "G4VisAttributes.hh" 55 #include "G4VisAttributes.hh" >> 56 #include "G4Colour.hh" >> 57 >> 58 #include "G4SDManager.hh" >> 59 #include "G4RunManager.hh" >> 60 #include "G4PhysicalConstants.hh" >> 61 #include "G4SystemOfUnits.hh" >> 62 #include "RMC01SD.hh" 62 63 63 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 64 65 65 RMC01DetectorConstruction::RMC01DetectorConstr 66 RMC01DetectorConstruction::RMC01DetectorConstruction() 66 : G4VUserDetectorConstruction(), << 67 : fShield_Thickness(5.*mm), 67 fDetectorMessenger(0), << 68 fSensitive_cylinder_H (1.*mm), 68 fShield_Thickness(5. * mm), << 69 fSensitive_cylinder_Rout (1.*mm) 69 fSensitive_cylinder_H(1. * mm), << 70 { 70 fSensitive_cylinder_Rout(1. * mm) << 71 fDetectorMessenger = new RMC01DetectorMessenger(this); 71 { << 72 fDetectorMessenger = new RMC01DetectorMessen << 73 } 72 } 74 73 75 //....oooOO0OOooo........oooOO0OOooo........oo 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 76 75 77 RMC01DetectorConstruction::~RMC01DetectorConst 76 RMC01DetectorConstruction::~RMC01DetectorConstruction() 78 { << 77 { delete fDetectorMessenger; 79 delete fDetectorMessenger; << 80 } 78 } 81 79 82 //....oooOO0OOooo........oooOO0OOooo........oo 80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 83 81 84 G4VPhysicalVolume* RMC01DetectorConstruction:: 82 G4VPhysicalVolume* RMC01DetectorConstruction::Construct() 85 { 83 { 86 DefineMaterials(); 84 DefineMaterials(); 87 return ConstructSimpleGeometry(); 85 return ConstructSimpleGeometry(); 88 } 86 } 89 87 90 //....oooOO0OOooo........oooOO0OOooo........oo 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 91 89 92 void RMC01DetectorConstruction::DefineMaterial 90 void RMC01DetectorConstruction::DefineMaterials() 93 { << 91 { 94 G4String symbol; // a=mass of a mole; << 92 95 G4double a, z, density; // z=mean number of << 93 G4String symbol; //a=mass of a mole; >> 94 G4double a, z, density; //z=mean number of protons; 96 G4double fractionmass; 95 G4double fractionmass; 97 G4int ncomponents; 96 G4int ncomponents; 98 << 97 99 // 98 // 100 // define Elements 99 // define Elements 101 // 100 // 102 << 101 103 G4Element* N = new G4Element("Nitrogen", sym << 102 G4Element* N = new G4Element("Nitrogen",symbol="N" , z= 7., a= 14.01*g/mole); 104 G4Element* O = new G4Element("Oxygen", symbo << 103 G4Element* O = new G4Element("Oxygen" ,symbol="O" , z= 8., a= 16.00*g/mole); 105 << 104 106 // 105 // 107 // define simple materials 106 // define simple materials 108 // 107 // 109 108 110 new G4Material("Aluminum", z = 13., a = 26.9 << 109 new G4Material("Aluminum", z=13., a=26.98*g/mole, density=2.700*g/cm3); 111 new G4Material("Silicon", z = 14., a = 28.09 << 110 new G4Material("Silicon", z=14., a=28.09*g/mole, density=2.33*g/cm3); 112 new G4Material("Tantalum", z = 73., a = 180. << 111 new G4Material("Tantalum", z=73., a=180.9479*g/mole, density=16.654*g/cm3); 113 112 114 // 113 // 115 // define air << 114 // define air 116 // 115 // 117 116 118 G4Material* Air = new G4Material("Air", dens << 117 G4Material* Air = new G4Material("Air" , density= 1.290*mg/cm3, ncomponents=2); 119 Air->AddElement(N, fractionmass = 0.7); << 118 Air->AddElement(N, fractionmass=0.7); 120 Air->AddElement(O, fractionmass = 0.3); << 119 Air->AddElement(O, fractionmass=0.3); 121 << 120 122 // 121 // 123 // Example of Vacuum << 122 //Example of Vacuum 124 // 123 // 125 124 126 new G4Material("Vacuum", z = 1., a = 1.01 * << 125 new G4Material("Vacuum", z=1., a=1.01*g/mole,density= universe_mean_density, 127 3.e-18 * pascal, 2.73 * kelvi << 126 kStateGas, 3.e-18*pascal, 2.73*kelvin); 128 } 127 } 129 128 130 //....oooOO0OOooo........oooOO0OOooo........oo 129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 131 130 132 G4VPhysicalVolume* RMC01DetectorConstruction:: 131 G4VPhysicalVolume* RMC01DetectorConstruction::ConstructSimpleGeometry() 133 { 132 { 134 // Clean old geometry, if any << 135 133 >> 134 // Clean old geometry, if any >> 135 136 G4GeometryManager::GetInstance()->OpenGeomet 136 G4GeometryManager::GetInstance()->OpenGeometry(); 137 G4PhysicalVolumeStore::GetInstance()->Clean( 137 G4PhysicalVolumeStore::GetInstance()->Clean(); 138 G4LogicalVolumeStore::GetInstance()->Clean() 138 G4LogicalVolumeStore::GetInstance()->Clean(); 139 G4SolidStore::GetInstance()->Clean(); 139 G4SolidStore::GetInstance()->Clean(); 140 140 141 // World 141 // World 142 //----------- 142 //----------- 143 << 143 144 G4Box* solidWorld = new G4Box("World", 15. * << 144 G4Box* solidWorld = new G4Box("World",15.*cm, 15.*cm, 15.*cm); 145 G4LogicalVolume* logicWorld = << 145 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, 146 new G4LogicalVolume(solidWorld, G4Material << 146 G4Material::GetMaterial("Vacuum"), 147 << 147 "World"); 148 G4VPhysicalVolume* physiWorld = new G4PVPlac << 148 149 << 149 G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, //no rotation 150 << 150 G4ThreeVector(), //at (0,0,0) 151 << 151 logicWorld, //its logical volume 152 << 152 "World", //its name 153 << 153 0, //its mother volume 154 << 154 false, //no boolean operation 155 << 155 0); 156 // Shielding Aluminum Sphere << 156 >> 157 //Shielding Aluminum Sphere 157 //------------------- 158 //------------------- 158 << 159 159 G4double radiusShieldingSphere = 10. * cm; << 160 G4double radiusShieldingSphere =10.*cm; 160 << 161 161 G4Orb* solidShieldingSphere = new G4Orb("Shi << 162 G4Orb* solidShieldingSphere=new G4Orb("Shielding", radiusShieldingSphere); 162 G4LogicalVolume* logicShieldingSphere = << 163 G4LogicalVolume* logicShieldingSphere= 163 new G4LogicalVolume(solidShieldingSphere, << 164 new G4LogicalVolume(solidShieldingSphere, 164 "Shielding"); // its << 165 G4Material::GetMaterial("Aluminum"), 165 << 166 "Shielding"); //its name; 166 new G4PVPlacement(0, // no rotation << 167 167 G4ThreeVector(), // at (0 << 168 new G4PVPlacement(0, //no rotation 168 logicShieldingSphere, // << 169 G4ThreeVector(), //at (0,0,0) 169 "Shielding", // its name << 170 logicShieldingSphere, //its logical volume 170 logicWorld, // its mother << 171 "Shielding", //its name 171 false, // no boolean oper << 172 logicWorld, //its mother volume 172 0); << 173 false, //no boolean operation 173 << 174 0); 174 // Bulk Sphere << 175 >> 176 //Bulk Sphere 175 //------------------- 177 //------------------- 176 << 178 177 G4Orb* solidBulkSphere = new G4Orb("Bulk", r << 179 G4Orb* solidBulkSphere=new G4Orb("Bulk", radiusShieldingSphere-fShield_Thickness); 178 G4LogicalVolume* logicBulkSphere = << 180 G4LogicalVolume* logicBulkSphere=new G4LogicalVolume(solidBulkSphere, //its solid 179 new G4LogicalVolume(solidBulkSphere, // i << 181 G4Material::GetMaterial("Air"),//its material 180 G4Material::GetMateria << 182 "Bulk"); //its name; 181 "Bulk"); // its name; << 183 182 << 184 new G4PVPlacement(0, //no rotation 183 new G4PVPlacement(0, // no rotation << 185 G4ThreeVector(), //at (0,0,0) 184 G4ThreeVector(), // at (0 << 186 logicBulkSphere, //its logical volume 185 logicBulkSphere, // its l << 187 "Bulk", //its name 186 "Bulk", // its name << 188 logicShieldingSphere, //its mother volume 187 logicShieldingSphere, // << 189 false, //no boolean operation 188 false, // no boolean oper << 190 0); 189 0); << 191 190 << 192 //Detecting cylinder 191 // Detecting cylinder << 192 //------------------- 193 //------------------- 193 << 194 194 G4Tubs* solidDetecting = new G4Tubs("Sensiti << 195 G4Tubs* solidDetecting=new G4Tubs("SensitiveVolume", 195 fSensiti << 196 0.,fSensitive_cylinder_Rout,fSensitive_cylinder_H/2., 196 << 197 0.,twopi); 197 G4LogicalVolume* logicDetectingCylinder = << 198 198 new G4LogicalVolume(solidDetecting, G4Mate << 199 G4LogicalVolume* logicDetectingCylinder=new G4LogicalVolume(solidDetecting, 199 << 200 G4Material::GetMaterial("Silicon"), 200 new G4PVPlacement(0, // no rotation << 201 "SensitiveVolume"); 201 G4ThreeVector(0., 0., 0.), << 202 202 logicDetectingCylinder, / << 203 new G4PVPlacement(0, //no rotation 203 "SensitiveVolume", // its << 204 G4ThreeVector(0.,0.,0.), //at (0,0,0) 204 logicBulkSphere, // its m << 205 logicDetectingCylinder, //its logical volume 205 false, // no boolean oper << 206 "SensitiveVolume", //its name 206 0); << 207 logicBulkSphere, //its mother volume 207 << 208 false, //no boolean operation 208 RMC01SD* theSensitiveDetector = new RMC01SD( << 209 0); 209 << 210 >> 211 >> 212 RMC01SD* theSensitiveDetector = new RMC01SD("/SensitiveCylinder"); >> 213 210 G4SDManager::GetSDMpointer()->AddNewDetector 214 G4SDManager::GetSDMpointer()->AddNewDetector(theSensitiveDetector); 211 logicDetectingCylinder->SetSensitiveDetector 215 logicDetectingCylinder->SetSensitiveDetector(theSensitiveDetector); 212 << 216 213 // Tantalum Plates on the top and beside << 217 //Tantalum Plates on the top and beside 214 //------------------------------------- 218 //------------------------------------- 215 G4Box* solidPlate = new G4Box("TantalumPlate << 219 G4Box* solidPlate=new G4Box("TantalumPlate",4.*cm,4.*cm,0.25*mm); 216 G4LogicalVolume* logicPlate = << 220 G4LogicalVolume* logicPlate=new G4LogicalVolume(solidPlate, //its solid 217 new G4LogicalVolume(solidPlate, // its so << 221 G4Material::GetMaterial("Tantalum"),//its material 218 G4Material::GetMateria << 222 "TantalumPlate"); //its name; 219 "TantalumPlate"); // << 223 220 << 224 221 new G4PVPlacement(0, // no rotation << 225 new G4PVPlacement(0, //no rotation 222 G4ThreeVector(0., 0., 6. * << 226 G4ThreeVector(0.,0.,6.*cm), //at (0,0,0) 223 logicPlate, // its logica << 227 logicPlate, //its logical volume 224 "TantalumPlate1", // its << 228 "TantalumPlate1", //its name 225 logicBulkSphere, // its m << 229 logicBulkSphere, //its mother volume 226 false, // no boolean oper << 230 false, //no boolean operation 227 0); << 231 0); 228 << 232 229 new G4PVPlacement(0, // no rotation << 233 new G4PVPlacement(0, //no rotation 230 G4ThreeVector(0., 0., -6. << 234 G4ThreeVector(0.,0.,-6.*cm), //at (0,0,0) 231 logicPlate, // its logica << 235 logicPlate, //its logical volume 232 "TantalumPlate2", // its << 236 "TantalumPlate2", //its name 233 logicBulkSphere, // its m << 237 logicBulkSphere, //its mother volume 234 false, // no boolean oper << 238 false, //no boolean operation 235 0); << 239 0); 236 << 240 237 return physiWorld; 241 return physiWorld; >> 242 238 } 243 } 239 244 240 //....oooOO0OOooo........oooOO0OOooo........oo 245 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 241 246 242 void RMC01DetectorConstruction::SetSensitiveVo 247 void RMC01DetectorConstruction::SetSensitiveVolumeRadius(G4double r) 243 { << 248 { fSensitive_cylinder_Rout=r; 244 fSensitive_cylinder_Rout = r; << 245 } 249 } 246 250 247 //....oooOO0OOooo........oooOO0OOooo........oo 251 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 248 252 249 void RMC01DetectorConstruction::SetSensitiveVo 253 void RMC01DetectorConstruction::SetSensitiveVolumeHeight(G4double h) 250 { << 254 { fSensitive_cylinder_H=h; 251 fSensitive_cylinder_H = h; << 252 } 255 } 253 256 254 //....oooOO0OOooo........oooOO0OOooo........oo 257 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 255 258 256 void RMC01DetectorConstruction::SetShieldingTh 259 void RMC01DetectorConstruction::SetShieldingThickness(G4double d) 257 { << 260 { fShield_Thickness=d; 258 fShield_Thickness = d; << 259 } 261 } 260 262 261 //....oooOO0OOooo........oooOO0OOooo........oo 263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 262 264