Giter VIP home page Giter VIP logo

marley's Introduction

MARLEY (Model of Argon Reaction Low Energy Yields)

platform License: GPL v3 DOI

Build Status rel commits since

Introduction

MARLEY (Model of Argon Reaction Low Energy Yields) is a Monte Carlo event generator for neutrino-nucleus interactions at energies of tens-of-MeV and below. The current version computes inclusive neutrino-nucleus cross sections employing the allowed approximation: the nuclear matrix elements are evaluated while neglecting Fermi motion and applying the long-wavelength (zero momentum transfer) limit. De-excitations of the final-state nucleus emerging from the primary interaction are simulated using a combination of tabulated γ-ray decay schemes and an original implementation of the Hauser-Feshbach statistical model.

Input files are provided with the code that are suitable for simulating the charged-current process

νe + 40Ar →  e + 40K*,

coherent elastic neutrino-nucleus scattering (CEvNS) on spin-zero target nuclei, and neutrino-electron elastic scattering on any atomic target. Inclusion of additional reactions and targets is planned for the future.

MARLEY follows an open-source development model and welcomes contributions of new input files and code improvements from the community. A partial list of potential projects for future MARLEY development is available on the developer documentation webpage.

See the FILEMAP file for a description of the full contents of the MARLEY source code distribution.

Copyright and License

Copyright © 2016-2021 Steven Gardiner [email protected]

MARLEY is distributed under the terms of version 3 of the GNU General Public License ("GPLv3") as published by the Free Software Foundation. For the full text of that license, please see the COPYING file.

As a matter of professional courtesy, MARLEY users are also requested to follow the MCnet Guidelines for Event Generator Authors and Users. Nevertheless, these guidelines are not legally binding and do not limit your rights guaranteed under the GPLv3. See the GUIDELINES file for more details.

Citing MARLEY

If you refer to MARLEY in academic work, please always cite the following reference:

S. Gardiner, Simulating low-energy neutrino interactions with MARLEY, Comput. Phys. Commun. 269, 108123, arXiv:2101.11867 [nucl-th] (2021).

In publications which use the official reaction input files for charged-current scattering on argon-40 (i.e., any of the files in data/react whose names begin with ve40ArCC), please also cite the paper describing their preparation:

S. Gardiner, Nuclear de-excitations in low-energy charged-current νe scattering on 40Ar, Phys. Rev. C 103, 044604, arXiv:2010.02393 [nucl-th] (2021).

Providing a citation for the MARLEY code itself is also encouraged and appreciated. To maximize reproducibility of published calculations, such citations should include the digital object identifier (DOI) associated with the code release that was used. The DOIs for recent versions of MARLEY are listed on the GitHub releases webpage and in the right-hand column of the Zenodo "concept DOI" webpage.

For convenience, recommended BibTeX citations to use for the latest MARLEY release are given in the CITATION.bib file.

If you use the default nuclear structure data files (strongly recommended) for published calculations, please also give proper attribution to the developers of the TALYS nuclear code (see data/structure/README.md for more information).

Getting Started

MARLEY is regularly tested on both Linux and macOS platforms and is expected to work in any Unix-like environment in which the prerequisites are installed. Building and running MARLEY on Windows is not currently supported.

Prerequisites

There are three prerequisites needed to build MARLEY:

  • A C++14-compliant compiler. The following compilers are officially supported:

  • GNU Make

  • GNU Scientific Library (GSL)

    • MARLEY's Makefile verifies that GSL is installed by checking that the gsl-config script is available on the system PATH.

On Linux machines, all three of these prerequisites will likely be available through the standard package manager. On macOS, installing GSL may be done using Homebrew:

brew install gsl

Although it is not required in order to build or use MARLEY, the popular ROOT data analysis framework provides convenient tools for plotting and analyzing simulation results. Users who wish to use the optional interface between the two codes should ensure that ROOT is installed before building MARLEY. At build time, the optional MARLEY interface to ROOT is enabled automatically if the root-config script is present on the system PATH.

