From 53bddf707eaf2ee190ceaee8c96e5ce2f8ed5a9c Mon Sep 17 00:00:00 2001
From: Jochen Meyer <Jochen.Meyer@cern.ch>
Date: Tue, 10 Nov 2015 15:54:50 +0100
Subject: [PATCH] turning off MuGrilStauAlg
 (MuonCombinedRecExample-01-09-06-01)

	* turning off MuGrilStau
	* tagging MuonCombinedRecExample-01-09-06-01

2015-11-04 Jochen Meyer
	* switching to old MuGirl
	* tagging MuonCombinedRecExample-01-09-06-00

2015-11-04 Edward.Moyse@cern.ch
	* dump of config in MuonCombinedRec_myTopOptions.py
	* removing some verbose prints
	* tagging MuonCombinedRecExample-01-09-06

2015-10-13 Niels van Eldik
	* python/MuonCombinedRecExampleConfigDb.py: add new Stau tools
	* python/MuGirlTagTool.py: add new Stau tools
	* tagging MuonCombinedRecExample-01-09-05

2015-09-29 Edward.Moyse@cern.ch
	* Trying to enable silicon associated forward muons (ATLASRECTS-2001)
	* Created new flag: doSiAssocForwardMuons
...
(Long ChangeLog diff - truncated)
---
 .../python/MuGirlTagTool.py                   | 56 +++++++++++++++++++
 .../python/MuonCombinedAlgs.py                | 18 +++++-
 .../python/MuonCombinedRecExampleConfigDb.py  | 15 +++++
 .../python/MuonCombinedRecFlags.py            |  9 +++
 .../python/MuonCombinedTools.py               |  7 ++-
 .../share/MuonCombinedRec_myTopOptions.py     |  5 ++
 6 files changed, 106 insertions(+), 4 deletions(-)

diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuGirlTagTool.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuGirlTagTool.py
index 9f9b34d75090..62e0b6fb2705 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuGirlTagTool.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuGirlTagTool.py
@@ -4,7 +4,15 @@
 
 from AthenaCommon import CfgMgr
 from AthenaCommon.CfgGetter import getPublicTool,getService
+
+from RecExConfig.RecFlags import rec
+
 from MuGirl.MuGirlRecoConfig import MuGirlRecoConfig
+from MuonCombinedRecExample.MuonCombinedFitTools import CombinedMuonTrackBuilder,CombinedMuonTrackBuilderFit,MuidSegmentRegionRecoveryTool
+from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
+
+from MuonRecExample.MooreTools import MuonSeededSegmentFinder, MuonChamberHoleRecoveryTool
+from MuonRecExample.MuonRecTools import DCMathSegmentMaker
 
 ###logfile
 from AthenaCommon.Logging import log
@@ -42,6 +50,54 @@ def MuonLayerAmbiguitySolverTool( name="MuonLayerAmbiguitySolverTool",**kwargs):
 def MuonRecoValidationTool( name="MuonRecoValidationTool",**kwargs):
    return CfgMgr.Muon__MuonRecoValidationTool(name,**kwargs)
 
