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  std::vector<CCGFloat> pv;
33  pv.reserve(vv.size());
34  for (unsigned int i(0); i != vv.size(); ++i) {
35  const CCGFloat factor(1 == i || 2 == i || 6 == i || 10 == i ? 1 : (CCGFloat)scale);
36 
37  pv.emplace_back(factor * vv[i]);
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 
62  while (doSubDets) {
64 
65  //nxtalPhi
66  DDValue valnPhi("nxtalPhi");
67  if (DDfetch(&sv, valnPhi)) {
68  const std::vector<double>& fvec = valnPhi.doubles();
69 
70  // this parameter can only appear once
71  assert(fvec.size() == 1);
72  geom->setNumXtalsPhiDirection((int)fvec[0]);
73  } else
74  continue;
75 
76  DDValue valnEta("nxtalEta");
77  if (DDfetch(&sv, valnEta)) {
78  const std::vector<double>& fmvec = valnEta.doubles();
79 
80  // there can only be one such value
81  assert(fmvec.size() == 1);
82 
83  geom->setNumXtalsEtaDirection((int)fmvec[0]);
84  } else
85  // once we find nxtalPhi, the rest must also be defined
86  assert(1 == 0);
87 
88  //EtaBaskets
89  DDValue valEtaB("EtaBaskets");
90  if (DDfetch(&sv, valEtaB)) {
91  const std::vector<double>& ebvec = valEtaB.doubles();
92  assert(!ebvec.empty());
93  std::vector<int> EtaBaskets;
94  EtaBaskets.resize(ebvec.size());
95  for (unsigned i = 0; i < ebvec.size(); ++i)
96  EtaBaskets[i] = (int)ebvec[i];
97  geom->setEtaBaskets(EtaBaskets);
98  } else
99  // once we find nxtalPhi, the rest must also be defined
100  assert(1 == 0);
101 
102  //PhiBaskets
103  DDValue valPhi("PhiBaskets");
104  if (DDfetch(&sv, valPhi)) {
105  const std::vector<double>& pvec = valPhi.doubles();
106  assert(!pvec.empty());
107  geom->setBasketSizeInPhi((int)pvec[0]);
108  } else
109  // once we find nxtalPhi, the rest must also be defined
110  assert(1 == 0);
111 
112  break;
113 
114  doSubDets = fv.nextSibling(); // go to next layer
115  }
116 }
117 
118 template <>
120  const std::string specName = "ecal_eb";
121 
122  //nxtalEta
123  std::vector<double> tempD = fv.get<std::vector<double> >(specName, "nxtalEta");
124  assert(tempD.size() == 1);
125  geom->setNumXtalsEtaDirection((int)tempD[0]);
126 
127  //nxtalPhi
128  tempD = fv.get<std::vector<double> >(specName, "nxtalPhi");
129  assert(tempD.size() == 1);
130  geom->setNumXtalsPhiDirection((int)tempD[0]);
131 
132  //EtaBaskets
133  tempD = fv.get<std::vector<double> >(specName, "EtaBaskets");
134  assert(!tempD.empty());
135  geom->setEtaBaskets(dbl_to_int(tempD));
136 
137  //PhiBaskets
138  tempD = fv.get<std::vector<double> >(specName, "PhiBaskets");
139  assert(!tempD.empty());
140  geom->setBasketSizeInPhi((int)tempD[0]);
141 }
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:355
EcalBarrelGeometry.h
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
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:65
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
CaloGeometryLoader
Definition: CaloGeometryLoader.h:21
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
cms::DDFilteredView::get
T get(const std::string &) const
extract attribute value
TruncatedPyramid.h
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:226
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 >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
EcalBarrelGeometry
Definition: EcalBarrelGeometry.h:19
DDutils.h
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
EcalBGL
CaloGeometryLoader< EcalBarrelGeometry > EcalBGL
Definition: EcalBarrelGeometryLoaderFromDDD.cc:8
CaloGeometryLoader::fillGeom
void fillGeom(T *geom, const ParmVec &pv, const HepGeom::Transform3D &tr, const DetId &id, const double &scale)
DDValue
Definition: DDValue.h:21
CaloGeometryLoader::ParmVec
std::vector< double > ParmVec
Definition: CaloGeometryLoader.h:23
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
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12