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 27 #include "eRositaDetectorConstruction.hh" 28 #include "eRositaTrackerSD.hh" 29 30 #include "G4Box.hh" 31 #include "G4Colour.hh" 32 #include "G4GeometryManager.hh" 33 #include "G4GeometryTolerance.hh" 34 #include "G4ios.hh" 35 #include "G4LogicalVolume.hh" 36 #include "G4Material.hh" 37 #include "G4PhysicalConstants.hh" 38 #include "G4PVParameterised.hh" 39 #include "G4PVPlacement.hh" 40 #include "G4SDManager.hh" 41 #include "G4SystemOfUnits.hh" 42 #include "G4UserLimits.hh" 43 #include "G4VisAttributes.hh" 44 45 //....oooOO0OOooo........oooOO0OOooo........oo 46 47 eRositaDetectorConstruction::eRositaDetectorCo 48 { 49 } 50 51 //....oooOO0OOooo........oooOO0OOooo........oo 52 53 eRositaDetectorConstruction::~eRositaDetectorC 54 { 55 } 56 57 //....oooOO0OOooo........oooOO0OOooo........oo 58 59 auto eRositaDetectorConstruction::Construct() 60 { 61 // ----------------------- 62 // - Material definition - 63 // ----------------------- 64 65 /* 66 // Nitrogen 67 constexpr auto NITROGEN_ATOMIC_NUMBER{7.}; 68 constexpr auto NITROGEN_MOLAR_MASS{14.01 * 69 70 auto *nitrogen = new G4Element("Nitrogen", 71 72 // Oxygen 73 constexpr auto OXYGEN_ATOMIC_NUMBER{8.}; 74 constexpr auto OXYGEN_MOLAR_MASS{16.00 * g 75 76 auto *oxygen = new G4Element("Oxygen", "O" 77 78 // Air 79 constexpr auto AIR_DENSITY{1.29 * mg / cm3 80 constexpr auto AIR_NUMBER_OF_ELEMENTS{2}; 81 constexpr auto NITROGEN_PERCENTAGE{70}; 82 constexpr auto OXYGEN_PERCENTAGE{30}; 83 84 auto *air = new G4Material("Air", AIR_DENS 85 air->AddElement(nitrogen, NITROGEN_PERCENT 86 air->AddElement(oxygen, OXYGEN_PERCENTAGE 87 */ 88 89 // Copper 90 constexpr auto COPPER_ATOMIC_NUMBER{29.}; 91 constexpr auto COPPER_DENSITY{8.92 * g / c 92 constexpr auto COPPER_MOLAR_MASS{63.55 * g 93 94 auto *copper = new G4Material("Copper", CO 95 96 // // Aluminium (for testing) 97 // constexpr auto COPPER_ATOMIC_NUMBER{13. 98 // constexpr auto COPPER_DENSITY{2.7 * g / 99 // constexpr auto COPPER_MOLAR_MASS{26.98 100 101 // auto *copper = new G4Material("Aluminiu 102 103 // Silicon 104 constexpr auto SILICON_ATOMIC_NUMBER{14.}; 105 constexpr auto SILICON_DENSITY{2.33 * g / 106 constexpr auto SILICON_MOLAR_MASS{28.09 * 107 108 auto *silicon = new G4Material("Silicon", 109 110 // Vacuum 111 112 constexpr auto VACUUM_ATOMIC_NUMBER{1}; 113 constexpr auto VACUUM_DENSITY{universe_mea 114 constexpr auto VACUUM_MOLAR_MASS{1.01 * g 115 constexpr auto VACUUM_PRESSURE{3.e-18 * pa 116 constexpr auto VACUUM_TEMPERATURE{2.73 * k 117 118 vacuum = new G4Material("Galactic", VACUUM 119 120 // Print all the materials defined. 121 G4cout << G4endl << "The materials defined 122 G4cout << *(G4Material::GetMaterialTable() 123 124 // --------- Sizes of the principal geomet 125 126 // world volume 127 constexpr auto WORLD_HALF_LENGTH{50.0 * mm 128 129 worldHalfLength = WORLD_HALF_LENGTH; 130 131 // target: 0.5 cm * 0.5 cm * 3 cm 132 constexpr auto TARGET_HALF_LENGTH{2.5 * mm 133 constexpr auto TARGET_HALF_DEPTH{15.0 * mm 134 135 targetHalfLength = TARGET_HALF_LENGTH; 136 targetHalfDepth = TARGET_HALF_DEPTH; 137 138 // tracker (CCD): 4 cm * 450 mu_m * 4 cm 139 constexpr auto TRACKER_HALF_LENGTH{20.0 * 140 constexpr auto TRACKER_HALF_DEPTH{0.225 * 141 142 trackerHalfLength = TRACKER_HALF_LENGTH; 143 trackerHalfDepth = TRACKER_HALF_DEPTH; 144 145 //--------- positions of the principal geo 146 147 // target position: (0 cm, 0 cm, 0 cm) 148 constexpr auto TARGET_INITIAL_POSITION_X{0 149 constexpr auto TARGET_INITIAL_POSITION_Y{0 150 constexpr auto TARGET_INITIAL_POSITION_Z{0 151 152 targetPositionX = TARGET_INITIAL_POSITION_ 153 targetPositionY = TARGET_INITIAL_POSITION_ 154 targetPositionZ = TARGET_INITIAL_POSITION_ 155 156 // tracker position: (0 cm, 2 cm, 0 cm) 157 constexpr auto TRACKER_INITIAL_POSITION_X{ 158 constexpr auto TRACKER_INITIAL_POSITION_Y{ 159 constexpr auto TRACKER_INITIAL_POSITION_Z{ 160 161 trackerPositionX = TRACKER_INITIAL_POSITIO 162 trackerPositionY = TRACKER_INITIAL_POSITIO 163 trackerPositionZ = TRACKER_INITIAL_POSITIO 164 165 // ------------ 166 // - Material - 167 // ------------ 168 169 // worldMaterial = air; 170 worldMaterial = vacuum; 171 targetMaterial = copper; 172 trackerMaterial = silicon; 173 174 //--------- Definitions of Solids, Logical 175 176 // --------- 177 // - World - 178 // --------- 179 180 worldSolid = new G4Box("world", worldHalfL 181 worldLogicalVolume = new G4LogicalVolume(w 182 183 // Place the world physical volume unrotat 184 worldPhysicalVolume = new G4PVPlacement(nu 185 G4ThreeVector(), // at (0, 0, 0) 186 worldLogicalVolume, // its logical vol 187 "World", // its name 188 nullptr, // its mother volume 189 false, // no boolean operations 190 0); // copy number 191 192 // ---------- 193 // - Target - 194 // ---------- 195 196 auto targetPosition = G4ThreeVector(target 197 198 targetSolid = new G4Box("target", targetHa 199 targetLogicalVolume = new G4LogicalVolume( 200 targetPhysicalVolume = new G4PVPlacement(n 201 targetPosition, // at (x, y, z) 202 targetLogicalVolume, // its logical vo 203 "Target", // its name 204 worldLogicalVolume, // its mother volu 205 false, // no boolean operations 206 0); // copy number 207 208 // ----------- 209 // - Tracker - 210 // ----------- 211 212 auto trackerPosition = G4ThreeVector(track 213 214 trackerSolid = new G4Box("tracker", tracke 215 trackerLogicalVolume = new G4LogicalVolume 216 trackerPhysicalVolume = new G4PVPlacement( 217 trackerPosition, // at (x, y, z) 218 trackerLogicalVolume, // its logical v 219 "Tracker", // its name 220 worldLogicalVolume, // its mother volu 221 false, // no boolean operations 222 0); // copy number 223 224 //----------------------- 225 // - Sensitive detector - 226 //----------------------- 227 228 constexpr auto TRACKER_SENSITIVE_DETECTOR_ 229 auto *trackerSensitiveDetector = new eRosi 230 trackerLogicalVolume->SetSensitiveDetector 231 232 //------------------ 233 // - Visualization - 234 //------------------ 235 236 // make world volume invisible 237 worldVisualizationStyle = new G4VisAttribu 238 worldVisualizationStyle->SetVisibility(fal 239 worldLogicalVolume->SetVisAttributes(world 240 241 // render the target in reddish color 242 targetVisualizationStyle = new G4VisAttrib 243 // targetVisualizationStyle->SetColor(G4Co 244 targetVisualizationStyle->SetColor(G4Color 245 targetLogicalVolume->SetVisAttributes(targ 246 247 // render the tracker in blueish color 248 trackerVisualizationStyle = new G4VisAttri 249 // trackerVisualizationStyle->SetColor(G4C 250 trackerVisualizationStyle->SetColor(G4Colo 251 trackerLogicalVolume->SetVisAttributes(tra 252 253 return worldPhysicalVolume; 254 } 255 256 //....oooOO0OOooo........oooOO0OOooo........oo 257 258 void eRositaDetectorConstruction::ConstructSDa 259 { 260 G4SDManager::GetSDMpointer()->SetVerboseLe 261 auto *sensitiveDetectorManager = G4SDManag 262 263 constexpr auto TRACKER_SENSITIVE_DETECTOR_ 264 auto *trackerSensitiveDetector = new eRosi 265 sensitiveDetectorManager->AddNewDetector(t 266 trackerLogicalVolume->SetSensitiveDetector 267 } 268 269 //....oooOO0OOooo........oooOO0OOooo........oo 270 271 /* 272 void eRositaDetectorConstruction::SetTargetMat 273 { 274 // search the material by name 275 auto *material = G4Material::GetMaterial(m 276 if (material != nullptr) { 277 targetMaterial = material; 278 targetLogicalVolume->SetMaterial(mater 279 G4cout << "\n----> The target is " << 280 } 281 } 282 */ 283