From f54dae30026251fc66f1131978d70038f8789e52 Mon Sep 17 00:00:00 2001
From: John Chapman <jchapman@cern.ch>
Date: Fri, 14 Aug 2020 10:52:16 +0200
Subject: [PATCH] Extra debugging printout

---
 .../ISF/ISF_Core/ISF_Algorithms/src/SimKernel.cxx | 15 ++++++++++++++-
 .../ISF_Core/ISF_Algorithms/src/SimKernelMT.cxx   | 15 +++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Simulation/ISF/ISF_Core/ISF_Algorithms/src/SimKernel.cxx b/Simulation/ISF/ISF_Core/ISF_Algorithms/src/SimKernel.cxx
index 51210782d11..691265b50f2 100644
--- a/Simulation/ISF/ISF_Core/ISF_Algorithms/src/SimKernel.cxx
+++ b/Simulation/ISF/ISF_Core/ISF_Algorithms/src/SimKernel.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 // ISF_Algs includes
@@ -26,6 +26,8 @@
 #include "GeneratorObjects/McEventCollection.h"
 #include "GeneratorObjects/HepMcParticleLink.h"
 
+#undef ISFDEBUG
+
 ///////////////////////////////////////////////////////////////////
 // Public methods:
 ///////////////////////////////////////////////////////////////////
@@ -382,6 +384,7 @@ StatusCode ISF::SimKernel::execute()
     const ISF::ConstISFParticleVector &particles = m_particleBroker->popVector(m_maxParticleVectorSize);
     const unsigned int numParticlesLeftInBroker = m_particleBroker->numParticles();
     int numParticles = particles.size();
+
     // particle vector empty -> end simulation
     if (numParticles==0) break;
 
@@ -396,6 +399,16 @@ StatusCode ISF::SimKernel::execute()
     ATH_MSG_DEBUG  ( "Took " << numParticles << " particles from queue (remaining: " << m_particleBroker->numParticles() << ")" );
     ATH_MSG_VERBOSE( " -> All particles will be sent to '" << m_simSvcNames[simID] << "' simulator (SimSvcID=" << simID << ")"  );
 
+    #ifdef ISFDEBUG
+    if (loopCounter>100 && numParticles<3) {
+      ATH_MSG_INFO("Main Loop pass no. " << loopCounter);
+      ATH_MSG_INFO("Selected " << numParticles << " particles to be processed by " << m_simSvcNames[simID]);
+      for ( const ISFParticle *particle : particles ) {
+        ATH_MSG_INFO(*particle);
+      }
+    }
+    #endif // ISFDEBUG
+
     // ensure that all particles in the vector have the same SimID
     for ( const ISFParticle *particle : particles ) {
       if ( particle->nextSimID() != simID ) {
diff --git a/Simulation/ISF/ISF_Core/ISF_Algorithms/src/SimKernelMT.cxx b/Simulation/ISF/ISF_Core/ISF_Algorithms/src/SimKernelMT.cxx
index 01aaa00efb1..a95ea80a4f5 100644
--- a/Simulation/ISF/ISF_Core/ISF_Algorithms/src/SimKernelMT.cxx
+++ b/Simulation/ISF/ISF_Core/ISF_Algorithms/src/SimKernelMT.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -20,6 +20,7 @@
 #include <queue>
 #include <utility>
 
+#undef ISFDEBUG
 
 ISF::SimKernelMT::SimKernelMT( const std::string& name, ISvcLocator* pSvcLocator ) :
     ::AthAlgorithm( name, pSvcLocator ),
@@ -129,7 +130,7 @@ StatusCode ISF::SimKernelMT::initialize() {
 
 StatusCode ISF::SimKernelMT::execute() {
 
-  // Release the event from all simulators (TODO: make the tools do this)
+  // Call setupEvent for all simulators (TODO: make the tools do this)
   for (auto& curSimTool: m_simulationTools) {
     if ( curSimTool ) {
       ATH_CHECK(curSimTool->setupEvent());
@@ -223,6 +224,16 @@ StatusCode ISF::SimKernelMT::execute() {
       }
     }
     particleQueue = std::move(tempQueue);
+    #ifdef ISFDEBUG
+    if (loopCounter>100 && particles.size()<3) {
+      ATH_MSG_INFO("Main Loop pass no. " << loopCounter);
+      ATH_MSG_INFO("Selected " << particles.size() << " particles to be processed by " << lastSimulator->name());
+      for ( const ISFParticle *particle : particles ) {
+        ATH_MSG_INFO(*particle);
+      }
+    }
+    #endif // ISFDEBUG
+
     ATH_MSG_VERBOSE("Selected " << particles.size() << " particles to be processed by " << lastSimulator->name());
     // Run the simulation
     ATH_CHECK( lastSimulator->simulateVector( particles, newSecondaries, outputTruth.ptr() ) );
-- 
GitLab