ATLAS Offline Software
Loading...
Searching...
No Matches
columnar::TestUtils::ColumnarTestToolHandle Class Referencefinal

a handle to a columnar tool for running tests More...

#include <ColumnarMemoryTest.h>

Collaboration diagram for columnar::TestUtils::ColumnarTestToolHandle:

Public Member Functions

 ColumnarTestToolHandle (asg::AsgTool &val_tool)
void renameContainers (const std::vector< std::pair< std::string, std::string > > &renames)
 rename the columns the tool uses
void initialize ()
 initialize the tool
void applySystematicVariation (const std::string &sysName)
 set the tool to apply the given systematic variation
std::vector< ColumnInfogetColumnInfo () const
 get the expected column info
std::vector< std::string > getColumnNames () const
 get the expected column names
std::vector< std::string > getRecommendedSystematics () const
 get the recommended systematics
ToolColumnVectorMapgetToolWrapper ()
 get the tool wrapper
const ToolColumnVectorMapgetToolWrapper () const
const ColumnVectorHeadergetColumnHeader () const
 get the column header
IColumnarToolgetTool ()
 get the contained tool

Private Attributes

IColumnarToolm_tool = nullptr
CP::ISystematicsToolm_systTool = nullptr
std::shared_ptr< ColumnVectorHeaderm_columnHeader
std::shared_ptr< ToolColumnVectorMapm_toolWrapper

Detailed Description

a handle to a columnar tool for running tests

This used to be shared with the python bindings, but there are sufficient differences between testing and python bindings to split the two.

Definition at line 54 of file ColumnarMemoryTest.h.

Constructor & Destructor Documentation

◆ ColumnarTestToolHandle()

columnar::TestUtils::ColumnarTestToolHandle::ColumnarTestToolHandle ( asg::AsgTool & val_tool)
explicit

Public Members

Definition at line 51 of file ColumnarMemoryTest.cxx.

53 {
54 m_tool = dynamic_cast<IColumnarTool*> (&val_tool);
55 if (m_tool == nullptr)
56 throw std::runtime_error ("tool does not implement IColumnarTool");
57 m_systTool = dynamic_cast<CP::ISystematicsTool*> (m_tool);
58 }

Member Function Documentation

◆ applySystematicVariation()

void columnar::TestUtils::ColumnarTestToolHandle::applySystematicVariation ( const std::string & sysName)

set the tool to apply the given systematic variation

Definition at line 84 of file ColumnarMemoryTest.cxx.

86 {
87 // by convention setting a systematic on a non-systematics tool
88 // will do nothing
89 if (m_systTool == nullptr)
90 return;
91 if (!m_systTool->applySystematicVariation (CP::SystematicSet (sysName)).isSuccess())
92 throw std::runtime_error ("failed to apply systematic variation");
93 }

◆ getColumnHeader()

const ColumnVectorHeader & columnar::TestUtils::ColumnarTestToolHandle::getColumnHeader ( ) const
inlinenodiscard

get the column header

Definition at line 86 of file ColumnarMemoryTest.h.

86 {
87 return *m_columnHeader;}
std::shared_ptr< ColumnVectorHeader > m_columnHeader

◆ getColumnInfo()

std::vector< ColumnInfo > columnar::TestUtils::ColumnarTestToolHandle::getColumnInfo ( ) const
nodiscard

get the expected column info

Definition at line 97 of file ColumnarMemoryTest.cxx.

99 {
100 if (!m_toolWrapper)
101 throw std::runtime_error ("tool not initialized");
102 return m_tool->getColumnInfo ();
103 }
std::shared_ptr< ToolColumnVectorMap > m_toolWrapper

◆ getColumnNames()

std::vector< std::string > columnar::TestUtils::ColumnarTestToolHandle::getColumnNames ( ) const

get the expected column names

Definition at line 107 of file ColumnarMemoryTest.cxx.

109 {
110 if (!m_toolWrapper)
111 throw std::runtime_error ("tool not initialized");
112 return m_toolWrapper->getColumnNames ();
113 }

◆ getRecommendedSystematics()

std::vector< std::string > columnar::TestUtils::ColumnarTestToolHandle::getRecommendedSystematics ( ) const

get the recommended systematics

Definition at line 117 of file ColumnarMemoryTest.cxx.

119 {
120 if (!m_systTool)
121 return {""};
122 std::vector<std::string> result;
123 for (auto& sys : CP::make_systematics_vector (m_systTool->recommendedSystematics()))
124 result.push_back (sys.name());
125 return result;
126 }
std::vector< CP::SystematicSet > make_systematics_vector(const SystematicSet &systematics)
utility functions for working with systematics

◆ getTool()

IColumnarTool * columnar::TestUtils::ColumnarTestToolHandle::getTool ( )
nodiscard

get the contained tool

Definition at line 150 of file ColumnarMemoryTest.cxx.

152 {
153 return m_tool;
154 }

◆ getToolWrapper() [1/2]

ToolColumnVectorMap & columnar::TestUtils::ColumnarTestToolHandle::getToolWrapper ( )
nodiscard

get the tool wrapper

Definition at line 130 of file ColumnarMemoryTest.cxx.

132 {
133 if (!m_toolWrapper)
134 throw std::runtime_error ("tool not initialized");
135 return *m_toolWrapper;
136 }

◆ getToolWrapper() [2/2]

const ToolColumnVectorMap & columnar::TestUtils::ColumnarTestToolHandle::getToolWrapper ( ) const
nodiscard

Definition at line 140 of file ColumnarMemoryTest.cxx.

142 {
143 if (!m_toolWrapper)
144 throw std::runtime_error ("tool not initialized");
145 return *m_toolWrapper;
146 }

◆ initialize()

void columnar::TestUtils::ColumnarTestToolHandle::initialize ( )

initialize the tool

Definition at line 75 of file ColumnarMemoryTest.cxx.

77 {
78 m_columnHeader = std::make_shared<ColumnVectorHeader> ();
79 m_toolWrapper = std::make_shared<ToolColumnVectorMap> (*m_columnHeader, *m_tool);
80 }

◆ renameContainers()

void columnar::TestUtils::ColumnarTestToolHandle::renameContainers ( const std::vector< std::pair< std::string, std::string > > & renames)

rename the columns the tool uses

Definition at line 62 of file ColumnarMemoryTest.cxx.

64 {
66 if (m_toolWrapper)
67 {
68 m_columnHeader = std::make_shared<ColumnVectorHeader> ();
69 m_toolWrapper = std::make_shared<ToolColumnVectorMap> (*m_columnHeader, *m_tool);
70 }
71 }
void renameContainers(IColumnarTool &tool, const std::vector< std::pair< std::string, std::string > > &renames)
rename containers in the columnar tool

Member Data Documentation

◆ m_columnHeader

std::shared_ptr<ColumnVectorHeader> columnar::TestUtils::ColumnarTestToolHandle::m_columnHeader
private

Definition at line 102 of file ColumnarMemoryTest.h.

◆ m_systTool

CP::ISystematicsTool* columnar::TestUtils::ColumnarTestToolHandle::m_systTool = nullptr
private

Definition at line 100 of file ColumnarMemoryTest.h.

◆ m_tool

IColumnarTool* columnar::TestUtils::ColumnarTestToolHandle::m_tool = nullptr
private

Private Members

Definition at line 99 of file ColumnarMemoryTest.h.

◆ m_toolWrapper

std::shared_ptr<ToolColumnVectorMap> columnar::TestUtils::ColumnarTestToolHandle::m_toolWrapper
private

Definition at line 103 of file ColumnarMemoryTest.h.


The documentation for this class was generated from the following files: