13 How to include user-defined histograms

The easiest, just load any ``RMC'' project from ``archive'' directory using ``RMC project - open RMC''. You will see changes in ``proj'' directory, and can study functions copied from RMC. Below are some additional details:

You can include additional histograms in a few steps: Go to the user project directory, ``proj'', and edit ``user-name.txt'' file. You have to put the line:


Variable description of this variable


The variable names should be defined as following:

Once you defined the title of your calculation, put the description of the calculation after a space. You can put up to 500 histogram definitions. Each definition should be on a new line.

There are a few types of histograms:

  1. A histogram for a value characterizing the entire event. You have to define the variable ``*getval'' (the star in front is important!) to do this in the function ``user_afill.cpp''. It is very important that the name in ``if'' statement of this function should match the histogram name in ``user-name.txt''. You can include as many calculations as you like, but they all should be included using ``if-else'' statements.

  2. A histogram representing a variable for each particle. Do this exactly as before, only specify particle counting number in your variable in ``user_afill.cpp'' function. See examples in the RMC files. The title of a calculation should contain ``@'' as explained above.

  3. A histogram for each particle pair. Do this exactly as before, but specify additional 2 arguments in this variable representing particle number in ``user_afill.cpp'' function. The name of the calculation should contain ``@@'' as explained above.

  4. A histogram for each jet. In this case use additional variable ``jet'' string in ``if'' statement of the function ``user_afill.cpp''.

When you did this, you have to recompile the project, type ``make clean'' and then ``make''.

You can find a number of examples in ``main/src/afill.cpp''. You should not modify this file. Better, load one of the physics projects from ``archive'' as described before.

Note that the name convention described above is not needed when a user fills the histograms in ``user-run.cpp'' file. See ``par-had-jetLHC.rmc'' project. In this example, the final state and well as histograms are filled without using RunMC directly. In addition, user can initialize the calculations in ``user-init.cpp''

If you now save the project as ``File - save MC'', you will see that your histograms are added to the end of the file ``project.mc''.

In total, 500 histograms can be included to your project. Instead of using the spreadsheet ``Histograms'', one can use any your favourite editor and correct the file ``project.mc''. Go to the end of this file. For each new histogram, you need to add 2 lines:

H-NAME ``Name of the histogram'' ``comment or definition'' H-INFO ``Dimension'' Xmin Xmax ``No of bins'' ``weight''

where ``Dimension'' means ``1'' or ``2'', i.e. 1D or 2D histogram, Xmin and Xmax are the minimum and maximum values for histogram, and ``No of bins'' is the number of bins (should be always integer). Xmin and Xmax, weight are real numbers. Note: do not use more than 20 characters to for the title of your histogram.

If you want to use ``2D'' histograms, set ``2'' after ``H-INFO''. The number of histogram with this option should be always even, otherwise RunMC will fail to calculate how many 2D histograms you want and will report an error.

You can also change any option in ``project.mc'' by hand. To learn about this, use RunMC GUI and study what it does when you create the ``project.mc'' file.