Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
art
art
test
Utilities
ParameterSet_get_CLHEP_t.cc
Go to the documentation of this file.
1
#include "
art/Utilities/ParameterSetHelpers/CLHEP_ps.h
"
2
#include "
fhiclcpp/ParameterSet.h
"
3
#include "
fhiclcpp/exception.h
"
4
5
#include <iostream>
6
#include <vector>
7
8
int
9
main
()
10
{
11
12
fhicl::ParameterSet
pset;
13
14
std::vector<double>
const
clhep_vec2 = {0.6, 123098};
15
std::vector<double>
const
clhep_vec3 = {0.4, -0.5, 123.0};
16
std::vector<double>
const
clhep_lorVec = {0.4, -0.5, 123.0, 58.};
17
18
pset.
put
<std::vector<double>>(
"clhepTwoVector"
, clhep_vec2);
19
pset.
put
<std::vector<double>>(
"clhepThreeVector"
, clhep_vec3);
20
pset.
put
<std::vector<double>>(
"clhepLorVector"
, clhep_lorVec);
21
22
auto
const
vec2 = pset.
get
<CLHEP::Hep2Vector>(
"clhepTwoVector"
);
23
auto
const
vec3 = pset.
get
<CLHEP::Hep3Vector>(
"clhepThreeVector"
);
24
auto
const
lorVec = pset.
get
<CLHEP::HepLorentzVector>(
"clhepLorVector"
);
25
26
// Various errors
27
try
{
28
pset.
get
<CLHEP::Hep3Vector>(
"clhepTwoVector"
);
29
}
30
catch
(
fhicl::exception
const
&
e
) {
31
std::cout << e.what() <<
std::endl
;
32
}
33
34
try
{
35
pset.
get
<CLHEP::Hep2Vector>(
"clhepLorVector"
);
36
}
37
catch
(
fhicl::exception
const
& e) {
38
std::cout << e.what() <<
std::endl
;
39
}
40
}
CLHEP_ps.h
exception.h
ParameterSet.h
e
const double e
Definition:
gUpMuFluxGen.cxx:165
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
main
int main()
Definition:
ParameterSet_get_CLHEP_t.cc:9
fhicl::ParameterSet::put
void put(std::string const &key)
Definition:
ParameterSet.cc:266
fhicl::exception
cet::coded_exception< error, detail::translate > exception
Definition:
exception.h:33
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11