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 "OBJ_N" in text.split():
142 elif "MET" in text.split():
144 elif "MWT" in text.split():
146 elif "MET+MWT" in text.split():
148 elif "MLL" in text.split():
150 elif "MLLWINDOW" in text.split():
152 elif "OS" in text.split():
154 elif "SS" in text.split():
156 elif "MLL_OSSF" in text.split():
158 elif "LJETMASS_N" in text.split():
160 elif "LJETMASSWINDOW_N" in text.split():
162 elif "SAVE" in text.split():
164 elif "IMPORT" in text.split():
166 elif "EVENTFLAG" in text.split():
168 elif "GLOBALTRIGMATCH" in text.split():
170 elif "RUN_NUMBER" in text.split():
173 raise ValueError (f
"[EventSelectionConfig] The following selection cut is not recognised! --> {text}")
176 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Check {keyword} in: {text}")
179 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Missing input collection for {collection}")
184 if not requirePositive
or value >= 0:
187 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Float {test} is not positive!")
189 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be a float, not {type(test)}!")
194 if value ==
float(test):
195 if not requirePositive
or value >= 0:
198 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Int {test} us not positive!")
200 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be an int, not a float!")
202 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be an int, not {type(test)}")
205 if not isinstance(test, str):
206 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be a string, not a number!")
221 raise KeyError (f
"[EventSelectionConfig] Misconfiguration! {test} should be one of {list(mapping.keys())}")
224 test = test.split(
":")
226 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be provided as 'btagger:btagWP'")
232 values = test.split(
"!")
234 "B":
"GhostBHadronsFinalCount",
235 "C":
"GhostCHadronsFinalCount",
236 "T":
"GhostTQuarksFinalCount",
237 "W":
"GhostWBosonsCount",
238 "Z":
"GhostZBosonsCount",
239 "H":
"GhostHBosonsCount",
240 "TAU":
"GhostTausFinalCount"
242 return [ghost_map.get(value.upper(), value)
for value
in values]
249 if algorithm
is not None:
250 algorithm.decorationName = f
'{decoration},as_char'
253 config.addOutputVar(
'EventInfo', decoration, decoration.split(
"_%SYS%")[0])
259 config.addSelection(
'EventInfo',
'', decoration)
265 decoration = decoration.split(
"&&")
266 decoration = [sub +
',as_char' if ',as_char' not in sub
else sub
for sub
in decoration]
267 return '&&'.
join(decoration)
272 if items[0] !=
"IMPORT":
280 self.
currentDecoration = f
'{self.currentDecoration},as_char&&pass_{region}_%SYS%'
282 imported_cuts = [cut
for cut
in config.getSelectionCutFlow(
'EventInfo',
'')
if cut.startswith(region)]
288 if items[0] !=
"EL_N":
290 if len(items) != 4
and len(items) != 5:
292 if not self.electrons:
294 thisalg = f
'{self.name}_NEL_{self.step}'
295 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
296 alg.particles, alg.objectSelection = config.readNameAndSelection(self.electrons)
297 if "Truth" in self.electrons:
298 alg.useDressedProperties = self.useDressedProperties
304 elif len(items) == 5:
306 if alg.objectSelection:
307 alg.objectSelection +=
"&&" + config.getFullSelection(self.electrons.
split(
".")[0], extraSel)
309 alg.objectSelection = config.getFullSelection(self.electrons.
split(
".")[0], extraSel)
318 if items[0] !=
"MU_N":
320 if len(items) != 4
and len(items) != 5:
324 thisalg = f
'{self.name}_NMU_{self.step}'
325 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
326 alg.particles, alg.objectSelection = config.readNameAndSelection(self.muons)
327 if "Truth" in self.muons:
328 alg.useDressedProperties = self.useDressedProperties
334 elif len(items) == 5:
336 if alg.objectSelection:
337 alg.objectSelection +=
"&&" + config.getFullSelection(self.muons.
split(
".")[0], extraSel)
339 alg.objectSelection = config.getFullSelection(self.muons.
split(
".")[0], extraSel)
348 if items[0] !=
"SUM_EL_N_MU_N":
350 if len(items) != 4
and len(items) != 5:
352 if not self.electrons
and not self.muons:
354 thisalg = f
'{self.name}_SUMNELNMU_{self.step}'
355 alg = config.createAlgorithm(
'CP::SumNLeptonPtSelectorAlg', thisalg)
356 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
357 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
358 if "Truth" in self.electrons:
359 alg.useDressedProperties = self.useDressedProperties
366 elif len(items) == 5:
376 if items[0] !=
"SUM_EL_N_MU_N_TAU_N":
378 if len(items) != 4
and len(items) != 6:
380 if not self.electrons
and not self.muons
and not self.taus:
382 thisalg = f
'{self.name}_SUMNLEPTONS_{self.step}'
383 alg = config.createAlgorithm(
'CP::SumNLeptonPtSelectorAlg', thisalg)
384 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
385 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
386 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
387 if "Truth" in self.electrons:
388 alg.useDressedProperties = self.useDressedProperties
396 elif len(items) == 6:
407 if items[0] !=
"JET_N":
409 if len(items) != 4
and len(items) != 5:
413 thisalg = f
'{self.name}_NJET_{self.step}'
414 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
415 alg.particles, alg.objectSelection = config.readNameAndSelection(self.jets)
421 elif len(items) == 5:
423 if alg.objectSelection:
424 alg.objectSelection +=
"&&" + config.getFullSelection(self.jets.
split(
".")[0], extraSel)
426 alg.objectSelection = config.getFullSelection(self.jets.
split(
".")[0], extraSel)
435 if items[0] !=
"JET_N_BTAG":
437 if len(items) != 3
and len(items) != 4
and len(items) != 5:
441 thisalg = f
'{self.name}_NBJET_{self.step}'
442 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
443 particles, selection = config.readNameAndSelection(self.jets)
444 alg.particles = particles
445 alg.objectSelection = f
'{selection}&&{self.btagDecoration},as_char' if selection
else f
'{self.btagDecoration},as_char'
450 elif len(items) == 4:
453 customBtag = f
'ftag_select_{btagger}_{btagWP}'
454 alg.objectSelection = f
'{selection}&&{customBtag},as_char' if selection
else f
'{customBtag},as_char'
457 alg.objectSelection +=
"&&" + config.getFullSelection(self.jets.
split(
".")[0], extraSel)
460 elif len(items) == 5:
463 customBtag = f
'ftag_select_{btagger}_{btagWP}'
464 alg.objectSelection = f
'{selection}&&{customBtag},as_char' if selection
else f
'{customBtag},as_char'
465 alg.objectSelection+=
"&&" + config.getFullSelection(self.jets.
split(
".")[0], extraSel)
473 if items[0] !=
"PH_N":
475 if len(items) != 4
and len(items) != 5:
479 thisalg = f
'{self.name}_NPH_{self.step}'
480 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
481 alg.particles, alg.objectSelection = config.readNameAndSelection(self.photons)
487 elif len(items) == 5:
489 if alg.objectSelection:
490 alg.objectSelection +=
"&&" + config.getFullSelection(self.photons.
split(
".")[0], extraSel)
492 alg.objectSelection = config.getFullSelection(self.photons.
split(
".")[0], extraSel)
501 if items[0] !=
"TAU_N":
503 if len(items) != 4
and len(items) != 5:
507 thisalg = f
'{self.name}_NTAU_{self.step}'
508 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
509 alg.particles, alg.objectSelection = config.readNameAndSelection(self.taus)
515 elif len(items) == 5:
517 if alg.objectSelection:
518 alg.objectSelection +=
"&&" + config.getFullSelection(self.taus.
split(
".")[0], extraSel)
520 alg.objectSelection = config.getFullSelection(self.taus.
split(
".")[0], extraSel)
529 if items[0] !=
"LJET_N":
531 if len(items) != 4
and len(items) != 5:
533 thisalg = f
'{self.name}_NLJET_{self.step}'
534 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
535 alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets)
541 elif len(items) == 5:
543 if alg.objectSelection:
544 alg.objectSelection +=
"&&" + config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
546 alg.objectSelection = config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
555 if items[0] !=
"LJETMASS_N":
557 if len(items) != 4
and len(items) != 5:
559 thisalg = f
'{self.name}_NLJETMASS_{self.step}'
560 alg = config.createAlgorithm(
'CP::NObjectMassSelectorAlg', thisalg)
561 alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets)
567 elif len(items) == 5:
569 if alg.objectSelection:
570 alg.objectSelection +=
"&&" + config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
572 alg.objectSelection = config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
581 if items[0] !=
"LJETMASSWINDOW_N":
583 if len(items) != 5
and len(items) != 6
and len(items) != 7:
585 thisalg = f
'{self.name}_NLJETMASSWINDOW_{self.step}'
586 alg = config.createAlgorithm(
'CP::NLargeRJetMassWindowSelectorAlg', thisalg)
587 alg.ljets, alg.ljetSelection = config.readNameAndSelection(self.largeRjets)
588 vetoMode = items[-1] ==
'veto' or items[-1] ==
'VETO'
589 if len(items) == 5
or (len(items) == 6
and vetoMode):
594 alg.vetoMode = vetoMode
595 elif (len(items) == 6
and not vetoMode)
or len(items) == 7:
597 if alg.ljetSelection:
598 alg.ljetSelection +=
"&&" + config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
600 alg.ljetSelection = config.getFullSelection(self.largeRjets.
split(
".")[0], extraSel)
605 alg.vetoMode = vetoMode
612 if items[0] !=
"JET_N_GHOST":
614 if len(items) != 4
and len(items) != 5:
616 thisalg = f
'{self.name}_NJETGHOST_{self.step}'
617 alg = config.createAlgorithm(
'CP::JetNGhostSelectorAlg', thisalg)
618 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
620 alg.ghost = ghosts[0]
626 elif len(items) == 5:
636 if items[0] !=
"LJET_N_GHOST":
638 if len(items) != 4
and len(items) != 5:
640 thisalg = f
'{self.name}_NLJETGHOST_{self.step}'
641 alg = config.createAlgorithm(
'CP::JetNGhostSelectorAlg', thisalg)
642 alg.jets, alg.jetSelection = config.readNameAndSelection(self.largeRjets)
644 alg.ghost = ghosts[0]
650 elif len(items) == 5:
660 if items[0] !=
"OBJ_N":
664 thisalg = f
'{self.name}_NOBJ_{self.step}'
665 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
666 alg.particles, alg.objectSelection = config.readNameAndSelection(self.
check_string(items[1]))
676 if items[0] !=
"MET":
682 thisalg = f
'{self.name}_MET_{self.step}'
683 alg = config.createAlgorithm(
'CP::MissingETSelectorAlg', thisalg)
684 alg.met = config.readName(self.met)
685 alg.metTerm = self.metTerm
694 if items[0] !=
"MWT":
698 if not self.electrons
and not self.muons:
700 thisalg = f
'{self.name}_MWT_{self.step}'
701 alg = config.createAlgorithm(
'CP::TransverseMassSelectorAlg', thisalg)
702 alg.met = config.readName(self.met)
703 alg.metTerm = self.metTerm
704 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
705 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
706 if "Truth" in self.electrons
or "Truth" in self.muons:
707 alg.useDressedProperties = self.useDressedProperties
716 if items[0] !=
"MET+MWT":
722 if not self.electrons
and not self.muons:
724 thisalg = f
'{self.name}_METMWT_{self.step}'
725 alg = config.createAlgorithm(
'CP::MissingETPlusTransverseMassSelectorAlg', thisalg)
726 alg.met = config.readName(self.met)
727 alg.metTerm = self.metTerm
728 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
729 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
730 if "Truth" in self.electrons
or "Truth" in self.muons:
731 alg.useDressedProperties = self.useDressedProperties
740 if items[0] !=
"MLL":
744 if not self.electrons
and not self.muons:
746 thisalg = f
'{self.name}_MLL_{self.step}'
747 alg = config.createAlgorithm(
'CP::DileptonInvariantMassSelectorAlg', thisalg)
749 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
751 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
752 if "Truth" in self.electrons
or "Truth" in self.muons:
753 alg.useDressedProperties = self.useDressedProperties
762 if items[0] !=
"MLLWINDOW":
764 if len(items) != 3
and len(items) != 4:
766 if not self.electrons
and not self.muons:
768 thisalg = f
'{self.name}_MLLWINDOW_{self.step}'
769 alg = config.createAlgorithm(
'CP::DileptonInvariantMassWindowSelectorAlg', thisalg)
771 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
773 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
774 if "Truth" in self.electrons
or "Truth" in self.muons:
775 alg.useDressedProperties = self.useDressedProperties
778 alg.vetoMode = (len(items) == 4
and self.
check_string(items[3]).lower() ==
"veto")
787 if not self.electrons
and not self.muons:
789 thisalg = f
'{self.name}_OS_{self.step}'
790 alg = config.createAlgorithm(
'CP::ChargeSelectorAlg', thisalg)
792 if "Particle" in self.electrons
or "Truth" in self.electrons:
793 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
795 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
797 if "Particle" in self.muons
or "Truth" in self.muons:
798 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
800 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
810 if not self.electrons
and not self.muons:
812 thisalg = f
'{self.name}_SS_{self.step}'
813 alg = config.createAlgorithm(
'CP::ChargeSelectorAlg', thisalg)
815 if "Particle" in self.electrons
or "Truth" in self.electrons:
816 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
818 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
820 if "Particle" in self.muons
or "Truth" in self.muons:
821 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
823 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
831 if items[0] !=
"MLL_OSSF":
833 if len(items) != 3
and len(items) != 4:
835 if not self.electrons
and not self.muons:
837 thisalg = f
'{self.name}_MLL_OSSF_{self.step}'
838 alg = config.createAlgorithm(
'CP::DileptonOSSFInvariantMassWindowSelectorAlg', thisalg)
840 if "Particle" in self.electrons
or "Truth" in self.electrons:
841 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
843 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
845 if "Particle" in self.muons
or "Truth" in self.muons:
846 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
848 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
849 if "Truth" in self.electrons
or "Truth" in self.muons:
850 alg.useDressedProperties = self.useDressedProperties
853 alg.vetoMode = (len(items) == 4
and self.
check_string(items[3]).lower() ==
"veto")
860 if items[0] !=
"EVENTFLAG":
870 if items[0] !=
"GLOBALTRIGMATCH":
872 if len(items) != 1
and len(items) != 2 :
878 self.
setDecorationName(
None, config, f
"globalTriggerMatch{postfix}_%SYS%,as_char")
883 if items[0] !=
"RUN_NUMBER":
887 thisalg = f
'{self.name}_RUN_NUMBER_{self.step}'
888 alg = config.createAlgorithm(
'CP::RunNumberSelectorAlg', thisalg)
891 alg.useRandomRunNumber = config.dataType()
is not DataType.Data
898 if items[0] !=
"SAVE":
902 thisalg = f
'{self.name}_SAVE'
903 alg = config.createAlgorithm(
'CP::SaveFilterAlg', thisalg)
904 alg.FilterDescription = f
'events passing < {self.name} >'
905 alg.eventDecisionOutputDecoration = f
'ignore_{self.name}_%SYS%'
907 alg.noFilter = self.noFilter
908 alg.selectionName = f
'pass_{self.name}_%SYS%,as_char'
909 alg.decorationName = f
'ntuplepass_{self.name}_%SYS%'
910 config.addOutputVar(
'EventInfo', f
'ntuplepass_{self.name}_%SYS%', f
'pass_{self.name}')
915 electrons=None, muons=None, jets=None,
917 photons=None, taus=None, met=None, metTerm=None,
918 btagDecoration=None, preselection=None,
919 selectionCuts=None, noFilter=None,
920 debugMode=None, cutFlowHistograms=None):
921 """Create an event selection config block
924 name -- the name defining this selection
925 electrons -- the electron container and selection
926 muons -- the muon container and selection
927 jets -- the jet container and selection
928 largeRjets -- the large-R jet container and selection
929 photons -- the photon container and selection
930 taus -- the tau-jet container and selection
931 met -- the MET container
932 metTerm -- the MET term to use (e.g. 'Final', 'NonInt')
933 btagDecoration -- the b-tagging decoration to use when defining b-jets
934 preselection -- optional event-wise selection flag to start from
935 selectionCuts -- a string listing one selection cut per line
936 noFilter -- whether to disable the event filter
937 debugMode -- enables saving all intermediate decorations
938 cutFlowHistograms -- whether to toggle event cutflow histograms per systematic
942 config.setOptionValue (
'electrons', electrons)
943 config.setOptionValue (
'muons', muons)
944 config.setOptionValue (
'jets', jets)
945 config.setOptionValue (
'largeRjets', largeRjets)
946 config.setOptionValue (
'photons', photons)
947 config.setOptionValue (
'taus', taus)
948 config.setOptionValue (
'met', met)
949 config.setOptionValue (
'metTerm', metTerm)
950 config.setOptionValue (
'btagDecoration', btagDecoration)
951 config.setOptionValue (
'preselection', preselection)
952 config.setOptionValue (
'selectionCuts', selectionCuts)
953 config.setOptionValue (
'noFilter', noFilter)
954 config.setOptionValue (
'debugMode', debugMode)
958 if cutFlowHistograms:
960 customSelections=name)
963 electrons=None, muons=None, jets=None,
965 photons=None, taus=None, met=None, metTerm=None,
966 btagDecoration=None, preselection=None,
967 selectionCutsDict=None, noFilter=None,
968 debugMode=None, cutFlowHistograms=None):
969 """Create multiple event selection config blocks
972 electrons -- the electron container and selection
973 muons -- the muon container and selection
974 jets -- the jet container and selection
975 largeRjets -- the large-R jet container and selection
976 photons -- the photon container and selection
977 taus -- the tau-jet container and selection
978 met -- the MET container
979 metTerm -- the MET term to use (e.g. 'Final', 'NonInt')
980 btagDecoration -- the b-tagging decoration to use when defining b-jets
981 preselection -- optional event-wise selection flag to start from
982 selectionCutsDict -- a dictionary with key the name of the selection and value a string listing one selection cut per line
983 noFilter -- whether to disable the event filter
984 debugMode -- enables saving all intermediate decorations
985 cutFlowHistograms -- whether to toggle event cutflow histograms per region and per systematic
989 if len(
list(selectionCutsDict.keys())) == 1:
990 name, selectionCuts =
list(selectionCutsDict.items())[0]
991 makeEventSelectionConfig(seq, name, electrons, muons, jets, largeRjets, photons, taus, met, metTerm, btagDecoration, preselection, selectionCuts, noFilter=noFilter, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms)
996 for name, selectionCuts
in selectionCutsDict.items():
997 makeEventSelectionConfig(seq, name, electrons, muons, jets, largeRjets, photons, taus, met, metTerm, btagDecoration, preselection, selectionCuts, noFilter=
True, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms)
1002 config.setOptionValue (
'selections', [f
'pass_{name}_%SYS%' for name
in selectionCutsDict.keys()
if not name.startswith(
"SUB")])
1003 config.setOptionValue (
'noFilter', noFilter)