Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // This example is provided by the Geant4-DNA 27 // Any report or published results obtained us 28 // shall cite the following Geant4-DNA collabo 29 // Med. Phys. 37 (2010) 4692-4708 30 // J. Comput. Phys. 274 (2014) 841-882 31 // The Geant4-DNA web site is available at htt 32 // 33 // 34 /// \file DetectorConstruction.cc 35 /// \brief Implementation of the DetectorConst 36 37 #include "DetectorConstruction.hh" 38 39 #include "DetectorMessenger.hh" 40 41 #include "G4ProductionCuts.hh" 42 #include "G4RunManager.hh" 43 #include "G4SystemOfUnits.hh" 44 45 //....oooOO0OOooo........oooOO0OOooo........oo 46 47 DetectorConstruction::DetectorConstruction() : 48 { 49 // create commands for interactive definitio 50 fDetectorMessenger = new DetectorMessenger(t 51 } 52 53 //....oooOO0OOooo........oooOO0OOooo........oo 54 55 DetectorConstruction::~DetectorConstruction() 56 { 57 delete fDetectorMessenger; 58 } 59 60 //....oooOO0OOooo........oooOO0OOooo........oo 61 62 G4VPhysicalVolume* DetectorConstruction::Const 63 64 { 65 DefineMaterials(); 66 return ConstructDetector(); 67 } 68 69 //....oooOO0OOooo........oooOO0OOooo........oo 70 71 void DetectorConstruction::DefineMaterials() 72 { 73 // Water is defined from NIST material datab 74 G4NistManager* man = G4NistManager::Instance 75 G4Material* H2O = man->FindOrBuildMaterial(" 76 77 // Default materials in setup. 78 fpWaterMaterial = H2O; 79 80 // needed variables 81 82 G4double z, a, density; 83 G4String name, symbol; 84 G4int nComponents, nAtoms; 85 86 a = 12.0107 * g / mole; 87 G4Element* elC = new G4Element(name = "Carbo 88 89 a = 1.00794 * g / mole; 90 G4Element* elH = new G4Element(name = "Hydro 91 92 a = 15.9994 * g / mole; 93 G4Element* elO = new G4Element(name = "Oxyge 94 95 a = 14.0067 * g / mole; 96 G4Element* elN = new G4Element(name = "Nitro 97 98 // Definition of Tetrahydrofurane (THF) 99 100 density = 1.346 * g / cm3; 101 102 fpTHFMaterial = new G4Material("THF", densit 103 fpTHFMaterial->AddElement(elC, nAtoms = 4); 104 fpTHFMaterial->AddElement(elH, nAtoms = 8); 105 fpTHFMaterial->AddElement(elO, nAtoms = 1); 106 107 // Definition of Nitrogen in nanodosimetry e 108 109 density = 0.34e-6 * g / cm3; 110 111 fpN2Material = new G4Material("N2", density, 112 fpN2Material->AddElement(elN, nAtoms = 2); 113 } 114 115 //....oooOO0OOooo........oooOO0OOooo........oo 116 117 G4VPhysicalVolume* DetectorConstruction::Const 118 { 119 G4double diameter; 120 G4double highz; 121 G4Material* targetMaterial; 122 G4Material* worldMaterial; 123 124 if (fGeomType == "dna") { 125 // nanometric geometry 126 fWorldSize = 20. * nm; 127 diameter = 2.3 * nm; 128 highz = 3.4 * nm; 129 targetMaterial = fpTHFMaterial; 130 worldMaterial = fpWaterMaterial; 131 } 132 else { 133 // macrometric geometry (experimental targ 134 fWorldSize = 2 * cm; 135 diameter = 1 * cm; 136 highz = 1 * cm; 137 ; 138 targetMaterial = fpN2Material; 139 worldMaterial = fpN2Material; 140 } 141 142 fpSolidWorld = new G4Box("World", // its na 143 fWorldSize / 2, fWo 144 145 fpLogicWorld = new G4LogicalVolume(fpSolidWo 146 worldMate 147 "World"); 148 149 fpPhysiWorld = new G4PVPlacement(0, // no r 150 G4ThreeVect 151 "World", / 152 fpLogicWorl 153 0, // its 154 false, // 155 0); // cop 156 157 G4Tubs* solidTarget = 158 new G4Tubs("Target", 0, diameter / 2., hig 159 160 G4LogicalVolume* logicTarget = new G4Logical 161 162 163 164 new G4PVPlacement(0, // no rotation 165 G4ThreeVector(), // at (0 166 "Target", // its name 167 logicTarget, // its logic 168 fpPhysiWorld, // its moth 169 false, // no boolean oper 170 0); // copy number 171 172 // Visualization attributes 173 G4VisAttributes* worldVisAtt = new G4VisAttr 174 worldVisAtt->SetVisibility(true); 175 fpLogicWorld->SetVisAttributes(worldVisAtt); 176 177 G4VisAttributes* worldVisAtt1 = new G4VisAtt 178 worldVisAtt1->SetVisibility(true); 179 logicTarget->SetVisAttributes(worldVisAtt1); 180 181 return fpPhysiWorld; 182 } 183 184 //....oooOO0OOooo........oooOO0OOooo........oo 185 186 void DetectorConstruction::SetGeometry(const G 187 { 188 fGeomType = name; 189 190 // tell RunManager about changes 191 G4RunManager::GetRunManager()->GeometryHasBe 192 } 193