def PrintYields(self, name='yields', doStat=True, doSyst=True):
     t = OutText(self.outpath, name, "new", textformat=self.textformat)
     t.SetTexAlign("l c")
     nsem = 16 + 3 + 8 + (5 + 8 if doStat else 0) + (5 + 8 if doSyst else 0)
     t.SetSeparatorLength(nsem)
     t.line('%' + 'Yields for channel \'%s\' and level \'%s\'' %
            (self.GetChan(), self.GetLevel()))
     t.bar()
     for pr in self.bkg:
         name = t.fix(" %s" % pr.GetName(), 16, 'l', 0)
         y = t.fix("%1.2f" % pr.GetYield(), 8, 0)
         stat = t.fix("%1.2f" % pr.GetStatUnc(), 8, 0)
         syst = t.fix("%1.2f" % pr.GetSystAbsUnc(), 8, 0)
         t.line(name + t.vsep() + y + ((t.pm() + stat) if doStat else '') +
                ((t.pm() + syst) if doSyst else ''))
     t.sep()
     totbkg = t.fix("%1.2f" % self.GetTotBkg(), 8, 0)
     totbkgstat = t.fix("%1.2f" % self.GetTotBkgStatUnc(), 8, 0)
     totbkgsyst = t.fix("%1.2f" % self.GetTotBkgSystUnc(), 8, 0)
     t.line(
         t.fix(" Total bkg", 16, 'l', 0) + t.vsep() + totbkg +
         ((t.pm() + totbkgstat) if doStat else '') +
         ((t.pm() + totbkgsyst) if doSyst else ''))
     t.sep()
     y = self.GetSignalYield()
     signal = t.fix(" %s" % (self.GetSignal().GetName()), 16, 'l', 0)
     ysig = t.fix("%1.2f" % y, 8, 0)
     sigunc = t.fix("%1.2f" % (self.GetXsecSystUnc() * y), 8, 0)
     sigsta = t.fix("%1.2f" % self.GetSignal().GetStatUnc(), 8, 0)
     t.line(signal + t.vsep() + ysig +
            ((t.pm() + sigsta) if doStat else '') +
            ((t.pm() + sigunc) if doSyst else ''))
     t.sep()
     t.line(
         t.fix(" Data", 16, 'l', 0) + t.vsep() +
         t.fix("%i" % self.GetData(), 8, 0))
     t.bar()
     t.write()
 def PrintXsec(self, name='xsec'):
     t = OutText(self.outpath, name, "new", textformat=self.textformat)
     t.SetTexAlign("l c")
     t.SetSeparatorLength(26 + 3 + 20 + 5)
     t.SetDefaultFixOption(False)
     t.line('%' + 'tt cross section for channel \'%s\' and level \'%s\'' %
            (self.GetChan(), self.GetLevel()))
     acc = self.GetAcc()
     eff = self.GetEff()
     t.bar()
     t.line(
         t.fix(' Acceptance', 16, 'r') + t.vsep() +
         t.fix("%1.4f" % acc, 6) + t.pm() +
         t.fix("%1.2f" % (acc * self.GetAccUnc()), 8))
     t.line(
         t.fix(' Efficiency', 16, 'r') + t.vsep() +
         t.fix("%1.4f" % eff, 6) + t.pm() +
         t.fix("%1.2f" % (eff * self.GetEffUnc()), 8))
     t.sep()
     t.line(
         t.fix(' Branching ratio', 16, 'r') + t.vsep() +
         t.fix("%1.4f" % self.GetBR(), 6))
     t.line(
         t.fix(' Gen events', 16, 'r') + t.vsep() +
         t.fix("%d" % self.GetGenEvents(), 9))
     t.line(
         t.fix(' Fiducial events', 16, 'r') + t.vsep() +
         t.fix("%d" % self.GetFiduEvents(), 9))
     if self.doFiducial:
         t.sep()
         xsec = self.GetFiduXsec()
         stat = self.GetXsecStatUnc()
         syst = self.GetEffUnc()
         lumi = self.GetXsecLumiUnc()
         #t.line(t.fix(' Fiducial cross section', 26, 'r') + t.vsep() + t.fix("%1.2f"%xsec,6))
         #t.line(t.fix(' +\- ', 26, 'r')            + '   ' + t.fix('%1.2f (%1.2f'%(stat*xsec,stat*100) + ' %) (stat)',20, 'l'))
         #t.line(t.fix(' +\- ', 26, 'r')            + '   ' + t.fix('%1.2f (%1.2f'%(syst*xsec,syst*100) + ' %) (syst)',20, 'l'))
         #t.line(t.fix(' +\- ', 26, 'r')            + '   ' + t.fix('%1.2f (%1.2f'%(lumi*xsec,lumi*100) + ' %) (lumi)',20, 'l'))
     t.sep()
     xsec = self.GetXsec()
     stat = self.GetXsecStatUnc()
     syst = self.GetXsecSystUnc()
     lumi = self.GetXsecLumiUnc()
     t.line(
         t.fix(' Inclusive cross section', 26, 'r') + t.vsep() +
         t.fix("%1.2f" % xsec, 6))
     t.line(
         t.fix(' $\pm$ ', 26, 'r') + '   ' +
         t.fix('%1.2f (%1.2f' %
               (stat * xsec, stat * 100) + ' \%) (stat)', 20, 'l') +
         t.vsep())
     t.line(
         t.fix(' $\pm$ ', 26, 'r') + '   ' +
         t.fix('%1.2f (%1.2f' %
               (syst * xsec, syst * 100) + ' \%) (syst)', 20, 'l') +
         t.vsep())
     t.line(
         t.fix(' $\pm$ ', 26, 'r') + '   ' +
         t.fix('%1.2f (%1.2f' %
               (lumi * xsec, lumi * 100) + ' \%) (lumi)', 20, 'l') +
         t.vsep())
     t.bar()
     t.write()
示例#3
0
      name = ('ee' if ch=='ElEl' else ('$\mu\mu$' if ch =='MuMu' else 'e$\mu$')) +' '+ mode
      name = t.fix(name, 10)
      for lab in snames:
        val, unc = GA(lab, ch) if mode == 'Gen' else RS(lab, ch)
        name += t.vsep() + (t.fix("%1.2f %s"%(unc, '\%'), 20) if lab!='tt' else t.fix("%g"%(val), 20))
        #name += t.vsep() + t.fix("%1.1f (%1.2f %s)"%(val, unc, '%'), 20)
      t.line(name)
  t.bar()
  t.write()

if printGenAndStatUnc:
  t = OutText(outpath+'/genSyst/', 'genSystWithUnc_'+l, "new", textformat='tex')
  t.SetTexAlign("l c c")
  t.SetSeparatorLength(12)
  t.bar()
  t.line('Variation' + t.vsep() + 'Acceptance' + t.vsep() + 'Uncertainty')
  t.sep()
  for ch in ['ElEl', 'MuMu', 'ElMu']:
    name = ('ee' if ch=='ElEl' else ('$\mu\mu$' if ch =='MuMu' else 'e$\mu$'))
    name = t.fix(name, 10)
    nom, uncnom, var, uncvar, syst, systunc = GetGAandUnc('tt', ch)
    t.line('Nominal %s'%name + t.vsep() + '%g (%1.2f%s)'%(nom, uncnom/nom*100, '\%') + t.vsep())
    for lab in snames[1:]:
      nom, uncnom, var, uncvar, syst, systunc = GetGAandUnc(lab, ch)
      t.line(lab +' '+ name + t.vsep() + '%g (%1.2f%s)'%(var, uncvar/var*100, '\%') + t.vsep() + '%1.2f%s %s %1.2f%s'%(syst*100, '\%', t.pm(), systunc*100, '\%')  )
    t.bar()
  t.bar()
  t.write()