208 def configureMonitor( self ):
210 acc = self.helper.resobj
211 EgammaMatchTool = CompFactory.TrigEgammaMatchingToolMT()
212 EgammaMatchTool.DeltaR=0.4
213 acc.addPublicTool(EgammaMatchTool)
214 cppyy.load_library(
'libElectronPhotonSelectorToolsDict')
218 LooseElectronSelector = CompFactory.AsgElectronIsEMSelector(
"T0HLTLooseElectronSelector")
219 MediumElectronSelector = CompFactory.AsgElectronIsEMSelector(
"T0HLTMediumElectronSelector")
220 TightElectronSelector = CompFactory.AsgElectronIsEMSelector(
"T0HLTTightElectronSelector")
221 LooseLHSelector = CompFactory.AsgElectronLikelihoodTool(
"T0HLTLooseLHSelector")
222 MediumLHSelector = CompFactory.AsgElectronLikelihoodTool(
"T0HLTMediumLHSelector")
223 TightLHSelector = CompFactory.AsgElectronLikelihoodTool(
"T0HLTTightLHSelector")
224 VeryLooseLHSelector = CompFactory.AsgElectronLikelihoodTool(
"T0HLTVeryLooseLHSelector")
227 LooseDNNElectronSelector = CompFactory.AsgElectronSelectorTool(
"T0HLTLooseElectronDNNSelector")
228 MediumDNNElectronSelector = CompFactory.AsgElectronSelectorTool(
"T0HLTMediumElectronDNNSelector")
229 TightDNNElectronSelector = CompFactory.AsgElectronSelectorTool(
"T0HLTTightElectronDNNSelector")
231 LoosePhotonSelector = CompFactory.AsgPhotonIsEMSelector(
"T0HLTLoosePhotonSelector" )
232 MediumPhotonSelector = CompFactory.AsgPhotonIsEMSelector(
"T0HLTMediumPhotonSelector" )
233 TightPhotonSelector = CompFactory.AsgPhotonIsEMSelector(
"T0HLTTightPhotonSelector" )
235 LoosePhotonSelector.ForceConvertedPhotonPID =
True
236 LoosePhotonSelector.isEMMask = SelectionDefPhoton.PhotonLoose
237 MediumPhotonSelector.ForceConvertedPhotonPID =
True
238 MediumPhotonSelector.isEMMask = SelectionDefPhoton.PhotonMedium
239 TightPhotonSelector.ForceConvertedPhotonPID =
True
240 TightPhotonSelector.isEMMask = SelectionDefPhoton.PhotonTight
243 acc.addPublicTool(LooseElectronSelector)
244 acc.addPublicTool(MediumElectronSelector)
245 acc.addPublicTool(TightElectronSelector)
246 acc.addPublicTool(LooseLHSelector)
247 acc.addPublicTool(MediumLHSelector)
248 acc.addPublicTool(TightLHSelector)
249 acc.addPublicTool(VeryLooseLHSelector)
250 acc.addPublicTool(LooseDNNElectronSelector)
251 acc.addPublicTool(MediumDNNElectronSelector)
252 acc.addPublicTool(TightDNNElectronSelector)
254 if self.runFlag ==
'2022':
255 raise RuntimeError(
'2022 (Run 3) configuration not available yet' )
258 elif self.runFlag ==
'2018':
260 LooseElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMLooseSelectorCutDefs.conf"
261 MediumElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMMediumSelectorCutDefs.conf"
262 TightElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMTightSelectorCutDefs.conf"
264 LooseLHSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc20_20210514/ElectronLikelihoodLooseOfflineConfig2017_CutBL_Smooth.conf"
265 MediumLHSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc20_20210514/ElectronLikelihoodMediumOfflineConfig2017_Smooth.conf"
266 TightLHSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc20_20210514/ElectronLikelihoodTightOfflineConfig2017_Smooth.conf"
267 VeryLooseLHSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc20_20210514/ElectronLikelihoodVeryLooseOfflineConfig2017_Smooth.conf"
269 LooseDNNElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassLoose.conf"
270 MediumDNNElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassMedium.conf"
271 TightDNNElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassTight.conf"
273 TightPhotonSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMTightSelectorCutDefs.conf"
274 MediumPhotonSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMMediumSelectorCutDefs.conf"
275 LoosePhotonSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf"
277 elif self.runFlag ==
'2017':
279 LooseElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMLooseSelectorCutDefs.conf"
280 MediumElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMMediumSelectorCutDefs.conf"
281 TightElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/ElectronIsEMTightSelectorCutDefs.conf"
283 LooseLHSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodLooseOfflineConfig2016_CutBL_Smooth.conf"
284 MediumLHSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodMediumOfflineConfig2016_Smooth.conf"
285 TightLHSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodTightOfflineConfig2016_Smooth.conf"
286 VeryLooseLHSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodVeryLooseOfflineConfig2016_Smooth.conf"
288 LooseDNNElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassLoose.conf"
289 MediumDNNElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassMedium.conf"
290 TightDNNElectronSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc16_20210430/ElectronDNNMulticlassTight.conf"
292 TightPhotonSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMTightSelectorCutDefs.conf"
293 MediumPhotonSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMMediumSelectorCutDefs.conf"
294 LoosePhotonSelector.ConfigFile =
"ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf"
298 raise RuntimeError(
'Wrong run flag configuration' )
302 if self.activate_zee:
305 self.__logger.
info(
"Creating the Zee monitor algorithm LH only...")
306 self.zeeMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorTagAndProbeAlgorithm,
"TrigEgammaMonitorTagAndProbeAlgorithm_Zee_LH" )
307 self.zeeMonAlg.Analysis=
'Zee'
308 self.zeeMonAlg.MatchTool = EgammaMatchTool
309 self.zeeMonAlg.TPTrigger=
False
310 self.zeeMonAlg.ElectronKey =
'Electrons'
311 self.zeeMonAlg.isEMResultNames=self.isemnames
312 self.zeeMonAlg.LHResultNames=self.lhnames
313 self.zeeMonAlg.DNNResultNames=self.dnnnames
314 self.zeeMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector]
315 self.zeeMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector,VeryLooseLHSelector]
316 self.zeeMonAlg.ElectronDNNSelectorTool =[TightDNNElectronSelector,MediumDNNElectronSelector,LooseDNNElectronSelector]
317 self.zeeMonAlg.ZeeLowerMass=80
318 self.zeeMonAlg.ZeeUpperMass=100
319 self.zeeMonAlg.OfflineTagMinEt=25
320 self.zeeMonAlg.OfflineTagSelector=
'lhtight'
321 self.zeeMonAlg.OfflineProbeSelector=
'lhloose'
322 self.zeeMonAlg.OppositeCharge=
True
323 self.zeeMonAlg.RemoveCrack=
False
324 self.zeeMonAlg.TagTriggerList=tagItems
325 self.zeeMonAlg.TriggerList=tpList
326 self.zeeMonAlg.DetailedHistograms=self.detailedHistograms
327 self.zeeMonAlg.DoEmulation =
False
328 self.zeeMonAlg.ApplyJetNearProbeSelection =
False
334 self.__logger.
info(
"Creating the Zee monitor algorithm DNN only...")
335 self.zeeMonAlg_dnn = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorTagAndProbeAlgorithm,
"TrigEgammaMonitorTagAndProbeAlgorithm_Zee_DNN" )
336 self.zeeMonAlg_dnn.Analysis=
'Zee_DNN'
337 self.zeeMonAlg_dnn.MatchTool = EgammaMatchTool
338 self.zeeMonAlg_dnn.TPTrigger=
False
339 self.zeeMonAlg_dnn.ElectronKey =
'Electrons'
340 self.zeeMonAlg_dnn.isEMResultNames=self.isemnames
341 self.zeeMonAlg_dnn.LHResultNames=self.lhnames
342 self.zeeMonAlg_dnn.DNNResultNames=self.dnnnames
343 self.zeeMonAlg_dnn.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector]
344 self.zeeMonAlg_dnn.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector,VeryLooseLHSelector]
345 self.zeeMonAlg_dnn.ElectronDNNSelectorTool =[TightDNNElectronSelector,MediumDNNElectronSelector,LooseDNNElectronSelector]
346 self.zeeMonAlg_dnn.ZeeLowerMass=80
347 self.zeeMonAlg_dnn.ZeeUpperMass=100
348 self.zeeMonAlg_dnn.OfflineTagMinEt=25
349 self.zeeMonAlg_dnn.OfflineTagSelector=
'dnntight'
350 self.zeeMonAlg_dnn.OfflineProbeSelector=
'dnnloose'
351 self.zeeMonAlg_dnn.OppositeCharge=
True
352 self.zeeMonAlg_dnn.RemoveCrack=
False
353 self.zeeMonAlg_dnn.TagTriggerList=tagItems
354 self.zeeMonAlg_dnn.TriggerList=tpList
355 self.zeeMonAlg_dnn.DetailedHistograms=self.detailedHistograms
356 self.zeeMonAlg_dnn.DoEmulation =
False
357 self.zeeMonAlg_dnn.ApplyJetNearProbeSelection =
False
360 self.emulator.TriggerList += self.tpList
361 self.zeeMonAlg.DoEmulation =
True
362 self.zeeMonAlg.EmulationTool = self.emulator.core()
363 self.zeeMonAlg_dnn.DoEmulation =
True
364 self.zeeMonAlg_dnn.EmulationTool = self.emulator.core()
369 if self.activate_jpsiee:
371 self.__logger.
info(
"Creating the Jpsiee monitor algorithm...")
372 self.jpsieeMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorTagAndProbeAlgorithm,
"TrigEgammaMonitorTagAndProbeAlgorithm_Jpsiee" )
373 self.jpsieeMonAlg.DoJpsiee=
True
374 self.jpsieeMonAlg.Analysis=
'Jpsiee'
375 self.jpsieeMonAlg.MatchTool = EgammaMatchTool
376 self.jpsieeMonAlg.TPTrigger=
False
377 self.jpsieeMonAlg.ElectronKey =
'Electrons'
378 self.jpsieeMonAlg.isEMResultNames=self.isemnames
379 self.jpsieeMonAlg.LHResultNames=self.lhnames
380 self.jpsieeMonAlg.DNNResultNames=self.dnnnames
381 self.jpsieeMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector]
382 self.jpsieeMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector,VeryLooseLHSelector]
383 self.jpsieeMonAlg.ElectronDNNSelectorTool =[TightDNNElectronSelector,MediumDNNElectronSelector,LooseDNNElectronSelector]
384 self.jpsieeMonAlg.ZeeLowerMass=2
385 self.jpsieeMonAlg.ZeeUpperMass=5
386 self.jpsieeMonAlg.OfflineTagMinEt=5
387 self.jpsieeMonAlg.OfflineTagSelector=
'lhtight'
388 self.jpsieeMonAlg.OfflineProbeSelector=
'lhloose'
389 self.jpsieeMonAlg.OppositeCharge=
True
390 self.jpsieeMonAlg.RemoveCrack=
False
391 self.jpsieeMonAlg.TagTriggerList=self.jpsitagItems
392 self.jpsieeMonAlg.TriggerList=self.jpsiList
393 self.jpsieeMonAlg.DetailedHistograms=self.detailedHistograms
394 self.jpsieeMonAlg.DoEmulation =
False
395 self.jpsieeMonAlg.ApplyJetNearProbeSelection =
False
397 if self.activate_electron:
399 self.__logger.
info(
"Creating the Electron monitor algorithm...")
400 self.elMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorElectronAlgorithm,
"TrigEgammaMonitorElectronAlgorithm" )
401 self.elMonAlg.MatchTool = EgammaMatchTool
402 self.elMonAlg.Analysis =
"Electrons"
403 self.elMonAlg.ElectronKey =
'Electrons'
404 self.elMonAlg.isEMResultNames=self.isemnames
405 self.elMonAlg.LHResultNames=self.lhnames
406 self.elMonAlg.DNNResultNames=self.dnnnames
407 self.elMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector]
408 self.elMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector,VeryLooseLHSelector]
409 self.elMonAlg.ForcePidSelection=
True
410 self.elMonAlg.ForceProbeIsolation=
False
411 self.elMonAlg.ForceEtThreshold=
True
412 self.elMonAlg.TriggerList=self.electronList
413 self.elMonAlg.DetailedHistograms=self.detailedHistograms
414 self.elMonAlg.DoEmulation =
False
417 self.elMonAlg.DoEmulation =
True
418 self.emulator.TriggerList += self.electronList
419 self.elMonAlg.EmulationTool = self.emulator.core()
422 if self.activate_photon:
424 self.__logger.
info(
"Creating the Photon monitor algorithm...")
425 self.phMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorPhotonAlgorithm,
"TrigEgammaMonitorPhotonAlgorithm" )
426 self.phMonAlg.Analysis =
"Photons"
427 self.phMonAlg.MatchTool = EgammaMatchTool
428 self.phMonAlg.PhotonKey =
'Photons'
429 self.phMonAlg.PhotonIsolationKeys = [
"Photons.topoetcone20",
"Photons.topoetcone40"]
430 self.phMonAlg.isEMResultNames=self.isemnames
431 self.phMonAlg.LHResultNames=self.lhnames
432 self.phMonAlg.PhotonIsEMSelector =[TightPhotonSelector,MediumPhotonSelector,LoosePhotonSelector]
433 self.phMonAlg.TriggerList=self.photonList
434 self.phMonAlg.BootstrapTriggerMap = self.bootstrapMap
435 self.phMonAlg.DetailedHistograms=self.detailedHistograms
436 self.phMonAlg.ForcePidSelection=
True
437 self.phMonAlg.DoUnconverted=
False
438 self.phMonAlg.DoEmulation =
False
443 self.phMonAlg.DoEmulation =
True
444 self.emulator.TriggerList += self.photonList
445 self.phMonAlg.EmulationTool = self.emulator.core()
448 if self.activate_topo:
450 self.__logger.
info(
"Creating the combo monitor algorithm...")
451 self.topoMonAlg = self.helper.addAlgorithm( CompFactory.TrigEgammaMonitorTopoAlgorithm,
"TrigEgammaMonitorTopoAlgorithm" )
452 self.topoMonAlg.MatchTool = EgammaMatchTool
453 self.topoMonAlg.ElectronKey =
'Electrons'
454 self.topoMonAlg.PhotonKey =
'Photons'
455 self.topoMonAlg.isEMResultNames=self.isemnames
456 self.topoMonAlg.LHResultNames=self.lhnames
457 self.topoMonAlg.DNNResultNames=self.dnnnames
458 self.topoMonAlg.ElectronIsEMSelector =[TightElectronSelector,MediumElectronSelector,LooseElectronSelector]
459 self.topoMonAlg.ElectronLikelihoodTool =[TightLHSelector,MediumLHSelector,LooseLHSelector]
460 self.topoMonAlg.DetailedHistograms=self.detailedHistograms
461 self.topoMonAlg.TriggerListConfig = self.topoList