25 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: Creating an instance";
37 genMaterial = sArgs[
"MaterialName"];
38 absorberMat = sArgs[
"AbsorberMat"];
39 plasticMat = sArgs[
"PlasticMat"];
40 scintMat = sArgs[
"ScintMat"];
41 rotstr = sArgs[
"Rotation"];
42 sectors =
int (nArgs[
"Sectors"]);
45 <<
"DDHCalEndcapModuleAlgo: General material " << genMaterial <<
"\tAbsorber " 46 << absorberMat <<
"\tPlastic " << plasticMat <<
"\tScintillator " 47 << scintMat <<
"\tRotation " << rotstr <<
"\tSectors " << sectors;
49 zMinBlock = nArgs[
"ZMinBlock"];
50 zMaxBlock = nArgs[
"ZMaxBlock"];
51 z1Beam = nArgs[
"Z1Beam"];
52 ziDip = nArgs[
"ZiDip"];
53 dzStep = nArgs[
"DzStep"];
54 moduleThick = nArgs[
"ModuleThick"];
55 layerThick = nArgs[
"LayerThick"];
56 scintThick = nArgs[
"ScintThick"];
59 <<
"DDHCalEndcapModuleAlgo: Zmin " << zMinBlock <<
"\tZmax " << zMaxBlock
60 <<
"\tZ1Beam " << z1Beam <<
"\tZiDip " << ziDip <<
"\tDzStep " << dzStep
61 <<
"\tModuleThick " << moduleThick <<
"\tLayerThick " << layerThick
62 <<
"\tScintThick " << scintThick;
64 rMaxFront = nArgs[
"RMaxFront"];
65 rMaxBack = nArgs[
"RMaxBack"];
66 trimLeft = nArgs[
"TrimLeft"];
67 trimRight = nArgs[
"TrimRight"];
68 tolAbs = nArgs[
"TolAbs"];
71 <<
"DDHCalEndcapModuleAlgo: RMaxFront " << rMaxFront <<
"\tRmaxBack " 72 << rMaxBack <<
"\tTrims " <<trimLeft <<
":" << trimRight <<
"\tTolAbs " 75 slopeBot = nArgs[
"SlopeBottom"];
76 slopeTop = nArgs[
"SlopeTop"];
77 slopeTopF = nArgs[
"SlopeTopFront"];
78 modType = (
int)(nArgs[
"ModType"]);
79 modNumber = (
int)(nArgs[
"ModNumber"]);
80 layerType = (
int)(nArgs[
"LayerType"]);
83 <<
"DDHCalEndcapModuleAlgo: slopeBot " << slopeBot <<
"\tslopeTop " 84 << slopeTop <<
"\tslopeTopF " << slopeTopF <<
"\tmodType " << modType
85 <<
"\tmodNumber " << modNumber <<
"\tlayerType " << layerType;
87 layerNumber =
dbl_to_int(vArgs[
"LayerNumber"]);
90 <<
"DDHCalEndcapModuleAlgo: " << layerNumber.size() <<
" layer Numbers";
91 for (
unsigned int i=0;
i<layerNumber.size(); ++
i)
93 <<
"LayerNumber[" <<
i <<
"] = " <<layerNumber[
i];
95 phiName = vsArgs[
"PhiName"];
98 <<
"DDHCalEndcapModuleAlgo: " << phiName.size() <<
" phi sectors";
99 for (
unsigned int i=0;
i<phiName.size(); ++
i)
102 layerName = vsArgs[
"LayerName"];
105 <<
"DDHCalEndcapModuleAlgo: " << layerName.size() <<
" layers";
106 for (
unsigned int i=0;
i<layerName.size(); ++
i)
109 idName = sArgs[
"MotherName"];
111 idOffset =
int (nArgs[
"IdOffset"]);
112 modName = sArgs[
"ModName"];
115 <<
"DDHCalEndcapModuleAlgo: Parent " <<
parent().name() <<
" " << modName
116 <<
" idName " <<
idName <<
" NameSpace " << idNameSpace <<
" Offset " 128 edm::LogVerbatim(
"HCalGeom") <<
"==>> Constructing DDHCalEndcapModuleAlgo...";
131 constructInsideModule0 (
parent(), cpv);
133 constructInsideModule (
parent(), cpv);
136 <<
"<<== End of DDHCalEndcapModuleAlgo construction ...";
144 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: \t\tInside module0";
154 int layer = layerNumber[0];
155 int layer0 = layerNumber[1];
159 for (
unsigned int iphi=0; iphi<phiName.size(); iphi++) {
161 name =
idName+modName+layerName[0]+phiName[iphi];
163 0.5*layerThick, 0, 0, parm.
yh1, parm.
bl1,
168 <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " 169 << plasName <<
" of dimensions " << 0.5*layerThick <<
", 0, 0, " 170 << parm.
yh1 <<
", " << parm.
bl1 <<
", " << parm.
tl1 <<
", " 177 cpv.
position(glog, module, idOffset+layer+1, r1, rot);
180 <<
"DDHCalEndcapModuleAlgo: " << glog.
name() <<
" number " 181 << idOffset+layer+1 <<
" positioned in " << module.
name() <<
" at " << r1
185 int copyNo = layer0*10 + layerType;
186 name = modName+layerName[0]+phiName[iphi];
187 constructScintLayer (glog, scintThick, parm, name, copyNo, cpv);
191 double zi = zMinBlock + layerThick;
192 double zo = zi + 0.5*dzStep;
193 double rinF, routF, rinB, routB;
194 if (modNumber == 0) {
195 rinF = zi * slopeTopF;
196 routF = (zi - z1Beam) * slopeTop;
197 rinB = zo * slopeTopF;
198 routB = (zo - z1Beam) * slopeTop;
199 }
else if (modNumber > 0) {
200 rinF = zi * slopeBot;
201 routF = zi * slopeTopF;
202 rinB = zo * slopeBot;
203 routB = zo * slopeTopF;
205 rinF = zi * slopeBot;
206 routF = (zi - z1Beam) * slopeTop;
207 rinB = zo * slopeBot;
208 routB = (zo - z1Beam) * slopeTop;
212 <<
"DDHCalEndcapModuleAlgo: Front " << zi <<
", " << rinF <<
", " << routF
213 <<
" Back " << zo <<
", " << rinB <<
", " << routB;
219 <<
"DDHCalEndcapModuleAlgo: Trim " << tolAbs <<
" Param " << parm.
yh1 <<
", " 220 << parm.
bl1 <<
", " << parm.
tl1 <<
", " << parm.
yh2 <<
", " << parm.
bl2 228 name =
idName+modName+layerName[0]+
"Absorber";
235 <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " << matName
244 cpv.
position(glog, module, 1, r2, rot);
247 <<
"DDHCalEndcapModuleAlgo: " << glog.
name() <<
" number 1 positioned in " 248 << module.
name() <<
" at " << r2 <<
" with " <<
rot;
256 edm::LogVerbatim(
"HCalGeom") <<
"DDHCalEndcapModuleAlgo: \t\tInside module";
266 double alpha = (1._pi)/sectors;
267 double zi = zMinBlock;
269 for (
unsigned int i=0;
i<layerName.size();
i++) {
273 int layer = layerNumber[
i];
274 double zo = zi + 0.5*dzStep;
276 for (
unsigned int iphi=0; iphi<phiName.size(); iphi++) {
277 double ziAir = zo - moduleThick;
279 if (modNumber == 0) {
280 rinF = ziAir * slopeTopF;
281 rinB = zo * slopeTopF;
283 rinF = ziAir * slopeBot;
284 rinB = zo * slopeBot;
286 double routF = getRout(ziAir);
287 double routB = getRout(zo);
290 <<
"DDHCalEndcapModuleAlgo: Layer " <<
i <<
" Phi " << iphi <<
" Front " 291 << ziAir <<
", " << rinF <<
", " << routF <<
" Back " << zo <<
", " << rinB
299 name =
idName+modName+layerName[
i]+phiName[iphi]+
"Air";
301 0.5*moduleThick, parm.
theta, parm.
phi,
306 <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " 307 << matName <<
" of dimensions " << 0.5*moduleThick <<
", " 309 <<
", " << parm.
yh1 <<
", " << parm.
bl1 <<
", " << parm.
tl1 <<
", " 316 cpv.
position(glog, module, layer+1, r1, rot);
319 <<
"DDHCalEndcapModuleAlgo: " <<glog.
name() <<
" number " << layer+1
320 <<
" positioned in " << module.
name() <<
" at " << r1 <<
" with " <<
rot;
323 parm.
yh1 = 0.5 * (routF - rinB) - getTrim(iphi);
324 parm.
bl1 = 0.5 * rinB *
tan(alpha) - getTrim(iphi);
325 parm.
tl1 = 0.5 * routF *
tan(alpha) - getTrim(iphi);
326 name =
idName+modName+layerName[
i]+phiName[iphi];
328 0.5*layerThick, 0, 0, parm.
yh1,
333 <<
"DDHCalEndcapModuleAlgo: "<< solid.
name() <<
" Trap made of " 334 << plasName <<
" of dimensions " << 0.5*layerThick <<
", 0, 0, " 335 << parm.
yh1 <<
", " << parm.
bl1 <<
", " << parm.
tl1 <<
", " 341 double ypos = 0.5*(routF+rinB) - parm.
xpos;
346 <<
"DDHCalEndcapModuleAlgo: " << plog.
name() <<
" number " 347 << idOffset+layer+1 <<
" positioned in " << glog.
name() <<
" at " 348 <<
r2 <<
" with no rotation";
351 int copyNo = layer*10 + layerType;
352 name = modName+layerName[
i]+phiName[iphi];
353 constructScintLayer (plog, scintThick, parm, name, copyNo, cpv);
356 zi = zo - 0.5*dzStep;
367 double alpha = (1._pi)/sectors;
375 zo = zi + layerThick;
378 zi = zo - layerThick;
381 if (modNumber == 0) {
382 rin = zo * slopeTopF;
383 rout = (zi - z1Beam) * slopeTop;
384 }
else if (modNumber > 0) {
386 rout = zi * slopeTopF;
389 rout = (zi - z1Beam) * slopeTop;
393 <<
"ModNumber " << modNumber <<
" " << zi <<
" " << zo <<
" " << slopeTopF
394 <<
" " << slopeTop <<
" " << slopeBot <<
" " << rin <<
" " << rout <<
" " 397 double yh = 0.5 * (rout - rin);
398 double bl = 0.5 * rin *
tan (alpha);
399 double tl = 0.5 * rout *
tan(alpha);
400 parm.
xpos = 0.5 * (rin + rout);
401 parm.
ypos = 0.5 * (bl + tl);
402 parm.
zpos = 0.5 * (zi + zo);
403 parm.
yh1 = parm.
yh2 = yh - getTrim(iphi);
404 parm.
bl1 = parm.
bl2 = bl - getTrim(iphi);
405 parm.
tl1 = parm.
tl2 = tl - getTrim(iphi);
406 parm.
alp = atan(0.5 *
tan(alpha));
414 <<
"Output Dimensions " << parm.
yh1 <<
" " << parm.
bl1 <<
" " << parm.
tl1 423 double routF,
double rinB,
double routB,
424 double zi,
double zo) {
429 double alpha = (1._pi)/sectors;
432 <<
"Input " << iphi <<
" Front " << rinF <<
" " << routF <<
" " << zi
433 <<
" Back " << rinB <<
" " << routB <<
" " << zo <<
" Alpha " 436 parm.
yh1 = 0.5 * (routF - rinB);
437 parm.
bl1 = 0.5 * rinB *
tan(alpha);
438 parm.
tl1 = 0.5 * routF *
tan(alpha);
439 parm.
yh2 = 0.5 * (routF - rinB);
440 parm.
bl2 = 0.5 * rinB *
tan(alpha);
441 parm.
tl2 = 0.5 * routF *
tan(alpha);
443 double dy = 0.5 * (rinB+routF-rinB-routF);
444 parm.
xpos = 0.25*(rinB+routF+rinB+routF);
446 parm.
zpos = 0.5*(zi+zo);
447 parm.
alp = atan(0.5 *
tan(alpha));
454 double r =
sqrt (dx*dx + dy*dy);
459 parm.
theta = atan (r/(zo-zi));
460 parm.
phi = atan2 (dy, dx);
466 <<
"Output Dimensions " << parm.
yh1 <<
" " << parm.
bl1 <<
" " << parm.
tl1 467 <<
" " << parm.
yh2 <<
" " << parm.
bl2 <<
" " << parm.
tl2 <<
" " 488 <<
"DDHCalEndcapModuleAlgo: " << solid.
name() <<
" Trap made of " << scintMat
489 <<
" of dimensions " << 0.5*dz <<
", 0, 0, " << parm.
yh1 <<
", " << parm.
bl1 498 <<
"DDHCalEndcapModuleAlgo: " << glog.name() <<
" number " <<
id 499 <<
" positioned in " << detector.
name() <<
" at (0,0,0) with no rotation";
505 if (j == 0)
return trimLeft;
506 else return trimRight;
510 double r = (modNumber >= 0) ? ((z - z1Beam) * slopeTop) : z * slopeTopF;
512 if (r > rMaxBack) r = rMaxBack;
514 if (r > rMaxFront) r = rMaxFront;
HcalEndcapPar parameterLayer(unsigned int iphi, double rinF, double routF, double rinB, double routB, double zi, double zo)
void constructInsideModule0(const DDLogicalPart &module, DDCompactView &cpv)
DDMaterial is used to define and access material information.
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
DDName is used to identify DDD entities uniquely.
constexpr NumType convertRadToDeg(NumType radians)
static std::string & ns()
Compact representation of the geometrical detector hierarchy.
A DDSolid represents the shape of a part.
HcalEndcapPar parameterLayer0(unsigned int iphi)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
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.
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 ...
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)
double getTrim(unsigned int j) const
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string ©no, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
void execute(DDCompactView &cpv) override
double getRout(double z) const
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
~DDHCalEndcapModuleAlgo() override