From eaa9460760b7b39e7883f64eaba46bd3d9a14aae Mon Sep 17 00:00:00 2001 From: Bill Balunas <bill.balunas@cern.ch> Date: Wed, 21 Aug 2019 15:49:19 +0200 Subject: [PATCH] Use list initialization for properties --- .../JetMomentTools/JetCaloQualityTool.h | 19 ++++++++--------- .../JetMomentTools/JetLArHVTool.h | 10 ++++++--- .../JetMomentTools/JetVoronoiMomentsTool.h | 21 ++++++++++++------- .../JetMomentTools/JetWidthTool.h | 10 ++++++--- .../Root/JetCaloQualityTool.cxx | 8 ------- .../Jet/JetMomentTools/Root/JetLArHVTool.cxx | 8 +++---- .../Jet/JetMomentTools/Root/JetWidthTool.cxx | 10 ++++----- .../src/JetVoronoiMomentsTool.cxx | 15 +++---------- 8 files changed, 46 insertions(+), 55 deletions(-) diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetCaloQualityTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetCaloQualityTool.h index a0d0bddcffb9..023778e2690b 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetCaloQualityTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetCaloQualityTool.h @@ -46,11 +46,16 @@ public: virtual StatusCode initialize(); protected: - /// Names of calo quantities to compute and to add as attributes - std::vector<std::string> m_calculationNames; - /// Time cuts for Out-of-time calo quantities. - std::vector <double> m_timingTimeCuts; + Gaudi::Property<std::vector<std::string> > m_calculationNames{this, "Calculations", {}, + "Name of calo quantities to compute and add as decorations"}; + Gaudi::Property<std::vector<double> > m_timingTimeCuts{this, "TimingCuts", {}, + "Time cuts for out-of-time calo quantities"}; + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key of input jet container"}; + + SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_writeDecorKeys{this, "OutputDecorKeys", {}, + "SG keys for output decorations (not to be configured manually!)"}; /// This objects holds a list of cluster-based calculators jet::JetCaloCalculations m_jetCalculations; @@ -58,12 +63,6 @@ public: // internal pointer to m_jetCalculations (this pointer is also used in the cell-based derived tool) jet::JetCaloCalculations * m_calcProcessor; - /// SG key for the jet container this tool will decorate. - std::string m_jetContainerName; - - // internal vector to manage WriteDecorHandleKeys - SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_writeDecorKeys; - bool m_doFracSamplingMax; // internal }; #endif diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetLArHVTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetLArHVTool.h index 1dbfd3af0bdb..9e27265345c3 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetLArHVTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetLArHVTool.h @@ -36,9 +36,13 @@ public: private: - std::string m_jetContainerName; - SG::WriteDecorHandleKey<xAOD::JetContainer> m_fracKey; - SG::WriteDecorHandleKey<xAOD::JetContainer> m_nCellKey; + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key for the input jet container"}; + + SG::WriteDecorHandleKey<xAOD::JetContainer> m_fracKey{this, "EnergyFracDecorKey", "LArBadHVEnergyFrac", + "SG key for energy fraction decoration (not including jet container name)"}; + SG::WriteDecorHandleKey<xAOD::JetContainer> m_nCellKey{this, "NCellDecorKey", "LArBadHVNCell", + "SG key for nCell decoration (not including jet container name)"}; }; #endif diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiMomentsTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiMomentsTool.h index 95ec94838414..1a1b0142dc6d 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiMomentsTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiMomentsTool.h @@ -43,14 +43,19 @@ public: private: // parameters - float m_x_min; - float m_x_max; - float m_y_min; - float m_y_max; - - std::string m_jetContainerName; - SG::WriteDecorHandleKey<xAOD::JetContainer> m_voronoiAreaKey; - + Gaudi::Property<float> m_x_min{this, "AreaXmin", -10, + "Minimum x-value for Voronoi diagram"}; + Gaudi::Property<float> m_x_max{this, "AreaXmax", 10, + "Maximum x-value for Voronoi diagram"}; + Gaudi::Property<float> m_y_min{this, "AreaYmin", -4, + "Minimum y-value for Voronoi diagram"}; + Gaudi::Property<float> m_y_max{this, "AreaYmax", 4, + "Maximum y-value for Voronoi diagram"}; + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key for the input jet container"}; + + SG::WriteDecorHandleKey<xAOD::JetContainer> m_voronoiAreaKey{this, "VoronoiAreaKey", "VoronoiArea", + "SG key for Voronoi area decoration (not including jet container name)"}; }; #endif diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetWidthTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetWidthTool.h index aed80e724f2b..4851554b97dd 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetWidthTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetWidthTool.h @@ -39,9 +39,13 @@ public: private: - std::string m_jetContainerName; - SG::WriteDecorHandleKey<xAOD::JetContainer> m_widthKey; - SG::WriteDecorHandleKey<xAOD::JetContainer> m_widthPhiKey; + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key for the input jet container"}; + + SG::WriteDecorHandleKey<xAOD::JetContainer> m_widthKey{this, "WidthKey", "Width", + "SG key for width decoration (not including jet container name)"}; + SG::WriteDecorHandleKey<xAOD::JetContainer> m_widthPhiKey{this, "WidthPhiKey", "WidthPhi", + "SG key for width phi decoration (not including jet container name)"}; }; #endif diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetCaloQualityTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetCaloQualityTool.cxx index c1b1978d4575..c3b12b4a38f0 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetCaloQualityTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetCaloQualityTool.cxx @@ -20,14 +20,6 @@ JetCaloQualityTool::JetCaloQualityTool(const std::string& name) : asg::AsgTool(name) { declareInterface<IJetDecorator>(this); - - declareProperty("TimingCuts", m_timingTimeCuts); - declareProperty("Calculations", m_calculationNames); - declareProperty("JetContainer", m_jetContainerName); - - // This is only a property so it can communicate dependencies to the - // scheduler. User should not configure it. - declareProperty("OutputDecorKeys", m_writeDecorKeys); } diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetLArHVTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetLArHVTool.cxx index 39b24a87f704..00c67a27ab97 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetLArHVTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetLArHVTool.cxx @@ -12,12 +12,10 @@ JetLArHVTool::JetLArHVTool(const std::string& name) : asg::AsgTool(name) { declareInterface<IJetDecorator>(this); - declareProperty("JetContainer", m_jetContainerName); - // These generally shouldn't be configured by the user, unless they really - // know what they're doing. - declareProperty("EnergyFracDecorKey", m_fracKey = m_jetContainerName + ".LArBadHVEnergyFrac"); - declareProperty("NCellDecorKey", m_nCellKey = m_jetContainerName + ".LArBadHVNCell"); + // Prepend jet container name + m_fracKey = m_jetContainerName + "." + m_fracKey.key(); + m_nCellKey = m_jetContainerName + "." + m_nCellKey.key(); } diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetWidthTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetWidthTool.cxx index 12fa00fd2e95..1ebf2b4da5c5 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetWidthTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetWidthTool.cxx @@ -16,19 +16,17 @@ JetWidthTool::JetWidthTool(std::string myname) : asg::AsgTool(myname) { declareInterface<IJetDecorator>(this); - declareProperty("JetContainer", m_jetContainerName); - // These generally shouldn't be configured by the user, unless they really - // know what they're doing. - declareProperty("WidthDecorKey", m_widthKey = m_jetContainerName + ".Width"); - declareProperty("WidthPhiDecorKey", m_widthPhiKey = m_jetContainerName + ".WidthPhi"); + // Prepend jet container name + m_widthKey = m_jetContainerName + "." + m_widthKey.key(); + m_widthPhiKey = m_jetContainerName + "." + m_widthPhiKey.key(); } //********************************************************************** StatusCode JetWidthTool::initialize(){ - if(m_widthKey.key().at(0) == '.' || m_widthPhiKey.key().at(0) == '.'){ + if(m_jetContainerName.empty()){ ATH_MSG_ERROR("JetWidthTool needs to have its input jet container name configured!"); return StatusCode::FAILURE; } diff --git a/Reconstruction/Jet/JetMomentTools/src/JetVoronoiMomentsTool.cxx b/Reconstruction/Jet/JetMomentTools/src/JetVoronoiMomentsTool.cxx index 6083c88f1d0c..0891ce4c320b 100644 --- a/Reconstruction/Jet/JetMomentTools/src/JetVoronoiMomentsTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/src/JetVoronoiMomentsTool.cxx @@ -21,25 +21,16 @@ using JetVoronoiDiagramHelpers::Diagram; JetVoronoiMomentsTool::JetVoronoiMomentsTool(const std::string& name) : asg::AsgTool(name) - , m_x_min(-10.) - , m_x_max( 10.) - , m_y_min(-4. ) - , m_y_max( 4. ) { declareInterface<IJetDecorator>(this); - declareProperty("AreaXmin",m_x_min); - declareProperty("AreaXmax",m_x_max); - declareProperty("AreaYmin",m_y_min); - declareProperty("AreaYmax",m_y_max); - declareProperty("JetContainer", m_jetContainerName); - // Generally shouldn't be configured by the user, unless they know what they're doing - declareProperty("VoronoiAreaDecorKey", m_voronoiAreaKey = m_jetContainerName + ".VoronoiArea"); + // Prepend jet collection name + m_voronoiAreaKey = m_jetContainerName + "." + m_voronoiAreaKey.key(); } StatusCode JetVoronoiMomentsTool::initialize() { - if(m_voronoiAreaKey.key().at(0) == '.'){ + if(m_jetContainerName.empty()){ ATH_MSG_ERROR("JetVoronoiMomentsTool needs to have its input jet container name configured!"); return StatusCode::FAILURE; } -- GitLab