21 #include <G4Transform3D.hh>
25 : G4VPVParameterisation(), m_placement(pv), m_params(*pv.data()->params)
51 auto callback = std::bind(&Geant4PlacementParameterisation::operator(),
52 this, std::placeholders::_1);
53 if ( dim.size() == 1 )
55 dim[0].delta, dim[0].count, callback);
56 else if ( dim.size() == 2 )
58 dim[0].delta, dim[0].count,
59 dim[1].delta, dim[1].count, callback);
60 else if ( dim.size() == 3 )
62 dim[0].delta, dim[0].count,
63 dim[1].delta, dim[1].count,
64 dim[2].delta, dim[2].count, callback);
75 this->m_translations.emplace_back(transform.getTranslation());
76 if ( this->m_have_rotation ) {
77 G4RotationMatrix rot = transform.inverse().getRotation();
78 this->m_rotations.emplace_back(rot);
84 const auto& dim = m_dimensions;
85 std::size_t nd = dim.size();
86 if ( !m_have_rotation ) {
87 G4ThreeVector tra = m_start.translation;
90 if (nd == 1) d1 =
copy;
91 else if (nd >= 2) d1 =
copy%dim[1].count;
92 tra = tra + (dim[0].translation * d1);
96 if (nd == 2) d2 =
copy / dim[0].count;
97 else if (nd >= 3 ) d2 =
copy%dim[2].count / dim[0].count;
98 tra = tra + (dim[1].translation * d2);
102 if ( nd == 3 ) d3 =
copy / (dim[0].count*dim[1].count);
103 tra = tra + (dim[2].translation * d3);
105 pv->SetTranslation(tra);
108 G4RotationMatrix& rot = m_rotations.at(
copy);
109 pv->SetTranslation(m_translations.at(
copy));
110 pv->SetRotation(&rot);