1 #include "DD4hep/DetFactoryHelper.h" 12 dd4hep::SensitiveDetector& ) {
16 double eta = args.
value<
double>(
"Eta");
17 double phi = args.
value<
double>(
"Phi");
18 double theta = 2.0 * atan(
exp(-eta));
20 double distanceZ = args.
value<
double>(
"DistZ");
21 double dist = (distance + distanceZ /
sin(theta));
22 int copyNumber = args.
value<
int>(
"Number");
24 double dz = args.
value<
double>(
"Dz");
26 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTestBeamAlgo: Parameters for position" 31 <<
"\tcopyNumber " << copyNumber;
33 <<
" NameSpace " << ns.
name();
38 double thetax = 90._deg +
theta;
39 double sthx =
sin(thetax);
44 double phix = atan2(sthx *
cos(theta) *
sin(phi), sthx *
cos(theta) *
cos(phi));
45 double thetay = 90._deg;
46 double phiy = 90._deg + phi;
47 double thetaz =
theta;
58 double r = dist *
sin(theta);
59 double xpos = r *
cos(phi);
60 double ypos = r *
sin(phi);
61 double zpos = dist *
cos(theta);
62 dd4hep::Position tran(xpos, ypos, zpos);
65 childName = ns.
name() + childName;
67 parent.placeVolume(child, copyNumber, dd4hep::Transform3D(rotation, tran));
69 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalTestBeamAlgo: " << child.name() <<
" number " << copyNumber
70 <<
" positioned in " << parent.name() <<
" at (" <<
convertCmToMm(xpos) <<
", " 73 xpos = (dist -
dz) *
sin(theta) *
cos(phi);
74 ypos = (dist -
dz) *
sin(theta) *
sin(phi);
75 zpos = (dist -
dz) *
cos(theta);
77 edm::LogInfo(
"HCalGeom") <<
"DDHCalTestBeamAlgo: Suggested Beam position " 79 <<
") and (dist, eta, phi) = (" <<
convertCmToMm(dist - dz) <<
", " << eta <<
", " << phi
dd4hep::Volume volume(const std::string &name, bool exc=true) const
constexpr NumType convertRadToDeg(NumType radians)
Sin< T >::type sin(const T &t)
T value(const std::string &name) const
Geom::Theta< T > theta() const
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
std::string_view name() const
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
constexpr NumType convertCmToMm(NumType centimeters)
static long algorithm(dd4hep::Detector &, cms::DDParsingContext &ctxt, xml_h e, dd4hep::SensitiveDetector &)
#define DECLARE_DDCMS_DETELEMENT(name, func)
std::string parentName() const
Access value of rParent child node.