From 85869bed8128c417e117595b61d49f16119b3091 Mon Sep 17 00:00:00 2001
From: Katherine Pachal <katepachal@gmail.com>
Date: Sat, 22 Sep 2018 06:28:55 +0000
Subject: [PATCH] Merge branch 'cherry-pick-20b605f70a [formerly
 46ef701e3d]-21.1-dev' into '21.1-dev'

Sweeping !14379 from 21.2 to 21.1-dev.
Added flag for HI b-tagging reconstruction, with default to off

See merge request atlas/athena!14423

Former-commit-id: f20f22330f2d94323820a77de956f26b81359cb0
---
 .../HIJetRec/python/HIJetRecFlags.py          |  8 ++
 .../HIJetRec/share/HIJetRec_jobOptions.py     | 86 ++++++++++---------
 2 files changed, 52 insertions(+), 42 deletions(-)

diff --git a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecFlags.py b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecFlags.py
index ea678cea410c..b210d9c17c87 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecFlags.py
+++ b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecFlags.py
@@ -126,6 +126,13 @@ class ExtraFlowMoments(JobProperty):
     allowedTypes = ['bool']
     StoredValue  = True
 
+class DoHIBTagging(JobProperty):
+    """ Perform b-tagging over HI jet collections
+    """
+    statusOn     = True
+    allowedTypes = ['bool']
+    StoredValue  = False
+
 
 class HIClusterKey(JobProperty):
     """ Key of CaloClusterContainer containing HI clusters
@@ -251,6 +258,7 @@ list_jobproperties = [UnsubtractedSuffix,
                       ModulationScheme,
                       Remodulate,
                       ExtraFlowMoments,
+                      DoHIBTagging,
                       HIClusterKey,
                       IteratedEventShapeKey,
                       TruthJetPtMin,
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/share/HIJetRec_jobOptions.py b/Reconstruction/HeavyIonRec/HIJetRec/share/HIJetRec_jobOptions.py
index 1f9ed0c737ab..37dad07c2dd6 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/share/HIJetRec_jobOptions.py
+++ b/Reconstruction/HeavyIonRec/HIJetRec/share/HIJetRec_jobOptions.py
@@ -111,45 +111,47 @@ JetAlgFromTools(jtm.HIJetRecs,suffix="HI",persistify=True)
 # code cloned from BTagging_jobOptions.py
 # to allow b-tagging over HI jets
 
-if not BTaggingFlags.DoNotSetupBTagging: # Temporary measure so the JetRec people can test setting this all up from their side.
-  #
-  # ========== Load and configure everything
-  #
-
-  from BTagging.BTaggingConfiguration import getConfiguration
-  ConfInstance = getConfiguration()
-
-  if ConfInstance.checkFlagsUsingBTaggingFlags():
-
-    #Jet collections
-    JetCollectionList = ['AntiKt4HIJets']
-    from JetRec.JetRecFlags import jetFlags
-
-    BTaggingFlags.Jets = [ name[:-4] for name in JetCollectionList]
-
-    #BTagging list
-    btag = ConfInstance.getOutputFilesPrefix() #BTaggingFlags.OutputFilesBTag #"BTagging_"
-
-    #TODO define name author (now BTagging_AntiKt4LCTopo)
-    AuthorSubString = [ btag+name[:-4] for name in JetCollectionList]
-
-    NotInJetToolManager = [] # For jet collections
-    from JetRec.JetRecStandard import jtm
-    for i, jet in enumerate(JetCollectionList):
-        try:
-          btagger = ConfInstance.setupJetBTaggerTool(ToolSvc, jet) #The [:-4] is not needed here; this function automatically removes trailing 'jets' or 'Jets'.
-          if btagger is None:
-            continue
-          jet = jet.replace("Track", "PV0Track")
-          jetname = getattr(jtm, jet)
-          jetname.unlock()
-          jetname.JetModifiers += [ btagger ]
-          jetname.lock()
-          if BTaggingFlags.OutputLevel < 3:
-            print ConfInstance.getJetCollectionTool(jet[:-4])
-        except AttributeError as error:
-          print '#BTAG# --> ' + str(error)
-          NotInJetToolManager.append(AuthorSubString[i])
-
-    if len(NotInJetToolManager) > 0:
-        AuthorSubString = list(set(AuthorSubString) - set(NotInJetToolManager))
+if HIJetFlags.DoHIBTagging():
+
+  if not BTaggingFlags.DoNotSetupBTagging: # Temporary measure so the JetRec people can test setting this all up from their side.
+    #
+    # ========== Load and configure everything
+    #
+
+    from BTagging.BTaggingConfiguration import getConfiguration
+    ConfInstance = getConfiguration()
+
+    if ConfInstance.checkFlagsUsingBTaggingFlags():
+
+      #Jet collections
+      JetCollectionList = ['AntiKt4HIJets']
+      from JetRec.JetRecFlags import jetFlags
+
+      BTaggingFlags.Jets = [ name[:-4] for name in JetCollectionList]
+
+      #BTagging list
+      btag = ConfInstance.getOutputFilesPrefix() #BTaggingFlags.OutputFilesBTag #"BTagging_"
+
+      #TODO define name author (now BTagging_AntiKt4LCTopo)
+      AuthorSubString = [ btag+name[:-4] for name in JetCollectionList]
+
+      NotInJetToolManager = [] # For jet collections
+      from JetRec.JetRecStandard import jtm
+      for i, jet in enumerate(JetCollectionList):
+          try:
+            btagger = ConfInstance.setupJetBTaggerTool(ToolSvc, jet) #The [:-4] is not needed here; this function automatically removes trailing 'jets' or 'Jets'.
+            if btagger is None:
+              continue
+            jet = jet.replace("Track", "PV0Track")
+            jetname = getattr(jtm, jet)
+            jetname.unlock()
+            jetname.JetModifiers += [ btagger ]
+            jetname.lock()
+            if BTaggingFlags.OutputLevel < 3:
+              print ConfInstance.getJetCollectionTool(jet[:-4])
+          except AttributeError as error:
+            print '#BTAG# --> ' + str(error)
+            NotInJetToolManager.append(AuthorSubString[i])
+
+      if len(NotInJetToolManager) > 0:
+          AuthorSubString = list(set(AuthorSubString) - set(NotInJetToolManager))
-- 
GitLab