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) {
67 const double dR2(
dR *
dR);
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) {
128 dVec.emplace_back(iv);
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);