96 def makeTriggerGlobalEffCorrAlg(
98 config: ConfigAccumulator,
101 triggerSuffix: str =
''
103 alg = config.createAlgorithm(
'CP::TrigGlobalEfficiencyAlg',
'TrigGlobalSFAlg' + triggerSuffix + self.postfix)
104 if config.geometry()
is LHCPeriod.Run3:
105 alg.triggers_2022 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in get_year_data(self.triggerChainsPerYear, 2022)]
106 alg.triggers_2023 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in get_year_data(self.triggerChainsPerYear, 2023)]
107 alg.triggers_2024 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in get_year_data(self.triggerChainsPerYear, 2024)]
108 alg.triggers_2025 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in get_year_data(self.triggerChainsPerYear, 2025)]
110 if not alg.triggers_2022:
111 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2022!')
113 if not alg.triggers_2023:
114 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2023!')
116 alg.triggers_2015 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in get_year_data(self.triggerChainsPerYear, 2015)]
117 alg.triggers_2016 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in get_year_data(self.triggerChainsPerYear, 2016)]
118 alg.triggers_2017 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in get_year_data(self.triggerChainsPerYear, 2017)]
119 alg.triggers_2018 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in get_year_data(self.triggerChainsPerYear, 2018)]
121 if not (alg.triggers_2015
and alg.triggers_2016):
122 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the years 2015 and 2016!')
124 if not alg.triggers_2015:
125 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2015!')
127 if not alg.triggers_2016:
128 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2016!')
130 if not alg.triggers_2017:
131 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2017!')
133 if not alg.triggers_2018:
134 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2018!')
136 alg.matchingTool =
'%s/%s' % ( matchingTool.getType(), matchingTool.getName() )
137 alg.isRun3Geo = config.geometry()
is LHCPeriod.Run3
138 alg.scaleFactorDecoration =
'globalTriggerEffSF' + triggerSuffix + self.postfix +
'_%SYS%'
139 alg.matchingDecoration =
'globalTriggerMatch' + triggerSuffix + self.postfix +
'_%SYS%'
140 alg.eventDecisionOutputDecoration =
'globalTriggerMatch' + triggerSuffix + self.postfix +
'_dontsave_%SYS%'
141 alg.doMatchingOnly = config.dataType()
is DataType.Data
or noSF
142 alg.noFilter = self.noFilter
143 alg.electronID = self.electronID
144 alg.electronIsol = self.electronIsol
145 alg.photonIsol = self.photonIsol
146 alg.muonID = self.muonID
148 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
150 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
152 alg.photons, alg.photonSelection = config.readNameAndSelection(self.photons)
153 if not (self.electrons
or self.muons
or self.photons):
154 raise ValueError(
'TriggerAnalysisConfig: at least one object collection must be provided! (electrons, muons, photons)' )
156 if config.dataType()
is not DataType.Data
and not alg.doMatchingOnly:
157 config.addOutputVar(
'EventInfo', alg.scaleFactorDecoration,
'globalTriggerEffSF' + triggerSuffix + self.postfix)
158 config.addOutputVar(
'EventInfo', alg.matchingDecoration,
'globalTriggerMatch' + triggerSuffix + self.postfix, noSys=
False)