ATLAS Offline Software
FullCPAlgorithmsTest.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 #
3 # @author Nils Krumnack
4 
5 from AnaAlgorithm.AlgSequence import AlgSequence
6 from AnalysisAlgorithmsConfig.ConfigSequence import ConfigSequence
7 from AnalysisAlgorithmsConfig.ConfigAccumulator import ConfigAccumulator, DataType
8 from AthenaConfiguration.Enums import LHCPeriod
9 from AthenaCommon.SystemOfUnits import GeV
10 
11 # Config:
12 triggerChainsPerYear = {
13  2015: ['HLT_e24_lhmedium_L1EM20VH || HLT_e60_lhmedium || HLT_e120_lhloose', 'HLT_mu20_iloose_L1MU15 || HLT_mu40', 'HLT_2g20_tight'],
14  2016: ['HLT_e26_lhtight_nod0_ivarloose || HLT_e60_lhmedium_nod0 || HLT_e140_lhloose_nod0', 'HLT_mu26_ivarmedium || HLT_mu50', 'HLT_g35_loose_g25_loose'],
15  2017: ['HLT_e26_lhtight_nod0_ivarloose || HLT_e60_lhmedium_nod0 || HLT_e140_lhloose_nod0', 'HLT_2g22_tight_L12EM15VHI', 'HLT_mu50'],
16  2018: ['HLT_e26_lhtight_nod0_ivarloose || HLT_e60_lhmedium_nod0 || HLT_e140_lhloose_nod0', 'HLT_g35_medium_g25_medium_L12EM20VH', 'HLT_mu26_ivarmedium', 'HLT_2mu14'],
17  # '2022': ['HLT_e26_lhtight_ivarloose_L1EM22VHI || HLT_e60_lhmedium_L1EM22VHI || HLT_e140_lhloose_L1EM22VHI'],
18  # '2023': ['HLT_e26_lhtight_ivarloose_L1EM22VHI || HLT_e60_lhmedium_L1EM22VHI || HLT_e140_lhloose_L1EM22VHI'],
19 }
20 tauTriggerChainsSF = {
21  2015: ['HLT_tau25_medium1_tracktwo', 'HLT_tau35_medium1_tracktwo'],
22  2016: ['HLT_tau25_medium1_tracktwo', 'HLT_tau35_medium1_tracktwo'],
23  2017: ['HLT_tau25_medium1_tracktwo', 'HLT_tau35_medium1_tracktwo'],
24  2018: ['HLT_tau25_medium1_tracktwoEF_OR_mediumRNN_tracktwoMVA', 'HLT_tau35_medium1_tracktwoEF_OR_mediumRNN_tracktwoMVA'],
25 }
26 
27 # Example cuts used for event selection algorithm test
28 exampleSelectionCuts = {
29  'SUBcommon': """JET_N_BTAG >= 2
30 JET_N 25000 >= 4
31 MET >= 20000
32 SAVE
33 """,
34  'ejets': """IMPORT SUBcommon
35 EL_N 5000 == 1
36 MU_N 3000 == 0
37 MWT < 170000
38 MET+MWT > 40000
39 SAVE
40 """,
41  'mujets': """IMPORT SUBcommon
42 EL_N 5000 == 0
43 MU_N medium 25000 > 0
44 SAVE
45 """
46 }
47 
48 electronMinPt = 10*GeV
49 photonMinPt = 10*GeV
50 
51 
52 def makeTestSequenceBlocks (dataType, algSeq, isPhyslite,
53  geometry=None, autoconfigFromFlags=None, noSystematics=None,
54  onlyNominalOR=False, forceEGammaFullSimConfig=False,
55  returnConfigSeq=False,
56  bleedingEdge=False) :
57 
58  largeRJets = True
59 
60  if autoconfigFromFlags is not None:
61  if geometry is None:
62  geometry = autoconfigFromFlags.GeoModel.Run
63 
64  configSeq = ConfigSequence ()
65 
66  outputContainers = {'mu_' : 'OutMuons',
67  'el_' : 'OutElectrons',
68  'ph_' : 'OutPhotons',
69  'tau_': 'OutTauJets',
70  'jet_': 'OutJets',
71  'met_': 'AnaMET',
72  '' : 'EventInfo'}
73  outputContainersForMC = {'truth_mu_' : 'OutTruthMuons',
74  'truth_el_' : 'OutTruthElectrons',
75  'truth_ph_' : 'OutTruthPhotons',
76  'truth_tau_': 'OutTruthTaus',
77  'truth_jet_': 'OutTruthJets',
78  'truth_met_': 'TruthMET'}
79 
80  # create factory object to build block configurations
81  from AnalysisAlgorithmsConfig.ConfigFactory import ConfigFactory
82  config = ConfigFactory()
83 
84  configSeq += config.makeConfig('CommonServices')
85  configSeq.setOptionValue('.systematicsHistogram', 'systematicsList')
86 
87  configSeq += config.makeConfig('PileupReweighting')
88 
89  # Skip events with no primary vertex,
90  # and perform loose jet cleaning
91  configSeq += config.makeConfig ('EventCleaning')
92  configSeq.setOptionValue ('.runEventCleaning', True)
93 
94  # disabling comparisons for triggers, because the config blocks do a
95  # lot more than the sequences. Also disabling for Run 3+4, as there is no SF yet
96  if geometry is LHCPeriod.Run2:
97  # Include, and then set up the trigger analysis sequence:
98  configSeq += config.makeConfig( 'Trigger' )
99  configSeq.setOptionValue ('.triggerChainsPerYear', triggerChainsPerYear )
100  configSeq.setOptionValue ('.noFilter', True )
101  configSeq.setOptionValue ('.electrons', 'AnaElectrons.loose' )
102  configSeq.setOptionValue ('.photons', 'AnaPhotons.tight' )
103  configSeq.setOptionValue ('.muons', 'AnaMuons.medium' )
104  configSeq.setOptionValue ('.taus', 'AnaTauJets.tight' )
105  configSeq.setOptionValue ('.electronID', 'Tight' )
106  configSeq.setOptionValue ('.electronIsol', 'Tight_VarRad')
107  configSeq.setOptionValue ('.photonIsol', 'TightCaloOnly')
108  configSeq.setOptionValue ('.muonID', 'Tight')
109  configSeq.setOptionValue ('.triggerMatchingChainsPerYear', triggerChainsPerYear)
110 
111  # Include, and then set up the jet analysis algorithm sequence:
112  configSeq += config.makeConfig( 'Jets',
113  containerName='AnaJets',
114  jetCollection='AntiKt4EMPFlowJets')
115  configSeq.setOptionValue ('.runJvtUpdate', False )
116  configSeq.setOptionValue ('.runNNJvtUpdate', True )
117  configSeq.setOptionValue ('.recalibratePhyslite', False)
118 
119  configSeq += config.makeConfig( 'Jets.JVT',
120  containerName='AnaJets' )
121 
122  # disabling flavor tagging for Run 4, as the configuration just
123  # refuses to work on that
124  if geometry is not LHCPeriod.Run4:
125 
126  btagger = "GN2v01"
127  btagWP = "FixedCutBEff_65"
128  configSeq += config.makeConfig( 'Jets.FlavourTagging',
129  containerName='AnaJets',
130  selectionName='ftag' )
131  configSeq.setOptionValue ('.btagger', btagger)
132  configSeq.setOptionValue ('.btagWP', btagWP)
133  configSeq.setOptionValue ('.saveScores', 'All')
134 
135  configSeq += config.makeConfig( 'Jets.FlavourTaggingEventSF',
136  containerName='AnaJets.baselineJvt')
137  configSeq.setOptionValue ('.btagger', btagger)
138 
139  if largeRJets :
140  configSeq += config.makeConfig( 'Jets',
141  containerName='AnaLargeRJets',
142  jetCollection='AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets' )
143  outputContainers['larger_jet_'] = 'OutLargeRJets'
144  configSeq.setOptionValue ('.recalibratePhyslite', False)
145 
146 
147  # Include, and then set up the electron analysis algorithm sequence:
148  likelihood = True
149  configSeq += config.makeConfig ('Electrons',
150  containerName='AnaElectrons' )
151  configSeq.setOptionValue ('.decorateTruth', True)
152  configSeq.setOptionValue ('.forceFullSimConfig', forceEGammaFullSimConfig)
153  configSeq.setOptionValue ('.recalibratePhyslite', False)
154  configSeq += config.makeConfig ('Electrons.WorkingPoint',
155  containerName='AnaElectrons',
156  selectionName='loose')
157  configSeq.setOptionValue ('.forceFullSimConfig', forceEGammaFullSimConfig)
158  configSeq.setOptionValue ('.noEffSF', geometry is LHCPeriod.Run2)
159  if likelihood:
160  configSeq.setOptionValue ('.identificationWP', 'LooseBLayerLH')
161  else:
162  configSeq.setOptionValue ('.identificationWP', 'LooseDNN')
163  configSeq.setOptionValue ('.isolationWP', 'Loose_VarRad')
164  configSeq.setOptionValue ('.writeTrackD0Z0', True)
165 
166  configSeq += config.makeConfig ('Electrons.IFFClassification',
167  containerName='AnaElectrons')
168  configSeq += config.makeConfig ('Electrons.MCTCClassification',
169  containerName='AnaElectrons')
170  configSeq.setOptionValue ('.prefix', 'truth_')
171 
172  configSeq += config.makeConfig ('Electrons.PtEtaSelection',
173  containerName='AnaElectrons')
174  configSeq.setOptionValue ('.minPt', electronMinPt)
175 
176 
177  # Include, and then set up the photon analysis algorithm sequence:
178  configSeq += config.makeConfig ('Photons',
179  containerName='AnaPhotons' )
180  configSeq.setOptionValue ('.decorateTruth', True)
181  configSeq.setOptionValue ('.forceFullSimConfig', forceEGammaFullSimConfig)
182  configSeq.setOptionValue ('.recomputeIsEM', False)
183  configSeq.setOptionValue ('.recalibratePhyslite', False)
184  configSeq += config.makeConfig ('Photons.WorkingPoint',
185  containerName='AnaPhotons',
186  selectionName='tight')
187  configSeq.setOptionValue ('.forceFullSimConfig', forceEGammaFullSimConfig)
188  configSeq.setOptionValue ('.qualityWP', 'Tight')
189  configSeq.setOptionValue ('.isolationWP', 'FixedCutTight')
190  configSeq.setOptionValue ('.recomputeIsEM', False)
191 
192  configSeq += config.makeConfig ('Photons.PtEtaSelection',
193  containerName='AnaPhotons')
194  configSeq.setOptionValue ('.minPt', photonMinPt)
195 
196 
197  # set up the muon analysis algorithm sequence:
198  configSeq += config.makeConfig ('Muons',
199  containerName='AnaMuons')
200  configSeq.setOptionValue ('.decorateTruth', True)
201  configSeq.setOptionValue ('.recalibratePhyslite', False)
202  configSeq += config.makeConfig ('Muons.WorkingPoint',
203  containerName='AnaMuons',
204  selectionName='medium')
205  configSeq.setOptionValue ('.quality', 'Medium')
206  configSeq.setOptionValue ('.isolation', 'Loose_VarRad')
207  configSeq.setOptionValue ('.writeTrackD0Z0', True)
208 
209  configSeq += config.makeConfig ('Muons.IFFClassification',
210  containerName='AnaMuons')
211  configSeq += config.makeConfig ('Muons.MCTCClassification',
212  containerName='AnaMuons')
213  configSeq.setOptionValue ('.prefix', 'truth_')
214 
215 
216  # TODO: MCP should restore this when the recommendations for Tight WP exist in R23
217  # configSeq += config.makeConfig ('Muons.Selection', 'AnaMuons.tight')
218  # configSeq.setOptionValue ('.quality', 'Tight')
219  # configSeq.setOptionValue ('.isolation', 'Loose_VarRad')
220 
221  # Include, and then set up the tau analysis algorithm sequence:
222  configSeq += config.makeConfig ('TauJets',
223  containerName='AnaTauJets')
224  configSeq.setOptionValue ('.decorateTruth', True)
225  configSeq += config.makeConfig ('TauJets.WorkingPoint',
226  containerName='AnaTauJets',
227  selectionName='tight')
228  configSeq.setOptionValue ('.quality', 'Tight')
229 
230  configSeq += config.makeConfig('TauJets.TriggerSF')
231  configSeq.setOptionValue('.containerName', 'AnaTauJets')
232  configSeq.setOptionValue('.tauID', 'Tight')
233  configSeq.setOptionValue('.triggerChainsPerYear', tauTriggerChainsSF)
234 
235  configSeq += config.makeConfig ('TauJets.MCTCClassification',
236  containerName='AnaTauJets')
237  configSeq.setOptionValue ('.prefix', 'truth_')
238 
239 
240  # Add systematic object links
241  configSeq += config.makeConfig('SystObjectLink', containerName='AnaJets')
242  if largeRJets:
243  configSeq += config.makeConfig('SystObjectLink', containerName='AnaLargeRJets')
244  configSeq += config.makeConfig('SystObjectLink', containerName='AnaElectrons')
245  configSeq += config.makeConfig('SystObjectLink', containerName='AnaPhotons')
246  configSeq += config.makeConfig('SystObjectLink', containerName='AnaMuons')
247  configSeq += config.makeConfig('SystObjectLink', containerName='AnaTauJets')
248 
249 
250  # Particle-level objects
251  configSeq += config.makeConfig ('PL_Electrons',
252  containerName='TruthElectrons')
253  configSeq += config.makeConfig ('PL_Electrons.MCTCClassification',
254  containerName='TruthElectrons')
255  configSeq.setOptionValue ('.prefix', '')
256  configSeq += config.makeConfig ('PL_Electrons.PtEtaSelection',
257  containerName='TruthElectrons')
258  configSeq.setOptionValue ('.skipOnData', True)
259  configSeq.setOptionValue ('.useDressedProperties', True)
260  configSeq.setOptionValue ('.minPt', 20e3)
261 
262  configSeq += config.makeConfig ('PL_Muons',
263  containerName='TruthMuons')
264  configSeq += config.makeConfig ('PL_Muons.MCTCClassification',
265  containerName='TruthMuons')
266  configSeq.setOptionValue ('.prefix', '')
267  configSeq += config.makeConfig ('PL_Muons.PtEtaSelection',
268  containerName='TruthMuons')
269  configSeq.setOptionValue ('.skipOnData', True)
270  configSeq.setOptionValue ('.useDressedProperties', True)
271  configSeq.setOptionValue ('.minPt', 20e3)
272 
273  configSeq += config.makeConfig ('PL_Neutrinos')
274  configSeq.setOptionValue ('.skipOnData', True)
275 
276  configSeq += config.makeConfig ('PL_Jets',
277  containerName='AntiKt4TruthDressedWZJets')
278  configSeq += config.makeConfig ('PL_Jets.PtEtaSelection',
279  containerName='AntiKt4TruthDressedWZJets')
280  configSeq.setOptionValue ('.skipOnData', True)
281  configSeq.setOptionValue ('.minPt', 20e3)
282 
283  configSeq += config.makeConfig ('PL_Taus',
284  containerName='TruthTaus')
285  configSeq += config.makeConfig ('PL_Taus.MCTCClassification',
286  containerName='TruthTaus')
287  configSeq.setOptionValue ('.prefix', '')
288  configSeq += config.makeConfig ('PL_Taus.PtEtaSelection',
289  containerName='TruthTaus')
290  configSeq.setOptionValue ('.skipOnData', True)
291  configSeq.setOptionValue ('.minPt', 20e3)
292 
293  configSeq += config.makeConfig ('PL_Photons',
294  containerName='TruthPhotons')
295  configSeq += config.makeConfig ('PL_Photons.PtEtaSelection',
296  containerName='TruthPhotons')
297  configSeq.setOptionValue ('.skipOnData', True)
298  configSeq.setOptionValue ('.minPt', 20e3)
299 
300  configSeq += config.makeConfig ('PL_MissingET')
301  configSeq.setOptionValue ('.skipOnData', True)
302 
303  configSeq += config.makeConfig ('PL_OverlapRemoval')
304  configSeq.setOptionValue ('.skipOnData', True)
305  configSeq.setOptionValue ('.electrons', 'TruthElectrons')
306  configSeq.setOptionValue ('.muons', 'TruthMuons')
307  configSeq.setOptionValue ('.photons', 'TruthPhotons')
308  configSeq.setOptionValue ('.jets', 'AntiKt4TruthDressedWZJets')
309  configSeq.setOptionValue ('.useRapidityForDeltaR', False)
310 
311 
312  if dataType is not DataType.Data :
313  # Include, and then set up the generator analysis sequence:
314  configSeq += config.makeConfig( 'GeneratorLevelAnalysis')
315 
316 
317  # Include, and then set up the met analysis algorithm config:
318  configSeq += config.makeConfig ('MissingET',
319  containerName='AnaMET')
320  configSeq.setOptionValue ('.jets', 'AnaJets')
321  configSeq.setOptionValue ('.taus', 'AnaTauJets.tight')
322  configSeq.setOptionValue ('.electrons', 'AnaElectrons.loose')
323  configSeq.setOptionValue ('.photons', 'AnaPhotons.tight')
324  # Note that the configuration for the muons is not what you'd
325  # normally do. This is specifically here because this is a unit
326  # test and I wanted to make sure that selection expressions work.
327  # For an actual analysis that would just be `AnaMuons.medium`, but
328  # since `tight` is a strict subset of `medium` it doesn't matter
329  # if we do an "or" of the two.
330  # TODO: MCP should restore this when the recommendations for Tight WP exist in R23
331  # configSeq.setOptionValue ('.muons', 'AnaMuons.medium||tight')
332  configSeq.setOptionValue ('.muons', 'AnaMuons.medium')
333 
334 
335  # Include, and then set up the overlap analysis algorithm config:
336  configSeq += config.makeConfig( 'OverlapRemoval' )
337  configSeq.setOptionValue ('.electrons', 'AnaElectrons.loose')
338  configSeq.setOptionValue ('.photons', 'AnaPhotons.tight')
339  # TODO: MCP should restore this when the recommendations for Tight WP exist in R23
340  # configSeq.setOptionValue ('.muons', 'AnaMuons.medium||tight')
341  configSeq.setOptionValue ('.muons', 'AnaMuons.medium')
342  configSeq.setOptionValue ('.jets', 'AnaJets.baselineJvt')
343  configSeq.setOptionValue ('.taus', 'AnaTauJets.tight')
344  configSeq.setOptionValue ('.inputLabel', 'preselectOR')
345  configSeq.setOptionValue ('.outputLabel', 'passesOR' )
346  configSeq.setOptionValue ('.nominalOnly', onlyNominalOR )
347 
348 
349  # ObjectCutFlow blocks
350  configSeq += config.makeConfig ('ObjectCutFlow',
351  containerName='AnaJets',
352  selectionName='jvt')
353  configSeq += config.makeConfig ('ObjectCutFlow',
354  containerName='AnaElectrons',
355  selectionName='loose')
356  configSeq += config.makeConfig ('ObjectCutFlow',
357  containerName='AnaPhotons',
358  selectionName='tight')
359  configSeq += config.makeConfig ('ObjectCutFlow',
360  containerName='AnaMuons',
361  selectionName='medium')
362  configSeq += config.makeConfig ('ObjectCutFlow',
363  containerName='AnaTauJets',
364  selectionName='tight')
365 
366 
367  # Include and set up a basic run of the event selection algorithm config:
368  if geometry is not LHCPeriod.Run4:
369  # configSeq += config.makeConfig( 'EventSelection', None )
370  # configSeq.setOptionValue ('.electrons', 'AnaElectrons.loose')
371  # configSeq.setOptionValue ('.muons', 'AnaMuons.medium')
372  # configSeq.setOptionValue ('.jets', 'AnaJets')
373  # configSeq.setOptionValue ('.met', 'AnaMET')
374  # configSeq.setOptionValue ('.selectionCutsDict', exampleSelectionCuts)
375  from EventSelectionAlgorithms.EventSelectionConfig import makeMultipleEventSelectionConfigs
376  makeMultipleEventSelectionConfigs(configSeq, electrons = 'AnaElectrons.loose', muons = 'AnaMuons.medium', jets = 'AnaJets.baselineJvt',
377  met = 'AnaMET', btagDecoration = 'ftag_select_ftag',
378  selectionCutsDict = exampleSelectionCuts, noFilter = True,
379  cutFlowHistograms = True)
380 
381  configSeq += config.makeConfig ('Bootstraps')
382  configSeq.setOptionValue ('.nReplicas', 2000 )
383  configSeq.setOptionValue ('.skipOnMC', False)
384 
385  # per-event lepton SF
386  configSeq += config.makeConfig ('LeptonSF')
387  if geometry is not LHCPeriod.Run2:
388  configSeq.setOptionValue ('.electrons', 'AnaElectrons.loose')
389  configSeq.setOptionValue ('.muons', 'AnaMuons.medium')
390  configSeq.setOptionValue ('.photons', 'AnaPhotons.tight')
391  configSeq.setOptionValue ('.lepton_postfix', 'nominal')
392 
393  # Thinning blocks
394  configSeq += config.makeConfig ('Thinning',
395  containerName='AnaElectrons')
396  configSeq.setOptionValue ('.selectionName', 'loose')
397  configSeq.setOptionValue ('.outputName', 'OutElectrons')
398  configSeq += config.makeConfig ('Thinning',
399  containerName='AnaPhotons')
400  configSeq.setOptionValue ('.selectionName', 'tight')
401  configSeq.setOptionValue ('.outputName', 'OutPhotons')
402  configSeq += config.makeConfig ('Thinning',
403  containerName='AnaMuons')
404  configSeq.setOptionValue ('.selectionName', 'medium')
405  configSeq.setOptionValue ('.outputName', 'OutMuons')
406  configSeq += config.makeConfig ('Thinning',
407  containerName='AnaTauJets')
408  configSeq.setOptionValue ('.selectionName', 'tight')
409  configSeq.setOptionValue ('.outputName', 'OutTauJets')
410  configSeq += config.makeConfig ('Thinning',
411  containerName='AnaJets')
412  configSeq.setOptionValue ('.outputName', 'OutJets')
413  if largeRJets :
414  configSeq += config.makeConfig ('Thinning',
415  containerName='AnaLargeRJets')
416  configSeq.setOptionValue ('.outputName', 'OutLargeRJets')
417  configSeq += config.makeConfig ('Thinning',
418  containerName='TruthElectrons')
419  configSeq.setOptionValue ('.skipOnData', True)
420  configSeq.setOptionValue ('.outputName', 'OutTruthElectrons')
421  configSeq += config.makeConfig ('Thinning',
422  containerName='TruthPhotons')
423  configSeq.setOptionValue ('.skipOnData', True)
424  configSeq.setOptionValue ('.outputName', 'OutTruthPhotons')
425  configSeq += config.makeConfig ('Thinning',
426  containerName='TruthMuons')
427  configSeq.setOptionValue ('.skipOnData', True)
428  configSeq.setOptionValue ('.outputName', 'OutTruthMuons')
429  configSeq += config.makeConfig ('Thinning',
430  containerName='TruthTaus')
431  configSeq.setOptionValue ('.skipOnData', True)
432  configSeq.setOptionValue ('.outputName', 'OutTruthTaus')
433  configSeq += config.makeConfig ('Thinning',
434  containerName='AntiKt4TruthDressedWZJets')
435  configSeq.setOptionValue ('.outputName', 'OutTruthJets')
436  configSeq.setOptionValue ('.skipOnData', True)
437 
438  configSeq += config.makeConfig ('Output')
439  configSeq.setOptionValue ('.treeName', 'analysis')
440  configSeq.setOptionValue ('.vars', [
441  'EventInfo.actualInteractionsPerCrossing -> actualMuScaled',
442  ])
443  configSeq.setOptionValue ('.metVars', [
444  'AnaMET_%SYS%.met -> met_%SYS%',
445  ])
446  configSeq.setOptionValue ('.truthMetVars', [
447  'TruthMET_NOSYS.met -> truth_met',
448  ])
449  configSeq.setOptionValue ('.containers', outputContainers)
450  configSeq.setOptionValue ('.containersOnlyForMC', outputContainersForMC)
451  configSeq.setOptionValue ('.commands', [
452  'disable actualInteractionsPerCrossing',
453  ])
454 
455  # return configSeq for unit test
456  if returnConfigSeq:
457  return configSeq
458 
459  configAccumulator = ConfigAccumulator (algSeq, dataType, isPhyslite, geometry, autoconfigFromFlags=autoconfigFromFlags, noSystematics=noSystematics)
460  configSeq.fullConfigure (configAccumulator)
461 
462  # order can change during fullConfigure
463  configSeq.printOptions()
464 
465  from AnaAlgorithm.DualUseConfig import isAthena, useComponentAccumulator
466  if isAthena and useComponentAccumulator:
467  return configAccumulator.CA
468  else:
469  return None
470 
471 
472 
473 def printSequenceAlgs (sequence) :
474  """print the algorithms in the sequence without the sequence structure
475 
476  This is mostly meant for easy comparison of different sequences
477  during configuration, particularly the sequences resulting from
478  the old sequence configuration and the new block configuration.
479  Those have different sequence structures in the output, but the
480  algorithms should essentially be configured the same way."""
481  if isinstance (sequence, AlgSequence) :
482  for alg in sequence :
483  printSequenceAlgs (alg)
484  else :
485  # assume this is an algorithm then
486  print (sequence)
487 
488 
489 def makeSequence (dataType, noSystematics,
490  yamlPath=None,
491  isPhyslite = False, geometry = None,
492  autoconfigFromFlags = None, onlyNominalOR = False,
493  forceEGammaFullSimConfig = False,
494  bleedingEdge = False) :
495 
496  algSeq = AlgSequence('AnalysisSequence')
497 
498  ca = None
499  if not yamlPath:
500  ca = makeTestSequenceBlocks (dataType, algSeq,
501  isPhyslite=isPhyslite,
502  geometry=geometry, onlyNominalOR=onlyNominalOR,
503  autoconfigFromFlags=autoconfigFromFlags,
504  noSystematics=noSystematics,
505  forceEGammaFullSimConfig=forceEGammaFullSimConfig,
506  bleedingEdge=bleedingEdge)
507  else:
508  from AnalysisAlgorithmsConfig.ConfigText import makeSequence as makeSequenceText
509  ca = makeSequenceText(yamlPath, dataType, algSeq, geometry=geometry,
510  isPhyslite=isPhyslite,
511  autoconfigFromFlags=autoconfigFromFlags,
512  noSystematics=noSystematics)
513 
514  if ca is not None:
515  return ca
516  else:
517  return algSeq
SystemOfUnits
python.FullCPAlgorithmsTest.makeSequence
def makeSequence(dataType, noSystematics, yamlPath=None, isPhyslite=False, geometry=None, autoconfigFromFlags=None, onlyNominalOR=False, forceEGammaFullSimConfig=False, bleedingEdge=False)
Definition: FullCPAlgorithmsTest.py:489
python.AlgSequence.AlgSequence
AlgSequence
Definition: PhysicsAnalysis/D3PDTools/AnaAlgorithm/python/AlgSequence.py:7
python.FullCPAlgorithmsTest.makeTestSequenceBlocks
def makeTestSequenceBlocks(dataType, algSeq, isPhyslite, geometry=None, autoconfigFromFlags=None, noSystematics=None, onlyNominalOR=False, forceEGammaFullSimConfig=False, returnConfigSeq=False, bleedingEdge=False)
Definition: FullCPAlgorithmsTest.py:52
python.EventSelectionConfig.makeMultipleEventSelectionConfigs
def makeMultipleEventSelectionConfigs(seq, electrons=None, muons=None, jets=None, largeRjets=None, photons=None, taus=None, met=None, metTerm=None, btagDecoration=None, preselection=None, selectionCutsDict=None, noFilter=None, debugMode=None, cutFlowHistograms=None)
Definition: EventSelectionConfig.py:911
python.FullCPAlgorithmsTest.printSequenceAlgs
def printSequenceAlgs(sequence)
Definition: FullCPAlgorithmsTest.py:473