CMS 3D CMS Logo

DDEcalEndcapAlgo.cc
Go to the documentation of this file.
1 
3 // File: DDEcalEndcapAlgo.cc
4 // Description: Geometry factory class for Ecal Barrel
6 
7 #include <cmath>
8 #include <algorithm>
9 
14 #include "CLHEP/Units/GlobalSystemOfUnits.h"
15 
16 #include <CLHEP/Geometry/Transform3D.h>
17 
18 // Header files for endcap supercrystal geometry
20 
21 #include <map>
22 #include <string>
23 #include <vector>
31 #include "CLHEP/Geometry/Transform3D.h"
32 
33 class DDEcalEndcapAlgo : public DDAlgorithm {
34 public:
36  typedef HepGeom::Point3D<double> Pt3D;
37  typedef HepGeom::Transform3D Tf3D;
38  typedef HepGeom::ReflectZ3D RfZ3D;
39  typedef HepGeom::Translate3D Tl3D;
40  typedef HepGeom::Rotate3D Ro3D;
41  typedef HepGeom::RotateZ3D RoZ3D;
42  typedef HepGeom::RotateY3D RoY3D;
43  typedef HepGeom::RotateX3D RoX3D;
44 
45  typedef CLHEP::Hep3Vector Vec3;
46  typedef CLHEP::HepRotation Rota;
47 
48  //Constructor and Destructor
50  ~DDEcalEndcapAlgo() override;
51 
52  void initialize(const DDNumericArguments& nArgs,
53  const DDVectorArguments& vArgs,
54  const DDMapArguments& mArgs,
55  const DDStringArguments& sArgs,
56  const DDStringVectorArguments& vsArgs) override;
57  void execute(DDCompactView& cpv) override;
58 
59  // New methods for SC geometry
60  void EEPositionCRs(const DDName& pName, const DDTranslation& offset, const int iSCType, DDCompactView& cpv);
61 
62  void EECreateSC(const unsigned int iSCType, DDCompactView& cpv);
63 
64  void EECreateCR();
65 
66  void EEPosSC(const int iCol, const int iRow, DDName EEDeeName);
67 
68  unsigned int EEGetSCType(const unsigned int iCol, const unsigned int iRow);
69 
70  DDName EEGetSCName(const int iCol, const int iRow);
71 
72  std::vector<double> EEGetSCCtrs(const int iCol, const int iRow);
73 
74  DDMaterial ddmat(const std::string& s) const;
75  DDName ddname(const std::string& s) const;
76  DDRotation myrot(const std::string& s, const DDRotationMatrix& r) const;
77 
78  const std::string& idNameSpace() const { return m_idNameSpace; }
79 
80  // endcap parent volume
81  DDMaterial eeMat() const { return ddmat(m_EEMat); }
82  double eezOff() const { return m_EEzOff; }
83 
84  DDName eeQuaName() const { return ddname(m_EEQuaName); }
85  DDMaterial eeQuaMat() const { return ddmat(m_EEQuaMat); }
86 
87  DDMaterial eeCrysMat() const { return ddmat(m_EECrysMat); }
88  DDMaterial eeWallMat() const { return ddmat(m_EEWallMat); }
89 
90  double eeCrysLength() const { return m_EECrysLength; }
91  double eeCrysRear() const { return m_EECrysRear; }
92  double eeCrysFront() const { return m_EECrysFront; }
93  double eeSCELength() const { return m_EESCELength; }
94  double eeSCERear() const { return m_EESCERear; }
95  double eeSCEFront() const { return m_EESCEFront; }
96  double eeSCALength() const { return m_EESCALength; }
97  double eeSCARear() const { return m_EESCARear; }
98  double eeSCAFront() const { return m_EESCAFront; }
99  double eeSCAWall() const { return m_EESCAWall; }
100  double eeSCHLength() const { return m_EESCHLength; }
101  double eeSCHSide() const { return m_EESCHSide; }
102 
103  double eenSCTypes() const { return m_EEnSCTypes; }
104  double eenColumns() const { return m_EEnColumns; }
105  double eenSCCutaway() const { return m_EEnSCCutaway; }
106  double eenSCquad() const { return m_EEnSCquad; }
107  double eenCRSC() const { return m_EEnCRSC; }
108  const std::vector<double>& eevecEESCProf() const { return m_vecEESCProf; }
109  const std::vector<double>& eevecEEShape() const { return m_vecEEShape; }
110  const std::vector<double>& eevecEESCCutaway() const { return m_vecEESCCutaway; }
111  const std::vector<double>& eevecEESCCtrs() const { return m_vecEESCCtrs; }
112  const std::vector<double>& eevecEECRCtrs() const { return m_vecEECRCtrs; }
113 
114  DDName cutBoxName() const { return ddname(m_cutBoxName); }
115  double eePFHalf() const { return m_PFhalf; }
116  double eePFFifth() const { return m_PFfifth; }
117  double eePF45() const { return m_PF45; }
118 
119  DDName envName(unsigned int i) const { return ddname(m_envName + std::to_string(i)); }
120  DDName alvName(unsigned int i) const { return ddname(m_alvName + std::to_string(i)); }
121  DDName intName(unsigned int i) const { return ddname(m_intName + std::to_string(i)); }
122  DDName cryName() const { return ddname(m_cryName); }
123 
124  DDName addTmp(DDName aName) const { return ddname(aName.name() + "Tmp"); }
125 
126  const DDTranslation& cryFCtr(unsigned int iRow, unsigned int iCol) const { return m_cryFCtr[iRow - 1][iCol - 1]; }
127 
128  const DDTranslation& cryRCtr(unsigned int iRow, unsigned int iCol) const { return m_cryRCtr[iRow - 1][iCol - 1]; }
129 
130  const DDTranslation& scrFCtr(unsigned int iRow, unsigned int iCol) const { return m_scrFCtr[iRow - 1][iCol - 1]; }
131 
132  const DDTranslation& scrRCtr(unsigned int iRow, unsigned int iCol) const { return m_scrRCtr[iRow - 1][iCol - 1]; }
133 
134  const std::vector<double>& vecEESCLims() const { return m_vecEESCLims; }
135 
136  double iLength() const { return m_iLength; }
137  double iXYOff() const { return m_iXYOff; }
138 
139 protected:
140 private:
141  std::string m_idNameSpace; //Namespace of this and ALL sub-parts
142 
143  // Barrel volume
145  double m_EEzOff;
146 
149 
152 
154  double m_EECrysRear;
157  double m_EESCERear;
158  double m_EESCEFront;
160  double m_EESCARear;
161  double m_EESCAFront;
162  double m_EESCAWall;
164  double m_EESCHSide;
165 
166  double m_EEnSCTypes;
167  std::vector<double> m_vecEESCProf;
168  double m_EEnColumns;
169  std::vector<double> m_vecEEShape;
171  std::vector<double> m_vecEESCCutaway;
172  double m_EEnSCquad;
173  std::vector<double> m_vecEESCCtrs;
174  double m_EEnCRSC;
175  std::vector<double> m_vecEECRCtrs;
176 
177  const std::vector<double>* m_cutParms;
179 
184 
187 
190 
191  double m_PFhalf;
192  double m_PFfifth;
193  double m_PF45;
194 
195  std::vector<double> m_vecEESCLims;
196 
197  double m_iLength;
198 
199  double m_iXYOff;
200 
201  double m_cryZOff;
202 
203  double m_zFront;
204 };
205 
206 namespace std {}
207 using namespace std;
208 
210  : m_idNameSpace(""),
211  m_EEMat(""),
212  m_EEzOff(0),
213  m_EEQuaName(""),
214  m_EEQuaMat(""),
215  m_EECrysMat(""),
216  m_EEWallMat(""),
217  m_EECrysLength(0),
218  m_EECrysRear(0),
219  m_EECrysFront(0),
220  m_EESCELength(0),
221  m_EESCERear(0),
222  m_EESCEFront(0),
223  m_EESCALength(0),
224  m_EESCARear(0),
225  m_EESCAFront(0),
226  m_EESCAWall(0),
227  m_EESCHLength(0),
228  m_EESCHSide(0),
229  m_EEnSCTypes(0),
230  m_vecEESCProf(),
231  m_EEnColumns(0),
232  m_vecEEShape(),
233  m_EEnSCCutaway(0),
234  m_vecEESCCutaway(),
235  m_EEnSCquad(0),
236  m_vecEESCCtrs(),
237  m_EEnCRSC(0),
238  m_vecEECRCtrs(),
239  m_cutParms(nullptr),
240  m_cutBoxName(""),
241  m_envName(""),
242  m_alvName(""),
243  m_intName(""),
244  m_cryName(""),
245  m_PFhalf(0),
246  m_PFfifth(0),
247  m_PF45(0),
248  m_vecEESCLims(),
249  m_iLength(0),
250  m_iXYOff(0),
251  m_cryZOff(0),
252  m_zFront(0) {
253  LogDebug("EcalGeom") << "DDEcalEndcapAlgo info: Creating an instance";
254 }
255 
257 
259  const DDVectorArguments& vArgs,
260  const DDMapArguments& /*mArgs*/,
261  const DDStringArguments& sArgs,
262  const DDStringVectorArguments& /*vsArgs*/) {
263  // edm::LogInfo("EcalGeom") << "DDEcalEndcapAlgo info: Initialize" ;
265  // TRICK!
266  m_idNameSpace = parent().name().ns();
267  // barrel parent volume
268  m_EEMat = sArgs["EEMat"];
269  m_EEzOff = nArgs["EEzOff"];
270 
271  m_EEQuaName = sArgs["EEQuaName"];
272  m_EEQuaMat = sArgs["EEQuaMat"];
273  m_EECrysMat = sArgs["EECrysMat"];
274  m_EEWallMat = sArgs["EEWallMat"];
275  m_EECrysLength = nArgs["EECrysLength"];
276  m_EECrysRear = nArgs["EECrysRear"];
277  m_EECrysFront = nArgs["EECrysFront"];
278  m_EESCELength = nArgs["EESCELength"];
279  m_EESCERear = nArgs["EESCERear"];
280  m_EESCEFront = nArgs["EESCEFront"];
281  m_EESCALength = nArgs["EESCALength"];
282  m_EESCARear = nArgs["EESCARear"];
283  m_EESCAFront = nArgs["EESCAFront"];
284  m_EESCAWall = nArgs["EESCAWall"];
285  m_EESCHLength = nArgs["EESCHLength"];
286  m_EESCHSide = nArgs["EESCHSide"];
287  m_EEnSCTypes = nArgs["EEnSCTypes"];
288  m_EEnColumns = nArgs["EEnColumns"];
289  m_EEnSCCutaway = nArgs["EEnSCCutaway"];
290  m_EEnSCquad = nArgs["EEnSCquad"];
291  m_EEnCRSC = nArgs["EEnCRSC"];
292  m_vecEESCProf = vArgs["EESCProf"];
293  m_vecEEShape = vArgs["EEShape"];
294  m_vecEESCCutaway = vArgs["EESCCutaway"];
295  m_vecEESCCtrs = vArgs["EESCCtrs"];
296  m_vecEECRCtrs = vArgs["EECRCtrs"];
297 
298  m_cutBoxName = sArgs["EECutBoxName"];
299 
300  m_envName = sArgs["EEEnvName"];
301  m_alvName = sArgs["EEAlvName"];
302  m_intName = sArgs["EEIntName"];
303  m_cryName = sArgs["EECryName"];
304 
305  m_PFhalf = nArgs["EEPFHalf"];
306  m_PFfifth = nArgs["EEPFFifth"];
307  m_PF45 = nArgs["EEPF45"];
308 
309  m_vecEESCLims = vArgs["EESCLims"];
310 
311  m_iLength = nArgs["EEiLength"];
312 
313  m_iXYOff = nArgs["EEiXYOff"];
314 
315  m_cryZOff = nArgs["EECryZOff"];
316 
317  m_zFront = nArgs["EEzFront"];
318 }
319 
321 // DDEcalEndcapAlgo methods...
323 
325  return DDrot(ddname(m_idNameSpace + ":" + s), std::make_unique<DDRotationMatrix>(r));
326 }
327 
329 
331  const pair<std::string, std::string> temp(DDSplit(s));
332  if (temp.second.empty()) {
333  return DDName(temp.first, m_idNameSpace);
334  } else {
335  return DDName(temp.first, temp.second);
336  }
337 }
338 
339 //-------------------- Endcap SC geometry methods ---------------------
340 
342  // Position supercrystals in EE Quadrant
343  // Version: 1.00
344  // Created: 30 July 2007
345  // Last Mod:
346  //---------------------------------------------------------------------
347 
348  //********************************* cutbox for trimming edge SCs
349  const double cutWid(eeSCERear() / sqrt(2.));
350  const DDSolid eeCutBox(DDSolidFactory::box(cutBoxName(), cutWid, cutWid, eeSCELength() / sqrt(2.)));
351  m_cutParms = &eeCutBox.parameters();
352  //**************************************************************
353 
354  const double zFix(m_zFront - 3172 * mm); // fix for changing z offset
355 
356  //** fill supercrystal front and rear center positions from xml input
357  for (unsigned int iC(0); iC != (unsigned int)eenSCquad(); ++iC) {
358  const unsigned int iOff(8 * iC);
359  const unsigned int ix((unsigned int)eevecEESCCtrs()[iOff + 0]);
360  const unsigned int iy((unsigned int)eevecEESCCtrs()[iOff + 1]);
361 
362  assert(ix > 0 && ix < 11 && iy > 0 && iy < 11);
363 
364  m_scrFCtr[ix - 1][iy - 1] =
365  DDTranslation(eevecEESCCtrs()[iOff + 2], eevecEESCCtrs()[iOff + 4], eevecEESCCtrs()[iOff + 6] + zFix);
366 
367  m_scrRCtr[ix - 1][iy - 1] =
368  DDTranslation(eevecEESCCtrs()[iOff + 3], eevecEESCCtrs()[iOff + 5], eevecEESCCtrs()[iOff + 7] + zFix);
369  }
370 
371  //** fill crystal front and rear center positions from xml input
372  for (unsigned int iC(0); iC != 25; ++iC) {
373  const unsigned int iOff(8 * iC);
374  const unsigned int ix((unsigned int)eevecEECRCtrs()[iOff + 0]);
375  const unsigned int iy((unsigned int)eevecEECRCtrs()[iOff + 1]);
376 
377  assert(ix > 0 && ix < 6 && iy > 0 && iy < 6);
378 
379  m_cryFCtr[ix - 1][iy - 1] =
380  DDTranslation(eevecEECRCtrs()[iOff + 2], eevecEECRCtrs()[iOff + 4], eevecEECRCtrs()[iOff + 6]);
381 
382  m_cryRCtr[ix - 1][iy - 1] =
383  DDTranslation(eevecEECRCtrs()[iOff + 3], eevecEECRCtrs()[iOff + 5], eevecEECRCtrs()[iOff + 7]);
384  }
385 
386  EECreateCR(); // make a single crystal just once here
387 
388  for (unsigned int isc(0); isc < eenSCTypes(); ++isc) {
389  EECreateSC(isc + 1, cpv);
390  }
391 
392  const std::vector<double>& colLimits(eevecEEShape());
393  //** Loop over endcap columns
394  for (int icol = 1; icol <= int(eenColumns()); icol++) {
395  //** Loop over SCs in column, using limits from xml input
396  for (int irow = int(colLimits[2 * icol - 2]); irow <= int(colLimits[2 * icol - 1]); ++irow) {
397  if (vecEESCLims()[0] <= icol && vecEESCLims()[1] >= icol && vecEESCLims()[2] <= irow &&
398  vecEESCLims()[3] >= irow) {
399  // Find SC type (complete or partial) for this location
400  const unsigned int isctype(EEGetSCType(icol, irow));
401 
402  // Create SC as a DDEcalEndcapTrap object and calculate rotation and
403  // translation required to position it in the endcap.
405 
406  scrys.moveto(scrFCtr(icol, irow), scrRCtr(icol, irow));
407  scrys.translate(DDTranslation(0., 0., -eezOff()));
408 
409  DDName rname(envName(isctype).name() + std::to_string(icol) + "R" + std::to_string(irow));
410  /*
411  edm::LogInfo("EcalGeom") << "Quadrant, SC col/row "
412  << eeQuaName() << " " << icol << " / " << irow << std::endl
413  << " Limits " << int(colLimits[2*icol-2]) << "->" << int(colLimits[2*icol-1]) << std::endl
414  << " SC type = " << isctype << std::endl
415  << " Zoff, Scz = " << eezOff() << " " << sc1.z() << std::endl
416  << " Rotation " << rname << " " << scrys.rotation() << std::endl
417  << " Position " << sccentre << std::endl;
418 */
419  // Position SC in endcap
420  cpv.position(envName(isctype),
421  eeQuaName(),
422  100 * isctype + 10 * (icol - 1) + (irow - 1),
423  scrys.centrePos(),
424  myrot(rname.fullname(), scrys.rotation()));
425  }
426  }
427  }
428 }
429 
430 void DDEcalEndcapAlgo::EECreateSC(const unsigned int iSCType,
431  DDCompactView& cpv) { // EECreateSCType Create SC logical volume of the given type
432 
433  DDRotation noRot;
434 
435  DDLogicalPart eeSCELog;
436  DDLogicalPart eeSCALog;
437  DDLogicalPart eeSCILog;
438 
439  // edm::LogInfo("EcalGeom") << "EECreateSC: Creating SC envelope" << std::endl;
440 
441  const string anum(std::to_string(iSCType));
442 
443  const double eFront(0.5 * eeSCEFront());
444  const double eRear(0.5 * eeSCERear());
445  const double eAng(atan((eeSCERear() - eeSCEFront()) / (sqrt(2.) * eeSCELength())));
446  const double ffived(45 * deg);
447  const double zerod(0 * deg);
448  DDSolid eeSCEnv(DDSolidFactory::trap((1 == iSCType ? envName(iSCType) : addTmp(envName(iSCType))),
449  0.5 * eeSCELength(),
450  eAng,
451  ffived,
452  eFront,
453  eFront,
454  eFront,
455  zerod,
456  eRear,
457  eRear,
458  eRear,
459  zerod));
460 
461  const double aFront(0.5 * eeSCAFront());
462  const double aRear(0.5 * eeSCARear());
463  const double aAng(atan((eeSCARear() - eeSCAFront()) / (sqrt(2.) * eeSCALength())));
464  const DDSolid eeSCAlv(DDSolidFactory::trap((1 == iSCType ? alvName(iSCType) : addTmp(alvName(iSCType))),
465  0.5 * eeSCALength(),
466  aAng,
467  ffived,
468  aFront,
469  aFront,
470  aFront,
471  zerod,
472  aRear,
473  aRear,
474  aRear,
475  zerod));
476 
477  const double dwall(eeSCAWall());
478  const double iFront(aFront - dwall);
479  const double iRear(iFront); //aRear - dwall ) ;
480  const double iLen(iLength()); //0.075*eeSCALength() ) ;
481  const DDSolid eeSCInt(DDSolidFactory::trap((1 == iSCType ? intName(iSCType) : addTmp(intName(iSCType))),
482  iLen / 2.,
483  atan((eeSCARear() - eeSCAFront()) / (sqrt(2.) * eeSCALength())),
484  ffived,
485  iFront,
486  iFront,
487  iFront,
488  zerod,
489  iRear,
490  iRear,
491  iRear,
492  zerod));
493 
494  const double dz(-0.5 * (eeSCELength() - eeSCALength()));
495  const double dxy(0.5 * dz * (eeSCERear() - eeSCEFront()) / eeSCELength());
496  const double zIOff(-(eeSCALength() - iLen) / 2.);
497  const double xyIOff(iXYOff());
498 
499  if (1 == iSCType) // standard SC in this block
500  {
501  eeSCELog = DDLogicalPart(envName(iSCType), eeMat(), eeSCEnv);
502  eeSCALog = DDLogicalPart(alvName(iSCType), eeWallMat(), eeSCAlv);
503  eeSCILog = DDLogicalPart(intName(iSCType), eeMat(), eeSCInt);
504  } else // partial SCs this block: create subtraction volumes as appropriate
505  {
506  const double half((*m_cutParms)[0] - eePFHalf() * eeCrysRear());
507  const double fifth((*m_cutParms)[0] + eePFFifth() * eeCrysRear());
508  const double fac(eePF45());
509 
510  const double zmm(0 * mm);
511 
512  DDTranslation cutTra(
513  2 == iSCType ? DDTranslation(zmm, half, zmm)
514  : (3 == iSCType ? DDTranslation(half, zmm, zmm)
515  : (4 == iSCType ? DDTranslation(zmm, -fifth, zmm)
516  : (5 == iSCType ? DDTranslation(-half * fac, -half * fac, zmm)
517  : DDTranslation(-fifth, zmm, zmm)))));
518 
519  const CLHEP::HepRotationZ cutm(ffived);
520 
521  DDRotation cutRot(5 != iSCType ? noRot
522  : myrot("EECry5Rot",
523  DDRotationMatrix(cutm.xx(),
524  cutm.xy(),
525  cutm.xz(),
526  cutm.yx(),
527  cutm.yy(),
528  cutm.yz(),
529  cutm.zx(),
530  cutm.zy(),
531  cutm.zz())));
532 
533  DDSolid eeCutEnv(
534  DDSolidFactory::subtraction(envName(iSCType), addTmp(envName(iSCType)), cutBoxName(), cutTra, cutRot));
535 
536  const DDTranslation extra(dxy, dxy, dz);
537 
538  DDSolid eeCutAlv(
539  DDSolidFactory::subtraction(alvName(iSCType), addTmp(alvName(iSCType)), cutBoxName(), cutTra - extra, cutRot));
540 
541  const double mySign(iSCType < 4 ? +1. : -1.);
542 
543  const DDTranslation extraI(xyIOff + mySign * 2 * mm, xyIOff + mySign * 2 * mm, zIOff);
544 
545  DDSolid eeCutInt(
546  DDSolidFactory::subtraction(intName(iSCType), addTmp(intName(iSCType)), cutBoxName(), cutTra - extraI, cutRot));
547 
548  eeSCELog = DDLogicalPart(envName(iSCType), eeMat(), eeCutEnv);
549  eeSCALog = DDLogicalPart(alvName(iSCType), eeWallMat(), eeCutAlv);
550  eeSCILog = DDLogicalPart(intName(iSCType), eeMat(), eeCutInt);
551  }
552 
553  cpv.position(eeSCALog, envName(iSCType), iSCType * 100 + 1, DDTranslation(dxy, dxy, dz), noRot);
554  cpv.position(eeSCILog, alvName(iSCType), iSCType * 100 + 1, DDTranslation(xyIOff, xyIOff, zIOff), noRot);
555 
556  DDTranslation croffset(0., 0., 0.);
557  EEPositionCRs(alvName(iSCType), croffset, iSCType, cpv);
558 }
559 
560 unsigned int DDEcalEndcapAlgo::EEGetSCType(const unsigned int iCol, const unsigned int iRow) {
561  unsigned int iType = 1;
562  for (unsigned int ii = 0; ii < (unsigned int)(eenSCCutaway()); ++ii) {
563  if ((eevecEESCCutaway()[3 * ii] == iCol) && (eevecEESCCutaway()[3 * ii + 1] == iRow)) {
564  iType = int(eevecEESCCutaway()[3 * ii + 2]);
565  // edm::LogInfo("EcalGeom") << "EEGetSCType: col, row, type = "
566  // << iCol << " " << iRow << " " << iType << std::endl;
567  }
568  }
569  return iType;
570 }
571 
573  // EECreateCR Create endcap crystal logical volume
574 
575  // edm::LogInfo("EcalGeom") << "EECreateCR: = " << std::endl;
576 
578  0.5 * eeCrysLength(),
579  atan((eeCrysRear() - eeCrysFront()) / (sqrt(2.) * eeCrysLength())),
580  45. * deg,
581  0.5 * eeCrysFront(),
582  0.5 * eeCrysFront(),
583  0.5 * eeCrysFront(),
584  0. * deg,
585  0.5 * eeCrysRear(),
586  0.5 * eeCrysRear(),
587  0.5 * eeCrysRear(),
588  0. * deg));
589 
590  DDLogicalPart part(cryName(), eeCrysMat(), EECRSolid);
591 }
592 
594  const DDTranslation& /*offset*/,
595  const int iSCType,
596  DDCompactView& cpv) {
597  // EEPositionCRs Position crystals within parent supercrystal interior volume
598 
599  // edm::LogInfo("EcalGeom") << "EEPositionCRs called " << std::endl;
600 
601  static const unsigned int ncol(5);
602 
603  if (iSCType > 0 && iSCType <= eenSCTypes()) {
604  const unsigned int icoffset((iSCType - 1) * ncol - 1);
605 
606  // Loop over columns of SC
607  for (unsigned int icol(1); icol <= ncol; ++icol) {
608  // Get column limits for this SC type from xml input
609  const int ncrcol((int)eevecEESCProf()[icoffset + icol]);
610 
611  const int imin(0 < ncrcol ? 1 : (0 > ncrcol ? ncol + ncrcol + 1 : 0));
612  const int imax(0 < ncrcol ? ncrcol : (0 > ncrcol ? ncol : 0));
613 
614  if (imax > 0) {
615  // Loop over crystals in this row
616  for (int irow(imin); irow <= imax; ++irow) {
617  // edm::LogInfo("EcalGeom") << " type, col, row " << iSCType
618  // << " " << icol << " " << irow << std::endl;
619 
620  // Create crystal as a DDEcalEndcapTrap object and calculate rotation and
621  // translation required to position it in the SC.
623 
624  crystal.moveto(cryFCtr(icol, irow), cryRCtr(icol, irow));
625 
626  DDName rname("EECrRoC" + std::to_string(icol) + "R" + std::to_string(irow));
627 
628  cpv.position(cryName(),
629  pName,
630  100 * iSCType + 10 * (icol - 1) + (irow - 1),
631  crystal.centrePos() - DDTranslation(0, 0, m_cryZOff),
632  myrot(rname.fullname(), crystal.rotation()));
633  }
634  }
635  }
636  }
637 }
638 
640 
641 DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDEcalEndcapAlgo, "ecal:DDEcalEndcapAlgo");
DDEcalEndcapAlgo::m_vecEEShape
std::vector< double > m_vecEEShape
Definition: DDEcalEndcapAlgo.cc:169
DDEcalEndcapAlgo::m_EEMat
std::string m_EEMat
Definition: DDEcalEndcapAlgo.cc:144
DDEcalEndcapAlgo::Trap
EcalTrapezoidParameters Trap
Definition: DDEcalEndcapAlgo.cc:35
DDEcalEndcapAlgo::cryName
DDName cryName() const
Definition: DDEcalEndcapAlgo.cc:122
DDEcalEndcapTrap::rotation
DDRotationMatrix rotation()
Definition: DDEcalEndcapTrap.h:35
DDEcalEndcapAlgo::m_EEzOff
double m_EEzOff
Definition: DDEcalEndcapAlgo.cc:145
DDCurrentNamespace.h
DDEcalEndcapAlgo::m_scrFCtr
DDTranslation m_scrFCtr[10][10]
Definition: DDEcalEndcapAlgo.cc:188
mps_fire.i
i
Definition: mps_fire.py:428
DDTransform.h
MessageLogger.h
DDrot
DDRotation DDrot(const DDName &name, std::unique_ptr< DDRotationMatrix > rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:67
DDEcalEndcapAlgo::Rota
CLHEP::HepRotation Rota
Definition: DDEcalEndcapAlgo.cc:46
EcalTrapezoidParameters
Definition: EcalTrapezoidParameters.h:62
DDEcalEndcapAlgo::addTmp
DDName addTmp(DDName aName) const
Definition: DDEcalEndcapAlgo.cc:124
DDEcalEndcapAlgo::eenCRSC
double eenCRSC() const
Definition: DDEcalEndcapAlgo.cc:107
DDEcalEndcapAlgo::m_EEnSCTypes
double m_EEnSCTypes
Definition: DDEcalEndcapAlgo.cc:166
DDEcalEndcapAlgo::m_cryRCtr
DDTranslation m_cryRCtr[5][5]
Definition: DDEcalEndcapAlgo.cc:186
DDEcalEndcapAlgo::iLength
double iLength() const
Definition: DDEcalEndcapAlgo.cc:136
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
DDEcalEndcapAlgo::m_EESCARear
double m_EESCARear
Definition: DDEcalEndcapAlgo.cc:160
DDEcalEndcapAlgo::EEGetSCCtrs
std::vector< double > EEGetSCCtrs(const int iCol, const int iRow)
DDEcalEndcapAlgo::m_EEnCRSC
double m_EEnCRSC
Definition: DDEcalEndcapAlgo.cc:174
DDEcalEndcapAlgo::m_cryName
std::string m_cryName
Definition: DDEcalEndcapAlgo.cc:183
DDEcalEndcapAlgo::intName
DDName intName(unsigned int i) const
Definition: DDEcalEndcapAlgo.cc:121
DDSplit.h
DDEcalEndcapAlgo::eevecEESCCutaway
const std::vector< double > & eevecEESCCutaway() const
Definition: DDEcalEndcapAlgo.cc:110
DDEcalEndcapAlgo::Tf3D
HepGeom::Transform3D Tf3D
Definition: DDEcalEndcapAlgo.cc:37
DDEcalEndcapAlgo::cryFCtr
const DDTranslation & cryFCtr(unsigned int iRow, unsigned int iCol) const
Definition: DDEcalEndcapAlgo.cc:126
DDEcalEndcapAlgo::RoZ3D
HepGeom::RotateZ3D RoZ3D
Definition: DDEcalEndcapAlgo.cc:41
DDEcalEndcapAlgo::m_EESCELength
double m_EESCELength
Definition: DDEcalEndcapAlgo.cc:156
cms::cuda::assert
assert(be >=bs)
DDEcalEndcapAlgo::eeSCERear
double eeSCERear() const
Definition: DDEcalEndcapAlgo.cc:94
DDEcalEndcapAlgo::m_vecEECRCtrs
std::vector< double > m_vecEECRCtrs
Definition: DDEcalEndcapAlgo.cc:175
DDEcalEndcapAlgo::eeSCEFront
double eeSCEFront() const
Definition: DDEcalEndcapAlgo.cc:95
DDEcalEndcapAlgo::m_alvName
std::string m_alvName
Definition: DDEcalEndcapAlgo.cc:181
DDEcalEndcapAlgo::m_PFfifth
double m_PFfifth
Definition: DDEcalEndcapAlgo.cc:192
DDEcalEndcapAlgo::scrFCtr
const DDTranslation & scrFCtr(unsigned int iRow, unsigned int iCol) const
Definition: DDEcalEndcapAlgo.cc:130
DDEcalEndcapAlgo::eeSCAWall
double eeSCAWall() const
Definition: DDEcalEndcapAlgo.cc:99
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
DDEcalEndcapAlgo::eeSCHLength
double eeSCHLength() const
Definition: DDEcalEndcapAlgo.cc:100
DDEcalEndcapAlgo::alvName
DDName alvName(unsigned int i) const
Definition: DDEcalEndcapAlgo.cc:120
DDEcalEndcapAlgo::m_vecEESCCutaway
std::vector< double > m_vecEESCCutaway
Definition: DDEcalEndcapAlgo.cc:171
DDEcalEndcapTrap
Definition: DDEcalEndcapTrap.h:11
DDEcalEndcapAlgo::m_EECrysFront
double m_EECrysFront
Definition: DDEcalEndcapAlgo.cc:155
DDEcalEndcapAlgo::DDEcalEndcapAlgo
DDEcalEndcapAlgo()
Definition: DDEcalEndcapAlgo.cc:209
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DDMaterial
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
DDEcalEndcapAlgo::eezOff
double eezOff() const
Definition: DDEcalEndcapAlgo.cc:82
DDSolidFactory::subtraction
static DDSolid subtraction(const DDName &name, const DDSolid &a, const DDSolid &b, const DDTranslation &t, const DDRotation &r)
Definition: DDSolid.cc:585
part
part
Definition: HCALResponse.h:20
DDEcalEndcapAlgo::m_vecEESCCtrs
std::vector< double > m_vecEESCCtrs
Definition: DDEcalEndcapAlgo.cc:173
DDEcalEndcapAlgo::RoY3D
HepGeom::RotateY3D RoY3D
Definition: DDEcalEndcapAlgo.cc:42
DDEcalEndcapAlgo::eevecEESCCtrs
const std::vector< double > & eevecEESCCtrs() const
Definition: DDEcalEndcapAlgo.cc:111
DDEcalEndcapTrap.h
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDEcalEndcapAlgo::m_iXYOff
double m_iXYOff
Definition: DDEcalEndcapAlgo.cc:199
DDEcalEndcapAlgo::m_EESCERear
double m_EESCERear
Definition: DDEcalEndcapAlgo.cc:157
DDEcalEndcapAlgo::m_EEnSCCutaway
double m_EEnSCCutaway
Definition: DDEcalEndcapAlgo.cc:170
DDEcalEndcapAlgo::execute
void execute(DDCompactView &cpv) override
Definition: DDEcalEndcapAlgo.cc:341
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDEcalEndcapAlgo::ddmat
DDMaterial ddmat(const std::string &s) const
Definition: DDEcalEndcapAlgo.cc:328
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDEcalEndcapAlgo::eeCrysMat
DDMaterial eeCrysMat() const
Definition: DDEcalEndcapAlgo.cc:87
DDEcalEndcapAlgo
Definition: DDEcalEndcapAlgo.cc:33
DDEcalEndcapAlgo::eevecEECRCtrs
const std::vector< double > & eevecEECRCtrs() const
Definition: DDEcalEndcapAlgo.cc:112
DDEcalEndcapAlgo::EECreateSC
void EECreateSC(const unsigned int iSCType, DDCompactView &cpv)
Definition: DDEcalEndcapAlgo.cc:430
DDEcalEndcapAlgo::eeCrysFront
double eeCrysFront() const
Definition: DDEcalEndcapAlgo.cc:92
DDEcalEndcapAlgo::m_EEWallMat
std::string m_EEWallMat
Definition: DDEcalEndcapAlgo.cc:151
DDEcalEndcapAlgo::m_zFront
double m_zFront
Definition: DDEcalEndcapAlgo.cc:203
DDEcalEndcapAlgo::Ro3D
HepGeom::Rotate3D Ro3D
Definition: DDEcalEndcapAlgo.cc:40
DDEcalEndcapAlgo::idNameSpace
const std::string & idNameSpace() const
Definition: DDEcalEndcapAlgo.cc:78
DDSolid.h
DDEcalEndcapAlgo::m_EESCEFront
double m_EESCEFront
Definition: DDEcalEndcapAlgo.cc:158
DDEcalEndcapAlgo::EEGetSCName
DDName EEGetSCName(const int iCol, const int iRow)
DDEcalEndcapAlgo::eevecEESCProf
const std::vector< double > & eevecEESCProf() const
Definition: DDEcalEndcapAlgo.cc:108
DDEcalEndcapAlgo::m_cutBoxName
std::string m_cutBoxName
Definition: DDEcalEndcapAlgo.cc:178
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
DDEcalEndcapAlgo::Pt3D
HepGeom::Point3D< double > Pt3D
Definition: DDEcalEndcapAlgo.cc:36
DDEcalEndcapAlgo::eevecEEShape
const std::vector< double > & eevecEEShape() const
Definition: DDEcalEndcapAlgo.cc:109
DDEcalEndcapAlgo::RoX3D
HepGeom::RotateX3D RoX3D
Definition: DDEcalEndcapAlgo.cc:43
DDEcalEndcapAlgo::eenSCCutaway
double eenSCCutaway() const
Definition: DDEcalEndcapAlgo.cc:105
DDEcalEndcapAlgo::m_EESCAWall
double m_EESCAWall
Definition: DDEcalEndcapAlgo.cc:162
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDEcalEndcapAlgo::eeSCALength
double eeSCALength() const
Definition: DDEcalEndcapAlgo.cc:96
DDEcalEndcapAlgo::ddname
DDName ddname(const std::string &s) const
Definition: DDEcalEndcapAlgo.cc:330
DDEcalEndcapAlgo::m_vecEESCProf
std::vector< double > m_vecEESCProf
Definition: DDEcalEndcapAlgo.cc:167
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
DDEcalEndcapAlgo::m_cutParms
const std::vector< double > * m_cutParms
Definition: DDEcalEndcapAlgo.cc:177
DDEcalEndcapAlgo::iXYOff
double iXYOff() const
Definition: DDEcalEndcapAlgo.cc:137
DDEcalEndcapAlgo::myrot
DDRotation myrot(const std::string &s, const DDRotationMatrix &r) const
Definition: DDEcalEndcapAlgo.cc:324
rname
const G4String rname[NREG]
Definition: ParametrisedEMPhysics.cc:48
edmplugin::PluginFactory
Definition: PluginFactory.h:34
DDEcalEndcapAlgo::eeCrysLength
double eeCrysLength() const
Definition: DDEcalEndcapAlgo.cc:90
DDEcalEndcapAlgo::m_EESCALength
double m_EESCALength
Definition: DDEcalEndcapAlgo.cc:159
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
DDTypes.h
DDMaterial.h
DDEcalEndcapAlgo::m_PFhalf
double m_PFhalf
Definition: DDEcalEndcapAlgo.cc:191
createfilelist.int
int
Definition: createfilelist.py:10
DDEcalEndcapAlgo::eePF45
double eePF45() const
Definition: DDEcalEndcapAlgo.cc:117
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
DDEcalEndcapAlgo::EEPositionCRs
void EEPositionCRs(const DDName &pName, const DDTranslation &offset, const int iSCType, DDCompactView &cpv)
Definition: DDEcalEndcapAlgo.cc:593
DDEcalEndcapAlgo::m_EECrysLength
double m_EECrysLength
Definition: DDEcalEndcapAlgo.cc:153
DDEcalEndcapAlgo::m_EESCHSide
double m_EESCHSide
Definition: DDEcalEndcapAlgo.cc:164
DDEcalEndcapAlgo::EECreateCR
void EECreateCR()
Definition: DDEcalEndcapAlgo.cc:572
DDEcalEndcapAlgo::m_scrRCtr
DDTranslation m_scrRCtr[10][10]
Definition: DDEcalEndcapAlgo.cc:189
DDEcalEndcapAlgo::EEGetSCType
unsigned int EEGetSCType(const unsigned int iCol, const unsigned int iRow)
Definition: DDEcalEndcapAlgo.cc:560
DDEcalEndcapAlgo::eeMat
DDMaterial eeMat() const
Definition: DDEcalEndcapAlgo.cc:81
DDLogicalPart.h
DDEcalEndcapAlgo::m_iLength
double m_iLength
Definition: DDEcalEndcapAlgo.cc:197
DDEcalEndcapAlgo::m_cryFCtr
DDTranslation m_cryFCtr[5][5]
Definition: DDEcalEndcapAlgo.cc:185
DDEcalEndcapAlgo::Tl3D
HepGeom::Translate3D Tl3D
Definition: DDEcalEndcapAlgo.cc:39
DDEcalEndcapAlgo::eenSCTypes
double eenSCTypes() const
Definition: DDEcalEndcapAlgo.cc:103
DDEcalEndcapAlgo::m_EECrysRear
double m_EECrysRear
Definition: DDEcalEndcapAlgo.cc:154
DDEcalEndcapAlgo::eenColumns
double eenColumns() const
Definition: DDEcalEndcapAlgo.cc:104
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDEcalEndcapAlgo::initialize
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
Definition: DDEcalEndcapAlgo.cc:258
DDEcalEndcapAlgo::vecEESCLims
const std::vector< double > & vecEESCLims() const
Definition: DDEcalEndcapAlgo.cc:134
ReadMapType< double >
DDAlgorithm.h
std
Definition: JetResolutionObject.h:76
DDEcalEndcapAlgo::eeSCHSide
double eeSCHSide() const
Definition: DDEcalEndcapAlgo.cc:101
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
DDEcalEndcapAlgo::m_EEnSCquad
double m_EEnSCquad
Definition: DDEcalEndcapAlgo.cc:172
PVValHelper::dxy
Definition: PVValidationHelpers.h:47
EcalTrapezoidParameters.h
PVValHelper::dz
Definition: PVValidationHelpers.h:50
DDEcalEndcapAlgo::m_intName
std::string m_intName
Definition: DDEcalEndcapAlgo.cc:182
DDEcalEndcapAlgo::~DDEcalEndcapAlgo
~DDEcalEndcapAlgo() override
Definition: DDEcalEndcapAlgo.cc:256
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
DDName.h
DDEcalEndcapAlgo::eeCrysRear
double eeCrysRear() const
Definition: DDEcalEndcapAlgo.cc:91
DDEcalEndcapAlgo::m_cryZOff
double m_cryZOff
Definition: DDEcalEndcapAlgo.cc:201
DDEcalEndcapAlgo::scrRCtr
const DDTranslation & scrRCtr(unsigned int iRow, unsigned int iCol) const
Definition: DDEcalEndcapAlgo.cc:132
DDEcalEndcapAlgo::m_idNameSpace
std::string m_idNameSpace
Definition: DDEcalEndcapAlgo.cc:141
DDEcalEndcapAlgo::m_EESCHLength
double m_EESCHLength
Definition: DDEcalEndcapAlgo.cc:163
DDEcalEndcapAlgo::eeQuaMat
DDMaterial eeQuaMat() const
Definition: DDEcalEndcapAlgo.cc:85
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDEcalEndcapTrap::translate
void translate(const DDTranslation &trans)
Definition: DDEcalEndcapTrap.cc:118
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
DDEcalEndcapAlgo::cryRCtr
const DDTranslation & cryRCtr(unsigned int iRow, unsigned int iCol) const
Definition: DDEcalEndcapAlgo.cc:128
DDEcalEndcapAlgo::m_EEQuaName
std::string m_EEQuaName
Definition: DDEcalEndcapAlgo.cc:147
DDEcalEndcapAlgo::EEPosSC
void EEPosSC(const int iCol, const int iRow, DDName EEDeeName)
DDEcalEndcapAlgo::Vec3
CLHEP::Hep3Vector Vec3
Definition: DDEcalEndcapAlgo.cc:45
DDEcalEndcapAlgo::m_EEQuaMat
std::string m_EEQuaMat
Definition: DDEcalEndcapAlgo.cc:148
DDEcalEndcapTrap::centrePos
DDTranslation centrePos()
Definition: DDEcalEndcapTrap.cc:220
DDEcalEndcapAlgo::m_EESCAFront
double m_EESCAFront
Definition: DDEcalEndcapAlgo.cc:161
DDEcalEndcapAlgo::m_EEnColumns
double m_EEnColumns
Definition: DDEcalEndcapAlgo.cc:168
DDEcalEndcapAlgo::m_PF45
double m_PF45
Definition: DDEcalEndcapAlgo.cc:193
DDEcalEndcapAlgo::eeSCELength
double eeSCELength() const
Definition: DDEcalEndcapAlgo.cc:93
DDEcalEndcapAlgo::eeSCAFront
double eeSCAFront() const
Definition: DDEcalEndcapAlgo.cc:98
DDEcalEndcapAlgo::eeWallMat
DDMaterial eeWallMat() const
Definition: DDEcalEndcapAlgo.cc:88
DDEcalEndcapAlgo::eePFFifth
double eePFFifth() const
Definition: DDEcalEndcapAlgo.cc:116
DDEcalEndcapAlgo::eeSCARear
double eeSCARear() const
Definition: DDEcalEndcapAlgo.cc:97
DDEcalEndcapAlgo::eeQuaName
DDName eeQuaName() const
Definition: DDEcalEndcapAlgo.cc:84
DDSolidFactory::box
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:533
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
DDEcalEndcapTrap::moveto
void moveto(const DDTranslation &frontCentre, const DDTranslation &rearCentre)
Definition: DDEcalEndcapTrap.cc:132
DDEcalEndcapAlgo::m_vecEESCLims
std::vector< double > m_vecEESCLims
Definition: DDEcalEndcapAlgo.cc:195
DDAlgorithmFactory.h
DDSolidFactory::trap
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)
Definition: DDSolid.cc:595
DDEcalEndcapAlgo::envName
DDName envName(unsigned int i) const
Definition: DDEcalEndcapAlgo.cc:119
class-composition.parent
parent
Definition: class-composition.py:88
DDEcalEndcapAlgo::m_EECrysMat
std::string m_EECrysMat
Definition: DDEcalEndcapAlgo.cc:150
DDEcalEndcapAlgo::eePFHalf
double eePFHalf() const
Definition: DDEcalEndcapAlgo.cc:115
cuy.ii
ii
Definition: cuy.py:590
DDEcalEndcapAlgo::RfZ3D
HepGeom::ReflectZ3D RfZ3D
Definition: DDEcalEndcapAlgo.cc:38
DDEcalEndcapAlgo::m_envName
std::string m_envName
Definition: DDEcalEndcapAlgo.cc:180
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3
DDEcalEndcapAlgo::eenSCquad
double eenSCquad() const
Definition: DDEcalEndcapAlgo.cc:106
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:76
DDEcalEndcapAlgo::cutBoxName
DDName cutBoxName() const
Definition: DDEcalEndcapAlgo.cc:114
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDEcalEndcapAlgo.cc:17