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()) {
24 std::cout <<
"Expected total # of Geometry Modules " 47 const DetId& detId ) {
54 const uint32_t cellIndex (
topology().detId2denseGeomId(detId));
62 for (
int etaZ = 1; etaZ <= nEtaZ; ++etaZ) {
74 std::cout <<
"FastTimeGeometry::newCell-> [" << cellIndex <<
"]" 75 <<
" front:" << f1.
x() <<
'/' << f1.
y() <<
'/' << f1.
z()
76 <<
" back:" << f2.
x() <<
'/' << f2.
y() <<
'/' << f2.
z()
77 <<
" eta|phi " <<
m_cellVec[cellIndex].etaPos() <<
":" 79 <<
" with valid DetId from " << nOld <<
" to " <<
m_validIds.size()
81 std::cout <<
"Cell[" << cellIndex <<
"] " << std::hex << geomId.
rawId()
89 if (
id ==
DetId())
return nullptr;
91 const uint32_t cellIndex (
topology().detId2denseGeomId(geoId));
97 if (
id ==
DetId())
return false;
115 for(
const auto&
corner : corners ) {
122 int zside = (r.
z() > 0) ? 1 : -1;
123 std::pair<int,int> etaZPhi;
125 double zz = (zside > 0) ? r.
z() : -r.
z();
128 double phi = (zside > 0) ? r.
phi() : atan2(r.
y(),-r.
x());
133 std::cout <<
"getClosestCell: for (" << r.
x() <<
", " << r.
y() <<
", " 134 << r.
z() <<
") Id " <<
id.type() <<
":" <<
id.zside() <<
":" 135 <<
id.ieta() <<
":" <<
id.iphi() << std::endl;
147 if (
m_Type == 1)
return "FastTimeBarrel";
148 else if (
m_Type == 2)
return "FastTimeEndcap";
149 else return "Unknown";
153 unsigned int cellIndex =
m_cellVec.size();
158 std::cout <<
"indexFor " << std::hex <<
id.rawId() <<
":" << geoId.
rawId()
159 <<
std::dec <<
" index " << cellIndex << std::endl;
173 nullptr == cell->
param() ?
nullptr : cell);
179 static const auto do_not_delete = [](
const void*){};
180 auto cell = std::shared_ptr<const CaloCellGeometry>(&
m_cellVec[
index],do_not_delete);
181 if (
nullptr == cell->param())
return nullptr;
190 cell->setPosition(pos);
194 if (
nullptr == cell->param())
return nullptr;
199 edm::LogError(
"FastTimeGeom") <<
"FastTimeGeometry::addValidID is not implemented";
227 iVector.reserve( numberOfCells );
228 dimVector.reserve( numberOfShapes * numberOfParametersPerShape );
229 dinsVector.reserve( numberOfCells );
234 params[1] = params[2] = 0;
238 params[6] = params[10]= 0;
239 params[11]= (
k == 0) ? 1.0 : -1.0;
240 dimVector.insert( dimVector.end(), params.begin(), params.end());
243 for (
unsigned int i( 0 );
i < numberOfCells; ++
i) {
245 dinsVector.emplace_back(
topology().detId2denseGeomId( detId ));
246 iVector.emplace_back(1);
250 if (
nullptr != ptr ) {
251 ptr->getTransform( tr, (
Pt3DVec* )
nullptr );
255 tr = HepGeom::Translate3D(
gp.x(),
gp.y(),
gp.z());
258 const CLHEP::Hep3Vector
tt( tr.getTranslation());
259 trVector.emplace_back(
tt.x());
260 trVector.emplace_back(
tt.y());
261 trVector.emplace_back(
tt.z());
263 const CLHEP::HepRotation
rr( tr.getRotation());
264 const ROOT::Math::Transform3D rtr(
rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
268 rtr.GetRotation( ea );
269 trVector.emplace_back( ea.Phi());
270 trVector.emplace_back( ea.Theta());
271 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)
A base class to handle the particular shape of HGCal volumes.
std::vector< CCGFloat > DimVec
unsigned int totalGeomModules() const
virtual unsigned int numberOfParametersPerShape() const
std::pair< int, int > getEtaPhi(double r, double phi) const
DetId getClosestCell(const GlobalPoint &r) const override
std::vector< GlobalPoint > CornersVec
CaloCellGeometry::Pt3DVec Pt3DVec
void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
int numberEtaZ(int type) const
FastTimeDetId geometryCell() const
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
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)
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)
uint32_t rawId() const
get the raw id
std::pair< int, int > getZPhi(double z, double phi) const
CaloCellGeometry::Tr3D Tr3D
const CCGFloat * param() const
DetIdSet getCells(const GlobalPoint &r, double dR) const override
Get a list of all cells within a dR of the given cell.
~FastTimeGeometry() override
virtual unsigned int numberOfShapes() const
virtual uint32_t detId2denseGeomId(const DetId &id) const
std::string cellElement() const
std::vector< DetId > m_validIds
bool present(const DetId &id) const override
is this detid present in the geometry?
std::vector< GlobalPoint > getCorners(int type, int izeta, int iphi, int zside) const
static void localCorners(Pt3DVec &vec, const CCGFloat *pv, Pt3D &ref)
#define TYPELOOKUP_DATA_REG(_dataclass_)
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.
AlgebraicVector EulerAngles
unsigned int indexFor(const DetId &id) const override
void initializeParms() override
CaloCellGeometry::CornersMgr * cornersMgr()
double getRin(int type) const
void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId) 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
std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const override
const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const override
virtual unsigned int numberOfTransformParms() const
const FastTimeDDDConstants & dddConstants() const
std::vector< DetId > m_validGeomIds
unsigned int sizeForDenseIndex() const
CornersVec getCorners(const DetId &id) const
Returns the corner points of this cell's volume.