CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CaloTowerGeometry.cc
Go to the documentation of this file.
3 
4 #include <Math/Transform3D.h>
5 #include <Math/EulerAngles.h>
6 
11 
13  : m_cttopo(cttopo),
14  k_NumberOfCellsForCorners(m_cttopo->sizeForDenseIndexing()),
15  k_NumberOfShapes(m_cttopo->lastHFRing()),
16  m_cellVec(k_NumberOfCellsForCorners) {}
17 
19 
21  const CaloGenericDetId gid(id);
22  assert(gid.isCaloTower());
23 
24  const CaloTowerDetId cid(id);
25  const int iea(cid.ietaAbs());
26  const unsigned int ip((cid.iphi() - 1) / 4);
27  const int izoff((cid.zside() + 1) / 2);
28  const unsigned int offset(izoff * 3 * 18);
29 
30  return (offset + ip +
31  (m_cttopo->firstHFQuadPhiRing() <= iea ? 36 : (m_cttopo->firstHEDoublePhiRing() <= iea ? 18 : 0)));
32 }
33 
34 unsigned int CaloTowerGeometry::alignmentTransformIndexGlobal(const DetId& id) { return (unsigned int)DetId::Calo - 1; }
35 
36 void CaloTowerGeometry::localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int i, Pt3D& ref) {
38 }
39 
41  const GlobalPoint& f1, const GlobalPoint& f2, const GlobalPoint& f3, const CCGFloat* parm, const DetId& detId) {
42  const CaloGenericDetId cgid(detId);
43 
44  assert(cgid.isCaloTower());
45 
46  const CaloTowerDetId cid(detId);
47 
48  const unsigned int di(m_cttopo->denseIndex(cid));
49 
50  m_cellVec[di] = IdealObliquePrism(f1, cornersMgr(), parm);
51  addValidID(detId);
52  m_dins.emplace_back(di);
53 }
54 
56  // Modify the RawPtr class
57  const CaloCellGeometry* cell(&m_cellVec[index]);
58  return (m_cellVec.size() < index || nullptr == cell->param() ? nullptr : cell);
59 }
60 
64  CaloSubdetectorGeometry::IVec& dinsVec) const {
66  iVec.reserve(numberOfShapes() == 1 ? 1 : numberOfCellsForCorners());
67  dVec.reserve(numberOfShapes() * numberOfParametersPerShape());
68  dinsVec.reserve(numberOfCellsForCorners());
69 
70  for (const auto& pv : parVecVec()) {
71  for (float iv : pv) {
72  dVec.emplace_back(iv);
73  }
74  }
75 
76  for (unsigned int i(0); i < numberOfCellsForCorners(); ++i) {
77  Tr3D tr;
78  auto ptr(cellGeomPtr(i));
79 
80  if (nullptr != ptr) {
81  dinsVec.emplace_back(i);
82 
83  ptr->getTransform(tr, (Pt3DVec*)nullptr);
84 
85  if (Tr3D() == tr) { // for preshower there is no rotation
86  const GlobalPoint& gp(ptr->getPosition());
87  tr = HepGeom::Translate3D(gp.x(), gp.y(), gp.z());
88  }
89 
90  const CLHEP::Hep3Vector tt(tr.getTranslation());
91  tVec.emplace_back(tt.x());
92  tVec.emplace_back(tt.y());
93  tVec.emplace_back(tt.z());
94  if (6 == numberOfTransformParms()) {
95  const CLHEP::HepRotation rr(tr.getRotation());
96  const ROOT::Math::Transform3D rtr(
97  rr.xx(), rr.xy(), rr.xz(), tt.x(), rr.yx(), rr.yy(), rr.yz(), tt.y(), rr.zx(), rr.zy(), rr.zz(), tt.z());
99  rtr.GetRotation(ea);
100  tVec.emplace_back(ea.Phi());
101  tVec.emplace_back(ea.Theta());
102  tVec.emplace_back(ea.Psi());
103  }
104 
105  const CCGFloat* par(ptr->param());
106 
107  unsigned int ishape(9999);
108  for (unsigned int ivv(0); ivv != parVecVec().size(); ++ivv) {
109  bool ok(true);
110  const CCGFloat* pv(&(*parVecVec()[ivv].begin()));
111  for (unsigned int k(0); k != numberOfParametersPerShape(); ++k) {
112  ok = ok && (fabs(par[k] - pv[k]) < 1.e-6);
113  }
114  if (ok) {
115  ishape = ivv;
116  break;
117  }
118  }
119  assert(9999 != ishape);
120 
121  const unsigned int nn((numberOfShapes() == 1) ? (unsigned int)1 : m_dins.size());
122  if (iVec.size() < nn)
123  iVec.emplace_back(ishape);
124  }
125  }
126 }
const CaloTowerTopology * m_cttopo
std::vector< CCGFloat > DimVec
int32_t *__restrict__ iv
unsigned int numberOfShapes() const override
virtual unsigned int numberOfCellsForCorners() const
bool isCaloTower() const
std::vector< unsigned int > IVec
unsigned int numberOfParametersPerShape() const override
std::vector< CCGFloat > TrVec
HepGeom::Transform3D Tr3D
std::vector< Pt3D > Pt3DVec
unsigned int alignmentTransformIndexLocal(const DetId &id)
assert(be >=bs)
CaloCellGeometry::CCGFloat CCGFloat
~CaloTowerGeometry() override
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
const CCGFloat * param() const
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
CaloCellGeometry::Pt3D Pt3D
CaloCellGeometry::CCGFloat CCGFloat
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
CaloSubdetectorGeometry::IVec m_dins
unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
uint32_t denseIndex(const DetId &id) const
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: DetId.h:17
AlgebraicVector EulerAngles
Definition: Definitions.h:34
void addValidID(const DetId &id)
CaloCellGeometry::CornersMgr * cornersMgr()
int firstHEDoublePhiRing() const
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
CaloTowerGeometry(const CaloTowerTopology *cttopo)
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Pt3DVec Pt3DVec
int32_t *__restrict__ nn
virtual unsigned int numberOfTransformParms() const
int firstHFQuadPhiRing() const