tools package

Submodules

tools.asciiGraph module

tools.asciiGraph.asciidraw(sms, labels=True, html=False, border=False)[source]

Draw a simple ASCII graph on the screen.

tools.caching module

class tools.caching.Cache[source]

Bases: object

a class for storing results from interpolation

static add(key, value)[source]
n_stored = 1000
static reset()[source]

completely reset the cache

static size()[source]

tools.coverage module

class tools.coverage.FinalStateSMS(sms, missingX=None, smFinalStates=[W, l, t, ta, nu, jet], bsmFinalStates=[MET, HSCP, RHadronG, RHadronQ])[source]

Bases: TheorySMS

This class represents a simplified SMS which only holds information about the final states. It holds a simple tree with one root (PV), having the final state nodes as its daughters.

Initialize basic attributes.

compressToFinalStates(sms)[source]

Compress the SMS subtrees generated by the primary mothers. After the compression the SMS will contain the primary mothers with direct edges to its final states. Returns a compressed copy of sms.

Parameters

sms – SMS object

oldStr()[source]

Generates a string using the old format (bracket notaion), if possible. For non Z2-like SMS, return the process string.

Returns

string representation of the SMS (in bracket notation)

class tools.coverage.Uncovered(topDict, sqrts=None, sigmacut=0.00E+00 [fb], groupFilters={'missing (all)': <function <lambda>>, 'missing (displaced)': <function <lambda>>, 'missing (prompt)': <function <lambda>>, 'outsideGrid (all)': <function <lambda>>}, groupFactors={'missing (all)': <function <lambda>>, 'missing (displaced)': <function <lambda>>, 'missing (prompt)': <function <lambda>>, 'outsideGrid (all)': <function <lambda>>}, groupdDescriptions={'missing (all)': 'missing topologies', 'missing (displaced)': 'missing topologies with displaced decays', 'missing (prompt)': 'missing topologies with prompt decays', 'outsideGrid (all)': 'topologies outside the grid'}, smFinalStates=[W, l, t, ta, nu, jet], bsmFinalStates=[MET, HSCP, RHadronG, RHadronQ])[source]

Bases: object

Wrapper object for defining and holding a list of coverage groups (UncoveredGroup objects).

The class builds a series of UncoveredGroup objects and stores them.

Inititalize the object.

Parameters
  • topDict – TopologyDict object used to select SMS from.

  • sqrts – Value (with units) for the center of mass energy used to compute the missing cross sections. If not specified the largest value available will be used.

  • sigmacut – Minimum cross-section/weight value (after applying the reweight factor) for an SMS to be included. The value should in fb (unitless)

  • groupFilters – Dictionary containing the groups’ labels and the method for selecting SMS.

  • groupFactors – Dictionary containing the groups’ labels and the method for reweighting cross sections.

  • groupdDescriptions – Dictionary containing the groups’ labels and strings describing the group (used for printout)

  • smFinalStates – List of (inclusive) Particle or MultiParticle objects used for grouping SM particles when creating FinalStateSMS.

  • bsmFinalSates – List of (inclusive) Particle or MultiParticle objects used for grouping BSM particles when creating FinalStateSMS.

getGroup(label)[source]

Returns the group with the required label. If not found, returns None.

Parameters

label – String corresponding to the specific group label

Returns

UncoveredGroup object which matches the label

class tools.coverage.UncoveredGroup(label, smsFilter, reweightFactor, smFinalStates, bsmFinalStates, sqrts, sigmacut=0.0)[source]

Bases: object

Holds information about a single coverage group: criteria for selecting and grouping SMS, function for reweighting cross sections, etc.

Parameters
  • label – Group label

  • smsFilter – Function which takes an SMS as argument and returns True (False) if the SMS should (not) be selected.

  • reweightFactor – Function which takes an SMS as argument and returns the reweighting factor to be applied to the SMS weight.

  • smFinalStates – List of Particle/MultiParticle objects used to group Z2-even particles appearing in the final state

  • bsmFinalStates – List of Particle/MultiParticle objects used to group Z2-odd particles appearing in the final state

  • sqrts – Value (with units) for the center of mass energy used to compute the missing cross sections. If not specified the largest value available will be used.

  • sigmacut – Minimum cross-section/weight value (after applying the reweight factor) for an SMS to be included. The value should in fb (unitless)

addToFinalStateSMS(sms, missingX)[source]

Adds an SMS to the list of missing topologies = final state SMS. If the SMS contributes to an SMS that is already in the list, add SMS and weight to the SMS. :parameter sms: SMS object to be added :parameter missingX: missing cross-section for the SMS (in fb)

getMissingX(sms)[source]

Calculate total missing cross section of an SMS, by recursively checking if its mothers already appear in the list. :param sms: SMS object

Returns

missing cross section without units (in fb)

getSMSFrom(topDict)[source]

Select the SMS from topDict according to self.smsFilter and build FinalStateSMS from the selected SMS. The FinalStateSMS weights corresponds to the missing cross-section with double counting from compressed SMS already accounted for.

getTotalXSec(sqrts=None)[source]

Calculate total missing topology cross section at sqrts. If no sqrts is given use self.sqrts :ivar sqrts: sqrts

tools.crashReport module

class tools.crashReport.CrashReport[source]

Bases: object

Class that handles all crash report information.

createCrashReportFile(inputFileName, parameterFileName)[source]

Create a new SModelS crash report file.

A SModelS crash report file contains:

  • a timestamp

  • SModelS version

  • platform information (CPU architecture, operating system, …)

  • Python version

  • stack trace

  • input file name

  • input file content

  • parameter file name

  • parameter file content

Parameters
  • inputFileName – relative location of the input file

  • parameterFileName – relative location of the parameter file

createUnknownErrorMessage()[source]

Create a message for an unknown error.

tools.crashReport.createStackTrace()[source]

Return the stack trace.

tools.crashReport.readCrashReportFile(crashReportFileName)[source]

Read a crash report file to use its input and parameter file sections for a SModelS run.

Parameters

crashReportFileName – relative location of the crash report file

tools.databaseBrowser module

class tools.databaseBrowser.Browser(database, force_txt=False)[source]

Bases: object

Browses the database, exits if given path does not point to a valid smodels-database. Browser can be restricted to specified run or experiment.

Parameters
  • force_txt – If True forces loading the text database.

  • database – Path to the database or Database object

getAttributes(showPrivate=False)[source]

Checks for all the fields/attributes it contains as well as the attributes of its objects if they belong to smodels.experiment.

Parameters

showPrivate – if True, also returns the protected fields (_field)

Returns

list of field names (strings)

getEfficiencyFor(expid, dataset, txname, massarray)[source]

Get an efficiency for the given experimental id, the dataset name, the txname, and the massarray. Can only be used for EfficiencyMap-type experimental results. Interpolation is done, if necessary.

Parameters
  • expid – experimental id (string)

  • dataset – dataset name (string)

  • txname – txname (string).

  • massarray – list of masses with units, e.g. [[ 400.*GeV, 100.*GeV],[400.*GeV, 100.*GeV]]

Returns

efficiency

getULFor(expid, txname, massarray, expected=False)[source]

Get an upper limit for the given experimental id, the txname, and the massarray. Can only be used for UL experimental results. Interpolation is done, if necessary.

Parameters
  • expid – experimental id (string)

  • txname – txname (string). ONLY required for upper limit results

  • massarray – list of masses with units, e.g. [[ 400.*GeV, 100.*GeV],[400.*GeV, 100.*GeV]]

  • expected – If true, return expected upper limit, otherwise return observed upper limit.

Returns

upper limit [fb]

getULForSR(expid, datasetID)[source]

Get an upper limit for the given experimental id and dataset (signal region). Can only be used for efficiency-map results. :param expid: experimental id (string) :param datasetID: string defining the dataset id, e.g. ANA5-CUT3. :return: upper limit [fb]

getValuesFor(attribute, expResult=None)[source]

Returns a list for the possible values appearing in the database for the required attribute (sqrts,id,constraint,…).

Parameters
  • attribute – name of a field in the database (string).

  • expResult – if defined, restricts the list to the corresponding expResult. Must be an ExpResult object.

Returns

list of values

loadAllResults()[source]

Saves all the results from database to the _selectedExpResults. Can be used to restore all results to _selectedExpResults.

selectExpResultsWith(**restrDict)[source]

Loads the list of the experimental results (pair of InfoFile and DataFile) satisfying the restrictions to the _selectedExpResults. The restrictions specified as a dictionary.

Parameters

