4 from AnalysisAlgorithmsConfig.ConfigBlock
import ConfigBlock
5 from AnalysisAlgorithmsConfig.ConfigAccumulator
import DataType
9 """the ConfigBlock for the MET configuration"""
12 super (MetAnalysisConfig, self).__init__ ()
13 self.addOption(
'containerName', containerName, type=str,
15 info=
"the name of the input container")
16 self.addOption (
'useJVT',
True, type=bool,
17 info=
"whether to use the JVT decision in the calculation")
18 self.addOption (
'useFJVT',
False, type=bool,
19 info=
"whether to use the forward JVT decision in the calculation")
20 self.addOption (
'treatPUJets',
False, type=bool,
21 info=
"whether to treat pile-up jets in the MET significance calculation")
22 self.addOption (
'setMuonJetEMScale',
True, type=bool,
23 info=
"enables the handling of muons in jets for the MET calculation. "
24 "Should be turned off for analyses where muons are not reconstructed "
26 self.addOption (
'jets',
"", type=str,
27 info=
"the input jet container")
28 self.addOption (
'electrons',
"", type=str,
29 info=
"the input electron container, with a possible selection, in "
30 "the format `container` or `container.selection`")
31 self.addOption (
'muons',
"", type=str,
32 info=
"the input muon container, with a possible selection, in the "
33 "format `container` or `container.selection`")
34 self.addOption (
'photons',
"", type=str,
35 info=
"the input photon container, with a possible selection, in "
36 "the format `container` or `container.selection`")
37 self.addOption (
'taus',
"", type=str,
38 info=
"the input tau-jet container, with a possible selection, in "
39 "the format `container` or `container.selection`")
40 self.addOption (
'invisible',
"", type=str,
41 info=
"any input container to be treated as invisible particles, "
42 "in the format `container` (no selection)")
43 self.addOption (
'metWP',
"Tight", type=str,
44 info=
"the MET working point to use: Loose, Tight, Tighter, "
46 self.addOption (
'skipSystematicJetSelection',
False, type=bool,
47 info=
"EXPERIMENTAL: whether to use simplified OR based on nominal jets "
48 "and for jet-related systematics only. "
49 "WARNING: this option is strictly for doing physics studies of the feasibility "
50 "of this OR scheme, it should not be used in a regular analysis")
51 self.addOption (
'saveSignificance',
True, type=bool,
52 info=
"whether to save the MET significance (default=True)")
53 self.addOption (
'useLRT',
False, type=bool,
54 info=
"whether to use LRT MET Core and association map")
58 if config.isPhyslite() :
59 metSuffix =
'AnalysisMET'
61 jetContainer = config.originalName (self.jets)
62 metSuffix = jetContainer[:-4]
66 if not self.useFJVT
and self.treatPUJets:
67 raise ValueError (
"MET significance pile-up treatment requires fJVT")
70 btIndex = metSuffix.find(
'_BTagging')
72 metSuffix = metSuffix[:btIndex]
75 alg = config.createAlgorithm(
'CP::MetMakerAlg',
'MetMakerAlg' + self.containerName )
76 config.addPrivateTool(
'makerTool',
'met::METMaker' )
77 alg.makerTool.skipSystematicJetSelection = self.skipSystematicJetSelection
79 alg.doJetJVT = self.useJVT
81 config.addPrivateTool(
'makerTool.JvtSelTool',
'CP::NNJvtSelectionTool' )
82 alg.makerTool.JvtSelTool.JetContainer = config.readName (self.jets)
84 alg.makerTool.JetRejectionDec =
'passFJVT_internal'
86 alg.makerTool.JetSelection = self.metWP
87 alg.makerTool.DoPFlow =
'PFlow' in metSuffix
or metSuffix==
"AnalysisMET"
88 alg.makerTool.DoSetMuonJetEMScale = self.setMuonJetEMScale
90 if config.dataType()
is not DataType.Data :
91 config.addPrivateTool(
'systematicsTool',
'met::METSystematicsTool' )
93 alg.metCore =
'MET_Core_' + metSuffix
94 alg.metAssociation =
'METAssoc_' + metSuffix
95 alg.jets = config.readName (self.jets)
97 alg.muons, alg.muonsSelection = config.readNameAndSelection (self.muons, excludeFrom={
'or'})
98 if self.electrons !=
"" :
99 alg.electrons, alg.electronsSelection = config.readNameAndSelection (self.electrons, excludeFrom={
'or'})
100 if self.photons !=
"" :
101 alg.photons, alg.photonsSelection = config.readNameAndSelection (self.photons, excludeFrom={
'or'})
103 alg.taus, alg.tausSelection = config.readNameAndSelection (self.taus, excludeFrom={
'or'})
104 if self.invisible !=
"" :
105 alg.invisible = config.readName (self.invisible)
106 alg.met = config.writeName (self.containerName, isMet =
True)
110 alg = config.createAlgorithm(
'CP::MetBuilderAlg',
'MetBuilderAlg' + self.containerName )
111 alg.met = config.readName (self.containerName)
115 if self.saveSignificance:
116 alg = config.createAlgorithm(
'CP::MetSignificanceAlg',
'MetSignificanceAlg' + self.containerName )
117 config.addPrivateTool(
'significanceTool',
'met::METSignificance' )
118 if self.muons !=
"" :
119 config.addPrivateTool(
'significanceTool.MuonCalibTool',
'CP::MuonCalibTool' )
121 alg.significanceTool.MuonCalibTool.calibMode = (
122 config.calibMode(self.muons.
split(
".")[0]))
124 alg.significanceTool.SoftTermParam = 0
125 alg.significanceTool.TreatPUJets = self.treatPUJets
126 alg.significanceTool.IsAFII = config.dataType()
is DataType.FastSim
127 alg.met = config.readName (self.containerName)
128 config.addOutputVar (self.containerName,
'significance',
'significance')
130 config.addOutputVar (self.containerName,
'met',
'met')
131 config.addOutputVar (self.containerName,
'phi',
'phi')
132 config.addOutputVar (self.containerName,
'sumet',
'sumet')