GithubHelp home page GithubHelp logo

shangjiaxuan / garfieldpp Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 73.46 MB

My attempt to run and debug garfield++ on windows with visual studio

CMake 0.28% Shell 0.01% C++ 43.01% C 9.24% Fortran 47.37% Python 0.10%

garfieldpp's Introduction

Garfield++

Garfield++ is a toolkit for the detailed simulation of detectors which use gases or semi-conductors as sensitive medium. The main area of application is currently in micropattern gaseous detectors.

Garfield++ shares functionality with Garfield. The main differences are the more up-to-date treatment of electron transport in gases and the user interface, which is derived from ROOT.

More...

Building the project

For simplicity, we define an environment variable $GARFIELD_HOME pointing to the directory to which we cloned the repository. Assuming that $GARFIELD_HOME is your current working directory, you can build and install Garfield++ as follows:

mkdir build
cd build
cmake [-DCMAKE_INSTALL_PREFIX=<installdir>] [-DWITH_DOCS=ON] [-DWITH_EXAMPLES=ON] <path to sources>
make -j<number of cores on your machine>
make install

If CMAKE_INSTALL_PREFIX is not provided in the configuration command, $GARFIELD_HOME/install will be used as installation prefix. The WITH_DOCS variable is optional, and should be passed if you wish to build the Doxygen based API documentation. Please note that this requires an existing installation of Doxygen. If CMake cannot locate Doxygen, its install location should be added into CMAKE_PREFIX_PATH. For further details please have a look at the CMake tutorial.

Building the documentation

The documentation of the project is based on doxygen. To build the documentation, the project must have been configured with Garfield_BUILD_DOCS enabled, as described earlier. It can then be built and installed:

make doc
make install

By default, this installs the documentation into <installdir>/share/doc/HSFTEMPLATE/share/doc.

Running the examples

You can run the examples from the build directory (if WITH_EXAMPLES has been turned on) but you need to setup a running environment defining some variables, in particular for the HEED database.

In the following lines we use the Gem example (assuming that the build folder is our current working directory):

source setupGarfield.sh
cd Examples/Gem
./gem

Building and running examples using an installed version of Garfield

Make sure that all required environment variables are set by sourcing the script setupGarfield.sh:

source $GARFIELD_HOME/install/share/Garfield/setupGarfield.sh

To get started, it can be useful to copy one of the examples to a local directory, modify it, build it against an installed version of Garfield and run it.

cp -r $GARFIELD_HOME/Examples/Gem .
mkdir Gem/build; cd Gem/build
cmake ..
make
./gem

Inclusion into other projects

If you want to build your own project against Garfield, CMake may be the best option for you. Just add its location to CMAKE_PREFIX_PATH and call find_package(Garfield) within your CMakeLists.txt.

cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
project(test)

if(NOT TARGET Garfield::Garfield)
  find_package(Garfield REQUIRED)
endif()

add_executable(test test.C)
target_link_libraries(test Garfield::Garfield)

About Windows Build:

Currently only tested 64 bit with cmake visual studio msvc + ifort (from Intel oneAPI HPC Toolkit, need registering and EULA to download) and msvc + gfortran (mingw binaries), using root from public release binary, and self-compiled geant4 with Qt 5.15 and GDML (xerces-c installed with vcpkg).

The compiled Garfield++ library have root generated header paths that loads on start, thus source directory needs to be constant, and cannot make portable install binary. Dependency binaries can be found in the releases section (excluding Garfield.dll).

Since the library requires large memory resources, 64 bit compilation is required. Running GEM example uses 2.1GB on typical machine: GEM example

The following environment variables need to be set to run (running without the shell scripts):

GARFIELD_INSTALL (Where to look for gas datasets)
optional:
    HEED_DATABASE (By default a location relative to GARFIELD_INSTALL)
    G4XXXXDATA (The Geant4 data variables for datasets)

Required dependencies:

Root

vs2022 binary available at https://root.cern/install/all_releases/, installer version sets environment variables. Tested with 6.26/06, should work with all versions built with vs2022.

Geant4

vs2019 binary available at https://geant4.web.cern.ch/support/download, binary compatible with vs2022. Tested with self-compiled 6.11.03 with Qt and GDML(xerces-c) using vs2022. Qt5.15 binary in vs2019 is compatible with vs2022 compiler.

gsl

vckpg install gsl, and just use cmake with vcpkg. Currently you need to specify the gsl and gslblas library files manually. Located at <vcpkg-dir>\installed\<compiler-setting(x64-windows)>

garfieldpp's People

Contributors

alexandrusconstantus avatar alisheharyar avatar djjansse avatar dorotheapfeiffer avatar hschindl avatar ihrivnac avatar josephmckenna avatar jottnad avatar knikolop-bham avatar lobis avatar peremato avatar shangjiaxuan avatar triskeldeian avatar zenker avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.