restrDict – selection fields and their allowed values. E.g. lumi = [19.4/fb, 20.3/fb], txName = ‘T1’,….} The values can be single entries or a list of values. For the fields not listed, all values are assumed to be allowed.

tools.databaseBrowser.main(args)[source]

IPython interface for browsing the Database.

tools.databaseClient module

class tools.databaseClient.DatabaseClient(servername=None, port=None, verbose='info', rundir='./', logfile='@@rundir@@/dbclient.log', clientid=-1)[source]

Bases: object

clearCache()[source]
findServerStatus()[source]
getWaitingTime()[source]

compute a waiting time between attempts, from self.ntries

initialize()[source]
log(*args)[source]
nameAndPort()[source]
pprint(*args)[source]
query(msg)[source]

query a certain result, msg is eg. obs:ATLAS-SUSY-2016-07:ul:T1:[[5.5000E+02,4.5000E+02],[5.5000E+02,4.5000E+02]]

saveStats()[source]
send(message, amount_expected=32)[source]

send the message. :param amount_expected: how many return bytes do you expect

send_shutdown()[source]

send shutdown request to server

setDefaults()[source]

put in some defaults if data members dont exist

tools.databaseClient.stresstest(args)[source]

this is one process in the stress test

tools.databaseServer module

class tools.databaseServer.DatabaseServer(dbpath, servername=None, port=None, verbose='info', rundir='./', logfile='@@rundir@@/dbserver.log')[source]

Bases: object

finish()[source]
initialize()[source]
is_port_in_use(port)[source]

check if port is in use

listen()[source]
log(*args)[source]
logServerStats()[source]

log our stats upon exit

lookUpResult(data)[source]
parseData(data)[source]

parse the data packet

pprint(*args)[source]
run(nonblocking=False)[source]

run server :param nonblock: run in nonblocking mode (not yet implemented)

setStatus(status)[source]

servers have a status file that tells us if they are running

shutdown(fromwhere='unknown')[source]
tools.databaseServer.shutdownAll()[source]

tools.externalPythonTools module

class tools.externalPythonTools.ExternalPythonTool(importname, optional=False)[source]

Bases: object

An instance of this class represents the installation of a python package. As it is python-only, we need this only for installation, not for running (contrary to nllfast or pythia).

Initializes the ExternalPythonTool object. Useful for installation. :params optional: optional package, not needed for core SModelS.

checkInstallation()[source]

The check is basically done in the constructor

compile()[source]
installDirectory()[source]

Just returns the pythonPath variable

pathOfExecutable()[source]

Just returns the pythonPath variable

tools.interactivePlots module

tools.interactivePlotsHelpers module

tools.ioObjects module

class tools.ioObjects.FileStatus[source]

Bases: object

Object to run several checks on the input file. It holds an LheStatus (SlhaStatus) object if inputType = lhe (slha)

checkFile(inputFile)[source]

Run checks on the input file.

Parameters

inputFile – path to input file

class tools.ioObjects.LheStatus(filename)[source]

Bases: object

Object to check if input lhe file contains errors.

Variables

filename – path to input LHE file

evaluateStatus()[source]

run status check

class tools.ioObjects.OutputStatus(status, inputFile, parameters, databaseVersion)[source]

Bases: object

Object that holds all status information and has a predefined printout.

Initialize output. If one of the checks failed, exit.

Parameters
  • status – status of input file

  • inputFile – input file name

  • parameters – input parameters

  • databaseVersion – database version (string)

addWarning(warning)[source]

Append warning to warnings.

Parameters

warning – warning to be appended

updateSLHAStatus(status)[source]

Update SLHA status.

Parameters

status – new SLHA status flag

updateStatus(status)[source]

Update status.

Parameters

status – new status flag

class tools.ioObjects.SlhaStatus(filename, findMissingDecayBlocks=True, findIllegalDecays=False, checkXsec=True)[source]

Bases: object

An instance of this class represents the status of an SLHA file. The output status is: = 0 : the file is not checked, = 1: the check is ok = -1: case of a physical problem, e.g. charged LSP, = -2: case of formal problems, e.g. no cross sections

Parameters
  • filename – path to input SLHA file

  • findMissingDecayBlocks – if True add a warning for missing decay blocks

  • findIllegalDecays – if True check if all decays are kinematically allowed

  • checkXsec – if True check if SLHA file contains cross sections

  • findLonglived – if True find stable charged particles and displaced vertices

