Reading values from a file

Many of the distributions described below need to read the data from a file. The parameter

/gamos/setParam DISTRIBUTION_NAME:FileName FILE_NAME

defines the name of the file that contains the distribution data. This file is a two column set of values, where the first column gives the input values (x) and the second the output values (y). After being read the input values are ordered in increasing order. To calculate the output value corresponding to an input value, each distribution uses its own algorithm, see below. If the input value is smaller than the minimum value in the file or bigger than the maximum value, an exception will be thrown, as the value cannot be calculated.

It is also possible to read the data from a histogram in ROOT or CSV format. In this case an extra parameter has to be provided to set the name of the histogram:

/gamos/setParam DISTRIBUTION_NAME:HistoName HISTO_NAME

The input values are taken as the centres of the histogram bins. The minimum and maximum values read are extended to the lower and upper edge of the histogram axis, i.e. minux and plus half a bin. If the input value is between this minimum and the lowest bin centre, the output is interpolated using the lowest and second lowest bins. Similarly for values between the maximum and the highest bin centre.

The type of the file will be automatically determined from the file name: if it ends by .csv it will be taken as a CSV format histogram file, if it ends by .root it will be taken as a ROOT format histogram file, else it will be taken as a text file. If you do not want to follow this convention then you have to set the file type explicitly by using the parameters:

/gamos/setParam DISTRIBUTION_NAME:FileNameCSV FILE_NAME

/gamos/setParam DISTRIBUTION_NAME:FileNameROOT FILE_NAME