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