ATLAS Offline Software
PileupReweightingAlgConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentFactory import CompFactory
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 
5 # ATTENTION: This is a ComponentAccumulator-based configuration file
6 # (not to be confused with ConfigAccumulator). If you are an analysis
7 # user you are likely looking for some other Block in
8 # AsgAnalysisConfig.py. That uses the block-configuration generally
9 # used for algorithms under PhysicsAnalysis/Algorithms. If you are
10 # using the block configuration do not use this configuration. We
11 # generally do not provide ComponentAccumulator-based configurations
12 # for the CP algorithms, and a special exception was made for this
13 # algorithm. Do not cite this as example why any other
14 # ComponentAccumulator-based configurations should be added. You can
15 # use this as an example for how ComponentAccumulator-based
16 # configurations can look like, but do not try to extend this to cover
17 # more CP algorithms. That is not supported, and you are likely to
18 # encounter problems if you scale this up in the wrong way. This
19 # configuration is covered by a unit test. Should it fail use your
20 # best judgement whether to fix this configuration or to change it to
21 # wrap the block configuration instead.
22 
23 def PileupReweightingToolCfg(flags, name="PileupReweightingTool", commonPRW=True, **kwargs):
24  acc = ComponentAccumulator()
25  from Campaigns.Utils import getMCCampaign
26  campaign = getMCCampaign(flags.Input.Files)
27 
28  from PileupReweighting.AutoconfigurePRW import defaultConfigFiles,getConfigurationFiles,getLumicalcFiles
29  kwargs.setdefault("LumiCalcFiles", getLumicalcFiles(campaign))
30  if commonPRW:
31  kwargs.setdefault("ConfigFiles", defaultConfigFiles(campaign))
32  else:
33  kwargs.setdefault("ConfigFiles", getConfigurationFiles(files=flags.Input.Files))
34 
35  acc.setPrivateTools(CompFactory.CP.PileupReweightingTool(**kwargs))
36  return acc
37 
38 
39 def PileupReweightingAlgCfg(flags, name="PileupReweightingAlg", **kwargs):
40  acc = ComponentAccumulator()
41  acc.addService(CompFactory.CP.SystematicsSvc("SystematicsSvc"))
42  kwargs.setdefault("pileupReweightingTool", acc.popToolsAndMerge(PileupReweightingToolCfg(flags)))
43  acc.addEventAlgo(CompFactory.CP.PileupReweightingAlg(name, **kwargs))
44  return acc
45 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.PileupReweightingAlgConfig.PileupReweightingAlgCfg
def PileupReweightingAlgCfg(flags, name="PileupReweightingAlg", **kwargs)
Definition: PileupReweightingAlgConfig.py:39
python.AutoconfigurePRW.getConfigurationFiles
def getConfigurationFiles(campaign=None, dsid=None, data_type=None, files=None, useDefaultConfig=False)
Definition: AutoconfigurePRW.py:127
python.AutoconfigurePRW.defaultConfigFiles
def defaultConfigFiles(campaign)
Definition: AutoconfigurePRW.py:84
python.PileupReweightingAlgConfig.PileupReweightingToolCfg
def PileupReweightingToolCfg(flags, name="PileupReweightingTool", commonPRW=True, **kwargs)
Definition: PileupReweightingAlgConfig.py:23
python.AutoconfigurePRW.getLumicalcFiles
def getLumicalcFiles(campaign)
Definition: AutoconfigurePRW.py:6
python.Utils.getMCCampaign
def getMCCampaign(files)
Definition: Tools/Campaigns/python/Utils.py:27