CMS 3D CMS Logo

EcalBarrelGeometryLoaderFromDDD.cc
Go to the documentation of this file.
7 
9 
10 template <>
12  const EcalBGL::ParmVec& vv,
13  const HepGeom::Transform3D& tr,
14  const DetId& id,
15  const double& scale);
16 template <>
18 template <>
20 
21 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
22 
25 
26 template <>
28  const EcalBGL::ParmVec& vv,
29  const HepGeom::Transform3D& tr,
30  const DetId& id,
31  const double& scale) {
32  static constexpr uint32_t maxSize = 11;
33  std::vector<CCGFloat> pv;
34  unsigned int size = (vv.size() > maxSize) ? maxSize : vv.size();
35  unsigned int ioff = (vv.size() > maxSize) ? (vv.size() - maxSize) : 0;
36  pv.reserve(size);
37  for (unsigned int i(0); i != size; ++i) {
38  const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : static_cast<CCGFloat>(scale));
39  pv.emplace_back(factor * vv[i + ioff]);
40  }
41 
42  std::vector<GlobalPoint> corners(8);
43 
44  TruncatedPyramid::createCorners(pv, tr, corners);
45 
46  const CCGFloat* parmPtr(CaloCellGeometry::getParmPtr(pv, geom->parMgr(), geom->parVecVec()));
47 
48  const GlobalPoint front(0.25 * (corners[0].x() + corners[1].x() + corners[2].x() + corners[3].x()),
49  0.25 * (corners[0].y() + corners[1].y() + corners[2].y() + corners[3].y()),
50  0.25 * (corners[0].z() + corners[1].z() + corners[2].z() + corners[3].z()));
51 
52  const GlobalPoint back(0.25 * (corners[4].x() + corners[5].x() + corners[6].x() + corners[7].x()),
53  0.25 * (corners[4].y() + corners[5].y() + corners[6].y() + corners[7].y()),
54  0.25 * (corners[4].z() + corners[5].z() + corners[6].z() + corners[7].z()));
55 
56  geom->newCell(front, back, corners[0], parmPtr, id);
57 }
58 
59 template <>
61  DDFilteredView fv = _fv;
62  bool doSubDets = fv.firstChild();
63 
64  while (doSubDets) {
66 
67  //nxtalPhi
68  DDValue valnPhi("nxtalPhi");
69  if (DDfetch(&sv, valnPhi)) {
70  const std::vector<double>& fvec = valnPhi.doubles();
71 
72  // this parameter can only appear once
73  assert(fvec.size() == 1);
74  geom->setNumXtalsPhiDirection(static_cast<int>(fvec[0]));
75  } else
76  continue;
77 
78  DDValue valnEta("nxtalEta");
79  if (DDfetch(&sv, valnEta)) {
80  const std::vector<double>& fmvec = valnEta.doubles();
81 
82  // there can only be one such value
83  assert(fmvec.size() == 1);
84 
85  geom->setNumXtalsEtaDirection(static_cast<int>(fmvec[0]));
86  } else
87  // once we find nxtalPhi, the rest must also be defined
88  assert(1 == 0);
89 
90  //EtaBaskets
91  DDValue valEtaB("EtaBaskets");
92  if (DDfetch(&sv, valEtaB)) {
93  const std::vector<double>& ebvec = valEtaB.doubles();
94  assert(!ebvec.empty());
95  std::vector<int> EtaBaskets;
96  EtaBaskets.reserve(ebvec.size());
97  for (const auto& ebv : ebvec)
98  EtaBaskets.emplace_back(static_cast<int>(ebv));
99  geom->setEtaBaskets(EtaBaskets);
100  } else
101  // once we find nxtalPhi, the rest must also be defined
102  assert(1 == 0);
103 
104  //PhiBaskets
105  DDValue valPhi("PhiBaskets");
106  if (DDfetch(&sv, valPhi)) {
107  const std::vector<double>& pvec = valPhi.doubles();
108  assert(!pvec.empty());
109  geom->setBasketSizeInPhi(static_cast<int>(pvec[0]));
110  } else
111  // once we find nxtalPhi, the rest must also be defined
112  assert(1 == 0);
113 
114  break;
115 
116  doSubDets = fv.nextSibling(); // go to next layer
117  }
118 }
119 
120 template <>
122  const std::string specName = "ecal_eb";
123 
124  //nxtalEta
125  std::vector<double> tempD = fv.get<std::vector<double> >(specName, "nxtalEta");
126  assert(tempD.size() == 1);
127  geom->setNumXtalsEtaDirection(static_cast<int>(tempD[0]));
128 
129  //nxtalPhi
130  tempD = fv.get<std::vector<double> >(specName, "nxtalPhi");
131  assert(tempD.size() == 1);
132  geom->setNumXtalsPhiDirection(static_cast<int>(tempD[0]));
133 
134  //EtaBaskets
135  tempD = fv.get<std::vector<double> >(specName, "EtaBaskets");
136  assert(!tempD.empty());
137  geom->setEtaBaskets(dbl_to_int(tempD));
138 
139  //PhiBaskets
140  tempD = fv.get<std::vector<double> >(specName, "PhiBaskets");
141  assert(!tempD.empty());
142  geom->setBasketSizeInPhi(static_cast<int>(tempD[0]));
143 }
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
EcalBarrelGeometry.h
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
DDFilteredView::mergedSpecifics
DDsvalues_type mergedSpecifics() const
Definition: DDFilteredView.cc:42
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CaloCellGeometry.cc:4
cms::cuda::assert
assert(be >=bs)
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: EcalBarrelGeometryLoaderFromDDD.cc:24
DDAxes::x
cms::DDFilteredView
Definition: DDFilteredView.h:70
CaloGeometryLoader
Definition: CaloGeometryLoader.h:22
cms::DDFilteredView::get
T get(const std::string &)
extract attribute value
DetId
Definition: DetId.h:17
CaloGeometryLoader.h
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
DDFilteredView.h
TruncatedPyramid.h
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
DDAxes::z
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
DDFilteredView::nextSibling
bool nextSibling()
set the current node to the next sibling ...
Definition: DDFilteredView.cc:124
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
TruncatedPyramid::createCorners
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: TruncatedPyramid.cc:237
DDFilteredView.h
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
Point3DBase< float, GlobalTag >
DDutils.h
EcalBarrelGeometry
Definition: EcalBarrelGeometry.h:19
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalBGL
CaloGeometryLoader< EcalBarrelGeometry > EcalBGL
Definition: EcalBarrelGeometryLoaderFromDDD.cc:8
reco_skim_cfg_mod.maxSize
maxSize
Definition: reco_skim_cfg_mod.py:154
CaloGeometryLoader::fillGeom
void fillGeom(T *geom, const ParmVec &pv, const HepGeom::Transform3D &tr, const DetId &id, const double &scale)
DDValue
Definition: DDValue.h:22
CaloGeometryLoader::ParmVec
std::vector< double > ParmVec
Definition: CaloGeometryLoader.h:24
CaloCellGeometry::getParmPtr
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: CaloCellGeometry.cc:117
CaloGeometryLoader::fillNamedParams
void fillNamedParams(const DDFilteredView &fv, T *geom)
DDFilteredView
Definition: DDFilteredView.h:20
dbl_to_int
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443