ATLAS Offline Software
AlignableTransformCnv_p1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include "CLHEP/Geometry/Transform3D.h"
9 
10 namespace {
11 
12 class Transform3DElements
13  : public HepGeom::Transform3D
14 {
15 public:
16  using HepGeom::Transform3D::setTransform;
17 };
18 
19 }
20 
21 void AlignableTransformCnv_p1::transToPers(const AlignableTransform* trans, AlignableTransform_p1* pers, MsgStream & /*log*/) {
22 
23  pers->m_tag = trans->tag();
24  pers->m_ids.reserve(trans->size());
25  pers->m_trans.reserve(12*trans->size());
26  for (const AlignableTransform::AlignTransMember& mem : trans->range()) {
27  pers->m_ids.push_back(mem.identify().get_identifier32().get_compact());
28  const HepGeom::Transform3D& tf = mem.transform();
29  pers->m_trans.push_back( tf.xx() );
30  pers->m_trans.push_back( tf.xy() );
31  pers->m_trans.push_back( tf.xz() );
32  pers->m_trans.push_back( tf.dx() );
33 
34  pers->m_trans.push_back( tf.yx() );
35  pers->m_trans.push_back( tf.yy() );
36  pers->m_trans.push_back( tf.yz() );
37  pers->m_trans.push_back( tf.dy() );
38 
39  pers->m_trans.push_back( tf.zx() );
40  pers->m_trans.push_back( tf.zy() );
41  pers->m_trans.push_back( tf.zz() );
42  pers->m_trans.push_back( tf.dz() );
43  }
44 }
45 
47 
48  trans->m_tag = pers->m_tag;
49  trans->m_vec.clear();
50  trans->m_vec.reserve(pers->m_ids.size());
51  unsigned int j = 0;
52  // Check on size for HepTransform info
53  if (pers->m_trans.size() != 12*pers->m_ids.size()) {
54  log << MSG::ERROR << "AlignableTransformCnv_p1::persToTrans Incorrect size for transform info: number of ids: "
55  << pers->m_ids.size() << " Number of transform elements: "
56  << pers->m_trans.size() << " Should be 12*nids!! "
57  << endmsg;
58  }
59  for (unsigned int i = 0; i < pers->m_ids.size(); ++i) {
60  Identifier id(pers->m_ids[i]);
61  Transform3DElements tf;
62  tf.setTransform( pers->m_trans[j + 0], // xx
63  pers->m_trans[j + 1], // xy
64  pers->m_trans[j + 2], // xz
65  pers->m_trans[j + 3], // dx
66 
67  pers->m_trans[j + 4], // yx
68  pers->m_trans[j + 5], // yy
69  pers->m_trans[j + 6], // yz
70  pers->m_trans[j + 7], // dy
71 
72  pers->m_trans[j + 8], // zx
73  pers->m_trans[j + 9], // zy
74  pers->m_trans[j + 10], // zz
75  pers->m_trans[j + 11] ); // dz
76  j += 12;
77  trans->add (id, tf);
78  }
79 }
80 
AlignableTransform_p1::m_ids
std::vector< unsigned int > m_ids
Definition: AlignableTransform_p1.h:21
AlignableTransform::tag
const std::string & tag() const
Definition: AlignableTransform.h:134
AlignableTransform_p1::m_trans
std::vector< double > m_trans
Definition: AlignableTransform_p1.h:22
AlignableTransform::m_tag
std::string m_tag
Definition: AlignableTransform.h:76
AlignableTransform_p1::m_tag
std::string m_tag
Definition: AlignableTransform_p1.h:20
AlignableTransform::size
size_t size() const
Definition: AlignableTransform.h:136
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
AlignableTransform::add
void add(const Identifier &ident, const HepGeom::Transform3D &trans)
Definition: AlignableTransform.cxx:16
AlignableTransform
Definition: AlignableTransform.h:24
AlignableTransform_p1
Definition: AlignableTransform_p1.h:16
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
AlignableTransformCnv_p1::transToPers
virtual void transToPers(const AlignableTransform *transObj, AlignableTransform_p1 *persObj, MsgStream &log)
Definition: AlignableTransformCnv_p1.cxx:21
AlignableTransform::range
AlignTransMem_crange range() const
Definition: AlignableTransform.h:108
AlignableTransform::AlignTransMember
Definition: AlignableTransform.h:32
AlignableTransform.h
AlignableTransformCnv_p1::persToTrans
virtual void persToTrans(const AlignableTransform_p1 *persObj, AlignableTransform *transObj, MsgStream &log)
Definition: AlignableTransformCnv_p1.cxx:46
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
AlignableTransformCnv_p1.h
AlignableTransform::m_vec
std::vector< AlignTransMember > m_vec
Definition: AlignableTransform.h:77
Identifier
Definition: IdentifierFieldParser.cxx:14