9from AnalysisAlgorithmsConfig.ConfigAccumulator
import DataType
10from AnalysisAlgorithmsConfig.FullCPAlgorithmsTest
import makeSequence
11from AthenaConfiguration.AllConfigFlags
import initConfigFlags
12from AthenaConfiguration.ComponentFactory
import CompFactory
13from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
14from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
15from EventBookkeeperTools.EventBookkeeperToolsConfig
import CutFlowSvcCfg
17flags = initConfigFlags()
18athArgsParser = flags.getArgumentParser()
19athArgsParser.add_argument(
"--input-file", action=
"append", dest=
"input_file",
21 help=
"Specify the input file")
22athArgsParser.add_argument(
"--output-file", action=
"store", dest=
"output_file",
24 help=
"Specify the output file")
25athArgsParser.add_argument(
"--dump-config", action=
"store", dest=
"dump_config",
27 help=
"Dump the config in a pickle file")
28athArgsParser.add_argument(
"--data-type", action=
"store", dest=
"data_type",
30 help=
"Type of input to run over. Valid options are 'data', 'fullsim', 'fastsim'")
31athArgsParser.add_argument(
'--text-config', dest=
'text_config',
32 action=
'store', default=
None,
33 help=
'Configure the job with the provided text configuration')
34athArgsParser.add_argument(
'--no-systematics', dest=
'no_systematics',
35 action=
'store_true', default=
False,
36 help=
'Configure the job to with no systematics')
37athArgsParser.add_argument(
'--physlite', dest=
'physlite',
38 action=
'store_true', default=
False,
39 help=
'Run the job on physlite')
40athArgsParser.add_argument(
'--run', action=
'store', dest=
'run',
42 help=
'Run number for the inputs')
43athArgsParser.add_argument(
'--only-nominal-or', dest=
'onlyNominalOR',
44 action=
'store_true', default=
False,
45 help=
'Only run overlap removal for nominal (skip systematics)')
46athArgsParser.add_argument(
'--bleeding-edge', dest=
'bleeding_edge',
47 action=
'store_true', default=
False,
48 help=
'Run on the latest bleeding edge input (usually from the CI output)')
49athArgs = flags.fillFromArgs(parser=athArgsParser)
51dataType = DataType(athArgs.data_type)
52textConfig = athArgs.text_config
55 from PathResolver
import PathResolver
58print(f
"Running on data type: {dataType.value}")
62 inputfile = {DataType.Data:
'ASG_TEST_FILE_LITE_RUN3_DATA',
63 DataType.FullSim:
'ASG_TEST_FILE_LITE_RUN3_MC',
64 DataType.FastSim:
'ASG_TEST_FILE_LITE_RUN3_MC_FASTSIM'}
66 inputfile = {DataType.Data:
'ASG_TEST_FILE_LITE_DATA',
67 DataType.FullSim:
'ASG_TEST_FILE_LITE_MC',
68 DataType.FastSim:
'ASG_TEST_FILE_LITE_MC_FASTSIM'}
71 inputfile = {DataType.Data:
'ASG_TEST_FILE_RUN3_DATA',
72 DataType.FullSim:
'ASG_TEST_FILE_RUN3_MC',
73 DataType.FastSim:
'ASG_TEST_FILE_RUN3_MC_FASTSIM'}
75 inputfile = {DataType.Data:
'ASG_TEST_FILE_DATA',
76 DataType.FullSim:
'ASG_TEST_FILE_MC',
77 DataType.FastSim:
'ASG_TEST_FILE_MC_FASTSIM'}
81 flags.Input.Files = athArgs.input_file[:]
83 testFile = os.getenv(inputfile[dataType])
84 flags.Input.Files = [testFile]
87flags.Exec.EventPrintoutInterval = 100
88if flags.PerfMon.doFullMonMT
or flags.PerfMon.doFastMonMT:
89 flags.PerfMon.OutputJSON=
"perfmonmt_CPAnalysis.json"
93cfg = MainServicesCfg(flags)
95cfg.merge(PoolReadCfg(flags))
97cfg.merge(CutFlowSvcCfg(flags))
100cp_cfg = makeSequence(dataType, yamlPath=textConfig,
101 noSystematics=athArgs.no_systematics,
102 isPhyslite=athArgs.physlite,
103 autoconfigFromFlags=flags, onlyNominalOR=athArgs.onlyNominalOR,
104 forceEGammaFullSimConfig=
True,
105 bleedingEdge=athArgs.bleeding_edge)
111 outputFile = f
"ANALYSIS DATAFILE='FullCPAlgorithmsTextConfigTest.{dataType.value}.hist.root' OPT='RECREATE'"
113 outputFile = f
"ANALYSIS DATAFILE='FullCPAlgorithmsConfigTest.{dataType.value}.hist.root' OPT='RECREATE'"
114if athArgs.output_file:
115 outputFile = f
"ANALYSIS DATAFILE='{athArgs.output_file}' OPT='RECREATE'"
116cfg.addService(CompFactory.THistSvc(Output=[outputFile]))
121if athArgs.dump_config:
122 with open(athArgs.dump_config,
"wb")
as f:
124if flags.Exec.MaxEvents>0:
125 sc=cfg.run(flags.Exec.MaxEvents)
128sys.exit(sc.isFailure())
void print(char *figname, TCanvas *c1)
static std::string FindCalibFile(const std::string &logical_file_name)