#!/usr/bin/env python
# coding: utf-8

# # How To: Print out the theoretical decomposition

# In[1]:


# Set up the path to SModelS installation folder
import sys; sys.path.append("."); import importlib; importlib.import_module("smodels_paths") if importlib.util.find_spec("smodels_paths") else None


# In[2]:


# Import those parts of smodels that are needed for this exercise
# (We will assume the input is a SLHA file. For LHE files, use the lheDecomposer instead)
from smodels.share.models.mssm import BSMList
from smodels.share.models.SMparticles import SMList
from smodels.base.model import Model
from smodels.decomposition import decomposer
from smodels.installation import installDirectory
from smodels.base.physicsUnits import fb, GeV


# In[3]:


# Define the SLHA file name
filename="inputFiles/slha/gluino_squarks.slha"
model = Model(BSMparticles = BSMList, SMparticles = SMList)
model.updateParticles(inputFile=filename)


# In[4]:


# Perform the decomposition:
listOfTopologies = decomposer.decompose(model, sigmacut = 0.5 * fb, 
                                            massCompress=True, invisibleCompress=True,minmassgap = 5* GeV)


# In[5]:


# To print specific information about othe i-th topology:
for top,smsList in listOfTopologies.items():
    print('Canonical name = %i' %top)
    print ("Number of SMS = ",len(smsList))


# In[6]:


# We can also print information for each element in the topology:
for sms in listOfTopologies[110110101000]:
    print ('SMS:',sms)
    print ('weight=',sms.weightList,'\n')
    sms.draw()


# In[ ]:




