[Rivet] Plot multiple histograms from one yoda on same canvas

Chris Pollard cpollard at cern.ch
Mon Mar 9 13:56:16 GMT 2015


Hi Christian,

What I usually do in this situation is to split the .yoda file into several
files, then call rivet-cmphistos or rivet-mkhtml on all files at once. I've
put a small skeleton of python code in the post script. Hopefully it is
clear what needs to be filled in by you, but please let me know if there
are questions.

Chris

import yoda
from sys import stdout, argv

# dictionary of paths (keys) and analysis objects (values)
aodict = yoda.core.read(argv[0], True)

yfiledict = {}
for k, ao in aodict.iteritems():
    # TODO
    # decide which file (fname) this analysis object goes into
    # alter the analysis object path according to the plots you want to make
    # (objects with the same path will be plotted together by
rivet-cmphistos)

    if fname in yfiledict:
        yfiledict[fname].append(ao)
    else:
        yfiledict[fname] = [ao]

    continue

# loop over outfiles and store objects
for fname, aos in yfiledict.iteritems():
    yoda.write(aos, fname)

On Fri, Mar 6, 2015 at 10:18 PM, Christian Johnson <
christian.johnson at cern.ch> wrote:

> Hi Rivet team,
>
> I have a feature request. There may already be a method for this, if so
> then please let me know.
>
> I have run into a few occasions where it is useful to compare several
> plots from the same yoda file (e.g. control region distribution comparison,
> etc…) on the same canvas. I have not been able to figure out a simple way
> to do this other than building the “*.dat” file myself and then using
> make-plots. I am sure there is an easier way using the YODA framework.
>
> Cheers,
> Christian Johnson
> _______________________________________________
> Rivet mailing list
> Rivet at projects.hepforge.org
> https://www.hepforge.org/lists/listinfo/rivet
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150309/e3196121/attachment.html>


More information about the Rivet mailing list