# Set up the path to SModelS installation folder if running on a different folder
import sys,os
sys.path.append(os.path.join(os.getenv("HOME"),"smodels/"))
# Import those parts of smodels that are needed for this exercise
from smodels.tools.physicsUnits import TeV, GeV, fb
from smodels.installation import installDirectory
from smodels.theory import slhaDecomposer
from smodels.experiment import smsAnalysisFactory, smsHelpers
from smodels.tools import missingTopologies
# define where the database resides
smsHelpers.base=os.path.join(os.getenv("HOME"),"smodels-database/")
# load list of analyses from database
listOfAnalyses = smsAnalysisFactory.load()
# Define the SLHA file name
filename = "%s/inputFiles/slha/gluino_squarks.slha" % installDirectory()
# Perform the decomposition:
listOfTopologies = slhaDecomposer.decompose (filename, sigcut=0.5*fb, doCompress=True, doInvisible=True, minmassgap=5*GeV)
# Initiate missing Topologies for 8 TeV
missingtopos = missingTopologies.MissingTopoList(8*TeV)
# Check listOfTopologies against listOfAnalyses to find missing topologies
missingtopos.findMissingTopos(listOfTopologies, listOfAnalyses, minmassgap=5*GeV,doCompress=True, doInvisible=True)
# to print a sorted list of missing topologies with high weights use
missingtopos.printout()
# To access the missing topologies direcly
# For the i-th entry, where the entries are not sorted, do
i = 3
topology = missingtopos.topos[i]
print topology.topo
print topology.weights
print topology.value