  | 
  
    ATLAS Offline Software
    
   | 
 
 
 
 
Go to the documentation of this file.
    3 from AthenaCommon.Logging 
import logging
 
   11     self.
log = logging.getLogger(
'GetCrossSectionAMI')
 
   15       import pyAMI.atlas.api 
as api
 
   17       self.
log.fatal(
'Unable to import the pyAMI client. Did you run "lsetup pyami; voms-proxy-init -voms atlas"?')
 
   34     datasetRegex = 
r'mc.._.*TeV\..*|valid.\..*'  
   35     parts = path.split(
'/')
 
   37       if re.match(datasetRegex, part):
 
   40     self.
log.
error(
'Unable to figure out the MC dataset name from the path, you must supply it yourself as MCDatasetName')
 
   43     dataset = re.sub(
'_tid[0-9]{8}_[0-9]{2}', 
'', dataset)
 
   44     dataset = re.sub(
'_sub[0-9]{10}', 
'', dataset)
 
   45     dataset = re.sub(
'/$', 
'', dataset)
 
   49     dsid = dataset.split(
'.')[1]
 
   52     except Exception 
as reason:
 
   53       self.
log.fatal(
'Unable to query AMI. Do you have a grid certificate? "voms-proxy-init -voms atlas"')
 
   54       self.
log.fatal(
'You can also supply the MCCrossSection and MCFilterEfficiency by hand for this sample')
 
   55       self.
log.fatal(f
'The reason for failure was: {reason}')
 
   59       n 
for n 
in res_d[
'node'] 
 
   60       if 'logicalDatasetName' in n.keys() 
and n[
'logicalDatasetName'].
split(
'.')[1] == dsid 
and 'EVNT' in n[
'logicalDatasetName']
 
   63     sorted_nodes = 
sorted(previous_nodes, key=
lambda n: n[
'distance'])
 
   65     evnt_dataset = sorted_nodes[0][
'logicalDatasetName']
 
   67     if 'EVNT' in evnt_dataset:
 
   68       self.
log.
info(
'Found the original EVNT dataset using AMI provenance.')
 
   69       self.
log.
info(f
'Went from: {dataset}')
 
   70       self.
log.
info(f
'       to: {evnt_dataset}')
 
   73       self.
log.fatal(
'Unable to get the original EVNT dataset from AMI provenance, you must supply it yourself as MCDatasetName')
 
   74       self.
log.fatal(
'You can also supply the MCCrossSection and MCFilterEfficiency by hand for this sample')
 
   78     if 'EVNT' not in dataset:
 
   81     self.
log.
info(f
'Looking up details of {self.dataset} on AMI')
 
   84     fields = 
'cross_section,generator_filter_efficiency' 
   87     except Exception 
as reason:
 
   88       self.
log.fatal(
'Unable to query AMI. Do you have a grid certificate? "voms-proxy-init -voms atlas"')
 
   89       self.
log.fatal(
'You can also supply the MCCrossSection and MCFilterEfficiency by hand for this sample')
 
   90       self.
log.fatal(f
'The reason for failure was: {reason}')
 
   94       self.
log.fatal(f
'The dataset "{dataset}" was not found in AMI')
 
   95       self.
log.fatal(
'You can also supply the MCCrossSection and MCFilterEfficiency by hand for this sample')
 
   98       self.
log.fatal(f
'More than one dataset "{dataset}" was found in AMI.')
 
  101     xsec = res_l[0][
'cross_section']
 
  102     gfe = res_l[0][
'generator_filter_efficiency']
 
  104     if xsec == 
'NULL' or gfe == 
'NULL':
 
  105       self.
log.fatal(f
'NULL cross section/filter efficiency values set on AMI for the dataset "{dataset}"')
 
  106       self.
log.fatal(
'You can supply the MCCrossSection and MCFilterEfficiency by hand for this sample')
 
  113       self.
log.fatal(
'Coudn\'t convert cross section/filter efficiency values to floats')
 
  114       self.
log.fatal(f
'    Cross Section: {xsec}')
 
  115       self.
log.fatal(f
'Filter Efficiency: {gfe}')
 
  116       self.
log.fatal(
'You can supply the MCCrossSection and MCFilterEfficiency by hand for this sample')
 
  120       self.
log.
info(
'################## ################## AMI Query Complete ################## ################## ')
 
  121       self.
log.
info(f
'    Cross section: {self.xsec} nb')
 
  122       self.
log.
info(f
'Filter efficiency: {self.filtereff}')
 
  123       self.
log.
info(
'You may want to supply these numbers directly in future as MCCrossSection and MCFilterEfficiency for speed')
 
  124       self.
log.
info(
'################## ################## ################## ################## ################### ')
 
  126       self.
log.fatal(f
'The cross section and/or filter efficiency values for the dataset "{dataset}" are set to 0 on AMI')
 
  127       self.
log.fatal(
'You can supply the MCCrossSection and MCFilterEfficiency by hand for this sample')
 
  
std::vector< typename R::value_type > sorted(const R &r, PROJ proj={})
Helper function to create a sorted vector from an unsorted range.
 
def init(v_theApp, v_rootStream=None)