36 int n =
args.value<
int>(
"N");
37 int startCopyNo =
args.find(
"StartCopyNo") ?
args.value<
int>(
"StartCopyNo") : 1;
38 int incrCopyNo =
args.find(
"IncrCopyNo") ?
args.value<
int>(
"IncrCopyNo") : 1;
39 double rangeAngle =
args.value<
double>(
"RangeAngle");
40 double startAngle =
args.value<
double>(
"StartAngle");
42 vector<double> center =
args.value<vector<double> >(
"Center");
43 vector<double> rotateSolid =
args.value<vector<double> >(
"RotateSolid");
45 string childName =
args.value<
string>(
"ChildName");
47 childName = ns.name() + childName;
52 if( fabs( rangeAngle - 360.0_deg ) < 0.001_deg ) {
53 delta = rangeAngle/double( n );
55 delta = rangeAngle/double( n - 1 );
58 LogDebug(
"DDAlgorithm") <<
"debug: Parameters for positioning:: n " 59 << n <<
" Start, Range, Delta " 62 <<
" Radius " << radius <<
" Centre " << center[0]
63 <<
", " << center[1] <<
", " << center[2]
64 <<
", Rotate solid " << rotateSolid[0] <<
", " << rotateSolid[1]
65 <<
", " << rotateSolid[2];
66 LogDebug(
"DDAlgorithm") <<
"debug: Parent " << mother.name()
67 <<
"\tChild " << child.name() <<
" NameSpace " 70 Rotation3D solidRot = Rotation3D();
71 auto sz = rotateSolid.size();
74 LogDebug(
"DDAlgorithm" ) <<
"\trotateSolid must occur 3*n times (defining n subsequent rotations)\n" 75 <<
"\t currently it appears " << sz <<
" times!\n";
77 for(
unsigned int i = 0;
i < sz;
i += 3 )
79 if((
i > 180._deg ) || (
i < 0._deg ))
81 LogDebug(
"DDAlgorithm" ) <<
"\trotateSolid \'theta\' must be in range [0,180*deg]\n" 83 <<
"*deg in rotateSolid[" << double(
i) <<
"]!\n";
88 solidRot =
temp * solidRot;
91 double theta = 90._deg;
92 int copy = startCopyNo;
93 double phi = startAngle;
94 for(
int i = 0;
i <
n; ++
i )
97 double phiy = phix + 90._deg;
101 string rotstr = ns.nsName( child.name()) + std::to_string( phideg * 10. );
102 auto irot = ctxt.
rotations.find( ns.prepend( rotstr ));
104 rotation = ns.rotation( ns.prepend( rotstr ));
107 double xpos = radius *
cos( phi ) + center[0];
108 double ypos = radius *
sin( phi ) + center[1];
109 double zpos = center[2];
110 Position tran( xpos, ypos, zpos );
111 mother.placeVolume( child, copy, Transform3D( rotation, tran ));
112 LogDebug(
"DDAlgorithm") <<
"test " << child.name() <<
" number " 113 << copy <<
" positioned in " << mother.name() <<
" at " 114 << tran <<
" with " << rotstr <<
": " <<
rotation;
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
constexpr NumType convertRadToDeg(NumType radians)
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
tbb::concurrent_unordered_map< std::string, dd4hep::Rotation3D > rotations
Cos< T >::type cos(const T &t)
ROOT::Math::AxisAngle DDAxisAngle