3 from __future__
import print_function
7 from pyAMI.atlas.api
import get_dataset_info
20 amiClient=pyAMI.client.Client(
'atlas')
31 data = ROOT.SH.MetaDataQuery()
32 data.messages =
'done by ami query'
35 for sample
in samples :
36 sample_noscope=sample.split(
':')[-1]
38 mydata = ROOT.SH.MetaDataSample(sample)
44 mydata.source =
'https://atlas-ami.cern.ch/AMI/pyAMI/'
47 if (sample.startswith(
"mc")) :
50 elif (sample.startswith(
"data")) :
66 if (sample.find(
"_tid")):
67 print (
"Stripping tid suffix from " + sample)
68 sample = sample.split(
"_tid")[0]
74 amiinfo=get_dataset_info(amiClient, sample_noscope)[0]
75 mydata.nevents = long(amiinfo[
'totalEvents'])
84 if (mydata.isData==1):
86 mydata.crossSection=-1
87 mydata.filterEfficiency=-1
90 mydata.luminosity = -1
92 xsec=
float(amiinfo[
'approx_crossSection'])
93 effic=
float(amiinfo[
'approx_GenFiltEff'])
95 mydata.crossSection= xsec
96 mydata.filterEfficiency= effic
97 if mydata.crossSection > 0
and mydata.filterEfficiency > 0:
98 mydata.luminosity= float (
float(mydata.nevents)/(mydata.crossSection*mydata.filterEfficiency))
102 data.addSample (mydata)