From 9aa86f2103fe908d9ae647df5815cddfe8ebe27c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20K=C3=B6hler?= <nicolas.koehler@cern.ch>
Date: Tue, 5 Nov 2019 16:26:03 +0100
Subject: [PATCH] set doMuGirlLowBeta to False if doMuGirl is False

---
 .../MuonCombinedRecExample/python/MuonCombinedAlgs.py       | 6 ++++++
 .../MuonCombinedRecExample/python/MuonCombinedRecFlags.py   | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
index bc31b2aeecf2..6fe88564b03e 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
@@ -17,8 +17,10 @@ def MuonCombinedInDetExtensionAlg(name="MuonCombinedInDetExtensionAlg",**kwargs)
     tools = []
     if muonCombinedRecFlags.doMuGirl():
         tools.append(getPublicTool("MuGirlTagTool"))
+        kwargs.setdefault("TagMap", "muGirlTagMap" )
     if muonCombinedRecFlags.doCaloTrkMuId():
         tools.append(getPublicTool("MuonCaloTagTool"))
+        kwargs.setdefault("TagMap", "caloTagMap" )
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
     kwargs.setdefault("HasCSC", MuonGeometryFlags.hasCSC() )
     kwargs.setdefault("HasSTgc", (CommonGeometryFlags.Run() in ["RUN3", "RUN4"]) )
@@ -131,6 +133,10 @@ def recordMuonCreatorAlgObjs (kw):
 def MuonCreatorAlg( name="MuonCreatorAlg",**kwargs ):
     kwargs.setdefault("MuonCreatorTool",getPublicTool("MuonCreatorTool"))
     recordMuonCreatorAlgObjs (kwargs)
+    # if muGirl is off, remove "muGirlTagMap" from "TagMaps"
+    # but don't set this default in case the StauCreatorAlg is created (see below)
+    if not muonCombinedRecFlags.doMuGirl() and not name=="StauCreatorAlg":
+        kwargs.setdefault("TagMaps",["muidcoTagMap","stacoTagMap","caloTagMap","segmentTagMap"])
     return CfgMgr.MuonCreatorAlg(name,**kwargs)
 
 def StauCreatorAlg( name="StauCreatorAlg", **kwargs ):
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
index c2d44fcfb083..d607015e7914 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
@@ -192,7 +192,7 @@ class MuonCombinedRec(JobPropertyContainer):
             # Algorithms for CaloMuonCollection
             setDefault(self.doCaloTrkMuId,self.doAOD())
             # Algorithms for MuGirlLowBetaCollection
-            setDefault(self.doMuGirlLowBeta,(self.doAOD() and self.doMuGirl()))
+            setDefault(self.doMuGirlLowBeta,self.doAOD())
 
         #else: # collisions
             # Algorithms for CaloMuonCollection
@@ -212,6 +212,8 @@ class MuonCombinedRec(JobPropertyContainer):
         setDefault(self.TrackPerfDebugLevel,   muonRecFlags.TrackPerfDebugLevel())
         setDefault(self.TrackPerfSummaryLevel, muonRecFlags.TrackPerfSummaryLevel())
 
+        if not self.doMuGirl(): setDefault(self.doMuGirlLowBeta, False)
+
     def doAnyMuons(self):
         """Are we running any algorithm that produces Analysis::MuonContainer? Read-only."""
         return self.doMuonCollection() or self.doMuGirlLowBetaMuonCollection()
-- 
GitLab