4 #include <Math/Transform3D.h> 5 #include <Math/EulerAngles.h> 16 : m_parMgr(nullptr), m_cmgr(nullptr), m_deltaPhi(nullptr), m_deltaEta(nullptr) {}
52 if (
nullptr != cell) {
68 const double eta(
r.eta());
69 const double phi(
r.phi());
76 if (
nullptr != cell) {
79 if (fabs(
eta - eta0) <
dR) {
83 delp = 2 *
M_PI - delp;
100 cells.reserve(ids.size());
127 for (
float iv :
pv) {
134 std::shared_ptr<const CaloCellGeometry> ptr(
cellGeomPtr(
i));
136 ptr->getTransform(tr, (
Pt3DVec*)
nullptr);
140 tr = HepGeom::Translate3D(
gp.x(),
gp.y(),
gp.z());
143 const CLHEP::Hep3Vector
tt(tr.getTranslation());
144 tVec.emplace_back(
tt.x());
145 tVec.emplace_back(
tt.y());
146 tVec.emplace_back(
tt.z());
148 const CLHEP::HepRotation
rr(tr.getRotation());
149 const ROOT::Math::Transform3D rtr(
150 rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
rr.yx(),
rr.yy(),
rr.yz(),
tt.y(),
rr.zx(),
rr.zy(),
rr.zz(),
tt.z());
153 tVec.emplace_back(ea.Phi());
154 tVec.emplace_back(ea.Theta());
155 tVec.emplace_back(ea.Psi());
160 unsigned int ishape(9999);
161 for (
unsigned int ivv(0); ivv !=
parVecVec().size(); ++ivv) {
165 ok =
ok && (fabs(par[
k] -
pv[
k]) < 1.e-6);
175 if (iVec.size() <
nn)
176 iVec.emplace_back(ishape);
183 if (!
m_deltaPhi.load(std::memory_order_acquire)) {
185 auto ptr =
new std::vector<CCGFloat>(kSize);
186 for (uint32_t
i(0);
i != kSize; ++
i) {
187 std::shared_ptr<const CaloCellGeometry> cellPtr(
cellGeomPtr(
i));
188 if (
nullptr != cellPtr) {
189 CCGFloat dPhi1(fabs(
GlobalPoint((cellPtr->getCorners()[0].x() + cellPtr->getCorners()[1].x()) / 2.,
190 (cellPtr->getCorners()[0].y() + cellPtr->getCorners()[1].y()) / 2.,
191 (cellPtr->getCorners()[0].z() + cellPtr->getCorners()[1].z()) / 2.)
193 GlobalPoint((cellPtr->getCorners()[2].x() + cellPtr->getCorners()[3].x()) / 2.,
194 (cellPtr->getCorners()[2].y() + cellPtr->getCorners()[3].y()) / 2.,
195 (cellPtr->getCorners()[2].z() + cellPtr->getCorners()[3].z()) / 2.)
197 CCGFloat dPhi2(fabs(
GlobalPoint((cellPtr->getCorners()[0].x() + cellPtr->getCorners()[3].x()) / 2.,
198 (cellPtr->getCorners()[0].y() + cellPtr->getCorners()[3].y()) / 2.,
199 (cellPtr->getCorners()[0].z() + cellPtr->getCorners()[3].z()) / 2.)
201 GlobalPoint((cellPtr->getCorners()[2].x() + cellPtr->getCorners()[1].x()) / 2.,
202 (cellPtr->getCorners()[2].y() + cellPtr->getCorners()[1].y()) / 2.,
203 (cellPtr->getCorners()[2].z() + cellPtr->getCorners()[1].z()) / 2.)
206 dPhi1 = fabs(dPhi1 - 2. *
M_PI);
208 dPhi2 = fabs(dPhi2 - 2. *
M_PI);
209 (*ptr)[
i] = dPhi1 > dPhi2 ? dPhi1 : dPhi2;
212 std::vector<CCGFloat>* expect =
nullptr;
213 bool exchanged =
m_deltaPhi.compare_exchange_strong(expect, ptr, std::memory_order_acq_rel);
221 if (!
m_deltaEta.load(std::memory_order_acquire)) {
223 auto ptr =
new std::vector<CCGFloat>(kSize);
224 for (uint32_t
i(0);
i != kSize; ++
i) {
225 std::shared_ptr<const CaloCellGeometry> cellPtr(
cellGeomPtr(
i));
226 if (
nullptr != cellPtr) {
227 const CCGFloat dEta1(fabs(
GlobalPoint((cellPtr->getCorners()[0].x() + cellPtr->getCorners()[1].x()) / 2.,
228 (cellPtr->getCorners()[0].y() + cellPtr->getCorners()[1].y()) / 2.,
229 (cellPtr->getCorners()[0].z() + cellPtr->getCorners()[1].z()) / 2.)
231 GlobalPoint((cellPtr->getCorners()[2].x() + cellPtr->getCorners()[3].x()) / 2.,
232 (cellPtr->getCorners()[2].y() + cellPtr->getCorners()[3].y()) / 2.,
233 (cellPtr->getCorners()[2].z() + cellPtr->getCorners()[3].z()) / 2.)
235 const CCGFloat dEta2(fabs(
GlobalPoint((cellPtr->getCorners()[0].x() + cellPtr->getCorners()[3].x()) / 2.,
236 (cellPtr->getCorners()[0].y() + cellPtr->getCorners()[3].y()) / 2.,
237 (cellPtr->getCorners()[0].z() + cellPtr->getCorners()[3].z()) / 2.)
239 GlobalPoint((cellPtr->getCorners()[2].x() + cellPtr->getCorners()[1].x()) / 2.,
240 (cellPtr->getCorners()[2].y() + cellPtr->getCorners()[1].y()) / 2.,
241 (cellPtr->getCorners()[2].z() + cellPtr->getCorners()[1].z()) / 2.)
243 (*ptr)[
i] = dEta1 > dEta2 ? dEta1 : dEta2;
246 std::vector<CCGFloat>* expect =
nullptr;
247 bool exchanged =
m_deltaEta.compare_exchange_strong(expect, ptr, std::memory_order_acq_rel);
263 static const auto do_not_delete = [](
const void*) {};
264 return ptr ==
nullptr ? nullptr : std::shared_ptr<const CaloCellGeometry>(ptr, do_not_delete);
CaloCellGeometry::CornersMgr * m_cmgr
std::set< DetId > DetIdSet
std::vector< CCGFloat > DimVec
virtual unsigned int numberOfTransformParms() const
Geom::Phi< T > phi() const
int closest(std::vector< int > const &vec, int value)
MgrType::size_type size_type
Global3DPoint GlobalPoint
std::vector< unsigned int > IVec
uint32_t denseIndex() const
std::vector< CCGFloat > TrVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Transform3D Tr3D
virtual unsigned int numberOfShapes() const
std::vector< Pt3D > Pt3DVec
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
EZMgrFL< GlobalPoint > CornersMgr
CaloCellGeometry::CCGFloat CCGFloat
void allocatePar(ParVec::size_type n, unsigned int m)
CCGFloat deltaPhi(const DetId &detId) const
std::vector< std::shared_ptr< const CaloCellGeometry > > CellSet
static constexpr unsigned int k_cornerSize
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
std::vector< DetId > m_validIds
std::atomic< std::vector< CCGFloat > * > m_deltaPhi
virtual bool present(const DetId &id) const
is this detid present in the geometry?
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
CaloSubdetectorGeometry::CCGFloat CCGFloat
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
virtual DetId getClosestCell(const GlobalPoint &r) const
CaloSubdetectorGeometry()
AlgebraicVector EulerAngles
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void addValidID(const DetId &id)
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
virtual unsigned int indexFor(const DetId &id) const
CaloCellGeometry::Pt3D Pt3D
CaloCellGeometry::ParMgr ParMgr
CaloCellGeometry::Tr3D Tr3D
virtual ~CaloSubdetectorGeometry()
The base class DOES assume that it owns the CaloCellGeometry objects.
virtual CellSet getCellSet(const GlobalPoint &r, double dR) const
virtual const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const =0
CCGFloat deltaEta(const DetId &detId) const
uint32_t sizeForDenseIndexing() const
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
std::atomic< std::vector< CCGFloat > * > m_deltaEta
virtual unsigned int numberOfParametersPerShape() const
virtual unsigned int sizeForDenseIndex(const DetId &id) const