13 : m_gp(gp), m_gv(gv) {
14 const double eps(fabs(small) > 1.
e-15 ? fabs(small) : 1.
e-10);
15 static unsigned int k_rlen(30);
17 m_ctr.reserve(k_rlen);
22 HepGeom::Point3D<double>(gp.
x(), gp.
y(), gp.
z()), HepGeom::Vector3D<double>(gv.
x(), gv.
y(), gv.
z()), eps);
24 LogDebug(
"CaloCellCrossing") <<
"*** Line: pt=" << line.
pt() <<
", unitvec=" << line.
uv();
28 for (
auto dId : ids) {
29 unsigned int found(0);
32 const HepGeom::Point3D<double> fr(cg->getPosition().x(), cg->getPosition().y(), cg->getPosition().z());
33 const double bCut2((gc[0] - gc[6]).
mag2());
35 if ((!onewayonly || eps < HepGeom::Vector3D<double>(fr - line.
pt()).
dot(line.
uv())) &&
36 bCut2 > line.
dist2(fr))
38 LogDebug(
"CaloCellCrossing") <<
"*** fr=" << fr <<
", bCut =" <<
sqrt(bCut2) <<
", dis=" << line.
dist(fr);
39 const HepGeom::Point3D<double>
cv[8] = {HepGeom::Point3D<double>(gc[0].x(), gc[0].y(), gc[0].z()),
40 HepGeom::Point3D<double>(gc[1].
x(), gc[1].y(), gc[1].z()),
41 HepGeom::Point3D<double>(gc[2].
x(), gc[2].y(), gc[2].z()),
42 HepGeom::Point3D<double>(gc[3].
x(), gc[3].y(), gc[3].z()),
43 HepGeom::Point3D<double>(gc[4].
x(), gc[4].y(), gc[4].z()),
44 HepGeom::Point3D<double>(gc[5].
x(), gc[5].y(), gc[5].z()),
45 HepGeom::Point3D<double>(gc[6].
x(), gc[6].y(), gc[6].z()),
46 HepGeom::Point3D<double>(gc[7].
x(), gc[7].y(), gc[7].z())};
47 const HepGeom::Point3D<double>
ctr(0.125 * (cv[0] + cv[1] + cv[2] + cv[3] + cv[4] + cv[5] + cv[6] + cv[7]));
48 const double dCut2(bCut2 / 4.);
49 if (dCut2 > line.
dist2(ctr))
51 LogDebug(
"CaloCellCrossing") <<
"** 2nd cut: ctr=" << ctr <<
", dist=" << line.
dist(ctr);
52 static const unsigned int nc[6][4] = {
53 {0, 1, 2, 3}, {0, 4, 5, 1}, {0, 4, 7, 3}, {6, 7, 4, 5}, {6, 2, 3, 7}, {6, 2, 1, 5}};
54 for (
unsigned int face(0); face != 6; ++face) {
55 const unsigned int* ic(&nc[face][0]);
56 const HepGeom::Plane3D<double> pl(cv[ic[0]], cv[ic[1]], cv[ic[2]]);
58 const HepGeom::Point3D<double>
pt(line.
point(pl, parallel));
59 LogDebug(
"CaloCellCrossing") <<
"***Face: " << face <<
", pt=" <<
pt;
61 LogDebug(
"CaloCellCrossing") <<
"Not parallel";
62 const HepLine3D la(cv[ic[0]], cv[ic[1]], eps);
63 const HepLine3D lb(cv[ic[2]], cv[ic[3]], eps);
69 const HepLine3D lc(cv[ic[0]], cv[ic[3]], eps);
70 const HepLine3D ld(cv[ic[1]], cv[ic[2]], eps);
85 (pt - HepGeom::Point3D<double>(
m_entr.back().x(),
m_entr.back().y(),
m_entr.back().z())).mag());
87 (pt - HepGeom::Point3D<double>(
m_exit.back().x(),
m_exit.back().y(),
m_exit.back().z())).mag());
88 if (eps < dist1 && eps < dist2) {
90 <<
"********For DetId = " << dId <<
" distances too big: " << dist1 <<
", " << dist2;
108 for (
unsigned int i(0);
i !=
m_entr.size(); ++
i) {
double dist2(const HepGeom::Point3D< double > &q) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Global3DPoint GlobalPoint
const HepGeom::Vector3D< double > & uv() 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)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
double dist(const HepGeom::Point3D< double > &q) const
CaloCellCrossing(const GlobalPoint &gp, const GlobalVector &gv, const DetIds *di, const CaloSubdetectorGeometry *sg, DetId::Detector det, int subdet, double small=1.e-10, bool onewayonly=false)
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.
HepGeom::Point3D< double > point(const HepGeom::Plane3D< double > &pl, bool ¶llel) const
std::vector< DetId > DetIds
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
const HepGeom::Point3D< double > & pt() const
Log< level::Warning, false > LogWarning