ATLAS Offline Software
MetAnalysisSequence.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2 
3 # AnaAlgorithm import(s):
4 from AnaAlgorithm.AnaAlgSequence import AnaAlgSequence
5 from AnaAlgorithm.DualUseConfig import createAlgorithm, addPrivateTool
6 
7 def makeMetAnalysisSequence( dataType, metSuffix,
8  postfix = '',
9  useFJVT = False,
10  treatPUJets = False,
11  setMuonJetEMScale = True,
12  electronsSelection = "",
13  muonsSelection = "",
14  photonsSelection = "",
15  tausSelection = ""):
16  """Create a met analysis algorithm sequence
17 
18  After creating the sequence object, it needs to be configured with a call
19  like:
20 
21  metSequence.configure( inputName = {
22  'jets' : 'AntiKt4EMPFlowJets_%SYS%',
23  'electrons' : 'AnalysisElectrons_%SYS%',
24  'photons' : 'AnalysisPhotons_%SYS%',
25  'muons' : 'AnalysisMuons_%SYS%',
26  'taus' : 'AnalysisTaus_%STS%',
27  },
28  outputName = 'AnalysisMET_%SYS%' )
29 
30  Note that defining a jet container is mandatory, but all other input
31  containers are optional.
32 
33  Selections on each container can also be defined
34 
35  Keyword arguments:
36  dataType -- The data type to run on ("data", "mc" or "afii")
37  metSuffix -- Suffix for the (core) MET objects to use from the input
38  (file)
39  useFJVT -- Use FJVT decision for the calculation
40  treatPUJets -- Treat pile-up jets in the MET significance calculation
41  """
42 
43  if dataType not in ["data", "mc", "afii"] :
44  raise ValueError ("invalid data type: " + dataType)
45 
46  if not useFJVT and treatPUJets:
47  raise ValueError ("MET significance pile-up treatment requires fJVT")
48 
49  # Remove b-tagging calibration from the MET suffix name
50  btIndex = metSuffix.find('_BTagging')
51  if btIndex != -1:
52  metSuffix = metSuffix[:btIndex]
53 
54  # Create the analysis algorithm sequence object:
55  seq = AnaAlgSequence( "MetAnalysisSequence" + postfix )
56 
57  # Set up the met maker algorithm:
58  alg = createAlgorithm( 'CP::MetMakerAlg', 'MetMakerAlg' + postfix)
59  addPrivateTool( alg, 'makerTool', 'met::METMaker' )
60 
61  alg.makerTool.DoPFlow = 'PFlow' in metSuffix or metSuffix=="AnalysisMET"
62  alg.makerTool.DoSetMuonJetEMScale = setMuonJetEMScale
63 
64  if useFJVT:
65  alg.makerTool.JetRejectionDec = 'passFJVT'
66  if dataType != "data" :
67  addPrivateTool( alg, 'systematicsTool', 'met::METSystematicsTool' )
68  alg.metCore = 'MET_Core_' + metSuffix
69  alg.metAssociation = 'METAssoc_' + metSuffix
70  alg.electronsSelection = electronsSelection
71  alg.muonsSelection = muonsSelection
72  alg.photonsSelection = photonsSelection
73  alg.tausSelection = tausSelection
74  seq.append( alg,
75  inputPropName = { 'jets' : 'jets',
76  'electrons' : 'electrons',
77  'photons' : 'photons',
78  'muons' : 'muons',
79  'taus' : 'taus',
80  'invisible' : 'invisible'},
81  outputPropName = 'met' )
82 
83  # Set up the met builder algorithm:
84  alg = createAlgorithm( 'CP::MetBuilderAlg', 'MetBuilderAlg' + postfix )
85  seq.append( alg, inputPropName = 'met' )
86 
87  # Set up the met significance algorithm:
88  alg = createAlgorithm( 'CP::MetSignificanceAlg', 'MetSignificanceAlg' + postfix )
89  addPrivateTool( alg, 'significanceTool', 'met::METSignificance' )
90  alg.significanceTool.SoftTermParam = 0
91  alg.significanceTool.TreatPUJets = treatPUJets
92  alg.significanceTool.IsAFII = dataType == "afii"
93  seq.append( alg, inputPropName = 'met' )
94 
95  # Return the sequence:
96  return seq
python.DualUseConfig.addPrivateTool
def addPrivateTool(alg, toolName, typeName)
Definition: DualUseConfig.py:180
python.DualUseConfig.createAlgorithm
def createAlgorithm(typeName, instanceName)
Definition: DualUseConfig.py:56
python.MetAnalysisSequence.makeMetAnalysisSequence
def makeMetAnalysisSequence(dataType, metSuffix, postfix='', useFJVT=False, treatPUJets=False, setMuonJetEMScale=True, electronsSelection="", muonsSelection="", photonsSelection="", tausSelection="")
Definition: MetAnalysisSequence.py:7