Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-13 08:05: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 DetectorConstruction.cc
0027 /// \brief Implementation of the DetectorConstruction class
0028 
0029 // This example is provided by the Geant4-DNA collaboration
0030 // Any report or published results obtained using the Geant4-DNA software
0031 // shall cite the following Geant4-DNA collaboration publication:
0032 // Med. Phys. 37 (2010) 4692-4708
0033 // J. Comput. Phys. 274 (2014) 841-882
0034 // The Geant4-DNA web site is available at http://geant4-dna.org
0035 //
0036 //
0037 
0038 #include "DetectorConstruction.hh"
0039 
0040 #include "G4Box.hh"
0041 #include "G4LogicalVolume.hh"
0042 #include "G4Material.hh"
0043 #include "G4NistManager.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4ProductionCuts.hh"
0046 #include "G4SystemOfUnits.hh"
0047 #include "G4UserLimits.hh"
0048 #include "G4VPhysicalVolume.hh"
0049 #include "G4VisAttributes.hh"
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0052 
0053 DetectorConstruction::DetectorConstruction() : G4VUserDetectorConstruction() {}
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 DetectorConstruction::~DetectorConstruction() {}
0058 
0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0060 
0061 G4VPhysicalVolume* DetectorConstruction::Construct()
0062 {
0063   return ConstructDetector();
0064 }
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 
0068 G4Material* DetectorConstruction::OtherMaterial(G4String materialName)
0069 {
0070   G4Material* material(0);
0071 
0072   // Water is defined from NIST material database
0073   G4NistManager* man = G4NistManager::Instance();
0074   material = man->FindOrBuildMaterial(materialName);
0075   // If one wishes to test other density value for water material,
0076   // one should use instead:
0077   // G4Material * H2O = man->BuildMaterialWithNewDensity(
0078   // "G4_WATER_MODIFIED",
0079   // "G4_WATER",1000*g/cm/cm/cm);
0080   // Note: any string for "G4_WATER_MODIFIED" parameter is accepted
0081   // and "G4_WATER" parameter should not be changed
0082   // Both materials are created and can be selected from dna.mac
0083 
0084   return material;
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
0090 {
0091   G4Material* water = OtherMaterial("G4_WATER");
0092 
0093   // WORLD VOLUME
0094 
0095   double worldSizeX = 2. * micrometer;
0096   double worldSizeY = worldSizeX;
0097   double worldSizeZ = worldSizeX;
0098 
0099   G4Box* solidWorld = new G4Box("World",  // its name
0100                                 worldSizeX / 2, worldSizeY / 2, worldSizeZ / 2);  // its size
0101 
0102   G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld,  // its solid
0103                                                     water,  // its material
0104                                                     "World");  // its name
0105 
0106   G4VPhysicalVolume* physiWorld = new G4PVPlacement(0,  // no rotation
0107                                                     G4ThreeVector(),  // at (0,0,0)
0108                                                     "World",  // its name
0109                                                     logicWorld,  // its logical volume
0110                                                     0,  // its mother  volume
0111                                                     false,  // no boolean operation
0112                                                     0);  // copy number
0113 
0114   // Visualization attributes
0115   G4VisAttributes* worldVisAtt = new G4VisAttributes(G4Colour(0.0, 0.4, 0.8, 0.5));
0116   worldVisAtt->SetVisibility(true);
0117   logicWorld->SetVisAttributes(worldVisAtt);
0118 
0119   return physiWorld;
0120 }