CMS 3D CMS Logo

moduleDB.cc
Go to the documentation of this file.
5 
9 
10 template <>
13  const typename HcalGeometry::AlignedRecord& iRecord) {
14  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
15 
16  TrVec tvec;
17  DimVec dvec;
18  IVec ivec;
19  IVec dins;
20 
21  const auto& pG = iRecord.get(geometryToken_);
22 
23  tvec = pG.getTranslation();
24  dvec = pG.getDimension();
25  ivec = pG.getIndexes();
26  dins = pG.getDenseIndices();
27  //*********************************************************************************************
28 
29  const auto& hcalTopology = iRecord.get(additionalTokens_.topology);
30 
31  // We know that the numer of shapes chanes with changing depth
32  // so, this check is temporary disabled. We need to implement
33  // a way either to store or calculate the number of shapes or be able
34  // to deal with only max numer of shapes.
35  // assert( dvec.size() == hcalTopology.getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape ) ;
36  assert(dvec.size() <= hcalTopology.getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape);
37  HcalGeometry* hcg = new HcalGeometry(hcalTopology);
38 
39  PtrType ptr(hcg);
40 
41  const unsigned int nTrParm(hcg->numberOfTransformParms());
42 
43  ptr->fillDefaultNamedParameters();
44  ptr->allocateCorners(hcalTopology.ncells() + hcalTopology.getHFSize());
45  ptr->allocatePar(dvec.size(), HcalGeometry::k_NumberOfParametersPerShape);
46 
47  for (unsigned int i(0); i < dins.size(); ++i) {
48  const unsigned int nPerShape(HcalGeometry::k_NumberOfParametersPerShape);
49  DimVec dims;
50  dims.reserve(nPerShape);
51 
52  const unsigned int indx(ivec.size() == 1 ? 0 : i);
53 
54  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
55 
56  for (unsigned int j(0); j != nPerShape; ++j) {
57  dims.emplace_back(*dsrc);
58  ++dsrc;
59  }
60 
61  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
62 
63  const DetId id(hcalTopology.denseId2detId(dins[i]));
64 
65  const unsigned int iGlob(nullptr == globalPtr ? 0 : HcalGeometry::alignmentTransformIndexGlobal(id));
66 
67  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
68 
69  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
70 
71  assert(nullptr == gt || iGlob == HcalGeometry::alignmentTransformIndexGlobal(DetId(gt->rawId())));
72 
73  const unsigned int iLoc(nullptr == alignPtr ? 0 : HcalGeometry::alignmentTransformIndexLocal(id));
74 
75  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
76 
77  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
78 
79  assert(nullptr == at || (HcalGeometry::alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
80 
81  Pt3D lRef;
82  Pt3DVec lc(8, Pt3D(0, 0, 0));
83  hcg->localCorners(lc, &dims.front(), dins[i], lRef);
84 
85  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
86  const Pt3D lCor(lc[0]);
87 
88  //----------------------------------- create transform from 6 numbers ---
89  const unsigned int jj(i * nTrParm); // Note: Dence indices are not sorted and
90  // parameters stored according to order of a cell creation
91  Tr3D tr;
92  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
93  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
95  const ROOT::Math::Transform3D rt(ea, tl);
96  double xx, xy, xz, dx;
97  double yx, yy, yz, dy;
98  double zx, zy, zz, dz;
99  rt.GetComponents(xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz);
100  tr = Tr3D(CLHEP::HepRep3x3(xx, xy, xz, yx, yy, yz, zx, zy, zz), CLHEP::Hep3Vector(dx, dy, dz));
101 
102  // now prepend alignment(s) for final transform
103  const Tr3D atr(nullptr == at ? tr
104  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
105  //--------------------------------- done making transform ---------------
106 
107  const Pt3D gRef(atr * lRef);
108  const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
109  const Pt3D gBck(atr * lBck);
110  const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
111  const Pt3D gCor(atr * lCor);
112  const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
113 
114  assert(hcalTopology.detId2denseId(id) == dins[i]);
115 
116  ptr->newCell(fCtr, fBck, fCor, myParm, id);
117  }
118 
119  ptr->initializeParms(); // initializations; must happen after cells filled
120 
121  return ptr;
122 }
123 
124 template <>
127  const typename CaloTowerGeometry::AlignedRecord& iRecord) {
128  const auto [alignPtr, globalPtr] = getAlignGlobal(iRecord);
129 
130  TrVec tvec;
131  DimVec dvec;
132  IVec ivec;
133  IVec dins;
134 
135  const auto& pG = iRecord.get(geometryToken_);
136 
137  tvec = pG.getTranslation();
138  dvec = pG.getDimension();
139  ivec = pG.getIndexes();
140  dins = pG.getDenseIndices();
141  //*********************************************************************************************
142 
143  const auto& caloTopology = iRecord.get(additionalTokens_.topology);
144 
145  CaloTowerGeometry* ctg = new CaloTowerGeometry(&caloTopology);
146 
147  const unsigned int nTrParm(tvec.size() / ctg->numberOfCellsForCorners());
148 
150 
151  PtrType ptr(ctg);
152 
153  ptr->fillDefaultNamedParameters();
154 
155  ptr->allocateCorners(ctg->numberOfCellsForCorners());
156 
157  ptr->allocatePar(dvec.size(), CaloTowerGeometry::k_NumberOfParametersPerShape);
158 
159  for (unsigned int i(0); i < dins.size(); ++i) {
160  const unsigned int nPerShape(ctg->numberOfParametersPerShape());
161  DimVec dims;
162  dims.reserve(nPerShape);
163 
164  const unsigned int indx(ivec.size() == 1 ? 0 : i);
165 
166  DimVec::const_iterator dsrc(dvec.begin() + ivec[indx] * nPerShape);
167 
168  for (unsigned int j(0); j != nPerShape; ++j) {
169  dims.emplace_back(*dsrc);
170  ++dsrc;
171  }
172 
173  const CCGFloat* myParm(CaloCellGeometry::getParmPtr(dims, ptr->parMgr(), ptr->parVecVec()));
174 
175  const DetId id(caloTopology.detIdFromDenseIndex(dins[i]));
176 
177  const unsigned int iGlob(nullptr == globalPtr ? 0 : ctg->alignmentTransformIndexGlobal(id));
178 
179  assert(nullptr == globalPtr || iGlob < globalPtr->m_align.size());
180 
181  const AlignTransform* gt(nullptr == globalPtr ? nullptr : &globalPtr->m_align[iGlob]);
182 
183  assert(nullptr == gt || iGlob == ctg->alignmentTransformIndexGlobal(DetId(gt->rawId())));
184 
185  const unsigned int iLoc(nullptr == alignPtr ? 0 : ctg->alignmentTransformIndexLocal(id));
186 
187  assert(nullptr == alignPtr || iLoc < alignPtr->m_align.size());
188 
189  const AlignTransform* at(nullptr == alignPtr ? nullptr : &alignPtr->m_align[iLoc]);
190 
191  assert(nullptr == at || (ctg->alignmentTransformIndexLocal(DetId(at->rawId())) == iLoc));
192 
193  const CaloGenericDetId gId(id);
194 
195  Pt3D lRef;
196  Pt3DVec lc(8, Pt3D(0, 0, 0));
197  ctg->localCorners(lc, &dims.front(), dins[i], lRef);
198 
199  const Pt3D lBck(0.25 * (lc[4] + lc[5] + lc[6] + lc[7])); // ctr rear face in local
200  const Pt3D lCor(lc[0]);
201 
202  //----------------------------------- create transform from 6 numbers ---
203  const unsigned int jj(i * nTrParm);
204  Tr3D tr;
205  const ROOT::Math::Translation3D tl(tvec[jj], tvec[jj + 1], tvec[jj + 2]);
206  const ROOT::Math::EulerAngles ea(6 == nTrParm ? ROOT::Math::EulerAngles(tvec[jj + 3], tvec[jj + 4], tvec[jj + 5])
208  const ROOT::Math::Transform3D rt(ea, tl);
209  double xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz;
210  rt.GetComponents(xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz);
211  tr = Tr3D(CLHEP::HepRep3x3(xx, xy, xz, yx, yy, yz, zx, zy, zz), CLHEP::Hep3Vector(dx, dy, dz));
212 
213  // now prepend alignment(s) for final transform
214  const Tr3D atr(nullptr == at ? tr
215  : (nullptr == gt ? at->transform() * tr : at->transform() * gt->transform() * tr));
216  //--------------------------------- done making transform ---------------
217 
218  const Pt3D gRef(atr * lRef);
219  const GlobalPoint fCtr(gRef.x(), gRef.y(), gRef.z());
220  const Pt3D gBck(atr * lBck);
221  const GlobalPoint fBck(gBck.x(), gBck.y(), gBck.z());
222  const Pt3D gCor(atr * lCor);
223  const GlobalPoint fCor(gCor.x(), gCor.y(), gCor.z());
224 
225  assert(caloTopology.denseIndex(id) == dins[i]);
226 
227  ptr->newCell(fCtr, fBck, fCor, myParm, id);
228  }
229 
230  ptr->initializeParms(); // initializations; must happen after cells filled
231 
232  return ptr;
233 }
234 
236 
238 
240 
242 
244 
CaloGeometryDBEP::Tr3D
CaloCellGeometry::Tr3D Tr3D
Definition: CaloGeometryDBEP.h:90
mps_fire.i
i
Definition: mps_fire.py:428
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
geometryCSVtoXML.yz
yz
Definition: geometryCSVtoXML.py:19
CaloGenericDetId
Definition: CaloGenericDetId.h:12
CaloGeometryDBHcal.h
hcal_runs.rt
rt
Definition: hcal_runs.py:76
CaloTowerGeometry::numberOfParametersPerShape
unsigned int numberOfParametersPerShape() const override
Definition: CaloTowerGeometry.h:34
CaloGeometryDBEP::TrVec
CaloSubdetectorGeometry::TrVec TrVec
Definition: CaloGeometryDBEP.h:93
CaloGeometryDBEP::CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CaloGeometryDBEP.h:87
CaloTowerGeometry::numberOfShapes
unsigned int numberOfShapes() const override
Definition: CaloTowerGeometry.h:33
cms::cuda::assert
assert(be >=bs)
HcalRecNumberingRecord.h
HcalGeometry::alignmentTransformIndexLocal
static unsigned int alignmentTransformIndexLocal(const DetId &id)
Definition: HcalGeometry.cc:413
HcalGeometry::k_NumberOfParametersPerShape
Definition: HcalGeometry.h:38
CaloGeometryDBEP.h
HcalGeometry.h
HcalGeometryFromDBEP
CaloGeometryDBEP< HcalGeometry, CaloGeometryDBReader > HcalGeometryFromDBEP
Definition: moduleDB.cc:237
Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: CaloCellGeometry.cc:5
DetId
Definition: DetId.h:17
submitPVValidationJobs.gt
list gt
Definition: submitPVValidationJobs.py:663
Tr3D
CaloCellGeometry::Tr3D Tr3D
Definition: CaloCellGeometry.cc:7
CaloTowerGeometry::alignmentTransformIndexLocal
unsigned int alignmentTransformIndexLocal(const DetId &id)
Definition: CaloTowerGeometry.cc:20
Point3DBase< float, GlobalTag >
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:109
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
AlignTransform
Definition: AlignTransform.h:15
HcalGeometryRecord
Definition: HcalGeometryRecord.h:23
CaloGeometryDBEP::PtrType
std::unique_ptr< CaloSubdetectorGeometry > PtrType
Definition: CaloGeometryDBEP.h:92
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
CaloGeometryDBEP::DimVec
CaloSubdetectorGeometry::DimVec DimVec
Definition: CaloGeometryDBEP.h:94
geometryCSVtoXML.xz
xz
Definition: geometryCSVtoXML.py:19
CaloTowerGeometry::localCorners
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: CaloTowerGeometry.cc:36
CaloTowerGeometryRecord
Definition: CaloTowerGeometryRecord.h:24
CaloTowerGeometryFromDBEP
CaloGeometryDBEP< CaloTowerGeometry, CaloGeometryDBReader > CaloTowerGeometryFromDBEP
Definition: moduleDB.cc:243
CaloGeometryDBEP::IVec
CaloSubdetectorGeometry::IVec IVec
Definition: CaloGeometryDBEP.h:95
PVValHelper::dy
Definition: PVValidationHelpers.h:50
HcalGeometry::alignmentTransformIndexGlobal
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
Definition: HcalGeometry.cc:436
CaloGeometryDBEP
Definition: CaloGeometryDBEP.h:85
CaloTowerGeometry
Definition: CaloTowerGeometry.h:16
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloGeometryDBEP::Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: CaloGeometryDBEP.h:88
CaloTowerGeometry::alignmentTransformIndexGlobal
unsigned int alignmentTransformIndexGlobal(const DetId &id)
Definition: CaloTowerGeometry.cc:34
PVValHelper::dz
Definition: PVValidationHelpers.h:51
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
CaloGeometryDBEP::produceAligned
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
Definition: CaloGeometryDBEP.h:116
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
CaloCellGeometry::getParmPtr
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: CaloCellGeometry.cc:117
CaloTowerGeometry::k_NumberOfParametersPerShape
Definition: CaloTowerGeometry.h:29
CaloTowerGeometry.h
CaloGeometryDBEP::Pt3DVec
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: CaloGeometryDBEP.h:89
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CaloTowerGeometry::numberOfCellsForCorners
virtual unsigned int numberOfCellsForCorners() const
Definition: CaloTowerGeometry.h:35
HcalGeometry
Definition: HcalGeometry.h:17
PVValHelper::dx
Definition: PVValidationHelpers.h:49
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
CaloGeometryDBReader.h
CaloGeometryDBCaloTower.h