1 #include "DD4hep/DetFactoryHelper.h" 19 string childName =
args.value<
string>(
"ChildName");
22 string parentName =
args.parentName();
23 int n =
args.value<
int>(
"N");
24 int startCopyNo =
args.value<
int>(
"StartCopyNo");
25 int incrCopyNo =
args.value<
int>(
"IncrCopyNo");
26 double rangeAngle =
args.value<
double>(
"RangeAngle");
27 double startAngle =
args.value<
double>(
"StartAngle");
29 vector<double> center =
args.value<vector<double> >(
"Center");
30 bool isZPlus =
args.value<
int>(
"IsZPlus") == 1;
31 double tiltAngle =
args.value<
double>(
"TiltAngle");
32 bool isFlipped =
args.value<
int>(
"IsFlipped") == 1;
35 if(
abs(rangeAngle - 360.0_deg) < 0.001_deg) {
36 delta = rangeAngle/double(n);
39 delta = rangeAngle/double(n-1);
45 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo debug: Parameters for position" 46 <<
"ing:: n " << n <<
" Start, Range, Delta " 49 <<
" Radius " << radius <<
" Centre " << center[0]
50 <<
", " << center[1] <<
", "<< center[2];
52 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo debug: Parent " << parentName
53 <<
"\tChild " << childName <<
" NameSpace " 56 Rotation3D flipMatrix, tiltMatrix, phiRotMatrix, globalRotMatrix;
60 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " 64 flipMatrix =
makeRotation3D(90._deg, 180._deg, 90._deg, 90._deg, 180._deg, 0._deg);
68 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " 72 tiltMatrix =
makeRotation3D(90._deg, 90._deg, tiltAngle, 180._deg, 90._deg - tiltAngle, 0._deg);
73 if(isFlipped) { tiltMatrix *= flipMatrix; }
76 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " 80 tiltMatrix =
makeRotation3D(90._deg, 90._deg, tiltAngle, 0._deg, 90._deg + tiltAngle, 0._deg);
81 if(isFlipped) { tiltMatrix *= flipMatrix; }
85 double theta = 90._deg;
86 int copy = startCopyNo;
87 double phi = startAngle;
89 for(
int i = 0;
i <
n; ++
i) {
92 double phiy = phix + 90._deg;
94 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " 101 globalRotMatrix = phiRotMatrix * tiltMatrix;
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);
110 mother.placeVolume(child, copy, Transform3D(globalRotMatrix, tran));
111 LogDebug(
"TrackerGeom") <<
"DDTrackerRingAlgo test " << child <<
" number " 112 << copy <<
" positioned in " << mother <<
" at " 113 << tran <<
" with " << globalRotMatrix;
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)
static constexpr long s_executed
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
Namespace of DDCMS conversion namespace.
#define DECLARE_DDCMS_DETELEMENT(name, func)