CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
SMHiggsBuilder.SMHiggsBuilder Class Reference

Public Member Functions

def __init__
 
def dump
 
def makeBR
 
def makePartialWidth
 
def makeTotalWidth
 
def makeXS
 
def textToSpline
 

Public Attributes

 datadir
 
 modelBuilder
 

Detailed Description

Definition at line 6 of file SMHiggsBuilder.py.

Constructor & Destructor Documentation

def SMHiggsBuilder.SMHiggsBuilder.__init__ (   self,
  modelBuilder,
  datadir = None 
)

Definition at line 7 of file SMHiggsBuilder.py.

7 
8  def __init__(self,modelBuilder,datadir=None):
9  self.modelBuilder = modelBuilder
10  if datadir == None:
11  datadir = os.environ['CMSSW_BASE']+"/src/HiggsAnalysis/CombinedLimit/data/lhc-hxswg/sm"
self.datadir = datadir

Member Function Documentation

def SMHiggsBuilder.SMHiggsBuilder.dump (   self,
  name,
  xvar,
  values,
  logfile 
)

Definition at line 41 of file SMHiggsBuilder.py.

41 
42  def dump(self,name,xvar,values,logfile):
43  xv = self.modelBuilder.out.var(xvar)
44  yf = self.modelBuilder.out.function(name)
45  if yf == None: raise RuntimeError, "Missing "+name
46  log = open(logfile, "w")
47  for x in values:
48  xv.setVal(x)
log.write("%.3f\t%.7g\n" % (x, yf.getVal()) )
def SMHiggsBuilder.SMHiggsBuilder.makeBR (   self,
  decay 
)

Definition at line 25 of file SMHiggsBuilder.py.

References SMHiggsBuilder.SMHiggsBuilder.textToSpline().

Referenced by SMHiggsBuilder.SMHiggsBuilder.makePartialWidth().

25 
26  def makeBR(self,decay):
27  if decay == "hww": self.textToSpline("SM_BR_hww", os.path.join(self.brpath, "BR.txt"), ycol=4);
28  if decay == "hzz": self.textToSpline("SM_BR_hzz", os.path.join(self.brpath, "BR.txt"), ycol=5);
29  if decay == "hgg": self.textToSpline("SM_BR_hgg", os.path.join(self.brpath, "BR.txt"), ycol=2);
30  if decay == "hZg": self.textToSpline("SM_BR_hZg", os.path.join(self.brpath, "BR.txt"), ycol=3);
31  if decay == "hbb": self.textToSpline("SM_BR_hbb", os.path.join(self.brpath, "BR1.txt"), ycol=1);
32  if decay == "htt": self.textToSpline("SM_BR_htt", os.path.join(self.brpath, "BR1.txt"), ycol=2);
33  if decay == "hmm": self.textToSpline("SM_BR_hmm", os.path.join(self.brpath, "BR1.txt"), ycol=3);
34  if decay == "hss": self.textToSpline("SM_BR_hss", os.path.join(self.brpath, "BR1.txt"), ycol=4);
35  if decay == "hcc": self.textToSpline("SM_BR_hcc", os.path.join(self.brpath, "BR1.txt"), ycol=5);
36  if decay == "hgluglu": self.textToSpline("SM_BR_hgluglu", os.path.join(self.brpath, "BR.txt"), ycol=1);
if decay == "htoptop": self.textToSpline("SM_BR_htoptop", os.path.join(self.brpath, "BR1.txt"), ycol=6);
def SMHiggsBuilder.SMHiggsBuilder.makePartialWidth (   self,
  decay 
)

Definition at line 37 of file SMHiggsBuilder.py.

References SMHiggsBuilder.SMHiggsBuilder.makeBR(), and SMHiggsBuilder.SMHiggsBuilder.makeTotalWidth().

37 
38  def makePartialWidth(self,decay):
39  self.makeTotalWidth();
40  self.makeBR(decay);
self.modelBuilder.factory_('prod::SM_Gamma_%s(SM_GammaTot,SM_BR_%s)' % (decay,decay))
def SMHiggsBuilder.SMHiggsBuilder.makeTotalWidth (   self)

Definition at line 23 of file SMHiggsBuilder.py.

References SMHiggsBuilder.SMHiggsBuilder.datadir, and SMHiggsBuilder.SMHiggsBuilder.textToSpline().

Referenced by SMHiggsBuilder.SMHiggsBuilder.makePartialWidth().

23 
24  def makeTotalWidth(self):
self.textToSpline("SM_GammaTot", self.datadir+"YR-BR.txt", ycol=6);
def SMHiggsBuilder.SMHiggsBuilder.makeXS (   self,
  process,
  energy = '7TeV' 
)

Definition at line 13 of file SMHiggsBuilder.py.

References SMHiggsBuilder.SMHiggsBuilder.datadir, and SMHiggsBuilder.SMHiggsBuilder.textToSpline().

13 
def makeXS(self,process, energy='7TeV'):
def SMHiggsBuilder.SMHiggsBuilder.textToSpline (   self,
  name,
  filename,
  xvar = "MH",
  ycol = 1,
  xcol = 0,
  skipRows = 1,
  algo = "CSPLINE" 
)

Definition at line 49 of file SMHiggsBuilder.py.

Referenced by SMHiggsBuilder.SMHiggsBuilder.makeBR(), SMHiggsBuilder.SMHiggsBuilder.makeTotalWidth(), and SMHiggsBuilder.SMHiggsBuilder.makeXS().

49 
50  def textToSpline(self,name,filename,xvar="MH",ycol=1,xcol=0,skipRows=1,algo="CSPLINE"):
51  if (self.modelBuilder.out.function(name) != None): return
52  x = []; y = []
53  file = open(filename,'r')
54  lines = [l for l in file]
55  for line in lines[skipRows:]:
56  if len(line.strip()) == 0: continue
57  cols = line.split();
58  x.append(float(cols[xcol]))
59  y.append(float(cols[ycol]))
60  xv = self.modelBuilder.out.var(xvar)
61  spline = ROOT.RooSpline1D(name, "file %s, x=%d, y=%d" % (filename,xcol,ycol), xv, len(x), array('d', x), array('d', y), algo)
62  self.modelBuilder.out._import(spline)
63 
64 #if __name__ == "__main__":
65 # sm = SMHiggsBuilder()

Member Data Documentation

SMHiggsBuilder.SMHiggsBuilder.datadir

Definition at line 11 of file SMHiggsBuilder.py.

Referenced by SMHiggsBuilder.SMHiggsBuilder.makeTotalWidth(), and SMHiggsBuilder.SMHiggsBuilder.makeXS().

SMHiggsBuilder.SMHiggsBuilder.modelBuilder

Definition at line 8 of file SMHiggsBuilder.py.