ATLAS Offline Software
SUSYWeightMetadataConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 # Sum of weights algorithm
7 def SumOfWeightsAlgCfg(flags, name, **kwargs):
8  """ Get the sum of weights algorithm """
10  SumOfWeightsAlg = CompFactory.SumOfWeightsAlg
11  acc.addEventAlgo( SumOfWeightsAlg(name=name, **kwargs) )
12  return acc
13 
14 # McEventWeight Tool
15 def McEventWeightToolCfg(flags, name, **kwargs):
16  """ Get the MC Event Weight Tool """
17  acc = ComponentAccumulator()
18  McEventWeight = CompFactory.McEventWeight
19  acc.addPublicTool( McEventWeight(name=name, **kwargs) )
20  return acc
21 
22 # SUSY ID Weight Tool
23 def SUSYIDWeightToolCfg(flags, name, **kwargs):
24  """ Get the SUSY ID Weight Tool """
25  acc = ComponentAccumulator()
26  SUSYIDWeight = CompFactory.SUSYIDWeight
27  acc.addPublicTool( SUSYIDWeight(name=name, **kwargs) )
28  return acc
29 
30 # SUSY Event Weights
31 def AddSUSYWeightsCfg(flags, pref = ""):
32  """Add SUSY weights"""
33 
34  acc = ComponentAccumulator()
35 
36  # Load all potential SUSY process IDs following Prospino conventions
37  # https://twiki.cern.ch/twiki/bin/view/AtlasProtected/SUSYSignalUncertainties#Subprocess_IDs
38  listTools = []
39  for i in range(0, 225):
40  myName = pref+"SUSYWeight_ID"+"_"+str(i)
41  if i==0: #flat sum of all processes (i.e. sum the weight no matter what)
42  acc.merge( McEventWeightToolCfg(flags, name=myName, UseTruthEvents=True) )
43  else: #add weight only to keeper associated to current process id
44  acc.merge( SUSYIDWeightToolCfg(flags, name=myName, SUSYProcID=i, UseTruthEvents=True) )
45  listTools.append( acc.getPublicTool(myName) )
46 
47  acc.merge( SumOfWeightsAlgCfg(flags, name=pref+"SUSYSumWeightsAlg", WeightTools=listTools) )
48  return acc
SUSYIDWeight
Definition: SUSYIDWeight.h:25
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.SUSYWeightMetadataConfig.McEventWeightToolCfg
def McEventWeightToolCfg(flags, name, **kwargs)
Definition: SUSYWeightMetadataConfig.py:15
SumOfWeightsAlg
Definition: SumOfWeightsAlg.h:30
McEventWeight
Definition: McEventWeight.h:21
python.SUSYWeightMetadataConfig.SumOfWeightsAlgCfg
def SumOfWeightsAlgCfg(flags, name, **kwargs)
Definition: SUSYWeightMetadataConfig.py:7
python.SUSYWeightMetadataConfig.AddSUSYWeightsCfg
def AddSUSYWeightsCfg(flags, pref="")
Definition: SUSYWeightMetadataConfig.py:31
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
str
Definition: BTagTrackIpAccessor.cxx:11
python.SUSYWeightMetadataConfig.SUSYIDWeightToolCfg
def SUSYIDWeightToolCfg(flags, name, **kwargs)
Definition: SUSYWeightMetadataConfig.py:23