def xsec_kfact_effic(self): global XSEC_CACHE_MODIFIED year = self.year % 1E3 if self.datatype == DATA: return 1., 1., 1. if year in XSEC_CACHE and self.name in XSEC_CACHE[year]: log.warning("using cached cross section for dataset %s" % self.ds) return XSEC_CACHE[year][self.name] try: return xsec.xsec_kfact_effic(self.year, self.id) except KeyError: log.warning("cross section of dataset %s not available locally. " "Looking it up in AMI instead. AMI cross sections can be very" "wrong! You have been warned!" % self.ds) if USE_PYAMI: if self.ds in DS_NOPROV: xs, effic = get_dataset_xsec_effic(amiclient, DS_NOPROV[self.ds]) else: xs, effic = get_dataset_xsec_effic(amiclient, self.ds) if year not in XSEC_CACHE: XSEC_CACHE[year] = {} XSEC_CACHE[year][self.name] = (xs, 1., effic) XSEC_CACHE_MODIFIED = True return xs, 1., effic raise Exception("cross section of dataset %s is not known!" % self.ds)
def xsec_kfact_effic(self): global XSEC_CACHE_MODIFIED year = self.year % 1E3 if self.datatype == DATA: return 1., 1., 1. if year in XSEC_CACHE and self.name in XSEC_CACHE[year]: log.warning("using cached cross section for dataset %s" % self.ds) return XSEC_CACHE[year][self.name] try: return xsec.xsec_kfact_effic(self.year, self.id) except KeyError: log.warning( "cross section of dataset %s not available locally. " "Looking it up in AMI instead. AMI cross sections can be very" "wrong! You have been warned!" % self.ds) if USE_PYAMI: if self.ds in DS_NOPROV: xs, effic = get_dataset_xsec_effic(amiclient, DS_NOPROV[self.ds]) else: xs, effic = get_dataset_xsec_effic(amiclient, self.ds) if year not in XSEC_CACHE: XSEC_CACHE[year] = {} XSEC_CACHE[year][self.name] = (xs, 1., effic) XSEC_CACHE_MODIFIED = True return xs, 1., effic raise Exception("cross section of dataset %s is not known!" % self.ds)
sys.exit(1) treeline = "TREENAME=%s\n" % treename outfile.write(treeline) for ds in dslist: isData = True if not datare.search(ds): isData = False xs = 0 eff = 0 slash = False if not isData: try: xs, eff = get_dataset_xsec_effic(client, ds+"/") slash = True except: try: xs, eff = get_dataset_xsec_effic(client, ds) except: try: Slash = True orig = ds ds = re.sub(r'(e[0-9]*_)',r'merge.NTUP_COMMON.\1', ds) print "trying to add NTUP_COMMON, like "+ds xs, eff = get_dataset_xsec_effic(client, ds+"/") #print xs except: print "Dataset", ds+"/", "not found in AMI, skipping."
from pyAMI.client import AMIClient from pyAMI.query import get_dataset_xsec_effic client = AMIClient() dataset = 'mc11_7TeV.125206.PowHegPythia_VBFH130_tautauhh.merge.NTUP_TAUMEDIUM.e893_s1310_s1300_r2730_r2780_p795' xsec, effic = get_dataset_xsec_effic(client, dataset) print 'xsec: %.5E nb' % xsec print 'effic: %.2f' % effic