ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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 More...
 
void initialize ()
 initialize the tool More...
 
void applySystematicVariation (const std::string &sysName)
 set the tool to apply the given systematic variation More...
 
std::vector< ColumnInfogetColumnInfo () const
 get the expected column info More...
 
std::vector< std::string > getColumnNames () const
 get the expected column names More...
 
std::vector< std::string > getRecommendedSystematics () const
 get the recommended systematics More...
 
ToolColumnVectorMapgetToolWrapper ()
 get the tool wrapper More...
 
const ToolColumnVectorMapgetToolWrapper () const
 
const ColumnVectorHeadergetColumnHeader () const
 get the column header More...
 
IColumnarToolgetTool ()
 get the contained tool More...
 

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;
92  throw std::runtime_error ("failed to apply systematic variation");
93  }

◆ getColumnHeader()

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

get the column header

Definition at line 86 of file ColumnarMemoryTest.h.

86  {
87  return *m_columnHeader;}

◆ getColumnInfo()

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

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  }

◆ 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;
124  result.push_back (sys.name());
125  return result;
126  }

◆ getTool()

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

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 ( )

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

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  }

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:
CaloCondBlobAlgs_fillNoiseFromASCII.sysName
sysName
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:92
get_generator_info.result
result
Definition: get_generator_info.py:21
CP::make_systematics_vector
std::vector< CP::SystematicSet > make_systematics_vector(const SystematicSet &systematics)
utility functions for working with systematics
Definition: SystematicsUtil.cxx:25
CP::SystematicSet
Class to wrap a set of SystematicVariations.
Definition: SystematicSet.h:31
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
columnar::IColumnarTool::getColumnInfo
virtual std::vector< ColumnInfo > getColumnInfo() const =0
the meta-information for the columns
columnar::TestUtils::ColumnarTestToolHandle::m_toolWrapper
std::shared_ptr< ToolColumnVectorMap > m_toolWrapper
Definition: ColumnarMemoryTest.h:103
columnar::TestUtils::ColumnarTestToolHandle::m_tool
IColumnarTool * m_tool
Definition: ColumnarMemoryTest.h:99
columnar::renameContainers
void renameContainers(IColumnarTool &tool, const std::vector< std::pair< std::string, std::string >> &renames)
rename containers in the columnar tool
Definition: ColumnarToolHelpers.cxx:23
CP::IReentrantSystematicsTool::recommendedSystematics
virtual SystematicSet recommendedSystematics() const =0
the list of all systematics this tool recommends to use
columnar::TestUtils::ColumnarTestToolHandle::m_columnHeader
std::shared_ptr< ColumnVectorHeader > m_columnHeader
Definition: ColumnarMemoryTest.h:102
CP::ISystematicsTool
Interface for all CP tools supporting systematic variations.
Definition: ISystematicsTool.h:32
columnar::TestUtils::ColumnarTestToolHandle::m_systTool
CP::ISystematicsTool * m_systTool
Definition: ColumnarMemoryTest.h:100
CP::ISystematicsTool::applySystematicVariation
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig)=0
effects: configure this tool for the given list of systematic variations.
python.difftuple.renames
dictionary renames
Definition: difftuple.py:22