1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#include "Geometry/CaloGeometry/interface/CaloGenericDetId.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/ForwardGeometry/interface/CastorGeometry.h"
#include "Geometry/ForwardGeometry/interface/IdealCastorTrapezoid.h"
#include "CastorGeometryData.h"
#include <algorithm>
typedef CaloCellGeometry::CCGFloat CCGFloat;
typedef CaloCellGeometry::Pt3D Pt3D;
typedef CaloCellGeometry::Pt3DVec Pt3DVec;
CastorGeometry::CastorGeometry()
: theTopology(new CastorTopology), m_ownsTopology(true), m_cellVec(k_NumberOfCellsForCorners) {}
CastorGeometry::CastorGeometry(const CastorTopology* topology)
: theTopology(topology), m_ownsTopology(false), m_cellVec(k_NumberOfCellsForCorners) {}
CastorGeometry::~CastorGeometry() {
if (m_ownsTopology)
delete theTopology;
}
DetId CastorGeometry::getClosestCell(const GlobalPoint& r) const {
DetId returnId(0);
const std::vector<DetId>& detIds(getValidDetIds());
for (auto detId : detIds) {
auto cell = getGeometry(detId);
if (nullptr != cell && cell->inside(r)) {
returnId = detId;
break;
}
}
return returnId;
}
unsigned int CastorGeometry::alignmentTransformIndexLocal(const DetId& id) {
const CaloGenericDetId gid(id);
assert(gid.isCastor());
return 0;
}
unsigned int CastorGeometry::alignmentTransformIndexGlobal(const DetId& /*id*/) {
return (unsigned int)DetId::Calo - 1;
}
void CastorGeometry::localCorners(Pt3DVec& lc, const CCGFloat* pv, unsigned int /*i*/, Pt3D& ref) {
IdealCastorTrapezoid::localCorners(lc, pv, ref);
}
void CastorGeometry::newCell(const GlobalPoint& f1,
const GlobalPoint& /*f2*/,
const GlobalPoint& /*f3*/,
const CCGFloat* parm,
const DetId& detId) {
const CaloGenericDetId cgid(detId);
assert(cgid.isCastor());
const unsigned int di(cgid.denseIndex());
m_cellVec[di] = IdealCastorTrapezoid(f1, cornersMgr(), parm);
addValidID(detId);
}
CaloCellGeometryPtr CastorGeometry::getGeometryRawPtr(uint32_t index) const {
// Modify the RawPtr class
return CaloCellGeometryPtr(m_cellVec.size() <= index || nullptr == m_cellVec[index].param() ? nullptr
: &m_cellVec[index]);
}
|