Back to home page

EIC code displayed by LXR

 
 

    


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

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 /// \file MoviesDetectorConstruction.cc
0027 /// \brief Implementation of the MoviesDetectorConstruction class
0028 //
0029 
0030 #include "MoviesDetectorConstruction.hh"
0031 
0032 #include "G4Box.hh"
0033 #include "G4LogicalVolume.hh"
0034 #include "G4Material.hh"
0035 #include "G4NistManager.hh"
0036 #include "G4PVPlacement.hh"
0037 #include "G4PVReplica.hh"
0038 #include "G4PhysicalConstants.hh"
0039 #include "G4SystemOfUnits.hh"
0040 #include "G4VisAttributes.hh"
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 G4VPhysicalVolume* MoviesDetectorConstruction::Construct()
0045 {
0046   // Define materials
0047   DefineMaterials();
0048 
0049   // Define volumes
0050   return DefineVolumes();
0051 }
0052 
0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0054 
0055 void MoviesDetectorConstruction::DefineMaterials()
0056 {
0057   auto nistManager = G4NistManager::Instance();
0058 
0059   // Lead material defined using NIST Manager
0060   nistManager->FindOrBuildMaterial("G4_Pb");
0061 
0062   // Liquid argon material
0063   G4double a;  // mass of a mole;
0064   G4double z;  // z=mean number of protons;
0065   G4double density;
0066   new G4Material("liquidArgon", z = 18., a = 39.95 * g / mole, density = 1.390 * g / cm3);
0067   // The argon by NIST Manager is a gas with a different density
0068 
0069   // Vacuum
0070   nistManager->FindOrBuildMaterial("G4_Galactic");
0071 
0072   // Print materials
0073   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
0074 }
0075 
0076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0077 
0078 G4VPhysicalVolume* MoviesDetectorConstruction::DefineVolumes()
0079 {
0080   // Geometry parameters
0081   const G4bool checkOverlaps = true;
0082 
0083   // A generous world
0084   const G4double worldSizeXY = 1. * m;
0085   const G4double worldSizeZ = 1. * m;
0086 
0087   // Lead-argon calorimeter
0088   G4int nofLayers = 10;
0089   G4double absoThickness = 10. * mm;
0090   G4double gapThickness = 5. * mm;
0091   G4double calorSizeXY = 10. * cm;
0092 
0093   auto layerThickness = absoThickness + gapThickness;
0094   auto calorThickness = nofLayers * layerThickness;
0095 
0096   // Get materials
0097   auto defaultMaterial = G4Material::GetMaterial("G4_Galactic");
0098   auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
0099   auto gapMaterial = G4Material::GetMaterial("liquidArgon");
0100 
0101   // World
0102   auto worldS = new G4Box("World", worldSizeXY / 2, worldSizeXY / 2, worldSizeZ / 2);
0103 
0104   auto worldLV = new G4LogicalVolume(worldS,  // its solid
0105                                      defaultMaterial,  // its material
0106                                      "World");  // its name
0107 
0108   auto worldPV = new G4PVPlacement(0,  // no rotation
0109                                    G4ThreeVector(),  // at (0,0,0)
0110                                    worldLV,  // its logical volume
0111                                    "World",  // its name
0112                                    0,  // its mother  volume
0113                                    false,  // no boolean operation
0114                                    0,  // copy number
0115                                    checkOverlaps);  // checking overlaps
0116 
0117   // Calorimeter
0118 
0119   auto calorimeterS =
0120     new G4Box("Calorimeter", calorSizeXY / 2, calorSizeXY / 2, calorThickness / 2);
0121 
0122   auto calorLV = new G4LogicalVolume(calorimeterS,  // its solid
0123                                      defaultMaterial,  // its material
0124                                      "Calorimeter");  // its name
0125 
0126   new G4PVPlacement(0,  // no rotation
0127                     G4ThreeVector(),  // at (0,0,0)
0128                     calorLV,  // its logical volume
0129                     "Calorimeter",  // its name
0130                     worldLV,  // its mother  volume
0131                     false,  // no boolean operation
0132                     0,  // copy number
0133                     checkOverlaps);  // checking overlaps
0134 
0135   // Layer
0136 
0137   auto layerS = new G4Box("Layer",  // its name
0138                           calorSizeXY / 2, calorSizeXY / 2, layerThickness / 2);  // its size
0139 
0140   auto layerLV = new G4LogicalVolume(layerS,  // its solid
0141                                      defaultMaterial,  // its material
0142                                      "Layer");  // its name
0143 
0144   new G4PVReplica("Layer",  // its name
0145                   layerLV,  // its logical volume
0146                   calorLV,  // its mother
0147                   kZAxis,  // axis of replication
0148                   nofLayers,  // number of replica
0149                   layerThickness);  // witdth of replica
0150 
0151   // Absorber
0152 
0153   auto absorberS = new G4Box("Abso",  // its name
0154                              calorSizeXY / 2, calorSizeXY / 2, absoThickness / 2);  // its size
0155 
0156   auto absorberLV = new G4LogicalVolume(absorberS,  // its solid
0157                                         absorberMaterial,  // its material
0158                                         "Abso");  // its name
0159 
0160   new G4PVPlacement(0,  // no rotation
0161                     G4ThreeVector(0., 0., -gapThickness / 2),  // its position
0162                     absorberLV,  // its logical volume
0163                     "Abso",  // its name
0164                     layerLV,  // its mother  volume
0165                     false,  // no boolean operation
0166                     0,  // copy number
0167                     checkOverlaps);  // checking overlaps
0168 
0169   // Gap
0170 
0171   auto gapS = new G4Box("Gap",  // its name
0172                         calorSizeXY / 2, calorSizeXY / 2, gapThickness / 2);  // its size
0173 
0174   auto gapLV = new G4LogicalVolume(gapS,  // its solid
0175                                    gapMaterial,  // its material
0176                                    "Gap");  // its name
0177 
0178   new G4PVPlacement(0,  // no rotation
0179                     G4ThreeVector(0., 0., absoThickness / 2),  // its position
0180                     gapLV,  // its logical volume
0181                     "Gap",  // its name
0182                     layerLV,  // its mother  volume
0183                     false,  // no boolean operation
0184                     0,  // copy number
0185                     checkOverlaps);  // checking overlaps
0186 
0187   // Visualization attributes
0188   worldLV->SetVisAttributes(G4VisAttributes::GetInvisible());
0189 
0190   return worldPV;
0191 }