 |
ATLAS Offline Software
|
Go to the documentation of this file.
35 static std::atomic<unsigned>
index = 0;
44 return std::is_same_v<ColumnarModeDefault,ColumnarModeArray>;
56 throw std::runtime_error (
"tool does not implement IColumnarTool");
92 throw std::runtime_error (
"failed to apply systematic variation");
101 throw std::runtime_error (
"tool not initialized");
111 throw std::runtime_error (
"tool not initialized");
122 std::vector<std::string>
result;
134 throw std::runtime_error (
"tool not initialized");
144 throw std::runtime_error (
"tool not initialized");
160 : m_toolHandle (&val_toolHandle), m_columnData (std::make_unique<
ColumnVectorData> (&val_toolHandle.getColumnHeader()))
165 if (userColumn.info.has_value())
166 throw std::runtime_error (
"column already exists: " +
column.name);
177 if (userColumn.input.has_value())
178 throw std::runtime_error (
"column added twice: " +
name);
180 userColumn.input = std::move (manualData);
189 if (userColumn.expectation.has_value())
190 throw std::runtime_error (
"column added twice: " +
name);
192 userColumn.expectation = std::move (manualData);
202 throw std::runtime_error (
"column not found: " +
name);
203 return iter->second.input.value().columnSize ();
211 std::vector<std::string> missingColumns;
214 if (!userColumn.info.has_value())
217 ADD_FAILURE() <<
"provided a column not requested by tool: " <<
name;
220 auto& columnInfo = userColumn.info.value();
221 if (!userColumn.input.has_value())
223 if (!columnInfo.isOptional)
228 missingColumns.push_back (
name);
232 auto& input = userColumn.input.value();
233 switch (columnInfo.accessMode)
240 input.configureType (
name, *columnInfo.type);
245 throw std::runtime_error (
"column mode unknown: " + columnInfo.name);
248 if (!missingColumns.empty())
250 std::string
message =
"missing input columns:";
251 for (
auto&
column : missingColumns)
253 throw std::runtime_error (
message);
273 if (!userColumn.info.has_value())
275 auto&
info = userColumn.info.value();
278 if (userColumn.expectation.has_value())
279 ADD_FAILURE() <<
"expectation provided for input-only column: " << columnName;
282 if (!userColumn.input.has_value())
286 if (userColumn.expectation.has_value())
287 ADD_FAILURE() <<
"expectation provided for omitted column: " << columnName;
290 throw std::logic_error (
"output column does not exist: " + columnName);
292 auto& output = userColumn.input.value();
294 if (!userColumn.expectation.has_value())
296 ADD_FAILURE() <<
"no expectation provided for output column: " << columnName;
299 auto& expectation = userColumn.expectation.value();
300 expectation.configureType (columnName, *
info.type);
301 TestUtils::checkExpectation (columnName, *output.type(), output.columnSize(), output.columnVoidData(), *expectation.type(), expectation.columnSize(), expectation.columnVoidData());
void setExpectation(const std::string &name, std::vector< std::any > values)
char data[hepevt_bytes_allocation_ATLAS]
std::vector< CP::SystematicSet > make_systematics_vector(const SystematicSet &systematics)
utility functions for working with systematics
void addColumn(const std::string &name, std::vector< std::any > data)
Class to wrap a set of SystematicVariations.
std::string to_string(const SectorProjector proj)
std::size_t columnSize(const std::string &name)
std::string makeUniqueName()
make a unique tool name to be used in unit tests
void renameContainers(IColumnarTool &tool, const std::vector< std::pair< std::string, std::string >> &renames)
rename containers in the columnar tool
@ update
an updateable column
std::unique_ptr< ColumnVectorData > m_columnData
void checkExpectation(const std::string &columnName, const std::type_info &outputType, std::size_t outputSize, const void *outputData, const std::type_info &expectationType, std::size_t expectationSize, const void *expectationData)
std::unordered_map< std::string, MyColumnData > m_userColumns
a class that holds the columnar data for a single call
a class that holds manually specified column data
ColumnarTestToolHandle * m_toolHandle
void connectColumnsToTool()
add the columns we have to the tool
static bool checkMode()
check whether we have the right mode
ColumnMapType(ColumnarTestToolHandle &val_toolHandle)
void printExpectedOutput(const std::string &columnName, const std::type_info &outputType, std::size_t outputSize, const void *outputData)