ATLAS Offline Software
Loading...
Searching...
No Matches
DetCondKeyTransCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9#include "CLHEP/Geometry/Transform3D.h"
10
11namespace {
12
13
14class Transform3DComponents
15 : public HepGeom::Transform3D
16{
17public:
18 using HepGeom::Transform3D::setTransform;
19};
20
21
22}
23
24void 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& transk : trans->keyTrans()) {
30 pers->m_keys.push_back(transk.first);
31 const HepGeom::Transform3D& tf = transk.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
49void 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
static Double_t sz
virtual void persToTrans(const DetCondKeyTrans_p1 *persObj, DetCondKeyTrans *transObj, MsgStream &log)
virtual void transToPers(const DetCondKeyTrans *transObj, DetCondKeyTrans_p1 *persObj, MsgStream &log)
std::vector< double > m_trans
std::vector< std::string > m_keys
Class to hold set of HepGeom::Transform3D keyed by string value for storage in the conditions DB typi...
void setTransform(const std::string &key, const HepGeom::Transform3D &trans)
const KeyTrans & keyTrans() const