Skip to content
Snippets Groups Projects
Commit 122bbb9d authored by Nils Krumnack's avatar Nils Krumnack
Browse files

make a configuration block for event cleaning

This is an adoption of the event selection sequence that pre-existed
and replaces the vertex selection configuration block.
parent 790ba9ad
No related branches found
No related tags found
No related merge requests found
......@@ -472,9 +472,9 @@ def makeSequenceBlocks (dataType, algSeq, vars, forCompare, isPhyslite, noPhysli
# it produces strange errors in CutFlowSvc in Athena
if not forCompare or dataType == 'data' :
# Skip events with no primary vertex:
from AsgAnalysisAlgorithms.AsgAnalysisConfig import \
makePrimaryVertexConfig
makePrimaryVertexConfig (configSeq)
from AsgAnalysisAlgorithms.EventCleaningConfig import \
makeEventCleaningConfig
makeEventCleaningConfig (configSeq)
# Include, and then set up the electron analysis algorithm sequence:
......
......@@ -104,22 +104,6 @@ class GeneratorAnalysisBlock (ConfigBlock):
class PrimaryVertexBlock (ConfigBlock):
"""the ConfigBlock for requiring primary vertices"""
def __init__ (self) :
super (PrimaryVertexBlock, self).__init__ ()
def makeAlgs (self, config) :
config.createAlgorithm( 'CP::VertexSelectionAlg',
'PrimaryVertexSelectorAlg' )
config.VertexContainer = 'PrimaryVertices'
config.MinVertices = 1
class PtEtaSelectionBlock (ConfigBlock):
"""the ConfigBlock for a pt-eta selection"""
......@@ -236,15 +220,6 @@ def makeGeneratorAnalysisConfig( seq,
def makePrimaryVertexConfig( seq ) :
"""Create config block that requires a primary vertex
"""
config = PrimaryVertexBlock ()
seq.append (config)
def makePtEtaSelectionConfig( seq, containerName,
*, postfix = '', minPt = None, maxEta = None,
selectionDecoration):
......
# 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment