Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
# AnaAlgorithm import(s):
from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
class EventCleaningBlock (ConfigBlock):
"""the ConfigBlock for event cleaning"""
def __init__ (self) :
super (EventCleaningBlock, self).__init__ ()
self.runPrimaryVertexSelection = True
self.runEventCleaning = False
self.userGRLFiles = []
def makeAlgs (self, config) :
if config.dataType() == 'data' :
grlFiles = self.userGRLFiles[:]
# Set up the GRL selection:
alg = config.createAlgorithm( 'GRLSelectorAlg', 'GRLSelectorAlg' )
config.addPrivateTool( 'Tool', 'GoodRunsListSelectionTool' )
alg.Tool.GoodRunsListVec = grlFiles
# Skip events with no primary vertex:
if self.runPrimaryVertexSelection:
alg = config.createAlgorithm( 'CP::VertexSelectionAlg',
'PrimaryVertexSelectorAlg' )
alg.VertexContainer = 'PrimaryVertices'
alg.MinVertices = 1
# Set up the event cleaning selection:
if self.runEventCleaning:
alg = config.createAlgorithm( 'CP::EventFlagSelectionAlg', 'EventFlagSelectorAlg' )
alg.FilterKey = 'JetCleaning'
alg.FilterDescription = 'selecting events passing DFCommonJets_eventClean_LooseBad'
alg.selectionFlags = ['DFCommonJets_eventClean_LooseBad,as_char']
def makeEventCleaningConfig( seq,
runPrimaryVertexSelection = True,
runEventCleaning = False,
userGRLFiles = []):
"""Create a basic event cleaning analysis algorithm sequence
Keyword arguments:
runPrimaryVertexSelection -- whether to run primary vertex selection
runEventCleaning -- wether to run event cleaning
userGRLFiles -- a list of GRL files to select data from
"""
config = EventCleaningBlock ()
config.runPrimaryVertexSelection = runPrimaryVertexSelection
config.runEventCleaning = runEventCleaning
config.userGRLFiles = userGRLFiles
seq.append (config)