Building MARLEY

To build the code, enter the build/ folder

cd build

and then run GNU make

make

If the build is successful, then executing

./marley

should produce the following output:

Usage: marley [OPTION...] CONFIG_FILE

  -h, --help     Print this help message
  -v, --version  Print version and exit

MARLEY home page: <http://www.marleygen.org>
E-mail bug reports to: <[email protected]>

Setting up the runtime environment

The marley executable relies on the system environment variable MARLEY to store the full path to the root folder of the source code. This variable may be set automatically by executing ("sourcing") the setup_marley.sh Bash script using the source command. From within the build/ folder, for example, one may source the setup script via

source ../setup_marley.sh

If generation of events is attempted without setting the MARLEY environment variable first, then MARLEY will halt after printing the error message

[ERROR]: The MARLEY environment variable is not set. Please set it (e.g.,
by sourcing the setup_marley.sh script) and try again.

For user convenience, the setup_marley.sh script also adds the build/ folder to the system PATH and to either LD_LIBRARY_PATH (Linux) or DYLD_LIBRARY_PATH (macOS).

Generating events

The marley executable allows the user to adjust simulation parameters via job configuration files written in a JSON-like format. The name of the configuration file to use appears as the first (and only) command-line argument:

marley CONFIG_FILE

To generate events using an example configuration file, execute the following command from within the build/ folder after sourcing the setup_marley.sh script:

marley ../examples/config/annotated.js

The program will display the MARLEY logo and diagnostic messages as it runs the simulation. When the program terminates, a new file named events.ascii will be present in the build/ folder. This file contains the generated events in MARLEY's native ASCII output format.

The annotated.js configuration file mentioned above is heavily commented with explanations of the most commonly-used input parameters. Reading it serves as a good next step for new users. When you are ready to start writing your own configuration files, editing a copy of examples/config/COPY_ME.js is recommended.

Full documentation for configuring MARLEY is available in section 6 of the MARLEY implementation paper.

Core Developers

See also the list of contributors who participated in this project.

Website

Further documentation for the latest version of MARLEY may be found on the official webpage at http://www.marleygen.org/.

Acknowledgements

Special thanks go to

  • The TALYS developers (Arjan Koning, Stéphane Hilaire, and Marieke Duijvestijn) for sharing their nuclear structure data

  • Zero Anixter for providing an illustration of Bob Marley to be used in the official MARLEY logo

marley's People

Contributors

sjgardiner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

marley's Issues

Makefile doesn't add necessary compiler flags if CXXFLAGS preset

Howdy! I'm working with Dave Elofson ( @delofson0211) at Texas A&M on the QPix simulation. He was having trouble building Marley, which I was able to isolate to an unexpected feature in the Makefile:

CXXFLAGS ?= -O0 -g -std=$(CXX_STD)

CXXFLAGS ?= -O3 -std=$(CXX_STD)

By using ?= here, the required compiler flags are not appended to the user's environment, but instead are thrown away. Without the c++14 selection, the code won't compile.

The Texas A&M HPRC cluster provides a buildenv Lmod module, which creates a comprehensive set of envvars for compilers (CC, CXX, F90, etc.), include directories, compiler flags (CPPFLAGS, CFLAGS, CXXFLAGS, ...), and so on. In particular, it sets CXXFLAGS=-O2 -ftree-vectorize -march=native -fno-math-errno.

Is there a reason for using ?=? If not, could it be changed to +=? If the user doesn't have CXXFLAGS set, the behaviour will remain the same; if it is set, the Marley flags will be added to the current ones.

Add handling of --no-as-needed linker flag to marley-config

