Back to home page

EIC code displayed by LXR

 
 

    


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

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 radiobiology/include/DetectorConstruction.hh
0027 /// \brief Definition of the RadioBio::DetectorConstruction class
0028 
0029 #ifndef RadiobiologyDetectorConstruction_h
0030 #define RadiobiologyDetectorConstruction_h 1
0031 
0032 #include "G4SystemOfUnits.hh"
0033 #include "G4ThreeVector.hh"
0034 #include "G4VUserDetectorConstruction.hh"
0035 #include "globals.hh"
0036 
0037 class G4LogicalVolume;
0038 class G4Material;
0039 
0040 namespace RadioBio
0041 {
0042 
0043 // Forward declariation of other radiobiology classes
0044 class DetectorMessenger;
0045 
0046 /**
0047  * @brief Mandatory class for the construction of geometry.
0048  *
0049  * This class is used to create the world volume and keep track of some
0050  * dimensions. World volume is the only one created and saved here,
0051  * whereas voxels and sensitiveness are accounted for by another
0052  * class.
0053  *
0054  * @note Different class will use some information to this class such
0055  * as geometrical constraints on the simulation world volume.
0056  *
0057  */
0058 
0059 class DetectorConstruction : public G4VUserDetectorConstruction
0060 {
0061   public:
0062     DetectorConstruction();
0063     ~DetectorConstruction();
0064 
0065   public:
0066     /** @brief Method overriding pure virtual
0067      * G4VUserDetectorConstruction one */
0068     G4VPhysicalVolume* Construct() override;
0069     /** @brief Method overriding pure virtual
0070      *  G4VUserDetectorConstruction one */
0071     void ConstructSDandField() override;
0072 
0073     // Set cubical world size
0074     /** @brief Method to set the world volume
0075      *  to be cubical with given side */
0076     void SetSize(G4double);
0077 
0078     // Set world size for non-cubic boxes
0079     /** @brief Method to set the world volume
0080      *  to be a box with given (potentially different) sides */
0081     void SetSize(G4ThreeVector);
0082     /** @brief Method to set the X width of the world volume
0083      *  @param x X width of the box */
0084     void SetSizeX(G4double x);
0085     /** @brief Method to set the Y width of the world volume
0086      *  @param y Y width of the box */
0087     void SetSizeY(G4double y);
0088     /** @brief Method to set the Z width of the world volume
0089      *  @param z Z width of the box */
0090     void SetSizeZ(G4double z);
0091 
0092     /** @brief Method to set the world material
0093      *
0094      * @note there will not be any different material throughout the
0095      * whole simulation
0096      *
0097      * @param mat string containing the name of the material
0098      * according to NIST database */
0099     void SetMaterial(G4String mat);
0100 
0101   public:
0102     /** @brief Returns a pointer to the world physical volume */
0103     const G4VPhysicalVolume* GetWorld() { return fPBox; }
0104 
0105     G4double GetSizeX() const { return fBoxSizeX; }
0106     G4double GetSizeY() const { return fBoxSizeY; }
0107     G4double GetSizeZ() const { return fBoxSizeZ; }
0108 
0109     /** @brief Returns a pointer to the world material */
0110     G4Material* GetMaterial() { return fMaterial; }
0111 
0112     /** @brief Prints on screen some parameters for this class */
0113     void PrintParameters();
0114 
0115   private:
0116     // World physical and logical
0117     G4VPhysicalVolume* fPBox = nullptr;
0118     G4LogicalVolume* fLBox = nullptr;
0119 
0120     // World box sizes
0121     G4double fBoxSizeX = 1. * m;
0122     G4double fBoxSizeY = 1. * m;
0123     G4double fBoxSizeZ = 1. * m;
0124 
0125     // World box material
0126     G4Material* fMaterial = nullptr;
0127 
0128     // Pointer to the messenger
0129     DetectorMessenger* fDetectorMessenger = nullptr;
0130 
0131   private:
0132     /** @brief Private method to construct geometry */
0133     G4VPhysicalVolume* ConstructVolumes();
0134 };
0135 
0136 }  // namespace RadioBio
0137 
0138 #endif  // DetectorConstruction_h