From 711896bc8884d71901bf06daff582b4442ad30bd Mon Sep 17 00:00:00 2001
From: Johannes Josef Junggeburth <johannes.josef.junggeburth@CERN.CH>
Date: Sat, 5 Sep 2020 10:17:01 +0200
Subject: [PATCH] Add large d0 tracks to physics validation

---
 .../python/InDetPhysValJobProperties.py       | 14 +++++++----
 .../python/InDetPhysValMonitoringTool.py      | 23 ++++++++++++++-----
 .../share/PhysValInDet_jobOptions.py          |  2 +-
 3 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py
index 33cc4495a373..e3fd7b6337bc 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py
@@ -1,7 +1,7 @@
 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 #
-## purpose Python module to hold common flags to configure the InDetPhysValMonitoring 
+## purpose Python module to hold common flags to configure the InDetPhysValMonitoring
 ##
 
 from __future__ import print_function
@@ -44,6 +44,11 @@ class InDetPhysValFlagsJobProperty(JobProperty):
        else:
           return self.StoredValue
 
+class doValidateLargeD0Tracks(InDetPhysValFlagsJobProperty):
+    statusOn     = True
+    allowedTypes = ['bool']
+    StoredValue  = False
+
 class doValidateDBMTracks(InDetPhysValFlagsJobProperty):
     statusOn     = True
     allowedTypes = ['bool']
@@ -138,7 +143,7 @@ class InDetPhysValJobProperties(JobPropertyContainer):
     if  hasattr(InDetFlags,'doDBM') and not InDetFlags.doDBM() :
         self.checkThenSet(self.doValidateDBMTracks,  False)
     print (self)
-    
+
   def printInfo(self) :
       pass
 
@@ -150,7 +155,7 @@ jobproperties.add_Container(InDetPhysValJobProperties)
 _list_InDetPhysValJobProperties = [
     Enabled,
     doValidateDBMTracks,
-    doValidateGSFTracks,    
+    doValidateGSFTracks,
     doValidateLooseTracks,
     doValidateTightPrimaryTracks,
     doValidateTracksInJets,
@@ -158,7 +163,8 @@ _list_InDetPhysValJobProperties = [
     validateExtraTrackCollections,
     doPhysValOutput,
     doExpertOutput,
-    setTruthStrategy
+    setTruthStrategy,
+    doValidateLargeD0Tracks
 ]
 
 for j in _list_InDetPhysValJobProperties:
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py
index 667585ac116c..a89451e96e6e 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration 
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 from __future__ import print_function
 
 from InDetPhysValMonitoring.ConfigUtils import serviceFactory,toolFactory
@@ -61,13 +61,13 @@ def getInDetPhysValMonitoringTool(**kwargs) :
          kwargs=setDefaults(kwargs,
                             JetContainerName    ='' ,
                             FillTrackInJetPlots = False)
-      
+
       #adding the VeretxTruthMatchingTool
       from InDetTruthVertexValidation.InDetTruthVertexValidationConf import InDetVertexTruthMatchTool
-      kwargs=setDefaults(kwargs, 
+      kwargs=setDefaults(kwargs,
                         useVertexTruthMatchTool = True,
          		VertexTruthMatchTool = toolFactory(InDetVertexTruthMatchTool) )
-      
+
       #Options for Truth Strategy : Requires full pile-up truth containers for some
       if InDetPhysValFlags.setTruthStrategy() == 'All' or InDetPhysValFlags.setTruthStrategy() == 'PileUp' :
         from RecExConfig.AutoConfiguration import IsInInputFile
@@ -78,9 +78,9 @@ def getInDetPhysValMonitoringTool(**kwargs) :
             print ('WARNING Truth Strategy for InDetPhysValMonitoring set to %s but TruthPileupEvents are missing in the input; resetting to HardScatter only' % (InDetPhysValFlags.setTruthStrategy()))
       elif InDetPhysValFlags.setTruthStrategy() != 'HardScatter' :
         print ('WARNING Truth Strategy for for InDetPhysValMonitoring set to invalid option %s; valid flags are ["HardScatter", "All", "PileUp"]' %  (InDetPhysValFlags.setTruthStrategy()))
-         
 
-      
+
+
 
 
    else :
@@ -165,3 +165,14 @@ def getInDetPhysValMonitoringToolDBM(**kwargs) :
                       useTrackSelection          = True)
 
    return getInDetPhysValMonitoringTool(**kwargs)
+
+def getInDetLargeD0PhysValMonitoringTool(**kwargs) :
+   from InDetRecExample.InDetJobProperties import InDetFlags
+   from InDetRecExample.InDetKeys import InDetKeys
+   kwargs=setDefaults(kwargs,
+                      name                       = 'InDetPhysValMonitoringToolLargeD0',
+                      SubFolder                  = 'LargeD0/',
+                      TrackParticleContainerName = InDetKeys.xAODLargeD0TrackParticleContainer() if InDetFlags.storeSeparateLargeD0Container() else  InDetKeys.xAODTrackParticleContainer(),
+                      useTrackSelection          = True)
+
+   return getInDetPhysValMonitoringTool(**kwargs)
diff --git a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValInDet_jobOptions.py b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValInDet_jobOptions.py
index a3dadd6ae12e..fe45b83eaf03 100644
--- a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValInDet_jobOptions.py
+++ b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValInDet_jobOptions.py
@@ -7,6 +7,7 @@ from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags
 import InDetPhysValMonitoring.InDetPhysValMonitoringTool as InDetPhysValMonitoringTool
 
 mons=[ (True                                             , InDetPhysValMonitoringTool.getInDetPhysValMonitoringTool),
+       (InDetPhysValFlags.doValidateLargeD0Tracks()      , InDetPhysValMonitoringTool.getInDetLargeD0PhysValMonitoringTool),
        (InDetPhysValFlags.doValidateLooseTracks()        , InDetPhysValMonitoringTool.getInDetPhysValMonitoringToolLoose),
        (InDetPhysValFlags.doValidateTightPrimaryTracks() , InDetPhysValMonitoringTool.getInDetPhysValMonitoringToolTightPrimary),
        (InDetPhysValFlags.doValidateDBMTracks()          , InDetPhysValMonitoringTool.getInDetPhysValMonitoringToolDBM),
@@ -17,7 +18,6 @@ for enabled, creator in mons :
     if enabled :
         monMan.AthenaMonTools += [ creator() ]
 
-
 from InDetPhysValMonitoring.InDetPhysValMonitoringTool import getInDetPhysValMonitoringTool
 from  InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags
 from  InDetPhysValMonitoring.ConfigUtils import extractCollectionPrefix
-- 
GitLab