From ad8f232c97dcc8f63092a3aa4dbf93a66b1f010e Mon Sep 17 00:00:00 2001
From: Goetz Gaycken <goetz.gaycken@cern.ch>
Date: Mon, 22 Jun 2020 14:06:28 +0200
Subject: [PATCH] Allow to run DenseEnvironmentsAmbiguityScoreProcessorTool if
 doPixelClusterSplitting is disabled.

---
 .../share/ConfiguredNewTrackingSiPattern.py            | 10 +++++-----
 .../DenseEnvironmentsAmbiguityScoreProcessorTool.cxx   |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
index 0063dfe7723..874a799bf0a 100644
--- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingSiPattern.py
@@ -504,10 +504,11 @@ class  ConfiguredNewTrackingSiPattern:
                                                    doHadCaloSeed      = InDetFlags.doCaloSeededRefit(),
                                                    InputHadClusterContainerName = InDetKeys.HadCaloClusterROIContainer()+"Bjet")
 
-            # DenseEnvironmentsAmbiguityScoreProcessorTool
+           # DenseEnvironmentsAmbiguityScoreProcessorTool
            from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__DenseEnvironmentsAmbiguityScoreProcessorTool as ScoreProcessorTool
            InDetAmbiguityScoreProcessor = ScoreProcessorTool(name               = 'InDetAmbiguityScoreProcessor'+NewTrackingCuts.extension(),
                                                              ScoringTool        = InDetAmbiScoringTool,
+                                                             SplitProbTool      = NnPixelClusterSplitProbTool if InDetFlags.doPixelClusterSplitting() and 'NnPixelClusterSplitProbTool' in globals() else None,
                                                              AssociationTool    = TrackingCommon.getInDetPRDtoTrackMapToolGangedPixels(),
                                                              AssociationToolNotGanged  = TrackingCommon.getPRDtoTrackMapTool(),
                                                              AssociationMapName = 'PRDToTrackMap'+NewTrackingCuts.extension(),
@@ -529,9 +530,8 @@ class  ConfiguredNewTrackingSiPattern:
                                                  RefitPrds          = True)
            InDetAmbiguityScoreProcessor = None
 
-         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "DBM")  and 'NnPixelClusterSplitProbTool' in globals():
-           if InDetAmbiguityScoreProcessor : 
-              InDetAmbiguityScoreProcessor.SplitProbTool             = NnPixelClusterSplitProbTool
+         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "DBM") and 'NnPixelClusterSplitProbTool' in globals() :
+           if InDetAmbiguityScoreProcessor is not None :
               InDetAmbiguityScoreProcessor.sharedProbCut             = prob1
               InDetAmbiguityScoreProcessor.sharedProbCut2            = prob2
               if NewTrackingCuts.extension() == "":
@@ -564,7 +564,7 @@ class  ConfiguredNewTrackingSiPattern:
             printfunc (InDetAmbiguityProcessor)
 
          # add InDetAmbiguityScoreProcessor
-         if InDetAmbiguityScoreProcessor :
+         if InDetAmbiguityScoreProcessor is not None :
             ToolSvc += InDetAmbiguityScoreProcessor
 
          #
diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx
index 9cca17d85c4..03db0a887b1 100644
--- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx
+++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx
@@ -294,7 +294,7 @@ Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::overlappingTracks(const Track
         
         //Update the pixel split information if the element is unique (The second element of the pair indiciates if the element was inserted into the map)
         auto ret =  setOfPixelClustersOnTrack.insert(std::make_pair( pixel, (*tsos)->trackParameters() ));
-        if (ret.second) {
+        if (ret.second && m_splitProbTool.isEnabled()) {
           updatePixelSplitInformationForCluster( *(ret.first), splitClusterMap);
         }
         
-- 
GitLab