ATLAS Offline Software
Loading...
Searching...
No Matches
python.EventSelectionConfig.EventSelectionConfig Class Reference
Inheritance diagram for python.EventSelectionConfig.EventSelectionConfig:
Collaboration diagram for python.EventSelectionConfig.EventSelectionConfig:

Public Member Functions

 __init__ (self)
 instanceName (self)
 makeAlgs (self, config)
 interpret (self, text, cfg)
 raise_misconfig (self, text, keyword)
 raise_missinginput (self, collection)
 check_float (self, test, requirePositive=True)
 check_int (self, test, requirePositive=True)
 check_string (self, test)
 check_sign (self, test)
 check_btagging (self, test)
 check_ghosts (self, test)
 getCutflow (self)
 setDecorationName (self, algorithm, config, decoration)
 checkDecorationName (self, decoration)
 extendObjectSelection (self, config, container, oldSelection, newSelection)
 add_IMPORT (self, text, config)
 add_NEL_selector (self, text, config)
 add_NMU_selector (self, text, config)
 add_SUMNELNMU_selector (self, text, config)
 add_SUMNLEPTONS_selector (self, text, config)
 add_NJET_selector (self, text, config)
 add_NBJET_selector (self, text, config)
 add_NPH_selector (self, text, config)
 add_NTAU_selector (self, text, config)
 add_NLJET_selector (self, text, config)
 add_NLJETMASS_selector (self, text, config)
 add_NLJETMASSWINDOW_selector (self, text, config)
 add_NJETGHOST_selector (self, text, config)
 add_NLJETGHOST_selector (self, text, config)
 add_NOBJ_selector (self, text, config)
 add_MET_selector (self, text, config)
 add_MWT_selector (self, text, config)
 add_METMWT_selector (self, text, config)
 add_MLL_selector (self, text, config)
 add_MLLWINDOW_selector (self, text, config)
 add_OS_selector (self, text, config)
 add_SS_selector (self, text, config)
 add_MLL_OSSF_selector (self, text, config)
 add_EVENTFLAG (self, text, config)
 add_GLOBALTRIGMATCH (self, text, config)
 add_RUNNUMBER (self, text, config)
 add_SAVE (self, text, config)

Public Attributes

int step = 0
str currentDecoration = ''
list cutflow = []
 selectionName
 debugMode
 electrons
 muons
 taus
 jets
 photons
 met

Detailed Description

ConfigBlock for interpreting text-based event selections

Definition at line 43 of file EventSelectionConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.EventSelectionConfig.EventSelectionConfig.__init__ ( self)

Definition at line 46 of file EventSelectionConfig.py.

46 def __init__(self):
47 super(EventSelectionConfig, self).__init__()
48 self.setBlockName('EventSelection')
49 self.addOption('selectionName', '', type=str,
50 noneAction='error',
51 info="the name of the event selection, used to uniquely identify "
52 "the `EventSelectionConfig` block.")
53 self.addOption('electrons', "", type=str,
54 info="the input electron container, with a possible selection, in "
55 "the format `container` or `container.selection`.")
56 self.addOption('muons', "", type=str,
57 info="the input muon container, with a possible selection, in the "
58 "format `container` or `container.selection`.")
59 self.addOption('jets', "", type=str,
60 info="the input jet container, with a possible selection, in the "
61 "format `container` or `container.selection`.")
62 self.addOption('largeRjets', "", type=str,
63 info="the large-R jet container, with a possible selection, in "
64 "the format `container` or `container.selection`.")
65 self.addOption('photons', "", type=str,
66 info="the input photon container, with a possible selection, in "
67 "the format `container` or `container.selection`.")
68 self.addOption('taus', "", type=str,
69 info="the input tau-jet container, with a possible selection, in "
70 "the format `container` or `container.selection`.")
71 self.addOption('met', "", type=str,
72 info="the input MET container.")
73 self.addOption('metTerm', "Final", type=str,
74 info="the MET term to use when computing MET-based quantities.")
75 self.addOption('btagDecoration', "", type=str,
76 info="the b-tagging decoration to use when defining b-jets.")
77 self.addOption('preselection', "", type=str,
78 info="the event-wise selection flag to start this event selection "
79 "from.")
80 self.addOption('selectionCuts', "", type=str,
81 noneAction='error',
82 info="a single string listing one selection cut per line. "
83 "See [available keywords](https://topcptoolkit.docs.cern.ch/latest/settings/eventselection/#available-keywords).")
84 self.addOption('debugMode', False, type=bool,
85 info="whether to create an output branch for every single line "
86 "of the selection cuts. Setting it to `False` only saves the"
87 " final decision.")
88 self.addOption('useDressedProperties', True, type=bool,
89 info="whether to use dressed truth electron and truth muon "
90 "kinematics rather than simple 4-vector kinematics.")
91 self.step = 0
92 self.currentDecoration = ''
93 self.cutflow = []
94

Member Function Documentation

◆ add_EVENTFLAG()

python.EventSelectionConfig.EventSelectionConfig.add_EVENTFLAG ( self,
text,
config )

Definition at line 879 of file EventSelectionConfig.py.

879 def add_EVENTFLAG(self, text, config):
880 items = text.split()
881 if items[0] != "EVENTFLAG":
882 self.raise_misconfig(text, "EVENTFLAG")
883 if len(items) != 2:
884 self.raise_misconfig(text, "number of arguments")
885 existingDecoration = self.check_string(items[1])
886 self.setDecorationName(None, config, existingDecoration)
887 return
888

◆ add_GLOBALTRIGMATCH()

python.EventSelectionConfig.EventSelectionConfig.add_GLOBALTRIGMATCH ( self,
text,
config )

Definition at line 889 of file EventSelectionConfig.py.

889 def add_GLOBALTRIGMATCH(self, text, config):
890 items = text.split()
891 if items[0] != "GLOBALTRIGMATCH":
892 self.raise_misconfig(text, "GLOBALTRIGMATCH")
893 if len(items) != 1 and len(items) != 2 :
894 self.raise_misconfig(text, "number of arguments")
895 if len(items) == 1:
896 self.setDecorationName(None, config, "globalTriggerMatch_%SYS%,as_char")
897 else:
898 postfix = self.check_string(items[1])
899 self.setDecorationName(None, config, f"globalTriggerMatch{postfix}_%SYS%,as_char")
900 return
901

◆ add_IMPORT()

