ATLAS Offline Software
Loading...
Searching...
No Matches
python.PhysicsValidationSkeleton Namespace Reference

Functions

 fromRunArgs (runArgs)

Variables

 jobPropertiesDisallowed

Function Documentation

◆ fromRunArgs()

python.PhysicsValidationSkeleton.fromRunArgs ( runArgs)

Definition at line 14 of file PhysicsValidationSkeleton.py.

14def fromRunArgs(runArgs):
15 from AthenaCommon.Logging import logging
16 logDerivation = logging.getLogger('PhysicsValidation')
17 logDerivation.info('****************** STARTING NTUP_PHYSVAL *****************')
18
19 logDerivation.info('**** Transformation run arguments')
20 logDerivation.info(str(runArgs))
21
22 logDerivation.info('**** Setting-up configuration flags')
23 from AthenaConfiguration.AllConfigFlags import initConfigFlags
24 flags = initConfigFlags()
25 flags.Exec.EventPrintoutInterval = 100
26 commonRunArgsToFlags(runArgs, flags)
27
28 # Switch on PerfMon
29 flags.PerfMon.doFullMonMT = True
30
31 # Input types
32 if not hasattr(runArgs, 'inputDAOD_PHYSVALFile'):
33 raise ValueError('Input must be provided using --inputDAOD_PHYSVALFile')
34 flags.Input.Files = runArgs.inputDAOD_PHYSVALFile
35
36 # Physics Validation
37 if hasattr(runArgs, 'outputNTUP_PHYSVALFile'):
38 logDerivation.info('Will produce NTUP_PHYSVAL file')
39 flags.PhysVal.OutputFileName = runArgs.outputNTUP_PHYSVALFile
40
41 if not (hasattr(runArgs, 'inputAODFile') or hasattr(runArgs, 'inputDAOD_PHYSVALFile')):
42 logDerivation.error('NTUP_PHYSVAL requires AOD or DAOD_PHYSVAL input')
43 raise ValueError('Incorrect inputs for NTUP_PHYSVAL')
44
45 if not hasattr(runArgs, 'validationFlags'):
46 raise ValueError('--validationFlags is mandatory')
47
48 for flag in runArgs.validationFlags:
49 if flag == 'doPFlow_FlowElements': # backwards compatibility
50 flag = 'doPFlow'
51
52 name = f'PhysVal.{flag}'
53 if not flags.hasFlag(name):
54 raise ValueError(f"Unknown validation flag '{name}'")
55
56 logDerivation.info("Enabling validation flag '%s'", name)
57 flags._set(name, True)
58 else:
59 raise ValueError('Output file name needs to be set using --outputNTUP_PHYSVALFile')
60
61 # Pre-include
62 processPreInclude(runArgs, flags)
63
64 # Pre-exec
65 processPreExec(runArgs, flags)
66
67 # To respect --athenaopts
68 flags.fillFromArgs()
69
70 # Lock flags
71 flags.lock()
72
73 # The main services configuration
74 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
75 cfg = MainServicesCfg(flags)
76 cfg.merge(PoolReadCfg(flags))
77
78 from AthenaConfiguration.ComponentFactory import CompFactory
79 from AthenaConfiguration.Enums import LHCPeriod
80 jetContainer = "AntiKt4EMTopoJets" if flags.GeoModel.Run >= LHCPeriod.Run4 else "AntiKt4EMPFlowJets"
81 cfg.addEventAlgo(CompFactory.FlavorTagDiscriminants.FTagGhostMuonAssociationAlg(
82 "FTagGhostMuonAssociationAlg",
83 jetContainer = jetContainer,
84 muonContainer = "Muons",
85 outMuons = f"{jetContainer}.GhostMuons",
86 ))
87
88 # Run NTUP_PHYSVAL making
89 from PhysValMonitoring.PhysValMonitoringConfig import PhysValMonitoringCfg
90 cfg.merge(PhysValMonitoringCfg(flags))
91
92 # Enabling PerfMon always for physics validation jobs regardless of PerfMon flags (unlike most other skeletons)
93 from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
94 cfg.merge(PerfMonMTSvcCfg(flags))
95
96 # Post-include
97 processPostInclude(runArgs, flags, cfg)
98
99 # Post-exec
100 processPostExec(runArgs, flags, cfg)
101
102 # Run the final configuration
103 sc = cfg.run()
104 sys.exit(not sc.isSuccess())

Variable Documentation

◆ jobPropertiesDisallowed

python.PhysicsValidationSkeleton.jobPropertiesDisallowed

Definition at line 11 of file PhysicsValidationSkeleton.py.