10 namespace std{}
using namespace std;
19 #include "CLHEP/Units/GlobalPhysicalConstants.h" 20 #include "CLHEP/Units/GlobalSystemOfUnits.h" 23 modMat(0),modType(0),sectionModule(0),layerN(0),layerN0(0),layerN1(0),
24 layerN2(0),layerN3(0),layerN4(0),layerN5(0),thick(0),trimLeft(0),
25 trimRight(0),zminBlock(0),zmaxBlock(0),rinBlock1(0),routBlock1(0),
26 rinBlock2(0),routBlock2(0),layerType(0),layerT(0),scintT(0) {
29 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo info: Creating an instance";
87 rotns = sArgs[
"RotNameSpace"];
97 ziDip = nArgs[
"ZiDip"];
100 double gap = nArgs[
"Gap"];
101 double z1 = nArgs[
"Z1"];
102 double r1 = nArgs[
"R1"];
103 rout = nArgs[
"Rout"];
105 drEnd = nArgs[
"DrEnd"];
106 double etamin = nArgs[
"Etamin"];
111 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: General material " 114 <<
"\tRotation matrix for half " <<
rotns 120 <<
" Gap " << gap <<
" z1 " << z1 <<
"\n\tr1 " << r1
122 <<
" drEnd " <<
drEnd <<
"\tetamin " << etamin
123 <<
" Bottom angle " <<
angBot <<
" Gap angle " 139 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: angTop " 143 <<
"\triDip " <<
riDip <<
"\n\troDip " <<
roDip 153 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Number of modules " 157 modName = vsArgs[
"ModuleName"];
158 modMat = vsArgs[
"ModuleMat"];
161 thick = vArgs[
"ModuleThick"];
176 <<
" type " <<
modType[
i] <<
" Sections " 180 <<
" with " <<
layerN[
i] <<
" layers";
182 for (
int j = 0; j < layerN[
i]; j++) {
186 for (
int j = 0; j < layerN[
i]; j++) {
190 for (
int j = 0; j < layerN[
i]; j++) {
194 for (
int j = 0; j < layerN[
i]; j++) {
198 for (
int j = 0; j < layerN[
i]; j++) {
202 for (
int j = 0; j < layerN[
i]; j++) {
223 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Phi Sections " 233 <<
"\tScint.Thick " <<
scintT[
i];
308 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Module " <<
i 315 idName = sArgs[
"MotherName"];
321 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Parent " << parentName
322 <<
" idName " <<
idName <<
" NameSpace " 330 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Tolerances - Positioning " 342 edm::LogInfo(
"HCalGeom") <<
"==>> Constructing DDHCalEndcapAlgo...";
348 edm::LogInfo(
"HCalGeom") <<
"<<== End of DDHCalEndcapAlgo construction ...";
357 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo test: General volume...";
361 for (
int i=0;
i<3;
i++)
371 <<
" Rotation " <<
rot;
382 vector<double> pgonZ, pgonRmin, pgonRmax;
401 pgonRmax.emplace_back(
getRout());
404 pgonRmax.emplace_back(
getRout());
423 <<
" Polyhedra made of " <<
getGenMat() <<
" with " 425 << -alpha/CLHEP::deg <<
" to " 426 << (-alpha+dphi)/CLHEP::deg <<
" and with " 427 << pgonZ.size() <<
" sections";
428 for (
unsigned int i = 0;
i <pgonZ.size();
i++)
429 edm::LogInfo(
"HCalGeom") <<
"\t\tZ = " << pgonZ[
i] <<
"\tRmin = " 430 << pgonRmin[
i] <<
"\tRmax = " << pgonRmax[
i];
443 <<
" number 1 positioned in " << parentName
444 <<
" at " << r0 <<
" with " <<
rot;
454 <<
"positioned in " << parentName <<
" at " << r0
462 vector<double> pgonZMod, pgonRminMod, pgonRmaxMod;
463 for (
unsigned int i=0;
i < (pgonZ.size()-1);
i++) {
465 pgonRminMod.emplace_back(pgonRmin[
i]);
466 pgonRmaxMod.emplace_back(pgonRmax[i]);
470 pgonRminMod, pgonRmaxMod);
476 <<
" sectors from " << -alpha/CLHEP::deg <<
" to " 477 << (-alpha+dphi)/CLHEP::deg <<
" and with " 478 << pgonZMod.size() <<
" sections ";
479 for (
unsigned int i = 0;
i < pgonZMod.size();
i++)
480 edm::LogInfo(
"HCalGeom") <<
"\t\tZ = " << pgonZMod[
i] <<
"\tRmin = " 481 << pgonRminMod[
i] <<
"\tRmax = " << pgonRmaxMod[
i];
491 <<
" number 1 positioned in " << genlogic.
name()
493 <<
") with no rotation";
499 1, -alpha, 2*alpha, pgonZMod,
500 pgonRminMod, pgonRmaxMod);
505 << -alpha/CLHEP::deg <<
" to " << alpha/CLHEP::deg
506 <<
" and with " << pgonZMod.size() <<
" sections";
507 for (
unsigned int i = 0;
i < pgonZMod.size();
i++)
508 edm::LogInfo(
"HCalGeom") <<
"\t\tZ = " << pgonZMod[
i] <<
"\tRmin = " 509 << pgonRminMod[
i] <<
"\tRmax = " << pgonRmaxMod[
i];
516 double phideg = phi/CLHEP::deg;
519 string rotstr(
"NULL");
522 if (phideg < 100) rotstr =
"R0";
523 rotstr = rotstr + std::to_string(phideg);
528 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo test: Creating a new " 529 <<
"rotation " << rotstr <<
"\t" << 90 <<
"," 530 << phideg <<
"," << 90 <<
"," << (phideg+90)
535 phideg*CLHEP::deg, 90*CLHEP::deg,
536 (90+phideg)*CLHEP::deg, 0*CLHEP::deg, 0*CLHEP::deg);
544 <<
" number " <<
ii+1 <<
" positioned in " 545 << genlogich.
name() <<
" at (0,0,0) with " 556 vector<double> pgonZBack, pgonRminBack, pgonRmaxBack;
560 pgonZBack.emplace_back(
getZEnd());
565 pgonRminBack, pgonRmaxBack);
571 <<
" sectors from " << -alpha/CLHEP::deg <<
" to " 572 << (-alpha+dphi)/CLHEP::deg <<
" and with " 573 << pgonZBack.size() <<
" sections";
574 for (
unsigned int i = 0;
i < pgonZBack.size();
i++)
575 edm::LogInfo(
"HCalGeom") <<
"\t\tZ = " << pgonZBack[
i] <<
"\tRmin = " 576 << pgonRminBack[
i] <<
"\tRmax = " 588 <<
" number 1 positioned in " << genlogic.
name()
589 <<
" at (0,0,0) with no rotation";
615 vector<double> pgonZ, pgonRmin, pgonRmax;
618 pgonZ.emplace_back(zf);
623 pgonRmax.emplace_back(
getRout());
632 pgonRmax.emplace_back(
getRout());
633 pgonZ.emplace_back(pgonZ[1] + deltaz);
634 pgonRmin.emplace_back(pgonRmin[1]);
645 pgonZ, pgonRmin, pgonRmax);
651 <<
" with 1 sector from " << -alpha/CLHEP::deg
652 <<
" to " << alpha/CLHEP::deg <<
" and with " 653 << nsec <<
" sections";
654 for (
unsigned int k=0;
k<pgonZ.size();
k++)
655 edm::LogInfo(
"HCalGeom") <<
"\t\tZ = " << pgonZ[
k] <<
"\tRmin = " 656 << pgonRmin[
k] <<
"\tRmax = " << pgonRmax[
k];
665 <<
" number " <<
i+1 <<
" positioned in " 666 <<sector.
name() <<
" at (0,0,0) with no rotation";
678 double& yh,
double& bl,
double& tl,
679 double& alp,
double& xpos,
double& ypos,
687 edm::LogInfo(
"HCalGeom") <<
"Input " << iphi <<
" " << layer <<
" " << iphi
688 <<
" Alpha " << alpha/CLHEP::deg;
707 yh = 0.5 * (rout - rin);
708 bl = 0.5 * rin *
tan (alpha);
709 tl = 0.5 * rout *
tan(alpha);
710 xpos = 0.5 * (rin +
rout);
711 ypos = 0.5 * (bl + tl);
712 zpos = 0.5 * (zi + zo);
716 alp = atan(0.5 *
tan(alpha));
724 edm::LogInfo(
"HCalGeom") <<
"Output Dimensions " << yh <<
" " << bl <<
" " 725 << tl <<
" " << alp/CLHEP::deg <<
" Position " 726 << xpos <<
" " << ypos <<
" " << zpos;
731 double rinB,
double routB,
double zi,
732 double zo,
double& yh1,
double& bl1,
733 double& tl1,
double& yh2,
double& bl2,
734 double& tl2,
double& alp,
double&
theta,
735 double&
phi,
double& xpos,
double& ypos,
743 edm::LogInfo(
"HCalGeom") <<
"Input " << iphi <<
" Front " << rinF <<
" " 744 << routF <<
" " << zi <<
" Back " << rinB <<
" " 745 << routB <<
" " << zo <<
" Alpha " 749 yh1 = 0.5 * (routF - rinB);
750 bl1 = 0.5 * rinB *
tan(alpha);
751 tl1 = 0.5 * routF *
tan(alpha);
752 yh2 = 0.5 * (routF - rinB);
753 bl2 = 0.5 * rinB *
tan(alpha);
754 tl2 = 0.5 * routF *
tan(alpha);
755 double dx = 0.25* (bl2+tl2-bl1-tl1);
756 double dy = 0.5 * (rinB+routF-rinB-routF);
757 xpos = 0.25*(rinB+routF+rinB+routF);
758 ypos = 0.25*(bl2+tl2+bl1+tl1);
760 alp = atan(0.5 *
tan(alpha));
768 double r =
sqrt (dx*dx + dy*dy);
769 theta= atan (r/(zo-zi));
770 phi = atan2 (dy, dx);
773 edm::LogInfo(
"HCalGeom") <<
"Output Dimensions " << yh1 <<
" " << bl1 <<
" " 774 << tl1 <<
" " << yh2 <<
" " << bl2 <<
" " << tl2
775 <<
" " << alp/CLHEP::deg <<
" " << theta/CLHEP::deg
776 <<
" " << phi/CLHEP::deg <<
" Position " << xpos
777 <<
" " << ypos <<
" " << zpos;
785 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo test: \t\tInside module0 ..." 801 double xpos, ypos, zpos;
804 for (
int iphi = 0; iphi <
getPhi(); iphi++) {
805 double yh, bl, tl, alp;
810 bl, tl, alp, yh, bl, tl, alp);
815 <<
" of dimensions " << 0.5*
getLayerT(layer)
816 <<
", 0, 0, " << yh <<
", " << bl <<
", " << tl
817 <<
", " << alp/CLHEP::deg <<
", " << yh <<
", " 818 << bl <<
", " << tl <<
", " << alp/CLHEP::deg;
829 <<
" positioned in " << module.
name() <<
" at " 830 << r1 <<
" with " <<
rot;
842 double rinF, routF, rinB, routB;
856 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo test: Module " << mod
857 <<
" Front " << zi <<
", " << rinF <<
", " << routF
858 <<
" Back " << zo <<
", " << rinB <<
", " << routB;
861 double yh1, bl1, tl1, yh2, bl2, tl2,
theta,
phi, alp;
862 parameterLayer(0, rinF, routF, rinB, routB, zi, zo, yh1, bl1, tl1, yh2, bl2,
863 tl2, alp, theta, phi, xpos, ypos, zpos);
867 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo test: Trim " << fact
868 <<
" Param " << yh1 <<
", " << bl1 <<
", " << tl1
869 <<
", " << yh2 <<
", " << bl2 <<
", " << tl2;
877 name = module.
name().
name()+
"Absorber";
880 bl1, tl1, alp, yh2, bl2, tl2, alp);
884 <<
" of dimensions " << 0.5*
getThick(mod) <<
", " 885 << theta/CLHEP::deg <<
", " << phi/CLHEP::deg <<
", " 886 << yh1 <<
", " << bl1 <<
", " << tl1 <<
", " 887 << alp/CLHEP::deg <<
", " << yh2 <<
", " 888 << bl2 <<
", " << tl2 <<
", " << alp/CLHEP::deg;
894 cpv.
position(glog, module, 1, r2, rot);
898 <<
" number 1 positioned in " << module.
name()
899 <<
" at " << r2 <<
" with " <<
rot;
907 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo test: \t\tInside module ..." 930 for (
int iphi = 0; iphi <
getPhi(); iphi++) {
946 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo test: Layer " <<
i <<
" Phi " 947 << iphi <<
" Front " << ziAir <<
", " << rinF
948 <<
", " << routF <<
" Back " << zo <<
", " 949 << rinB <<
", " << routB;
952 double yh1, bl1, tl1, yh2, bl2, tl2,
theta,
phi, alp;
953 double xpos, ypos, zpos;
954 parameterLayer(iphi, rinF, routF, rinB, routB, ziAir, zo, yh1, bl1, tl1,
955 yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
960 bl1, tl1, alp, yh2, bl2, tl2, alp);
965 <<
" of dimensions " << 0.5*
getThick(mod) <<
", " 966 << theta/CLHEP::deg <<
", " << phi/CLHEP::deg
967 <<
", " << yh1 <<
", " << bl1 <<
", " << tl1
968 <<
", " << alp/CLHEP::deg <<
", " << yh2 <<
", " 969 << bl2 <<
", " << tl2 <<
", " << alp/CLHEP::deg;
975 cpv.
position(glog, module, layer+1, r1, rot);
979 <<
" number " << layer+1 <<
" positioned in " 980 << module.
name() <<
" at " << r1 <<
" with " 985 double yh = 0.5 * (routF - rinB) -
getTrim(mod,iphi);
986 double bl = 0.5 * rinB *
tan(alpha) -
getTrim(mod,iphi);
987 double tl = 0.5 * routF *
tan(alpha) -
getTrim(mod,iphi);
991 bl, tl, alp, yh, bl, tl, alp);
996 <<
" of dimensions " << 0.5*
getLayerT(layer)
997 <<
", 0, 0, " << yh <<
", " << bl <<
", " << tl
998 <<
", " << alp/CLHEP::deg <<
", " << yh <<
", " 999 << bl <<
", " << tl <<
", " << alp/CLHEP::deg;
1004 ypos = 0.5*(routF+rinB) - xpos;
1011 <<
" positioned in " << glog.
name() <<
" at " 1012 << r2 <<
" with no rotation";
1027 double yh,
double bl,
double tl,
1035 yh, bl, tl, alp, yh, bl, tl, alp);
1041 <<
", 0, 0, " << yh <<
", " << bl <<
", " << tl
1042 <<
", " << alp/CLHEP::deg <<
", " << yh <<
", " 1043 << bl <<
", " << tl <<
", " << alp/CLHEP::deg;
1051 edm::LogInfo(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << glog.name()
1052 <<
" number " <<
id <<
" positioned in " 1053 << detector.
name() <<
" at (0,0,0) with no rotation";
double getTrim(unsigned int i, unsigned int j) const
std::string getModName(unsigned int i) const
void execute(DDCompactView &cpv) override
double getZmaxBlock(unsigned i) const
std::vector< int > layerN2
std::vector< int > modType
std::vector< double > zminBlock
double getRinBlock2(unsigned i) const
int getNsectortot() const
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
std::string getAbsMat() const
DDMaterial is used to define and access material information.
double getRoutBlock2(unsigned i) const
int getModType(unsigned int i) const
Sin< T >::type sin(const T &t)
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
static std::string & ns()
double getRinKink() const
std::vector< double > zmaxBlock
type of data representation of DDCompactView
int getSectionModule(unsigned i) const
A DDSolid represents the shape of a part.
std::string getModMat(unsigned int i) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
std::string getRotMat() const
std::string getRotation() const
std::vector< double > routBlock2
Represents a uniquely identifyable rotation matrix.
U second(std::pair< T, U > const &p)
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< 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
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
std::string getPlastMat() const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
std::vector< double > rinBlock1
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 > layerType
std::vector< int > layerN
void constructGeneralVolume(DDCompactView &cpv)
int getLayerType(unsigned int i) const
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
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 getDzShift() const
int getLayer(unsigned int i, unsigned int j) const
std::string getPhiName(unsigned int i) const
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
std::vector< int > layerN3
std::string getGenMat() const
std::string getScintMat() const
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
std::string getLayerName(unsigned int i) const
T mod(const T &a, const T &b)
std::vector< double > scintT
std::vector< double > layerT
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