21 #include <G4Transform3D.hh>
25 : G4VPVParameterisation(), m_placement(pv), m_params(*pv.data()->params)
53 if ( t.x() != 0.0 && t.y() == 0.0 && t.z() == 0.0 )
m_axis = kXAxis;
54 else if ( t.x() == 0.0 && t.y() != 0.0 && t.z() == 0.0 )
m_axis = kYAxis;
55 else if ( t.x() == 0.0 && t.y() == 0.0 && t.z() != 0.0 )
m_axis = kZAxis;
58 auto callback = std::bind(&Geant4PlacementParameterisation::operator(),
59 this, std::placeholders::_1);
60 if ( dim.size() == 1 )
62 dim[0].delta, dim[0].count, callback);
63 else if ( dim.size() == 2 )
65 dim[0].delta, dim[0].count,
66 dim[1].delta, dim[1].count, callback);
67 else if ( dim.size() == 3 )
69 dim[0].delta, dim[0].count,
70 dim[1].delta, dim[1].count,
71 dim[2].delta, dim[2].count, callback);
82 this->m_translations.emplace_back(transform.getTranslation());
83 if ( this->m_have_rotation ) {
84 G4RotationMatrix rot = transform.inverse().getRotation();
85 this->m_rotations.emplace_back(rot);
91 const auto& dim = m_dimensions;
92 std::size_t nd = dim.size();
93 if ( !m_have_rotation ) {
94 G4ThreeVector tra = m_start.translation;
97 if (nd == 1) d1 =
copy;
98 else if (nd >= 2) d1 =
copy%dim[1].count;
99 tra = tra + (dim[0].translation * d1);
103 if (nd == 2) d2 =
copy / dim[0].count;
104 else if (nd >= 3 ) d2 =
copy%dim[2].count / dim[0].count;
105 tra = tra + (dim[1].translation * d2);
109 if ( nd == 3 ) d3 =
copy / (dim[0].count*dim[1].count);
110 tra = tra + (dim[2].translation * d3);
112 pv->SetTranslation(tra);
115 G4RotationMatrix& rot = m_rotations.at(
copy);
116 pv->SetTranslation(m_translations.at(
copy));
117 pv->SetRotation(&rot);