emptyDecay(pid)[source]

Check if any decay is missing for the particle with pid

Parameters

pid – PID number of particle to be checked

Returns

True if the decay block is missing or if it is empty, None otherwise

evaluateStatus()[source]

Get status summary from all performed checks.

Returns

a status flag and a message for explanation

findIllegalDecay(findIllegal)[source]

Find decays for which the sum of daughter masses excels the mother mass

Parameters

findIllegal – True if check should be run

Returns

status flag and message

findMissingDecayBlocks(findMissingBlocks)[source]

For all non-SMpdgs particles listed in mass block, check if decay block is written

Returns

status flag and message

hasXsec(checkXsec)[source]

Check if XSECTION table is present in the slha file.

Parameters

checkXsec – set True to run the check

Returns

status flag, message

read()[source]

Get pyslha output object.

tools.lheChecks module

tools.lheChecks.main(args)[source]

tools.nllFastWrapper module

class tools.nllFastWrapper.NllFastWrapper(sqrts, nllfastVersion, testParams, testCondition)[source]

Bases: WrapperBase

An instance of this class represents the installation of nllfast.

Parameters
  • sqrts – sqrt of s, in TeV, as an integer,

  • nllfastVersion – version of the nllfast tool

  • testParams – what are the test params we need to run things with?

  • testCondition – the line that should be the last output line when running executable

SrcPath

the path of the source code, for compilation

getKfactorsFor(pIDs, slhafile, pdf='cteq')[source]

Read the NLLfast grid and returns a pair of k-factors (NLO and NLL) for the PIDs pair.

Returns

k-factors = None, if NLLfast does not contain the process; uses the slhafile to obtain the SUSY spectrum.

class tools.nllFastWrapper.NllFastWrapper13[source]

Bases: NllFastWrapper

An instance of this class represents the installation of nllfast 8.

Parameters
  • sqrts – sqrt of s, in TeV, as an integer,

  • nllfastVersion – version of the nllfast tool

  • testParams – what are the test params we need to run things with?

  • testCondition – the line that should be the last output line when running executable

SrcPath

the path of the source code, for compilation

class tools.nllFastWrapper.NllFastWrapper7[source]

Bases: NllFastWrapper

An instance of this class represents the installation of nllfast 7.

Parameters
  • sqrts – sqrt of s, in TeV, as an integer,

  • nllfastVersion – version of the nllfast tool

  • testParams – what are the test params we need to run things with?

  • testCondition – the line that should be the last output line when running executable

SrcPath

the path of the source code, for compilation

class tools.nllFastWrapper.NllFastWrapper8[source]

Bases: NllFastWrapper

An instance of this class represents the installation of nllfast 8.

Parameters
  • sqrts – sqrt of s, in TeV, as an integer,

  • nllfastVersion – version of the nllfast tool

  • testParams – what are the test params we need to run things with?

  • testCondition – the line that should be the last output line when running executable

SrcPath

the path of the source code, for compilation

tools.printerTools module

tools.printerTools.formatNestedDict(outputDict, ident=0, maxLength=50)[source]

Convert a nested dictionary to a string with identation.

Parameters
  • outputDict – Dictionary to be printed

  • ident – Current identation

  • maxLength – Maximum length allowed without identation

return: String with formatted output

tools.printerTools.formatNestedList(outputList, ident=0, maxLength=50)[source]

Convert a nested list to a string with identation.

Parameters
  • outputList – List to be formatted

  • ident – Current identation

  • maxLength – Maximum length allowed without identation

return: String with formatted output

tools.printerTools.getInfoFromPython(output)[source]

Retrieves information from the python output

Parameters

output – output (dictionary)

Returns

list of r-values,r-expected and analysis IDs. None if no results are found. If there are results for combined analyses, returns the largest r-value and the corresponding r-expected from the combination.

tools.printerTools.getInfoFromSLHA(output)[source]

Retrieves information from the SLHA output

Parameters

output – output (string)

Returns

list of r-values,r-expected and analysis IDs. None if no results are found. If there are results for combined analyses, returns the largest r-value and the corresponding r-expected from the combination.

tools.printerTools.getInfoFromSummary(output)[source]

Retrieves information from the summary output

Parameters

output – output (string)

Returns

