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 """Return the instance name for this block"""
26 if not ( isinstance(self.selections, list)
and self.selections
and all(isinstance(item, str)
for item
in self.selections) ):
27 print(
'EventSelectionMerger: selections = ', self.selections)
28 raise ValueError(
'EventSelectionMerger requires a non-empty list of selection strings to be '
29 'passed as `selections`!')
30 alg = config.createAlgorithm(
'CP::SaveFilterAlg',
'EventSelectionMerger' + self.selections[0].
split(
"_%SYS%")[0])
31 alg.FilterDescription =
'events passing at least one EventSelection algorithm'
32 alg.eventDecisionOutputDecoration =
'ignore_anySelection_%SYS%'
33 alg.selection =
'||'.
join([sel+
',as_char' for sel
in self.selections
if sel])
34 alg.noFilter = self.noFilter
35 alg.selectionName =
'pass_anySelection_%SYS%'
36 alg.decorationName =
'ntuplepass_anySelection_%SYS%'
39 """ConfigBlock for interpreting text-based event selections"""
42 super(EventSelectionConfig, self).
__init__()
43 self.addOption(
'name',
'', type=str,
45 info=
"the name of the event selection, used to uniquely identify "
46 "the EventSelectionConfig block.")
47 self.addOption(
'electrons',
"", type=str,
48 info=
"the input electron container, with a possible selection, in "
49 "the format container or container.selection. The default is '' "
51 self.addOption(
'muons',
"", type=str,
52 info=
"the input muon container, with a possible selection, in the "
53 "format container or container.selection. The default is '' "
55 self.addOption(
'jets',
"", type=str,
56 info=
"the input jet container, with a possible selection, in the "
57 "format container or container.selection. The default is '' "
59 self.addOption(
'largeRjets',
"", type=str,
60 info=
"the large-R jet container, with a possible selection, in "
61 "the format container or container.selection. The default is '' "
63 self.addOption(
'photons',
"", type=str,
64 info=
"the input photon container, with a possible selection, in "
65 "the format container or container.selection. The default is '' "
67 self.addOption(
'taus',
"", type=str,
68 info=
"the input tau-jet container, with a possible selection, in "
69 "the format container or container.selection. The default is '' "
71 self.addOption(
'met',
"", type=str,
72 info=
"he input MET container. The default is '' (empty string).")
74 self.addOption(
'metTerm',
"Final", type=str,
76 self.addOption(
'btagDecoration',
"", type=str,
77 info=
"the b-tagging decoration to use when defining b-jets. "
78 "The default is '' (empty string).")
79 self.addOption(
'preselection',
"", type=str,
80 info=
"the event-wise selection flag to start this event selection "
81 "from. The default is '' (empty string).")
82 self.addOption(
'selectionCuts',
"", type=str,
84 info=
"a single string listing one selection cut per line.")
85 self.addOption(
'noFilter',
False, type=bool,
86 info=
"do not apply an event filter. The default is False, i.e. "
87 "remove events not passing the full list of selection cuts.")
88 self.addOption(
'debugMode',
False, type=bool,
89 info=
"whether to create an output branch for every single line "
90 "of the selection cuts. The default is False (only saves the"
92 self.addOption(
'useDressedProperties',
True, type=bool,
93 info=
"whether to use dressed truth electron and truth muon "
94 "kinematics rather than simple P4 kinematics.")
100 """Return the instance name for this block"""
111 if self.selectionCuts
is None:
112 raise ValueError (
"[EventSelectionConfig] You must provide the 'selectionCuts' option to 'EventSelectionConfig': "
113 "a single string where each line represents a different selection cut to apply in order.")
114 for line
in self.selectionCuts.
split(
"\n"):
116 config.addEventCutFlow(self.name, self.
getCutflow())
122 if text.startswith(
"#"):
125 if "EL_N" in text.split():
127 elif "MU_N" in text.split():
129 elif "SUM_EL_N_MU_N" in text.split():
131 elif "SUM_EL_N_MU_N_TAU_N" in text.split():
133 elif "JET_N_GHOST" in text.split():
135 elif "JET_N" in text.split():
137 elif "JET_N_BTAG" in text.split():
139 elif "PH_N" in text.split():
141 elif "TAU_N" in text.split():
143 elif "LJET_N_GHOST" in text.split():
145 elif "LJET_N" in text.split():
147 elif "OBJ_N" in text.split():
149 elif "MET" in text.split():
151 elif "MWT" in text.split():
153 elif "MET+MWT" in text.split():
155 elif "MLL" in text.split():
157 elif "MLLWINDOW" in text.split():
159 elif "OS" in text.split():
161 elif "SS" in text.split():
163 elif "MLL_OSSF" in text.split():
165 elif "LJETMASS_N" in text.split():
167 elif "LJETMASSWINDOW_N" in text.split():
169 elif "SAVE" in text.split():
171 elif "IMPORT" in text.split():
173 elif "EVENTFLAG" in text.split():
175 elif "GLOBALTRIGMATCH" in text.split():
177 elif "RUN_NUMBER" in text.split():
180 raise ValueError (f
"[EventSelectionConfig] The following selection cut is not recognised! --> {text}")
183 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Check {keyword} in: {text}")
186 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Missing input collection for {collection}")
191 if not requirePositive
or value >= 0:
194 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Float {test} is not positive!")
196 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be a float, not {type(test)}!")
201 if value ==
float(test):
202 if not requirePositive
or value >= 0:
205 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! Int {test} us not positive!")
207 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be an int, not a float!")
209 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be an int, not {type(test)}")
212 if not isinstance(test, str):
213 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be a string, not a number!")
228 raise KeyError (f
"[EventSelectionConfig] Misconfiguration! {test} should be one of {list(mapping.keys())}")
231 test = test.split(
":")
233 raise ValueError (f
"[EventSelectionConfig] Misconfiguration! {test} should be provided as 'btagger:btagWP'")
239 values = test.split(
"!")
241 "B":
"GhostBHadronsFinalCount",
242 "C":
"GhostCHadronsFinalCount",
243 "T":
"GhostTQuarksFinalCount",
244 "W":
"GhostWBosonsCount",
245 "Z":
"GhostZBosonsCount",
246 "H":
"GhostHBosonsCount",
247 "TAU":
"GhostTausFinalCount"
249 return [ghost_map.get(value.upper(), value)
for value
in values]
256 if algorithm
is not None:
257 algorithm.decorationName = f
'{decoration},as_char'
260 config.addOutputVar(
'EventInfo', decoration, decoration.split(
"_%SYS%")[0])
266 config.addSelection(
'EventInfo',
'', decoration)
272 decoration = decoration.split(
"&&")
273 decoration = [sub +
',as_char' if ',as_char' not in sub
else sub
for sub
in decoration]
274 return '&&'.
join(decoration)
278 return oldSelection +
"&&" + config.getFullSelection(container, newSelection)
280 return config.getFullSelection(container, newSelection)
285 if items[0] !=
"IMPORT":
293 self.
currentDecoration = f
'{self.currentDecoration},as_char&&pass_{region}_%SYS%'
295 imported_cuts = [cut
for cut
in config.getSelectionCutFlow(
'EventInfo',
'')
if cut.startswith(region)]
301 if items[0] !=
"EL_N":
303 if len(items) != 4
and len(items) != 5:
305 if not self.electrons:
307 thisalg = f
'{self.name}_NEL_{self.step}'
308 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
309 alg.particles, alg.objectSelection = config.readNameAndSelection(self.electrons)
310 if "Truth" in self.electrons:
311 alg.useDressedProperties = self.useDressedProperties
317 elif len(items) == 5:
328 if items[0] !=
"MU_N":
330 if len(items) != 4
and len(items) != 5:
334 thisalg = f
'{self.name}_NMU_{self.step}'
335 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
336 alg.particles, alg.objectSelection = config.readNameAndSelection(self.muons)
337 if "Truth" in self.muons:
338 alg.useDressedProperties = self.useDressedProperties
344 elif len(items) == 5:
355 if items[0] !=
"SUM_EL_N_MU_N":
357 if len(items) != 4
and len(items) != 5
and len(items) != 7:
359 if not self.electrons
and not self.muons:
361 thisalg = f
'{self.name}_SUMNELNMU_{self.step}'
362 alg = config.createAlgorithm(
'CP::SumNLeptonPtSelectorAlg', thisalg)
363 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
364 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
365 if "Truth" in self.electrons:
366 alg.useDressedProperties = self.useDressedProperties
373 elif len(items) == 5:
378 elif len(items) == 7:
392 if items[0] !=
"SUM_EL_N_MU_N_TAU_N":
394 if len(items) != 4
and len(items) != 6
and len(items) != 9:
396 if not self.electrons
and not self.muons
and not self.taus:
398 thisalg = f
'{self.name}_SUMNLEPTONS_{self.step}'
399 alg = config.createAlgorithm(
'CP::SumNLeptonPtSelectorAlg', thisalg)
400 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
401 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
402 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
403 if "Truth" in self.electrons:
404 alg.useDressedProperties = self.useDressedProperties
412 elif len(items) == 6:
418 elif len(items) == 9:
435 if items[0] !=
"JET_N":
437 if len(items) != 4
and len(items) != 5:
441 thisalg = f
'{self.name}_NJET_{self.step}'
442 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
443 alg.particles, alg.objectSelection = config.readNameAndSelection(self.jets)
449 elif len(items) == 5:
460 if items[0] !=
"JET_N_BTAG":
462 if len(items) != 3
and len(items) != 4
and len(items) != 5:
466 thisalg = f
'{self.name}_NBJET_{self.step}'
467 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
468 particles, selection = config.readNameAndSelection(self.jets)
469 alg.particles = particles
470 alg.objectSelection = f
'{selection}&&{self.btagDecoration},as_char' if selection
else f
'{self.btagDecoration},as_char'
475 elif len(items) == 4:
478 customBtag = f
'ftag_select_{btagger}_{btagWP}'
479 alg.objectSelection = f
'{selection}&&{customBtag},as_char' if selection
else f
'{customBtag},as_char'
485 elif len(items) == 5:
488 customBtag = f
'ftag_select_{btagger}_{btagWP}'
489 alg.objectSelection = f
'{selection}&&{customBtag},as_char' if selection
else f
'{customBtag},as_char'
498 if items[0] !=
"PH_N":
500 if len(items) != 4
and len(items) != 5:
504 thisalg = f
'{self.name}_NPH_{self.step}'
505 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
506 alg.particles, alg.objectSelection = config.readNameAndSelection(self.photons)
512 elif len(items) == 5:
523 if items[0] !=
"TAU_N":
525 if len(items) != 4
and len(items) != 5:
529 thisalg = f
'{self.name}_NTAU_{self.step}'
530 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
531 alg.particles, alg.objectSelection = config.readNameAndSelection(self.taus)
537 elif len(items) == 5:
548 if items[0] !=
"LJET_N":
550 if len(items) != 4
and len(items) != 5:
552 thisalg = f
'{self.name}_NLJET_{self.step}'
553 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
554 alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets)
560 elif len(items) == 5:
571 if items[0] !=
"LJETMASS_N":
573 if len(items) != 4
and len(items) != 5:
575 thisalg = f
'{self.name}_NLJETMASS_{self.step}'
576 alg = config.createAlgorithm(
'CP::NObjectMassSelectorAlg', thisalg)
577 alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets)
583 elif len(items) == 5:
594 if items[0] !=
"LJETMASSWINDOW_N":
596 if len(items) != 5
and len(items) != 6
and len(items) != 7:
598 thisalg = f
'{self.name}_NLJETMASSWINDOW_{self.step}'
599 alg = config.createAlgorithm(
'CP::NLargeRJetMassWindowSelectorAlg', thisalg)
600 alg.ljets, alg.ljetSelection = config.readNameAndSelection(self.largeRjets)
601 vetoMode = items[-1] ==
'veto' or items[-1] ==
'VETO'
602 if len(items) == 5
or (len(items) == 6
and vetoMode):
607 alg.vetoMode = vetoMode
608 elif (len(items) == 6
and not vetoMode)
or len(items) == 7:
615 alg.vetoMode = vetoMode
622 if items[0] !=
"JET_N_GHOST":
624 if len(items) != 4
and len(items) != 5:
626 thisalg = f
'{self.name}_NJETGHOST_{self.step}'
627 alg = config.createAlgorithm(
'CP::JetNGhostSelectorAlg', thisalg)
628 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
630 alg.ghost = ghosts[0]
636 elif len(items) == 5:
646 if items[0] !=
"LJET_N_GHOST":
648 if len(items) != 4
and len(items) != 5:
650 thisalg = f
'{self.name}_NLJETGHOST_{self.step}'
651 alg = config.createAlgorithm(
'CP::JetNGhostSelectorAlg', thisalg)
652 alg.jets, alg.jetSelection = config.readNameAndSelection(self.largeRjets)
654 alg.ghost = ghosts[0]
660 elif len(items) == 5:
670 if items[0] !=
"OBJ_N":
674 thisalg = f
'{self.name}_NOBJ_{self.step}'
675 alg = config.createAlgorithm(
'CP::NObjectPtSelectorAlg', thisalg)
676 alg.particles, alg.objectSelection = config.readNameAndSelection(self.
check_string(items[1]))
686 if items[0] !=
"MET":
692 thisalg = f
'{self.name}_MET_{self.step}'
693 alg = config.createAlgorithm(
'CP::MissingETSelectorAlg', thisalg)
694 alg.met = config.readName(self.met)
695 alg.metTerm = self.metTerm
704 if items[0] !=
"MWT":
708 if not self.electrons
and not self.muons:
710 thisalg = f
'{self.name}_MWT_{self.step}'
711 alg = config.createAlgorithm(
'CP::TransverseMassSelectorAlg', thisalg)
712 alg.met = config.readName(self.met)
713 alg.metTerm = self.metTerm
714 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
715 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
716 if "Truth" in self.electrons
or "Truth" in self.muons:
717 alg.useDressedProperties = self.useDressedProperties
726 if items[0] !=
"MET+MWT":
732 if not self.electrons
and not self.muons:
734 thisalg = f
'{self.name}_METMWT_{self.step}'
735 alg = config.createAlgorithm(
'CP::MissingETPlusTransverseMassSelectorAlg', thisalg)
736 alg.met = config.readName(self.met)
737 alg.metTerm = self.metTerm
738 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
739 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
740 if "Truth" in self.electrons
or "Truth" in self.muons:
741 alg.useDressedProperties = self.useDressedProperties
750 if items[0] !=
"MLL":
754 if not self.electrons
and not self.muons:
756 thisalg = f
'{self.name}_MLL_{self.step}'
757 alg = config.createAlgorithm(
'CP::DileptonInvariantMassSelectorAlg', thisalg)
759 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
761 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
762 if "Truth" in self.electrons
or "Truth" in self.muons:
763 alg.useDressedProperties = self.useDressedProperties
772 if items[0] !=
"MLLWINDOW":
774 if len(items) != 3
and len(items) != 4:
776 if not self.electrons
and not self.muons:
778 thisalg = f
'{self.name}_MLLWINDOW_{self.step}'
779 alg = config.createAlgorithm(
'CP::DileptonInvariantMassWindowSelectorAlg', thisalg)
781 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
783 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
784 if "Truth" in self.electrons
or "Truth" in self.muons:
785 alg.useDressedProperties = self.useDressedProperties
788 alg.vetoMode = (len(items) == 4
and self.
check_string(items[3]).lower() ==
"veto")
795 if not items
or len(items) > 4:
797 if not self.electrons
and not self.muons
and not self.taus:
799 thisalg = f
'{self.name}_OS_{self.step}'
800 alg = config.createAlgorithm(
'CP::ChargeSelectorAlg', thisalg)
801 if self.electrons
and (len(items) == 1
or "el" in items):
802 if "Particle" in self.electrons
or "Truth" in self.electrons:
803 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
805 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
806 if self.muons
and (len(items) == 1
or "mu" in items):
807 if "Particle" in self.muons
or "Truth" in self.muons:
808 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
810 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
811 if self.taus
and (len(items) == 1
or "tau" in items):
812 if "Particle" in self.taus
or "Truth" in self.taus:
813 alg.truthTaus, alg.truthTauSelection = config.readNameAndSelection(self.taus)
815 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
823 if not items
or len(items) > 4:
825 if not self.electrons
and not self.muons
and not self.taus:
827 thisalg = f
'{self.name}_SS_{self.step}'
828 alg = config.createAlgorithm(
'CP::ChargeSelectorAlg', thisalg)
829 if self.electrons
and (len(items) == 1
or "el" in items):
830 if "Particle" in self.electrons
or "Truth" in self.electrons:
831 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
833 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
834 if self.muons
and (len(items) == 1
or "mu" in items):
835 if "Particle" in self.muons
or "Truth" in self.muons:
836 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
838 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
839 if self.taus
and (len(items) == 1
or "tau" in items):
840 if "Particle" in self.taus
or "Truth" in self.taus:
841 alg.truthTaus, alg.truthTauSelection = config.readNameAndSelection(self.taus)
843 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
851 if items[0] !=
"MLL_OSSF":
853 if len(items) != 3
and len(items) != 4:
855 if not self.electrons
and not self.muons:
857 thisalg = f
'{self.name}_MLL_OSSF_{self.step}'
858 alg = config.createAlgorithm(
'CP::DileptonOSSFInvariantMassWindowSelectorAlg', thisalg)
860 if "Particle" in self.electrons
or "Truth" in self.electrons:
861 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
863 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
865 if "Particle" in self.muons
or "Truth" in self.muons:
866 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
868 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
869 if "Truth" in self.electrons
or "Truth" in self.muons:
870 alg.useDressedProperties = self.useDressedProperties
873 alg.vetoMode = (len(items) == 4
and self.
check_string(items[3]).lower() ==
"veto")
880 if items[0] !=
"EVENTFLAG":
890 if items[0] !=
"GLOBALTRIGMATCH":
892 if len(items) != 1
and len(items) != 2 :
898 self.
setDecorationName(
None, config, f
"globalTriggerMatch{postfix}_%SYS%,as_char")
903 if items[0] !=
"RUN_NUMBER":
907 thisalg = f
'{self.name}_RUN_NUMBER_{self.step}'
908 alg = config.createAlgorithm(
'CP::RunNumberSelectorAlg', thisalg)
911 alg.useRandomRunNumber = config.dataType()
is not DataType.Data
918 if items[0] !=
"SAVE":
922 thisalg = f
'{self.name}_SAVE'
923 alg = config.createAlgorithm(
'CP::SaveFilterAlg', thisalg)
924 alg.FilterDescription = f
'events passing < {self.name} >'
925 alg.eventDecisionOutputDecoration = f
'ignore_{self.name}_%SYS%'
927 alg.noFilter = self.noFilter
928 alg.selectionName = f
'pass_{self.name}_%SYS%,as_char'
929 alg.decorationName = f
'ntuplepass_{self.name}_%SYS%'
930 config.addOutputVar(
'EventInfo', f
'ntuplepass_{self.name}_%SYS%', f
'pass_{self.name}')
935 electrons=None, muons=None, jets=None,
937 photons=None, taus=None, met=None, metTerm=None,
938 btagDecoration=None, preselection=None,
939 selectionCuts=None, noFilter=None,
940 debugMode=None, cutFlowHistograms=None):
941 """Create an event selection config block
944 name -- the name defining this selection
945 electrons -- the electron container and selection
946 muons -- the muon container and selection
947 jets -- the jet container and selection
948 largeRjets -- the large-R jet container and selection
949 photons -- the photon container and selection
950 taus -- the tau-jet container and selection
951 met -- the MET container
952 metTerm -- the MET term to use (e.g. 'Final', 'NonInt')
953 btagDecoration -- the b-tagging decoration to use when defining b-jets
954 preselection -- optional event-wise selection flag to start from
955 selectionCuts -- a string listing one selection cut per line
956 noFilter -- whether to disable the event filter
957 debugMode -- enables saving all intermediate decorations
958 cutFlowHistograms -- whether to toggle event cutflow histograms per systematic
962 config.setOptionValue (
'name', name)
963 config.setOptionValue (
'electrons', electrons)
964 config.setOptionValue (
'muons', muons)
965 config.setOptionValue (
'jets', jets)
966 config.setOptionValue (
'largeRjets', largeRjets)
967 config.setOptionValue (
'photons', photons)
968 config.setOptionValue (
'taus', taus)
969 config.setOptionValue (
'met', met)
970 config.setOptionValue (
'metTerm', metTerm)
971 config.setOptionValue (
'btagDecoration', btagDecoration)
972 config.setOptionValue (
'preselection', preselection)
973 config.setOptionValue (
'selectionCuts', selectionCuts)
974 config.setOptionValue (
'noFilter', noFilter)
975 config.setOptionValue (
'debugMode', debugMode)
979 if cutFlowHistograms:
981 customSelections=name)
984 electrons=None, muons=None, jets=None,
986 photons=None, taus=None, met=None, metTerm=None,
987 btagDecoration=None, preselection=None,
988 selectionCutsDict=None, noFilter=None,
989 debugMode=None, cutFlowHistograms=None):
990 """Create multiple event selection config blocks
993 electrons -- the electron container and selection
994 muons -- the muon container and selection
995 jets -- the jet container and selection
996 largeRjets -- the large-R jet container and selection
997 photons -- the photon container and selection
998 taus -- the tau-jet container and selection
999 met -- the MET container
1000 metTerm -- the MET term to use (e.g. 'Final', 'NonInt')
1001 btagDecoration -- the b-tagging decoration to use when defining b-jets
1002 preselection -- optional event-wise selection flag to start from
1003 selectionCutsDict -- a dictionary with key the name of the selection and value a string listing one selection cut per line
1004 noFilter -- whether to disable the event filter
1005 debugMode -- enables saving all intermediate decorations
1006 cutFlowHistograms -- whether to toggle event cutflow histograms per region and per systematic
1010 if len(
list(selectionCutsDict.keys())) == 1:
1011 name, selectionCuts =
list(selectionCutsDict.items())[0]
1012 makeEventSelectionConfig(seq, name, electrons, muons, jets, largeRjets, photons, taus, met, metTerm, btagDecoration, preselection, selectionCuts, noFilter=noFilter, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms)
1017 for name, selectionCuts
in selectionCutsDict.items():
1018 makeEventSelectionConfig(seq, name, electrons, muons, jets, largeRjets, photons, taus, met, metTerm, btagDecoration, preselection, selectionCuts, noFilter=
True, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms)
1023 config.setOptionValue (
'selections', [f
'pass_{name}_%SYS%' for name
in selectionCutsDict.keys()
if not name.startswith(
"SUB")])
1024 config.setOptionValue (
'noFilter', noFilter)