Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19251658
scales.rst
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
scales.rst
View Options
..
_`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 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
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 30, 6:09 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6545856
Default Alt Text
scales.rst (2 KB)
Attached To
Mode
rHEJ HEJ
Attached
Detach File
Event Timeline
Log In to Comment