9 #include <Math/Transform3D.h>
10 #include <Math/EulerAngles.h>
16 : m_topology(topology_),
17 m_cellVec(topology_.totalGeomModules()),
18 m_validGeomIds(topology_.totalGeomModules()),
19 m_Type(topology_.detectorType()),
20 m_subdet(topology_.subDetector()) {
44 const uint32_t cellIndex(
topology().detId2denseGeomId(detId));
52 for (
int etaZ = 1; etaZ <= nEtaZ; ++etaZ) {
64 std::cout <<
"FastTimeGeometry::newCell-> [" << cellIndex <<
"]"
65 <<
" front:" << f1.
x() <<
'/' << f1.
y() <<
'/' << f1.
z() <<
" back:" << f2.
x() <<
'/' << f2.
y() <<
'/'
66 << f2.
z() <<
" eta|phi " <<
m_cellVec[cellIndex].etaPos() <<
":" <<
m_cellVec[cellIndex].phiPos()
78 const uint32_t cellIndex(
topology().detId2denseGeomId(geoId));
94 return GlobalPoint(0.1 * pos.x(), 0.1 * pos.y(), 0.1 * pos.z());
101 for (
const auto& corner : corners) {
102 out.emplace_back(0.1 * corner.x(), 0.1 * corner.y(), 0.1 * corner.z());
108 int zside = (r.
z() > 0) ? 1 : -1;
109 std::pair<int, int> etaZPhi;
111 double zz = (zside > 0) ? r.
z() : -r.
z();
114 double phi = (zside > 0) ? static_cast<double>(r.
phi()) : atan2(r.
y(), -r.
x());
122 std::cout <<
"getClosestCell: for (" << r.
x() <<
", " << r.
y() <<
", " << r.
z() <<
") Id " <<
id.type() <<
":"
123 <<
id.zside() <<
":" <<
id.ieta() <<
":" <<
id.iphi() << std::endl;
136 return "FastTimeBarrel";
138 return "FastTimeEndcap";
144 unsigned int cellIndex =
m_cellVec.size();
149 std::cout <<
"indexFor " << std::hex <<
id.rawId() <<
":" << geoId.
rawId() <<
std::dec <<
" index " << cellIndex
161 return (
m_cellVec.size() < index ||
nullptr == cell->
param() ?
nullptr : cell);
167 static const auto do_not_delete = [](
const void*) {};
168 auto cell = std::shared_ptr<const CaloCellGeometry>(&
m_cellVec[
index], do_not_delete);
169 if (
nullptr == cell->param())
180 cell->setPosition(pos);
184 if (
nullptr == cell->param())
190 edm::LogError(
"FastTimeGeom") <<
"FastTimeGeometry::addValidID is not implemented";
214 iVector.reserve(numberOfCells);
215 dimVector.reserve(numberOfShapes * numberOfParametersPerShape);
216 dinsVector.reserve(numberOfCells);
221 params[1] = params[2] = 0;
225 params[6] = params[10] = 0;
226 params[11] = (
k == 0) ? 1.0 : -1.0;
227 dimVector.insert(dimVector.end(), params.begin(), params.end());
230 for (
unsigned int i(0);
i < numberOfCells; ++
i) {
232 dinsVector.emplace_back(
topology().detId2denseGeomId(detId));
233 iVector.emplace_back(1);
237 if (
nullptr != ptr) {
238 ptr->getTransform(tr, (
Pt3DVec*)
nullptr);
242 tr = HepGeom::Translate3D(
gp.x(),
gp.y(),
gp.z());
245 const CLHEP::Hep3Vector
tt(tr.getTranslation());
246 trVector.emplace_back(
tt.x());
247 trVector.emplace_back(
tt.y());
248 trVector.emplace_back(
tt.z());
250 const CLHEP::HepRotation
rr(tr.getRotation());
251 const ROOT::Math::Transform3D rtr(
252 rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
rr.yx(),
rr.yy(),
rr.yz(),
tt.y(),
rr.zx(),
rr.zy(),
rr.zz(),
tt.z());
255 trVector.emplace_back(ea.Phi());
256 trVector.emplace_back(ea.Theta());
257 trVector.emplace_back(ea.Psi());
void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
std::set< DetId > DetIdSet
DecodedDetId decode(const DetId &id) const
int ieta() const
get the absolute value of the cell #'s along x-axis (EC) | z-axis (Barel)
bool present(const DetId &id) const override
is this detid present in the geometry?
A base class to handle the particular shape of HGCal volumes.
unsigned int indexFor(const DetId &id) const override
std::vector< CCGFloat > DimVec
unsigned int totalGeomModules() const
virtual unsigned int numberOfParametersPerShape() const
std::pair< int, int > getEtaPhi(double r, double phi) const
std::vector< GlobalPoint > CornersVec
CaloCellGeometry::Pt3DVec Pt3DVec
int numberEtaZ(int type) const
FastTimeDetId geometryCell() const
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
std::vector< unsigned int > IVec
virtual void fillNamedParams(DDFilteredView fv)
const FastTimeTopology & topology() const
void addValidID(const DetId &id)
std::vector< float > ParmVec
std::vector< CCGFloat > TrVec
HepGeom::Transform3D Tr3D
int iphi() const
get the absolute value of the cell #'s along y-axis (EC) | phi (Barrel)
Log< level::Error, false > LogError
int numberPhi(int type) const
int zside() const
get the z-side of the cell (1/-1)
GlobalPoint getPosition(const DetId &id) const
CaloCellGeometry::CCGFloat CCGFloat
CaloCellGeometry::Pt3D Pt3D
FastTimeGeometry(const FastTimeTopology &topology)
std::pair< int, int > getZPhi(double z, double phi) const
const CCGFloat * param() const
~FastTimeGeometry() override
virtual unsigned int numberOfShapes() const
virtual uint32_t detId2denseGeomId(const DetId &id) const
std::string cellElement() const
std::vector< DetId > m_validIds
std::vector< GlobalPoint > getCorners(int type, int izeta, int iphi, int zside) const
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
#define TYPELOOKUP_DATA_REG(_dataclass_)
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
AlgebraicVector EulerAngles
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
void initializeParms() override
CaloCellGeometry::CornersMgr * cornersMgr()
std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const override
Get the cell geometry of a given detector id. Should return false if not found.
double getRin(int type) const
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) override
DetId getClosestCell(const GlobalPoint &r) const override
CaloCellGeometry::Tr3D Tr3D
double getRout(int type) const
DetId encode(const DecodedDetId &id_) const
GlobalPoint getPosition(int type, int izeta, int iphi, int zside) const
double getZHalf(int type) const
virtual unsigned int numberOfTransformParms() const
const FastTimeDDDConstants & dddConstants() const
std::vector< DetId > m_validGeomIds
unsigned int sizeForDenseIndex() const
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell's volume.