rivet is hosted by Hepforge, IPPP Durham
close Warning: Can't synchronize with repository "(default)" (Repository path '/hepforge/hg/rivet/public/rivet' does not exist.). Look in the Trac log for more information.

Changes between Version 15 and Version 16 of FirstRivetRun


Ignore:
Timestamp:
Mar 15, 2016, 2:38:38 PM (5 years ago)
Author:
Andy Buckley
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FirstRivetRun

    v15 v16  
    11= Your first Rivet run =
    22
    3 So, we assume you've got Rivet installed and that the {{{rivet}}} command is available in your executable {{{$PATH}}}. Now it's time to run some events, make some analysis data, and plot the results...
     3So, we assume you've got Rivet installed and that the {{{rivet}}} command is available in your executable path (i.e. the {{{$PATH}}} environment variable). Now it's time to run some events, make some analysis data, and plot the results.
    44
    55
     
    77
    88The main interface to Rivet is the {{{rivet}}} command. We will demonstrate how to use this to analyse HepMC events from a text file in the "IO_GenEvent" HepMC format.
    9 (This is the only supported HepMC text format from HepMC 2.5 onwards.)
    109
    1110Firstly, we recommend using a named pipe (or 'FIFO') so that your events
    1211don't create a huge file that takes all your disk space. The idea is that the
    13 generator will push events into what looks like a file, and Rivet will read from
    14 the same 'file'. In fact, though, the 'file' is a disguised pipe between the two
    15 processes, so no slow filesystem access needs to take place, and the system will
    16 automatically balance the data flow between the writing and reading processes:
    17 the generator will only write more event data when Rivet has read that currently
    18 available in the FIFO buffer. All this is completely transparent to the user:
    19 good old Unix!  Here's how you do it (with a fictional generator command, as an example):
     12generator will push events into what looks like a file, and Rivet will read from it. However, this 'file' is a direct pipe between the two processes (just like the shell pipe in e.g. {{{echo foo | less}}}), so no slow filesystem access needs to take place, no disk space is occupied, and the system will automatically balance the data flow between the writing and reading processes. All this is completely transparent to the user: good old Unix!  Here's how you do it (with a fictional generator command, as an example):
    2013{{{
    2114> mkfifo fifo.hepmc
     
    2316> rivet --analysis=ANALYSIS_NAME fifo.hepmc
    2417}}}
    25 or, for the concrete example of the {{{agile-runmc}}} generator interface command:
    26 {{{
    27 > mkfifo fifo.hepmc
    28 > agile-runmc Pythia6:425 --beams=LHC:7000 -n 500000 -o fifo.hepmc &
    29 > rivet --analysis=ANALYSIS_NAME fifo.hepmc
    30 }}}
    3118
    32 The backgrounding of the generator process is important: the generator will wait
    33 until the {{{fifo.hepmc}}} pipe is being read by Rivet, so unless it is backgrounded
    34 you will never get the terminal focus back to run {{{rivet}}}!
     19The backgrounding of the generator process -- i.e. the {{{&}}} character -- is important: the generator will wait until the {{{fifo.hepmc}}} pipe is being read by Rivet, so unless it is backgrounded you will never get the terminal focus back to run {{{rivet}}}!
    3520
    36 '''WARNING:''' FIFOs don't work on AFS filesystems... this isn't a killer for those of you working on CERN systems like lxplus, it just means that you need to make the FIFO on the local filesystem, e.g. {{{mkfifo /tmp/$USER/fifo.hepmc}}}.
     21'''WARNING:''' FIFOs don't work on AFS filesystems, probably so you don't get confused and think that they will allow you to exchange data between processes on different machines. If you are working on an AFS system, e.g. the home directories on CERN lxplus, you just need to make the FIFO on the local filesystem instead, e.g. {{{mkfifo /tmp/$USER/fifo.hepmc}}}.
    3722
    38 If you have trouble with this FIFO approach, try writing a few -- 10 or so -- events to a normal file and look at the file (e.g. with emacs, less, gedit or any other text editor). If your AGILe command is writing the events to file properly you should have a pure HepMC file consisting of a header, lots of lines starting with a letter (E, P, V in particular) followed by a list of numbers. If you don't see this, or if the HepMC data is intermixed with generator headers or warning messages, something has gone wrong: make sure you are using the {{{-o}}} flag rather than just writing the {{{agile-runmc}}} standard output to file, e.g. with the {{{>}}} shell operator.
    39 
    40 The generator used above can be anything which writes HepMC text output to the
    41 specified FIFO. As a concrete example, the AGILe package
    42 (http://agile.hepforge.org/) provides an interface to several
    43 generators with a command line tool called {{{agile-runmc}}}:
    44 {{{
    45 > agile-runmc Pythia6:423 --beams=TVT:1800 &
    46 > rivet --analysis=CDF_2001_S4751469 hepmc.fifo
    47 }}}
    48 
    49 The {{{agile-runmc}}} and {{{rivet}}} commands both provide extensive command line
    50 documentation when called with the {{{-h}}}/{{{--help}}} flag.
     23If you have trouble with this FIFO approach, try writing a few -- 10 or so -- events to a normal file and look at the file (e.g. with emacs, less, gedit or any other text editor). If your generator is writing the events to file properly your HepMC file should consist of a short header, followed by lots of largely numeric lines starting with a letter (E, P, V in particular). If you don't see this, something has gone wrong "upstream" and you should fix it before blaming the FIFO or Rivet ;-)
    5124
    5225
    5326== Checking the data ==
    5427
    55 By default, Rivet outputs its histograms in the AIDA XML format, which is not
    56 particularly easy to read or plot. An easier format is available if you convert
    57 the AIDA file to a flat text format (the long-term Rivet data format) with the
    58 {{{aida2flat}}} command:
    59 {{{
    60 > aida2flat Rivet.aida | less
    61 }}}
     28By default, Rivet outputs its histograms in the YODA text format. To get a clearer view of the data values in histogram bins, you can use the {{{yoda2flat}}} script, e.g. {{{yoda2flat Rivet.yoda - | less}}}.
    6229
    63 Again, check the {{{aida2flat --help}}} documentation for details on more options.
    64 
    65 There is also an {{{aida2root}}} command which provides the data as ROOT {{{TGraph}}} objects for those of a ROOTy disposition. Due to a ROOT bug, for {{{TGraph}}}s to display properly you will have to specify the {{{"AP"}}} options in the top right-hand box of the ROOT {{{TBrowser}}}, or alternatively draw the {{{TGraph}}} programmatically using {{{myTGraph->Draw("AP")}}}. This ''isn't'' a Rivet bug: it's ROOT forgetting to draw the graph axes!
     30There is also a {{{yoda2root}}} command which provides the data as ROOT histogram (or {{{TGraph}}}) objects for those of a ROOTy disposition. Due to a ROOT bug, you may have to specify the {{{"AP"}}} options in the top right-hand box of the ROOT {{{TBrowser}}}, or alternatively draw the {{{TGraph}}} programmatically using {{{myTGraph->Draw("AP")}}}. This ''isn't'' a Rivet bug!
    6631
    6732
    6833== Plotting ==
    6934
    70 Rivet comes with three commands --- {{{rivet-mkhtml}}}, {{{compare-histos}}} and
    71 {{{make-plots}}} --- for comparing and plotting data files. These commands
     35Rivet comes with three commands --- {{{rivet-mkhtml}}}, {{{compare-histos}}} and {{{make-plots}}} --- for comparing and plotting data files. These commands
    7236produce nice comparison plots of publication quality from the AIDA format text
    7337files.
    7438
    75 The high level program {{{rivet-mkhtml}}} will automatically create a plot
     39The high-level program {{{rivet-mkhtml}}} will automatically create a plot
    7640webpage from the given AIDA files. It searches for reference data automatically
    7741and uses the other two commands internally. Example:
    7842{{{
    79 rivet-mkhtml withUE.aida:'Title=With UE' withoutUE.aida:'LineColor=blue'
     43rivet-mkhtml withUE.yoda:'Title=With UE' withoutUE.yoda:'LineColor=blue'
    8044}}}
    8145Run {{{rivet-mkhtml --help}}} to find out about all features and options.
     
    8549You can also run the other two commands separately:
    8650
    87 {{{compare-histos}}} will accept a number of AIDA files as input (ending in
    88 {{{.aida}}}), identify which plots are available in them, and combine the MC
     51{{{compare-histos}}} will accept a number of YODA files as input (ending in
     52{{{.yoda}}}), identify which plots are available in them, and combine the MC
    8953and reference plots appropriately into a set of plot data files ending with
    9054{{{.dat}}}. More options are described by running {{{compare-histos --help}}}.
    9155
    92 Incidentally, the reference files for each Rivet analysis are to be found in the
    93 installed Rivet shared data directory, {{{installdir/share/Rivet}}}. You
     56Incidentally, the reference files for each Rivet analysis are to be found in the installed Rivet shared data directory, {{{installdir/share/Rivet}}}. You
    9457can find the location of this by using the {{{rivet-config}}} command:
    9558{{{rivet-config --datadir}}}
     
    11376== That's all! ==
    11477
    115 We hope this was useful as a quick guide to getting started with running Rivet's
    116 built-in analyses for Monte Carlo generator validation. Be aware that we will be
    117 overhauling Rivet's histogramming system in version 2.0, and some of this will change... all hopefully in a good way.
     78We hope this was useful as a quick guide to getting started with running Rivet's built-in analyses for Monte Carlo generator validation.
    11879
    11980