+def DCMathStauSegmentMaker( name="DCMathStauSegmentMaker", **kwargs ):
+   kwargs.setdefault("MdtCreator", getPublicTool("MdtDriftCircleOnTrackCreatorStau") )   
+   return DCMathSegmentMaker(name,**kwargs)
+
+def MuonStauChamberHoleRecoveryTool(name="MuonStauChamberHoleRecoveryTool",**kwargs):
+   kwargs.setdefault("MdtRotCreator", getPublicTool("MdtDriftCircleOnTrackCreatorStau") )
+   return MuonChamberHoleRecoveryTool(name,**kwargs)
+
+def MuonStauSeededSegmentFinder( name="MuonStauSeededSegmentFinder", **kwargs ):
+    kwargs.setdefault("MdtRotCreator", getPublicTool("MdtDriftCircleOnTrackCreatorStau") )
+    kwargs.setdefault("SegmentMaker", getPublicTool("DCMathStauSegmentMaker") )
+    kwargs.setdefault("SegmentMakerNoHoles", getPublicTool("DCMathStauSegmentMaker") )
+    return MuonSeededSegmentFinder(name,**kwargs)
+
+def MuonStauSegmentRegionRecoveryTool(name="MuonStauSegmentRegionRecoveryTool",**kwargs ):
+   kwargs.setdefault("SeededSegmentFinder", getPublicTool("MuonStauSeededSegmentFinder") )
+   kwargs.setdefault("ChamberHoleRecoveryTool", getPublicTool("MuonStauChamberHoleRecoveryTool") )
+   kwargs.setdefault("Fitter",  getPublicTool("CombinedStauTrackBuilderFit") )
+   return MuidSegmentRegionRecoveryTool(name,**kwargs)
+
+def CombinedStauTrackBuilderFit( name='CombinedStauTrackBuilderFit', **kwargs ):
+   kwargs.setdefault("MdtRotCreator"                 , getPublicTool("MdtDriftCircleOnTrackCreatorStau") )
+   return CombinedMuonTrackBuilderFit(name,**kwargs )
+
+def CombinedStauTrackBuilder( name='CombinedStauTrackBuilder', **kwargs ):
+   kwargs.setdefault("MdtRotCreator"                 , getPublicTool("MdtDriftCircleOnTrackCreatorStau") )
+   kwargs.setdefault("MuonHoleRecovery"              , getPublicTool("MuonStauSegmentRegionRecoveryTool") )
+   return CombinedMuonTrackBuilder(name,**kwargs )
+
+def MuonStauCandidateTrackBuilderTool( name="MuonStauCandidateTrackBuilderTool",**kwargs):
+
+   kwargs.setdefault("MuonTrackBuilder",  getPublicTool("CombinedStauTrackBuilder") )
+   return CfgMgr.Muon__MuonCandidateTrackBuilderTool(name,**kwargs)
+
+def MuonStauInsideOutRecoTool( name="MuonStauInsideOutRecoTool", **kwargs ):
+
+   kwargs.setdefault("MuonCandidateTrackBuilderTool", getPublicTool("MuonStauCandidateTrackBuilderTool") )
+   return CfgMgr.MuonCombined__MuonInsideOutRecoTool(name,**kwargs )
+
+def MuonStauRecoTool( name="MuonStauRecoTool", **kwargs ):
+   kwargs.setdefault("ConsideredPDGs", [13,-13,1000015,-1000015])
+   kwargs.setdefault("DoTruth", rec.doTruth() )
+   kwargs.setdefault("DoSummary", muonCombinedRecFlags.printSummary() )
+   kwargs.setdefault("MuonSegmentMaker", getPublicTool("DCMathStauSegmentMaker") )
+   kwargs.setdefault("MuonInsideOutRecoTool", getPublicTool("MuonStauInsideOutRecoTool") )
+   return CfgMgr.MuonCombined__MuonStauRecoTool(name,**kwargs )
+
+
         #ToolSvc +=  CfgMgr.Muon__MuonSystemExtensionTool("MuonSystemExtensionTool",OutputLevel=VERBOSE)
         #ToolSvc +=  CfgMgr.Muon__MuonPrepRawDataCollectionProviderTool("MuonPrepRawDataCollectionProviderTool",OutputLevel=VERBOSE)
         #ToolSvc +=  CfgMgr.Muon__MuonLayerHashProviderTool("MuonLayerHashProviderTool",OutputLevel=VERBOSE)
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
index 524848dea729..6ff23fa119a1 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
@@ -1,11 +1,12 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
 from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
-from AthenaCommon.CfgGetter import getPublicTool, getAlgorithm
+from AthenaCommon.CfgGetter import getPublicTool, getAlgorithm,getPublicToolClone
 from MuonRecExample.ConfiguredMuonRec import ConfiguredMuonRec
 from AthenaCommon.AlgSequence import AlgSequence
 from AthenaCommon import CfgMgr
 
+
 def MuonCombinedInDetExtensionAlg(name="MuonCombinedInDetExtensionAlg",**kwargs):
     tools = []
     if muonCombinedRecFlags.doMuGirl():
@@ -20,6 +21,7 @@ def MuGirlAlg(name="MuGirlAlg",**kwargs):
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
     return CfgMgr.MuonCombinedInDetExtensionAlg(name,**kwargs)
 
+
 def MuonCaloTagAlg(name="MuonCaloTagAlg",**kwargs):
     tools = [getPublicTool("MuonCaloTagTool")]
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
@@ -34,8 +36,16 @@ def MuonInsideOutRecoAlg( name="MuonInsideOutRecoAlg", **kwargs ):
     kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
     return CfgMgr.MuonCombinedInDetExtensionAlg(name,**kwargs)
 
