ATLAS Offline Software
DetCondKeyTransCnv_p1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
8 
9 #include "CLHEP/Geometry/Transform3D.h"
10 
11 namespace {
12 
13 
14 class Transform3DComponents
15  : public HepGeom::Transform3D
16 {
17 public:
18  using HepGeom::Transform3D::setTransform;
19 };
20 
21 
22 }
23 
24 void DetCondKeyTransCnv_p1::transToPers(const DetCondKeyTrans* trans, DetCondKeyTrans_p1* pers, MsgStream &/*log*/)
25 {
26  size_t sz = trans->keyTrans().size();
27  pers->m_trans.reserve(12*sz);
28 
29  for (const DetCondKeyTrans::KeyTrans::value_type& trans : trans->keyTrans()) {
30  pers->m_keys.push_back(trans.first);
31  const HepGeom::Transform3D& tf = trans.second;
32  pers->m_trans.push_back( tf.xx() );
33  pers->m_trans.push_back( tf.xy() );
34  pers->m_trans.push_back( tf.xz() );
35  pers->m_trans.push_back( tf.dx() );
36 
37  pers->m_trans.push_back( tf.yx() );
38  pers->m_trans.push_back( tf.yy() );
39  pers->m_trans.push_back( tf.yz() );
40  pers->m_trans.push_back( tf.dy() );
41 
42  pers->m_trans.push_back( tf.zx() );
43  pers->m_trans.push_back( tf.zy() );
44  pers->m_trans.push_back( tf.zz() );
45  pers->m_trans.push_back( tf.dz() );
46  }
47 }
48 
49 void DetCondKeyTransCnv_p1::persToTrans(const DetCondKeyTrans_p1* pers, DetCondKeyTrans* trans, MsgStream &/*log*/) {
50 
51  // Copy stored vec into map
52  unsigned int j = 0;
53  for (unsigned int i = 0; i < pers->m_keys.size(); ++i) {
54  Transform3DComponents tf;
55  tf.setTransform( pers->m_trans[j + 0], // xx
56  pers->m_trans[j + 1], // xy
57  pers->m_trans[j + 2], // xz
58  pers->m_trans[j + 3], // dx
59 
60  pers->m_trans[j + 4], // yx
61  pers->m_trans[j + 5], // yy
62  pers->m_trans[j + 6], // yz
63  pers->m_trans[j + 7], // dy
64 
65  pers->m_trans[j + 8], // zx
66  pers->m_trans[j + 9], // zy
67  pers->m_trans[j + 10], // zz
68  pers->m_trans[j + 11] ); // dz
69  j += 12;
70  trans->setTransform (pers->m_keys[i], tf);
71  }
72 }
73 
DetCondKeyTrans::keyTrans
const KeyTrans & keyTrans() const
Definition: DetCondKeyTrans.cxx:45
fitman.sz
sz
Definition: fitman.py:527
DetCondKeyTrans
Class to hold set of HepGeom::Transform3D keyed by string value for storage in the conditions DB typi...
Definition: DetCondKeyTrans.h:27
DetCondKeyTrans_p1::m_trans
std::vector< double > m_trans
Definition: DetCondKeyTrans_p1.h:21
lumiFormat.i
int i
Definition: lumiFormat.py:85
DetCondKeyTrans_p1
Definition: DetCondKeyTrans_p1.h:16
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
DetCondKeyTrans.h
DetCondKeyTransCnv_p1::persToTrans
virtual void persToTrans(const DetCondKeyTrans_p1 *persObj, DetCondKeyTrans *transObj, MsgStream &log)
Definition: DetCondKeyTransCnv_p1.cxx:49
DetCondKeyTransCnv_p1::transToPers
virtual void transToPers(const DetCondKeyTrans *transObj, DetCondKeyTrans_p1 *persObj, MsgStream &log)
Definition: DetCondKeyTransCnv_p1.cxx:24
DetCondKeyTrans::setTransform
void setTransform(const std::string &key, const HepGeom::Transform3D &trans)
Definition: DetCondKeyTrans.h:64
DetCondKeyTransCnv_p1.h
DetCondKeyTrans_p1::m_keys
std::vector< std::string > m_keys
Definition: DetCondKeyTrans_p1.h:20