python.EventSelectionConfig.EventSelectionConfig.add_IMPORT ( self,
text,
config )

Definition at line 283 of file EventSelectionConfig.py.

283 def add_IMPORT(self, text, config):
284 # this is used to import a previous selection
285 items = text.split()
286 if items[0] != "IMPORT":
287 self.raise_misconfig(text, "IMPORT")
288 if len(items) != 2:
289 self.raise_misconfig(text, "number of arguments")
290 region = self.check_string(items[1])
291 if not self.currentDecoration:
292 self.currentDecoration = f'pass_{region}_%SYS%,as_char'
293 else:
294 self.currentDecoration = f'{self.currentDecoration},as_char&&pass_{region}_%SYS%'
295 # for the cutflow, we need to retrieve all the cuts corresponding to this IMPORT
296 imported_cuts = [cut for cut in config.getSelectionCutFlow('EventInfo', '') if cut.startswith(region)]
297 self.cutflow += imported_cuts
298 return
299

◆ add_MET_selector()

python.EventSelectionConfig.EventSelectionConfig.add_MET_selector ( self,
text,
config )

Definition at line 685 of file EventSelectionConfig.py.

685 def add_MET_selector(self, text, config):
686 items = text.split()
687 if items[0] != "MET":
688 self.raise_misconfig(text, "MET")
689 if len(items) != 3:
690 self.raise_misconfig(text, "number of arguments")
691 if not self.met:
692 self.raise_missinginput("MET")
693 thisalg = f'{self.selectionName}_MET_{self.step}'
694 alg = config.createAlgorithm('CP::MissingETSelectorAlg', thisalg)
695 alg.met = config.readName(self.met)
696 alg.metTerm = self.metTerm
697 alg.sign = self.check_sign(items[1])
698 alg.refMET = self.check_float(items[2])
699 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
700 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
701 return
702

◆ add_METMWT_selector()

python.EventSelectionConfig.EventSelectionConfig.add_METMWT_selector ( self,
text,
config )

Definition at line 725 of file EventSelectionConfig.py.

725 def add_METMWT_selector(self, text, config):
726 items = text.split()
727 if items[0] != "MET+MWT":
728 self.raise_misconfig(text, "MET+MWT")
729 if len(items) != 3:
730 self.raise_misconfig(text, "number of arguments")
731 if not self.met:
732 self.raise_missinginput("MET")
733 if not self.electrons and not self.muons:
734 self.raise_missinginput("electrons or muons")
735 thisalg = f'{self.selectionName}_METMWT_{self.step}'
736 alg = config.createAlgorithm('CP::MissingETPlusTransverseMassSelectorAlg', thisalg)
737 alg.met = config.readName(self.met)
738 alg.metTerm = self.metTerm
739 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
740 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
741 if "Truth" in self.electrons or "Truth" in self.muons:
742 alg.useDressedProperties = self.useDressedProperties
743 alg.sign = self.check_sign(items[1])
744 alg.refMETMWT = self.check_float(items[2])
745 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
746 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
747 return
748

◆ add_MLL_OSSF_selector()

python.EventSelectionConfig.EventSelectionConfig.add_MLL_OSSF_selector ( self,
text,
config )

Definition at line 850 of file EventSelectionConfig.py.

850 def add_MLL_OSSF_selector(self, text, config):
851 items = text.split()
852 if items[0] != "MLL_OSSF":
853 self.raise_misconfig(text, "MLL_OSSF")
854 if len(items) != 3 and len(items) != 4:
855 self.raise_misconfig(text, "number of arguments")
856 if not self.electrons and not self.muons:
857 self.raise_missinginput("electrons or muons")
858 thisalg = f'{self.selectionName}_MLL_OSSF_{self.step}'
859 alg = config.createAlgorithm('CP::DileptonOSSFInvariantMassWindowSelectorAlg', thisalg)
860 if self.electrons:
861 if "Particle" in self.electrons or "Truth" in self.electrons:
862 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
863 else:
864 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
865 if self.muons:
866 if "Particle" in self.muons or "Truth" in self.muons:
867 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
868 else:
869 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
870 if "Truth" in self.electrons or "Truth" in self.muons:
871 alg.useDressedProperties = self.useDressedProperties
872 alg.lowMll = self.check_float(items[1])
873 alg.highMll = self.check_float(items[2])
874 alg.vetoMode = (len(items) == 4 and self.check_string(items[3]).lower() == "veto")
875 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
876 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
877 return
878

◆ add_MLL_selector()

python.EventSelectionConfig.EventSelectionConfig.add_MLL_selector ( self,
text,
config )

Definition at line 749 of file EventSelectionConfig.py.

749 def add_MLL_selector(self, text, config):
750 items = text.split()
751 if items[0] != "MLL":
752 self.raise_misconfig(text, "MLL")
753 if len(items) != 3:
754 self.raise_misconfig(text, "number of arguments")
755 if not self.electrons and not self.muons:
756 self.raise_missinginput("electrons or muons")
757 thisalg = f'{self.selectionName}_MLL_{self.step}'
758 alg = config.createAlgorithm('CP::DileptonInvariantMassSelectorAlg', thisalg)
759 if self.electrons:
760 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
761 if self.muons:
762 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
763 if "Truth" in self.electrons or "Truth" in self.muons:
764 alg.useDressedProperties = self.useDressedProperties
765 alg.sign = self.check_sign(items[1])
766 alg.refMLL = self.check_float(items[2])
767 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
768 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
769 return
770

◆ add_MLLWINDOW_selector()

python.EventSelectionConfig.EventSelectionConfig.add_MLLWINDOW_selector ( self,
text,
config )

Definition at line 771 of file EventSelectionConfig.py.

771 def add_MLLWINDOW_selector(self, text, config):
772 items = text.split()
773 if items[0] != "MLLWINDOW":
774 self.raise_misconfig(text, "MLLWINDOW")
775 if len(items) != 3 and len(items) != 4:
776 self.raise_misconfig(text, "number of arguments")
777 if not self.electrons and not self.muons:
778 self.raise_missinginput("electrons or muons")
779 thisalg = f'{self.selectionName}_MLLWINDOW_{self.step}'
780 alg = config.createAlgorithm('CP::DileptonInvariantMassWindowSelectorAlg', thisalg)
781 if self.electrons:
782 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
783 if self.muons:
784 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
785 if "Truth" in self.electrons or "Truth" in self.muons:
786 alg.useDressedProperties = self.useDressedProperties
787 alg.lowMLL = self.check_float(items[1])
788 alg.highMLL = self.check_float(items[2])
789 alg.vetoMode = (len(items) == 4 and self.check_string(items[3]).lower() == "veto")
790 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
791 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
792 return
793

◆ add_MWT_selector()

python.EventSelectionConfig.EventSelectionConfig.add_MWT_selector ( self,
text,
config )

Definition at line 703 of file EventSelectionConfig.py.

703 def add_MWT_selector(self, text, config):
704 items = text.split()
705 if items[0] != "MWT":
706 self.raise_misconfig(text, "MWT")
707 if len(items) != 3:
708 self.raise_misconfig(text, "number of arguments")
709 if not self.electrons and not self.muons:
710 self.raise_missinginput("electrons or muons")
711 thisalg = f'{self.selectionName}_MWT_{self.step}'
712 alg = config.createAlgorithm('CP::TransverseMassSelectorAlg', thisalg)
713 alg.met = config.readName(self.met)
714 alg.metTerm = self.metTerm
715 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
716 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
717 if "Truth" in self.electrons or "Truth" in self.muons:
718 alg.useDressedProperties = self.useDressedProperties
719 alg.sign = self.check_sign(items[1])
720 alg.refMWT = self.check_float(items[2])
721 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
722 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
723 return
724

◆ add_NBJET_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NBJET_selector ( self,
text,
config )

Definition at line 459 of file EventSelectionConfig.py.

459 def add_NBJET_selector(self, text, config):
460 items = text.split()
461 if items[0] != "JET_N_BTAG":
462 self.raise_misconfig(text, "JET_N_BTAG")
463 if len(items) != 3 and len(items) != 4 and len(items) != 5:
464 self.raise_misconfig(text, "number of arguments")
465 if not self.jets:
466 self.raise_missinginput("jets")
467 thisalg = f'{self.selectionName}_NBJET_{self.step}'
468 alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg)
469 particles, selection = config.readNameAndSelection(self.jets)
470 alg.particles = particles
471 alg.objectSelection = f'{selection}&&{self.btagDecoration},as_char' if selection else f'{self.btagDecoration},as_char'
472 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
473 if len(items) == 3:
474 alg.sign = self.check_sign(items[1])
475 alg.count = self.check_int(items[2])
476 elif len(items) == 4:
477 if ":" in text:
478 btagger, btagWP = self.check_btagging(items[1])
479 customBtag = f'ftag_select_{btagger}_{btagWP}'
480 alg.objectSelection = f'{selection}&&{customBtag},as_char' if selection else f'{customBtag},as_char'
481 else:
482 extraSel = self.check_string(items[1])
483 alg.objectSelection = self.extendObjectSelection(config, self.jets.split(".")[0], alg.objectSelection, extraSel)
484 alg.sign = self.check_sign(items[2])
485 alg.count = self.check_int(items[3])
486 elif len(items) == 5:
487 extraSel = self.check_string(items[1])
488 btagger, btagWP = self.check_btagging(items[2])
489 customBtag = f'ftag_select_{btagger}_{btagWP}'
490 alg.objectSelection = f'{selection}&&{customBtag},as_char' if selection else f'{customBtag},as_char'
491 alg.objectSelection = self.extendObjectSelection(config, self.jets.split(".")[0], alg.objectSelection, extraSel)
492 alg.sign = self.check_sign(items[3])
493 alg.count = self.check_int(items[4])
494 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
495 return
496
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179

◆ add_NEL_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NEL_selector ( self,
text,
config )

Definition at line 300 of file EventSelectionConfig.py.

300 def add_NEL_selector(self, text, config):
301 items = text.split()
302 if items[0] != "EL_N":
303 self.raise_misconfig(text, "EL_N")
304 if len(items) != 4 and len(items) != 5:
305 self.raise_misconfig(text, "number of arguments")
306 if not self.electrons:
307 self.raise_missinginput("electrons")
308 thisalg = f'{self.selectionName}_NEL_{self.step}'
309 alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg)
310 alg.particles, alg.objectSelection = config.readNameAndSelection(self.electrons)
311 if "Truth" in self.electrons:
312 alg.useDressedProperties = self.useDressedProperties
313 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
314 if len(items) == 4:
315 alg.minPt = self.check_float(items[1])
316 alg.sign = self.check_sign(items[2])
317 alg.count = self.check_int(items[3])
318 elif len(items) == 5:
319 extraSel = self.check_string(items[1])
320 alg.objectSelection = self.extendObjectSelection(config, self.electrons.split(".")[0], alg.objectSelection, extraSel)
321 alg.minPt = self.check_float(items[2])
322 alg.sign = self.check_sign(items[3])
323 alg.count = self.check_int(items[4])
324 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
325 return
326

◆ add_NJET_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NJET_selector ( self,
text,
config )

Definition at line 434 of file EventSelectionConfig.py.

434 def add_NJET_selector(self, text, config):
435 items = text.split()
436 if items[0] != "JET_N":
437 self.raise_misconfig(text, "JET_N")
438 if len(items) != 4 and len(items) != 5:
439 self.raise_misconfig(text, "number of arguments")
440 if not self.jets:
441 self.raise_missinginput("jets")
442 thisalg = f'{self.selectionName}_NJET_{self.step}'
443 alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg)
444 alg.particles, alg.objectSelection = config.readNameAndSelection(self.jets)
445 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
446 if len(items) == 4:
447 alg.minPt = self.check_float(items[1])
448 alg.sign = self.check_sign(items[2])
449 alg.count = self.check_int(items[3])
450 elif len(items) == 5:
451 extraSel = self.check_string(items[1])
452 alg.objectSelection = self.extendObjectSelection(config, self.jets.split(".")[0], alg.objectSelection, extraSel)
453 alg.minPt = self.check_float(items[2])
454 alg.sign = self.check_sign(items[3])
455 alg.count = self.check_int(items[4])
456 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
457 return
458

◆ add_NJETGHOST_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NJETGHOST_selector ( self,
text,
config )

Definition at line 621 of file EventSelectionConfig.py.

621 def add_NJETGHOST_selector(self, text, config):
622 items = text.split()
623 if items[0] != "JET_N_GHOST":
624 self.raise_misconfig(text, "JET_N_GHOST")
625 if len(items) != 4 and len(items) != 5:
626 self.raise_misconfig(text, "number of arguments")
627 thisalg = f'{self.selectionName}_NJETGHOST_{self.step}'
628 alg = config.createAlgorithm('CP::JetNGhostSelectorAlg', thisalg)
629 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
630 ghosts = self.check_ghosts(items[1])
631 alg.ghost = ghosts[0]
632 if len(ghosts) > 1 :
633 alg.veto = ghosts[1]
634 if len(items) == 4:
635 alg.sign = self.check_sign(items[2])
636 alg.count = self.check_int(items[3])
637 elif len(items) == 5:
638 alg.minPt = self.check_float(items[2])
639 alg.sign = self.check_sign(items[3])
640 alg.count = self.check_int(items[4])
641 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
642 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
643 return
644

◆ add_NLJET_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NLJET_selector ( self,
text,
config )

Definition at line 547 of file EventSelectionConfig.py.

547 def add_NLJET_selector(self, text, config):
548 items = text.split()
549 if items[0] != "LJET_N":
550 self.raise_misconfig(text, "LJET_N")
551 if len(items) != 4 and len(items) != 5:
552 self.raise_misconfig(text, "number of arguments")
553 thisalg = f'{self.selectionName}_NLJET_{self.step}'
554 alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg)
555 alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets)
556 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
557 if len(items) == 4:
558 alg.minPt = self.check_float(items[1])
559 alg.sign = self.check_sign(items[2])
560 alg.count = self.check_int(items[3])
561 elif len(items) == 5:
562 extraSel = self.check_string(items[1])
563 alg.objectSelection = self.extendObjectSelection(config, self.largeRjets.split(".")[0], alg.objectSelection, extraSel)
564 alg.minPt = self.check_float(items[2])
565 alg.sign = self.check_sign(items[3])
566 alg.count = self.check_int(items[4])
567 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
568 return
569

◆ add_NLJETGHOST_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NLJETGHOST_selector ( self,
text,
config )

Definition at line 645 of file EventSelectionConfig.py.

645 def add_NLJETGHOST_selector(self, text, config):
646 items = text.split()
647 if items[0] != "LJET_N_GHOST":
648 self.raise_misconfig(text, "LJET_N_GHOST")
649 if len(items) != 4 and len(items) != 5:
650 self.raise_misconfig(text, "number of arguments")
651 thisalg = f'{self.selectionName}_NLJETGHOST_{self.step}'
652 alg = config.createAlgorithm('CP::JetNGhostSelectorAlg', thisalg)
653 alg.jets, alg.jetSelection = config.readNameAndSelection(self.largeRjets)
654 ghosts = self.check_ghosts(items[1])
655 alg.ghost = ghosts[0]
656 if len(ghosts) > 1 :
657 alg.veto = ghosts[1]
658 if len(items) == 4:
659 alg.sign = self.check_sign(items[2])
660 alg.count = self.check_int(items[3])
661 elif len(items) == 5:
662 alg.minPt = self.check_float(items[2])
663 alg.sign = self.check_sign(items[3])
664 alg.count = self.check_int(items[4])
665 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
666 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
667 return
668

◆ add_NLJETMASS_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NLJETMASS_selector ( self,
text,
config )

Definition at line 570 of file EventSelectionConfig.py.

570 def add_NLJETMASS_selector(self, text, config):
571 items = text.split()
572 if items[0] != "LJETMASS_N":
573 self.raise_misconfig(text, "LJETMASS_N")
574 if len(items) != 4 and len(items) != 5:
575 self.raise_misconfig(text, "number of arguments")
576 thisalg = f'{self.selectionName}_NLJETMASS_{self.step}'
577 alg = config.createAlgorithm('CP::NObjectMassSelectorAlg', thisalg)
578 alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets)
579 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
580 if len(items) == 4:
581 alg.minMass = self.check_float(items[1])
582 alg.sign = self.check_sign(items[2])
583 alg.count = self.check_int(items[3])
584 elif len(items) == 5:
585 extraSel = self.check_string(items[1])
586 alg.objectSelection = self.extendObjectSelection(config, self.largeRjets.split(".")[0], alg.objectSelection, extraSel)
587 alg.minMass = self.check_float(items[2])
588 alg.sign = self.check_sign(items[3])
589 alg.count = self.check_int(items[4])
590 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
591 return
592

◆ add_NLJETMASSWINDOW_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NLJETMASSWINDOW_selector ( self,
text,
config )

Definition at line 593 of file EventSelectionConfig.py.

593 def add_NLJETMASSWINDOW_selector(self, text, config):
594 items = text.split()
595 if items[0] != "LJETMASSWINDOW_N":
596 self.raise_misconfig(text, "LJETMASSWINDOW_N")
597 if len(items) != 5 and len(items) != 6 and len(items) != 7:
598 self.raise_misconfig(text, "number of arguments")
599 thisalg = f'{self.selectionName}_NLJETMASSWINDOW_{self.step}'
600 alg = config.createAlgorithm('CP::NLargeRJetMassWindowSelectorAlg', thisalg)
601 alg.ljets, alg.ljetSelection = config.readNameAndSelection(self.largeRjets)
602 vetoMode = items[-1] == 'veto' or items[-1] == 'VETO'
603 if len(items) == 5 or (len(items) == 6 and vetoMode):
604 alg.lowMass = self.check_float(items[1])
605 alg.highMass = self.check_float(items[2])
606 alg.sign = self.check_sign(items[3])
607 alg.count = self.check_int(items[4])
608 alg.vetoMode = vetoMode
609 elif (len(items) == 6 and not vetoMode) or len(items) == 7:
610 extraSel = self.check_string(items[1])
611 alg.ljetSelection = self.extendObjectSelection(config, self.largeRjets.split(".")[0], alg.ljetSelection, extraSel)
612 alg.lowMass = self.check_float(items[2])
613 alg.highMass = self.check_float(items[3])
614 alg.sign = self.check_sign(items[4])
615 alg.count = self.check_int(items[5])
616 alg.vetoMode = vetoMode
617 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
618 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
619 return
620

◆ add_NMU_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NMU_selector ( self,
text,
config )

Definition at line 327 of file EventSelectionConfig.py.

