Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21: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 // This example is provided by the Geant4-DNA collaboration
0027 // Any report or published results obtained using the Geant4-DNA software
0028 // shall cite the following Geant4-DNA collaboration publication:
0029 // Med. Phys. 37 (2010) 4692-4708
0030 // J. Comput. Phys. 274 (2014) 841-882
0031 // The Geant4-DNA web site is available at http://geant4-dna.org
0032 //
0033 //
0034 /// \file DetectorConstruction.cc
0035 /// \brief Implementation of the DetectorConstruction class
0036 
0037 #include "DetectorConstruction.hh"
0038 
0039 #include "G4LogicalVolume.hh"
0040 #include "G4Material.hh"
0041 #include "G4NistManager.hh"
0042 #include "G4Orb.hh"
0043 #include "G4PVPlacement.hh"
0044 #include "G4ProductionCuts.hh"
0045 #include "G4SystemOfUnits.hh"
0046 #include "G4UserLimits.hh"
0047 #include "G4VPhysicalVolume.hh"
0048 #include "G4VisAttributes.hh"
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0051 
0052 DetectorConstruction::DetectorConstruction() : G4VUserDetectorConstruction() {}
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 DetectorConstruction::~DetectorConstruction() {}
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 
0060 G4VPhysicalVolume* DetectorConstruction::Construct()
0061 
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 
0076   // If one wishes to test other density value for water material,
0077   // one should use instead:
0078   // G4Material * H2O =
0079   //  man->BuildMaterialWithNewDensity("G4_WATER_MODIFIED",
0080   //      "G4_WATER",
0081   //      1000*g/cm/cm/cm);
0082   // Note: any string for "G4_WATER_MODIFIED" parameter is accepted
0083   // and "G4_WATER" parameter should not be changed
0084 
0085   return material;
0086 }
0087 
0088 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0089 
0090 G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
0091 {
0092   G4Material* water = OtherMaterial("G4_WATER");
0093 
0094   // WORLD VOLUME = an G4ORB FULL OF LIQUID WATER
0095 
0096   double worldRadius = 0.3 * micrometer;
0097 
0098   G4Orb* solidWorld = new G4Orb("World", worldRadius);
0099 
0100   G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld,  // its solid
0101                                                     water,  // its material
0102                                                     "World");  // its name
0103 
0104   G4VPhysicalVolume* physiWorld = new G4PVPlacement(0,  // no rotation
0105                                                     G4ThreeVector(),  // at (0,0,0)
0106                                                     "World",  // its name
0107                                                     logicWorld,  // its logical volume
0108                                                     0,  // its mother  volume
0109                                                     false,  // no boolean operation
0110                                                     0);  // copy number
0111 
0112   // Visualization attributes = semitransparent navy blue
0113   G4VisAttributes* worldVisAtt = new G4VisAttributes(G4Colour(0.0, 0.4, 0.8, 0.5));
0114   worldVisAtt->SetForceSolid(true);
0115   worldVisAtt->SetVisibility(true);
0116   logicWorld->SetVisAttributes(worldVisAtt);
0117 
0118   return physiWorld;
0119 }