27 using namespace angle_units::operators;
76 int getLayer(
unsigned int i,
unsigned int j)
const;
77 double getThick(
unsigned int i)
const {
return thick[
i]; }
78 double getTrim(
unsigned int i,
unsigned int j)
const;
86 int getPhi()
const {
return phiSections; }
110 void parameterLayer(
int iphi,
129 void parameterLayer0(
int mod,
306 nEndcap = int(nArgs[
"Endcap"]);
308 rotns = sArgs[
"RotNameSpace"];
312 zEnd = nArgs[
"ZEnd"];
318 ziDip = nArgs[
"ZiDip"];
321 double gap = nArgs[
"Gap"];
322 double z1 = nArgs[
"Z1"];
323 double r1 = nArgs[
"R1"];
324 rout = nArgs[
"Rout"];
326 drEnd = nArgs[
"DrEnd"];
327 double etamin = nArgs[
"Etamin"];
333 <<
", " <<
nsectortot <<
"\tEndcaps " <<
nEndcap <<
"\tRotation matrix for half "
336 <<
" z0Beam " <<
z0Beam <<
" ziDip " <<
ziDip <<
" dzStep " <<
dzStep <<
" Gap " << gap
337 <<
" z1 " << z1 <<
"\n\tr1 " << r1 <<
" rout " <<
rout <<
" HeboxDepth " <<
heboxDepth
338 <<
" drEnd " <<
drEnd <<
"\tetamin " << etamin <<
" Bottom angle " <<
angBot
355 <<
"\triKink " <<
riKink <<
"\triDip " <<
riDip <<
"\n\troDip " <<
roDip <<
"\tRotation "
362 modules = int(nArgs[
"Modules"]);
369 modName = vsArgs[
"ModuleName"];
370 modMat = vsArgs[
"ModuleMat"];
373 thick = vArgs[
"ModuleThick"];
392 for (
int j = 0;
j < layerN[
i];
j++) {
396 for (
int j = 0;
j < layerN[
i];
j++) {
400 for (
int j = 0;
j < layerN[
i];
j++) {
404 for (
int j = 0;
j < layerN[
i];
j++) {
408 for (
int j = 0;
j < layerN[
i];
j++) {
412 for (
int j = 0;
j < layerN[
i];
j++) {
423 layers = int(nArgs[
"Layers"]);
440 <<
"\tScint.Thick " <<
scintT[
i];
520 idName = sArgs[
"MotherName"];
549 edm::LogVerbatim(
"HCalGeom") <<
"<<== End of DDHCalEndcapAlgo construction ...";
561 for (
int i = 0;
i < 3;
i++)
584 std::vector<double> pgonZ, pgonRmin, pgonRmax;
603 pgonRmax.emplace_back(
getRout());
606 pgonRmax.emplace_back(
getRout());
625 << pgonZ.size() <<
" sections";
626 for (
unsigned int i = 0;
i < pgonZ.size();
i++)
627 edm::LogVerbatim(
"HCalGeom") <<
"\t\tZ = " << pgonZ[
i] <<
"\tRmin = " << pgonRmin[
i] <<
"\tRmax = " << pgonRmax[
i];
639 << parentName <<
" at " << r0 <<
" with " <<
rot;
648 <<
"positioned in " << parentName <<
" at " << r0 <<
" with " <<
rot;
654 std::vector<double> pgonZMod, pgonRminMod, pgonRmaxMod;
655 for (
unsigned int i = 0;
i < (pgonZ.size() - 1);
i++) {
657 pgonRminMod.emplace_back(pgonRmin[
i]);
658 pgonRmaxMod.emplace_back(pgonRmax[i]);
667 << pgonZMod.size() <<
" sections ";
668 for (
unsigned int i = 0;
i < pgonZMod.size();
i++)
669 edm::LogVerbatim(
"HCalGeom") <<
"\t\tZ = " << pgonZMod[
i] <<
"\tRmin = " << pgonRminMod[
i]
670 <<
"\tRmax = " << pgonRmaxMod[
i];
678 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: " << genlogich.
name() <<
" number 1 positioned in "
679 << genlogic.
name() <<
" at (0,0," << -
getDzShift() <<
") with no rotation";
689 <<
convertRadToDeg(alpha) <<
" and with " << pgonZMod.size() <<
" sections";
690 for (
unsigned int i = 0;
i < pgonZMod.size();
i++)
691 edm::LogVerbatim(
"HCalGeom") <<
"\t\tZ = " << pgonZMod[
i] <<
"\tRmin = " << pgonRminMod[
i]
692 <<
"\tRmax = " << pgonRmaxMod[
i];
706 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: Creating a new rotation " << rotstr <<
"\t 90,"
709 rotation =
DDrot(
DDName(rotstr,
rotns), 90._deg, phi, 90._deg, (90._deg + phi), 0, 0);
716 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: " << seclogic.
name() <<
" number " <<
ii + 1 <<
" positioned in "
726 std::vector<double> pgonZBack, pgonRminBack, pgonRmaxBack;
730 pgonZBack.emplace_back(
getZEnd());
740 << pgonZBack.size() <<
" sections";
741 for (
unsigned int i = 0;
i < pgonZBack.size();
i++)
742 edm::LogVerbatim(
"HCalGeom") <<
"\t\tZ = " << pgonZBack[
i] <<
"\tRmin = " << pgonRminBack[
i]
743 <<
"\tRmax = " << pgonRmaxBack[
i];
753 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: " << glog.
name() <<
" number 1 positioned in " << genlogic.
name()
754 <<
" at (0,0,0) with no rotation";
777 std::vector<double> pgonZ, pgonRmin, pgonRmax;
780 pgonZ.emplace_back(zf);
785 pgonRmax.emplace_back(
getRout());
794 pgonRmax.emplace_back(
getRout());
795 pgonZ.emplace_back(pgonZ[1] + deltaz);
796 pgonRmin.emplace_back(pgonRmin[1]);
811 for (
unsigned int k = 0;
k < pgonZ.size();
k++)
813 <<
"\tRmax = " << pgonRmax[
k];
821 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: " << glog.
name() <<
" number " <<
i + 1 <<
" positioned in "
822 << sector.
name() <<
" at (0,0,0) with no rotation";
848 edm::LogVerbatim(
"HCalGeom") <<
"Input " << iphi <<
" " << layer <<
" " << iphi <<
" Alpha "
868 yh = 0.5 * (rout - rin);
869 bl = 0.5 * rin *
tan(alpha);
870 tl = 0.5 * rout *
tan(alpha);
871 xpos = 0.5 * (rin +
rout);
872 ypos = 0.5 * (bl + tl);
873 zpos = 0.5 * (zi + zo);
877 alp = atan(0.5 *
tan(alpha));
886 <<
" Position " << xpos <<
" " << ypos <<
" " << zpos;
914 edm::LogVerbatim(
"HCalGeom") <<
"Input " << iphi <<
" Front " << rinF <<
" " << routF <<
" " << zi <<
" Back " << rinB
918 yh1 = 0.5 * (routF - rinB);
919 bl1 = 0.5 * rinB *
tan(alpha);
920 tl1 = 0.5 * routF *
tan(alpha);
921 yh2 = 0.5 * (routF - rinB);
922 bl2 = 0.5 * rinB *
tan(alpha);
923 tl2 = 0.5 * routF *
tan(alpha);
924 double dx = 0.25 * (bl2 + tl2 - bl1 - tl1);
925 double dy = 0.5 * (rinB + routF - rinB - routF);
926 xpos = 0.25 * (rinB + routF + rinB + routF);
927 ypos = 0.25 * (bl2 + tl2 + bl1 + tl1);
928 zpos = 0.5 * (zi + zo);
929 alp = atan(0.5 *
tan(alpha));
937 double r =
sqrt(dx * dx + dy * dy);
938 theta = atan(r / (zo - zi));
942 edm::LogVerbatim(
"HCalGeom") <<
"Output Dimensions " << yh1 <<
" " << bl1 <<
" " << tl1 <<
" " << yh2 <<
" " << bl2
944 <<
convertRadToDeg(phi) <<
" Position " << xpos <<
" " << ypos <<
" " << zpos;
965 double xpos, ypos, zpos;
968 for (
int iphi = 0; iphi <
getPhi(); iphi++) {
969 double yh, bl, tl, alp;
973 DDSolidFactory::trap(
DDName(name,
idNameSpace), 0.5 *
getLayerT(layer), 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
977 <<
" of dimensions " << 0.5 *
getLayerT(layer) <<
", 0, 0, " << yh <<
", " << bl
978 <<
", " << tl <<
", " <<
convertRadToDeg(alp) <<
", " << yh <<
", " << bl <<
", " << tl
989 <<
" positioned in " << module.
name() <<
" at " << r1 <<
" with " <<
rot;
1001 double rinF, routF, rinB, routB;
1015 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: Module " << mod <<
" Front " << zi <<
", " << rinF <<
", " << routF
1016 <<
" Back " << zo <<
", " << rinB <<
", " << routB;
1019 double yh1, bl1, tl1, yh2, bl2, tl2,
theta,
phi, alp;
1020 parameterLayer(0, rinF, routF, rinB, routB, zi, zo, yh1, bl1, tl1, yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
1024 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: Trim " << fact <<
" Param " << yh1 <<
", " << bl1 <<
", " << tl1
1025 <<
", " << yh2 <<
", " << bl2 <<
", " << tl2;
1033 name = module.
name().
name() +
"Absorber";
1035 DDName(name,
idNameSpace), 0.5 *
getThick(mod), theta, phi, yh1, bl1, tl1, alp, yh2, bl2, tl2, alp);
1039 <<
convertRadToDeg(phi) <<
", " << yh1 <<
", " << bl1 <<
", " << tl1 <<
", "
1040 <<
convertRadToDeg(alp) <<
", " << yh2 <<
", " << bl2 <<
", " << tl2 <<
", "
1047 cpv.
position(glog, module, 1, r2, rot);
1051 <<
" at " << r2 <<
" with " <<
rot;
1079 for (
int iphi = 0; iphi <
getPhi(); iphi++) {
1097 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: Layer " <<
i <<
" Phi " << iphi <<
" Front " << ziAir <<
", "
1098 << rinF <<
", " << routF <<
" Back " << zo <<
", " << rinB <<
", " << routB;
1101 double yh1, bl1, tl1, yh2, bl2, tl2,
theta,
phi, alp;
1102 double xpos, ypos, zpos;
1104 iphi, rinF, routF, rinB, routB, ziAir, zo, yh1, bl1, tl1, yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
1108 DDName(name,
idNameSpace), 0.5 *
getThick(mod), theta, phi, yh1, bl1, tl1, alp, yh2, bl2, tl2, alp);
1113 <<
convertRadToDeg(phi) <<
", " << yh1 <<
", " << bl1 <<
", " << tl1 <<
", "
1114 <<
convertRadToDeg(alp) <<
", " << yh2 <<
", " << bl2 <<
", " << tl2 <<
", "
1121 cpv.
position(glog, module, layer + 1, r1, rot);
1125 <<
" positioned in " << module.
name() <<
" at " << r1 <<
" with " <<
rot;
1129 double yh = 0.5 * (routF - rinB) -
getTrim(mod, iphi);
1130 double bl = 0.5 * rinB *
tan(alpha) -
getTrim(mod, iphi);
1131 double tl = 0.5 * routF *
tan(alpha) -
getTrim(mod, iphi);
1134 DDName(name,
idNameSpace), 0.5 *
getLayerT(layer), 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
1138 <<
" of dimensions " << 0.5 *
getLayerT(layer) <<
", 0, 0, " << yh <<
", " << bl
1139 <<
", " << tl <<
", " <<
convertRadToDeg(alp) <<
", " << yh <<
", " << bl <<
", "
1145 ypos = 0.5 * (routF + rinB) - xpos;
1151 <<
" positioned in " << glog.
name() <<
" at " << r2 <<
" with no rotation";
1177 DDSolid solid =
DDSolidFactory::trap(
DDName(name,
idNameSpace), 0.5 * dz, 0, 0, yh, bl, tl, alp, yh, bl, tl, alp);
1181 <<
" of dimensions " << 0.5 * dz <<
", 0, 0, " << yh <<
", " << bl <<
", " << tl <<
", "
1182 <<
convertRadToDeg(alp) <<
", " << yh <<
", " << bl <<
", " << tl <<
", "
1191 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapAlgo: " << glog.name() <<
" number " <<
id <<
" positioned in "
1192 << detector.
name() <<
" at (0,0,0) with no rotation";
double getTrim(unsigned int i, unsigned int j) const
Log< level::Info, true > LogVerbatim
static AlgebraicMatrix initialize()
void execute(DDCompactView &cpv) override
double getZmaxBlock(unsigned i) const
double getZiL0Nose() const
std::vector< int > layerN2
const std::string & getLayerName(unsigned int i) const
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
std::vector< int > modType
constexpr char const * layerName[numberOfLayers]
std::vector< double > zminBlock
double getRinBlock2(unsigned i) const
const std::string & getScintMat() const
int getNsectortot() const
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
std::vector< int > layerN0
std::vector< std::string > modMat
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
DDMaterial is used to define and access material information.
const std::string & getAbsMat() const
static const double slope[3]
constexpr NumType convertRadToDeg(NumType radians)
double getRoutBlock2(unsigned i) const
int getModType(unsigned int i) const
Sin< T >::type sin(const T &t)
const std::string & getModName(unsigned int i) const
void constructInsideSector(const DDLogicalPart §or, DDCompactView &cpv)
Geom::Theta< T > theta() const
DDName is used to identify DDD entities uniquely.
std::vector< double > routBlock1
void constructInsideModule(const DDLogicalPart &module, int mod, DDCompactView &cpv)
double getThick(unsigned int i) const
const std::string & getModMat(unsigned int i) const
static std::string & ns()
Exp< T >::type exp(const T &t)
double getRinKink() const
const std::string & getRotMat() const
std::vector< double > zmaxBlock
Compact representation of the geometrical detector hierarchy.
int getSectionModule(unsigned i) const
std::string formatAsDegreesInInteger(double radianVal)
A DDSolid represents the shape of a part.
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< double > routBlock2
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
std::vector< std::string > layerName
double getScintT(unsigned int i) const
void parameterLayer0(int mod, int layer, int iphi, double &yh, double &bl, double &tl, double &alp, double &xpos, double &ypos, double &zcpv)
std::vector< int > layerN1
const std::string & getGenMat() const
void constructScintLayer(const DDLogicalPart &glog, double pDz, double yh, double bl, double tl, double alp, const std::string &name, int id, DDCompactView &cpv)
double getRinBlock1(unsigned i) const
std::vector< int > layerN4
int equipModule(unsigned int i) const
std::vector< int > sectionModule
Tan< T >::type tan(const T &t)
double getZiL0Body() const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
std::vector< double > rinBlock1
constexpr uint8_t getLayer(uint32_t detId)
std::vector< std::string > modName
std::vector< int > layerN5
~DDHCalEndcapAlgo() override
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)
int getLayerN(unsigned int i) const
std::vector< int > eModule
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
std::vector< int > layerType
std::vector< int > layerN
const std::string & getPlastMat() const
void constructGeneralVolume(DDCompactView &cpv)
int getLayerType(unsigned int i) const
const std::string & getRotation() const
void constructInsideModule0(const DDLogicalPart &module, int mod, DDCompactView &cpv)
std::vector< double > rinBlock2
double getLayerT(unsigned int i) const
double getRoutDip() const
std::vector< double > trimRight
double getHeboxDepth() const
double getDzShift() const
int getLayer(unsigned int i, unsigned int j) const
const std::string & getPhiName(unsigned int i) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< int > layerN3
std::vector< std::string > phiName
void parameterLayer(int iphi, double rinF, double routF, double rinB, double routB, double zi, double zo, double &yh1, double &bl1, double &tl1, double &yh2, double &bl2, double &tl2, double &alp, double &theta, double &phi, double &xpos, double &ypos, double &zcpv)
double getZminBlock(unsigned i) const
std::vector< double > thick
T mod(const T &a, const T &b)
std::vector< double > scintT
std::vector< double > layerT
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
const std::string & name() const
Returns the name.
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
double getZShiftHac2() const
double getRoutBlock1(unsigned i) const
std::vector< double > trimLeft