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

# ### Load the browser

# 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]:


from smodels.base.physicsUnits import GeV
from smodels.tools import databaseBrowser
# First load the browser and check the total number of results loaded
browser = databaseBrowser.Browser("official")
print(len(browser))


# ### Check the upper limit of a efficiency map result (95% C.L. limit for a given signal region)

# In[3]:


# Check the upper limit for the HM200 signal region:
print(browser.getULForSR(expid='CMS-SUS-13-011', datasetID='HM200'))
# Check the upper limit for the LM300 signal region:
print(browser.getULForSR(expid='CMS-SUS-13-011', datasetID='LM300'))


# ### Check the upper limit for a upper limit result (95% C.L. limit for a given simplified model/txname and mass) 

# In[4]:


# Check the upper limit for T1tttt simplified model with gluino mass 1 TeV and LSP mass 100 GeV:
print(browser.getULFor(expid='CMS-SUS-16-037', txname='T1tttt', massarray = [[1000.*GeV,100.*GeV],[1000.*GeV,100.*GeV]]))


# In[5]:


# Check the upper limit for T1tttt simplified model with gluino mass 1.5 TeV and LSP mass 100 GeV:
print(browser.getULFor(expid='CMS-SUS-16-037', txname='T1tttt', massarray = [[1500.*GeV,100.*GeV],[1500.*GeV,100.*GeV]]))


# In[6]:


# No results will be given if masses outside the data grid are used:
print(browser.getULFor(expid='CMS-SUS-16-037', txname='T1tttt', massarray = [[5000.*GeV,100.*GeV],[5000.*GeV,100.*GeV]]))


# In[ ]:




