3 from AnalysisAlgorithmsConfig.ConfigBlock
import ConfigBlock
4 from AsgAnalysisAlgorithms.AsgAnalysisConfig
import makeEventCutFlowConfig
5 from AnalysisAlgorithmsConfig.ConfigAccumulator
import DataType
9 """ConfigBlock for merging the output of various selection streams"""
12 super(EventSelectionMergerConfig, self).
__init__()
13 self.addOption(
'selections', [], type=list,
14 info=
"the selection decisions (list of strings) to unify into a "
15 "final decision (internally: selection_1 || selection_2 || ...). "
16 "The default is [] (empty list).")
17 self.addOption(
'noFilter',
False, type=bool,
18 info=
"do not apply an event filter. The default is False, i.e. "
19 "remove events not passing the full list of selection cuts.")
22 if not ( isinstance(self.selections, list)
and self.selections
and all(isinstance(item, str)
for item
in self.selections) ):
23 print(
'EventSelectionMerger: selections = ', self.selections)
24 raise ValueError(
'EventSelectionMerger requires a non-empty list of selection strings to be '
25 'passed as `selections`!')
26 alg = config.createAlgorithm(
'CP::SaveFilterAlg',
'EventSelectionMerger' + self.selections[0].
split(
"_%SYS%")[0])
27 alg.FilterDescription =
'events passing at least one EventSelection algorithm'
28 alg.eventDecisionOutputDecoration =
'ignore_anySelection_%SYS%'
29 alg.selection =
'||'.
join([sel+
',as_char' for sel
in self.selections
if sel])
30 alg.noFilter = self.noFilter
31 alg.selectionName =
'pass_anySelection_%SYS%'
32 alg.decorationName =
'ntuplepass_anySelection_%SYS%'
35 """ConfigBlock for interpreting text-based event selections"""
38 super(EventSelectionConfig, self).
__init__()
39 self.addOption(
'name', name, type=str,
41 info=
"the name of the event selection, used to uniquely identify "
42 "the EventSelectionConfig block.")
43 self.addOption(
'electrons',
"", type=str,
44 info=
"the input electron container, with a possible selection, in "
45 "the format container or container.selection. The default is '' "
47 self.addOption(
'muons',
"", type=str,
48 info=
"the input muon container, with a possible selection, in the "
49 "format container or container.selection. The default is '' "
51 self.addOption(
'jets',
"", type=str,
52 info=
"the input jet container, with a possible selection, in the "
53 "format container or container.selection. The default is '' "
55 self.addOption(
'largeRjets',
"", type=str,
56 info=
"the large-R jet container, with a possible selection, in "
57 "the format container or container.selection. The default is '' "
59 self.addOption(
'photons',
"", type=str,
60 info=
"the input photon container, with a possible selection, in "
61 "the format container or container.selection. The default is '' "
63 self.addOption(
'taus',
"", type=str,
64 info=
"the input tau-jet container, with a possible selection, in "
65 "the format container or container.selection. The default is '' "
67 self.addOption(
'met',
"", type=str,
68 info=
"he input MET container. The default is '' (empty string).")
70 self.addOption(
'metTerm',
"Final", type=str,
72 self.addOption(
'btagDecoration',
"", type=str,
73 info=
"the b-tagging decoration to use when defining b-jets. "
74 "The default is '' (empty string).")
75 self.addOption(
'preselection',
"", type=str,
76 info=
"the event-wise selection flag to start this event selection "
77 "from. The default is '' (empty string).")
78 self.addOption(
'selectionCuts',
"", type=str,
80 info=
"a single string listing one selection cut per line.")
81 self.addOption(
'noFilter',
False, type=bool,
82 info=
"do not apply an event filter. The default is False, i.e. "
83 "remove events not passing the full list of selection cuts.")
84 self.addOption(
'debugMode',
False, type=bool,
85 info=
"whether to create an output branch for every single line "
86 "of the selection cuts. The default is False (only saves the"
88 self.addOption(
'useDressedProperties',
True, type=bool,
89 info=
"whether to use dressed truth electron and truth muon "
90 "kinematics rather than simple P4 kinematics.")
104 if self.selectionCuts
is None:
105 raise ValueError (
"[EventSelectionConfig] You must provide the 'selectionCuts' option to 'EventSelectionConfig': "
106 "a single string where each line represents a different selection cut to apply in order.")
107 for line
in self.selectionCuts.
split(
"\n"):
115 if text.startswith(
"#"):
118 if "EL_N" in text.split():
120 elif "MU_N" in text.split():
122 elif "SUM_EL_N_MU_N" in text.split():
124 elif "SUM_EL_N_MU_N_TAU_N" in text.split():
126 elif "JET_N_GHOST" in text.split():
128 elif "JET_N" in text.split():
130 elif "JET_N_BTAG" in text.split():
132 elif "PH_N" in text.split():
134 elif "TAU_N" in text.split():
136 elif "LJET_N_GHOST" in text.split():
138 elif "LJET_N" in text.split():
140 elif "MET" in text.split():
142 elif "MWT" in text.split():
144 elif "MET+MWT" in text.split():
146 elif "MLL" in text.split():
148 elif "MLLWINDOW" in text.split():
150 elif "OS" in text.split():
152 elif "SS" in text.split():
154 elif "MLL_OSSF" in text.split():
156 elif "LJETMASS_N" in text.split():
158 elif "LJETMASSWINDOW_N" in text.split():
160 elif "SAVE" in text.split():
162 elif "IMPORT" in text.split():
164 elif "EVENTFLAG" in text.split():
166 elif "GLOBALTRIGMATCH" in text.split():
168 elif "RUN_NUMBER" in text.split():
171 raise ValueError (f
"[EventSelectionConfig] The following selection cut is not recognised! --> {text}")
174 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Check {keyword} in: {text}")
177 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Missing input collection for {collection}")
182 if not requirePositive
or value >= 0:
185 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Float {test} is not positive!")
187 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be a float, not {type(test)}!")
192 if value ==
float(test):
193 if not requirePositive
or value >= 0:
196 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Int {test} us not positive!")
198 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be an int, not a float!")
200 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be an int, not {type(test)}")
203 if not isinstance(test, str):
204 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be a string, not a number!")
219 raise KeyError (f
"[EventSelectionConfig] Misconfiguration! {test} should be one of {list(mapping.keys())}")
222 test = test.split(
":")
224 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be provided as 'btagger:btagWP'")
230 values = test.split(
"!")
232 "B":
"GhostBHadronsFinalCount",
233 "C":
"GhostCHadronsFinalCount",
234 "T":
"GhostTQuarksFinalCount",
235 "W":
"GhostWBosonsCount",
236 "Z":
"GhostZBosonsCount",
237 "H":
"GhostHBosonsCount",
238 "TAU":
"GhostTausFinalCount"
240 return [ghost_map.get(value.upper(), value)
for value
in values]
247 if algorithm
is not None:
248 algorithm.decorationName = f
'{decoration},as_char'
251 config.addOutputVar(
'EventInfo', decoration, decoration.split(
"_%SYS%")[0])
257 config.addSelection(
'EventInfo',
'', decoration)
263 decoration = decoration.split(
"&&")
264 decoration = [sub +
',as_char' if ',as_char' not in sub
else sub
for sub
in decoration]
265 return '&&'.
join(decoration)
270 if items[0] !=
"IMPORT":
278 self.
currentDecoration = f
'{self.currentDecoration},as_char&&pass_{region}_%SYS%'
280 imported_cuts = [cut
for cut
in config.getSelectionCutFlow(
'EventInfo',
'')
if cut.startswith(region)]
286 if items[0] !=
"EL_N":
288 if len(items) != 4
and len(items) != 5:
290 if not self.electrons:
292 thisalg = f
'{self.name}_NEL_{self.step}'
293 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
294 alg.particles, alg.objectSelection = config.readNameAndSelection(self.electrons)
295 if "Truth" in self.electrons:
296 alg.useDressedProperties = self.useDressedProperties
302 elif len(items) == 5:
304 if alg.objectSelection:
305 alg.objectSelection +=
"&&" + config.getFullSelection(self.electrons.
split(
".")[0], extraSel)
307 alg.objectSelection = config.getFullSelection(self.electrons.
split(
".")[0], extraSel)
316 if items[0] !=
"MU_N":
318 if len(items) != 4
and len(items) != 5:
322 thisalg = f
'{self.name}_NMU_{self.step}'
323 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
324 alg.particles, alg.objectSelection = config.readNameAndSelection(self.muons)
325 if "Truth" in self.muons:
326 alg.useDressedProperties = self.useDressedProperties
332 elif len(items) == 5:
334 if alg.objectSelection:
335 alg.objectSelection +=
"&&" + config.getFullSelection(self.muons.
split(
".")[0], extraSel)
337 alg.objectSelection = config.getFullSelection(self.muons.
split(
".")[0], extraSel)
346 if items[0] !=
"SUM_EL_N_MU_N":
348 if len(items) != 4
and len(items) != 5:
350 if not self.electrons
and not self.muons:
352 thisalg = f
'{self.name}_SUMNELNMU_{self.step}'
353 alg = config.createAlgorithm(
'CP::SumNLeptonPtSelectorAlg', thisalg)
354 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
355 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
356 if "Truth" in self.electrons:
357 alg.useDressedProperties = self.useDressedProperties
364 elif len(items) == 5:
374 if items[0] !=
"SUM_EL_N_MU_N_TAU_N":
376 if len(items) != 4
and len(items) != 6:
378 if not self.electrons
and not self.muons
and not self.taus:
380 thisalg = f
'{self.name}_SUMNLEPTONS_{self.step}'
381 alg = config.createAlgorithm(
'CP::SumNLeptonPtSelectorAlg', thisalg)
382 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
383 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
384 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
385 if "Truth" in self.electrons:
386 alg.useDressedProperties = self.useDressedProperties
394 elif len(items) == 6:
405 if items[0] !=
"JET_N":
407 if len(items) != 4
and len(items) != 5:
411 thisalg = f
'{self.name}_NJET_{self.step}'
412 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
413 alg.particles, alg.objectSelection = config.readNameAndSelection(self.jets)
419 elif len(items) == 5:
421 if alg.objectSelection:
422 alg.objectSelection +=
"&&" + config.getFullSelection(self.jets.
split(
".")[0], extraSel)
424 alg.objectSelection = config.getFullSelection(self.jets.
split(
".")[0], extraSel)
433 if items[0] !=
"JET_N_BTAG":
435 if len(items) != 3
and len(items) != 4
and len(items) != 5:
439 thisalg = f
'{self.name}_NBJET_{self.step}'
440 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
441 particles, selection = config.readNameAndSelection(self.jets)
442 alg.particles = particles
443 alg.objectSelection = f
'{selection}&&{self.btagDecoration},as_char' if selection
else f
'{self.btagDecoration},as_char'
448 elif len(items) == 4:
451 customBtag = f
'ftag_select_{btagger}_{btagWP}'
452 alg.objectSelection = f
'{selection}&&{customBtag},as_char' if selection
else f
'{customBtag},as_char'
455 alg.objectSelection +=
"&&" + config.getFullSelection(self.jets.
split(
".")[0], extraSel)
458 elif len(items) == 5:
461 customBtag = f
'ftag_select_{btagger}_{btagWP}'
462 alg.objectSelection = f
'{selection}&&{customBtag},as_char' if selection
else f
'{customBtag},as_char'
463 alg.objectSelection+=
"&&" + config.getFullSelection(self.jets.
split(
".")[0], extraSel)
471 if items[0] !=
"PH_N":
473 if len(items) != 4
and len(items) != 5:
477 thisalg = f
'{self.name}_NPH_{self.step}'
478 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
479 alg.particles, alg.objectSelection = config.readNameAndSelection(self.photons)
485 elif len(items) == 5:
487 if alg.objectSelection:
488 alg.objectSelection +=
"&&" + config.getFullSelection(self.photons.
split(
".")[0], extraSel)
490 alg.objectSelection = config.getFullSelection(self.photons.
split(
".")[0], extraSel)
499 if items[0] !=
"TAU_N":
501 if len(items) != 4
and len(items) != 5:
505 thisalg = f
'{self.name}_NTAU_{self.step}'
506 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
507 alg.particles, alg.objectSelection = config.readNameAndSelection(self.taus)
513 elif len(items) == 5:
515 if alg.objectSelection:
516 alg.objectSelection +=
"&&" + config.getFullSelection(self.taus.
split(
".")[0], extraSel)
518 alg.objectSelection = config.getFullSelection(self.taus.
split(
".")[0], extraSel)
527 if items[0] !=
"LJET_N":
529 if len(items) != 4
and len(items) != 5:
531 thisalg = f
'{self.name}_NLJET_{self.step}'
532 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
533 alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets)
539 elif len(items) == 5:
541 if alg.objectSelection:
542 alg.objectSelection +=
"&&" + config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
544 alg.objectSelection = config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
553 if items[0] !=
"LJETMASS_N":
555 if len(items) != 4
and len(items) != 5:
557 thisalg = f
'{self.name}_NLJETMASS_{self.step}'
558 alg = config.createAlgorithm(
'CP::NObjectMassSelectorAlg', thisalg)
559 alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets)
565 elif len(items) == 5:
567 if alg.objectSelection:
568 alg.objectSelection +=
"&&" + config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
570 alg.objectSelection = config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
579 if items[0] !=
"LJETMASSWINDOW_N":
581 if len(items) != 5
and len(items) != 6
and len(items) != 7:
583 thisalg = f
'{self.name}_NLJETMASSWINDOW_{self.step}'
584 alg = config.createAlgorithm(
'CP::NLargeRJetMassWindowSelectorAlg', thisalg)
585 alg.ljets, alg.ljetSelection = config.readNameAndSelection(self.largeRjets)
586 vetoMode = items[-1] ==
'veto' or items[-1] ==
'VETO'
587 if len(items) == 5
or (len(items) == 6
and vetoMode):
592 alg.vetoMode = vetoMode
593 elif (len(items) == 6
and not vetoMode)
or len(items) == 7:
595 if alg.ljetSelection:
596 alg.ljetSelection +=
"&&" + config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
598 alg.ljetSelection = config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
603 alg.vetoMode = vetoMode
610 if items[0] !=
"JET_N_GHOST":
612 if len(items) != 4
and len(items) != 5:
614 thisalg = f
'{self.name}_NJETGHOST_{self.step}'
615 alg = config.createAlgorithm(
'CP::JetNGhostSelectorAlg', thisalg)
616 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
618 alg.ghost = ghosts[0]
624 elif len(items) == 5:
634 if items[0] !=
"LJET_N_GHOST":
636 if len(items) != 4
and len(items) != 5:
638 thisalg = f
'{self.name}_NLJETGHOST_{self.step}'
639 alg = config.createAlgorithm(
'CP::JetNGhostSelectorAlg', thisalg)
640 alg.jets, alg.jetSelection = config.readNameAndSelection(self.largeRjets)
642 alg.ghost = ghosts[0]
648 elif len(items) == 5:
658 if items[0] !=
"MET":
664 thisalg = f
'{self.name}_MET_{self.step}'
665 alg = config.createAlgorithm(
'CP::MissingETSelectorAlg', thisalg)
666 alg.met = config.readName(self.met)
667 alg.metTerm = self.metTerm
676 if items[0] !=
"MWT":
680 if not self.electrons
and not self.muons:
682 thisalg = f
'{self.name}_MWT_{self.step}'
683 alg = config.createAlgorithm(
'CP::TransverseMassSelectorAlg', thisalg)
684 alg.met = config.readName(self.met)
685 alg.metTerm = self.metTerm
686 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
687 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
688 if "Truth" in self.electrons
or "Truth" in self.muons:
689 alg.useDressedProperties = self.useDressedProperties
698 if items[0] !=
"MET+MWT":
704 if not self.electrons
and not self.muons:
706 thisalg = f
'{self.name}_METMWT_{self.step}'
707 alg = config.createAlgorithm(
'CP::MissingETPlusTransverseMassSelectorAlg', thisalg)
708 alg.met = config.readName(self.met)
709 alg.metTerm = self.metTerm
710 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
711 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
712 if "Truth" in self.electrons
or "Truth" in self.muons:
713 alg.useDressedProperties = self.useDressedProperties
722 if items[0] !=
"MLL":
726 if not self.electrons
and not self.muons:
728 thisalg = f
'{self.name}_MLL_{self.step}'
729 alg = config.createAlgorithm(
'CP::DileptonInvariantMassSelectorAlg', thisalg)
731 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
733 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
734 if "Truth" in self.electrons
or "Truth" in self.muons:
735 alg.useDressedProperties = self.useDressedProperties
744 if items[0] !=
"MLLWINDOW":
746 if len(items) != 3
and len(items) != 4:
748 if not self.electrons
and not self.muons:
750 thisalg = f
'{self.name}_MLLWINDOW_{self.step}'
751 alg = config.createAlgorithm(
'CP::DileptonInvariantMassWindowSelectorAlg', thisalg)
753 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
755 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
756 if "Truth" in self.electrons
or "Truth" in self.muons:
757 alg.useDressedProperties = self.useDressedProperties
760 alg.vetoMode = (len(items) == 4
and self.
check_string(items[3]).lower() ==
"veto")
769 if not self.electrons
and not self.muons:
771 thisalg = f
'{self.name}_OS_{self.step}'
772 alg = config.createAlgorithm(
'CP::ChargeSelectorAlg', thisalg)
774 if "Particle" in self.electrons
or "Truth" in self.electrons:
775 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
777 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
779 if "Particle" in self.muons
or "Truth" in self.muons:
780 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
782 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
792 if not self.electrons
and not self.muons:
794 thisalg = f
'{self.name}_SS_{self.step}'
795 alg = config.createAlgorithm(
'CP::ChargeSelectorAlg', thisalg)
797 if "Particle" in self.electrons
or "Truth" in self.electrons:
798 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
800 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
802 if "Particle" in self.muons
or "Truth" in self.muons:
803 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
805 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
813 if items[0] !=
"MLL_OSSF":
815 if len(items) != 3
and len(items) != 4:
817 if not self.electrons
and not self.muons:
819 thisalg = f
'{self.name}_MLL_OSSF_{self.step}'
820 alg = config.createAlgorithm(
'CP::DileptonOSSFInvariantMassWindowSelectorAlg', thisalg)
822 if "Particle" in self.electrons
or "Truth" in self.electrons:
823 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
825 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
827 if "Particle" in self.muons
or "Truth" in self.muons:
828 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
830 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
831 if "Truth" in self.electrons
or "Truth" in self.muons:
832 alg.useDressedProperties = self.useDressedProperties
835 alg.vetoMode = (len(items) == 4
and self.
check_string(items[3]).lower() ==
"veto")
842 if items[0] !=
"EVENTFLAG":
852 if items[0] !=
"GLOBALTRIGMATCH":
854 if len(items) != 1
and len(items) != 2 :
860 self.
setDecorationName(
None, config, f
"globalTriggerMatch{postfix}_%SYS%,as_char")
865 if items[0] !=
"RUN_NUMBER":
869 thisalg = f
'{self.name}_RUN_NUMBER_{self.step}'
870 alg = config.createAlgorithm(
'CP::RunNumberSelectorAlg', thisalg)
873 alg.useRandomRunNumber = config.dataType()
is not DataType.Data
880 if items[0] !=
"SAVE":
884 thisalg = f
'{self.name}_SAVE'
885 alg = config.createAlgorithm(
'CP::SaveFilterAlg', thisalg)
886 alg.FilterDescription = f
'events passing < {self.name} >'
887 alg.eventDecisionOutputDecoration = f
'ignore_{self.name}_%SYS%'
889 alg.noFilter = self.noFilter
890 alg.selectionName = f
'pass_{self.name}_%SYS%,as_char'
891 alg.decorationName = f
'ntuplepass_{self.name}_%SYS%'
892 config.addOutputVar(
'EventInfo', f
'ntuplepass_{self.name}_%SYS%', f
'pass_{self.name}')
897 electrons=None, muons=None, jets=None,
899 photons=None, taus=None, met=None, metTerm=None,
900 btagDecoration=None, preselection=None,
901 selectionCuts=None, noFilter=None,
902 debugMode=None, cutFlowHistograms=None):
903 """Create an event selection config block
906 name -- the name defining this selection
907 electrons -- the electron container and selection
908 muons -- the muon container and selection
909 jets -- the jet container and selection
910 largeRjets -- the large-R jet container and selection
911 photons -- the photon container and selection
912 taus -- the tau-jet container and selection
913 met -- the MET container
914 metTerm -- the MET term to use (e.g. 'Final', 'NonInt')
915 btagDecoration -- the b-tagging decoration to use when defining b-jets
916 preselection -- optional event-wise selection flag to start from
917 selectionCuts -- a string listing one selection cut per line
918 noFilter -- whether to disable the event filter
919 debugMode -- enables saving all intermediate decorations
920 cutFlowHistograms -- whether to toggle event cutflow histograms per systematic
924 config.setOptionValue (
'electrons', electrons)
925 config.setOptionValue (
'muons', muons)
926 config.setOptionValue (
'jets', jets)
927 config.setOptionValue (
'largeRjets', largeRjets)
928 config.setOptionValue (
'photons', photons)
929 config.setOptionValue (
'taus', taus)
930 config.setOptionValue (
'met', met)
931 config.setOptionValue (
'metTerm', metTerm)
932 config.setOptionValue (
'btagDecoration', btagDecoration)
933 config.setOptionValue (
'preselection', preselection)
934 config.setOptionValue (
'selectionCuts', selectionCuts)
935 config.setOptionValue (
'noFilter', noFilter)
936 config.setOptionValue (
'debugMode', debugMode)
940 if cutFlowHistograms:
942 customSelections=name)
945 electrons=None, muons=None, jets=None,
947 photons=None, taus=None, met=None, metTerm=None,
948 btagDecoration=None, preselection=None,
949 selectionCutsDict=None, noFilter=None,
950 debugMode=None, cutFlowHistograms=None):
951 """Create multiple event selection config blocks
954 electrons -- the electron container and selection
955 muons -- the muon container and selection
956 jets -- the jet container and selection
957 largeRjets -- the large-R jet container and selection
958 photons -- the photon container and selection
959 taus -- the tau-jet container and selection
960 met -- the MET container
961 metTerm -- the MET term to use (e.g. 'Final', 'NonInt')
962 btagDecoration -- the b-tagging decoration to use when defining b-jets
963 preselection -- optional event-wise selection flag to start from
964 selectionCutsDict -- a dictionary with key the name of the selection and value a string listing one selection cut per line
965 noFilter -- whether to disable the event filter
966 debugMode -- enables saving all intermediate decorations
967 cutFlowHistograms -- whether to toggle event cutflow histograms per region and per systematic
971 if len(
list(selectionCutsDict.keys())) == 1:
972 name, selectionCuts =
list(selectionCutsDict.items())[0]
973 makeEventSelectionConfig(seq, name, electrons, muons, jets, largeRjets, photons, taus, met, metTerm, btagDecoration, preselection, selectionCuts, noFilter=noFilter, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms)
978 for name, selectionCuts
in selectionCutsDict.items():
979 makeEventSelectionConfig(seq, name, electrons, muons, jets, largeRjets, photons, taus, met, metTerm, btagDecoration, preselection, selectionCuts, noFilter=
True, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms)
984 config.setOptionValue (
'selections', [f
'pass_{name}_%SYS%' for name
in selectionCutsDict.keys()
if not name.startswith(
"SUB")])
985 config.setOptionValue (
'noFilter', noFilter)