FWCore
ParameterSet
interface
getFixedSizeArray.h
Go to the documentation of this file.
1
#ifndef FWCore_ParameterSet_getFixedSizeArray_h
2
#define FWCore_ParameterSet_getFixedSizeArray_h
3
4
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
5
#include "
FWCore/Utilities/interface/EDMException.h
"
6
7
#include <algorithm>
8
#include <array>
9
#include <cstddef>
10
#include <string>
11
#include <vector>
12
13
namespace
edm
{
14
15
template
<
class
T, std::
size_t
N>
16
std::array<T, N>
getFixedSizeArray
(
ParameterSet
const
&
pset
,
std::string
const
&
name
) {
17
std::vector<T> vec =
pset
.getParameter<std::vector<T>>(
name
);
18
if
(vec.size() !=
N
) {
19
throw
Exception
(
errors::Configuration
)
20
<<
"The parameter '"
<<
name
<<
"' should have "
<<
N
<<
" elements, but has "
<< vec.size()
21
<<
" elements in the configuration.\n"
;
22
}
23
std::array<T, N>
a
{};
24
std::copy_n(vec.begin(),
N
,
a
.begin());
25
return
a
;
26
}
27
}
// namespace edm
28
#endif
edm
HLT enums.
Definition:
AlignableModifier.h:19
EDMException.h
N
#define N
Definition:
blowfish.cc:9
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:36
a
double a
Definition:
hdecay.h:119
Exception
Definition:
hltDiff.cc:246
Skims_PA_cff.name
name
Definition:
Skims_PA_cff.py:17
edm::getFixedSizeArray
std::array< T, N > getFixedSizeArray(ParameterSet const &pset, std::string const &name)
Definition:
getFixedSizeArray.h:16
ParameterSet.h
edm::errors::Configuration
Definition:
EDMException.h:36
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
Generated for CMSSW Reference Manual by
1.8.16