Skip to content

Noah-Everett/DSPS-Detector

Repository files navigation

G4-DSPS-Detector-Sim

This repository contains a simulation of a detector system using the Geant4 and NEST toolkits. The simulation is designed to model the interaction of particles with a detector, and provides a framework for analyzing the results of these interactions with python scripts.

Installation From Source

To run the simulation, you need to have Geant4 and NEST installed on your system. Here are some useful links to get started:

Geant4:

NEST:

Your CMake command for Geant4 should look something like this where <> marks the variables you need to replace and [] marks optional variables:

$ cmake -S <Geant4SourceDirectory> \
        -B <Geant4BuildDirectory> \
       [-DCMAKE_INSTALL_PREFIX=<Geant4InstallDirectory>] \
        -DGEANT4_INSTALL_DATA=ON \
        -DGEANT4_USE_GDML=ON \
       [-DGEANT4_USE_OPENGL_X11=ON] \
       [-DGEANT4_USE_QT=ON] \
       [-DGEANT4_USE_OPENGL_X11=ON]

Likewise, your CMake command for NEST should look something like this:

$ cmake -S <NESTSourceDirectory> \
        -B <NESTBuildDirectory> \
       [-DCMAKE_INSTALL_PREFIX=<NESTInstallDirectory>] \
        -DG4=ON \
       [-DBUILD_ROOT=ON] \
       [-DGeant4_DIR=<Geant4InstallDir>/lib/cmake/Geant4]

Once you have everything installed, you can clone this repository and build the simulation with

$ cmake -S <DSPSSourceDirectory> \
        -B <DSPSBuildDirectory> \
       [-DGeant4_DIR=<Geant4InstallDirectory>/lib/cmake/Geant4] \
       [-DNEST_DIR=<NESTInstallDirectory>/lib/cmake/NEST]
$ cd <DSPSBuildDirectory>
$ make [-j<numberOfCPUs>]

Installation With Docker

You can also use Docker to run the simulation. This is useful if you do not want to install Geant4 and NEST on your system. There are pre-built Docker images available on Docker Hub at noaheverett/dsps. You can pull the image with:

$ docker pull noaheverett/dsps:<versionNumber>-<architecture (x86 or arm64)>

and run the image (make the container) with:

$ docker run -it \
            [--mount type=bind,src=<sourceDirector>,dst=<destinationDirectory>] \
            [--name <containerName>] \
             noaheverett/dsps:<versionNumber>-<architecture (x86 or arm64)>

The Docker images are built with the Geant4 and NEST toolkits installed. The simulation is located in the /DSPS directory. The image also contains GENIE and ROOT (along with all dependencies), which can be used to simulate neutrino interactions and analyze the results of the simulation, respectively.

Usage

To run the simulation, you can use the DSPS executable generated by the build process. The most basic way to run the simulation is with no arguments. This will initialize the simulation with default parameters from macros/parameters_* and open the visualization window:

$ ./DSPS

The simulation is controlled by a set of macro files that specify the parameters of the simulation. These macro files are located in the macros directory. You can run the simulation with a specific macro file by passing it as an argument to the DSPS executable:

$ ./DSPS <pathToMacroFile>.mac

For example, you can use event.mac as:

$ ./DSPS event.mac

The detector settings are specified in macros/parameters_detector.mac. You can specify a different detector configuration by editing this file or creating a new one and passing it to the DSPS executable with the -d flag:

$ ./DSPS -d <pathToDetectorMacroFile>.mac

Likewise, the simulation output settings are specified in macros/parameters_output.mac. You can specify a different output configuration by editing this file or creating a new one and passing it to the DSPS executable with the -o flag:

$ ./DSPS -o <pathToOutputMacroFile>.mac

Finally, the simulation Graphical User Interface (GUI) settings are specified in macros/parameters_gui.mac. You can specify a different GUI configuration by editing this file or creating a new one and passing it to the DSPS executable with the -g flag:

$ ./DSPS -g <pathToGUIMacroFile>.mac

Naming Convention

In the detector configuration (and in the simulation code), the following names are used:

  • PhotoSensor: The photosensors themselves, which are used to detect the light emitted by the particles and are placed on the sides of the detector.
  • Lens: The lens(es) that focuses the light onto the photosensors.
  • DSPS(s): The direction-sensitive photosensors (DSPSs) are the meta photodetector which can detect the direction of the incoming light. They contain both the photosensor and the lens.
  • Calorimeter: The walls that seperate adjacent DSPSs. I called calorimeter because they could, in theory, be augmented to measure the energy (or number of hits) of incident photons.

Contributing

Contributions are welcome. If you would like to contribute to this project, please fork the repository and submit a pull request. If you have any questions or suggestions, feel free to reach out to me at Noah.Everett at mines.sdsmt.edu or in the future at NEverett at g.harvard.edu.

Disclaimer

This project is a work in progress and is not yet complete. Everything was written by me, Noah Everett, so do not expect it to be perfect (or work at all 😊). If you have any questions or suggestions, feel free to reach out to me at Noah.Everett at mines.sdsmt.edu or in the future at NEverett at g.harvard.edu.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published