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 // 26 // 27 /// \file B1/src/DetectorConstruction.cc 27 /// \file B1/src/DetectorConstruction.cc 28 /// \brief Implementation of the B1::DetectorC 28 /// \brief Implementation of the B1::DetectorConstruction class 29 29 >> 30 #include <cmath> >> 31 30 #include "DetectorConstruction.hh" 32 #include "DetectorConstruction.hh" 31 33 >> 34 #include "G4RunManager.hh" >> 35 #include "G4NistManager.hh" 32 #include "G4Box.hh" 36 #include "G4Box.hh" >> 37 #include "G4Tubs.hh" >> 38 #include "G4SubtractionSolid.hh" 33 #include "G4LogicalVolume.hh" 39 #include "G4LogicalVolume.hh" 34 #include "G4NistManager.hh" << 35 #include "G4PVPlacement.hh" 40 #include "G4PVPlacement.hh" 36 #include "G4RunManager.hh" << 37 #include "G4SubtractionSolid.hh" << 38 #include "G4SystemOfUnits.hh" 41 #include "G4SystemOfUnits.hh" 39 #include "G4Tubs.hh" << 40 << 41 #include <cmath> << 42 42 43 namespace VtkVis 43 namespace VtkVis 44 { 44 { 45 45 46 //....oooOO0OOooo........oooOO0OOooo........oo 46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 47 48 G4VPhysicalVolume* DetectorConstruction::Const 48 G4VPhysicalVolume* DetectorConstruction::Construct() 49 { 49 { 50 // Get nist material manager 50 // Get nist material manager 51 G4NistManager* nist = G4NistManager::Instanc 51 G4NistManager* nist = G4NistManager::Instance(); 52 52 53 // Envelope parameters 53 // Envelope parameters 54 // 54 // 55 G4double env_sizeXY = 10 * m, env_sizeZ = 10 << 55 G4double env_sizeXY = 10*m, env_sizeZ = 10*m; 56 G4Material* env_mat = nist->FindOrBuildMater 56 G4Material* env_mat = nist->FindOrBuildMaterial("G4_Galactic"); 57 57 58 // Option to switch on/off checking of volum 58 // Option to switch on/off checking of volumes overlaps 59 // 59 // 60 G4bool checkOverlaps = true; 60 G4bool checkOverlaps = true; 61 61 62 // 62 // 63 // World 63 // World 64 // 64 // 65 G4double world_sizeXY = 1.2 * env_sizeXY; << 65 G4double world_sizeXY = 1.2*env_sizeXY; 66 G4double world_sizeZ = 1.2 * env_sizeZ; << 66 G4double world_sizeZ = 1.2*env_sizeZ; 67 G4Material* world_mat = nist->FindOrBuildMat 67 G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR"); 68 68 69 auto solidWorld = << 69 auto solidWorld = new G4Box("World", // its name 70 new G4Box("World", // its name << 70 0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ); // its size 71 0.5 * world_sizeXY, 0.5 * world_ << 72 71 73 auto logicWorld = new G4LogicalVolume(solidW 72 auto logicWorld = new G4LogicalVolume(solidWorld, // its solid 74 world_ << 73 world_mat, // its material 75 "World << 74 "World"); // its name 76 75 77 auto physWorld = new G4PVPlacement(nullptr, 76 auto physWorld = new G4PVPlacement(nullptr, // no rotation 78 G4ThreeVe << 77 G4ThreeVector(), // at (0,0,0) 79 logicWorl << 78 logicWorld, // its logical volume 80 "World", << 79 "World", // its name 81 nullptr, << 80 nullptr, // its mother volume 82 false, / << 81 false, // no boolean operation 83 0, // co << 82 0, // copy number 84 checkOver << 83 checkOverlaps); // overlaps checking 85 84 86 // 85 // 87 // Envelope 86 // Envelope 88 // 87 // 89 auto solidEnv = new G4Box("Envelope", // it << 88 auto solidEnv = new G4Box("Envelope", // its name 90 0.5 * env_sizeXY, << 89 0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ); // its size 91 90 92 auto logicEnv = new G4LogicalVolume(solidEnv 91 auto logicEnv = new G4LogicalVolume(solidEnv, // its solid 93 env_mat, << 92 env_mat, // its material 94 "Envelop << 93 "Envelope"); // its name 95 94 96 new G4PVPlacement(nullptr, // no rotation 95 new G4PVPlacement(nullptr, // no rotation 97 G4ThreeVector(), // at (0 << 96 G4ThreeVector(), // at (0,0,0) 98 logicEnv, // its logical << 97 logicEnv, // its logical volume 99 "Envelope", // its name << 98 "Envelope", // its name 100 logicWorld, // its mother << 99 logicWorld, // its mother volume 101 false, // no boolean oper << 100 false, // no boolean operation 102 0, // copy number << 101 0, // copy number 103 checkOverlaps); // overla << 102 checkOverlaps); // overlaps checking >> 103 104 104 105 auto dumpPos = G4ThreeVector(0, 0, 0); 105 auto dumpPos = G4ThreeVector(0, 0, 0); 106 auto dumpMat = nist->FindOrBuildMaterial("G4 106 auto dumpMat = nist->FindOrBuildMaterial("G4_CONCRETE"); 107 auto dumpShape1 = new G4Box("dumpShape1", 1 << 107 auto dumpShape1 = new G4Box("dumpShape1", 1*m, 1*m, 0.5*m); 108 108 109 auto dumpCutoutPos = G4ThreeVector(0, 0, -5. << 109 auto dumpCutoutPos = G4ThreeVector(0, 0, -5.1*cm); 110 auto dumpCutoutShape = new G4Tubs("DumpCutou << 110 auto dumpCutoutShape = new G4Tubs("DumpCutoutShape", 0*cm, 10*cm, 90/2*cm, 0, 2*M_PI); 111 111 112 auto dumpShape2 = << 112 auto dumpShape2 = new G4SubtractionSolid("dumpShape2",dumpShape1, dumpCutoutShape, 0, 113 new G4SubtractionSolid("dumpShape2", dumpS << 113 dumpCutoutPos); 114 114 115 auto dumpLogical = new G4LogicalVolume(dumpS 115 auto dumpLogical = new G4LogicalVolume(dumpShape2, 116 dumpM << 116 dumpMat, // its material 117 "dump 117 "dump"); 118 // its name 118 // its name 119 new G4PVPlacement(nullptr, // no rotation << 119 new G4PVPlacement(nullptr, // no rotation 120 dumpPos, // at position << 120 dumpPos, // at position 121 dumpLogical, // its logic << 121 dumpLogical, // its logical volume 122 "dump", // its name << 122 "dump", // its name 123 logicEnv, // its mother << 123 logicEnv, // its mother volume 124 false, // no boolean oper << 124 false, // no boolean operation 125 0, // copy number << 125 0, // copy number 126 checkOverlaps); // overla << 126 checkOverlaps); // overlaps checking >> 127 >> 128 127 129 128 fScoringVolume = dumpLogical; 130 fScoringVolume = dumpLogical; 129 131 130 // 132 // 131 // always return the physical World << 133 //always return the physical World 132 // 134 // 133 return physWorld; 135 return physWorld; 134 } 136 } 135 137 136 //....oooOO0OOooo........oooOO0OOooo........oo 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 137 139 138 } // namespace VtkVis << 140 } 139 141