[Rivet] Question about YODA plotting only some histos based on regular expression

Adrian Buzatu Adrian.Buzatu at glasgow.ac.uk
Sat Jun 6 16:50:08 BST 2015


Dear Rivet, YODA authors,

I am using Rivet and YODA. I create many histograms (on the order of 400) and creating the .pdf plots for the .dat aabout 10 minutes. As I fine tune the YMin and YMax ranges, I want to be able to test it easily. In short, I want to be able to plot only one or a few histograms instead of them all. I find two potential solutions, but I have questions for both.

1.
rivet-mkhtml ${RIVET_OUTPUT_FILE} -c ${RIVET_ANALYSIS}.plot -m counter*
I see in rivet-mkhtml that -m and -M allow for a regular expression of the histogram. However, this does not work for me. The documentation says
  -m PATHPATTERNS, --match=PATHPATTERNS
                        only write out histograms from analyses whose name
                        matches any of these regexes
  -M PATHUNPATTERNS, --unmatch=PATHUNPATTERNS
                        Exclude histograms whose $path/$name string matches
                        these regexes
There is an inconsistency between the two options, one says name, the other says $path/$name
I tried all options but could not find one that works.
My plots get saved in plots/RivetHbbBJets and there .dot files such as
counter_El.dat
h1D_3_ResponsePtCalMuNuMu.dat
I would like to keep only those with "counter_" in the name for example, or remove those with "counter_" in the name.

2. I found in a Rivet tutorial online by Andy Buckley (which I found very useful, by the way) that I can replace the rivet-mkhtml command with two commands:
# here make all the .dat files (it works)
rivet-cmphistos ${RIVET_OUTPUT_FILE} -o plots --hier-out
# here create only the histograms that I want (it works, so regular expressions work here)
make-plots ./plots/RivetHbbBJets/*counter*.dat --pdfpng
# but then we want one more step, that of making the index.html that has all the plots in one webpage. How is that done in a new command as well? I tried this again, but it did not work.
rivet-mkhtml ${RIVET_OUTPUT_FILE} -c ${RIVET_ANALYSIS}.plot -m counter*
It only creates an index.html in plots, but not in plots/RivetHbbBJets

I create a similar script myself in bash, but it would be useful if it would provided in a simple form (presumably in python for consistency) by Rivet/Yoda.
#!/bin/bash

if [ $# -ne 1 ]; then
cat <<EOF
Usage: $0 Folder
Usage: $0 afs/phas.gla.ac.uk/user/a/abuzatu/public_ppe/RivetHbbBJets
EOF
exit 1
fi

FOLDER=$1
INDEX_FILE="index.html"

# go to the folder that has the files
pushd ${FOLDER}

rm -f ${INDEX_FILE}

for FILE in `ls -1 *.pdf`
do
    STEM=${FILE%.*}
    echo "<br> ${STEM} <br>" >> ${INDEX_FILE}
    echo "<br> <a href=\"./${STEM}.pdf\"> <img src=\"./${STEM}.png\" alt=\"Mountain View\"> </a> <br>" >> ${INDEX_FILE}
done

# return to folde r when we run from
popd

exit

The way to run everything in step 2:
#RIVET_INPUT_FILE="${RIVET_INPUT_FILE_PATH}/ZHvvbb_1000000.hepmc"
#RIVET_INPUT_FILE="${RIVET_INPUT_FILE_PATH}/ZHvvbb_3000000.nobias.hepmc"
RIVET_INPUT_FILE="${RIVET_INPUT_FILE_PATH}/ZHvvbb_3000000.ptbias.hepmc"
RIVET_OUTPUT_FILE="./yoda/ZHvvbb.yoda"
RIVET_ANALYSIS="RivetHbbBJets"
RIVET_PLOTS_FOLDER="/afs/phas.gla.ac.uk/user/a/abuzatu/public_html/${RIVET_ANALYSIS}"

RIVET_RUN="rivet --pwd -a ${RIVET_ANALYSIS} ${RIVET_INPUT_FILE} -H ${RIVET_OUTPUT_FILE} -n 100 --histo-interval=10000 " #-l Rivet.Analysis=DEBUG -v "
RIVET_MKHTML="rivet-mkhtml ${RIVET_OUTPUT_FILE} -c ${RIVET_ANALYSIS}.plot --mc-errs -M \"./plots/RivetHbbBJets/counter_lepton.dat\"' " # -n 8 -v
RIVET_CMPHISTOS="rivet-cmphistos ${RIVET_OUTPUT_FILE} -o plots --hier-out"
MAKE_PLOTS="make-plots ./plots/${RIVET_ANALYSIS}/counter*.dat --pdfpng -n 4"
MAKE_HTML="./make_html.sh ${RIVET_PLOTS_FOLDER}"

`echo ${RIVET_CMPHISTOS}`
`echo ${MAKE_PLOTS}`
rm -rf ${RIVET_PLOTS_FOLDER}
mkdir -p ${RIVET_PLOTS_FOLDER}
mv ./plots/${RIVET_ANALYSIS}/*.png ${RIVET_PLOTS_FOLDER}/.
mv ./plots/${RIVET_ANALYSIS}/*.pdf ${RIVET_PLOTS_FOLDER}/.
`echo ${MAKE_HTML}`

Thank you,
Adrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150606/9cf98dac/attachment.html>


More information about the Rivet mailing list