11 parser = optparse.OptionParser()
12 parser.add_option(
'-d',
'--data-type', dest =
'data_type',
13 action =
'store', type =
'string', default =
'data',
14 help =
'Type of data to run over. Valid options are data, mc, afii' )
15 parser.add_option(
'--dnn', dest =
'dnn',
16 action =
'store_true', default =
False,
17 help =
'Use the DNN electron ID instead of the likelihood. ')
18 parser.add_option(
'-s',
'--submission-dir', dest =
'submission_dir',
19 action =
'store', type =
'string', default =
'submitDir',
20 help =
'Submission directory for EventLoop' )
21 parser.add_option(
'-u',
'--unit-test', dest=
'unit_test',
22 action =
'store_true', default =
False,
23 help =
'Run the job in "unit test mode"' )
24 ( options, args ) = parser.parse_args()
33 dataType = options.data_type
34 useDNNeID = options.dnn
36 if dataType
not in [
"data",
"mc",
"afii"] :
37 raise ValueError (
"invalid data type: " + dataType)
42 sh = ROOT.SH.SampleHandler()
43 sh.setMetaString(
'nc_tree',
'CollectionTree' )
44 sample = ROOT.SH.SampleLocal (dataType)
45 if dataType ==
"data" :
46 sample.add (os.getenv (
'ASG_TEST_FILE_DATA'))
49 sample.add (os.getenv (
'ASG_TEST_FILE_MC'))
51 if dataType ==
"afii" :
52 sample.add (os.getenv (
'ASG_TEST_FILE_MC_AFII'))
59 job.sampleHandler( sh )
60 job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
62 from EgammaAnalysisAlgorithms.EgammaAnalysisAlgorithmsTest
import makeSequence
63 algSeq = makeSequence (dataType,
not useDNNeID)
65 algSeq.addSelfToJob( job )
68 submitDir = options.submission_dir
72 eSelection =
'_DNN' if useDNNeID
else '_LH'
73 submitDir = tempfile.mkdtemp( prefix =
'egammaTest_'+dataType+eSelection+
'_', dir = os.getcwd() )
78 driver = ROOT.EL.DirectDriver()
79 driver.submit( job, submitDir )