diff --git a/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/FullCPAlgorithmsTest.py b/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/FullCPAlgorithmsTest.py
index 0745668d9fdf97886ce089649f7e86eda3d78592..1279497ee776fad16a2c873b90f79824f48d0827 100644
--- a/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/FullCPAlgorithmsTest.py
+++ b/PhysicsAnalysis/Algorithms/AnalysisAlgorithmsConfig/python/FullCPAlgorithmsTest.py
@@ -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:
diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisConfig.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisConfig.py
index 3e315940ff69ab0077fb65136a88eab8952243ce..668b2ae60e61dc1f261567c854eb0aa6621d1573 100644
--- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisConfig.py
+++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisConfig.py
@@ -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):
diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/EventCleaningConfig.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/EventCleaningConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..037e20bd7e5b308c63ecf6dc0cee3427066c4dff
--- /dev/null
+++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/EventCleaningConfig.py
@@ -0,0 +1,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)