#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/"))
from smodels.experiment import smsAnalysisFactory, smsHelpers
from smodels.tools.physicsUnits import GeV
## define where the database resides
smsHelpers.base=os.path.join(os.getenv("HOME"),"smodels-database/")
#Select only the CMS SUS-12-028 conference note
analyses=["CMS-SUS-12-028"]
#Loads the selected analyses
#(The INFO tells you that superseded analyses are not loaded, see below)
list_of_analyses=smsAnalysisFactory.load(analyses)
#Print the analyses that were loaded:
for analysis in list_of_analyses: analysis.printout(outputLevel=1)
#To see which elements are constrained by the analyses (in bracket notation), set outputLevel=2
for analysis in list_of_analyses: analysis.printout(outputLevel=2)
#To print basic information about one analysis:
analysisT1 = list_of_analyses[4]
analysisT2 = list_of_analyses[2]
print "Name = ",analysisT1.label,", Sqrts = ",analysisT1.sqrts, ", Luminosity =",analysisT1.lum
#To obtain the upper limit for a given analysis and a given mass vector.
#Note that the number of masses in the mass vector must be consitent with the analysis. For the T1 analysis, for instance:
massesT1 = [[300*GeV,100*GeV],[300*GeV,100*GeV]]
analysisT1 = list_of_analyses[0]
print analysisT1.getUpperLimitFor(massesT1)
#For the T2 analysis:
massesT2 = [[300*GeV,50*GeV],[300*GeV,50*GeV]]
print analysisT2.getUpperLimitFor(massesT2)
#If you try with the wrong mass format, an error will be printed:
masses = [[300*GeV],[300*GeV,50*GeV]]
print analysisT2.getUpperLimitFor(masses)
#It is also possible to load all the results for a single constraint (using the Txname convention)
Txnames = ["T1"]
new_list = smsAnalysisFactory.load(topologies=Txnames)
#Print all the analyses containing the required Txname:
for analysis in new_list: print analysis.label
#By default only non-supersed analyses are loaded:
analysisList = smsAnalysisFactory.load()
for analysis in analysisList: print analysis.label
#To load all analyses (included the superseded ones), set useSuperseded=True
full_list = smsAnalysisFactory.load(useSuperseded=True)
for analysis in full_list: print analysis.label