+def MuGirlStauAlg(name="MuGirlStauAlg",**kwargs):
+    tools = [getPublicTool("MuonStauRecoTool")]
+    kwargs.setdefault("MuonCombinedInDetExtensionTools", tools )
+    return CfgMgr.MuonCombinedInDetExtensionAlg(name,**kwargs)
+
 def MuonCombinedInDetCandidateAlg( name="MuonCombinedInDetCandidateAlg",**kwargs ):
     kwargs.setdefault("InDetCandidateTool",getPublicTool("InDetCandidateTool") )
+    if muonCombinedRecFlags.doSiAssocForwardMuons():
+        kwargs.setdefault("DoSiliconAssocForwardMuons", True )
+        kwargs.setdefault("InDetForwardCandidateTool", getPublicTool("MuonInDetForwardCandidateTool") )
     return CfgMgr.MuonCombinedInDetCandidateAlg(name,**kwargs)
     
 def MuonCombinedMuonCandidateAlg( name="MuonCombinedMuonCandidateAlg", **kwargs ):
@@ -80,8 +90,10 @@ class MuonCombinedReconstruction(ConfiguredMuonRec):
             topSequence += getAlgorithm("MuonCombinedAlg") 
 
         if muonCombinedRecFlags.doMuGirl():
-            topSequence += getAlgorithm("MuonInsideOutRecoAlg") 
-            #topSequence += getAlgorithm("MuGirlAlg") 
+            #topSequence += getAlgorithm("MuonInsideOutRecoAlg") 
+            topSequence += getAlgorithm("MuGirlAlg") 
+            #if muonCombinedRecFlags.doMuGirlLowBeta():
+            #    topSequence += getAlgorithm("MuGirlStauAlg")
 
         if muonCombinedRecFlags.doCaloTrkMuId():
             topSequence += getAlgorithm("MuonCaloTagAlg") 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecExampleConfigDb.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecExampleConfigDb.py
