[Rivet] Two-dimensional histograms

Andy Buckley andy.buckley at cern.ch
Wed Sep 17 11:13:46 BST 2014


On 17/09/14 10:38, James Robinson wrote:
> 
> 
> On 17 September 2014 11:26, Andy Buckley <andy.buckley at cern.ch
> <mailto:andy.buckley at cern.ch>> wrote:
> 
>     On 16/09/14 22:53, James Robinson wrote:
>     > Dear Andy and David,
>     >
>     > On 16 September 2014 20:58, Andy Buckley <andy.buckley at cern.ch <mailto:andy.buckley at cern.ch>
>     > <mailto:andy.buckley at cern.ch <mailto:andy.buckley at cern.ch>>> wrote:
>     >
>     >     In fact, there is even an efficiency(pass, tot) function that takes 1D
>     >     histos and returns a Scatter2D with appropriate binomial statistics
>     >     treatment!
>     >
>     >     Andy
>     >
>     >
>     > ​I think this is exactly what I want! The binomial error treatment is
>     > important for this analysis as the efficiencies tend towards 1.0 in some
>     > parts of phase space.​ What is the appropriate class called?
> 
>     It's a function rather than a bound method (so call it as above):
> 
>     https://yoda.hepforge.org/trac/browser/include/YODA/Histo1D.h#L426
> 
>     We don't yet have the equivalent for 2D histos, but it should be trivial
>     to put together from the 1D version. I'll add that to my TODO list, but
>     maybe someone else fancies doing it? ;-)
> 
> 
> ​Ah OK. That makes sense. Presumably I still need to book it somehow to
> get it written out? Is there another method to register existing YODA
> objects? Or can the bookScatter2D() function accept an existing
> Scatter2D as it's argument (instead of a bin descriptor)?

Good points -- I should provide helper methods for doing this in Rivet,
with automatic registration of the output Scatter, like we have for
YODA's divide(h_a,h_b) -> Rivet's divide(h_a,h_b,s_out). I'll add those
to the 2.2.0 release candidate.

For now I think you can use addAnalysisObject(aoptr) to register any
YODA analysis object. But it's made a little fiddly because YODA returns
a stack-allocated object and what is needed is a new'd heap object. You
might need to do

Scatter2D s = efficiency(*tmph1, *tmph2);
s.setPath(histoPath("foo"));
addAnalysisObject(s.newclone());

or similar. It's not very pretty, which is why I should provide the
cosmetic wrapper functions.

Andy

-- 
Dr Andy Buckley, Royal Society University Research Fellow
Particle Physics Expt Group, University of Glasgow / PH Dept, CERN


More information about the Rivet mailing list