97 def makeTriggerGlobalEffCorrAlg(self, config, matchingTool, noSF,
100 alg = config.createAlgorithm(
'CP::TrigGlobalEfficiencyAlg',
'TrigGlobalSFAlg' + triggerSuffix )
101 if config.geometry()
is LHCPeriod.Run3:
102 alg.triggers_2022 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in self.triggerChainsPerYear.
get(
'2022',[])]
103 alg.triggers_2023 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in self.triggerChainsPerYear.
get(
'2023',[])]
104 alg.triggers_2024 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in self.triggerChainsPerYear.
get(
'2024',[])]
105 alg.triggers_2025 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in self.triggerChainsPerYear.
get(
'2025',[])]
106 if config.campaign()
in [Campaign.MC21a, Campaign.MC23a]:
107 if not alg.triggers_2022:
108 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2022!' )
109 elif config.campaign()
in [Campaign.MC23c, Campaign.MC23d]:
110 if not alg.triggers_2023:
111 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2023!' )
113 alg.triggers_2015 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in self.triggerChainsPerYear.
get(
'2015',[])]
114 alg.triggers_2016 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in self.triggerChainsPerYear.
get(
'2016',[])]
115 alg.triggers_2017 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in self.triggerChainsPerYear.
get(
'2017',[])]
116 alg.triggers_2018 = [trig.replace(
"HLT_",
"").
replace(
" || ",
"_OR_")
for trig
in self.triggerChainsPerYear.
get(
'2018',[])]
117 if config.campaign()
is Campaign.MC20a:
118 if not (alg.triggers_2015
and alg.triggers_2016):
119 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the years 2015 and 2016!' )
120 elif config.campaign()
is Campaign.MC20d:
121 if not alg.triggers_2017:
122 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2017!' )
123 elif config.campaign()
is Campaign.MC20e:
124 if not alg.triggers_2018:
125 raise ValueError(
'TriggerAnalysisConfig: you must provide a set of triggers for the year 2018!' )
127 alg.matchingTool =
'%s/%s' % ( matchingTool.getType(), matchingTool.getName() )
128 alg.isRun3Geo = config.geometry()
is LHCPeriod.Run3
129 alg.scaleFactorDecoration =
'globalTriggerEffSF'+triggerSuffix+
'_%SYS%'
130 alg.matchingDecoration =
'globalTriggerMatch'+triggerSuffix+
'_%SYS%'
131 alg.eventDecisionOutputDecoration =
'globalTriggerMatch'+triggerSuffix+
'_dontsave_%SYS%'
132 alg.doMatchingOnly = config.dataType()
is DataType.Data
or noSF
133 alg.noFilter = self.noFilter
134 alg.electronID = self.electronID
135 alg.electronIsol = self.electronIsol
136 alg.photonIsol = self.photonIsol
137 alg.muonID = self.muonID
139 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
141 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
143 alg.photons, alg.photonSelection = config.readNameAndSelection(self.photons)
144 if not (self.electrons
or self.muons
or self.photons):
145 raise ValueError (
'TriggerAnalysisConfig: at least one object collection must be provided! (electrons, muons, photons)' )
147 if config.dataType()
is not DataType.Data
and not alg.doMatchingOnly:
148 config.addOutputVar (
'EventInfo', alg.scaleFactorDecoration,
'globalTriggerEffSF'+triggerSuffix)
149 config.addOutputVar (
'EventInfo', alg.matchingDecoration,
'globalTriggerMatch'+triggerSuffix, noSys=
False)