ATLAS Offline Software
Loading...
Searching...
No Matches
python.AthenaCPRunScript.AthenaCPRunScript Class Reference
Inheritance diagram for python.AthenaCPRunScript.AthenaCPRunScript:
Collaboration diagram for python.AthenaCPRunScript.AthenaCPRunScript:

Public Member Functions

 __init__ (self)
 cfg (self)
 addCustomArguments (self)
 makeAlgSequence (self)
 initServiceCfg (self)
 run (self)

Public Attributes

 configSeq = None
 flags

Protected Attributes

 _cfg = None

Detailed Description

Definition at line 6 of file AthenaCPRunScript.py.

Constructor & Destructor Documentation

◆ __init__()

python.AthenaCPRunScript.AthenaCPRunScript.__init__ ( self)

Definition at line 7 of file AthenaCPRunScript.py.

7 def __init__(self):
8 super().__init__()
9 self.logger.info("AthenaCPRunScript initialized")
10 self._cfg = None
11 self.addCustomArguments()
12 self.configSeq = None
13 # Avoid putting call to parse_args() here! Otherwise it is hard to retrieve the parser infos
14

Member Function Documentation

◆ addCustomArguments()

python.AthenaCPRunScript.AthenaCPRunScript.addCustomArguments ( self)

Definition at line 21 of file AthenaCPRunScript.py.

21 def addCustomArguments(self):
22 # add arguments here
23 derivedGroup = self.parser.add_argument_group('Athena specific arguments')
24 derivedGroup.add_argument('--config-only', dest='config_only',
25 action='store_true', help='Only generate the configuration and save it to a pickle file')
26 derivedGroup.add_argument('--pool-file-reading', dest='pool_file_reading',
27 action='store_true', help='Run the job with the POOL-based file reading')
28 return
29

◆ cfg()

python.AthenaCPRunScript.AthenaCPRunScript.cfg ( self)

Definition at line 16 of file AthenaCPRunScript.py.

16 def cfg(self):
17 if self._cfg is None:
18 raise ValueError('Service configuration not initialized, use initServiceCfg()')
19 return self._cfg
20

◆ initServiceCfg()

python.AthenaCPRunScript.AthenaCPRunScript.initServiceCfg ( self)

Definition at line 48 of file AthenaCPRunScript.py.

48 def initServiceCfg(self):
49 if not self.flags.locked():
50 raise ValueError('Flags must be locked before initializing services')
51 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
52 self._cfg = MainServicesCfg(self.flags)
53

◆ makeAlgSequence()

python.AthenaCPRunScript.AthenaCPRunScript.makeAlgSequence ( self)

Definition at line 30 of file AthenaCPRunScript.py.

30 def makeAlgSequence(self):
31 from AthenaConfiguration.ComponentFactory import CompFactory
32 algSeq = CompFactory.AthSequencer()
33 self.logger.info("Configuring algorithms based on YAML file")
34 configSeq = self.config.configure()
35 self.logger.info("Configuring common services")
36 from AnalysisAlgorithmsConfig.ConfigAccumulator import ConfigAccumulator
37 configAccumulator = ConfigAccumulator(autoconfigFromFlags=self.flags,
38 algSeq=algSeq,
39 noSystematics=self.args.no_systematics)
40 if not self.args.merge_output_files:
41 configAccumulator.setDefaultHistogramStream('ANALYSIS_HIST')
42 self.logger.info("Configuring algorithms")
43 configSeq.fullConfigure(configAccumulator)
44 self.configSeq = configSeq
45 self.modifyAlgSequence()
46 return configAccumulator.CA
47
bool configure(asg::AnaToolHandle< ITrigGlobalEfficiencyCorrectionTool > &tool, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronEffToolsHandles, ToolHandleArray< IAsgElectronEfficiencyCorrectionTool > &electronSFToolsHandles, ToolHandleArray< CP::IMuonTriggerScaleFactors > &muonToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonEffToolsHandles, ToolHandleArray< IAsgPhotonEfficiencyCorrectionTool > &photonSFToolsHandles, const std::string &triggers, const std::map< std::string, std::string > &legsPerTool, unsigned long nToys, bool debug)

◆ run()

python.AthenaCPRunScript.AthenaCPRunScript.run ( self)

Definition at line 54 of file AthenaCPRunScript.py.

54 def run(self):
55 self.setup()
56 self.flags.lock()
57 self.printFlags()
58
59 self.initServiceCfg()
60 if self.args.pool_file_reading:
61 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
62 self.cfg.merge(PoolReadCfg(self.flags))
63 else:
64 from AthenaRootComps.xAODEventSelectorConfig import xAODReadCfg
65 self.cfg.merge(xAODReadCfg(self.flags))
66 from EventBookkeeperTools.EventBookkeeperToolsConfig import CutFlowSvcCfg
67 self.cfg.merge(CutFlowSvcCfg(self.flags))
68
69 outputFile = f"ANALYSIS DATAFILE='{self.outputName}.root' OPT='RECREATE'"
70 from AthenaConfiguration.ComponentFactory import CompFactory
71 self.cfg.addService(CompFactory.THistSvc(Output=[outputFile]))
72 if not self.args.merge_output_files:
73 outputFileHist = f"ANALYSIS_HIST DATAFILE='hist-{self.outputName}.root' OPT='RECREATE'"
74 from AthenaConfiguration.ComponentFactory import CompFactory
75 self.cfg.addService(CompFactory.THistSvc(Output=[outputFileHist]))
76
77 self.cfg.merge(self.makeAlgSequence())
78 self.cfg.printConfig()
79
80 # dump pickle if requested
81 if self.args.config_only:
82 with open("CPRunConfig.pkl", "wb") as f:
83 self.cfg.store(f)
84 sys.exit(0)
85
86 sc = self.cfg.run()
87 sys.exit(sc.isFailure())
Definition merge.py:1
int run(int argc, char *argv[])

Member Data Documentation

◆ _cfg

python.AthenaCPRunScript.AthenaCPRunScript._cfg = None
protected

Definition at line 10 of file AthenaCPRunScript.py.

◆ configSeq

python.AthenaCPRunScript.AthenaCPRunScript.configSeq = None

Definition at line 12 of file AthenaCPRunScript.py.

◆ flags

python.AthenaCPRunScript.AthenaCPRunScript.flags

Definition at line 62 of file AthenaCPRunScript.py.


The documentation for this class was generated from the following file: