From d86f2f685f5ad697df83eece98d1a89c67ec7f45 Mon Sep 17 00:00:00 2001 From: Baptiste Ravina <baptiste.ravina@cern.ch> Date: Fri, 2 Feb 2024 12:06:11 +0100 Subject: [PATCH] CPAlgorithms: smarter systematic printouts CPAlgorithms: smarter systematic printouts --- .../python/AsgAnalysisConfig.py | 7 +++-- .../Root/SystematicsSvc.cxx | 31 +++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisConfig.py b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisConfig.py index d24215bacb43..8bef719de42c 100644 --- a/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisConfig.py +++ b/PhysicsAnalysis/Algorithms/AsgAnalysisAlgorithms/python/AsgAnalysisConfig.py @@ -182,7 +182,7 @@ class GeneratorAnalysisBlock (ConfigBlock): super (GeneratorAnalysisBlock, self).__init__ ('Generator') self.addOption ('saveCutBookkeepers', True, type=bool) self.addOption ('runNumber', None, type=int) - self.addOption ('cutBookkeepersSystematics', True, type=bool) + self.addOption ('cutBookkeepersSystematics', None, type=bool) def makeAlgs (self, config) : @@ -200,7 +200,10 @@ class GeneratorAnalysisBlock (ConfigBlock): if self.saveCutBookkeepers: alg = config.createAlgorithm('CP::AsgCutBookkeeperAlg', 'CutBookkeeperAlg') alg.runNumber = self.runNumber - alg.enableSystematics = self.cutBookkeepersSystematics + if self.cutBookkeepersSystematics: + alg.enableSystematics = self.cutBookkeepersSystematics + else: + alg.enableSystematics = not config.noSystematics() config.addPrivateTool( 'truthWeightTool', 'PMGTools::PMGTruthWeightTool' ) # Set up the weights algorithm: diff --git a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SystematicsSvc.cxx b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SystematicsSvc.cxx index fced1c57ac91..325630bc290f 100644 --- a/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SystematicsSvc.cxx +++ b/PhysicsAnalysis/Algorithms/SystematicsHandles/Root/SystematicsSvc.cxx @@ -270,21 +270,26 @@ namespace CP StatusCode SystematicsSvc :: finalize () { - for (const CP::SystematicVariation& mysys : m_affectingSystematics) - { - // this logic checks whether a systematic is recommended and - // affecting, or only affecting. if it is only the later, it - // reports the systematic in parenthesis to set it apart. - if (m_recommendedSystematics.find (mysys) == m_recommendedSystematics.end()) - ANA_MSG_INFO ("found systematic: (" << mysys << ")"); - else - ANA_MSG_INFO ("found systematic: " << mysys); + if (m_systematicsList.empty()) { + ANA_MSG_INFO ("no systematics were run."); } - - if(m_systematicsRegex!=".*") { - ANA_MSG_INFO("Systematics regex '" << m_systematicsRegex << "' matched:"); - for(const CP::SystematicSet& mysys : makeSystematicsVector()) { + else{ + for (const CP::SystematicVariation& mysys : m_affectingSystematics) + { + // this logic checks whether a systematic is recommended and + // affecting, or only affecting. if it is only the later, it + // reports the systematic in parenthesis to set it apart. + if (m_recommendedSystematics.find (mysys) == m_recommendedSystematics.end()) + ANA_MSG_INFO ("found systematic: (" << mysys << ")"); + else + ANA_MSG_INFO ("found systematic: " << mysys); + } + + if(m_systematicsRegex!=".*") { + ANA_MSG_INFO("Systematics regex '" << m_systematicsRegex << "' matched:"); + for(const CP::SystematicSet& mysys : makeSystematicsVector()) { ANA_MSG_INFO (" '" << mysys.name() << "'"); + } } } return StatusCode::SUCCESS; -- GitLab