index 6beb25bd4f2c..75800824a6d8 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecExampleConfigDb.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecExampleConfigDb.py
@@ -22,6 +22,18 @@ addTool("MuonCombinedRecExample.MuGirlTagTool.MuonLayerSegmentMatchingTool","Muo
 addTool("MuonCombinedRecExample.MuGirlTagTool.MuonLayerAmbiguitySolverTool","MuonLayerAmbiguitySolverTool")
 addTool("MuonCombinedRecExample.MuGirlTagTool.MuonRecoValidationTool","MuonRecoValidationTool")
 
+addTool("MuonCombinedRecExample.MuGirlTagTool.DCMathStauSegmentMaker","DCMathStauSegmentMaker")
+addTool("MuonCombinedRecExample.MuGirlTagTool.MuonStauChamberHoleRecoveryTool","MuonStauChamberHoleRecoveryTool")
+addTool("MuonCombinedRecExample.MuGirlTagTool.MuonStauSeededSegmentFinder","MuonStauSeededSegmentFinder")
+addTool("MuonCombinedRecExample.MuGirlTagTool.MuonStauSegmentRegionRecoveryTool","MuonStauSegmentRegionRecoveryTool")
+addTool("MuonCombinedRecExample.MuGirlTagTool.CombinedStauTrackBuilderFit",'CombinedStauTrackBuilderFit')
+addTool("MuonCombinedRecExample.MuGirlTagTool.CombinedStauTrackBuilder",'CombinedStauTrackBuilder')
+addTool("MuonCombinedRecExample.MuGirlTagTool.MuonStauCandidateTrackBuilderTool","MuonStauCandidateTrackBuilderTool")
+addTool("MuonCombinedRecExample.MuGirlTagTool.MuonStauInsideOutRecoTool","MuonStauInsideOutRecoTool")
+addTool("MuonCombinedRecExample.MuGirlTagTool.MuonStauRecoTool","MuonStauRecoTool")
+
+
+
 addTool("MuonCombined::MuonCombinedStacoTagTool","MuonCombinedStacoTagTool")
 addTool("MuonCombinedRecExample.MuonCombinedTools.MuonCombinedFitTagTool","MuonCombinedFitTagTool")
 addTool("Trk::TrackParticleCreatorTool","TrackParticleCreatorTool")
@@ -32,6 +44,7 @@ addTool("Rec::MuonScatteringAngleSignificanceTool","MuonScatteringAngleSignifica
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuGirlAlg","MuGirlAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCaloTagAlg","MuonCaloTagAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonInsideOutRecoAlg","MuonInsideOutRecoAlg")
+addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuGirlStauAlg","MuGirlStauAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedInDetCandidateAlg","MuonCombinedInDetCandidateAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedMuonCandidateAlg","MuonCombinedMuonCandidateAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedAlg","MuonCombinedAlg")
@@ -49,6 +62,8 @@ addTool("MuonCombinedRecExample.MuonSegmentTaggerTools.MuTagAmbiguitySolverTool"
 addTool("MuonCombinedRecExample.MuonSegmentTaggerTools.MuonSegmentTagTool","MuonSegmentTagTool")
 
 addTool("MuonCombinedRecExample.MuonCombinedTools.MuonCombinedInDetDetailedTrackSelectorTool","MuonCombinedInDetDetailedTrackSelectorTool")
+addTool("MuonCombinedRecExample.MuonCombinedTools.MuonCombinedInDetDetailedTrackSelectorTool","MuonCombinedInDetDetailedForwardTrackSelectorTool", nHitSct=0)
+addTool("MuonCombinedRecExample.MuonCombinedTools.MuonInDetForwardCandidateTool","MuonInDetForwardCandidateTool")
 addTool("MuonCombinedRecExample.MuonCombinedTools.MuonCombinedParticleCreator","MuonCombinedParticleCreator")
 addTool("MuonCombinedRecExample.MuonCombinedTools.MuonCaloParticleCreator","MuonCaloParticleCreator")
 addTool("MuonCombinedRecExample.MuonCombinedTools.MuonCreatorTool","MuonCreatorTool")
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
index 3653d333051d..1662c39349c2 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
@@ -61,6 +61,14 @@ class doMuonSegmentTagger(JobProperty):
     allowedTypes=['bool']
     StoredValue=True
 
+#
+# 'silicon-associated'muons, or muons which rely on special ID reconstruction because they're outside the usual acceptance.
+#
+class doSiAssocForwardMuons(JobProperty):
+    statusOn=True
+    allowedTypes=['bool']
+    StoredValue=True
+
 #
 # Switch on/off algorithms that make Muons for the CaloMuonCollection
 #
@@ -275,6 +283,7 @@ class Enabled(SummaryJobProperty):
                     muonCombinedRecFlags.doAOD,
                     muonCombinedRecFlags.doxAOD,
                     muonCombinedRecFlags.doTrackPerformance,
+                    muonCombinedRecFlags.doSiAssocForwardMuons,
                     ]
 
 muonCombinedRecFlags.add_JobProperty(Enabled)
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedTools.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedTools.py
index 48233a4b9693..2453adbbf8a9 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedTools.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedTools.py
@@ -45,8 +45,13 @@ def MuonCombinedInDetDetailedTrackSelectorTool( name='MuonCombinedInDetDetailedT
         kwargs.setdefault("useTrackQualityInfo", False )
     kwargs.setdefault("TrackSummaryTool", getPublicTool("AtlasTrackSummaryTool") )
     kwargs.setdefault("Extrapolator", getPublicTool("AtlasExtrapolator") )
-    return CfgMgr.InDet__InDetDetailedTrackSelectorTool(name,**kwargs)
+    return CfgMgr.InDet__InDetDetailedTrackSelectorTool(name,**kwargs) 
 
+def MuonInDetForwardCandidateTool( name = 'MuonInDetForwardCandidateTool', **kwargs):
+   #import pdb ; pdb.set_trace()
+   idCandTool = getPublicToolClone("InDetForwardCandidateTool","InDetCandidateTool", TrackSelector = getPublicTool("MuonCombinedInDetDetailedForwardTrackSelectorTool"))
+   idCandTool.TrackSelector = getPublicTool("MuonCombinedInDetDetailedForwardTrackSelectorTool")
+   return idCandTool
 
 def MuonCombinedParticleCreator(name="MuonCombinedParticleCreator",**kwargs):
     import MuonCombinedRecExample.CombinedMuonTrackSummary
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_myTopOptions.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_myTopOptions.py
index cec23d5a4efc..28a7de4cf01f 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_myTopOptions.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_myTopOptions.py
@@ -221,3 +221,8 @@ try:
 except:
     print 'got an exception' 
     pass
+
+from AthenaCommon.ConfigurationShelve import saveToAscii
+saveToAscii("config.txt")
+from MuonRecExample.MuonRecUtils import dumpDetFlags
+dumpDetFlags("config.txt")
-- 
GitLab