[Rivet] inRange trouble

Andy Buckley andy.buckley at ed.ac.uk
Thu Sep 22 10:13:24 BST 2011


On 22/09/11 08:58, Hendrik Hoeth wrote:
> Hi guys,
>
> our dear Jenkins build system throws up in ATLAS_2011_I919017, and for a
> good reason. That analysis has 50 lines of the style
>
>    if (inRange(jetpt/GeV, 10, 15)) { ... }
>
> and the compiler tells us that it's not a good idea to put a double into
> a function that takes an integer argument:
>
>    passing 'double' for argument 1 to 'bool Rivet::inRange(int, int, int, Rivet::RangeBoundary, Rivet::RangeBoundary)'
>
> So, what do we do? Right now the function is templated, so that the
> first three arguments have the same type. Adding an inRange(double,<T>,<T>)
> won't work, because it introduces an ambiguity. Getting rid of the
> templates altogether means we need to introduce a loooong list of
> inRange functions.

Do we really? If we have an explicit (int, int, int) and a (double, 
double, double), won't implicit conversion do the rest? I have a feeling 
that the templation might be making the type matching extra picky.

Andy

-- 
Dr Andy Buckley
SUPA Advanced Research Fellow
Particle Physics Experiment Group, University of Edinburgh

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the Rivet mailing list