22 arg=
'-gLiteEntity=\"prodsys_task\" -gLiteQuery=\"SELECT prodsys_task.prodsysIdentifier, prodsys_task.nInputEvents, prodsys_task.nInputEventsUsed, prodsys_task.datasetFK, prodsys_task.identifier , prodsys_task.taskStatus WHERE dataset.identifier=\'%s\'\", -processingStep=\"production\" -project=\"mc15_001\" -sql=\"SELECT prodsys_task.prodsysIdentifier, prodsys_task.nInputEvents, prodsys_task.nInputEventsUsed, prodsys_task.datasetFK, prodsys_task.identifier ,\'mc15_001\' as PROJECT,\'production\' as PROCESS, \'prodsys_task\' as AMIENTITYNAME, prodsys_task.identifier as AMIELEMENTID , FROM dataset,prodsys_task WHERE (dataset.identifier IN (SELECT dataset.identifier FROM dataset WHERE dataset.identifier = \'%s\')) AND (dataset.identifier = prodsys_task.datasetFK ) AND (\'DATA_DELETED\' <> prodsys_task.taskStatus)\" -stats=\"prodsys_task.%s\"' % (DSidentifier, DSidentifier, InputType)
30 client = pyAMI.client.Client(
'atlas')
33 print "Error: please pass the script an input file containing a list of MC15 DAODs:"
34 print "CheckDAODCompleteness.py list_of_datasets.txt"
37 print "Reading list of DAODs from file %s" % argv[1]
42 outfilenom =
'for_reprocessing_'+time.strftime(
'%y%m%d_%H%M%S')+
'.txt'
43 outfile =
open(outfilenom,
'w')
46 for asample
in infile.readlines():
48 sample = asample.split(
'#')[0].strip()
50 if ''==sample:
continue
52 if 'mc15_13TeV' not in sample
or '_p' not in sample
or not 'merge.DAOD_' in sample:
53 print "unexpected input %s, the script only runs over MC15 DAODs" % sample
57 sample = sample.replace(
'mc15_13TeV:',
'')
59 print 'Checking sample',sample
61 result_DAOD = client.execute([
'GetDatasetInfo',
'-logicalDatasetName=%s'%sample], format =
'dict_object')
63 identifier=result_DAOD.get_rows(
'Element_Info')[0][
'identifier']
66 nInputEvents_DAOD =
int(client.execute([
'SearchQuery',
MakeArg(identifier,
'nInputEvents')], format =
'dict_object').get_rows(
'Element_Info')[0][
'SUM'])
67 nInputEventsUsed_DAOD =
int(client.execute([
'SearchQuery',
MakeArg(identifier,
'nInputEventsUsed')], format =
'dict_object').get_rows(
'Element_Info')[0][
'SUM'])
70 if nInputEventsUsed_DAOD < nInputEvents_DAOD:
71 print "\nWarning: nInputEvents_DAOD = %i, nInputEventsUsed_DAOD = %i, likely some failed derivation jobs\n"%(nInputEvents_DAOD,nInputEventsUsed_DAOD)
72 elif nInputEventsUsed_DAOD > nInputEvents_DAOD:
73 print "\nERROR: INCONSISTENT RESULT, nInputEvents_DAOD = %i, nInputEventsUsed_DAOD = %i\n"%(nInputEvents_DAOD,nInputEventsUsed_DAOD)
76 result_xAOD = client.execute([
'GetDatasetProv',
'-logicalDatasetName=%s'%sample], format =
'dict_object')
77 nEvents_xAOD =
int(result_xAOD.get_rows(
'node')[1][
'events'])
80 if nInputEvents_DAOD < nEvents_xAOD:
81 print "\nWARNING !!! NOT ALL xAOD EVENTS WERE PROCESSED: number of events in xAOD = %i, number of input events for DAOD = %i"%(nEvents_xAOD,nInputEvents_DAOD)
82 print "This DAOD should be reprocessed (with the same ptag) to pick up the remaining statistics\n"
83 outfile.write(sample+
'\n')
85 elif nInputEvents_DAOD > nEvents_xAOD:
86 print "\nERROR: INCONSISTENT RESULT, number of event in xAOD = %i, number of input events for DAOD = %i\n"%(nEvents_xAOD,nInputEvents_DAOD)
92 print 'You can find all samples that should be reprocessed in the file',outfilenom
93 print 'Please request derivations for these samples at http://its.cern.ch/jira/browse/ATLSUSYDPD'
96 os.remove( outfilenom )