Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
32 constexpr
unsigned numpySigned = 0;
33 constexpr
unsigned numpyUnsigned = 1;
34 constexpr
unsigned numpyFloat = 2;
35 std::unordered_map<std::type_index, std::pair<int,unsigned>> numpyTypes;
36 numpyTypes[
typeid (
float)] = { numpyFloat,
sizeof (
float) * 8 };
37 numpyTypes[
typeid (
char)] = { std::is_signed_v<char> ? numpySigned : numpyUnsigned,
sizeof (
char) * 8 };
38 numpyTypes[
typeid (
int)] = { numpySigned,
sizeof (
int) * 8 };
46 unsigned nextIndex = 1
u;
47 for (
auto&
column : toolColumns)
50 myinfo.
index = nextIndex++;
65 for (
unsigned dim :
column.fixedDimensions)
70 if (
auto iter = numpyTypes.find (*
column.type); iter != numpyTypes.end())
75 const auto infoIdx = myinfo.
index;
76 auto [iter, success] =
m_columns.emplace (
column.name, std::move (myinfo));
78 throw std::runtime_error (
"column name already registered: " +
column.name);
84 for (
auto&
column : toolColumns)
86 if (!
column.offsetName.empty())
90 throw std::runtime_error (
"offset column name not found: " +
column.offsetName);
92 throw std::runtime_error (
"offset column has wrong type: " +
column.offsetName);
93 if (!offsetIter->second.isOffset)
94 throw std::runtime_error (
"offset column is not registered as offset: " +
column.offsetName);
113 : m_wrapper (val_wrapper),
114 m_data (m_wrapper->m_numColumns,
nullptr),
115 m_dataSize (m_wrapper->m_numColumns, 0
u),
116 m_columnIsChecked (m_wrapper->m_numColumns,
false),
117 m_columnIsFilled (m_wrapper->m_numColumns,
false)
127 throw std::runtime_error (
"unknown column name: " +
name);
130 throw std::runtime_error (
"invalid type for column: " +
name);
131 if (isConst && !
column->second.isConst)
132 throw std::runtime_error (
"assigning const vector to a non-const column: " +
name);
133 if (
column->second.index == 0)
134 throw std::runtime_error (
"column has no index assigned: " +
name);
136 throw std::runtime_error (
"column filled multiple times: " +
name);
150 throw std::runtime_error (
"unknown column name: " +
name);
154 if (isConst && !
column->second.isConst)
155 throw std::runtime_error (
"assigning const vector to a non-const column: " +
name);
156 if (
column->second.index == 0)
157 throw std::runtime_error (
"column has no index assigned: " +
name);
159 throw std::runtime_error (
"column filled multiple times: " +
name);
173 throw std::runtime_error (
"unknown column name: " +
name);
176 throw std::runtime_error (
"invalid type for column: " +
name);
177 if (!isConst &&
column->second.isConst)
178 throw std::runtime_error (
"retrieving non-const vector from a const column: " +
name);
183 return std::make_pair (0
u,
nullptr);
207 checkColumn (
const std::pair<const std::string,ColumnarToolWrapper::MyColumnInfo>&
column)
213 if (!
column.second.isOptional)
214 throw std::runtime_error (
"column not filled: " +
column.first);
220 if (
column.second.offsets)
223 if (
m_data[
column.second.offsets->second.index] ==
nullptr)
224 throw std::runtime_error (
"offset column not filled: " +
column.second.offsets->first);
225 const auto offsetIndex =
column.second.offsets->second.index;
227 expectedSize = offsetsPtr[
m_dataSize[offsetIndex]-1];
229 expectedSize *=
column.second.fixedDimensions;
231 if (
column.second.isOffset)
237 if (
column.second.isOffset)
241 throw std::runtime_error (
"offset column doesn't start with 0: " +
column.first);
252 std::vector<std::string>
result;
@ u
Enums for curvilinear frames.
std::size_t size() const noexcept
@ update
an updateable column
std::string to_string(const DetectorType &type)
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
#define ATLAS_THREAD_SAFE
Define macros for attributes used to control the static checker.
std::size_t ColumnarOffsetType
the type used for the size and offsets in the columnar data