1 #include "DD4hep/DetFactoryHelper.h"
8 using namespace angle_units::operators;
14 double eta = args.
value<
double>(
"Eta");
15 double phi = args.
value<
double>(
"Phi");
16 double theta = 2.0 * atan(
exp(-eta));
18 double distanceZ = args.
value<
double>(
"DistZ");
19 double dist = (distance + distanceZ /
sin(theta));
20 int copyNumber = args.
value<
int>(
"Number");
22 double dz = args.
value<
double>(
"Dz");
24 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTestBeamAlgo: Parameters for positioning-- Eta " << eta <<
"\tPhi "
30 <<
" NameSpace " << ns.
name();
35 double thetax = 90._deg +
theta;
36 double sthx =
sin(thetax);
41 double phix = atan2(sthx *
cos(theta) *
sin(phi), sthx *
cos(theta) *
cos(phi));
42 double thetay = 90._deg;
43 double phiy = 90._deg + phi;
44 double thetaz =
theta;
55 double r = dist *
sin(theta);
56 double xpos = r *
cos(phi);
57 double ypos = r *
sin(phi);
58 double zpos = dist *
cos(theta);
61 childName = ns.
prepend(childName);
63 parent.placeVolume(child, copyNumber, dd4hep::Transform3D(rotation, tran));
65 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTestBeamAlgo: " << child.name() <<
" number " << copyNumber
66 <<
" positioned in " << parent.name() <<
" at (" <<
cms::convert2mm(xpos) <<
", "
70 xpos = (dist -
dz) *
sin(theta) *
cos(phi);
71 ypos = (dist -
dz) *
sin(theta) *
sin(phi);
72 zpos = (dist -
dz) *
cos(theta);
Log< level::Info, true > LogVerbatim
dd4hep::Volume volume(const std::string &name, bool exc=true) const
constexpr NumType convertRadToDeg(NumType radians)
constexpr NumType convert2mm(NumType length)
Sin< T >::type sin(const T &t)
T value(const std::string &name) const
Geom::Theta< T > theta() const
Exp< T >::type exp(const T &t)
DDRotationMatrix makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
std::string_view name() const
#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)
std::string prepend(const std::string &) const
Log< level::Info, false > LogInfo
std::string parentName() const
Access value of rParent child node.