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) {
27 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo info: Creating an instance";
83 nEndcap = int (nArgs[
"Endcap"]);
85 rotns = sArgs[
"RotNameSpace"];
95 ziDip = nArgs[
"ZiDip"];
98 double gap = nArgs[
"Gap"];
99 double z1 = nArgs[
"Z1"];
100 double r1 = nArgs[
"R1"];
101 rout = nArgs[
"Rout"];
103 drEnd = nArgs[
"DrEnd"];
104 double etamin = nArgs[
"Etamin"];
108 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: General material "
111 <<
"\tRotation matrix for half " <<
rotns
113 <<
zEnd <<
" ziNose " <<
ziNose <<
" ziL0Nose "
117 <<
" z1 " << z1 <<
"\n\tr1 " << r1 <<
" rout " <<
rout
119 <<
"\tetamin " << etamin <<
" Bottom angle " <<
angBot
132 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: angTop "
136 <<
"\triDip " <<
riDip <<
"\n\troDip " <<
roDip
142 modules = int(nArgs[
"Modules"]);
143 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Number of modules "
146 modName = vsArgs[
"ModuleName"];
147 modMat = vsArgs[
"ModuleMat"];
150 thick = vArgs[
"ModuleThick"];
161 for (i = 0; i <
modules; i++) {
164 <<
" thickness of absorber/air " <<
thick[
i]
166 <<
" equip module " <<
eModule[
i] <<
" with "
169 for (j = 0; j < layerN[
i]; j++) {
173 for (j = 0; j < layerN[
i]; j++) {
177 for (j = 0; j < layerN[
i]; j++) {
181 for (j = 0; j < layerN[
i]; j++) {
185 for (j = 0; j < layerN[
i]; j++) {
189 for (j = 0; j < layerN[
i]; j++) {
199 layers = int(nArgs[
"Layers"]);
207 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Phi Sections "
214 for (i = 0; i <
layers; i++) {
216 <<
"\tThickness " <<
layerT[
i] <<
"\tScint.Thick "
289 for (i = 0; i <
module; i++)
290 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Module " << i
296 idName = sArgs[
"MotherName"];
300 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Parent " << parentName
306 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo debug: Tolerances - Positioning "
316 LogDebug(
"HCalGeom") <<
"==>> Constructing DDHCalEndcapAlgo...";
318 LogDebug(
"HCalGeom") <<
"<<== End of DDHCalEndcapAlgo construction ...";
325 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: General volume...";
327 for (
int i=0;
i<3;
i++)
335 <<
" Rotation " << rot;
344 vector<double> pgonZ, pgonRmin, pgonRmax;
383 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: "
386 <<
" sectors from " << -alpha/CLHEP::deg <<
" to "
387 << (-alpha+dphi)/CLHEP::deg <<
" and with "
388 << pgonZ.size() <<
" sections";
389 for (i = 0; i <pgonZ.size(); i++)
390 LogDebug(
"HCalGeom") <<
"\t\tZ = " << pgonZ[
i] <<
"\tRmin = " <<pgonRmin[
i]
391 <<
"\tRmax = " << pgonRmax[
i];
399 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: "
401 <<
" in " << parentName <<
" at " << r0 <<
" with "
406 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: "
408 <<
"positioned in " << parentName <<
" at " << r0
414 vector<double> pgonZMod, pgonRminMod, pgonRmaxMod;
415 for (i=0; i < (pgonZ.size()-1); i++) {
417 pgonRminMod.push_back(pgonRmin[i]);
418 pgonRmaxMod.push_back(pgonRmax[i]);
422 pgonRminMod, pgonRmaxMod);
424 <<
" Polyhedra made of " <<
getGenMat() <<
" with "
426 << -alpha/CLHEP::deg <<
" to "
427 << (-alpha+dphi)/CLHEP::deg <<
" and with "
428 << pgonZMod.size() <<
" sections ";
429 for (i = 0; i < pgonZMod.size(); i++)
430 LogDebug(
"HCalGeom") <<
"\t\tZ = " << pgonZMod[
i] <<
"\tRmin = "
431 << pgonRminMod[
i] <<
"\tRmax = " << pgonRmaxMod[
i];
436 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << genlogich.
name()
437 <<
" number 1 positioned in " << genlogic.
name()
438 <<
" at (0,0," << -
getDzShift() <<
") with no rotation";
443 1, -alpha, 2*alpha, pgonZMod,
444 pgonRminMod, pgonRmaxMod);
447 <<
" with 1 sector from " << -alpha/CLHEP::deg <<
" to "
448 << alpha/CLHEP::deg <<
" and with " << pgonZMod.size()
450 for (i = 0; i < pgonZMod.size(); i++)
451 LogDebug(
"HCalGeom") <<
"\t\tZ = " << pgonZMod[
i] <<
"\tRmin = "
452 << pgonRminMod[
i] <<
"\tRmax = " << pgonRmaxMod[
i];
458 double phideg = phi/CLHEP::deg;
461 string rotstr(
"NULL");
464 if (phideg < 100) rotstr =
"R0";
468 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: Creating a new "
469 <<
"rotation " << rotstr <<
"\t" << 90 <<
","
470 << phideg <<
"," << 90 <<
"," << (phideg+90)
473 phideg*CLHEP::deg, 90*CLHEP::deg,
474 (90+phideg)*CLHEP::deg, 0*CLHEP::deg, 0*CLHEP::deg);
479 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << seclogic.
name()
480 <<
" number " << ii+1 <<
" positioned in "
489 vector<double> pgonZBack, pgonRminBack, pgonRmaxBack;
493 pgonZBack.push_back(
getZEnd());
498 pgonRminBack, pgonRmaxBack);
500 <<
" Polyhedra made of " <<
getAbsMat() <<
" with "
502 << -alpha/CLHEP::deg <<
" to "
503 << (-alpha+dphi)/CLHEP::deg <<
" and with "
504 << pgonZBack.size() <<
" sections";
505 for (i = 0; i < pgonZBack.size(); i++)
506 LogDebug(
"HCalGeom") <<
"\t\tZ = " << pgonZBack[
i] <<
"\tRmin = "
507 << pgonRminBack[
i] <<
"\tRmax = " << pgonRmaxBack[
i];
513 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << glog.
name()
514 <<
" number 1 positioned in " << genlogic.
name()
515 <<
" at (0,0,0) with no rotation";
537 vector<double> pgonZ, pgonRmin, pgonRmax;
555 pgonZ.push_back(pgonZ[1] + deltaz);
556 pgonRmin.push_back(pgonRmin[1]);
567 pgonZ, pgonRmin, pgonRmax);
568 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: "
571 << -alpha/CLHEP::deg <<
" to " << alpha/CLHEP::deg
572 <<
" and with " << nsec <<
" sections";
573 for (
unsigned int k=0;
k<pgonZ.size();
k++)
574 LogDebug(
"HCalGeom") <<
"\t\tZ = " << pgonZ[
k] <<
"\tRmin = "
575 << pgonRmin[
k] <<
"\tRmax = " << pgonRmax[
k];
580 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << glog.
name()
581 <<
" number " <<
i+1 <<
" positioned in "
582 << sector.
name() <<
" at (0,0,0) with no rotation";
594 double& yh,
double& bl,
double& tl,
595 double& alp,
double& xpos,
double& ypos,
601 LogDebug(
"HCalGeom") <<
"Input " << iphi <<
" " << layer <<
" " << iphi
602 <<
" Alpha " << alpha/CLHEP::deg;
620 yh = 0.5 * (rout - rin);
621 bl = 0.5 * rin *
tan (alpha);
622 tl = 0.5 * rout *
tan(alpha);
623 xpos = 0.5 * (rin +
rout);
624 ypos = 0.5 * (bl + tl);
625 zpos = 0.5 * (zi + zo);
629 alp = atan(0.5 *
tan(alpha));
635 LogDebug(
"HCalGeom") <<
"Output Dimensions " << yh <<
" " << bl <<
" "
636 << tl <<
" " << alp/CLHEP::deg <<
" Position " << xpos
637 <<
" " << ypos <<
" " << zpos;
642 double rinB,
double routB,
double zi,
643 double zo,
double& yh1,
double& bl1,
644 double& tl1,
double& yh2,
double& bl2,
645 double& tl2,
double& alp,
double&
theta,
646 double&
phi,
double& xpos,
double& ypos,
652 LogDebug(
"HCalGeom") <<
"Input " << iphi <<
" Front " << rinF <<
" " << routF
653 <<
" " << zi <<
" Back " << rinB <<
" " << routB <<
" "
654 << zo <<
" Alpha " << alpha/CLHEP::deg;
656 yh1 = 0.5 * (routF - rinB);
657 bl1 = 0.5 * rinB *
tan(alpha);
658 tl1 = 0.5 * routF *
tan(alpha);
659 yh2 = 0.5 * (routF - rinB);
660 bl2 = 0.5 * rinB *
tan(alpha);
661 tl2 = 0.5 * routF *
tan(alpha);
662 double dx = 0.25* (bl2+tl2-bl1-tl1);
663 double dy = 0.5 * (rinB+routF-rinB-routF);
664 xpos = 0.25*(rinB+routF+rinB+routF);
665 ypos = 0.25*(bl2+tl2+bl1+tl1);
667 alp = atan(0.5 *
tan(alpha));
675 double r =
sqrt (dx*dx + dy*dy);
676 theta= atan (r/(zo-zi));
677 phi = atan2 (dy, dx);
678 LogDebug(
"HCalGeom") <<
"Output Dimensions " << yh1 <<
" " << bl1 <<
" "
679 << tl1 <<
" " << yh2 <<
" " << bl2 <<
" " << tl2
680 <<
" " << alp/CLHEP::deg <<
" " << theta/CLHEP::deg
681 <<
" " << phi/CLHEP::deg <<
" Position " << xpos <<
" "
682 << ypos <<
" " << zpos;
688 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: \t\tInside module0 ..."<<
mod;
702 double xpos, ypos, zpos;
705 for (
int iphi = 0; iphi <
getPhi(); iphi++) {
706 double yh, bl, tl, alp;
711 bl, tl, alp, yh, bl, tl, alp);
712 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << solid.
name()
714 <<
" of dimensions " << 0.5*
getLayerT(layer)
715 <<
", 0, 0, " << yh <<
", " << bl <<
", " << tl
716 <<
", " << alp/CLHEP::deg <<
", " << yh <<
", " << bl
717 <<
", " << tl <<
", " << alp/CLHEP::deg;
722 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << glog.
name()
723 <<
" number " <<
idOffset+layer+1 <<
" positioned in "
724 << module.
name() <<
" at " << r1 <<
" with " << rot;
734 double rinF, routF, rinB, routB;
746 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: Module " << mod <<
" Front "
747 << zi <<
", " << rinF <<
", " << routF <<
" Back "
748 << zo <<
", " << rinB <<
", " << routB;
749 double yh1, bl1, tl1, yh2, bl2, tl2,
theta,
phi, alp;
750 parameterLayer(0, rinF, routF, rinB, routB, zi, zo, yh1, bl1, tl1, yh2, bl2,
751 tl2, alp, theta, phi, xpos, ypos, zpos);
753 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: Trim " << fact <<
" Param "
754 << yh1 <<
", " << bl1 <<
", " << tl1 <<
", " << yh2
755 <<
", " << bl2 <<
", " << tl2;
761 name = module.
name().
name()+
"Absorber";
764 bl1, tl1, alp, yh2, bl2, tl2, alp);
765 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << solid.
name()
766 <<
" Trap made of " <<
getAbsMat() <<
" of dimensions "
767 << 0.5*
getThick(mod) <<
", " << theta/CLHEP::deg <<
", "
768 << phi/CLHEP::deg <<
", " << yh1 <<
", " << bl1 <<
", "
769 << tl1 <<
", " << alp/CLHEP::deg <<
", " << yh2 <<
", "
770 << bl2 <<
", " << tl2 <<
", " << alp/CLHEP::deg;
774 cpv.
position(glog, module, 1, r2, rot);
775 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << glog.
name()
776 <<
" number 1 positioned in " << module.
name() <<
" at "
777 << r2 <<
" with " << rot;
783 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: \t\tInside module ..." <<
mod;
804 for (
int iphi = 0; iphi <
getPhi(); iphi++) {
818 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: Layer " <<
i <<
" Phi "
819 << iphi <<
" Front " << ziAir <<
", " << rinF
820 <<
", " << routF <<
" Back " << zo <<
", " << rinB
822 double yh1, bl1, tl1, yh2, bl2, tl2,
theta,
phi, alp;
823 double xpos, ypos, zpos;
824 parameterLayer(iphi, rinF, routF, rinB, routB, ziAir, zo, yh1, bl1, tl1,
825 yh2, bl2, tl2, alp, theta, phi, xpos, ypos, zpos);
830 bl1, tl1, alp, yh2, bl2, tl2, alp);
831 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << solid.
name()
833 <<
" of dimensions " << 0.5*
getThick(mod) <<
", "
834 << theta/CLHEP::deg <<
", " << phi/CLHEP::deg
835 <<
", " << yh1 <<
", " << bl1 <<
", " << tl1 <<
", "
836 << alp/CLHEP::deg <<
", " << yh2 <<
", " << bl2
837 <<
", " << tl2 <<
", " << alp/CLHEP::deg;
841 cpv.
position(glog, module, layer+1, r1, rot);
842 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << glog.
name()
843 <<
" number " << layer+1 <<
" positioned in "
844 << module.
name() <<
" at " << r1 <<
" with " << rot;
847 double yh = 0.5 * (routF - rinB) -
getTrim(mod,iphi);
848 double bl = 0.5 * rinB *
tan(alpha) -
getTrim(mod,iphi);
849 double tl = 0.5 * routF *
tan(alpha) -
getTrim(mod,iphi);
853 bl, tl, alp, yh, bl, tl, alp);
854 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << solid.
name()
856 <<
" of dimensions " << 0.5*
getLayerT(layer)
857 <<
", 0, 0, " << yh <<
", " << bl <<
", " << tl
858 <<
", " << alp/CLHEP::deg <<
", " << yh <<
", "
859 << bl <<
", " << tl <<
", " << alp/CLHEP::deg;
862 ypos = 0.5*(routF+rinB) - xpos;
865 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << plog.
name()
867 <<
" positioned in " << glog.
name() <<
" at " << r2
868 <<
" with no rotation";
882 double yh,
double bl,
double tl,
890 yh, bl, tl, alp, yh, bl, tl, alp);
892 <<
" Trap made of " <<
getScintMat() <<
" of dimensions "
893 << 0.5*dz <<
", 0, 0, " << yh <<
", " << bl <<
", "
894 << tl <<
", " << alp/CLHEP::deg <<
", " << yh <<
", "
895 << bl <<
", " << tl <<
", " << alp/CLHEP::deg;
900 LogDebug(
"HCalGeom") <<
"DDHCalEndcapAlgo test: " << glog.name()
901 <<
" number " <<
id <<
" positioned in "
902 << detector.
name() <<
" at (0,0,0) with no rotation";
double getTrim(unsigned int i, unsigned int j) const
void constructInsideModule0(DDLogicalPart module, int mod, DDCompactView &cpv)
std::string getModName(unsigned int i) const
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
std::string getAbsMat() const
DDMaterial is used to define and access material information.
virtual ~DDHCalEndcapAlgo()
double getRoutBlock2(unsigned i) const
int getModType(unsigned int i) const
Sin< T >::type sin(const T &t)
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
void execute(DDCompactView &cpv)
Geom::Theta< T > theta() const
std::vector< double > routBlock1
double getThick(unsigned int i) const
static std::string & ns()
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Exp< T >::type exp(const T &t)
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
double getRinBlock1(unsigned i) const
std::vector< int > layerN4
void constructInsideModule(DDLogicalPart module, int mod, DDCompactView &cpv)
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
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 initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
void constructGeneralVolume(DDCompactView &cpv)
int getLayerType(unsigned int i) const
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
void constructInsideSector(DDLogicalPart sector, DDCompactView &cpv)
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) //! Creates a polycone (refere to Gean...
void constructScintLayer(DDLogicalPart glog, double pDz, double yh, double bl, double tl, double alp, std::string name, int id, DDCompactView &cpv)
double getZShiftHac2() const
double getRoutBlock1(unsigned i) const
std::vector< double > trimLeft