1 #include "DD4hep/DetFactoryHelper.h" 16 string childName =
args.value<
string>(
"ChildName");
19 string parentName =
args.parentName();
20 int n =
args.value<
int>(
"N");
21 int startCopyNo =
args.value<
int>(
"StartCopyNo");
22 int incrCopyNo =
args.value<
int>(
"IncrCopyNo");
23 double rangeAngle =
args.value<
double>(
"RangeAngle");
24 double startAngle =
args.value<
double>(
"StartAngle");
26 vector<double> center =
args.value<vector<double> >(
"Center");
27 bool isZPlus =
args.value<
int>(
"IsZPlus") == 1;
28 double tiltAngle =
args.value<
double>(
"TiltAngle");
29 bool isFlipped =
args.value<
int>(
"IsFlipped") == 1;
32 if (
abs(rangeAngle - 360.0_deg) < 0.001_deg) {
33 delta = rangeAngle / double(
n);
36 delta = rangeAngle / double(
n - 1);
42 edm::LogVerbatim(
"TrackerGeom") <<
"DDTrackerRingAlgo debug: Parameters for position" 43 <<
"ing:: n " <<
n <<
" Start, Range, Delta " <<
convertRadToDeg(startAngle) <<
" " 45 <<
radius <<
" Centre " << center[0] <<
", " << center[1] <<
", " << center[2];
47 edm::LogVerbatim(
"TrackerGeom") <<
"DDTrackerRingAlgo debug: Parent " << parentName <<
"\tChild " << childName
48 <<
" NameSpace " << ns.name();
50 Rotation3D flipMatrix, tiltMatrix, phiRotMatrix, globalRotMatrix;
54 edm::LogVerbatim(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " 58 flipMatrix =
makeRotation3D(90._deg, 180._deg, 90._deg, 90._deg, 180._deg, 0._deg);
62 edm::LogVerbatim(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " 65 tiltMatrix =
makeRotation3D(90._deg, 90._deg, tiltAngle, 180._deg, 90._deg - tiltAngle, 0._deg);
67 tiltMatrix *= flipMatrix;
70 edm::LogVerbatim(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " 73 tiltMatrix =
makeRotation3D(90._deg, 90._deg, tiltAngle, 0._deg, 90._deg + tiltAngle, 0._deg);
75 tiltMatrix *= flipMatrix;
80 double theta = 90._deg;
81 int copy = startCopyNo;
82 double phi = startAngle;
84 for (
int i = 0;
i <
n; ++
i) {
87 double phiy = phix + 90._deg;
89 edm::LogVerbatim(
"TrackerGeom") <<
"DDTrackerRingAlgo test: Creating a new rotation: " 95 globalRotMatrix = phiRotMatrix * tiltMatrix;
98 double xpos =
radius *
cos(phi) + center[0];
99 double ypos =
radius *
sin(phi) + center[1];
100 double zpos = center[2];
104 mother.placeVolume(
child,
copy, Transform3D(globalRotMatrix, tran));
106 <<
" positioned in " << mother.data()->GetName() <<
" at " << tran <<
" with " Log< level::Info, true > LogVerbatim
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
#define DECLARE_DDCMS_DETELEMENT(name, func)
static constexpr long s_executed
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
Namespace of DDCMS conversion namespace.
Geom::Theta< T > theta() const