Skip to content

Commit

Permalink
Add possibility to disable channels
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Feb 22, 2017
1 parent 1e17684 commit 002e67c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
New in 0.5:
===========

- it is now possible to disable channels by setting their weight to zero
- the function ``multi_channel_verbose_callback`` now prints an overview of the
smallest and largest a-priori weights
- the functions ``multi_channel`` and ``mpi_multi_channel`` now accept an
Expand Down
7 changes: 7 additions & 0 deletions include/hep/mc/multi_channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ inline std::vector<T> multi_channel_refine_weights(

for (T& weight : new_weights)
{
if (weight == T())
{
// do not enable disabled channels (with weight zero) by setting
// them to the minimum weight
continue;
}

weight /= sum_of_new_weights;
weight = std::fmax(weight, minimum_weight);
new_sum += weight;
Expand Down

0 comments on commit 002e67c

Please sign in to comment.