8 #include "DD4hep/DetFactoryHelper.h"
9 #include "DD4hep/Printout.h"
15 using namespace cms_units::operators;
26 std::vector<double> bladeZShift;
36 startCopyNo = args.
find(
"StartCopyNo") ? args.
value<
int>(
"StartCopyNo") : 0;
37 nBlades = args.
value<
int>(
"NumberOfBlades");
38 bladeAngle = args.
value<
double>(
"BladeAngle");
39 bladeTilt = args.
value<
double>(
"BladeTilt");
40 zPlane = args.
value<
double>(
"BladeCommonZ");
41 anchorR = args.
value<
double>(
"AnchorRadius");
43 bladeZShift = args.
value<std::vector<double> >(
"BladeZShift");
50 childName = ns.
prepend(childName);
54 edm::LogVerbatim(
"PixelGeom") <<
"DDPixFwdDiskAlgo debug: Parent " << mother.name() <<
"\tChild " << child.name()
55 <<
" NameSpace " << ns.
name() <<
"\tRot Name " << rotName <<
"\tCopyNo (Start/Total) "
56 << startCopyNo <<
", " << nBlades <<
"\tAngles " <<
convertRadToDeg(bladeAngle) <<
", "
57 <<
convertRadToDeg(bladeTilt) <<
"\tZshifts " << zPlane <<
"\tAnchor Radius "
60 for (
int iBlade = 0; iBlade < nBlades; ++iBlade) {
61 edm::LogVerbatim(
"PixelGeom") <<
"DDPixFwdDiskAlgo: Blade " << iBlade <<
" flag " << flagString[iBlade]
62 <<
" zshift " << bladeZShift[iBlade];
65 double deltaPhi = 360.0_deg / (double)nBlades;
66 int copyNo = startCopyNo;
69 for (
int iBlade = 0; iBlade < nBlades; ++iBlade) {
70 if (flagString[iBlade] == flagSelector[0]) {
72 double phi = (iBlade + 0.5) *
deltaPhi;
73 double phix = atan2(
sin(phi) *
cos(bladeAngle),
cos(phi) *
cos(bladeAngle));
74 double thetx = acos(-
sin(bladeAngle));
75 double phiy = atan2((
cos(phi) *
cos(bladeTilt) +
sin(phi) *
sin(bladeAngle) *
sin(bladeTilt)),
76 (-
sin(phi) *
cos(bladeTilt) +
cos(phi) *
sin(bladeAngle) *
sin(bladeTilt)));
78 double thety = acos(
cos(bladeAngle) *
sin(bladeTilt));
79 double phiz = atan2((-
cos(phi) *
sin(bladeTilt) +
sin(phi) *
sin(bladeAngle) *
cos(bladeTilt)),
80 (
sin(phi) *
sin(bladeTilt) +
cos(phi) *
sin(bladeAngle) *
cos(bladeTilt)));
82 double thetz = acos(
cos(bladeAngle) *
cos(bladeTilt));
84 auto rot = dd4hep::Rotation3D();
97 <<
cos(phi) *
cos(bladeAngle) <<
", "
98 << (-
sin(phi) *
cos(bladeTilt) +
cos(phi) *
sin(bladeAngle) *
sin(bladeTilt))
100 << (
sin(phi) *
sin(bladeTilt) +
cos(phi) *
sin(bladeAngle) *
cos(bladeTilt))
101 <<
", " <<
sin(phi) *
cos(bladeAngle) <<
", "
102 << (
cos(phi) *
cos(bladeTilt) +
sin(phi) *
sin(bladeAngle) *
sin(bladeTilt))
104 << (-
cos(phi) *
sin(bladeTilt) +
sin(phi) *
sin(bladeAngle) *
cos(bladeTilt))
105 <<
", " << -
sin(bladeAngle) <<
", " <<
cos(bladeAngle) *
sin(bladeTilt) <<
", "
106 <<
cos(bladeAngle) *
cos(bladeTilt);
109 double xpos = anchorR * (-
sin(phi) *
cos(bladeTilt) +
cos(phi) *
sin(bladeAngle) *
sin(bladeTilt));
110 double ypos = anchorR * (
cos(phi) *
cos(bladeTilt) +
sin(phi) *
sin(bladeAngle) *
sin(bladeTilt));
111 double zpos = anchorR * (
cos(bladeAngle) *
sin(bladeTilt)) + zPlane + bladeZShift[iBlade];
114 pv = mother.placeVolume(child, copyNo, dd4hep::Transform3D(
rot, tran));
115 edm::LogVerbatim(
"PixelGeom") <<
"DDPixFwdDiskAlgo test: " << pv.name() <<
": " << childName <<
" number "
116 << copyNo <<
" positioned in " << mother.name() <<
" at " << tran <<
" with "
Log< level::Info, true > LogVerbatim
dd4hep::Volume volume(const std::string &name, bool exc=true) const
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
std::unordered_map< std::string, dd4hep::Rotation3D > rotations
T value(const std::string &name) const
std::string to_string(const V &value)
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
std::string_view name() const
static const std::string & rotName(const T &rot, const cms::DDParsingContext &context)
#define DECLARE_DDCMS_DETELEMENT(name, func)
static constexpr long s_executed
dd4hep::PlacedVolume PlacedVolume
Cos< T >::type cos(const T &t)
std::string prepend(const std::string &) const
bool find(const std::string &name) const
Check the existence of an argument by name.
std::string parentName() const
Access value of rParent child node.