CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CLHEP.h
Go to the documentation of this file.
1 #ifndef CondFormats_External_CLHEP_H
2 #define CondFormats_External_CLHEP_H
3 
4 #include <boost/serialization/base_object.hpp>
5 #include <boost/serialization/nvp.hpp>
6 #include <boost/serialization/split_free.hpp>
7 
8 // std::vector used in DataFormats/EcalDetId/interface/EcalContainer.h
9 #include <boost/serialization/vector.hpp>
10 #include <boost/serialization/string.hpp>
11 #include <boost/serialization/map.hpp>
12 
13 #include "CLHEP/Vector/EulerAngles.h"
14 #include "CLHEP/Vector/ThreeVector.h"
15 
16 namespace boost {
17  namespace serialization {
18 
19  /*
20  * Note regarding object tracking: all autos used here
21  * must resolve to untracked types, since we use local
22  * variables in the stack which could end up with the same
23  * address. For the moment, all types resolved by auto here
24  * are primitive types, which are untracked by default
25  * by Boost Serialization.
26  */
27 
28  // CLHEP/Vector/ThreeVector.h
29  template <class Archive>
30  void save(Archive& ar, const CLHEP::Hep3Vector& obj, const unsigned int) {
31  auto dx = obj.x();
32  auto dy = obj.y();
33  auto dz = obj.z();
34  ar& BOOST_SERIALIZATION_NVP(dx);
35  ar& BOOST_SERIALIZATION_NVP(dy);
36  ar& BOOST_SERIALIZATION_NVP(dz);
37  }
38 
39  template <class Archive>
40  void load(Archive& ar, CLHEP::Hep3Vector& obj, const unsigned int) {
41  decltype(obj.x()) dx;
42  decltype(obj.y()) dy;
43  decltype(obj.z()) dz;
44  ar& BOOST_SERIALIZATION_NVP(dx);
45  ar& BOOST_SERIALIZATION_NVP(dy);
46  ar& BOOST_SERIALIZATION_NVP(dz);
47  obj.set(dx, dy, dz);
48  }
49 
50  template <class Archive>
51  void serialize(Archive& ar, CLHEP::Hep3Vector& obj, const unsigned int v) {
52  split_free(ar, obj, v);
53  }
54 
55  // CLHEP/Vector/EulerAngles.h
56  template <class Archive>
57  void save(Archive& ar, const CLHEP::HepEulerAngles& obj, const unsigned int) {
58  auto phi_ = obj.phi();
59  auto theta_ = obj.theta();
60  auto psi_ = obj.psi();
61  ar& BOOST_SERIALIZATION_NVP(phi_);
62  ar& BOOST_SERIALIZATION_NVP(theta_);
63  ar& BOOST_SERIALIZATION_NVP(psi_);
64  }
65 
66  template <class Archive>
67  void load(Archive& ar, CLHEP::HepEulerAngles& obj, const unsigned int) {
68  decltype(obj.phi()) phi_;
69  decltype(obj.theta()) theta_;
70  decltype(obj.psi()) psi_;
71  ar& BOOST_SERIALIZATION_NVP(phi_);
72  ar& BOOST_SERIALIZATION_NVP(theta_);
73  ar& BOOST_SERIALIZATION_NVP(psi_);
74  obj.set(phi_, theta_, psi_);
75  }
76 
77  template <class Archive>
78  void serialize(Archive& ar, CLHEP::HepEulerAngles& obj, const unsigned int v) {
79  split_free(ar, obj, v);
80  }
81 
82  } // namespace serialization
83 } // namespace boost
84 
85 #endif
void serialize(Archive &ar, CLHEP::Hep3Vector &obj, const unsigned int v)
Definition: CLHEP.h:51
void load(Archive &ar, CLHEP::Hep3Vector &obj, const unsigned int)
Definition: CLHEP.h:40
void save(Archive &ar, const CLHEP::Hep3Vector &obj, const unsigned int)
Definition: CLHEP.h:30