Venkatesh Iyer reports linker trouble building the example executables on Ubuntu. The cause appears to be the need to add -Wl,--no-as-needed to the compiler flags since the Ubuntu build of the GCC linker adds -Wl,--as-needed by default (see http://www.bnikolic.co.uk/blog/gnu-ld-as-needed.html). This is already done in the main MARLEY Makefile, but for the example programs it will be most convenient to handle at the marley-config level rather than requiring the user to add it manually.

Global configuration for electron scattering parameters

Currently, the electron scattering cross-section is hard coded via the coupling constants (g1 g2). It might be useful to have user-defined parameters because.

  1. global fit values of the Weinberg angle may change as more measurements were made.
  2. the electron scattering cross-section will change depending on if we want to take into account radiative correction (https://journals.aps.org/prd/pdf/10.1103/PhysRevD.101.032002)
    A more general (and yet simple for users) way to specify the coupling constants would be highly useful.

Missing gammas for some 40K levels in v1.1.0

Bishu Behera from Colorado State noticed some odd behavior while doing DUNE photon detector simulations. Further investigation revealed that the problem was caused by a few levels in the 40K decay scheme (structure/z019) which lacked any tabulated gamma transitions. The levels with missing gammas were introduced when the 40K structure data were reprocessed for v1.1.0 based on the latest ENSDF evaluation.

Dictionary problem when building v1.1.0 against ROOT 5

Nitali Dash from IHEP encountered the following error while building the MARLEY ROOT dictionaries. This issue appears to be limited to builds involving ROOT 5.

/home/nitali/Root/root/bin/rootcint -f marley_root_dict.cc -c -I../include marley/Particle.hh marley/Event.hh marley/marley_linkdef.hh
g++ -pthread -m64 -I/home/nitali/Root/root/include -O3 -std=c++14 -I../include -Wall -Wextra -Wpedantic -Wno-error=unused-parameter -Wcast-align -Wl,--no-as-needed -DUSE_ROOT -I/usr/local/include \
-I../include -fPIC -o marley_root_dict.o -c marley_root_dict.cc
marley_root_dict.cc: In function ‘int G__marley_root_dict_170_0_25(G__value*, const char*, G__param*, int)’:
marley_root_dict.cc:662:29: error: variable ‘const marley::JSON xobj’ has initializer but incomplete type
          const marley::JSON xobj = ((const marley::Particle*) G__getstructoffset())->to_json();
                             ^~~~
marley_root_dict.cc:662:94: error: invalid use of incomplete type ‘class marley::JSON’
 arley::JSON xobj = ((const marley::Particle*) G__getstructoffset())->to_json();
                                                                              ^
In file included from marley_root_dict.h:34:0,
                 from marley_root_dict.cc:17:
../include/marley/Particle.hh:11:9: note: forward declaration of ‘class marley::JSON’
   class JSON;
         ^~~~
marley_root_dict.cc:663:38: error: invalid use of incomplete type ‘class marley::JSON’
          pobj = new marley::JSON(xobj);
                                      ^
In file included from marley_root_dict.h:34:0,
                 from marley_root_dict.cc:17:
../include/marley/Particle.hh:11:9: note: forward declaration of ‘class marley::JSON’
   class JSON;
         ^~~~
marley_root_dict.cc: In function ‘int G__marley_root_dict_171_0_25(G__value*, const char*, G__param*, int)’:
marley_root_dict.cc:1026:29: error: variable ‘const marley::JSON xobj’ has initializer but incomplete type
          const marley::JSON xobj = ((const marley::Event*) G__getstructoffset())->to_json();
                             ^~~~
marley_root_dict.cc:1026:91: error: invalid use of incomplete type ‘class marley::JSON’
 t marley::JSON xobj = ((const marley::Event*) G__getstructoffset())->to_json();
                                                                              ^
In file included from marley_root_dict.h:34:0,
                 from marley_root_dict.cc:17:
../include/marley/Particle.hh:11:9: note: forward declaration of ‘class marley::JSON’
   class JSON;
         ^~~~
marley_root_dict.cc:1027:38: error: invalid use of incomplete type ‘class marley::JSON’
          pobj = new marley::JSON(xobj);
                                      ^
In file included from marley_root_dict.h:34:0,
                 from marley_root_dict.cc:17:
../include/marley/Particle.hh:11:9: note: forward declaration of ‘class marley::JSON’
   class JSON;
         ^~~~
Makefile:123: recipe for target 'marley_root_dict.o' failed
make: *** [marley_root_dict.o] Error 1
rm RootJSONConfig.o WeisskopfSingleParticleModel.o Reaction.o marley_utils.o BackshiftedFermiGasModel.o ExitChannel.o Logger.o Generator.o HauserFeshbachDecay.o RootConfigurationFile.o Gamma.o Level.o StandardLorentzianModel.o JSONConfig.o Particle.o coulomb_wavefunctions.o MassTable.o Integrator.o marley_root.o DecayScheme.o GammaStrengthFunctionModel.o KoningDelarocheOpticalModel.o NeutrinoSource.o ConfigurationFile.o Event.o marley_kinematics.o StructureDatabase.o NuclearReaction.o RotationMatrix.o

Marley errors when parsing default COPY_ME.js files

When parsing /package_srcs/marley/examples/config/COPY_ME.js

Error:
It outputs:

Seeded random number generator with 123456Created Fermi-Dirac 1000170370νe source with parameters

60 has a tabulated decay scheme in the file Cl.dat

before having a segmentation fault

Expected behavior:
I would expect it to return a marley::Generator object with the configuration as set in the COPY_ME.js file

Minimal working example:

config_file_name = std::string(std::getenv("MARLEY"))+"/examples/config/COPY_ME.js"
fMarleyMessenger = new MarleyMessenger(this); 
marley::JSONConfig config(config_file_name);
marley_generator_= config.create_generator();
std::cout << "Finished creating marley generator\n";

Version:
c80cfb5-dirty

Stacktrace:

sndwrm(65619,0x280887000) malloc: Heap corruption detected, free list is damaged at 0x6000005f6dc0
*** Incorrect guard value: 105553219572816
Process 65619 stopped
* thread #8, stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
    frame #0: 0x0000000100f7cf98 libMARLEY.dylib`std::__1::__shared_count::__release_shared[abi:v15006]() + 56
libMARLEY.dylib`std::__1::__shared_count::__release_shared[abi:v15006]:
->  0x100f7cf98 <+56>: ldr    x8, [x8, #0x10]
    0x100f7cf9c <+60>: blr    x8
    0x100f7cfa0 <+64>: mov    w8, #0x1
    0x100f7cfa4 <+68>: and    w8, w8, #0x1
Target 0: (sndwrm) stopped.

Backtrace:

* thread #9, stop reason = EXC_BAD_ACCESS (code=1, address=0xbeadce37a4a0)
  * frame #0: 0x000000018e744858 libc++.1.dylib`std::__1::__shared_weak_count::__release_weak() + 44
    frame #1: 0x0000000100f7cf50 libMARLEY.dylib`std::__1::__shared_weak_count::__release_shared[abi:v15006]() + 44
    frame #2: 0x0000000100f7cf10 libMARLEY.dylib`std::__1::shared_ptr<std::__1::basic_ostream<char, std::__1::char_traits<char> > >::~shared_ptr[abi:v15006]() + 64
    frame #3: 0x0000000100f7cec0 libMARLEY.dylib`std::__1::shared_ptr<std::__1::basic_ostream<char, std::__1::char_traits<char> > >::~shared_ptr[abi:v15006]() + 28
    frame #4: 0x0000000100f7ce94 libMARLEY.dylib`marley::Logger::OutStream::~OutStream() + 28
    frame #5: 0x0000000100f7cc08 libMARLEY.dylib`marley::Logger::OutStream::~OutStream() + 28
    frame #6: 0x0000000100fdfd10 libMARLEY.dylib`marley::Logger::OutStreamVector& marley::Logger::OutStreamVector::operator<<<char [23]>(char const (&) [23]) + 184
    frame #7: 0x0000000100fd6124 libMARLEY.dylib`marley::Logger::Message&& marley::Logger::Message::operator<<<char [23]>(char const (&) [23]) + 40
    frame #8: 0x0000000101042b68 libMARLEY.dylib`marley::StructureDatabase::load_structure_index() + 536
    frame #9: 0x00000001010423a8 libMARLEY.dylib`marley::StructureDatabase::get_decay_scheme(int) + 232
    frame #10: 0x0000000101035758 libMARLEY.dylib`(anonymous namespace)::set_level_ptrs(std::__1::vector<marley::MatrixElement, std::__1::allocator<marley::MatrixElement> >&, int, int, marley::StructureDatabase&) + 52
    frame #11: 0x000000010103530c libMARLEY.dylib`marley::Reaction::load_from_file(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, marley::StructureDatabase&) + 2136
    frame #12: 0x0000000100ff357c libMARLEY.dylib`marley::JSONConfig::prepare_reactions(marley::Generator&) const + 860
    frame #13: 0x0000000100fef43c libMARLEY.dylib`marley::JSONConfig::create_generator() const + 560
    frame #14: 0x0000000100028db0 sndwrm`PrimaryGeneratorAction::PrimaryGeneratorAction(this=0x0000000109501800) at PrimaryGeneratorAction.cc:71:29 [opt]


stepping w/ lldb through the create_generator function in marley pinpointed the error to prepare_direction


* thread #8, stop reason = breakpoint 2.1
    frame #0: 0x00000001015f5ffc libMARLEY.dylib`marley::JSONConfig::prepare_direction(marley::Generator&) const
libMARLEY.dylib`marley::JSONConfig::prepare_direction:
->  0x1015f5ffc <+0>:  stp    x20, x19, [sp, #-0x20]!
    0x1015f6000 <+4>:  stp    x29, x30, [sp, #0x10]
    0x1015f6004 <+8>:  add    x29, sp, #0x10
    0x1015f6008 <+12>: sub    x9, sp, #0x300
Target 0: (sndwrm) stopped.
(lldb) continue
Process 78721 resuming
Incident neutrino direction: (0.000000, 0.000000, 1.000000)
=================================================================
==78721==ERROR: AddressSanitizer: container-overflow on address 0x00010b6f7c40 at pc 0x0001015ee97c bp 0x00016ff0f310 sp 0x00016ff0f308
WRITE of size 8 at 0x00010b6f7c40 thread T7
Seeded random number generator with 1696014266373310
PrimaryGenAction: Marley config file is /Users/jackxu/local_code/package_srcs/marley/examples/config/COPY_ME.js
PrimaryGenAction: Unused if nu_e is not specified 
Process 78721 stopped
* thread #7, stop reason = breakpoint 3.1
    frame #0: 0x00000001015f35c4 libMARLEY.dylib`marley::JSONConfig::create_generator() const
libMARLEY.dylib`marley::JSONConfig::create_generator:
->  0x1015f35c4 <+0>:  stp    x20, x19, [sp, #-0x20]!
    0x1015f35c8 <+4>:  stp    x29, x30, [sp, #0x10]
    0x1015f35cc <+8>:  add    x29, sp, #0x10
    0x1015f35d0 <+12>: sub    x9, sp, #0x600
Target 0: (sndwrm) stopped.


Doing image lookup gives

(lldb) image lookup --address 0x0001015ee97c
Address: libMARLEY.dylib[0x00000000001b697c] (libMARLEY.dylib.__TEXT.__text + 1782704)
Summary: libMARLEY.dylib`marley::Integrator::Integrator(unsigned long) + 816

Time information for final state particles

The final state particles seem to not include timing information.
For CC events like nu_e + Ar40 -> K* + e -> K + gamma + e, the delayed gamma coming from the K de-excitation could be used as for background and signal selection.
To use this information would make the simulation of time necessary.

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.