Functions
ParameterSet_get_CLHEP_t.cc File Reference
#include "art/Utilities/ParameterSetHelpers/CLHEP_ps.h"
#include "fhiclcpp/ParameterSet.h"
#include "fhiclcpp/exception.h"
#include <iostream>
#include <vector>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 9 of file ParameterSet_get_CLHEP_t.cc.

10 {
11 
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 }
const double e
T get(std::string const &key) const
Definition: ParameterSet.h:271
void put(std::string const &key)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)