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");
46 if( fabs( rangeAngle - 360.0_deg ) < 0.001_deg ) {
47 delta = rangeAngle/double( n );
49 delta = rangeAngle/double( n - 1 );
52 LogDebug(
"DDAlgorithm") <<
"debug: Parameters for positioning:: n " 53 << n <<
" Start, Range, Delta " 56 <<
" Radius " << radius <<
" Centre " << center[0]
57 <<
", " << center[1] <<
", " << center[2]
58 <<
", Rotate solid " << rotateSolid[0] <<
", " << rotateSolid[1]
59 <<
", " << rotateSolid[2];
60 LogDebug(
"DDAlgorithm") <<
"debug: Parent " << mother.name()
61 <<
"\tChild " << child.name() <<
" NameSpace " 64 Rotation3D solidRot = Rotation3D();
65 auto sz = rotateSolid.size();
68 LogDebug(
"DDAlgorithm" ) <<
"\trotateSolid must occur 3*n times (defining n subsequent rotations)\n" 69 <<
"\t currently it appears " << sz <<
" times!\n";
71 for(
unsigned int i = 0;
i < sz;
i += 3 )
73 if((
i > 180._deg ) || (
i < 0._deg ))
75 LogDebug(
"DDAlgorithm" ) <<
"\trotateSolid \'theta\' must be in range [0,180*deg]\n" 76 <<
"\t currently it is " <<
ConvertTo(
i, deg )
77 <<
"*deg in rotateSolid[" << double(
i) <<
"]!\n";
82 solidRot =
temp * solidRot;
85 double theta = 90._deg;
86 int copy = startCopyNo;
87 double phi = startAngle;
88 for(
int i = 0;
i <
n; ++
i )
91 double phiy = phix + 90._deg;
95 string rotstr = ns.nsName( child.name()) + std::to_string( phideg * 10. );
96 auto irot = ctxt.
rotations.find( ns.prepend( rotstr ));
98 rotation = ns.rotation( ns.prepend( rotstr ));
101 double xpos = radius *
cos( phi ) + center[0];
102 double ypos = radius *
sin( phi ) + center[1];
103 double zpos = center[2];
104 Position tran( xpos, ypos, zpos );
105 mother.placeVolume( child, copy, Transform3D( rotation, tran ));
106 LogDebug(
"DDAlgorithm") <<
"test " << child.name() <<
" number " 107 << copy <<
" positioned in " << mother.name() <<
" at " 108 << 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)
Cos< T >::type cos(const T &t)
std::map< std::string, dd4hep::Rotation3D > rotations
#define ConvertTo(_x, _y)
ROOT::Math::AxisAngle DDAxisAngle