xSLHA
is a Mathematica
parser for files written in the SLHA format. It is optimised for fast reading of a large sample of files.
The best way to install the package is to put the file xSLHA.m
into a xSLHA
sub-directory of the applications directory of Mathematica
. Thus,
/home/\$USER/.Mathematica/Applications/xSLHA/
is the best place to store xSLHA.m
. Afterwards, the package can be loaded via
<<xSLHA`
Reading a spectrum file file
and storing the information in a class object spc
is done via the command
spc=xSLHA`Read[file]
The content of the spectrum file is returned on form of a list of replacements. Those can be uses as follows:
Print["tan(beta): ",MINPAR[3]/.spc]
Print["T_u(3,3): ",TU[3,3]/.spc]
Print["m_h [GeV]: ",MASS[25]/.spc]
Print["Gamma(h) [GeV]: ",WIDTH[25]/.spc]
Print["BR(h->W^+W^-): ",BR[25][-13,13]/.spc]
Print["Sigma(pp->N1 N1,Q=8TeV): ",XSECTION[8000,[2212,2212],[1000021,1000021]]/.spc]
this produces the following output
tan(beta): 16.870458
T_u(3,3): 954.867627
m_h [GeV]: 117.758677
Gamma(h) [GeV]: 0.00324670136
BR(h->W^+W^-): 0.000265688227
Sigma(pp->N1 N1,Q=8TeV): {{{0, 2, 0, 0, 0, 0}, 0.00496483158}}
Thus, the conventions are:
- for information given in the different SLHA blocks is returned by using the name of the block as input together with the numbers in the block as list
- the widths of particles are returned via the keyword
WIDHT
and the pdg of the particle - for branching ratios, the keyword
BR
is used together with two sets of arguments which state the pdg of the decaying particle as well as of the final states - for cross-sections the keyword
XSECTION
is used together with a nested list which states the center-of-mass energy and the pdgs of the initial/final states. The result is a list containing all calculated cross-sections for the given options for the renormalisation scheme, the QED & QCD order, etc. (see the SLHA recommendations for details).
In order to read several spectrum files located in a directory dir
, one can make use of the command
ListSpc=xSLHA`ReadDir[dir]
This generates a list ListSpc
where each entry corresponds to one spectrum. Thus, one can for instance use
{MINPAR[1],MASS[25]}/. ListSpc
to extract the input for a 2D-scatter plot.
Reading many spectrum files can be time consuming. However, many of the information which is given in a SLHA file is often not needed for a current study. Therefore, one can speed up the reading by extracting first all relevant information. This generates smaller files which are faster to read in. This can be done via the optional argument entries
for ReadDir
:
ListSpcFast=xSLHA`ReadDir["/home/$USER/Documents/spc1000",entries={"# m0","# m12","# hh_1"}]`
entries
defines a list of strings which can be used to extract the necessary lines from the SLHA file by using grep
. The speed improvement can be easily an order of magnitude if only some entries from a SLHA file are actually needed.
The impact of this optimisation for reading 1000 files is as follows:
Timing[
ListSPC = xSLHA`ReadDir["/home/fnstaub/Desktop/TempSLHA/"];
]
{158.996, Null}
compared to
Timing[
ListSPC =
xSLHA`ReadDir["/home/fnstaub/Desktop/TempSLHA/",
entries -> {"# m0", "# m12", "# hh_1"}];
]
{6.48319, Null}
Another common approach for saving spectrum files is to produce one huge file in which the different spectra are separated by a keyword. xSLHA
can read such files by setting the optional argument separator
for Read
:
listSPC=xSLHA`Read[file,separator->string]
In order to speed up the reading of many spectra also in this case, it is possible to define the entries as well which are need:
listSPC=xSLHA`ReadSmall[file,separator->string,entries->list]
In this casexSLHA
will produce first a smaller spectrum file using cat
and grep
. For instance, in order to read efficiently files produced with SSP
, one can use:
listSPC=xslha`ReadSmall["SpectrumFiles.spc",separator->"ENDOFPARAMETERFILE",entries->{"# m0", "# m12", "# hh_1"}]
There are some programs which use blocks that are not supported by the official SLHA conventions:
HiggsBounds
expects the effective coupling ratios in blocksHIGGSBOUNDSINPUTHIGGSCOUPLINGSBOSONS
andHIGGSBOUNDSINPUTHIGGSCOUPLINGSFERMIONS
which are differently order compared to other blocks (first the numerical entries are stated before the PDGs of the involved particles follow)SPheno
version generated bySARAH
can calculate one-loop corrections to the decays. The results are given in the blocksDECAY1L
which appear in parallel toDECAY
containing the standard calculation.xSLHA
will distinguish these cases when reading the file and offer the two following options forValues
in addition:
WIDTH1L[1000022] /.spc
BR1L[1000023][25,1000022] /.spc