Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:48

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 //
0027 /// \file B1DetectorConstruction.cc
0028 /// \brief Implementation of the B1DetectorConstruction class
0029 
0030 #include "B1DetectorConstruction.hh"
0031 
0032 #include "G4Box.hh"
0033 #include "G4Cons.hh"
0034 #include "G4LogicalVolume.hh"
0035 #include "G4NistManager.hh"
0036 #include "G4Orb.hh"
0037 #include "G4PVPlacement.hh"
0038 #include "G4RunManager.hh"
0039 #include "G4Sphere.hh"
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4Trd.hh"
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 
0045 B1DetectorConstruction::B1DetectorConstruction() : G4VUserDetectorConstruction(), fScoringVolume(0)
0046 {}
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 B1DetectorConstruction::~B1DetectorConstruction() {}
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 
0054 G4VPhysicalVolume* B1DetectorConstruction::Construct()
0055 {
0056   // Get nist material manager
0057   G4NistManager* nist = G4NistManager::Instance();
0058 
0059   // Envelope parameters
0060   //
0061   G4double env_sizeXY = 20 * cm, env_sizeZ = 30 * cm;
0062   G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
0063 
0064   // Option to switch on/off checking of volumes overlaps
0065   //
0066   G4bool checkOverlaps = true;
0067 
0068   //
0069   // World
0070   //
0071   G4double world_sizeXY = 1.2 * env_sizeXY;
0072   G4double world_sizeZ = 1.2 * env_sizeZ;
0073   G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
0074 
0075   G4Box* solidWorld =
0076     new G4Box("World",  // its name
0077               0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ);  // its size
0078 
0079   G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld,  // its solid
0080                                                     world_mat,  // its material
0081                                                     "World");  // its name
0082 
0083   G4VPhysicalVolume* physWorld = new G4PVPlacement(0,  // no rotation
0084                                                    G4ThreeVector(),  // at (0,0,0)
0085                                                    logicWorld,  // its logical volume
0086                                                    "World",  // its name
0087                                                    0,  // its mother  volume
0088                                                    false,  // no boolean operation
0089                                                    0,  // copy number
0090                                                    checkOverlaps);  // overlaps checking
0091 
0092   //
0093   // Envelope
0094   //
0095   G4Box* solidEnv = new G4Box("Envelope",  // its name
0096                               0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ);  // its size
0097 
0098   G4LogicalVolume* logicEnv = new G4LogicalVolume(solidEnv,  // its solid
0099                                                   env_mat,  // its material
0100                                                   "Envelope");  // its name
0101 
0102   new G4PVPlacement(0,  // no rotation
0103                     G4ThreeVector(),  // at (0,0,0)
0104                     logicEnv,  // its logical volume
0105                     "Envelope",  // its name
0106                     logicWorld,  // its mother  volume
0107                     false,  // no boolean operation
0108                     0,  // copy number
0109                     checkOverlaps);  // overlaps checking
0110 
0111   //
0112   // Shape 1
0113   //
0114   G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE");
0115   G4ThreeVector pos1 = G4ThreeVector(0, 2 * cm, -7 * cm);
0116 
0117   // Conical section shape
0118   G4double shape1_rmina = 0. * cm, shape1_rmaxa = 2. * cm;
0119   G4double shape1_rminb = 0. * cm, shape1_rmaxb = 4. * cm;
0120   G4double shape1_hz = 3. * cm;
0121   G4double shape1_phimin = 0. * deg, shape1_phimax = 360. * deg;
0122   G4Cons* solidShape1 = new G4Cons("Shape1", shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb,
0123                                    shape1_hz, shape1_phimin, shape1_phimax);
0124 
0125   G4LogicalVolume* logicShape1 = new G4LogicalVolume(solidShape1,  // its solid
0126                                                      shape1_mat,  // its material
0127                                                      "Shape1");  // its name
0128 
0129   new G4PVPlacement(0,  // no rotation
0130                     pos1,  // at position
0131                     logicShape1,  // its logical volume
0132                     "Shape1",  // its name
0133                     logicEnv,  // its mother  volume
0134                     false,  // no boolean operation
0135                     0,  // copy number
0136                     checkOverlaps);  // overlaps checking
0137 
0138   //
0139   // Shape 2
0140   //
0141   G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
0142   G4ThreeVector pos2 = G4ThreeVector(0, -1 * cm, 7 * cm);
0143 
0144   // Trapezoid shape
0145   G4double shape2_dxa = 12 * cm, shape2_dxb = 12 * cm;
0146   G4double shape2_dya = 10 * cm, shape2_dyb = 16 * cm;
0147   G4double shape2_dz = 6 * cm;
0148   G4Trd* solidShape2 = new G4Trd("Shape2",  // its name
0149                                  0.5 * shape2_dxa, 0.5 * shape2_dxb, 0.5 * shape2_dya,
0150                                  0.5 * shape2_dyb, 0.5 * shape2_dz);  // its size
0151 
0152   G4LogicalVolume* logicShape2 = new G4LogicalVolume(solidShape2,  // its solid
0153                                                      shape2_mat,  // its material
0154                                                      "Shape2");  // its name
0155 
0156   new G4PVPlacement(0,  // no rotation
0157                     pos2,  // at position
0158                     logicShape2,  // its logical volume
0159                     "Shape2",  // its name
0160                     logicEnv,  // its mother  volume
0161                     false,  // no boolean operation
0162                     0,  // copy number
0163                     checkOverlaps);  // overlaps checking
0164 
0165   // Set Shape2 as scoring volume
0166   //
0167   fScoringVolume = logicShape2;
0168 
0169   //
0170   // always return the physical World
0171   //
0172   return physWorld;
0173 }
0174 
0175 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......