Warning, /JETSCAPE/external_packages/trento/doc/internals.rst is written in an unsupported language. File is not indexed.
0001 Tests & internals
0002 =================
0003
0004 Unit tests
0005 ----------
0006 .. image:: https://travis-ci.org/Duke-QCD/trento.svg?branch=master
0007 :target: https://travis-ci.org/Duke-QCD/trento
0008 :width: 90px
0009
0010 T\ :sub:`R`\ ENTo has a thorough `test suite <https://github.com/Duke-QCD/trento/tree/master/test>`_.
0011 To run the tests, build the code in debug mode::
0012
0013 mkdir build-debug && cd build-debug
0014 cmake .. -DCMAKE_BUILD_TYPE=Debug
0015 make tests
0016
0017 Tests rely on the `Catch <https://github.com/philsquared/Catch>`_ C++ test framework, which CMake downloads automatically during the build process.
0018 If for some reason this fails, manually download the header `catch.hpp <https://raw.githubusercontent.com/philsquared/Catch/master/single_include/catch.hpp>`_ and place it in the ``test`` directory.
0019
0020 If `gcovr <http://gcovr.com>`_ is installed a code coverage report will be generated.
0021
0022 If any `sanitizers <https://github.com/google/sanitizers>`_ are available they will run.
0023 The sanitizers check for runtime errors such as memory leaks.
0024 They are included in recent versions of GCC and Clang.
0025
0026 Fitting the cross section
0027 -------------------------
0028 It is vital that the model reproduce the inelastic nucleon-nucleon cross section `\sigma_{NN}`.
0029 This condition may be written
0030
0031 .. math::
0032
0033 \sigma_{NN} = \int d^2b \, P_\text{coll}(b),
0034
0035 where
0036
0037 .. math::
0038
0039 P_\text{coll}(b) = 1 - \exp[-\sigma_{gg}T_{AB}(b)]
0040
0041 is the probability of two nucleons colliding at impact parameter `b`.
0042
0043 `T_{AB}` is the overlap integral of the two nucleons' thickness functions, easily computed given Gaussian nucleons of width `w`:
0044
0045 .. math::
0046
0047 \begin{align*}
0048 T_A(x, y) &= \frac{1}{2\pi w^2} \exp\biggl( -\frac{x^2 + y^2}{2w^2} \biggr), \\[1em]
0049 T_{AB}(b) &= \int dx \, dy \, T_A(x - b/2, y) T_B(x + b/2, y) \\
0050 &= \frac{1}{4\pi w^2} \exp\biggl( -\frac{b^2}{4w^2} \biggr).
0051 \end{align*}
0052
0053 `\sigma_{gg}` is an effective parton-parton cross section now determined by the relation
0054
0055 .. math::
0056
0057 \sigma_{NN} = \int_0^{b_\text{max}} 2\pi b \, db \,
0058 \biggl\{
0059 1 - \exp\biggl[
0060 -\frac{\sigma_{gg}}{4\pi w^2}
0061 \exp\biggl( -\frac{b^2}{4w^2} \biggr)
0062 \biggr]
0063 \biggr\},
0064
0065 where `b_\text{max}` is the maximum impact parameter for a collision.
0066 Let `b_\text{max} = Aw`, i.e. some number of nucleon widths (the actual code uses `A = 6`).
0067
0068 After appropriate change of variables, this relation may be written
0069
0070 .. math::
0071
0072 \frac{\sigma_{NN}}{4\pi w^2} =
0073 \frac{A^2}{4} +
0074 \text{Ei}\biggl( -e^{-A^2/4} \frac{\sigma_{gg}}{4\pi w^2} \biggr) -
0075 \text{Ei}\biggl( -\frac{\sigma_{gg}}{4\pi w^2} \biggr)
0076
0077 where `\text{Ei}` is the `exponential integral <https://en.wikipedia.org/wiki/Exponential_integral>`_.
0078 This is still a transcendental equation but it can be quickly solved numerically for a given cross section and nucleon width.
0079
0080 The code determines `\sigma_{gg}` at runtime by solving this equation using a standard root finding algorithm.
0081 The relevant function is ``compute_cross_sec_param`` in `nucleon.cxx <https://github.com/Duke-QCD/trento/blob/master/src/nucleon.cxx>`_.
0082 Note that it actually optimizes over the dimensionless variable `\log({\sigma_{gg}/4\pi w^2})`.
0083
0084 The nucleon unit test verifies that the cross section is accurately reproduced.
0085
0086 List of classes
0087 ---------------
0088 This section is automatically generated from the source code by `Doxygen <http://www.stack.nl/~dimitri/doxygen>`_ and converted into `Sphinx <http://sphinx-doc.org>`_ format by `Breathe <https://breathe.readthedocs.org>`_.
0089 In order to emphasize functionality---rather than implementation details---private class methods are not shown.
0090
0091 .. highlight:: cpp
0092
0093 Collider
0094 ~~~~~~~~
0095 .. doxygenclass:: trento::Collider
0096 :members: Collider, run_events
0097
0098 Event
0099 ~~~~~
0100 .. doxygenclass:: trento::Event
0101 :members:
0102
0103 Output
0104 ~~~~~~
0105 .. doxygenclass:: trento::Output
0106 :members:
0107
0108 Nucleus
0109 ~~~~~~~
0110 .. doxygenfunction:: trento::Nucleus::create
0111
0112 .. doxygenclass:: trento::Nucleus
0113 :members: radius, sample_nucleons, ~Nucleus
0114 :protected-members:
0115
0116 Nucleus types
0117 '''''''''''''
0118 .. doxygenclass:: trento::Proton
0119 .. doxygenclass:: trento::Deuteron
0120 .. doxygenclass:: trento::WoodsSaxonNucleus
0121 .. doxygenclass:: trento::DeformedWoodsSaxonNucleus
0122 .. doxygenclass:: trento::ManualNucleus
0123
0124 Nucleon
0125 ~~~~~~~
0126 .. doxygenclass:: trento::Nucleon
0127 :members: Nucleon, x, y, z, is_participant, set_position, set_participant
0128
0129 Nucleon profile
0130 ~~~~~~~~~~~~~~~
0131 .. doxygenclass:: trento::NucleonProfile
0132 :members:
0133
0134 Fast exponential
0135 ~~~~~~~~~~~~~~~~
0136 .. doxygenclass:: trento::FastExp
0137 :members: