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 B1/src/DetectorConstruction.cc
0028 /// \brief Implementation of the B1::DetectorConstruction class
0029 
0030 #include "DetectorConstruction.hh"
0031 
0032 #include "G4Box.hh"
0033 #include "G4LogicalVolume.hh"
0034 #include "G4NistManager.hh"
0035 #include "G4PVPlacement.hh"
0036 #include "G4RunManager.hh"
0037 #include "G4SubtractionSolid.hh"
0038 #include "G4SystemOfUnits.hh"
0039 #include "G4Tubs.hh"
0040 
0041 #include <cmath>
0042 
0043 namespace VtkVis
0044 {
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 G4VPhysicalVolume* DetectorConstruction::Construct()
0049 {
0050   // Get nist material manager
0051   G4NistManager* nist = G4NistManager::Instance();
0052 
0053   // Envelope parameters
0054   //
0055   G4double env_sizeXY = 10 * m, env_sizeZ = 10 * m;
0056   G4Material* env_mat = nist->FindOrBuildMaterial("G4_Galactic");
0057 
0058   // Option to switch on/off checking of volumes overlaps
0059   //
0060   G4bool checkOverlaps = true;
0061 
0062   //
0063   // World
0064   //
0065   G4double world_sizeXY = 1.2 * env_sizeXY;
0066   G4double world_sizeZ = 1.2 * env_sizeZ;
0067   G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
0068 
0069   auto solidWorld =
0070     new G4Box("World",  // its name
0071               0.5 * world_sizeXY, 0.5 * world_sizeXY, 0.5 * world_sizeZ);  // its size
0072 
0073   auto logicWorld = new G4LogicalVolume(solidWorld,  // its solid
0074                                         world_mat,  // its material
0075                                         "World");  // its name
0076 
0077   auto physWorld = new G4PVPlacement(nullptr,  // no rotation
0078                                      G4ThreeVector(),  // at (0,0,0)
0079                                      logicWorld,  // its logical volume
0080                                      "World",  // its name
0081                                      nullptr,  // its mother  volume
0082                                      false,  // no boolean operation
0083                                      0,  // copy number
0084                                      checkOverlaps);  // overlaps checking
0085 
0086   //
0087   // Envelope
0088   //
0089   auto solidEnv = new G4Box("Envelope",  // its name
0090                             0.5 * env_sizeXY, 0.5 * env_sizeXY, 0.5 * env_sizeZ);  // its size
0091 
0092   auto logicEnv = new G4LogicalVolume(solidEnv,  // its solid
0093                                       env_mat,  // its material
0094                                       "Envelope");  // its name
0095 
0096   new G4PVPlacement(nullptr,  // no rotation
0097                     G4ThreeVector(),  // at (0,0,0)
0098                     logicEnv,  // its logical volume
0099                     "Envelope",  // its name
0100                     logicWorld,  // its mother  volume
0101                     false,  // no boolean operation
0102                     0,  // copy number
0103                     checkOverlaps);  // overlaps checking
0104 
0105   auto dumpPos = G4ThreeVector(0, 0, 0);
0106   auto dumpMat = nist->FindOrBuildMaterial("G4_CONCRETE");
0107   auto dumpShape1 = new G4Box("dumpShape1", 1 * m, 1 * m, 0.5 * m);
0108 
0109   auto dumpCutoutPos = G4ThreeVector(0, 0, -5.1 * cm);
0110   auto dumpCutoutShape = new G4Tubs("DumpCutoutShape", 0 * cm, 10 * cm, 90 / 2 * cm, 0, 2 * M_PI);
0111 
0112   auto dumpShape2 =
0113     new G4SubtractionSolid("dumpShape2", dumpShape1, dumpCutoutShape, 0, dumpCutoutPos);
0114 
0115   auto dumpLogical = new G4LogicalVolume(dumpShape2,
0116                                          dumpMat,  // its material
0117                                          "dump");
0118   // its name
0119   new G4PVPlacement(nullptr,  // no rotation
0120                     dumpPos,  // at position
0121                     dumpLogical,  // its logical volume
0122                     "dump",  // its name
0123                     logicEnv,  // its mother  volume
0124                     false,  // no boolean operation
0125                     0,  // copy number
0126                     checkOverlaps);  // overlaps checking
0127 
0128   fScoringVolume = dumpLogical;
0129 
0130   //
0131   // always return the physical World
0132   //
0133   return physWorld;
0134 }
0135 
0136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0137 
0138 }  // namespace VtkVis