4 #include <Math/Transform3D.h> 5 #include <Math/EulerAngles.h> 38 const std::vector<DetId>&
45 std::shared_ptr<const CaloCellGeometry>
60 uint32_t
index ( ~0 ) ;
65 if(
nullptr != cell ) {
76 return ( closest > 0.9e9 ||
77 (uint32_t)(~0) == index ?
DetId(0) :
83 const double dR2 ( dR*dR ) ;
84 const double eta ( r.
eta() ) ;
85 const double phi ( r.
phi() ) ;
98 if( fabs(
eta - eta0 ) <
dR )
102 if( delp >
M_PI ) delp = 2*
M_PI - delp ;
106 if( dist2 < dR2 ) dss.insert(
m_validIds[i] ) ;
120 for (
auto id : ids) cells.emplace_back(
getGeometry(
id));
127 assert(
nullptr ==
m_cmgr ) ;
153 dVec.emplace_back( iv ) ;
159 std::shared_ptr<const CaloCellGeometry> ptr (
cellGeomPtr(
i ) ) ;
160 assert(
nullptr != ptr ) ;
161 ptr->getTransform( tr, (
Pt3DVec* )
nullptr ) ;
165 tr = HepGeom::Translate3D(
gp.x(),
gp.y(),
gp.z() ) ;
168 const CLHEP::Hep3Vector
tt ( tr.getTranslation() ) ;
169 tVec.emplace_back(
tt.x() ) ;
170 tVec.emplace_back(
tt.y() ) ;
171 tVec.emplace_back(
tt.z() ) ;
173 const CLHEP::HepRotation
rr ( tr.getRotation() ) ;
174 const ROOT::Math::Transform3D rtr (
rr.xx(),
rr.xy(),
rr.xz(),
tt.x(),
176 rr.zx(),
rr.zy(),
rr.zz(),
tt.z() ) ;
178 rtr.GetRotation( ea ) ;
179 tVec.emplace_back( ea.Phi() ) ;
180 tVec.emplace_back( ea.Theta() ) ;
181 tVec.emplace_back( ea.Psi() ) ;
184 const CCGFloat* par ( ptr->param() ) ;
186 unsigned int ishape ( 9999 ) ;
187 for(
unsigned int ivv ( 0 ) ; ivv !=
parVecVec().size() ; ++ivv ) {
191 ok = ok && ( fabs( par[
k] - pv[
k] ) < 1.e-6 ) ;
198 assert( 9999 != ishape ) ;
201 if( iVec.size() <
nn ) iVec.emplace_back( ishape ) ;
208 if(!
m_deltaPhi.load(std::memory_order_acquire)) {
210 auto ptr =
new std::vector<CCGFloat>(kSize);
211 for( uint32_t
i ( 0 ) ;
i != kSize ; ++
i ) {
212 std::shared_ptr<const CaloCellGeometry> cellPtr (
cellGeomPtr(
i ) ) ;
213 if(
nullptr != cellPtr ) {
216 cellPtr->getCorners()[1].x() )/2.,
217 (cellPtr->getCorners()[0].y() +
218 cellPtr->getCorners()[1].y() )/2.,
219 (cellPtr->getCorners()[0].z() +
220 cellPtr->getCorners()[1].z() )/2.).
phi() -
222 cellPtr->getCorners()[3].x() )/2.,
223 (cellPtr->getCorners()[2].y() +
224 cellPtr->getCorners()[3].y() )/2.,
225 (cellPtr->getCorners()[2].z() +
226 cellPtr->getCorners()[3].z() )/2.).
phi() ) ) ;
229 cellPtr->getCorners()[3].x() )/2.,
230 (cellPtr->getCorners()[0].y() +
231 cellPtr->getCorners()[3].y() )/2.,
232 (cellPtr->getCorners()[0].z() +
233 cellPtr->getCorners()[3].z() )/2. ).
phi() -
235 cellPtr->getCorners()[1].x() )/2.,
236 (cellPtr->getCorners()[2].y() +
237 cellPtr->getCorners()[1].y() )/2.,
238 (cellPtr->getCorners()[2].z() +
239 cellPtr->getCorners()[1].z() )/2.).
phi() ) ) ;
240 if(
M_PI < dPhi1 ) dPhi1 = fabs( dPhi1 - 2.*
M_PI ) ;
241 if(
M_PI < dPhi2 ) dPhi2 = fabs( dPhi2 - 2.*
M_PI ) ;
242 (*ptr)[
i] = dPhi1>dPhi2 ? dPhi1 : dPhi2 ;
245 std::vector<CCGFloat>* expect =
nullptr;
246 bool exchanged =
m_deltaPhi.compare_exchange_strong(expect, ptr, std::memory_order_acq_rel);
247 if (!exchanged)
delete ptr;
255 if(!
m_deltaEta.load(std::memory_order_acquire)) {
257 auto ptr =
new std::vector<CCGFloat> ( kSize ) ;
258 for( uint32_t
i ( 0 ) ;
i != kSize ; ++
i ) {
259 std::shared_ptr<const CaloCellGeometry> cellPtr (
cellGeomPtr(
i ) ) ;
260 if(
nullptr != cellPtr ) {
263 cellPtr->getCorners()[1].x())/2.,
264 (cellPtr->getCorners()[0].y() +
265 cellPtr->getCorners()[1].y())/2.,
266 (cellPtr->getCorners()[0].z() +
267 cellPtr->getCorners()[1].z())/2.).
eta() -
269 cellPtr->getCorners()[3].x())/2.,
270 (cellPtr->getCorners()[2].y() +
271 cellPtr->getCorners()[3].y())/2. ,
272 (cellPtr->getCorners()[2].z() +
273 cellPtr->getCorners()[3].z())/2.).
eta() ) ) ;
276 cellPtr->getCorners()[3].x())/2.,
277 (cellPtr->getCorners()[0].y() +
278 cellPtr->getCorners()[3].y())/2.,
279 (cellPtr->getCorners()[0].z() +
280 cellPtr->getCorners()[3].z())/2.).
eta() -
282 cellPtr->getCorners()[1].x())/2.,
283 (cellPtr->getCorners()[2].y() +
284 cellPtr->getCorners()[1].y())/2.,
285 (cellPtr->getCorners()[2].z() +
286 cellPtr->getCorners()[1].z())/2.).
eta() ) ) ;
287 (*ptr)[
i] = dEta1>dEta2 ? dEta1 : dEta2 ;
290 std::vector<CCGFloat>* expect =
nullptr;
291 bool exchanged =
m_deltaEta.compare_exchange_strong(expect, ptr, std::memory_order_acq_rel);
292 if (!exchanged)
delete ptr;
302 std::shared_ptr<const CaloCellGeometry>
306 static const auto do_not_delete = [](
const void*){};
307 return ptr ==
nullptr ?
nullptr : std::shared_ptr<const CaloCellGeometry>(ptr, do_not_delete);
virtual const CaloCellGeometry * getGeometryRawPtr(uint32_t index) const =0
CaloCellGeometry::CornersMgr * m_cmgr
std::set< DetId > DetIdSet
std::vector< CCGFloat > DimVec
virtual unsigned int numberOfParametersPerShape() const
CCGFloat deltaPhi(const DetId &detId) const
Geom::Phi< T > phi() const
MgrType::size_type size_type
Global3DPoint GlobalPoint
std::vector< unsigned int > IVec
std::vector< CCGFloat > TrVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Transform3D Tr3D
uint32_t sizeForDenseIndexing() const
std::vector< Pt3D > Pt3DVec
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
CCGFloat deltaEta(const DetId &detId) const
CaloCellGeometry::CCGFloat CCGFloat
EZMgrFL< GlobalPoint > CornersMgr
void allocatePar(ParVec::size_type n, unsigned int m)
virtual CellSet getCellSet(const GlobalPoint &r, double dR) const
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)
std::vector< std::shared_ptr< const CaloCellGeometry > > CellSet
static constexpr unsigned int k_cornerSize
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
virtual bool present(const DetId &id) const
is this detid present in the geometry?
virtual std::shared_ptr< const CaloCellGeometry > cellGeomPtr(uint32_t index) const
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
virtual unsigned int numberOfShapes() const
std::vector< DetId > m_validIds
std::atomic< std::vector< CCGFloat > * > m_deltaPhi
CaloSubdetectorGeometry::CCGFloat CCGFloat
uint32_t denseIndex() const
CaloSubdetectorGeometry()
virtual DetId getClosestCell(const GlobalPoint &r) const
AlgebraicVector EulerAngles
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
void addValidID(const DetId &id)
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.
CaloCellGeometry::Pt3DVec Pt3DVec
HepGeom::Point3D< CCGFloat > Pt3D
CaloCellGeometry::Pt3D Pt3D
CaloCellGeometry::ParMgr ParMgr
CaloCellGeometry::Tr3D Tr3D
virtual unsigned int indexFor(const DetId &id) const
virtual ~CaloSubdetectorGeometry()
The base class DOES assume that it owns the CaloCellGeometry objects.
void allocateCorners(CaloCellGeometry::CornersVec::size_type n)
std::atomic< std::vector< CCGFloat > * > m_deltaEta
virtual unsigned int numberOfTransformParms() const
virtual unsigned int sizeForDenseIndex(const DetId &id) const