327 def add_NMU_selector(self, text, config):
328 items = text.split()
329 if items[0] != "MU_N":
330 self.raise_misconfig(text, "MU_N")
331 if len(items) != 4 and len(items) != 5:
332 self.raise_misconfig(text, "number of arguments")
333 if not self.muons:
334 self.raise_missinginput("muons")
335 thisalg = f'{self.selectionName}_NMU_{self.step}'
336 alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg)
337 alg.particles, alg.objectSelection = config.readNameAndSelection(self.muons)
338 if "Truth" in self.muons:
339 alg.useDressedProperties = self.useDressedProperties
340 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
341 if len(items) == 4:
342 alg.minPt = self.check_float(items[1])
343 alg.sign = self.check_sign(items[2])
344 alg.count = self.check_int(items[3])
345 elif len(items) == 5:
346 extraSel = self.check_string(items[1])
347 alg.objectSelection = self.extendObjectSelection(config, self.muons.split(".")[0], alg.objectSelection, extraSel)
348 alg.minPt = self.check_float(items[2])
349 alg.sign = self.check_sign(items[3])
350 alg.count = self.check_int(items[4])
351 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
352 return
353

◆ add_NOBJ_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NOBJ_selector ( self,
text,
config )

Definition at line 669 of file EventSelectionConfig.py.

669 def add_NOBJ_selector(self, text, config):
670 items = text.split()
671 if items[0] != "OBJ_N":
672 self.raise_misconfig(text, "OBJ_N")
673 if len(items) != 5:
674 self.raise_misconfig(text, "number of arguments")
675 thisalg = f'{self.selectionName}_NOBJ_{self.step}'
676 alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg)
677 alg.particles, alg.objectSelection = config.readNameAndSelection(self.check_string(items[1]))
678 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
679 alg.minPt = self.check_float(items[2])
680 alg.sign = self.check_sign(items[3])
681 alg.count = self.check_int(items[4])
682 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
683 return
684

◆ add_NPH_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NPH_selector ( self,
text,
config )

Definition at line 497 of file EventSelectionConfig.py.

497 def add_NPH_selector(self, text, config):
498 items = text.split()
499 if items[0] != "PH_N":
500 self.raise_misconfig(text, "PH_N")
501 if len(items) != 4 and len(items) != 5:
502 self.raise_misconfig(text, "number of arguments")
503 if not self.photons:
504 self.raise_missinginput("photons")
505 thisalg = f'{self.selectionName}_NPH_{self.step}'
506 alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg)
507 alg.particles, alg.objectSelection = config.readNameAndSelection(self.photons)
508 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
509 if len(items) == 4:
510 alg.minPt = self.check_float(items[1])
511 alg.sign = self.check_sign(items[2])
512 alg.count = self.check_int(items[3])
513 elif len(items) == 5:
514 extraSel = self.check_string(items[1])
515 alg.objectSelection = self.extendObjectSelection(config, self.photons.split(".")[0], alg.objectSelection, extraSel)
516 alg.minPt = self.check_float(items[2])
517 alg.sign = self.check_sign(items[3])
518 alg.count = self.check_int(items[4])
519 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
520 return
521

◆ add_NTAU_selector()

python.EventSelectionConfig.EventSelectionConfig.add_NTAU_selector ( self,
text,
config )

Definition at line 522 of file EventSelectionConfig.py.

522 def add_NTAU_selector(self, text, config):
523 items = text.split()
524 if items[0] != "TAU_N":
525 self.raise_misconfig(text, "TAU_N")
526 if len(items) != 4 and len(items) != 5:
527 self.raise_misconfig(text, "number of arguments")
528 if not self.taus:
529 self.raise_missinginput("taus")
530 thisalg = f'{self.selectionName}_NTAU_{self.step}'
531 alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg)
532 alg.particles, alg.objectSelection = config.readNameAndSelection(self.taus)
533 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
534 if len(items) == 4:
535 alg.minPt = self.check_float(items[1])
536 alg.sign = self.check_sign(items[2])
537 alg.count = self.check_int(items[3])
538 elif len(items) == 5:
539 extraSel = self.check_string(items[1])
540 alg.objectSelection = self.extendObjectSelection(config, self.taus.split(".")[0], alg.objectSelection, extraSel)
541 alg.minPt = self.check_float(items[2])
542 alg.sign = self.check_sign(items[3])
543 alg.count = self.check_int(items[4])
544 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
545 return
546

◆ add_OS_selector()

python.EventSelectionConfig.EventSelectionConfig.add_OS_selector ( self,
text,
config )

Definition at line 794 of file EventSelectionConfig.py.

794 def add_OS_selector(self, text, config):
795 items = text.split()
796 if not items or len(items) > 4:
797 self.raise_misconfig(text, "number of arguments")
798 if not self.electrons and not self.muons and not self.taus:
799 self.raise_missinginput("electrons or muons or taus")
800 thisalg = f'{self.selectionName}_OS_{self.step}'
801 alg = config.createAlgorithm('CP::ChargeSelectorAlg', thisalg)
802 if self.electrons and (len(items) == 1 or "el" in items):
803 if "Particle" in self.electrons or "Truth" in self.electrons:
804 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
805 else:
806 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
807 if self.muons and (len(items) == 1 or "mu" in items):
808 if "Particle" in self.muons or "Truth" in self.muons:
809 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
810 else:
811 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
812 if self.taus and (len(items) == 1 or "tau" in items):
813 if "Particle" in self.taus or "Truth" in self.taus:
814 alg.truthTaus, alg.truthTauSelection = config.readNameAndSelection(self.taus)
815 else:
816 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
817 alg.OS = True
818 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
819 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
820 return
821

◆ add_RUNNUMBER()

python.EventSelectionConfig.EventSelectionConfig.add_RUNNUMBER ( self,
text,
config )

Definition at line 902 of file EventSelectionConfig.py.

902 def add_RUNNUMBER(self, text, config):
903 items = text.split()
904 if items[0] != "RUN_NUMBER":
905 self.raise_misconfig(text, "RUN_NUMBER")
906 if len(items) != 3:
907 self.raise_misconfig(text, "number of arguments")
908 thisalg = f'{self.selectionName}_RUN_NUMBER_{self.step}'
909 alg = config.createAlgorithm('CP::RunNumberSelectorAlg', thisalg)
910 alg.sign = self.check_sign(items[1])
911 alg.runNumber = self.check_int(items[2])
912 alg.useRandomRunNumber = config.dataType() is not DataType.Data
913 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
914 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
915 return
916

◆ add_SAVE()

python.EventSelectionConfig.EventSelectionConfig.add_SAVE ( self,
text,
config )

Definition at line 917 of file EventSelectionConfig.py.

