From 9a8325c78f655ac57ec62e6f96dc3aeb0bc7233b Mon Sep 17 00:00:00 2001
From: Johannes Josef Junggeburth <johannes.josef.junggeburth@CERN.CH>
Date: Sat, 5 Sep 2020 18:50:20 +0200
Subject: [PATCH] Write container output for muons

---
 .../python/MuonCombinedAlgs.py                |  1 -
 .../python/MuonCombinedKeys.py                | 30 +++++++++++++++----
 .../python/MuonCombinedRecExampleConfigDb.py  | 12 ++++----
 .../python/MuonCombinedRecFlags.py            |  6 +++-
 .../share/MuonCombined_OutputItemsAOD.py      | 10 +++++--
 5 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
index 6bdc3df69e0a..90b3b8033ba0 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
@@ -75,7 +75,6 @@ def MuonCombinedInDetCandidateAlg( name="MuonCombinedInDetCandidateAlg",**kwargs
         kwargs.setdefault("InDetForwardTrackSelector", getPublicTool("MuonCombinedInDetDetailedForwardTrackSelectorTool") )
 
     kwargs.setdefault("MuonSystemExtensionTool", getPublicTool("MuonSystemExtensionTool"))
-    print (kwargs)
     return CfgMgr.MuonCombinedInDetCandidateAlg(name,**kwargs)
 
 def MuonCombinedMuonCandidateAlg( name="MuonCombinedMuonCandidateAlg", **kwargs ):
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedKeys.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedKeys.py
index ae52c1b1df0c..47e404fed022 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedKeys.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedKeys.py
@@ -36,11 +36,11 @@ class InDetTrackParticles(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'TrackParticleCandidate'
 
-class ExtrapolatedInDetParticles(JobProperty):
-    """StoreGate key for association object of ID particles plus vector of extrpolated TrackPars"""
+class InDetTrackParticlesLargeD0(JobProperty):
+    """StoreGate key for ID track particles with large radius tracking"""
     statusOn     = True
     allowedTypes = ['str']
-    StoredValue  = 'MuonCandidateTracks'
+    StoredValue  = 'TrackParticleCandidateLRT'
 
 ## classes for track collections
 class SpectrometerTracks(JobProperty): # clarify with MS if to be replaced by jobPr. in MuonRecExample
@@ -61,6 +61,12 @@ class CombinedFitTracks(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'CombinedMuonTracks'
 
+class CombinedFitTracksLargeD0(JobProperty):
+    """StoreGate key for tracks from combined fit using large d0 inner tracking particles"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'CombinedMuonTracksLRT'
+
 class RefittedExtrapolatedMSTracks(JobProperty):
     """StoreGate key for tracks with refitted extrapolation using the MS part of the combined track"""
     statusOn     = True
@@ -162,6 +168,13 @@ class FinalMuons(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'Muons'
 
+class FinalMuonsLargeD0(JobProperty):
+    """StoreGate key for final muon collection with large radius InDetTracks after overlap removal and dressing"""
+    statusOn     = True
+    allowedTypes = ['str']
+    StoredValue  = 'MuonsLRT'
+
+
 class FinalCaloMuons(JobProperty):
     """StoreGate key for final muon collection from calorimeter tagging"""
     statusOn     = True
@@ -210,6 +223,8 @@ class InternalMuTagTracksContainer(JobProperty):
     allowedTypes = ['str']
     StoredValue  = 'InternalMuTagTracksContainer'
 
+
+
 ##-----------------------------------------------------------------------------
 ## 2nd step
 ## Definition of the MuonCombined flag container
@@ -222,7 +237,7 @@ class MuonCombinedContainerKeys(JobPropertyContainer):
         print("MuonCombinedKeys: Locking all keys except one thing")
         # MuonCombinedKeys.lock_JobProperties()
         [k.lock() for k in MuonCombinedKeys.__dict__.values() if hasattr(k,'is_locked') and not isinstance(k,type(MuonCombinedKeys.OneThing))]
-        return 
+        return
     pass
 
 ##-----------------------------------------------------------------------------
@@ -234,7 +249,6 @@ jobproperties.add_Container(MuonCombinedContainerKeys)
 ## 4th step
 ## adding ID flags to the MuonCombinedContainerKeys container
 jobproperties.MuonCombinedContainerKeys.add_JobProperty(InDetTrackParticles)
-jobproperties.MuonCombinedContainerKeys.add_JobProperty(ExtrapolatedInDetParticles)
 jobproperties.MuonCombinedContainerKeys.add_JobProperty(SpectrometerTracks)
 jobproperties.MuonCombinedContainerKeys.add_JobProperty(ExtrapolatedMSTracks)
 jobproperties.MuonCombinedContainerKeys.add_JobProperty(CombinedFitTracks)
@@ -262,6 +276,12 @@ jobproperties.MuonCombinedContainerKeys.add_JobProperty(SegmentTagMuons)
 jobproperties.MuonCombinedContainerKeys.add_JobProperty(SegmentTagMuonSegments)
 jobproperties.MuonCombinedContainerKeys.add_JobProperty(InternalMuTagTracksContainer)
 jobproperties.MuonCombinedContainerKeys.add_JobProperty(ExtrapolatedMSOnlyTracks)
+# Large d0 tracking muons
+jobproperties.MuonCombinedContainerKeys.add_JobProperty(FinalMuonsLargeD0)
+jobproperties.MuonCombinedContainerKeys.add_JobProperty(InDetTrackParticlesLargeD0)
+jobproperties.MuonCombinedContainerKeys.add_JobProperty(CombinedFitTracksLargeD0)
+
+
 
 ##-----------------------------------------------------------------------------
 ## 5th step
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecExampleConfigDb.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecExampleConfigDb.py
index 980048cc316a..9dd6e5ac5ff7 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecExampleConfigDb.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecExampleConfigDb.py
@@ -45,7 +45,7 @@ addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedInDetCandidate
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedInDetCandidateAlg",
                                     "MuonCombinedInDetCandidateAlg_LargeD0",
                                     TrackParticleLocation=[InDetKeys.xAODLargeD0TrackParticleContainer()],
-                                    InDetCandidateLocation="InDetCandidates_LargeD0",
+                                    InDetCandidateLocation=MuonCbKeys.InDetTrackParticlesLargeD0(),
                                     DoSiliconAssocForwardMuons=False)
 
 
@@ -53,7 +53,7 @@ addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedInDetCandidate
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedMuonCandidateAlg","MuonCombinedMuonCandidateAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedAlg","MuonCombinedAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedAlg", "MuonCombinedAlg_LargeD0",
-                                                                        InDetCandidateLocation="InDetCandidates_LargeD0",
+                                                                        InDetCandidateLocation=MuonCbKeys.InDetTrackParticlesLargeD0(),
                                                                         CombinedTagMaps=["muidcoTagMap_LargeD0","stacoTagMap_LargeD0"],
                                                                         MuidCombinedTracksLocation="MuidCombinedTracks_LargeD0",
                                                                         MuidMETracksLocation="MuidMETracks_LargeD0")
@@ -62,7 +62,7 @@ addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCombinedInDetExtension
 
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonSegmentTagAlg","MuonSegmentTagAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonSegmentTagAlg","MuonSegmentTagAlg_LargeD0",
-                                                                        InDetCandidateLocation="InDetCandidates_LargeD0",
+                                                                        InDetCandidateLocation=MuonCbKeys.InDetTrackParticlesLargeD0(),
                                                                         TagMap="segmentTagMap_LargeD0",
                                                                         MuonSegmentLocation="MuonSegments")
 
@@ -72,13 +72,13 @@ addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonSegmentTagAlg","MuonSe
 
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCreatorAlg","MuonCreatorAlg")
 addAlgorithm("MuonCombinedRecExample.MuonCombinedAlgs.MuonCreatorAlg","MuonCreatorAlg_LargeD0",
-                                                                      MuonContainerLocation="Muons_LargeD0",
-                                                                      InDetCandidateLocation="InDetCandidates_LargeD0",
+                                                                      MuonContainerLocation=MuonCbKeys.FinalMuonsLargeD0(),
+                                                                      InDetCandidateLocation=MuonCbKeys.InDetTrackParticlesLargeD0(),
                                                                       ExtrapolatedLocation="ExtraPolatedMuon_LargeD0",
                                                                       ExtrapolatedTrackLocation="ExtraPolatedMuonTrack_LargeD0",
                                                                       MSOnlyExtrapolatedLocation="MSOnlyExtraPolatedMuons_LargeD0",
                                                                       MSOnlyExtrapolatedTrackLocation="MSOnlyExtraPolatedMuonTrack_LargeD0",
-                                                                      CombinedLocation="CombinedMuon_LargeD0",
+                                                                      CombinedLocation=MuonCbKeys.CombinedFitTracksLargeD0(),
                                                                       SegmentContainerName="MuonSegments_LargeD0",
                                                                       TrackSegmentContainerName="TrakMuonSegments_LargeD0",
                                                                       TagMaps=["muidcoTagMap_LargeD0","stacoTagMap_LargeD0","segmentTagMap_LargeD0"],
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
index d607015e7914..759c35cd2cef 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedRecFlags.py
@@ -109,7 +109,10 @@ class doxAOD(JobProperty):
     allowedTypes=['bool']
     StoredValue=True
 
-
+class doLargeRadius(JobProperty):
+    satusOn = True
+    allowedTypes=['bool']
+    StoredValue=False
 # @brief run truth-matching on tracks to evaluate tracking performance
 #
 # It will enable matching for the Combined Muon algorithms that are running
@@ -165,6 +168,7 @@ class createScaleCalibrationInput(JobProperty):
     allowedTypes=['bool']
     StoredValue=False
 
+ 
 
 ## The container with all the flags to steer MuonCombined reconstruction
 class MuonCombinedRec(JobPropertyContainer):
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombined_OutputItemsAOD.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombined_OutputItemsAOD.py
index 9576e4a910a2..69757f5a3c2c 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombined_OutputItemsAOD.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombined_OutputItemsAOD.py
@@ -3,8 +3,10 @@ MuonCombinedAODList = []
 
 from MuonCombinedRecExample.MuonCombinedKeys import MuonCombinedKeys as MuonCbKeys
 from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags
+from InDetRecExample.InDetJobProperties import InDetFlags
 from RecExConfig.RecFlags import rec as rec
 
+
 if DetFlags.detdescr.Calo_on(): # FIXME - check if the objects below still make sense. EJWM
    MuonCombinedAODList+=["xAOD::CaloClusterContainer#MuonClusterCollection"]
    MuonCombinedAODList+=["xAOD::CaloClusterAuxContainer#MuonClusterCollectionAux."]
@@ -23,6 +25,12 @@ if DetFlags.detdescr.Muon_on():
    MuonCombinedAODList+=[ "xAOD::TrackParticleAuxContainer#"+MuonCbKeys.SpectrometerParticles()+"Aux." + excludedAuxData ]
    MuonCombinedAODList+=[ "xAOD::MuonContainer#Muons" ]
    MuonCombinedAODList+=[ "xAOD::MuonAuxContainer#MuonsAux.-DFCommonMuonsTight.-DFCommonGoodMuon.-DFCommonMuonsMedium.-DFCommonMuonsLoose" ] # See note
+   if InDetFlags.doR3LargeD0():
+       MuonCombinedAODList+=[ "xAOD::MuonContainer#"+MuonCbKeys.FinalMuonsLargeD0() ]
+       MuonCombinedAODList+=[ "xAOD::MuonAuxContainer#"+MuonCbKeys.FinalMuonsLargeD0()+"Aux.-DFCommonMuonsTight.-DFCommonGoodMuon.-DFCommonMuonsMedium.-DFCommonMuonsLoose" ] # See note
+       MuonCombinedAODList+=[ "xAOD::TrackParticleContainer#"+MuonCbKeys.CombinedFitTracksLargeD0()]
+       MuonCombinedAODList+=[ "xAOD::TrackParticleAuxContainer#"+MuonCbKeys.CombinedFitTracksLargeD0()+"Aux." + excludedAuxData]
+
    # Note: hack to remove derivation framework variables that are added by DRAW building and are supposed to be transient
 
    ### stau
@@ -37,5 +45,3 @@ if DetFlags.detdescr.Muon_on():
 
    #Slimmed Track Collection
    #MuonCombinedAODList+=["TrackCollection#MuonSlimmedTrackCollection"]
-
-
-- 
GitLab