33 int n =
args.value<
int>(
"N");
34 int startCopyNo =
args.find(
"StartCopyNo") ?
args.value<
int>(
"StartCopyNo") : 1;
35 int incrCopyNo =
args.find(
"IncrCopyNo") ?
args.value<
int>(
"IncrCopyNo") : 1;
36 double rangeAngle =
args.value<
double>(
"RangeAngle");
37 double startAngle =
args.value<
double>(
"StartAngle");
39 vector<double> center =
args.value<vector<double> >(
"Center");
40 vector<double> rotateSolid =
args.value<vector<double> >(
"RotateSolid");
42 string childName =
args.value<
string>(
"ChildName");
44 childName = ns.name() + childName;
49 if( fabs( rangeAngle - 360.0_deg ) < 0.001_deg ) {
50 delta = rangeAngle/double( n );
52 delta = rangeAngle/double( n - 1 );
55 LogDebug(
"DDAlgorithm") <<
"debug: Parameters for positioning:: n " 56 << n <<
" Start, Range, Delta " 59 <<
" Radius " << radius <<
" Centre " << center[0]
60 <<
", " << center[1] <<
", " << center[2]
61 <<
", Rotate solid " << rotateSolid[0] <<
", " << rotateSolid[1]
62 <<
", " << rotateSolid[2];
63 LogDebug(
"DDAlgorithm") <<
"debug: Parent " << mother.name()
64 <<
"\tChild " << child.name() <<
" NameSpace " 67 Rotation3D solidRot = Rotation3D();
68 auto sz = rotateSolid.size();
71 LogDebug(
"DDAlgorithm" ) <<
"\trotateSolid must occur 3*n times (defining n subsequent rotations)\n" 72 <<
"\t currently it appears " << sz <<
" times!\n";
74 for(
unsigned int i = 0;
i < sz;
i += 3 )
76 if((
i > 180._deg ) || (
i < 0._deg ))
78 LogDebug(
"DDAlgorithm" ) <<
"\trotateSolid \'theta\' must be in range [0,180*deg]\n" 79 <<
"\t currently it is " <<
ConvertTo(
i, deg )
80 <<
"*deg in rotateSolid[" << double(
i) <<
"]!\n";
85 solidRot =
temp * solidRot;
88 double theta = 90._deg;
89 int copy = startCopyNo;
90 double phi = startAngle;
91 for(
int i = 0;
i <
n; ++
i )
94 double phiy = phix + 90._deg;
98 string rotstr = ns.nsName( child.name()) + std::to_string( phideg * 10. );
99 auto irot = ctxt.
rotations.find( ns.prepend( rotstr ));
101 rotation = ns.rotation( ns.prepend( rotstr ));
104 double xpos = radius *
cos( phi ) + center[0];
105 double ypos = radius *
sin( phi ) + center[1];
106 double zpos = center[2];
107 Position tran( xpos, ypos, zpos );
108 mother.placeVolume( child, copy, Transform3D( rotation, tran ));
109 LogDebug(
"DDAlgorithm") <<
"test " << child.name() <<
" number " 110 << copy <<
" positioned in " << mother.name() <<
" at " 111 << tran <<
" with " << rotstr <<
": " <<
rotation;
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
std::unordered_map< std::string, dd4hep::Rotation3D > rotations
Cos< T >::type cos(const T &t)
#define ConvertTo(_x, _y)
ROOT::Math::AxisAngle DDAxisAngle