917 def add_SAVE(self, text, config):
918 items = text.split()
919 if items[0] != "SAVE":
920 self.raise_misconfig(text, "SAVE")
921 if len(items) != 1:
922 self.raise_misconfig(text, "number of arguments")
923 thisalg = f'{self.selectionName}_SAVE'
924 alg = config.createAlgorithm('CP::SaveFilterAlg', thisalg)
925 alg.FilterDescription = f'events passing < {self.selectionName} >'
926 alg.eventDecisionOutputDecoration = f'ignore_{self.selectionName}_%SYS%'
927 alg.selection = self.checkDecorationName(self.currentDecoration)
928 alg.noFilter = True
929 alg.selectionName = f'pass_{self.selectionName}_%SYS%,as_char' # this one is used as a selection
930 alg.decorationName = f'ntuplepass_{self.selectionName}_%SYS%' # this one is saved to file
931 config.addOutputVar('EventInfo', f'ntuplepass_{self.selectionName}_%SYS%', f'pass_{self.selectionName}')
932 return
933
934@groupBlocks

◆ add_SS_selector()

python.EventSelectionConfig.EventSelectionConfig.add_SS_selector ( self,
text,
config )

Definition at line 822 of file EventSelectionConfig.py.

822 def add_SS_selector(self, text, config):
823 items = text.split()
824 if not items or len(items) > 4:
825 self.raise_misconfig(text, "number of arguments")
826 if not self.electrons and not self.muons and not self.taus:
827 self.raise_missinginput("electrons or muons or taus")
828 thisalg = f'{self.selectionName}_SS_{self.step}'
829 alg = config.createAlgorithm('CP::ChargeSelectorAlg', thisalg)
830 if self.electrons and (len(items) == 1 or "el" in items):
831 if "Particle" in self.electrons or "Truth" in self.electrons:
832 alg.truthElectrons, alg.truthElectronSelection = config.readNameAndSelection(self.electrons)
833 else:
834 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
835 if self.muons and (len(items) == 1 or "mu" in items):
836 if "Particle" in self.muons or "Truth" in self.muons:
837 alg.truthMuons, alg.truthMuonSelection = config.readNameAndSelection(self.muons)
838 else:
839 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
840 if self.taus and (len(items) == 1 or "tau" in items):
841 if "Particle" in self.taus or "Truth" in self.taus:
842 alg.truthTaus, alg.truthTauSelection = config.readNameAndSelection(self.taus)
843 else:
844 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
845 alg.OS = False
846 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
847 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
848 return
849

◆ add_SUMNELNMU_selector()

python.EventSelectionConfig.EventSelectionConfig.add_SUMNELNMU_selector ( self,
text,
config )

Definition at line 354 of file EventSelectionConfig.py.

354 def add_SUMNELNMU_selector(self, text, config):
355 items = text.split()
356 if items[0] != "SUM_EL_N_MU_N":
357 self.raise_misconfig(text, "SUM_EL_N_MU_N")
358 if len(items) != 4 and len(items) != 5 and len(items) != 7:
359 self.raise_misconfig(text, "number of arguments")
360 if not self.electrons and not self.muons:
361 self.raise_missinginput("electrons or muons")
362 thisalg = f'{self.selectionName}_SUMNELNMU_{self.step}'
363 alg = config.createAlgorithm('CP::SumNLeptonPtSelectorAlg', thisalg)
364 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
365 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
366 if "Truth" in self.electrons:
367 alg.useDressedProperties = self.useDressedProperties
368 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
369 if len(items) == 4:
370 alg.minPtEl = self.check_float(items[1])
371 alg.minPtMu = self.check_float(items[1])
372 alg.sign = self.check_sign(items[2])
373 alg.count = self.check_int(items[3])
374 elif len(items) == 5:
375 alg.minPtEl = self.check_float(items[1])
376 alg.minPtMu = self.check_float(items[2])
377 alg.sign = self.check_sign(items[3])
378 alg.count = self.check_int(items[4])
379 elif len(items) == 7:
380 extraSelEl = self.check_string(items[1])
381 extraSelMu = self.check_string(items[2])
382 alg.electronSelection = self.extendObjectSelection(config, self.electrons.split(".")[0], alg.electronSelection, extraSelEl)
383 alg.muonSelection = self.extendObjectSelection(config, self.muons.split(".")[0], alg.muonSelection, extraSelMu)
384 alg.minPtEl = self.check_float(items[3])
385 alg.minPtMu = self.check_float(items[4])
386 alg.sign = self.check_sign(items[5])
387 alg.count = self.check_int(items[6])
388 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
389 return
390

◆ add_SUMNLEPTONS_selector()

python.EventSelectionConfig.EventSelectionConfig.add_SUMNLEPTONS_selector ( self,
text,
config )

Definition at line 391 of file EventSelectionConfig.py.

391 def add_SUMNLEPTONS_selector(self, text, config):
392 items = text.split()
393 if items[0] != "SUM_EL_N_MU_N_TAU_N":
394 self.raise_misconfig(text, "SUM_EL_N_MU_N_TAU_N")
395 if len(items) != 4 and len(items) != 6 and len(items) != 9:
396 self.raise_misconfig(text, "number of arguments")
397 if not self.electrons and not self.muons and not self.taus:
398 self.raise_missinginput("electrons, muons or taus")
399 thisalg = f'{self.selectionName}_SUMNLEPTONS_{self.step}'
400 alg = config.createAlgorithm('CP::SumNLeptonPtSelectorAlg', thisalg)
401 alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons)
402 alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons)
403 alg.taus, alg.tauSelection = config.readNameAndSelection(self.taus)
404 if "Truth" in self.electrons:
405 alg.useDressedProperties = self.useDressedProperties
406 alg.eventPreselection = self.checkDecorationName(self.currentDecoration)
407 if len(items) == 4:
408 alg.minPtEl = self.check_float(items[1])
409 alg.minPtMu = self.check_float(items[1])
410 alg.minPtTau = self.check_float(items[1])
411 alg.sign = self.check_sign(items[2])
412 alg.count = self.check_int(items[3])
413 elif len(items) == 6:
414 alg.minPtEl = self.check_float(items[1])
415 alg.minPtMu = self.check_float(items[2])
416 alg.minPtTau = self.check_float(items[3])
417 alg.sign = self.check_sign(items[4])
418 alg.count = self.check_int(items[5])
419 elif len(items) == 9:
420 extraSelEl = self.check_string(items[1])
421 extraSelMu = self.check_string(items[2])
422 extraSelTau = self.check_string(items[3])
423 alg.electronSelection = self.extendObjectSelection(config, self.electrons.split(".")[0], alg.electronSelection, extraSelEl)
424 alg.muonSelection = self.extendObjectSelection(config, self.muons.split(".")[0], alg.muonSelection, extraSelMu)
425 alg.tauSelection = self.extendObjectSelection(config, self.taus.split(".")[0], alg.tauSelection, extraSelTau)
426 alg.minPtEl = self.check_float(items[4])
427 alg.minPtMu = self.check_float(items[5])
428 alg.minPtTau = self.check_float(items[6])
429 alg.sign = self.check_sign(items[7])
430 alg.count = self.check_int(items[8])
431 self.setDecorationName(alg, config, f'{thisalg}_%SYS%')
432 return
433

