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>
17
getFixedSizeArray
(
ParameterSet
const
&
pset
,
std::string
const
&
name
) {
18
std::vector<T> vec = pset.
getParameter
<std::vector<T>>(
name
);
19
if
(vec.size() !=
N
) {
20
throw
Exception
(
errors::Configuration
)
21
<<
"The parameter '"
<< name
22
<<
"' should have "
<<
N
<<
" elements, but has "
<< vec.size()
23
<<
" elements in the configuration.\n"
;
24
}
25
std::array<T, N>
a
{};
26
std::copy_n(vec.begin(),
N
,
a
.begin());
27
return
a
;
28
}
29
}
30
#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:37
EDMException.h
edm::getFixedSizeArray
std::array< T, N > getFixedSizeArray(ParameterSet const &pset, std::string const &name)
Definition:
getFixedSizeArray.h:17
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