100 string myns{mynamespace(
args.parentName()).
data(), mynamespace(
args.parentName()).
size()};
103 ee.mat =
args.str(
"EEMat");
104 ee.zOff =
args.dble(
"EEzOff");
106 ee.quaName =
args.str(
"EEQuaName");
107 ee.quaMat =
args.str(
"EEQuaMat");
108 ee.crysMat =
args.str(
"EECrysMat");
109 ee.wallMat =
args.str(
"EEWallMat");
110 ee.crysLength =
args.dble(
"EECrysLength");
111 ee.crysRear =
args.dble(
"EECrysRear");
112 ee.crysFront =
args.dble(
"EECrysFront");
113 ee.sCELength =
args.dble(
"EESCELength");
114 ee.sCERear =
args.dble(
"EESCERear");
115 ee.sCEFront =
args.dble(
"EESCEFront");
116 ee.sCALength =
args.dble(
"EESCALength");
117 ee.sCARear =
args.dble(
"EESCARear");
118 ee.sCAFront =
args.dble(
"EESCAFront");
119 ee.sCAWall =
args.dble(
"EESCAWall");
120 ee.sCHLength =
args.dble(
"EESCHLength");
121 ee.sCHSide =
args.dble(
"EESCHSide");
122 ee.nSCTypes =
args.dble(
"EEnSCTypes");
123 ee.nColumns =
args.dble(
"EEnColumns");
124 ee.nSCCutaway =
args.dble(
"EEnSCCutaway");
125 ee.nSCquad =
args.dble(
"EEnSCquad");
126 ee.nCRSC =
args.dble(
"EEnCRSC");
127 ee.vecEESCProf =
args.vecDble(
"EESCProf");
128 ee.vecEEShape =
args.vecDble(
"EEShape");
129 ee.vecEESCCutaway =
args.vecDble(
"EESCCutaway");
130 ee.vecEESCCtrs =
args.vecDble(
"EESCCtrs");
131 ee.vecEECRCtrs =
args.vecDble(
"EECRCtrs");
133 ee.cutBoxName =
args.str(
"EECutBoxName");
135 ee.envName =
args.str(
"EEEnvName");
136 ee.alvName =
args.str(
"EEAlvName");
137 ee.intName =
args.str(
"EEIntName");
138 ee.cryName =
args.str(
"EECryName");
140 ee.pFHalf =
args.dble(
"EEPFHalf");
141 ee.pFFifth =
args.dble(
"EEPFFifth");
142 ee.pF45 =
args.dble(
"EEPF45");
144 ee.vecEESCLims =
args.vecDble(
"EESCLims");
145 ee.iLength =
args.dble(
"EEiLength");
146 ee.iXYOff =
args.dble(
"EEiXYOff");
147 ee.cryZOff =
args.dble(
"EECryZOff");
148 ee.zFront =
args.dble(
"EEzFront");
153 const double cutWid(ee.sCERear /
sqrt(2.));
154 ee.cutParms[0] = cutWid;
155 ee.cutParms[1] = cutWid;
156 ee.cutParms[2] = ee.sCELength /
sqrt(2.);
157 Solid eeCutBox = Box(ee.cutBoxName, ee.cutParms[0], ee.cutParms[1], ee.cutParms[2]);
160 const double zFix(ee.zFront - 3172_mm);
163 for (
unsigned int iC(0); iC != (
unsigned int)ee.nSCquad; ++iC) {
164 const unsigned int iOff(8 * iC);
165 const unsigned int ix((
unsigned int)ee.vecEESCCtrs[iOff + 0]);
166 const unsigned int iy((
unsigned int)ee.vecEESCCtrs[iOff + 1]);
168 assert(ix > 0 && ix < 11 && iy > 0 && iy < 11);
170 ee.scrFCtr[ix - 1][iy - 1] =
171 DDTranslation(ee.vecEESCCtrs[iOff + 2], ee.vecEESCCtrs[iOff + 4], ee.vecEESCCtrs[iOff + 6] + zFix);
173 ee.scrRCtr[ix - 1][iy - 1] =
174 DDTranslation(ee.vecEESCCtrs[iOff + 3], ee.vecEESCCtrs[iOff + 5], ee.vecEESCCtrs[iOff + 7] + zFix);
178 for (
unsigned int iC(0); iC != 25; ++iC) {
179 const unsigned int iOff(8 * iC);
180 const unsigned int ix((
unsigned int)ee.vecEECRCtrs[iOff + 0]);
181 const unsigned int iy((
unsigned int)ee.vecEECRCtrs[iOff + 1]);
183 assert(ix > 0 && ix < 6 && iy > 0 && iy < 6);
185 ee.cryFCtr[ix - 1][iy - 1] =
186 DDTranslation(ee.vecEECRCtrs[iOff + 2], ee.vecEECRCtrs[iOff + 4], ee.vecEECRCtrs[iOff + 6]);
188 ee.cryRCtr[ix - 1][iy - 1] =
189 DDTranslation(ee.vecEECRCtrs[iOff + 3], ee.vecEECRCtrs[iOff + 5], ee.vecEECRCtrs[iOff + 7]);
192 Solid eeCRSolid = Trap(ee.cryName,
194 atan((ee.crysRear - ee.crysFront) / (
sqrt(2.) * ee.crysLength)),
204 Volume eeCRLog =
Volume(ee.cryName, eeCRSolid, ns.material(ee.crysMat));
206 for (
unsigned int isc(0); isc < ee.nSCTypes; ++isc) {
207 unsigned int iSCType = isc + 1;
208 const string anum(std::to_string(iSCType));
209 const double eFront(0.5 * ee.sCEFront);
210 const double eRear(0.5 * ee.sCERear);
211 const double eAng(atan((ee.sCERear - ee.sCEFront) / (
sqrt(2.) * ee.sCELength)));
212 const double ffived(45_deg);
213 const double zerod(0_deg);
214 string eeSCEnvName(1 == iSCType ? ee.envName + std::to_string(iSCType)
215 : (ee.envName + std::to_string(iSCType) +
"Tmp"));
216 Solid eeSCEnv = ns.addSolidNS(
218 Trap(eeSCEnvName, 0.5 * ee.sCELength, eAng, ffived, eFront, eFront, eFront, zerod, eRear, eRear, eRear, zerod));
220 const double aFront(0.5 * ee.sCAFront);
221 const double aRear(0.5 * ee.sCARear);
222 const double aAng(atan((ee.sCARear - ee.sCAFront) / (
sqrt(2.) * ee.sCALength)));
224 (1 == iSCType ? ee.alvName + std::to_string(iSCType) : (ee.alvName + std::to_string(iSCType) +
"Tmp")));
225 Solid eeSCAlv = ns.addSolidNS(
227 Trap(eeSCAlvName, 0.5 * ee.sCALength, aAng, ffived, aFront, aFront, aFront, zerod, aRear, aRear, aRear, zerod));
229 const double dwall(ee.sCAWall);
230 const double iFront(aFront - dwall);
231 const double iRear(iFront);
232 const double iLen(ee.iLength);
233 string eeSCIntName(1 == iSCType ? ee.intName + std::to_string(iSCType)
234 : (ee.intName + std::to_string(iSCType) +
"Tmp"));
235 Solid eeSCInt = ns.addSolidNS(eeSCIntName,
238 atan((ee.sCARear - ee.sCAFront) / (
sqrt(2.) * ee.sCALength)),
249 const double dz(-0.5 * (ee.sCELength - ee.sCALength));
250 const double dxy(0.5 *
dz * (ee.sCERear - ee.sCEFront) / ee.sCELength);
251 const double zIOff(-(ee.sCALength - iLen) / 2.);
252 const double xyIOff(ee.iXYOff);
259 eeSCELog = ns.addVolumeNS(
Volume(myns + ee.envName + std::to_string(iSCType), eeSCEnv, ns.material(ee.mat)));
260 eeSCALog =
Volume(ee.alvName + std::to_string(iSCType), eeSCAlv, ns.material(ee.wallMat));
261 eeSCILog =
Volume(ee.intName + std::to_string(iSCType), eeSCInt, ns.material(ee.mat));
263 const double half(ee.cutParms[0] - ee.pFHalf * ee.crysRear);
264 const double fifth(ee.cutParms[0] + ee.pFFifth * ee.crysRear);
265 const double fac(ee.pF45);
267 const double zmm(0_mm);
273 : (5 == iSCType ?
DDTranslation(-half * fac, -half * fac, zmm)
276 const CLHEP::HepRotationZ cutm(ffived);
278 Rotation3D cutRot(5 != iSCType ? Rotation3D()
281 Rotation3D(cutm.xx(),
291 Solid eeCutEnv = SubtractionSolid(ee.envName + std::to_string(iSCType),
292 ns.solid(ee.envName + std::to_string(iSCType) +
"Tmp"),
294 Transform3D(cutRot, cutTra));
298 Solid eeCutAlv = SubtractionSolid(ee.alvName + std::to_string(iSCType),
299 ns.solid(ee.alvName + std::to_string(iSCType) +
"Tmp"),
301 Transform3D(cutRot, cutTra - extra));
303 const double mySign(iSCType < 4 ? +1. : -1.);
305 const DDTranslation extraI(xyIOff + mySign * 2_mm, xyIOff + mySign * 2_mm, zIOff);
307 Solid eeCutInt = SubtractionSolid(ee.intName + std::to_string(iSCType),
308 ns.solid(ee.intName + std::to_string(iSCType) +
"Tmp"),
310 Transform3D(cutRot, cutTra - extraI));
312 eeSCELog = ns.addVolumeNS(
Volume(myns + ee.envName + std::to_string(iSCType), eeCutEnv, ns.material(ee.mat)));
313 eeSCALog =
Volume(ee.alvName + std::to_string(iSCType), eeCutAlv, ns.material(ee.wallMat));
314 eeSCILog =
Volume(ee.intName + std::to_string(iSCType), eeCutInt, ns.material(ee.mat));
317 eeSCALog.placeVolume(eeSCILog, iSCType * 100 + 1,
Position(xyIOff, xyIOff, zIOff));
322 static const unsigned int ncol(5);
324 if (iSCType > 0 && iSCType <= ee.nSCTypes) {
325 const unsigned int icoffset((iSCType - 1) * ncol - 1);
328 for (
unsigned int icol(1); icol <= ncol; ++icol) {
330 const int ncrcol((
int)ee.vecEESCProf[icoffset + icol]);
332 const int imin(0 < ncrcol ? 1 : (0 > ncrcol ? ncol + ncrcol + 1 : 0));
333 const int imax(0 < ncrcol ? ncrcol : (0 > ncrcol ? ncol : 0));
337 for (
int irow(imin); irow <= imax; ++irow) {
342 crystal.moveto(ee.cryFCtr[icol - 1][irow - 1], ee.cryRCtr[icol - 1][irow - 1]);
344 string rname(
"EECrRoC" + std::to_string(icol) +
"R" + std::to_string(irow));
346 eeSCALog.placeVolume(
348 100 * iSCType + 10 * (icol - 1) + (irow - 1),
350 myrot(ns,
rname, crystal.rotation()),
351 Position(crystal.centrePos().x(), crystal.centrePos().y(), crystal.centrePos().z() - ee.cryZOff)));
359 for (
int icol = 1; icol <=
int(ee.nColumns); icol++) {
361 for (
int irow =
int(ee.vecEEShape[2 * icol - 2]); irow <=
int(ee.vecEEShape[2 * icol - 1]); ++irow) {
362 if (ee.vecEESCLims[0] <= icol && ee.vecEESCLims[1] >= icol && ee.vecEESCLims[2] <= irow &&
363 ee.vecEESCLims[3] >= irow) {
365 unsigned int isctype = 1;
367 for (
unsigned int ii = 0;
ii < (
unsigned int)(ee.nSCCutaway); ++
ii) {
368 if ((ee.vecEESCCutaway[3 *
ii] == icol) && (ee.vecEESCCutaway[3 *
ii + 1] == irow)) {
369 isctype =
int(ee.vecEESCCutaway[3 *
ii + 2]);
376 scrys.moveto(ee.scrFCtr[icol - 1][irow - 1], ee.scrRCtr[icol - 1][irow - 1]);
379 string rname(ee.envName + std::to_string(isctype) + std::to_string(icol) +
"R" + std::to_string(irow));
381 Volume quaLog = ns.volume(ee.quaName);
382 Volume childEnvLog = ns.volume(myns + ee.envName + std::to_string(isctype));
383 quaLog.placeVolume(childEnvLog,
384 100 * isctype + 10 * (icol - 1) + (irow - 1),
385 Transform3D(scrys.rotation(), scrys.centrePos()));