19 using namespace angle_units::operators;
34 int createQuarter(
DDCompactView& cpv,
int xQuadrant,
int yQuadrant,
int startCopyNo);
51 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalNoTaperEndcap test: Creating an instance";
59 m_tiltAngle = nArgs[
"tiltAngle"];
60 m_invert = int(nArgs[
"invert"]);
61 m_rMin = int(nArgs[
"rMin"]);
62 m_rMax = int(nArgs[
"rMax"]);
63 m_zoffset = nArgs[
"zoffset"];
64 m_xyoffset = nArgs[
"xyoffset"];
65 m_n = int(nArgs[
"n"]);
66 m_startCopyNo = int(nArgs[
"startCopyNo"]);
67 m_incrCopyNo = int(nArgs[
"incrCopyNo"]);
68 m_childName = sArgs[
"ChildName"];
70 edm::LogVerbatim(
"HGCalGeom") <<
"Tilt Angle " << m_tiltAngle <<
" Invert " << m_invert <<
" R " << m_rMin <<
":"
71 << m_rMax <<
" Offset " << m_zoffset <<
":" << m_xyoffset <<
" N " << m_n <<
" Copy "
72 << m_startCopyNo <<
":" << m_incrCopyNo <<
" Child " << m_childName;
77 edm::LogVerbatim(
"HGCalGeom") <<
"DDHGCalNoTaperEndcap: NameSpace " << m_idNameSpace <<
"\tParent "
83 int lastCopyNo = m_startCopyNo;
87 lastCopyNo = createQuarter(cpv, 1, 1, lastCopyNo);
91 lastCopyNo = createQuarter(cpv, -1, 1, lastCopyNo);
95 lastCopyNo = createQuarter(cpv, -1, -1, lastCopyNo);
99 createQuarter(cpv, 1, -1, lastCopyNo);
103 int copyNo = startCopyNo;
104 double tiltAngle = m_tiltAngle;
105 double xphi = xQuadrant * tiltAngle;
106 double yphi = yQuadrant * tiltAngle;
107 double theta = 90._deg;
110 double phiZ = 3 *
theta;
111 double offsetZ = m_zoffset;
112 double offsetXY = m_xyoffset;
114 double offsetX = xQuadrant * 0.5 * offsetXY;
115 double offsetY = yQuadrant * 0.5 * offsetXY;
118 int rowmax(0), column(0);
120 while (
std::abs(offsetX) < m_rMax) {
125 while (
std::abs(offsetY) < m_rMax) {
129 double limit1 =
sqrt((offsetX + 0.5 * xQuadrant * offsetXY) * (offsetX + 0.5 * xQuadrant * offsetXY) +
130 (offsetY + 0.5 * yQuadrant * offsetXY) * (offsetY + 0.5 * yQuadrant * offsetXY));
131 double limit2 =
sqrt((offsetX - 0.5 * xQuadrant * offsetXY) * (offsetX - 0.5 * xQuadrant * offsetXY) +
132 (offsetY - 0.5 * yQuadrant * offsetXY) * (offsetY - 0.5 * yQuadrant * offsetXY));
134 if (limit2 > m_rMin && limit1 < m_rMax) {
136 edm::LogVerbatim(
"HGCalGeom") << m_childName <<
" copyNo = " << copyNo <<
" (" << column <<
"," << row
137 <<
"): offsetX,Y = " << offsetX <<
"," << offsetY <<
" limit=" << limit1 <<
":"
138 << limit2 <<
" rMin, rMax = " << m_rMin <<
"," << m_rMax;
145 rotstr += std::to_string(copyNo);
149 std::make_unique<DDRotationMatrix>(
159 cpv.
position(
DDName(m_childName), parentName, copyNo, tran, rotation);
161 copyNo += m_incrCopyNo;
164 edm::LogVerbatim(
"HGCalGeom") <<
" (" << column <<
"," << row <<
"): offsetX,Y = " << offsetX <<
"," << offsetY
165 <<
" is out of limit=" << limit1 <<
":" << limit2 <<
" rMin, rMax = " << m_rMin
170 yphi += yQuadrant * 2. * tiltAngle;
171 offsetY += yQuadrant * offsetXY;
177 xphi += xQuadrant * 2. * tiltAngle;
178 yphi = yQuadrant * tiltAngle;
179 offsetY = yQuadrant * 0.5 * offsetXY;
180 offsetX += xQuadrant * offsetXY;
183 edm::LogVerbatim(
"HGCalGeom") << rowmax <<
" rows and " << column <<
" columns in quadrant " << xQuadrant <<
":"
Log< level::Info, true > LogVerbatim
static AlgebraicMatrix initialize()
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDHGCalNoTaperEndcap(void)
Geom::Theta< T > theta() const
DDName is used to identify DDD entities uniquely.
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
std::string m_idNameSpace
Represents a uniquely identifyable rotation matrix.
Abs< T >::type abs(const T &t)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
void execute(DDCompactView &cpv) override
#define DEFINE_EDM_PLUGIN(factory, type, name)
int createQuarter(DDCompactView &cpv, int xQuadrant, int yQuadrant, int startCopyNo)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation