103 string myns{mynamespace(
args.parentName()).
data(), mynamespace(
args.parentName()).
size()};
106 ee.mat =
args.str(
"EEMat");
107 ee.zOff =
args.dble(
"EEzOff");
109 ee.quaName =
args.str(
"EEQuaName");
110 ee.quaMat =
args.str(
"EEQuaMat");
111 ee.crysMat =
args.str(
"EECrysMat");
112 ee.wallMat =
args.str(
"EEWallMat");
113 ee.crysLength =
args.dble(
"EECrysLength");
114 ee.crysRear =
args.dble(
"EECrysRear");
115 ee.crysFront =
args.dble(
"EECrysFront");
116 ee.sCELength =
args.dble(
"EESCELength");
117 ee.sCERear =
args.dble(
"EESCERear");
118 ee.sCEFront =
args.dble(
"EESCEFront");
119 ee.sCALength =
args.dble(
"EESCALength");
120 ee.sCARear =
args.dble(
"EESCARear");
121 ee.sCAFront =
args.dble(
"EESCAFront");
122 ee.sCAWall =
args.dble(
"EESCAWall");
123 ee.sCHLength =
args.dble(
"EESCHLength");
124 ee.sCHSide =
args.dble(
"EESCHSide");
125 ee.nSCTypes =
args.dble(
"EEnSCTypes");
126 ee.nColumns =
args.dble(
"EEnColumns");
127 ee.nSCCutaway =
args.dble(
"EEnSCCutaway");
128 ee.nSCquad =
args.dble(
"EEnSCquad");
129 ee.nCRSC =
args.dble(
"EEnCRSC");
130 ee.vecEESCProf =
args.vecDble(
"EESCProf");
131 ee.vecEEShape =
args.vecDble(
"EEShape");
132 ee.vecEESCCutaway =
args.vecDble(
"EESCCutaway");
133 ee.vecEESCCtrs =
args.vecDble(
"EESCCtrs");
134 ee.vecEECRCtrs =
args.vecDble(
"EECRCtrs");
136 ee.cutBoxName =
args.str(
"EECutBoxName");
138 ee.envName =
args.str(
"EEEnvName");
139 ee.alvName =
args.str(
"EEAlvName");
140 ee.intName =
args.str(
"EEIntName");
141 ee.cryName =
args.str(
"EECryName");
143 ee.pFHalf =
args.dble(
"EEPFHalf");
144 ee.pFFifth =
args.dble(
"EEPFFifth");
145 ee.pF45 =
args.dble(
"EEPF45");
147 ee.vecEESCLims =
args.vecDble(
"EESCLims");
148 ee.iLength =
args.dble(
"EEiLength");
149 ee.iXYOff =
args.dble(
"EEiXYOff");
150 ee.cryZOff =
args.dble(
"EECryZOff");
151 ee.zFront =
args.dble(
"EEzFront");
156 const double cutWid(ee.sCERear /
sqrt(2.));
157 ee.cutParms[0] = cutWid;
158 ee.cutParms[1] = cutWid;
159 ee.cutParms[2] = ee.sCELength /
sqrt(2.);
160 Solid eeCutBox = Box(ee.cutBoxName, ee.cutParms[0], ee.cutParms[1], ee.cutParms[2]);
163 const double zFix(ee.zFront - 3172_mm);
166 for (
unsigned int iC(0); iC != (
unsigned int)ee.nSCquad; ++iC) {
167 const unsigned int iOff(8 * iC);
168 const unsigned int ix((
unsigned int)ee.vecEESCCtrs[iOff + 0]);
169 const unsigned int iy((
unsigned int)ee.vecEESCCtrs[iOff + 1]);
171 assert(ix > 0 && ix < 11 && iy > 0 && iy < 11);
173 ee.scrFCtr[ix - 1][iy - 1] =
174 DDTranslation(ee.vecEESCCtrs[iOff + 2], ee.vecEESCCtrs[iOff + 4], ee.vecEESCCtrs[iOff + 6] + zFix);
176 ee.scrRCtr[ix - 1][iy - 1] =
177 DDTranslation(ee.vecEESCCtrs[iOff + 3], ee.vecEESCCtrs[iOff + 5], ee.vecEESCCtrs[iOff + 7] + zFix);
181 for (
unsigned int iC(0); iC != 25; ++iC) {
182 const unsigned int iOff(8 * iC);
183 const unsigned int ix((
unsigned int)ee.vecEECRCtrs[iOff + 0]);
184 const unsigned int iy((
unsigned int)ee.vecEECRCtrs[iOff + 1]);
186 assert(ix > 0 && ix < 6 && iy > 0 && iy < 6);
188 ee.cryFCtr[ix - 1][iy - 1] =
189 DDTranslation(ee.vecEECRCtrs[iOff + 2], ee.vecEECRCtrs[iOff + 4], ee.vecEECRCtrs[iOff + 6]);
191 ee.cryRCtr[ix - 1][iy - 1] =
192 DDTranslation(ee.vecEECRCtrs[iOff + 3], ee.vecEECRCtrs[iOff + 5], ee.vecEECRCtrs[iOff + 7]);
195 Solid eeCRSolid = Trap(ee.cryName,
197 atan((ee.crysRear - ee.crysFront) / (
sqrt(2.) * ee.crysLength)),
207 Volume eeCRLog =
Volume(ee.cryName, eeCRSolid, ns.material(ee.crysMat));
209 for (
unsigned int isc(0); isc < ee.nSCTypes; ++isc) {
210 unsigned int iSCType = isc + 1;
211 const string anum(std::to_string(iSCType));
212 const double eFront(0.5 * ee.sCEFront);
213 const double eRear(0.5 * ee.sCERear);
214 const double eAng(atan((ee.sCERear - ee.sCEFront) / (
sqrt(2.) * ee.sCELength)));
215 const double ffived(45_deg);
216 const double zerod(0_deg);
217 string eeSCEnvName(1 == iSCType ? ee.envName + std::to_string(iSCType)
218 : (ee.envName + std::to_string(iSCType) +
"Tmp"));
219 Solid eeSCEnv = ns.addSolidNS(
221 Trap(eeSCEnvName, 0.5 * ee.sCELength, eAng, ffived, eFront, eFront, eFront, zerod, eRear, eRear, eRear, zerod));
223 const double aFront(0.5 * ee.sCAFront);
224 const double aRear(0.5 * ee.sCARear);
225 const double aAng(atan((ee.sCARear - ee.sCAFront) / (
sqrt(2.) * ee.sCALength)));
227 (1 == iSCType ? ee.alvName + std::to_string(iSCType) : (ee.alvName + std::to_string(iSCType) +
"Tmp")));
228 Solid eeSCAlv = ns.addSolidNS(
230 Trap(eeSCAlvName, 0.5 * ee.sCALength, aAng, ffived, aFront, aFront, aFront, zerod, aRear, aRear, aRear, zerod));
232 const double dwall(ee.sCAWall);
233 const double iFront(aFront - dwall);
234 const double iRear(iFront);
235 const double iLen(ee.iLength);
236 string eeSCIntName(1 == iSCType ? ee.intName + std::to_string(iSCType)
237 : (ee.intName + std::to_string(iSCType) +
"Tmp"));
238 Solid eeSCInt = ns.addSolidNS(eeSCIntName,
241 atan((ee.sCARear - ee.sCAFront) / (
sqrt(2.) * ee.sCALength)),
252 const double dz(-0.5 * (ee.sCELength - ee.sCALength));
253 const double dxy(0.5 *
dz * (ee.sCERear - ee.sCEFront) / ee.sCELength);
254 const double zIOff(-(ee.sCALength - iLen) / 2.);
255 const double xyIOff(ee.iXYOff);
262 eeSCELog = ns.addVolumeNS(
Volume(myns + ee.envName + std::to_string(iSCType), eeSCEnv, ns.material(ee.mat)));
263 eeSCALog =
Volume(ee.alvName + std::to_string(iSCType), eeSCAlv, ns.material(ee.wallMat));
264 eeSCILog =
Volume(ee.intName + std::to_string(iSCType), eeSCInt, ns.material(ee.mat));
266 const double half(ee.cutParms[0] - ee.pFHalf * ee.crysRear);
267 const double fifth(ee.cutParms[0] + ee.pFFifth * ee.crysRear);
268 const double fac(ee.pF45);
270 const double zmm(0_mm);
276 : (5 == iSCType ?
DDTranslation(-half * fac, -half * fac, zmm)
279 const CLHEP::HepRotationZ cutm(ffived);
281 Rotation3D cutRot(5 != iSCType ? Rotation3D()
284 Rotation3D(cutm.xx(),
294 Solid eeCutEnv = SubtractionSolid(ee.envName + std::to_string(iSCType),
295 ns.solid(ee.envName + std::to_string(iSCType) +
"Tmp"),
297 Transform3D(cutRot, cutTra));
301 Solid eeCutAlv = SubtractionSolid(ee.alvName + std::to_string(iSCType),
302 ns.solid(ee.alvName + std::to_string(iSCType) +
"Tmp"),
304 Transform3D(cutRot, cutTra - extra));
306 const double mySign(iSCType < 4 ? +1. : -1.);
308 const DDTranslation extraI(xyIOff + mySign * 2_mm, xyIOff + mySign * 2_mm, zIOff);
310 Solid eeCutInt = SubtractionSolid(ee.intName + std::to_string(iSCType),
311 ns.solid(ee.intName + std::to_string(iSCType) +
"Tmp"),
313 Transform3D(cutRot, cutTra - extraI));
315 eeSCELog = ns.addVolumeNS(
Volume(myns + ee.envName + std::to_string(iSCType), eeCutEnv, ns.material(ee.mat)));
316 eeSCALog =
Volume(ee.alvName + std::to_string(iSCType), eeCutAlv, ns.material(ee.wallMat));
317 eeSCILog =
Volume(ee.intName + std::to_string(iSCType), eeCutInt, ns.material(ee.mat));
320 eeSCALog.placeVolume(eeSCILog, iSCType * 100 + 1,
Position(xyIOff, xyIOff, zIOff));
325 static const unsigned int ncol(5);
327 if (iSCType > 0 && iSCType <= ee.nSCTypes) {
328 const unsigned int icoffset((iSCType - 1) * ncol - 1);
331 for (
unsigned int icol(1); icol <= ncol; ++icol) {
333 const int ncrcol((
int)ee.vecEESCProf[icoffset + icol]);
335 const int imin(0 < ncrcol ? 1 : (0 > ncrcol ? ncol + ncrcol + 1 : 0));
336 const int imax(0 < ncrcol ? ncrcol : (0 > ncrcol ? ncol : 0));
340 for (
int irow(imin); irow <= imax; ++irow) {
345 crystal.moveto(ee.cryFCtr[icol - 1][irow - 1], ee.cryRCtr[icol - 1][irow - 1]);
347 string rname(
"EECrRoC" + std::to_string(icol) +
"R" + std::to_string(irow));
349 eeSCALog.placeVolume(
351 100 * iSCType + 10 * (icol - 1) + (irow - 1),
353 myrot(ns,
rname, crystal.rotation()),
354 Position(crystal.centrePos().x(), crystal.centrePos().y(), crystal.centrePos().z() - ee.cryZOff)));
362 for (
int icol = 1; icol <=
int(ee.nColumns); icol++) {
364 for (
int irow =
int(ee.vecEEShape[2 * icol - 2]); irow <=
int(ee.vecEEShape[2 * icol - 1]); ++irow) {
365 if (ee.vecEESCLims[0] <= icol && ee.vecEESCLims[1] >= icol && ee.vecEESCLims[2] <= irow &&
366 ee.vecEESCLims[3] >= irow) {
368 unsigned int isctype = 1;
370 for (
unsigned int ii = 0;
ii < (
unsigned int)(ee.nSCCutaway); ++
ii) {
371 if ((ee.vecEESCCutaway[3 *
ii] == icol) && (ee.vecEESCCutaway[3 *
ii + 1] == irow)) {
372 isctype =
int(ee.vecEESCCutaway[3 *
ii + 2]);
379 scrys.moveto(ee.scrFCtr[icol - 1][irow - 1], ee.scrRCtr[icol - 1][irow - 1]);
382 string rname(ee.envName + std::to_string(isctype) + std::to_string(icol) +
"R" + std::to_string(irow));
384 Volume quaLog = ns.volume(ee.quaName);
385 Volume childEnvLog = ns.volume(myns + ee.envName + std::to_string(isctype));
386 quaLog.placeVolume(childEnvLog,
387 100 * isctype + 10 * (icol - 1) + (irow - 1),
388 Transform3D(scrys.rotation(), scrys.centrePos()));