◆ check_btagging()

python.EventSelectionConfig.EventSelectionConfig.check_btagging ( self,
test )

Definition at line 231 of file EventSelectionConfig.py.

231 def check_btagging(self, test):
232 test = test.split(":")
233 if len(test) != 2:
234 raise ValueError (f"[EventSelectionConfig] Misconfiguration! {test} should be provided as 'btagger:btagWP'")
235 else:
236 return test
237

◆ check_float()

python.EventSelectionConfig.EventSelectionConfig.check_float ( self,
test,
requirePositive = True )

Definition at line 189 of file EventSelectionConfig.py.

189 def check_float(self, test, requirePositive=True):
190 try:
191 value = float(test)
192 if not requirePositive or value >= 0:
193 return value
194 else:
195 raise ValueError (f"[EventSelectionConfig] Misconfiguration! Float {test} is not positive!")
196 except ValueError:
197 raise ValueError (f"[EventSelectionConfig] Misconfiguration! {test} should be a float, not {type(test)}!")
198

◆ check_ghosts()

python.EventSelectionConfig.EventSelectionConfig.check_ghosts ( self,
test )

Definition at line 238 of file EventSelectionConfig.py.

238 def check_ghosts(self, test):
239 test = self.check_string(test)
240 values = test.split("!")
241 ghost_map = {
242 "B": "GhostBHadronsFinalCount",
243 "C": "GhostCHadronsFinalCount",
244 "T": "GhostTQuarksFinalCount",
245 "W": "GhostWBosonsCount",
246 "Z": "GhostZBosonsCount",
247 "H": "GhostHBosonsCount",
248 "TAU": "GhostTausFinalCount"
249 }
250 return [ghost_map.get(value.upper(), value) for value in values]
251

◆ check_int()

python.EventSelectionConfig.EventSelectionConfig.check_int ( self,
test,
requirePositive = True )

Definition at line 199 of file EventSelectionConfig.py.

199 def check_int(self, test, requirePositive=True):
200 try:
201 value = int(test)
202 if value == float(test):
203 if not requirePositive or value >= 0:
204 return value
205 else:
206 raise ValueError (f"[EventSelectionConfig] Misconfiguration! Int {test} us not positive!")
207 else:
208 raise ValueError (f"[EventSelectionConfig] Misconfiguration! {test} should be an int, not a float!")
209 except ValueError:
210 raise ValueError (f"[EventSelectionConfig] Misconfiguration! {test} should be an int, not {type(test)}")
211

◆ check_sign()

python.EventSelectionConfig.EventSelectionConfig.check_sign ( self,
test )

Definition at line 218 of file EventSelectionConfig.py.

218 def check_sign(self, test):
219 mapping = {
220 "<" : "LT",
221 ">" : "GT",
222 "==": "EQ",
223 ">=": "GE",
224 "<=": "LE"
225 }
226 try:
227 return mapping[test]
228 except KeyError:
229 raise KeyError (f"[EventSelectionConfig] Misconfiguration! {test} should be one of {list(mapping.keys())}")
230

◆ check_string()

python.EventSelectionConfig.EventSelectionConfig.check_string ( self,
test )

Definition at line 212 of file EventSelectionConfig.py.

212 def check_string(self, test):
213 if not isinstance(test, str):
214 raise ValueError (f"[EventSelectionConfig] Misconfiguration! {test} should be a string, not a number!")
215 else:
216 return test
217

◆ checkDecorationName()

python.EventSelectionConfig.EventSelectionConfig.checkDecorationName ( self,
decoration )

Definition at line 270 of file EventSelectionConfig.py.

270 def checkDecorationName(self, decoration):
271 if decoration == '':
272 return decoration
273 decoration = decoration.split("&&")
274 decoration = [sub + ',as_char' if ',as_char' not in sub else sub for sub in decoration]
275 return '&&'.join(decoration)
276

◆ extendObjectSelection()

python.EventSelectionConfig.EventSelectionConfig.extendObjectSelection ( self,
config,
container,
oldSelection,
newSelection )

Definition at line 277 of file EventSelectionConfig.py.

277 def extendObjectSelection(self, config, container, oldSelection, newSelection):
278 if oldSelection:
279 return oldSelection + "&&" + config.getFullSelection(container, newSelection)
280 else:
281 return config.getFullSelection(container, newSelection)
282

◆ getCutflow()

python.EventSelectionConfig.EventSelectionConfig.getCutflow ( self)

Definition at line 252 of file EventSelectionConfig.py.

252 def getCutflow(self):
253 return self.cutflow
254

◆ instanceName()

python.EventSelectionConfig.EventSelectionConfig.instanceName ( self)
Return the instance name for this block

Definition at line 95 of file EventSelectionConfig.py.

95 def instanceName (self) :
96 """Return the instance name for this block"""
97 return self.selectionName
98

◆ interpret()

python.EventSelectionConfig.EventSelectionConfig.interpret ( self,
text,
cfg )

Definition at line 119 of file EventSelectionConfig.py.

119 def interpret(self, text, cfg):
120 text = text.strip()
121 if not text:
122 return
123 if text.startswith("#"):
124 return
125 self.step += 1
126 if "EL_N" in text.split():
127 self.add_NEL_selector(text, cfg)
128 elif "MU_N" in text.split():
129 self.add_NMU_selector(text, cfg)
130 elif "SUM_EL_N_MU_N" in text.split():
131 self.add_SUMNELNMU_selector(text, cfg)
132 elif "SUM_EL_N_MU_N_TAU_N" in text.split():
133 self.add_SUMNLEPTONS_selector(text, cfg)
134 elif "JET_N_GHOST" in text.split():
135 self.add_NJETGHOST_selector(text, cfg)
136 elif "JET_N" in text.split():
137 self.add_NJET_selector(text, cfg)
138 elif "JET_N_BTAG" in text.split():
139 self.add_NBJET_selector(text, cfg)
140 elif "PH_N" in text.split():
141 self.add_NPH_selector(text, cfg)
142 elif "TAU_N" in text.split():
143 self.add_NTAU_selector(text, cfg)
144 elif "LJET_N_GHOST" in text.split():
145 self.add_NLJETGHOST_selector(text, cfg)
146 elif "LJET_N" in text.split():
147 self.add_NLJET_selector(text, cfg)
148 elif "OBJ_N" in text.split():
149 self.add_NOBJ_selector(text, cfg)
150 elif "MET" in text.split():
151 self.add_MET_selector(text, cfg)
152 elif "MWT" in text.split():
153 self.add_MWT_selector(text, cfg)
154 elif "MET+MWT" in text.split():
155 self.add_METMWT_selector(text, cfg)
156 elif "MLL" in text.split():
157 self.add_MLL_selector(text, cfg)
158 elif "MLLWINDOW" in text.split():
159 self.add_MLLWINDOW_selector(text, cfg)
160 elif "OS" in text.split():
161 self.add_OS_selector(text, cfg)
162 elif "SS" in text.split():
163 self.add_SS_selector(text, cfg)
164 elif "MLL_OSSF" in text.split():
165 self.add_MLL_OSSF_selector(text, cfg)
166 elif "LJETMASS_N" in text.split():
167 self.add_NLJETMASS_selector(text, cfg)
168 elif "LJETMASSWINDOW_N" in text.split():
169 self.add_NLJETMASSWINDOW_selector(text, cfg)
170 elif "SAVE" in text.split():
171 self.add_SAVE(text, cfg)
172 elif "IMPORT" in text.split():
173 self.add_IMPORT(text, cfg)
174 elif "EVENTFLAG" in text.split():
175 self.add_EVENTFLAG(text, cfg)
176 elif "GLOBALTRIGMATCH" in text.split():
177 self.add_GLOBALTRIGMATCH(text, cfg)
178 elif "RUN_NUMBER" in text.split():
179 self.add_RUNNUMBER(text, cfg)
180 else:
181 raise ValueError (f"[EventSelectionConfig] The following selection cut is not recognised! --> {text}")
182

◆ makeAlgs()

python.EventSelectionConfig.EventSelectionConfig.makeAlgs ( self,
config )

Definition at line 99 of file EventSelectionConfig.py.

99 def makeAlgs(self, config):
100 existing = config.getContainerMeta('EventInfo', 'eventSelectionNames', defaultValue=[])
101 config.setContainerMeta('EventInfo', 'eventSelectionNames',
102 existing + [f'pass_{self.selectionName}_%SYS%'], allowOverwrite=True)
103
104 # need to re-initialize here to deal with multiple passes
105 self.step = 0
106 # initialize the pre-selection
107 self.currentDecoration = self.preselection
108 # re-initialize the cutflow
109 self.cutflow = []
110 # read the selection cuts
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"):
115 self.interpret(line, config)
116 config.addEventCutFlow(self.selectionName, self.getCutflow())
117
118

◆ raise_misconfig()

python.EventSelectionConfig.EventSelectionConfig.raise_misconfig ( self,
text,
keyword )

Definition at line 183 of file EventSelectionConfig.py.

183 def raise_misconfig(self, text, keyword):
184 raise ValueError (f"[EventSelectionConfig] Misconfiguration! Check {keyword} in: {text}")
185

◆ raise_missinginput()

python.EventSelectionConfig.EventSelectionConfig.raise_missinginput ( self,
collection )

Definition at line 186 of file EventSelectionConfig.py.

186 def raise_missinginput(self, collection):
187 raise ValueError (f"[EventSelectionConfig] Misconfiguration! Missing input collection for {collection}")
188

◆ setDecorationName()

python.EventSelectionConfig.EventSelectionConfig.setDecorationName ( self,
algorithm,
config,
decoration )

Definition at line 255 of file EventSelectionConfig.py.

255 def setDecorationName(self, algorithm, config, decoration):
256 self.cutflow.append( decoration )
257 if algorithm is not None:
258 algorithm.decorationName = f'{decoration},as_char'
259 self.currentDecoration = decoration
260 if self.debugMode:
261 config.addOutputVar('EventInfo', decoration, decoration.split("_%SYS%")[0])
262 else:
263 if self.currentDecoration:
264 self.currentDecoration += '&&' + decoration
265 else:
266 self.currentDecoration = decoration
267 config.addSelection('EventInfo', '', decoration)
268 return
269

Member Data Documentation

◆ currentDecoration

str python.EventSelectionConfig.EventSelectionConfig.currentDecoration = ''

Definition at line 92 of file EventSelectionConfig.py.

◆ cutflow

list python.EventSelectionConfig.EventSelectionConfig.cutflow = []

Definition at line 93 of file EventSelectionConfig.py.

◆ debugMode

python.EventSelectionConfig.EventSelectionConfig.debugMode

Definition at line 260 of file EventSelectionConfig.py.

◆ electrons

python.EventSelectionConfig.EventSelectionConfig.electrons

Definition at line 306 of file EventSelectionConfig.py.

◆ jets

python.EventSelectionConfig.EventSelectionConfig.jets

Definition at line 440 of file EventSelectionConfig.py.

◆ met

python.EventSelectionConfig.EventSelectionConfig.met

Definition at line 691 of file EventSelectionConfig.py.

◆ muons

python.EventSelectionConfig.EventSelectionConfig.muons

Definition at line 333 of file EventSelectionConfig.py.

◆ photons

python.EventSelectionConfig.EventSelectionConfig.photons

Definition at line 503 of file EventSelectionConfig.py.

◆ selectionName

python.EventSelectionConfig.EventSelectionConfig.selectionName

Definition at line 116 of file EventSelectionConfig.py.

◆ step

int python.EventSelectionConfig.EventSelectionConfig.step = 0

Definition at line 91 of file EventSelectionConfig.py.

◆ taus

python.EventSelectionConfig.EventSelectionConfig.taus

Definition at line 397 of file EventSelectionConfig.py.


The documentation for this class was generated from the following file: