ATLAS Offline Software
Public Member Functions | List of all members
python.EventCleaningConfig.EventCleaningBlock Class Reference
Inheritance diagram for python.EventCleaningConfig.EventCleaningBlock:
Collaboration diagram for python.EventCleaningConfig.EventCleaningBlock:

Public Member Functions

def __init__ (self)
 
def getDefaultGRLs (self, data_year)
 
def makeAlgs (self, config)
 

Detailed Description

the ConfigBlock for event cleaning

Definition at line 8 of file EventCleaningConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.EventCleaningConfig.EventCleaningBlock.__init__ (   self)

Definition at line 11 of file EventCleaningConfig.py.

11  def __init__ (self) :
12  super (EventCleaningBlock, self).__init__ ()
13  self.addOption ('runPrimaryVertexSelection', True, type=bool,
14  info="whether to run primary vertex selection. The default is True.")
15  self.addOption ('runEventCleaning', False, type=bool,
16  info="whether to run event cleaning (sets up an instance of "
17  "CP::EventFlagSelectionAlg). The default is False.")
18  self.addOption ('runGRL', True, type=bool,
19  info="whether to run GRL decoration/selection. The default is True.")
20  self.addOption ('userGRLFiles', [], type=None,
21  info="a list of GRL files (list of strings) to select data from. "
22  "The default is [] (empty list).")
23  self.addOption ('minTracksPerVertex', 2, type=int,
24  info="minimum number (integer) of tracks per vertex. The default is 2.")
25  self.addOption ('selectionFlags', ['DFCommonJets_eventClean_LooseBad'], type=None,
26  info="lags (list of strings) to use for jet cleaning. The default is "
27  "['DFCommonJets_eventClean_LooseBad'].")
28  # This is a vector<bool>, so parsing True/False is not handled
29  # in AnalysisBase, but we can evade this with numerical values
30  self.addOption ('invertFlags', [0], type=None,
31  info="list of booleans determining whether to invert the cut of the "
32  "above selectionFlags. The default is [0].")
33  self.addOption ('GRLDict', {}, type=None)
34  self.addOption ('noFilter', False, type=bool,
35  info="do apply event decoration, but do not filter. The default is False, i.e. 'We decorate events but do not filter' ")
36 
37  if self.runGRL and self.userGRLFiles:
38  raise ValueError("No userGRLFiles should be specified if runGRL=False")
39 

Member Function Documentation

◆ getDefaultGRLs()

def python.EventCleaningConfig.EventCleaningBlock.getDefaultGRLs (   self,
  data_year 
)
returns a reasonable set of GRLs that should be suited for most analyses 

Definition at line 40 of file EventCleaningConfig.py.

40  def getDefaultGRLs (self, data_year) :
41  """ returns a reasonable set of GRLs that should be suited for most analyses """
42 
43  if data_year == 2015:
44  return ['GoodRunsLists/data15_13TeV/20170619/data15_13TeV.periodAllYear_DetStatus-v89-pro21-02_Unknown_PHYS_StandardGRL_All_Good_25ns.xml']
45  elif data_year == 2016:
46  return ['GoodRunsLists/data16_13TeV/20180129/data16_13TeV.periodAllYear_DetStatus-v89-pro21-01_DQDefects-00-02-04_PHYS_StandardGRL_All_Good_25ns.xml']
47  elif data_year == 2017:
48  return ['GoodRunsLists/data17_13TeV/20180619/data17_13TeV.periodAllYear_DetStatus-v99-pro22-01_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml']
49  elif data_year == 2018:
50  return ['GoodRunsLists/data18_13TeV/20190318/data18_13TeV.periodAllYear_DetStatus-v102-pro22-04_Unknown_PHYS_StandardGRL_All_Good_25ns_Triggerno17e33prim.xml']
51  elif data_year == 2022:
52  return ['GoodRunsLists/data22_13p6TeV/20230207/data22_13p6TeV.periodAllYear_DetStatus-v109-pro28-04_MERGED_PHYS_StandardGRL_All_Good_25ns.xml']
53  elif data_year == 2023:
54  return ['GoodRunsLists/data23_13p6TeV/20230712/data23_13p6TeV.periodAllYear_DetStatus-v110-pro31-05_MERGED_PHYS_StandardGRL_All_Good_25ns.xml']
55  else:
56  raise ValueError (f"Data year {data_year} is not recognised for automatic GRL retrieval!")
57 

◆ makeAlgs()

def python.EventCleaningConfig.EventCleaningBlock.makeAlgs (   self,
  config 
)

Definition at line 58 of file EventCleaningConfig.py.

58  def makeAlgs (self, config) :
59 
60  # Apply GRL
61  if self.runGRL and config.dataType() is DataType.Data:
62  if self.noFilter:
63  # here we only decorate the PHYSLITE events with a boolean and don't do any cleaning
64  # Set up the GRL Decoration
65  for GRLDecoratorName,GRLFile in (self.GRLDict).items():
66  alg = config.createAlgorithm( 'GRLSelectorAlg', GRLDecoratorName )
67  config.addPrivateTool( 'Tool', 'GoodRunsListSelectionTool' )
68  alg.Tool.GoodRunsListVec = GRLFile
69  alg.noFilter = True
70  alg.grlKey = "EventInfo." + GRLDecoratorName
71  # Using WriteDecorHandle thus no need for addOutputVar
72  else:
73  # Set up the GRL selection:
74  alg = config.createAlgorithm( 'GRLSelectorAlg', 'GRLSelectorAlg' )
75  config.addPrivateTool( 'Tool', 'GoodRunsListSelectionTool' )
76  if self.userGRLFiles:
77  alg.Tool.GoodRunsListVec = self.userGRLFiles
78  else:
79  alg.Tool.GoodRunsListVec = self.getDefaultGRLs( config.dataYear() )
80 
81  # Skip events with no primary vertex:
82  if self.runPrimaryVertexSelection:
83  alg = config.createAlgorithm( 'CP::VertexSelectionAlg',
84  'PrimaryVertexSelectorAlg' )
85  alg.VertexContainer = 'PrimaryVertices'
86  alg.MinVertices = 1
87  alg.MinTracks = self.minTracksPerVertex
88 
89  # Set up the event cleaning selection:
90  if self.runEventCleaning:
91  if config.dataType() is DataType.Data:
92  alg = config.createAlgorithm( 'CP::EventStatusSelectionAlg', 'EventStatusSelectionAlg' )
93  alg.FilterKey = 'EventErrorState'
94  alg.FilterDescription = 'selecting events without any error state set'
95 
96  alg = config.createAlgorithm( 'CP::EventFlagSelectionAlg', 'EventFlagSelectionAlg' )
97  alg.FilterKey = 'JetCleaning'
98  alg.selectionFlags = [f'{sel},as_char' for sel in self.selectionFlags]
99  alg.invertFlags = self.invertFlags
100  alg.FilterDescription = f"selecting events passing: {','.join(alg.selectionFlags)}"
101 
102 
103 
104 

The documentation for this class was generated from the following file:
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18