27 using namespace angle_units::operators;
36 double yh1, bl1, tl1, yh2, bl2, tl2, alp,
theta, phi, xpos, ypos,
zpos;
72 HcalEndcapPar parameterLayer0(
unsigned int iphi);
73 HcalEndcapPar parameterLayer(
74 unsigned int iphi,
double rinF,
double routF,
double rinB,
double routB,
double zi,
double zo);
81 double getTrim(
unsigned int j)
const;
82 double getRout(
double z)
const;
121 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Creating an instance";
132 genMaterial = sArgs[
"MaterialName"];
133 absorberMat = sArgs[
"AbsorberMat"];
134 plasticMat = sArgs[
"PlasticMat"];
135 scintMat = sArgs[
"ScintMat"];
136 rotstr = sArgs[
"Rotation"];
137 sectors = int(nArgs[
"Sectors"]);
139 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: General material " << genMaterial <<
"\tAbsorber "
140 << absorberMat <<
"\tPlastic " << plasticMat <<
"\tScintillator " << scintMat
141 <<
"\tRotation " << rotstr <<
"\tSectors " <<
sectors;
143 zMinBlock = nArgs[
"ZMinBlock"];
144 zMaxBlock = nArgs[
"ZMaxBlock"];
145 z1Beam = nArgs[
"Z1Beam"];
146 ziDip = nArgs[
"ZiDip"];
147 dzStep = nArgs[
"DzStep"];
148 moduleThick = nArgs[
"ModuleThick"];
149 layerThick = nArgs[
"LayerThick"];
150 scintThick = nArgs[
"ScintThick"];
152 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Zmin " << zMinBlock <<
"\tZmax " << zMaxBlock <<
"\tZ1Beam "
153 << z1Beam <<
"\tZiDip " << ziDip <<
"\tDzStep " << dzStep <<
"\tModuleThick "
154 << moduleThick <<
"\tLayerThick " << layerThick <<
"\tScintThick " << scintThick;
156 rMaxFront = nArgs[
"RMaxFront"];
157 rMaxBack = nArgs[
"RMaxBack"];
158 trimLeft = nArgs[
"TrimLeft"];
159 trimRight = nArgs[
"TrimRight"];
160 tolAbs = nArgs[
"TolAbs"];
162 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: RMaxFront " << rMaxFront <<
"\tRmaxBack " << rMaxBack
163 <<
"\tTrims " << trimLeft <<
":" << trimRight <<
"\tTolAbs " << tolAbs;
165 slopeBot = nArgs[
"SlopeBottom"];
166 slopeTop = nArgs[
"SlopeTop"];
167 slopeTopF = nArgs[
"SlopeTopFront"];
168 modType = (int)(nArgs[
"ModType"]);
169 modNumber = (int)(nArgs[
"ModNumber"]);
170 layerType = (int)(nArgs[
"LayerType"]);
172 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: slopeBot " << slopeBot <<
"\tslopeTop " << slopeTop
173 <<
"\tslopeTopF " << slopeTopF <<
"\tmodType " << modType <<
"\tmodNumber " << modNumber
174 <<
"\tlayerType " << layerType;
176 layerNumber =
dbl_to_int(vArgs[
"LayerNumber"]);
178 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << layerNumber.size() <<
" layer Numbers";
179 for (
unsigned int i = 0;
i < layerNumber.size(); ++
i)
182 phiName = vsArgs[
"PhiName"];
184 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << phiName.size() <<
" phi sectors";
185 for (
unsigned int i = 0;
i < phiName.size(); ++
i)
194 idName = sArgs[
"MotherName"];
196 idOffset = int(nArgs[
"IdOffset"]);
197 modName = sArgs[
"ModName"];
199 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Parent " <<
parent().name() <<
" " << modName <<
" idName "
200 <<
idName <<
" NameSpace " << idNameSpace <<
" Offset " << idOffset;
210 edm::LogVerbatim(
"HCalGeom") <<
"==>> Constructing DDHCalEndcapModuleAlgo...";
213 constructInsideModule0(
parent(), cpv);
215 constructInsideModule(
parent(), cpv);
217 edm::LogVerbatim(
"HCalGeom") <<
"<<== End of DDHCalEndcapModuleAlgo construction ...";
223 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: \t\tInside module0";
233 int layer = layerNumber[0];
234 int layer0 = layerNumber[1];
238 for (
unsigned int iphi = 0; iphi < phiName.size(); iphi++) {
254 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " << plasName
255 <<
" of dimensions " << 0.5 * layerThick <<
", 0, 0, " << parm.
yh1 <<
", " << parm.
bl1
262 cpv.
position(glog, module, idOffset + layer + 1, r1, rot);
264 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << glog.
name() <<
" number " << idOffset + layer + 1
265 <<
" positioned in " << module.
name() <<
" at " << r1 <<
" with " <<
rot;
268 int copyNo = layer0 * 10 + layerType;
269 name = modName +
layerName[0] + phiName[iphi];
270 constructScintLayer(glog, scintThick, parm, name, copyNo, cpv);
274 double zi = zMinBlock + layerThick;
275 double zo = zi + 0.5 * dzStep;
276 double rinF, routF, rinB, routB;
277 if (modNumber == 0) {
278 rinF = zi * slopeTopF;
279 routF = (zi - z1Beam) * slopeTop;
280 rinB = zo * slopeTopF;
281 routB = (zo - z1Beam) * slopeTop;
282 }
else if (modNumber > 0) {
283 rinF = zi * slopeBot;
284 routF = zi * slopeTopF;
285 rinB = zo * slopeBot;
286 routB = zo * slopeTopF;
288 rinF = zi * slopeBot;
289 routF = (zi - z1Beam) * slopeTop;
290 rinB = zo * slopeBot;
291 routB = (zo - z1Beam) * slopeTop;
294 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Front " << zi <<
", " << rinF <<
", " << routF <<
" Back "
295 << zo <<
", " << rinB <<
", " << routB;
299 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Trim " << tolAbs <<
" Param " << parm.
yh1 <<
", " << parm.
bl1
300 <<
", " << parm.
tl1 <<
", " << parm.
yh2 <<
", " << parm.
bl2 <<
", " << parm.
tl2;
321 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " << matName
330 cpv.
position(glog, module, 1, r2, rot);
332 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << glog.
name() <<
" number 1 positioned in "
333 << module.
name() <<
" at " << r2 <<
" with " <<
rot;
339 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: \t\tInside module";
350 double zi = zMinBlock;
356 int layer = layerNumber[
i];
357 double zo = zi + 0.5 * dzStep;
359 for (
unsigned int iphi = 0; iphi < phiName.size(); iphi++) {
360 double ziAir = zo - moduleThick;
362 if (modNumber == 0) {
363 rinF = ziAir * slopeTopF;
364 rinB = zo * slopeTopF;
366 rinF = ziAir * slopeBot;
367 rinB = zo * slopeBot;
369 double routF = getRout(ziAir);
370 double routB = getRout(zo);
372 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Layer " <<
i <<
" Phi " << iphi <<
" Front " << ziAir
373 <<
", " << rinF <<
", " << routF <<
" Back " << zo <<
", " << rinB <<
", " << routB;
391 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " << matName
400 cpv.
position(glog, module, layer + 1, r1, rot);
402 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << glog.
name() <<
" number " << layer + 1
403 <<
" positioned in " << module.
name() <<
" at " << r1 <<
" with " <<
rot;
406 parm.
yh1 = 0.5 * (routF - rinB) - getTrim(iphi);
407 parm.
bl1 = 0.5 * rinB *
tan(alpha) - getTrim(iphi);
408 parm.
tl1 = 0.5 * routF *
tan(alpha) - getTrim(iphi);
423 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " << plasName
424 <<
" of dimensions " << 0.5 * layerThick <<
", 0, 0, " << parm.
yh1 <<
", "
426 << parm.
yh1 <<
", " << parm.
bl1 <<
", " << parm.
tl1 <<
", "
431 double ypos = 0.5 * (routF + rinB) - parm.
xpos;
435 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << plog.
name() <<
" number " << idOffset + layer + 1
436 <<
" positioned in " << glog.
name() <<
" at " <<
r2 <<
" with no rotation";
439 int copyNo = layer * 10 + layerType;
440 name = modName +
layerName[
i] + phiName[iphi];
441 constructScintLayer(plog, scintThick, parm, name, copyNo, cpv);
444 zi = zo - 0.5 * dzStep;
459 zo = zi + layerThick;
462 zi = zo - layerThick;
465 if (modNumber == 0) {
466 rin = zo * slopeTopF;
467 rout = (zi - z1Beam) * slopeTop;
468 }
else if (modNumber > 0) {
470 rout = zi * slopeTopF;
473 rout = (zi - z1Beam) * slopeTop;
476 edm::LogVerbatim(
"HCalGeom") <<
"ModNumber " << modNumber <<
" " << zi <<
" " << zo <<
" " << slopeTopF <<
" "
477 << slopeTop <<
" " << slopeBot <<
" " << rin <<
" " << rout <<
" " << getTrim(iphi);
479 double yh = 0.5 * (rout - rin);
480 double bl = 0.5 * rin *
tan(alpha);
481 double tl = 0.5 * rout *
tan(alpha);
482 parm.
xpos = 0.5 * (rin + rout);
483 parm.
ypos = 0.5 * (bl + tl);
484 parm.
zpos = 0.5 * (zi + zo);
485 parm.
yh1 = parm.
yh2 = yh - getTrim(iphi);
486 parm.
bl1 = parm.
bl2 = bl - getTrim(iphi);
487 parm.
tl1 = parm.
tl2 = tl - getTrim(iphi);
488 parm.
alp = atan(0.5 *
tan(alpha));
503 unsigned int iphi,
double rinF,
double routF,
double rinB,
double routB,
double zi,
double zo) {
509 edm::LogVerbatim(
"HCalGeom") <<
"Input " << iphi <<
" Front " << rinF <<
" " << routF <<
" " << zi <<
" Back " << rinB
512 parm.
yh1 = 0.5 * (routF - rinB);
513 parm.
bl1 = 0.5 * rinB *
tan(alpha);
514 parm.
tl1 = 0.5 * routF *
tan(alpha);
515 parm.
yh2 = 0.5 * (routF - rinB);
516 parm.
bl2 = 0.5 * rinB *
tan(alpha);
517 parm.
tl2 = 0.5 * routF *
tan(alpha);
519 double dy = 0.5 * (rinB + routF - rinB - routF);
520 parm.
xpos = 0.25 * (rinB + routF + rinB + routF);
522 parm.
zpos = 0.5 * (zi + zo);
523 parm.
alp = atan(0.5 *
tan(alpha));
530 double r =
sqrt(dx * dx + dy * dy);
535 parm.
theta = atan(r / (zo - zi));
536 parm.
phi = atan2(dy, dx);
572 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " << scintMat
573 <<
" of dimensions " << 0.5 * dz <<
", 0, 0, " << parm.
yh1 <<
", " << parm.
bl1 <<
", "
581 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: " << glog.name() <<
" number " <<
id <<
" positioned in "
582 << detector.
name() <<
" at (0,0,0) with no rotation";
594 double r = (modNumber >= 0) ? ((z - z1Beam) * slopeTop) : z * slopeTopF;
Log< level::Info, true > LogVerbatim
static AlgebraicMatrix initialize()
HcalEndcapPar parameterLayer(unsigned int iphi, double rinF, double routF, double rinB, double routB, double zi, double zo)
constexpr char const * layerName[numberOfLayers]
void constructInsideModule0(const DDLogicalPart &module, DDCompactView &cpv)
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
DDMaterial is used to define and access material information.
constexpr NumType convertRadToDeg(NumType radians)
std::vector< int > layerNumber
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Geom::Theta< T > theta() const
DDName is used to identify DDD entities uniquely.
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
A DDSolid represents the shape of a part.
HcalEndcapPar parameterLayer0(unsigned int iphi)
constexpr std::array< uint8_t, layerIndexSize > layer
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
std::vector< std::string > phiName
void constructInsideModule(const DDLogicalPart &module, DDCompactView &cpv)
void constructScintLayer(const DDLogicalPart &detector, double dz, DDHCalEndcapModuleAlgo::HcalEndcapPar parm, const std::string &nm, int id, DDCompactView &cpv)
Tan< T >::type tan(const T &t)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
HcalEndcapPar(double yh1v=0, double bl1v=0, double tl1v=0, double yh2v=0, double bl2v=0, double tl2v=0, double alpv=0, double thv=0, double fiv=0, double x=0, double y=0, double z=0)
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
std::vector< std::string > layerName
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
double getTrim(unsigned int j) const
void execute(DDCompactView &cpv) override
double getRout(double z) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
~DDHCalEndcapModuleAlgo() override