theory package

Submodules

theory.auxiliaryFunctions module

theory.auxiliaryFunctions.cGtr(weightA, weightB)[source]

Define the auxiliary greater function.

Return a number between 0 and 1 depending on how much it is violated (0 = A > B, 1 = A << B).

Returns:XSectioList object with the values for each label.
theory.auxiliaryFunctions.cSim(*weights)[source]

Define the auxiliar similar function.

Return the maximum relative difference between any element weights of the list, normalized to [0,1].

Returns:XSectionList object with the values for each label.
theory.auxiliaryFunctions.distance(xmass1, xmass2)[source]

Define distance between two mass positions in upper limit space. The distance is defined as d = 2*|xmass1-xmass2|/(xmass1+xmass2).

Parameters:
  • xmass1 – upper limit value (in fb) for the mass1
  • xmass2 – upper limit value (in fb) for the mass2
Returns:

relative mass distance in upper limit space

theory.auxiliaryFunctions.index_bisect(inlist, el)[source]

Return the index where to insert item el in inlist. inlist is assumed to be sorted and a comparison function (lt or cmp) must exist for el and the other elements of the list. If el already appears in the list, inlist.insert(el) will insert just before the leftmost el already there.

theory.auxiliaryFunctions.massAvg(massList, method='weighted', weights=None)[source]

Compute the average mass of massList according to method.

If method=weighted but weights were not properly defined, switch method to harmonic. If massList contains a zero mass, switch method to mean.

Parameters:
  • method – possible values: harmonic, mean, weighted
  • weights – weights of elements (only for weighted average)
theory.auxiliaryFunctions.massPosition(mass, txdata)[source]

Give mass position in upper limit space. Use the analysis experimental limit data. :param txdata: TxNameData object holding the data and interpolation

theory.branch module

class theory.branch.Branch(info=None, finalState=None)[source]

Bases: object

An instance of this class represents a branch. A branch-element can be constructed from a string (e.g., (‘[b,b],[W]’).

Variables:
  • masses – list of masses for the intermediate states
  • particles – list of particles (strings) for the final states
  • PIDs – a list of the pdg numbers of the intermediate states appearing in the branch. If the branch represents more than one possible pdg list, PIDs will correspond to a nested list (PIDs = [[pid1,pid2,…],[pidA,pidB,…])
  • maxWeight – weight of the branch (XSection object)
copy()[source]

Generate an independent copy of self. Faster than deepcopy.

Returns:Branch object
decayDaughter(brDictionary, massDictionary)[source]

Generate a list of all new branches generated by the 1-step cascade decay of the current branch daughter.

Parameters:
  • brDictionary – dictionary with the decay information for all intermediate states (values are br objects, see pyslha)
  • massDictionary – dictionary containing the masses for all intermediate states.
Returns:

list of extended branches (Branch objects). Empty list if daughter is stable or if daughterID was not defined.

getInfo()[source]

Get branch topology info from particles.

Returns:dictionary containing vertices and number of final states information
getLength()[source]

Returns the branch length (number of R-odd particles).

Returns:length of branch (number of R-odd particles)
particlesMatch(other)[source]

Compare two Branches for matching particles, allow for inclusive particle labels (such as the ones defined in particles.py). Includes the final state in the comparison.

Parameters:other – branch to be compared (Branch object)
Returns:True if branches are equal (particles and masses match); False otherwise.
setFinalState(finalState=None)[source]

If finalState = None, define the branch final state according to the PID of the last R-odd particle appearing in the cascade decay. Else set the final state to the finalState given :parameter finalState: String defining the final state

setInfo()[source]

Defines the number of vertices (vertnumb) and number of particles in each vertex (vertpats) properties, if they have not been defined yet.

sortParticles()[source]

Sort the particles inside each vertex

class theory.branch.InclusiveBranch[source]

Bases: theory.branch.Branch

A branch wildcard class. It will return True when compared to any other branch object with the same final state.

getInfo()[source]

Get branch topology info from particles.

Returns:dictionary containing vertices and number of final states information
class theory.branch.InclusiveInt[source]

Bases: int

A integer wildcard class. It will return True when compared to any other integer object.

class theory.branch.InclusiveList[source]

Bases: list

A list wildcard class. It will return True when compared to any other list object.

theory.branch.decayBranches(branchList, brDictionary, massDictionary, sigcut=0.00E+00 [fb])[source]

Decay all branches from branchList until all unstable intermediate states have decayed.

Parameters:
  • branchList – list of Branch() objects containing the initial mothers
  • brDictionary
    dictionary with the decay information
    for all intermediate states (values are br objects, see pyslha).

    It may also contain information about long-lived particles.

  • massDictionary – dictionary containing the masses for all intermediate states.
  • promptDictionary – optional dictionary with the fraction of prompt and non-prompt decays. Allows to deal with quasi-stable or long-lived particles If not given, all particles are considered to always decay promptly or to be stable.
  • sigcut – minimum sigma*BR to be generated, by default sigcut = 0. (all branches are kept)
Returns:

list of branches (Branch objects)

theory.clusterTools module

class theory.clusterTools.ElementCluster[source]

Bases: object

An instance of this class represents a cluster. This class is used to store the relevant information about a cluster of elements and to manipulate this information.

Variables:elements – list of elements in the cluster (Element objects)
getAvgMass()[source]

Return the average mass of all elements belonging to the cluster. If the cluster does not refer to a TxName (i.e. in efficiency map results) AND the cluster contains more than one element (assuming they differ in the masses), returns None.

Returns:average mass array
getDataType()[source]

Checks to which type of data (efficiency map or upper limit) the cluster refers to. It uses the cluster.txnames attribute. If not defined, returns None :return: upperLimits or efficiencyMap (string)

getIDs()[source]

Return list of all element IDs appearing in the cluster :return: list of element IDs

getPIDs()[source]

Return the list of all PIDs appearing in all elements in the cluster, i.e. [ [[pdg1, pdg2,…],[pdg3,pdg4,…]], [[pdg1’, pdg2’,…],[pdg3’,pdg4’,…]]

Returns:list of PIDs
getTotalXSec()[source]

Return the sum over the cross sections of all elements belonging to the cluster.

Returns:sum of weights of all the elements in the cluster (XSectionList object)
class theory.clusterTools.IndexCluster(massMap=None, posMap=None, wMap=None, indices=set(), txdata=None)[source]

Bases: object

An instance of this class represents a cluster storing element indices. This auxiliary class is used to store element indices and positions in upper limit space. It is only used by the clustering algorithm.

Variables:
  • indices – list of integers mapping the cluster elements to their position in the list (1st element -> index 0, 2nd element -> index 1,…)
  • avgPosition – position in upper limit space for the cluster average mass
  • massMap – dictionary with indices as keys and the corresponding element mass as values
  • positionMap – dictionary with indices as keys and the corresponding element position in upper limit space as values
  • weightMap – dictionary with indices as keys and the corresponding element weight as values
  • txdata – TxNameData object to be used for computing distances in UL space
add(iels)[source]

Add an index or a list of indices to the list of indices and update the avgPosition value.

copy()[source]

Returns a copy of the index cluster (faster than deepcopy).

remove(iels)[source]

Remove an index or a list of indices to the list of indices and update the avgPosition value.

theory.clusterTools.clusterElements(elements, maxDist)[source]

Cluster the original elements according to their mass distance.

Parameters:
  • elements – list of elements (Element objects)
  • txname – TxName object to be used for computing distances in UL space
  • maxDist – maximum mass distance for clustering two elements
Returns:

list of clusters (ElementCluster objects)

theory.clusterTools.groupAll(elements)[source]

Create a single cluster containing all the elements. Skip mother elements which contain the daughter in the list (avoids double counting).

Parameters:elements – List of Element objects
Returns:ElementCluster object containing all unique elements

theory.crossSection module

class theory.crossSection.XSection[source]

Bases: object

An instance of this class represents a cross section.

This class is used to store the information of a single cross section (value, paritcle ids, center of mass, order and label).

order = 0 (LO), 1 (NLO) or 2 (NLL).

copy()[source]

Generates an independent copy of self.

Faster than deepcopy.

niceStr()[source]

Generates a more human readable string. The string format is: Sqrts: self.info.sqrts, Weight: self.value

pid
class theory.crossSection.XSectionInfo(sqrts=None, order=None, label=None)[source]

Bases: object

An instance of this class represents information regarding a cross section.

This class is used to store information of a cross section (center of mass, order and label).

copy()[source]

Generate an independent copy of self.

Faster than deepcopy.

class theory.crossSection.XSectionList(infoList=None)[source]

Bases: object

An instance of this class represents a list of cross sections.

This class is used to store a list of cross sections. The list is sorted by cross section, highest cross section first.

add(newxsec)[source]

Append a XSection object to the list.

combineWith(newXsecs)[source]

Add a new list of cross sections.

If the new cross sections already appear (have same order and sqrts), add its value to the original value, otherwise append it to the list. The particle IDs are ignored when adding cross sections. Hence, they are set to (None, None) if any cross sections are combined.

copy()[source]

Generates an independent copy of itself. Faster than deepcopy.

delete(xSec)[source]

Delete the cross section entry from the list.

getDictionary(groupBy='pids')[source]

Convert the list of XSection objects to a nested dictionary.

First level keys are the particles IDs (if groupBy == pids) or labels (if groupBy == labels) and values are the cross section labels or particle IDs and the cross section value.

getInfo()[source]

Get basic info about the cross sections appearing in the list (order, value and label).

Returns:list of XSectionInfo objects
getMaxXsec()[source]

Get the maximum cross section value appearing in the list.

getMinXsec()[source]

Get minimum cross section value appearing in the list.

getPIDpairs()[source]

Get all particle ID pairs appearing in the list.

getPIDs()[source]

Get all particle IDs appearing in the list.

getXsecsFor(item)[source]

Return a list of XSection objects for item (label, pid, sqrts).

niceStr()[source]
order()[source]

Order the cross section in the list by their PDG pairs

removeLowerOrder()[source]

Keep only the highest order cross section for each process in the list.

Remove order information and set default labels.

sort()[source]

sort the xsecs by the values

theory.crossSection.getXsecFromLHEFile(lhefile, addEvents=True)[source]

Obtain cross sections from input LHE file.

Parameters:
  • lhefile – LHE input file with unweighted MC events
  • addEvents – if True, add cross sections with the same mothers, otherwise return the event weight for each pair of mothers
Returns:

a XSectionList object

theory.crossSection.getXsecFromSLHAFile(slhafile, useXSecs=None, xsecUnit=1.00E+00 [pb])[source]

Obtain cross sections for pair production of R-odd particles from input SLHA file. The default unit for cross section is pb.

Parameters:
  • slhafile – SLHA input file with cross sections
  • useXSecs – if defined enables the user to select cross sections to use. Must be a XSecInfoList object
  • xsecUnit – cross section unit in the input file (must be a Unum unit)
Returns:

a XSectionList object

theory.element module

class theory.element.Element(info=None, finalState=None)[source]

Bases: object

An instance of this class represents an element. This class possesses a pair of branches and the element weight (cross-section * BR).

Variables:
  • branches – list of branches (Branch objects)
  • weight – element weight (cross-section * BR)
  • motherElements – only for elements generated from a parent element by mass compression, invisible compression,etc. Holds a pair of (whence, mother element), where whence describes what process generated the element
checkConsistency()[source]

Check if the particles defined in the element exist and are consistent with the element info.

Returns:True if the element is consistent. Print error message and exits otherwise.
combineMotherElements(el2)[source]

Combine mother elements from self and el2 into self

Parameters:el2 – element (Element Object)
combinePIDs(el2)[source]

Combine the PIDs of both elements. If the PIDs already appear in self, do not add them to the list.

Parameters:el2 – element (Element Object)
compressElement(doCompress, doInvisible, minmassgap)[source]

Keep compressing the original element and the derived ones till they can be compressed no more.

Parameters:
  • doCompress – if True, perform mass compression
  • doInvisible – if True, perform invisible compression
  • minmassgap – value (in GeV) of the maximum mass difference for compression (if mass difference < minmassgap, perform mass compression)
Returns:

list with the compressed elements (Element objects)

copy()[source]

Create a copy of self. Faster than deepcopy.

Returns:copy of element (Element object)
getDaughters()[source]

Get a pair of daughter IDs (PDGs of the last intermediate state appearing the cascade decay), i.e. [ [pdgLSP1,pdgLSP2] ] Can be a list, if the element combines several daughters: [ [pdgLSP1,pdgLSP2], [pdgLSP1’,pdgLSP2’]]

Returns:list of PDG ids
getEinfo()[source]

Get element topology info from branch topology info.

Returns:dictionary containing vertices and number of final states information
getFinalStates()[source]

Get the array of particles in the element.

Returns:list of particle strings
getMasses()[source]

Get the array of masses in the element.

Returns:list of masses (mass array)
getMothers()[source]

Get a pair of mother IDs (PDGs of the first intermediate state appearing the cascade decay), i.e. [ [pdgMOM1,pdgMOM2] ] Can be a list, if the element combines several mothers: [ [pdgMOM1,pdgMOM2], [pdgMOM1’,pdgMOM2’]]

Returns:list of PDG ids
getPIDs()[source]

Get the list of IDs (PDGs of the intermediate states appearing the cascade decay), i.e. [ [[pdg1,pdg2,…],[pdg3,pdg4,…]] ]. The list might have more than one entry if the element combines different pdg lists: [ [[pdg1,pdg2,…],[pdg3,pdg4,…]], [[pdg1’,pdg2’,…],[pdg3’,pdg4’,…]], …]

Returns:list of PDG ids
getParticles()[source]

Get the array of particles in the element.

Returns:list of particle strings
hasTopInList(elementList)[source]

Check if the element topology matches any of the topologies in the element list.

Parameters:elementList – list of elements (Element objects)
Returns:True, if element topology has a match in the list, False otherwise.
invisibleCompress()[source]

Perform invisible compression.

Returns:compressed copy of the element, if element ends with invisible particles; None, if compression is not possible
massCompress(minmassgap)[source]

Perform mass compression.

Parameters:minmassgap – value (in GeV) of the maximum mass difference for compression (if mass difference < minmassgap -> perform mass compression)
Returns:compressed copy of the element, if two masses in this element are degenerate; None, if compression is not possible;
particlesMatch(other, branchOrder=False)[source]

Compare two Elements for matching particles only. Allow for inclusive particle labels (such as the ones defined in particles.py) and includes final state comparison. If branchOrder = False, check both branch orderings.

Parameters:
  • other – element to be compared (Element object)
  • branchOrder – If False, check both orderings, otherwise check the same branch ordering
Returns:

True, if particles match; False, else;

setFinalState(finalStates)[source]

If finalStates = None, define the element final states according to the PID of the last R-odd particle appearing in the cascade decay. Else set the final states according to the finalStates list (must match the branch ordering)

Parameters:finalStates – List with final state labels (must match the branch ordering)
setMasses(mass, sameOrder=True, opposOrder=False)[source]

Set the element masses to the input mass array.

Parameters:
  • mass – list of masses ([[masses for branch1],[masses for branch2]])
  • sameOrder – if True, set the masses to the same branch ordering If True and opposOrder=True, set the masses to the smaller of the two orderings.
  • opposOrder – if True, set the masses to the opposite branch ordering. If True and sameOrder=True, set the masses to the smaller of the two orderings.
sortBranches()[source]

Sort branches. The smallest branch is the first one. See the Branch object for definition of branch size and comparison

switchBranches()[source]

Switch branches, if the element contains a pair of them.

Returns:element with switched branches (Element object)
toStr()[source]

Returns a string with the element represented in bracket notation, including the final states, e.g. [[[jet]],[[jet]] (MET,MET)

theory.exceptions module

exception theory.exceptions.SModelSTheoryError(value=None)[source]

Bases: Exception

Class to define SModelS specific errors

theory.lheDecomposer module

theory.lheDecomposer.decompose(lhefile, inputXsecs=None, nevts=None, doCompress=False, doInvisible=False, minmassgap=-1.00E+00 [GeV])[source]

Perform LHE-based decomposition.

Parameters:
  • lhefile – LHE file with e.g. pythia events
  • inputXsecs – xSectionList object with cross sections for the mothers appearing in the LHE file. If None, use information from file.
  • nevts – (maximum) number of events used in the decomposition. If None, all events from file are processed.
  • doCompress – mass compression option (True/False)
  • doInvisible – invisible compression option (True/False)
  • minmassgap – minimum mass gap for mass compression (only used if doCompress=True)
Returns:

list of topologies (TopologyList object)

theory.lheDecomposer.elementFromEvent(event, weight=None)[source]

Creates an element from a LHE event and the corresponding event weight.

Parameters:
  • event – LHE event
  • weight – event weight. Must be a XSectionList object (usually with a single entry) or None if not specified.
Returns:

element

theory.lheReader module

class theory.lheReader.LheReader(filename, nmax=None)[source]

Bases: object

An instance of this class represents a reader for LHE files.

close()[source]

Close the lhe file, if open.

event()[source]

Get next event.

Returns:SmsEvent; None if no event is left to be read.
next()[source]

Get next element in iteration.

Needed for the iterator.

class theory.lheReader.Particle[source]

Bases: object

An instance of this class represents a particle.

class theory.lheReader.SmsEvent(eventnr=None)[source]

Bases: object

Event class featuring a list of particles and some convenience functions.

add(particle)[source]

Add particle to the event.

getMom()[source]

Return the pdgs of the mothers, None if a problem occurs.

metaInfo(key)[source]

Return the meta information of ‘key’, None if info does not exist.

theory.particleNames module

class theory.particleNames.InclusiveStr[source]

Bases: str

A string wildcard class. It will return True when compared to any other string.

theory.particleNames.elementsInStr(instring, removeQuotes=True)[source]

Parse instring and return a list of elements appearing in instring. instring can also be a list of strings.

Parameters:
  • instring – string containing elements (e.g. “[[[‘e+’]],[[‘e-‘]]]+[[[‘mu+’]],[[‘mu-‘]]]”)
  • removeQuotes – If True, it will remove the quotes from the particle labels. Set to False, if one wants to run eval on the output.
Returns:

list of elements appearing in instring in string format

theory.particleNames.getFinalStateLabel(pid)[source]

Given the particle PID, returns the label corresponding to its final state (e.g. 1000022 -> MET, 1000023 -> HSCP,…) :parameter pid: PDG code for particle (must appear in particles.py) :return: Final state string (e.g. MET, HSCP,…)

theory.particleNames.getName(pdg)[source]

Convert pdg number to particle name according to the dictionaries rOdd and rEven.

Returns:particle name (e.g. gluino, mu-, …)
theory.particleNames.getPdg(name)[source]

Convert a name to the pdg number according to the dictionaries rOdd and rEven.

Returns:particle pdg; None, if name could not be resolved
theory.particleNames.simParticles(plist1, plist2, useDict=True)[source]

Compares two lists of particle names. Allows for dictionary labels (Ex: L = l, l+ = l, l = l-,…). Ignores particle ordering inside the list

Parameters:
  • plist1 – first list of particle names, e.g. [‘l’,’jet’]
  • plist2 – second list of particle names
  • useDict – use the translation dictionary, i.e. allow e to stand for e+ or e-, l+ to stand for e+ or mu+, etc
Returns:

True/False if the particles list match (ignoring order)

theory.particleNames.vertInStr(instring)[source]

Parses instring (or a list of strings) and returns the list of particle vertices appearing in instring.

Parameters:instring – string containing elements (e.g. “[[[‘e+’]],[[‘e-‘]]]+[[[‘mu+’]],[[‘mu-‘]]]”)
Returns:list of elements appearing in instring in string format

theory.slhaDecomposer module

theory.slhaDecomposer.decompose(slhafile, sigcut=1.00E-01 [fb], doCompress=False, doInvisible=False, minmassgap=-1.00E+00 [GeV], useXSecs=None)[source]

Perform SLHA-based decomposition.

Parameters:
  • sigcut – minimum sigma*BR to be generated, by default sigcut = 0.1 fb
  • doCompress – turn mass compression on/off
  • doInvisible – turn invisible compression on/off
  • minmassgap – maximum value (in GeV) for considering two R-odd particles degenerate (only revelant for doCompress=True )
  • useXSecs – optionally a dictionary with cross sections for pair production, by default reading the cross sections from the SLHA file.
Returns:

list of topologies (TopologyList object)

theory.slhaDecomposer.writeIgnoreMessage(keys, rEven, rOdd)[source]

theory.theoryPrediction module

theoryPrediction._getElementsFrom(smsTopList, dataset)[source]

Get elements that belong to any of the TxNames in dataset (appear in any of constraints in the result). Loop over all elements in smsTopList and returns a copy of the elements belonging to any of the constraints (i.e. have efficiency != 0). The copied elements have their weights multiplied by their respective efficiencies.

Parameters:
  • dataset – Data Set to be considered (DataSet object)
  • smsTopList – list of topologies containing elements (TopologyList object)
Returns:

list of elements (Element objects)

class theory.theoryPrediction.TheoryPrediction[source]

Bases: object

An instance of this class represents the results of the theory prediction for an analysis.

Variables:
  • analysis – holds the analysis (ULanalysis or EManalysis object) to which the prediction refers
  • xsection – xsection of the theory prediction (relevant cross section to be compared with the experimental limits). For EM-type analyses, it corresponds to sigma*eff, for UL-type analyses, eff is considered to be 1. It is a XSection object.
  • conditions – list of values for the analysis conditions (only for upper limit-type analysis, e.g. analysis=ULanalysis)
  • mass – mass of the cluster to which the theory prediction refers (only for upper limit-type analysis, e.g. analysis=ULanalysis)
analysisId()[source]

Return experimental analysis ID

computeStatistics(marginalize=False, deltas_rel=0.2)[source]

Compute the likelihood, chi2 and expected upper limit for this theory prediction. The resulting values are stored as the likelihood and chi2 attributes. :param marginalize: if true, marginalize nuisances. Else, profile them. :param deltas_rel: relative uncertainty in signal (float). Default value is 20%.

dataId()[source]

Return ID of dataset

dataType()[source]

Return the type of dataset

describe()[source]
getRValue(expected=False)[source]

Get the r value = theory prediction / experimental upper limit

getUpperLimit(expected=False, deltas_rel=0.2)[source]

Get the upper limit on sigma*eff. For UL-type results, use the UL map. For EM-Type returns the corresponding dataset (signal region) upper limit. For combined results, returns the upper limit on the total sigma*eff (for all signal regions/datasets).

Parameters:
  • expected – return expected Upper Limit, instead of observed.
  • deltas_rel – relative uncertainty in signal (float). Default value is 20%.
Returns:

upper limit (Unum object)

getmaxCondition()[source]

Returns the maximum xsection from the list conditions

Returns:maximum condition xsection (float)
class theory.theoryPrediction.TheoryPredictionList(theoryPredictions=None)[source]

Bases: object

An instance of this class represents a collection of theory prediction objects.

Variables:_theoryPredictions – list of TheoryPrediction objects
append(theoryPred)[source]
theory.theoryPrediction.theoryPredictionsFor(expResult, smsTopList, maxMassDist=0.2, useBestDataset=True, combinedResults=True, marginalize=False, deltas_rel=0.2)[source]

Compute theory predictions for the given experimental result, using the list of elements in smsTopList. For each Txname appearing in expResult, it collects the elements and efficiencies, combine the masses (if needed) and compute the conditions (if exist).

Parameters:
  • expResult – expResult to be considered (ExpResult object)
  • smsTopList – list of topologies containing elements (TopologyList object)
  • maxMassDist – maximum mass distance for clustering elements (float)
  • useBestDataset – If True, uses only the best dataset (signal region). If False, returns predictions for all datasets (if combinedResults is False), or only the combinedResults (if combinedResults is True).
  • combinedResults – add theory predictions that result from combining datasets.
  • marginalize – If true, marginalize nuisances. If false, profile them.
  • deltas_rel – relative uncertainty in signal (float). Default value is 20%.
Returns:

a TheoryPredictionList object containing a list of TheoryPrediction objects

theory.topology module

class theory.topology.Topology(elements=None)[source]

Bases: object

An instance of this class represents a topology.

Variables:
  • vertnumb – list with number of vertices in each branch
  • verparts – list with number of final states in each branch
  • elementList – list of Element objects with this common topology
addElement(newelement)[source]

Add an Element object to the elementList.

For all the pre-existing elements, which match the new element, add weight. If no pre-existing elements match the new one, add it to the list. OBS: newelement MUST ALREADY BE SORTED (see element.sort())

Parameters:newelement – element to be added (Element object)
Returns:True, if the element was added. False, otherwise
checkConsistency()[source]

Check if the all the elements in elementList are consistent with the topology (same number of vertices and final states)

Returns:True if all the elements are consistent. Print error message and exits otherwise.
describe()[source]

Create a detailed description of the topology.

Returns:list of strings with a description of the topology
getElements()[source]

Get list of elements of the topology.

Returns:elementList (list of Element objects)
getTotalWeight()[source]

Return the sum of all elements weights.

Returns:sum of weights of all elements (XSection object)
class theory.topology.TopologyList(topologies=[])[source]

Bases: object

An instance of this class represents an iterable collection of topologies.

Variables:topos – list of topologies (Topology objects)
add(newTopology)[source]

Check if elements in newTopology matches an entry in self.topos.

If it does, add weight. If the same topology exists, but not the same element, add element. If neither element nor topology exist, add the new topology and all its elements.

Parameters:newTopology – Topology object
addElement(newelement)[source]

Add an Element object to the corresponding topology in the list. If the element topology does not match any of the topologies in the list, create a new topology and insert it in the list. If the element topology already exists, add it to the respective topology. :parameter newelement: element to be added (Element object) :returns: True, if the element was added. False, otherwise

addList(topoList)[source]

Adds topologies in topoList using the add method.

compressElements(doCompress, doInvisible, minmassgap)[source]

Compress all elements in the list and included the compressed elements in the topology list.

Parameters:
  • doCompress – if True, perform mass compression
  • doInvisible – if True, perform invisible compression
  • minmassgap – value (in GeV) of the maximum mass difference for compression (if mass difference < minmassgap, perform mass compression)
describe()[source]

Returns string with basic information about the topology list.

getElements()[source]

Return a list with all the elements in all the topologies.

getTotalWeight()[source]

Return the sum of all topologies total weights.

hasTopology(topo)[source]

Checks if topo appears in any of the topologies in the list.

Parameters:topo – Topology object
Returns:True if topo appears in the list, False otherwise.
index(topo)[source]

Uses bisect to find the index where of topo in the list. If topo does not appear in the list, returns None.

Parameters:topo – Topology object
Returns:position of topo in the list. If topo does not appear in the list, return None.
insert(index, topo)[source]

Module contents