Hammer-README

DOI DOI

HAMMER - Helicity Amplitude Module for Matrix Element Reweighting, ver. 2.0.0

A C++ software library, designed to provide fast and efficient reweighting of large Monte Carlo datasets containing semileptonic b-Hadron decays to any desired New Physics, or to any description of the hadronic matrix elements. See the HAMMER website for more information.

Documentation

System Requirements

To use the latest HAMMER, you will need:

Installation

HAMMER uses CMake to configure the build process. Out-of-source build is required:

~$ tar -xzf Hammer-X.Y.Z-Source.tar.gz
~$ mkdir Hammer-build
~$ cd Hammer-build
~$ cmake -DCMAKE_INSTALL_PREFIX=../Hammer-install <ADDITIONAL_OPTIONS> ../Hammer-X.Y.Z-Source  # configure the project. See below for ADDITIONAL_OPTIONS
~$ make # compile the project
~$ ctest -V  # runs all the unit tests. Optional, to be called if tests are enabled
~$ make doc  # create the code documentation. Optional, to be called if documentation is enabled
~$ make install # install the project

Configure Options

The following options can be passed to CMake at configure time with the usual -D<OPTION_NAME>=ON|OFF syntax.

Option Default Description
WITH_PYTHON ON Build the HAMMER Python3 bindings
PYTHON_USE_CPPYY ON Use cppyy for Python bindings (set to OFF to use Cython instead)
WITH_ROOT OFF Build the HAMMER ROOT interface
WITH_EXAMPLES OFF Build the HAMMER examples. The ROOT and Python examples will be built only if the corresponding options are enabled. All the examples will be located in <INSTALL_DIR>/shared/Hammer/Examples after installation
ENABLE_TESTS OFF Build the unit tests
BUILD_DOCUMENTATION OFF Allows building the doxygen documentation with make doc
INSTALL_HEADERS OFF Install all HAMMER development headers (Amplitudes, FormFactors, Rates, Math internals, and other internal headers). By default only the headers needed to compile against the public API are installed
INSTALL_EXTERNAL_DEPENDENCIES OFF Build and install local copies of certain missing dependencies. For missing Python modules a working pip is required
FORCE_YAMLCPP_INSTALL OFF Install local copy of yaml-cpp even if one is present (rarely needed). Useful on certain systems where package finding and INSTALL_EXTERNAL_DEPENDENCIES both fails
FORCE_HEPMC_INSTALL OFF Install local copy of HepMC3 even if one is present (rarely needed). Useful on certain systems where package finding and INSTALL_EXTERNAL_DEPENDENCIES both fails

furthermore, the following options are available for debugging

Option Default Description
VERBOSE_DEBUG OFF Build for debugging with high verbosity
SANITIZE OFF Enable AddressSanitizer and UndefinedBehaviorSanitizer (requires compiler support; implies VERBOSE_DEBUG)
COVERAGE OFF Enable code coverage reporting

and the standard CMake option -DBUILD_SHARED_LIBS=ON|OFF controls whether Hammer is built as a static or dynamic library (static is default) and switching to shared library sometimes may be useful for resolving linking issues with the Boost Thread library on some platforms.

Post-installation configuration

HAMMER installs thishammer.{cssh,sh,fish} scripts in <install_dir>/bin. They can be sourced to set up the look-up path environment variables for installations not in the standard location (analogously to thisroot.sh for ROOT).

Compilation of user code against the HAMMER library

HAMMER will install CMake modules, allowing the library to be discovered by CMake via find_package(Hammer REQUIRED) and linked against by adding the necessary HAMMER targets via target_link_link_libraries(<program_name> PRIVATE Hammer::Hammer). See the [manual] for more information.

Examples

The folder Examples/ contains several examples and is a great place to learn to use HAMMER.

Example Description
demo01 read MC events, reweighs \(B\rightarrow (D^*\rightarrow D\pi) \tau\nu\) and \(B\rightarrow D \tau \nu\) from ISGW2 to BLPR for generalized NP, saving all the event NP tensor weights into a file
demo02 read in the output of demo01 and reweighs all the events from Standard Model to new physics with complex Wilson Coefficients \(S_{qLlL} = x i\), \(T_{qLlL}= x/4\) for \(x=0, 0.2, \ldots, 1.0\), printing the values of the first few weights in each case
demo03 same reweighing as in demo01 but histograms are filled (\(p_\ell~\) vs \(Q^2\), in 6-by-5 bins, separately for \(D\) and \(D^*\)), including weight-squared uncertainties, and saved instead
demo04 read the output of demo03 and perform the same reweighing to new physics as demo02, printing the histogram bin values — weight, number of events, and weight-squared uncertainty
demo05 read MC events, reweighs \(B\rightarrow (D^*\rightarrow D\pi) \tau\nu\), \(B\rightarrow D \tau \nu\), \(B\rightarrow (D^*\rightarrow D\pi) \ell~\nu\) and \(B\rightarrow D \ell~ \nu\) starting from pure phase space events. Prints total sum of weights reweighing decays with a \(\tau\) to \(S_{qLlL} = x i\), \(T_{qLlL}= x/4\) and those with a \(\mu\) to \(S_{qLlL} = -x i\), \(T_{qLlL}= -x/4\) for \(x=0, 0.2, \ldots, 1.0\)
demo07 read MC events, reweighs \(B \rightarrow D \ell~ \nu\) from ISGW2 to BGL with FF variations and fill histograms (\(Q^2\) in 12 bins and \(p_\ell~\) vs \(Q^2\) in 8-by-7 bins), including weight-squared uncertainties
demo08 read the output of demo07 and reweighs by varying the Form Factors with BGL parameters \(\delta~ a_1=x\) and \(\delta~ a_2=x/3\) with \(x=0.0,0.01,\ldots,0.05\), printing out the histogram bin values for weight, number of events, and weight-squared uncertainty
demo09 same as demo03, but splits the event sample into two different output files
demo10 same as demo04, but merges the output files produced in demo09 (automatically summing histograms)
demo11 same as demo07, but renames the FF variation eigenvector directions
demo12 same as demo08, but renames the FF variation eigenvector directions, and processes the results of demo11
demo13 same as demo03 but with Wilson Coefficient specialization enabled
demo13rl reload weights and specializations to fill histograms
demo14 same output as demo04 but with WC specialization. Read demo03/13 output and compare histograms and timing with and without specialization
demo01root same as demo01 but using ROOT TTree for storage
demo02root same as demo02 but using ROOT TTree for storage
demo03root same as demo03 but using ROOT TTree for storage and TH2D for histograms
demo04root same as demo04 but using ROOT TTree for storage and TH2D for histograms
demo04root2 alternative implementation of demo04root
demo01card same as demo01 but using a card file to set the run options
demo04mma same as demo04 but with Wilson Coefficient values passed from the command line (to be called from Mathematica)
demo08mma same as demo08 but with Wilson Coefficient values passed from the command line (to be called from Mathematica)
demo04parallel same as demo04 but using multi-threading
Example Description
demo01.py Python version of demo01
demo01root.py Python version of demo01root
demo01_io.py Python version of demo01 using the Python I/O
demo02.py Python version of demo02
demo03.py Python version of demo03
demo04.py Python version of demo04
Example Description
demo01_cython.py Python version of demo01
demo02_cython.py Python version of demo02
demo03_cython.py Python version of demo03
demo04_cython.py Python version of demo04

Contributors

Hammer has been developed by:

Current contributors can be found here.

License

Hammer is licensed under version 3 of the GPL. Please note the MCnet academic guidelines.

Keeping in touch