1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#include "CondFormats/RunInfo/interface/LHCInfoVectorizedFields.h"
#include "CondCore/CondDB/interface/Exception.h"
LHCInfoVectorizedFields::LHCInfoVectorizedFields() : LHCInfoVectorizedFields(ISIZE, FSIZE, TSIZE, SSIZE) {}
LHCInfoVectorizedFields::LHCInfoVectorizedFields(size_t iSize, size_t fSize, size_t tSize, size_t sSize) {
m_intParams.resize(iSize, std::vector<unsigned int>(1, 0));
m_floatParams.resize(fSize, std::vector<float>(1, 0.));
m_timeParams.resize(tSize, std::vector<unsigned long long>(1, 0ULL));
m_stringParams.resize(sSize, std::vector<std::string>(1, ""));
}
template <typename T>
const T& LHCInfoVectorizedFields::getParams(const std::vector<T>& params, size_t index) {
if (index >= params.size())
throw cond::Exception("Parameter with index " + std::to_string(index) + " is out of range.");
return params[index];
}
template const std::vector<unsigned int>& LHCInfoVectorizedFields::getParams(
const std::vector<std::vector<unsigned int>>&, size_t);
template const std::vector<float>& LHCInfoVectorizedFields::getParams(const std::vector<std::vector<float>>&, size_t);
template const std::vector<unsigned long long>& LHCInfoVectorizedFields::getParams(
const std::vector<std::vector<unsigned long long>>&, size_t);
template const std::vector<std::string>& LHCInfoVectorizedFields::getParams(
const std::vector<std::vector<std::string>>&, size_t);
template <typename T>
T& LHCInfoVectorizedFields::accessParams(std::vector<T>& params, size_t index) {
if (index >= params.size())
throw cond::Exception("Parameter with index " + std::to_string(index) + " is out of range.");
return params[index];
}
template std::vector<unsigned int>& LHCInfoVectorizedFields::accessParams(std::vector<std::vector<unsigned int>>&,
size_t);
template std::vector<float>& LHCInfoVectorizedFields::accessParams(std::vector<std::vector<float>>&, size_t);
template std::vector<unsigned long long>& LHCInfoVectorizedFields::accessParams(
std::vector<std::vector<unsigned long long>>&, size_t);
template std::vector<std::string>& LHCInfoVectorizedFields::accessParams(std::vector<std::vector<std::string>>&,
size_t);
template <typename T>
const T& LHCInfoVectorizedFields::getOneParam(const std::vector<std::vector<T>>& params, size_t index) {
if (index >= params.size())
throw cond::Exception("Parameter with index " + std::to_string(index) + " is out of range.");
const std::vector<T>& inner = params[index];
if (inner.empty())
throw cond::Exception("Parameter with index " + std::to_string(index) + " type=" + typeid(T).name() +
" has no value stored.");
return inner[0];
}
template const unsigned int& LHCInfoVectorizedFields::getOneParam(const std::vector<std::vector<unsigned int>>&,
size_t);
template const float& LHCInfoVectorizedFields::getOneParam(const std::vector<std::vector<float>>&, size_t);
template const unsigned long long& LHCInfoVectorizedFields::getOneParam(
const std::vector<std::vector<unsigned long long>>&, size_t);
template const std::string& LHCInfoVectorizedFields::getOneParam(const std::vector<std::vector<std::string>>&, size_t);
template <typename T>
void LHCInfoVectorizedFields::setOneParam(std::vector<std::vector<T>>& params, size_t index, const T& value) {
if (index >= params.size())
throw cond::Exception("Parameter with index " + std::to_string(index) + " is out of range.");
params[index] = std::vector<T>(1, value);
}
template void LHCInfoVectorizedFields::setOneParam(std::vector<std::vector<unsigned int>>& params,
size_t index,
const unsigned int& value);
template void LHCInfoVectorizedFields::setOneParam(std::vector<std::vector<float>>& params,
size_t index,
const float& value);
template void LHCInfoVectorizedFields::setOneParam(std::vector<std::vector<unsigned long long>>& params,
size_t index,
const unsigned long long& value);
template void LHCInfoVectorizedFields::setOneParam(std::vector<std::vector<std::string>>& params,
size_t index,
const std::string& value);
template <typename T>
void LHCInfoVectorizedFields::setParams(std::vector<T>& params, size_t index, const T& value) {
if (index >= params.size())
throw cond::Exception("Parameter with index " + std::to_string(index) + " is out of range.");
params[index] = value;
}
template void LHCInfoVectorizedFields::setParams(std::vector<std::vector<unsigned int>>& params,
size_t index,
const std::vector<unsigned int>& value);
template void LHCInfoVectorizedFields::setParams(std::vector<std::vector<float>>& params,
size_t index,
const std::vector<float>& value);
template void LHCInfoVectorizedFields::setParams(std::vector<std::vector<unsigned long long>>& params,
size_t index,
const std::vector<unsigned long long>& value);
template void LHCInfoVectorizedFields::setParams(std::vector<std::vector<std::string>>& params,
size_t index,
const std::vector<std::string>& value);
|