Page MenuHomeHEPForge

No OneTemporary

diff --git a/doc/sphinx/scales.rst b/doc/sphinx/scales.rst
index ab1a2b1..9378351 100644
--- a/doc/sphinx/scales.rst
+++ b/doc/sphinx/scales.rst
@@ -1,80 +1,69 @@
.. _`Custom scales`:
Custom scales
=============
Reversed HEJ comes with a small selection of built-in renormalisation
and factorisation scales, as described in the :ref:`scales <scales>` setting. In
addition to this, user-defined scales can be imported from custom
libraries.
Writing the library
-------------------
Custom scales are defined through C++ functions that take an event and
-compute the corresponding scale. As an example, let's consider the
-following function returning the transverse momentum of the softest jet
-in an event:
-
-.. code-block:: C++
-
- #include "RHEJ/Event.hh"
-
- double softest_jet_pt(RHEJ::Event const & ev){
- const auto softest_jet = sorted_by_pt(ev.jets()).back();
- return softest_jet.perp();
- }
-
-To make this accessible from reversed HEJ, we have to prevent C++ name
-mangling with :code:`extern "C"`:
+compute the corresponding scale. As an example, let's consider a
+function returning the transverse momentum of the softest jet in an
+event. To make it accessible from reversed HEJ, we have to prevent C++
+name mangling with :code:`extern "C"`:
.. code-block:: C++
#include "RHEJ/Event.hh"
extern "C"
double softest_jet_pt(RHEJ::Event const & ev){
const auto softest_jet = sorted_by_pt(ev.jets()).back();
return softest_jet.perp();
}
After saving this code to some file :code:`myscales.cc`, we can compile
it to a shared library. With the :code:`g++` compiler this can be done
with the command
.. code-block:: sh
g++ -fPIC -shared -Wl,-soname,libmyscales.so -o libmyscales.so myscales.cc
If :code:`g++` is used and the library also contains other definitions,
it is recommended to add :code:`-fvisibility=hidden` to the compiler
flags and :code:`__attribute__((visibility("default")))` after
:code:`extern "C"` for each exported function in order to avoid possible
name clashes.
Importing the scale into reversed HEJ
-------------------------------------
Our custom scale can now be imported into reversed HEJ by adding the
lines
.. code-block:: YAML
import scales:
/path/to/libmyscales.so: softest_jet_pt
It is also possible to import several scales from one or more libraries:
.. code-block:: YAML
import scales:
/path/to/libmyscales1.so: [first_scale, second_scale]
/path/to/libmyscales2.so: [another_scale, yet_another_scale]
The custom scales can then be used as usual in the :ref:`scales <scales>`
setting, for example
.. code-block:: YAML
scales: [H_T, softest_jet_pt, 2*softest_jet_pt]

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 2:38 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3800358
Default Alt Text
(2 KB)

Event Timeline