Main Page
Namespaces
Classes
Package Documentation
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::ParameterSet::getParameter
T getParameter(std::string const &) const
Exception
Definition:
hltDiff.cc:292
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
ParameterSet.h
edm::errors::Configuration
Definition:
EDMException.h:36
EDMException.h
edm::getFixedSizeArray
std::array< T, N > getFixedSizeArray(ParameterSet const &pset, std::string const &name)
Definition:
getFixedSizeArray.h:16
N
#define N
Definition:
blowfish.cc:9
edm
HLT enums.
Definition:
AlignableModifier.h:17
a
double a
Definition:
hdecay.h:121
edm::ParameterSet
Definition:
ParameterSet.h:36
dataset.name
name
Definition:
dataset.py:45
Generated for CMSSW Reference Manual by
1.8.11