list of r-values,r-expected and analysis IDs. None if no results are found. If there are results for combined analyses, returns the largest r-value and the corresponding r-expected from the combination.

tools.printerTools.getScanSummaryFrom(output, ptype)[source]

Retrieves information about the output according to the printer type (slha,python or summary)

Parameters
  • output – output (dictionary for ptype=python or string for ptype=slha/summary)

  • ptype – Printer type (slha, python or summary)

Returns

Dictionary with the output information

tools.printerTools.printScanSummary(outputDict, outputFile)[source]

Method for creating a simple summary of the results when running SModelS over multiple files.

Parameters
  • outputDict – A dictionary with filenames as keys and the master printer flush dictionary as values.

  • outputFile – Path to the summary file to be written.

tools.pythia6Wrapper module

class tools.pythia6Wrapper.Pythia6Wrapper(configFile='<install>/smodels/etc/pythia.card', executablePath='<install>/smodels/lib/pythia6/pythia_lhe', srcPath='<install>/smodels/lib/pythia6/')[source]

Bases: WrapperBase

An instance of this class represents the installation of pythia6. nevents keeps track of how many events we run. For each event we only allow a certain computation time: if self.secondsPerEvent * self.nevents > CPU time, we terminate Pythia.

Parameters
  • configFile – Location of the config file, full path; copy this file and provide tools to change its content and to provide a template

  • executablePath – Location of executable, full path (pythia_lhe)

  • srcPath – Location of source code

checkFileExists(inputFile)[source]

Check if file exists, raise an IOError if it does not.

Returns

absolute file name if file exists.

replaceInCfgFile(replacements={'NEVENTS': 10000, 'SQRTS': 8000})[source]

Replace strings in the config file by other strings, similar to setParameter.

This is introduced as a simple mechanism to make changes to the parameter file.

Parameters

replacements – dictionary of strings and values; the strings will be replaced with the values; the dictionary keys must be strings present in the config file

run(slhafile, lhefile=None, unlink=True)[source]

Execute pythia_lhe with n events, at sqrt(s)=sqrts.

Parameters
  • slhafile – input SLHA file

  • lhefile – option to write LHE output to file; if None, do not write output to disk. If lhe file exists, use its events for xsecs calculation.

  • unlink – Clean up temp directory after running pythia

Returns

List of cross sections

setParameter(param='MSTP(163)', value=6)[source]

Modifies the config file, similar to .replaceInCfgFile.

It will set param to value, overwriting possible old values.

Remove temporary files.

Parameters

unlinkdir – remove temp directory completely

tools.pythia8Wrapper module

class tools.pythia8Wrapper.Pythia8Wrapper(configFile='<install>/smodels/etc/pythia8.cfg', executablePath='<install>/smodels/lib/pythia8/pythia8.exe', srcPath='<install>/smodels/lib/pythia8/')[source]

Bases: WrapperBase

An instance of this class represents the installation of pythia8.

Parameters
  • configFile – Location of the config file, full path; copy this file and provide tools to change its content and to provide a template

  • executablePath – Location of executable, full path (pythia8.exe)

  • srcPath – Location of source code

checkFileExists(inputFile)[source]

Check if file exists, raise an IOError if it does not.

Returns

absolute file name if file exists.

checkInstallation(compile: bool = True)[source]

Checks if installation of tool is correct by looking for executable and executing it. If check is False and compile is True, then try and compile it.

Returns

True, if everything is ok

chmod()[source]

chmod 755 on pythia executable, if it exists. Do nothing, if it doesnt exist.

getPythiaVersion()[source]

obtain the pythia version we wish to use, stored in file ‘pythiaversion’

getXmldoc()[source]

get the content of xml.doc

run(slhaFile, lhefile=None, unlink=True)[source]

Run pythia8.

Parameters
  • slhaFile – SLHA file

  • lhefile – option to write LHE output to file; if None, do not write output to disk. If lhe file exists, use its events for xsecs calculation.

  • unlink – clean up temporary files after run?

Returns

List of cross sections

Remove temporary files.

Parameters

unlinkdir – remove temp directory completely

tools.pythia8particles module

tools.runSModelS module

tools.runSModelS.main()[source]
tools.runSModelS.run(inFile, parameterFile, outputDir, db, timeout, development)[source]

Provides a command line interface to basic SModelS functionalities.

Parameters
  • inFile – input file name (either a SLHA or LHE file) or directory name (path to directory containing input files)

  • parameterFile – File containing the input parameters (default = smodels/etc/parameters_default.ini)

  • outputDir – Output directory to write the results to

  • db – supply a smodels.experiment.databaseObj.Database object, so the database doesn’t have to be loaded anymore. Will render a few parameters in the parameter file irrelevant. If None, load the database as described in parameterFile, If True, force loading the text database.

  • timeout – set a timeout for one model point (0 means no timeout)

  • development – turn on development mode (e.g. no crash report)

tools.slhaChecks module

tools.slhaChecks.main(args)[source]

tools.smodelsTools module

tools.smodelsTools.main()[source]

tools.timeOut module

exception tools.timeOut.NoTime(value=None)[source]

Bases: Exception

The time out exception. Raised when the running time exceeds timeout

class tools.timeOut.Timeout(sec)[source]

Bases: object

Timeout class using ALARM signal.

raise_timeout(*args)[source]

tools.toolBox module

class tools.toolBox.ToolBox[source]

Bases: object

A singleton-like class that keeps track of all external tools. Intended to make installation and deployment easier.

Constructor creates the singleton.

add(instance)[source]

Adds a tool by passing an instance to this method.

checkInstallation(make=False, printit=True, longL=False)[source]

Checks if all tools listed are installed properly, returns True if everything is ok, False otherwise.

compile()[source]

Tries to compile and install tools that are not yet marked as ‘installed’.

get(tool, verbose=True)[source]

Gets instance of tool from the toolbox.

initSingleton()[source]

Initializes singleton instance (done only once for the entire class).

installationOk(ok)[source]

Returns color coded string to signal installation issues.

listOfTools()[source]

Returns a simple list with the tool names.

tools.toolBox.main(args)[source]

tools.wrapperBase module

class tools.wrapperBase.WrapperBase[source]

Bases: object

An instance of this class represents the installation of an external tool.

An external tool encapsulates a tool that is executed via commands.getoutput. The wrapper defines how the tool is tested for proper installation and how the tool is executed.

absPath(path)[source]

Get the absolute path of <path>, replacing <install> with the installation directory.

basePath()[source]

Get the base installation path.

checkInstallation(compile=True)[source]

Checks if installation of tool is correct by looking for executable and executing it. If check is False and compile is True, then try and compile it.

Returns

True, if everything is ok

chmod()[source]

chmod 755 on executable, if it exists. Do nothing, if it doesnt exist.

compile()[source]

Try to compile the tool.

complain()[source]
defaulttempdir = '/tmp/'
installDirectory()[source]
Returns

the installation directory of the tool

pathOfExecutable()[source]
Returns

path of executable

tempDirectory()[source]

Return the temporary directory name.

tools.wrapperBase.ok(b)[source]
Returns

‘ok’ if b is True, else, return ‘error’.

tools.xsecBase module

class tools.xsecBase.ArgsStandardizer[source]

Bases: object

simple class to collect all argument manipulators

checkAllowedSqrtses(order, sqrtses)[source]

check if the sqrtses are ‘allowed’

checkNCPUs(ncpus, inputFiles)[source]
checkXsec_limit(args)[source]
getInputFiles(args)[source]

geth the names of the slha files to run over

getOrder(args)[source]

retrieve the order in perturbation theory from argument list

getParticles(args)[source]

extract the particles from argument list, default to None, then channels are chosen by the json file

getPythiaVersion(args)[source]
getSSMultipliers(multipliers)[source]
getSqrtses(args)[source]

extract the sqrtses from argument list

getjson(args)[source]

retrieve the path to the json file from argument list

queryCrossSections(filename)[source]
tempDir(args)[source]
writeToFile(args)[source]
class tools.xsecBase.XSecBase(maxOrder, slha_folder_name, maycompile=True)[source]

Bases: object

cross section computer class, what else?

Parameters
  • maxOrder – maximum order to compute the cross section, given as an integer if maxOrder == LO, compute only LO pythia xsecs if maxOrder == NLO, apply NLO K-factors from NLLfast (if available) if maxOrder == NLL, apply NLO+NLL K-factors from NLLfast (if available)

  • nevents – number of events for pythia run

  • pythiaVersion – pythia6 or pythia8 (integer)

  • maycompile – if True, then tools can get compiled on-the-fly

addXSecToFile(xsecs, slhafile, comment=None, complain=True)[source]

Write cross sections to an SLHA file.

Parameters
  • xsecs – a XSectionList object containing the cross sections

  • slhafile – target file for writing the cross sections in SLHA format

  • comment – optional comment to be added to each cross section block

  • complain – complain if there are already cross sections in file

xsecToBlock(xsec, inPDGs=(2212, 2212), comment=None, xsecUnit=1.0000000000000000E+00[pb])[source]

Generate a string for a XSECTION block in the SLHA format from a XSection object.

Parameters
  • inPDGs – defines the PDGs of the incoming states (default = 2212,2212)

  • comment – is added at the end of the header as a comment

  • xsecUnit – unit of cross sections to be written (default is pb). Must be a Unum unit.

tools.xsecComputer module

class tools.xsecComputer.XSecComputer(maxOrder, nevents, pythiaVersion, maycompile=True, defaulttempdir: str = '/tmp/')[source]

Bases: XSecBase

cross section computer class, what else?

Parameters
  • maxOrder – maximum order to compute the cross section, given as an integer if maxOrder == LO, compute only LO pythia xsecs if maxOrder == NLO, apply NLO K-factors from NLLfast (if available) if maxOrder == NLL, apply NLO+NLL K-factors from NLLfast (if available)

  • nevents – number of events for pythia run

  • pythiaVersion – pythia6 or pythia8 (integer)

  • maycompile – if True, then tools can get compiled on-the-fly

  • defaulttempdir – the default temp directory

addCommentToFile(comment, slhaFile)[source]

add the optional comment to file

addHigherOrders(sqrts, slhafile)[source]

add higher order xsecs

addMultipliersToFile(ssmultipliers, slhaFile)[source]

add the signal strength multipliers to the SLHA file

applyMultipliers(xsecs, ssmultipliers)[source]

apply the given multipliers to the cross sections

compute(sqrts, slhafile, lhefile=None, unlink=True, loFromSlha=None, pythiacard=None, ssmultipliers=None)[source]

Run pythia and compute SUSY cross sections for the input SLHA file.

Parameters
  • sqrts – sqrt{s} to run Pythia, given as a unum (e.g. 7.*TeV)

  • slhafile – SLHA file

  • lhefile – LHE file. If None, do not write pythia output to file. If file does not exist, write pythia output to this file name. If file exists, read LO xsecs from this file (does not run pythia).

  • unlink – Clean up temp directory after running pythia

  • loFromSlha – If True, uses the LO xsecs from the SLHA file to compute the higher order xsecs

  • pythiaCard – Optional path to pythia.card. If None, uses smodels/etc/pythia.card

  • ssmultipliers – optionally supply signal strengh multipliers, given as dictionary of the tuple of the mothers’ pids as keys and multipliers as values, e.g { (1000001,1000021):1.1 }.

Returns

XSectionList object

computeForBunch(sqrtses, inputFiles, unlink, lOfromSLHA, tofile, pythiacard=None, ssmultipliers=None)[source]

compute xsecs for a bunch of slha files

computeForOneFile(sqrtses, inputFile, unlink, lOfromSLHA, tofile, pythiacard=None, ssmultipliers=None, comment=None)[source]

Compute the cross sections for one file.

Parameters
  • sqrtses – list of sqrt{s} tu run pythia, as a unum (e.g. [7*TeV])

  • inputFile – input SLHA file to compute xsecs for

  • unlink – if False, keep temporary files

  • lofromSLHA – try to obtain LO xsecs from SLHA file itself

  • tofile – False, True, “all”: write results to file, if “all” also write lower xsecs to file.

  • pythiacard – optionally supply your own runcard

  • ssmultipliers – optionally supply signal strengh multipliers, given as dictionary of the tuple of the mothers’ pids as keys and multipliers as values, e.g { (1000001,1000021):1.1 }.

  • comment – an optional comment that gets added to the slha file.

Returns

number of xsections that have been computed

getPythia()[source]

returns the pythia tool that is configured to be used

match(pids, theorypid)[source]

do the pids given by the user match the pids of the theorypred?

tools.xsecComputer.main(args)[source]

tools.xsecResummino module

class tools.xsecResummino.XSecResummino(maxOrder, slha_folder_name, sqrt=13, ncpu=1, maycompile=True, type_writing=None, verbosity='', json=None, particles=None, xsec_limit=None)[source]

Bases: XSecBase

cross section computer class (for resummino), what else?

Parameters
  • maxOrder – maximum order to compute the cross section, given as an integer if maxOrder == LO, compute only LO resummino xsecs if maxOrder == NLO, compute NLO resummino xsecs if maxOrder == NLL, compute NLO+NLL resummino xsecs

  • slha_folder_name – name of slha file or folder containing slha files to compute cross sections for

  • sqrt – Center of mass energy to consider for the cross section calculation

  • ncpu – Number of cpu used in parallel for the calculation

  • maycompile – if True, then tools can get compiled on-the-fly

  • type_writing – If ‘all’, write all the perturbation orders into the slha file, if ‘highest’, only the highest order.

  • json – Path to the json file with all the relevant informations concerning the resummino calculation

  • xsec_limit – Value below which cross sections at NLO order are not calculated

are_crosssection(slha_file, order)[source]

check if the cross sections are already written, and remove the cross section written twice.

calculate_one_slha(particles, input_file, slha_file, output_file, num_try, order, log)[source]

log file management and launch resummino command. Prepare also the cross section list to write the cross section onto the slha file.

checkInstallation(compile: bool = True) bool[source]

check if resummino is already compiled.

Parameters

compile – if true, then attempt a compilation if not installed

Returns

true if we have a compiled executable

create_routine_files(order, slha_folder_name)[source]

Prepare all the paths and everything before turning into parallel task. resumino.py is called here to avoid multi-tasking on one file. Create also tempfile to stock all data needed by resummino.

create_xsection(result, particle_1, particle_2, order, Xsections)[source]

Create cross section list filled with cross section objects, corresponding to all the channels calculated.

determine_channels()[source]

function to find channels using a set of particles

Returns

tuple of: string: Mode of writting for the slha cross section list: list of the daugther particle to consider in the calculation of the cross section

extract_N1_N2_C1(file_path)[source]

function to extract the breaking term of the electrowikino part (SUSY) in an slha file.

Parameters

(string) (file_path) – path of the slha file

Returns

float: N1 Mass of the neutralino 1 float: N2 Mass of the neutralino 2 float: C1 Mass of the chargino 1 float: C2 Mass of the chargnino 2

extract_json()[source]

function to extract all the informations in the resummino.py file

Returns

tuple of: string: Mode of writting for the slha cross section list: list of the daugther particle to consider in the calculation of the cross section

extract_m1_m2_mu(file_path: PathLike) dict[source]

function to extract the breaking term of the electrowikino part (SUSY) in an slha file.

Parameters

(string) (file_path) – path of the slha file

Returns

dictionary of: int: M1 breaking term in SUSY models int: M2 braking term in SUSY models int: mu breaking term in SUSY models

find_channels(slha_file)[source]
getVersion()[source]

retrieve the version from version_path, set self.version if it doesnt exist, set to default of 3.1.2

launch_all()[source]

Launch all the calculations of the slha files in parallel (limited by ncpu), with first the creation of every path needed for the calculations.

launch_command(resummino_bin, input_file, output_file, order)[source]

use resummino at the order asked by the user (order variable).

launch_resummino(input_file, slha_file, output_file, particle_1, particle_2, num_try, order, Xsections, log)[source]

Check everything before launching resummino.

modify_outgoing_particles(input_file, output_file, new_particle1, new_particle2)[source]

modify the output particles (mother particles) in the resummino .in file. First call the template (input_file), then write into the resummino .in file (output_file). Can also write directly onto the output_file.

modify_slha_file(file_before, file_after, slha_file)[source]

Change all the informations in the .in files before launching calculations

Parameters
  • file_before – (input file for resummino): template

  • file_after – (input file for resummino): input file ready for resummino

search_in_output(output_file)[source]

Search in the .out files of resummino (in tempfiles) to get the cross section asked by the users, then extract the LO,NLO and NLL+NLO. If you want to get the incertainties given by resummino, you have everything here in LO, NLO and NLL.

write_in_slha(output_file, slha_file, order, particle_1, particle_2, type_writing, Xsections, log)[source]

Organize here the way cross sections are written into the file (highest, all) and then create cross_section object to let smodels take care of the writing itself with the create_xsection method.

tools.xsecResummino.main(args: Namespace)[source]

the central entry point

Module contents