CMS 3D CMS Logo

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 }
CaloCellGeometry::Tr3D
HepGeom::Transform3D Tr3D
Definition: CaloCellGeometry.h:53
CaloCellGeometry::Pt3DVec
std::vector< Pt3D > Pt3DVec
Definition: CaloCellGeometry.h:55
CaloGenericDetId.h
CaloTowerGeometry::m_cellVec
CellVec m_cellVec
Definition: CaloTowerGeometry.h:74
mps_fire.i
i
Definition: mps_fire.py:355
CaloCellGeometry::CCGFloat
float CCGFloat
Definition: CaloCellGeometry.h:52
CaloTowerGeometry::m_cttopo
const CaloTowerTopology * m_cttopo
Definition: CaloTowerGeometry.h:71
CaloGenericDetId
Definition: CaloGenericDetId.h:12
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
CaloGenericDetId::isCaloTower
bool isCaloTower() const
Definition: CaloGenericDetId.h:36
CaloSubdetectorGeometry::DimVec
std::vector< CCGFloat > DimVec
Definition: CaloSubdetectorGeometry.h:35
findQualityFiles.rr
string rr
Definition: findQualityFiles.py:185
CaloTowerGeometry::numberOfParametersPerShape
unsigned int numberOfParametersPerShape() const override
Definition: CaloTowerGeometry.h:34
CaloTowerGeometry::~CaloTowerGeometry
~CaloTowerGeometry() override
Definition: CaloTowerGeometry.cc:18
CaloTowerGeometry::numberOfShapes
unsigned int numberOfShapes() const override
Definition: CaloTowerGeometry.h:33
CaloTowerTopology::firstHEDoublePhiRing
int firstHEDoublePhiRing() const
Definition: CaloTowerTopology.h:44
CaloSubdetectorGeometry::TrVec
std::vector< CCGFloat > TrVec
Definition: CaloSubdetectorGeometry.h:33
CaloTowerTopology
Definition: CaloTowerTopology.h:13
cms::cuda::assert
assert(be >=bs)
CaloSubdetectorGeometry::numberOfTransformParms
virtual unsigned int numberOfTransformParms() const
Definition: CaloSubdetectorGeometry.h:94
CaloTowerGeometry::getGeometryRawPtr
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
Definition: CaloTowerGeometry.cc:55
CaloSubdetectorGeometry::IVec
std::vector< unsigned int > IVec
Definition: CaloSubdetectorGeometry.h:34
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
DetId::Calo
Definition: DetId.h:29
Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: CaloTowerGeometry.cc:8
DetId
Definition: DetId.h:17
CaloSubdetectorGeometry::CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CaloSubdetectorGeometry.h:25
IdealObliquePrism
Definition: IdealObliquePrism.h:28
CaloTowerGeometry::newCell
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
Definition: CaloTowerGeometry.cc:40
CCGFloat
CaloCellGeometry::CCGFloat CCGFloat
Definition: CaloTowerGeometry.cc:7
CaloTowerGeometry::m_dins
CaloSubdetectorGeometry::IVec m_dins
Definition: CaloTowerGeometry.h:75
Tr3D
CaloCellGeometry::Tr3D Tr3D
Definition: CaloCellGeometry.cc:7
CaloTowerGeometry::alignmentTransformIndexLocal
unsigned int alignmentTransformIndexLocal(const DetId &id)
Definition: CaloTowerGeometry.cc:20
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Point3DBase< float, GlobalTag >
CaloCellGeometry::Pt3D
HepGeom::Point3D< CCGFloat > Pt3D
Definition: CaloCellGeometry.h:54
IdealObliquePrism::localCorners
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
Definition: IdealObliquePrism.cc:45
Tr3D
CaloCellGeometry::Tr3D Tr3D
Definition: CaloTowerGeometry.cc:10
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
Pt3DVec
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: CaloTowerGeometry.cc:9
CaloCellGeometry
Definition: CaloCellGeometry.h:50
DeadROC_duringRun.f2
f2
Definition: DeadROC_duringRun.py:220
CaloTowerGeometry::localCorners
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: CaloTowerGeometry.cc:36
CaloCellGeometry::param
const CCGFloat * param() const
Definition: CaloCellGeometry.h:99
CaloTowerGeometry::getSummary
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
Definition: CaloTowerGeometry.cc:61
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
CaloSubdetectorGeometry::addValidID
void addValidID(const DetId &id)
Definition: CaloSubdetectorGeometry.cc:27
CaloTowerGeometry::Pt3D
CaloCellGeometry::Pt3D Pt3D
Definition: CaloTowerGeometry.h:21
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
CaloTowerGeometry::CaloTowerGeometry
CaloTowerGeometry(const CaloTowerTopology *cttopo)
Definition: CaloTowerGeometry.cc:12
groupFilesInBlocks.nn
nn
Definition: groupFilesInBlocks.py:150
CaloTowerGeometry::alignmentTransformIndexGlobal
unsigned int alignmentTransformIndexGlobal(const DetId &id)
Definition: CaloTowerGeometry.cc:34
CaloSubdetectorGeometry::cornersMgr
CaloCellGeometry::CornersMgr * cornersMgr()
Definition: CaloSubdetectorGeometry.h:82
CaloTowerGeometry::Pt3DVec
CaloCellGeometry::Pt3DVec Pt3DVec
Definition: CaloTowerGeometry.h:22
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
CaloTowerGeometry.h
CaloSubdetectorGeometry::parVecVec
ParVecVec & parVecVec()
Definition: CaloSubdetectorGeometry.h:89
CaloSubdetectorGeometry::cellGeomPtr
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
Definition: CaloSubdetectorGeometry.cc:260
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
CaloTowerGeometry::numberOfCellsForCorners
virtual unsigned int numberOfCellsForCorners() const
Definition: CaloTowerGeometry.h:35
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
begin
#define begin
Definition: vmac.h:32
CaloTowerTopology::denseIndex
uint32_t denseIndex(const DetId &id) const
Definition: CaloTowerTopology.cc:235
CaloTowerTopology::firstHFQuadPhiRing
int firstHFQuadPhiRing() const
Definition: CaloTowerTopology.h:46
CaloTowerDetId
Definition: CaloTowerDetId.h:12