the ConfigBlock for trigger analysis
Definition at line 10 of file TriggerAnalysisConfig.py.
◆ __init__()
def python.TriggerAnalysisConfig.TriggerAnalysisBlock.__init__ |
( |
|
self, |
|
|
|
configName = '' |
|
) |
| |
Definition at line 14 of file TriggerAnalysisConfig.py.
15 super (TriggerAnalysisBlock, self).__init__ ()
16 self.addOption (
'triggerChainsPerYear', {}, type=
None,
17 info=
"a dictionary with key (string) the year and value (list of "
18 "strings) the trigger chains. You can also use || within a string "
19 "to enforce an OR of triggers without looking up the individual "
20 "triggers. Used for both trigger selection and SFs. "
21 "The default is {} (empty dictionary).")
22 self.addOption (
'multiTriggerChainsPerYear', {}, type=
None,
23 info=
"a dictionary with key (string) a trigger set name and value a "
24 "triggerChainsPerYear dictionary, following the previous convention. "
25 "Relevant for analyses using different triggers in different categories, "
26 "where the trigger global scale factors shouldn't be combined. "
27 "The default is {} (empty dictionary).")
28 self.addOption (
'triggerChainsForSelection', [], type=
None,
29 info=
"a list of trigger chains (list of strings) to be used for "
30 "trigger selection. Only set it if you need a different setup "
31 "than for trigger SFs. The default is [] (empty list).")
32 self.addOption (
'prescaleLumiCalcFiles', [], type=
None,
33 info=
"a list of lumical files (list of strings) to calculate "
34 "trigger prescales. The default is [] (empty list).")
35 self.addOption (
'prescaleTriggersFormula',
'', type=str,
36 info=
"a formula used in (un)prescaling, producing overall prescale "
37 "factor instead of prescale per trigger.")
38 self.addOption (
'prescaleMC',
False, type=bool,
39 info=
"prescale MC instead of unprescaling of data.")
40 self.addOption (
'noFilter',
False, type=bool,
41 info=
"do not apply an event filter. The default is False, i.e. "
42 "remove events not passing trigger selection and matching.")
44 self.addOption (
'noL1',
False, type=bool,
◆ makeAlgs()
def python.TriggerAnalysisConfig.TriggerAnalysisBlock.makeAlgs |
( |
|
self, |
|
|
|
config |
|
) |
| |
Definition at line 95 of file TriggerAnalysisConfig.py.
95 def makeAlgs (self, config) :
97 if (self.multiTriggerChainsPerYear
and self.triggerChainsPerYear
and
98 self.triggerChainsPerYear
is not self.multiTriggerChainsPerYear.
get(
'')):
99 raise Exception(
'multiTriggerChainsPerYear and triggerChainsPerYear cannot be configured at the same time!')
101 if self.triggerChainsPerYear
and not self.multiTriggerChainsPerYear:
102 self.multiTriggerChainsPerYear = {
'': self.triggerChainsPerYear}
105 if self.triggerChainsPerYear
and not self.triggerChainsForSelection:
107 for trigger_chains
in self.multiTriggerChainsPerYear.
values():
108 for chain_list
in self.triggerChainsPerYear.
values():
109 for chain
in chain_list:
111 chains = chain.split(
'||')
112 triggers.update(map(str.strip, chains))
114 triggers.add(chain.strip())
115 self.triggerChainsForSelection =
list(triggers)
118 decisionTool = self.makeTriggerDecisionTool(config)
120 if self.triggerChainsForSelection:
121 self.makeTriggerSelectionAlg(config, decisionTool)
◆ makeTriggerDecisionTool()
def python.TriggerAnalysisConfig.TriggerAnalysisBlock.makeTriggerDecisionTool |
( |
|
self, |
|
|
|
config |
|
) |
| |
Definition at line 47 of file TriggerAnalysisConfig.py.
47 def makeTriggerDecisionTool(self, config):
50 xAODConfTool = config.createPublicTool(
'TrigConf::xAODConfigTool',
'xAODConfigTool' )
51 decisionTool = config.createPublicTool(
'Trig::TrigDecisionTool',
'TrigDecisionTool' )
52 decisionTool.ConfigTool =
'%s/%s' % \
53 ( xAODConfTool.getType(), xAODConfTool.getName() )
54 decisionTool.HLTSummary = config.hltSummary()
55 if config.geometry()
is LHCPeriod.Run3:
56 decisionTool.NavigationFormat =
'TrigComposite'
◆ makeTriggerSelectionAlg()
def python.TriggerAnalysisConfig.TriggerAnalysisBlock.makeTriggerSelectionAlg |
( |
|
self, |
|
|
|
config, |
|
|
|
decisionTool |
|
) |
| |
Definition at line 61 of file TriggerAnalysisConfig.py.
61 def makeTriggerSelectionAlg(self, config, decisionTool):
64 alg = config.createAlgorithm(
'CP::TrigEventSelectionAlg',
'TrigEventSelectionAlg' )
65 alg.tool =
'%s/%s' % \
66 ( decisionTool.getType(), decisionTool.getName() )
67 alg.triggers = self.triggerChainsForSelection
68 alg.selectionDecoration =
'trigPassed'
69 alg.noFilter = self.noFilter
72 for t
in self.triggerChainsForSelection :
73 t = t.replace(
".",
"p").
replace(
"-",
"_")
74 config.addOutputVar (
'EventInfo',
'trigPassed_' + t,
'trigPassed_' + t, noSys=
True)
77 if ((config.dataType()
is DataType.Data) != self.prescaleMC)
and self.prescaleLumiCalcFiles:
79 alg = config.createAlgorithm(
'CP::TrigPrescalesAlg',
'TrigPrescalesAlg' )
80 config.addPrivateTool(
'pileupReweightingTool',
'CP::PileupReweightingTool' )
81 alg.pileupReweightingTool.LumiCalcFiles = self.prescaleLumiCalcFiles
82 alg.pileupReweightingTool.TrigDecisionTool =
'%s/%s' % \
83 ( decisionTool.getType(), decisionTool.getName() )
84 if self.prescaleTriggersFormula !=
'':
85 alg.prescaleTriggersFormula = self.prescaleTriggersFormula
87 alg.triggers = [lumicalc.split(
':')[-1]
for lumicalc
in self.prescaleLumiCalcFiles
if ':' in lumicalc]
88 alg.triggersAll = self.triggerChainsForSelection
89 alg.prescaleMC = self.prescaleMC
90 alg.prescaleDecoration =
'prescale'
◆ multiTriggerChainsPerYear
python.TriggerAnalysisConfig.TriggerAnalysisBlock.multiTriggerChainsPerYear |
◆ triggerChainsForSelection
python.TriggerAnalysisConfig.TriggerAnalysisBlock.triggerChainsForSelection |
The documentation for this class was generated from the following file:
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.