|
| 1 | +// |
| 2 | +// ******************************************************************** |
| 3 | +// * License and Disclaimer * |
| 4 | +// * * |
| 5 | +// * The Geant4 software is copyright of the Copyright Holders of * |
| 6 | +// * the Geant4 Collaboration. It is provided under the terms and * |
| 7 | +// * conditions of the Geant4 Software License, included in the file * |
| 8 | +// * LICENSE and available at http://cern.ch/geant4/license . These * |
| 9 | +// * include a list of copyright holders. * |
| 10 | +// * * |
| 11 | +// * Neither the authors of this software system, nor their employing * |
| 12 | +// * institutes,nor the agencies providing financial support for this * |
| 13 | +// * work make any representation or warranty, express or implied, * |
| 14 | +// * regarding this software system or assume any liability for its * |
| 15 | +// * use. Please see the license in the file LICENSE and URL above * |
| 16 | +// * for the full disclaimer and the limitation of liability. * |
| 17 | +// * * |
| 18 | +// * This code implementation is the result of the scientific and * |
| 19 | +// * technical work of the GEANT4 collaboration. * |
| 20 | +// * By using, copying, modifying or distributing the software (or * |
| 21 | +// * any work based on the software) you agree to acknowledge its * |
| 22 | +// * use in resulting scientific publications, and indicate your * |
| 23 | +// * acceptance of all terms of the Geant4 Software license. * |
| 24 | +// ******************************************************************** |
| 25 | +// |
| 26 | +// |
| 27 | +/// \file B1DetectorConstruction.cc |
| 28 | +/// \brief Implementation of the B1DetectorConstruction class |
| 29 | + |
| 30 | +#include "B1DetectorConstruction.hh" |
| 31 | + |
| 32 | +#include "G4MultiUnion.hh" |
| 33 | +#include "G4RunManager.hh" |
| 34 | +#include "G4NistManager.hh" |
| 35 | +#include "G4Box.hh" |
| 36 | +#include "G4Cons.hh" |
| 37 | +#include "G4Orb.hh" |
| 38 | +#include "G4Sphere.hh" |
| 39 | +#include "G4Trd.hh" |
| 40 | +#include "G4LogicalVolume.hh" |
| 41 | +#include "G4PVPlacement.hh" |
| 42 | +#include "G4SystemOfUnits.hh" |
| 43 | + |
| 44 | +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
| 45 | + |
| 46 | +B1DetectorConstruction::B1DetectorConstruction() |
| 47 | +: G4VUserDetectorConstruction(), |
| 48 | + fScoringVolume(0) |
| 49 | +{ } |
| 50 | + |
| 51 | +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
| 52 | + |
| 53 | +B1DetectorConstruction::~B1DetectorConstruction() |
| 54 | +{ } |
| 55 | + |
| 56 | +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
| 57 | + |
| 58 | +G4VPhysicalVolume* B1DetectorConstruction::Construct() |
| 59 | +{ |
| 60 | + // Get nist material manager |
| 61 | + G4NistManager* nist = G4NistManager::Instance(); |
| 62 | + |
| 63 | + // Envelope parameters |
| 64 | + // |
| 65 | + G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm; |
| 66 | + G4Material* env_mat = nist->FindOrBuildMaterial("G4_Galactic"); |
| 67 | + |
| 68 | + // Option to switch on/off checking of volumes overlaps |
| 69 | + // |
| 70 | + G4bool checkOverlaps = true; |
| 71 | + |
| 72 | + // |
| 73 | + // World |
| 74 | + // |
| 75 | + G4double world_sizeXY = 1.2*env_sizeXY; |
| 76 | + G4double world_sizeZ = 1.2*env_sizeZ; |
| 77 | + G4Material* world_mat = nist->FindOrBuildMaterial("G4_Galactic"); |
| 78 | + |
| 79 | + G4Box* solidWorld = |
| 80 | + new G4Box("World", //its name |
| 81 | + 0.5*world_sizeXY, 0.5*world_sizeXY, 0.5*world_sizeZ); //its size |
| 82 | + |
| 83 | + G4LogicalVolume* logicWorld = |
| 84 | + new G4LogicalVolume(solidWorld, //its solid |
| 85 | + world_mat, //its material |
| 86 | + "World"); //its name |
| 87 | + |
| 88 | + G4VPhysicalVolume* physWorld = |
| 89 | + new G4PVPlacement(0, //no rotation |
| 90 | + G4ThreeVector(), //at (0,0,0) |
| 91 | + logicWorld, //its logical volume |
| 92 | + "World", //its name |
| 93 | + 0, //its mother volume |
| 94 | + false, //no boolean operation |
| 95 | + 0, //copy number |
| 96 | + checkOverlaps); //overlaps checking |
| 97 | + |
| 98 | + // |
| 99 | + // Envelope |
| 100 | + // |
| 101 | + G4Box* solidEnv = |
| 102 | + new G4Box("Envelope", //its name |
| 103 | + 0.5*env_sizeXY, 0.5*env_sizeXY, 0.5*env_sizeZ); //its size |
| 104 | + |
| 105 | + G4LogicalVolume* logicEnv = |
| 106 | + new G4LogicalVolume(solidEnv, //its solid |
| 107 | + env_mat, //its material |
| 108 | + "Envelope"); //its name |
| 109 | + |
| 110 | + new G4PVPlacement(0, //no rotation |
| 111 | + G4ThreeVector(), //at (0,0,0) |
| 112 | + logicEnv, //its logical volume |
| 113 | + "Envelope", //its name |
| 114 | + logicWorld, //its mother volume |
| 115 | + false, //no boolean operation |
| 116 | + 0, //copy number |
| 117 | + checkOverlaps); //overlaps checking |
| 118 | + |
| 119 | + // |
| 120 | + //shape1 |
| 121 | + // |
| 122 | + G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_Pb"); |
| 123 | + G4ThreeVector pos1 = G4ThreeVector(0, 0, -10*cm); |
| 124 | + G4Box* box1 = new G4Box("Box1", 10.*cm, 10.*cm, 4.*um); |
| 125 | + |
| 126 | + G4LogicalVolume* logicShape1 = |
| 127 | + new G4LogicalVolume(box1, //its solid |
| 128 | + shape1_mat, //its material |
| 129 | + "Shape1"); //its name |
| 130 | + |
| 131 | + new G4PVPlacement(0, //no rotation |
| 132 | + pos1, //at position |
| 133 | + logicShape1, //its logical volume |
| 134 | + "Shape1", //its name |
| 135 | + logicEnv, //its mother volume |
| 136 | + false, //no boolean operation |
| 137 | + 0, //copy number |
| 138 | + checkOverlaps); //overlaps checking |
| 139 | + |
| 140 | + // Set munion_solid as scoring volume |
| 141 | + // |
| 142 | + fScoringVolume = logicShape1; |
| 143 | + |
| 144 | + // |
| 145 | + //always return the physical World |
| 146 | + // |
| 147 | + return physWorld; |
| 148 | +} |
| 149 | + |
| 150 | +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
0 commit comments