ATLAS Offline Software
Loading...
Searching...
No Matches
PMGTruthWeightAlgConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6
7# ATTENTION: This is a ComponentAccumulator-based configuration file
8# (not to be confused with ConfigAccumulator). If you are an analysis
9# user you are likely looking for GeneratorAnalysisBlock in
10# AsgAnalysisConfig.py. That uses the block-configuration generally
11# used for algorithms under PhysicsAnalysis/Algorithms. If you are
12# using the block configuration do not use this configuration. We
13# generally do not provide ComponentAccumulator-based configurations
14# for the CP algorithms, and a special exception was made for this
15# algorithm. Do not cite this as example why any other
16# ComponentAccumulator-based configurations should be added. You can
17# use this as an example for how ComponentAccumulator-based
18# configurations can look like, but do not try to extend this to cover
19# more CP algorithms. That is not supported, and you are likely to
20# encounter problems if you scale this up in the wrong way. This
21# configuration is covered by a unit test. Should it fail use your
22# best judgement whether to fix this configuration or to change it to
23# wrap the block configuration instead.
24
25def PMGTruthWeightAlgCfg(flags, systematicsRegex='.*'):
26 """Decorate systematically varied generator weights to
27 'EventInfo', with a human-readable name.
28
29 With systematicsRegex set to 'None', do not add the
30 SystematicsSvc.
31
32 """
33 ca = ComponentAccumulator()
34 # we need both the systematics service and the metadata service to
35 # make this tool work.
36 if systematicsRegex is not None:
37 ca.addService(
38 CompFactory.CP.SystematicsSvc(
39 name="SystematicsSvc",
40 sigmaRecommended=1,
41 systematicsRegex=systematicsRegex,
42 )
43 )
44 ca.merge(MetaDataSvcCfg(flags))
45 ca.addEventAlgo(
46 CompFactory.CP.PMGTruthWeightAlg(
47 name="PMGTruthWeightAlg",
48 truthWeightTool=CompFactory.PMGTools.PMGTruthWeightTool(
49 name="PMGTruthWeightTool"
50 ),
51 decoration = 'generatorWeight_%SYS%',
52 )
53 )
54 return ca
PMGTruthWeightAlgCfg(flags, systematicsRegex='.*')