![]() |
|
|||
File indexing completed on 2025-02-23 09:21:47
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // This example is provided by the Geant4-DNA collaboration 0027 // Any report or published results obtained using the Geant4-DNA software 0028 // shall cite the following Geant4-DNA collaboration publication: 0029 // Med. Phys. 37 (2010) 4692-4708 0030 // J. Comput. Phys. 274 (2014) 841-882 0031 // The Geant4-DNA web site is available at http://geant4-dna.org 0032 // 0033 // 0034 /// \file DetectorConstruction.cc 0035 /// \brief Implementation of the DetectorConstruction class 0036 0037 #include "DetectorConstruction.hh" 0038 0039 #include "G4Box.hh" 0040 #include "G4LogicalVolume.hh" 0041 #include "G4Material.hh" 0042 #include "G4NistManager.hh" 0043 #include "G4PVPlacement.hh" 0044 #include "G4ProductionCuts.hh" 0045 #include "G4SystemOfUnits.hh" 0046 #include "G4UserLimits.hh" 0047 #include "G4VPhysicalVolume.hh" 0048 #include "G4VisAttributes.hh" 0049 0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0051 0052 DetectorConstruction::DetectorConstruction() : G4VUserDetectorConstruction() {} 0053 0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0055 0056 DetectorConstruction::~DetectorConstruction() {} 0057 0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0059 0060 G4VPhysicalVolume* DetectorConstruction::Construct() 0061 { 0062 return ConstructDetector(); 0063 } 0064 0065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0066 0067 G4Material* DetectorConstruction::OtherMaterial(G4String materialName) 0068 { 0069 G4Material* material(0); 0070 0071 // Water is defined from NIST material database 0072 G4NistManager* man = G4NistManager::Instance(); 0073 material = man->FindOrBuildMaterial(materialName); 0074 // If one wishes to test other density value for water material, 0075 // one should use instead: 0076 // G4Material * H2O = man->BuildMaterialWithNewDensity( 0077 // "G4_WATER_MODIFIED", 0078 // "G4_WATER",1000*g/cm/cm/cm); 0079 // Note: any string for "G4_WATER_MODIFIED" parameter is accepted 0080 // and "G4_WATER" parameter should not be changed 0081 // Both materials are created and can be selected from dna.mac 0082 0083 return material; 0084 } 0085 0086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0087 0088 G4VPhysicalVolume* DetectorConstruction::ConstructDetector() 0089 { 0090 G4Material* water = OtherMaterial("G4_WATER"); 0091 0092 // WORLD VOLUME 0093 0094 double worldSizeX = 2. * micrometer; 0095 double worldSizeY = worldSizeX; 0096 double worldSizeZ = worldSizeX; 0097 0098 G4Box* solidWorld = new G4Box("World", // its name 0099 worldSizeX / 2, worldSizeY / 2, worldSizeZ / 2); // its size 0100 0101 G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, // its solid 0102 water, // its material 0103 "World"); // its name 0104 0105 G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, // no rotation 0106 G4ThreeVector(), // at (0,0,0) 0107 "World", // its name 0108 logicWorld, // its logical volume 0109 0, // its mother volume 0110 false, // no boolean operation 0111 0); // copy number 0112 0113 // Visualization attributes 0114 G4VisAttributes* worldVisAtt = new G4VisAttributes(G4Colour(0.0, 0.4, 0.8, 0.5)); 0115 worldVisAtt->SetVisibility(true); 0116 logicWorld->SetVisAttributes(worldVisAtt); 0117 0118 return physiWorld; 0119 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |