CMS 3D CMS Logo

EcalEndcapGeometryLoaderFromDDD.cc
Go to the documentation of this file.
5 
7 
8 template <>
10  const EcalEGL::ParmVec& vv,
11  const HepGeom::Transform3D& tr,
12  const DetId& id,
13  const double& scale);
14 template <>
16 template <>
18 
19 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
20 
23 
24 template <>
26  const EcalEGL::ParmVec& vv,
27  const HepGeom::Transform3D& tr,
28  const DetId& id,
29  const double& scale) {
30  static constexpr uint32_t maxSize = 11;
31  std::vector<CCGFloat> pv;
32  unsigned int size = (vv.size() > maxSize) ? maxSize : vv.size();
33  unsigned int ioff = (vv.size() > maxSize) ? (vv.size() - maxSize) : 0;
34  pv.reserve(size);
35  for (unsigned int i(0); i != size; ++i) {
36  const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : static_cast<CCGFloat>(scale));
37  pv.emplace_back(factor * vv[i + ioff]);
38  }
39 
40  std::vector<GlobalPoint> corners(8);
41 
42  TruncatedPyramid::createCorners(pv, tr, corners);
43 
44  const CCGFloat* parmPtr(CaloCellGeometry::getParmPtr(pv, geom->parMgr(), geom->parVecVec()));
45 
46  const GlobalPoint front(0.25 * (corners[0].x() + corners[1].x() + corners[2].x() + corners[3].x()),
47  0.25 * (corners[0].y() + corners[1].y() + corners[2].y() + corners[3].y()),
48  0.25 * (corners[0].z() + corners[1].z() + corners[2].z() + corners[3].z()));
49 
50  const GlobalPoint back(0.25 * (corners[4].x() + corners[5].x() + corners[6].x() + corners[7].x()),
51  0.25 * (corners[4].y() + corners[5].y() + corners[6].y() + corners[7].y()),
52  0.25 * (corners[4].z() + corners[5].z() + corners[6].z() + corners[7].z()));
53 
54  geom->newCell(front, back, corners[0], parmPtr, id);
55 }
56 
57 template <>
59  DDFilteredView fv = _fv;
60  bool doSubDets = fv.firstChild();
61  while (doSubDets) {
63 
64  //ncrys
65  DDValue valNcrys("ncrys");
66  if (DDfetch(&sv, valNcrys)) {
67  const std::vector<double>& fvec = valNcrys.doubles();
68 
69  // this parameter can only appear once
70  assert(fvec.size() == 1);
71  geom->setNumberOfCrystalPerModule(static_cast<int>(fvec[0]));
72  } else
73  continue;
74 
75  //nmods
76  DDValue valNmods("nmods");
77  if (DDfetch(&sv, valNmods)) {
78  const std::vector<double>& fmvec = valNmods.doubles();
79 
80  // there can only be one such value
81  assert(fmvec.size() == 1);
82  geom->setNumberOfModules(static_cast<int>(fmvec[0]));
83  }
84 
85  break;
86 
87  doSubDets = fv.nextSibling(); // go to next layer
88  }
89 }
90 
91 template <>
93  const std::string specName = "ecal_ee";
94 
95  //ncrys
96  std::vector<double> tempD = fv.get<std::vector<double> >(specName, "ncrys");
97  assert(tempD.size() == 1);
98  geom->setNumberOfCrystalPerModule(static_cast<int>(tempD[0]));
99 
100  //nmods
101  tempD = fv.get<std::vector<double> >(specName, "nmods");
102  assert(tempD.size() == 1);
103  geom->setNumberOfModules(static_cast<int>(tempD[0]));
104 }
size
Write out results.
bool nextSibling()
set the current node to the next sibling ...
CaloCellGeometry::CCGFloat CCGFloat
assert(be >=bs)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
void fillGeom(T *geom, const ParmVec &pv, const HepGeom::Transform3D &tr, const DetId &id, const double &scale)
std::vector< double > ParmVec
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
def pv(vc)
Definition: MetAnalyzer.py:7
CaloCellGeometry::CCGFloat CCGFloat
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
DDsvalues_type mergedSpecifics() const
Definition: DetId.h:17
T get(const std::string &)
extract attribute value
void fillNamedParams(const DDFilteredView &fv, T *geom)
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
bool firstChild()
set the current node to the first child ...
CaloGeometryLoader< EcalEndcapGeometry > EcalEGL