4 const std::vector<int> &innerDoublets,
9 int nDoublets = innerDoublets.size();
10 int constexpr VSIZE = 4;
21 auto loop = [&](
int i,
int vs) {
22 for (
int j = 0;
j < vs; ++
j) {
23 auto otherDoubletId = innerDoublets[i +
j];
24 auto &otherDoublet = allDoublets[otherDoubletId];
25 xi[
j] = otherDoublet.innerX();
26 yi[
j] = otherDoublet.innerY();
27 zi[
j] = otherDoublet.innerZ();
28 seedi[
j] = otherDoublet.seedIndex();
30 LogDebug(
"HGCDoublet") << i +
j <<
" is doublet " << otherDoubletId << std::endl;
33 for (
int j = 0;
j < vs; ++
j) {
38 ok[
j] =
areAligned(xi[
j], yi[j], zi[j], xo, yo, zo, minCosTheta, minCosPointing, refDir, debug);
40 LogDebug(
"HGCDoublet") <<
"Are aligned for InnerDoubletId: " << i + j <<
" is " << ok[
j] << std::endl;
43 for (
int j = 0;
j < vs; ++
j) {
44 auto otherDoubletId = innerDoublets[i +
j];
45 auto &otherDoublet = allDoublets[otherDoubletId];
47 otherDoublet.tagAsOuterNeighbor(doubletId);
48 allDoublets[doubletId].tagAsInnerNeighbor(otherDoubletId);
52 auto lim = VSIZE * (nDoublets / VSIZE);
53 for (
int i = 0; i < lim; i += VSIZE)
55 loop(lim, nDoublets - lim);
59 <<
" considered" << std::endl;
83 auto dot = dx1 * dx2 + dy1 * dy2 + dz1 * dz2;
86 auto mag1sq = dx1 * dx1 + dy1 * dy1 + dz1 * dz1;
87 auto mag2sq = dx2 * dx2 + dy2 * dy2 + dz2 * dz2;
89 auto minCosTheta_sq = minCosTheta * minCosTheta;
90 bool isWithinLimits = (dotsq > minCosTheta_sq * mag1sq * mag2sq);
93 LogDebug(
"HGCDoublet") <<
"-- Are Aligned -- dotsq: " << dotsq <<
" mag1sq: " << mag1sq <<
" mag2sq: " << mag2sq
94 <<
"minCosTheta_sq:" << minCosTheta_sq <<
" isWithinLimits: " << isWithinLimits << std::endl;
107 auto dot_pointing = pointingDir.
dot(firstDoublet);
108 auto dot_pointing_sq = dot_pointing * dot_pointing;
109 auto mag_pointing_sq = pointingDir.
mag2();
110 auto minCosPointing_sq = minCosPointing * minCosPointing;
111 bool isWithinLimitsPointing = (dot_pointing_sq > minCosPointing_sq * mag_pointing_sq * mag2sq);
113 LogDebug(
"HGCDoublet") <<
"Pointing direction: " << pointingDir << std::endl;
114 LogDebug(
"HGCDoublet") <<
"-- Are Aligned -- dot_pointing_sq: " << dot_pointing_sq
115 <<
" mag_pointing_sq: " << mag_pointing_sq <<
" mag2sq: " << mag2sq
116 <<
" isWithinLimitsPointing: " << isWithinLimitsPointing << std::endl;
120 return isWithinLimits && isWithinLimitsPointing;
127 const unsigned int outInHops,
128 const unsigned int maxOutInHops,
129 std::vector<std::pair<unsigned int, unsigned int> > &outInToVisit) {
134 for (
unsigned int i = 0;
i < numberOfOuterNeighbors; ++
i) {
136 allDoublets, tmpNtuplet, seedIndex, outInDFS, outInHops, maxOutInHops, outInToVisit);
138 if (outInDFS && outInHops < maxOutInHops) {
140 outInToVisit.emplace_back(inN, outInHops + 1);
std::vector< unsigned int > HGCntuplet
std::vector< int > outerNeighbors_
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
int areAligned(double xi, double yi, double zi, double xo, double yo, double zo, float minCosTheta, float minCosPointing, const GlobalVector &refDir, bool debug=false) const
std::vector< int > innerNeighbors_
void findNtuplets(std::vector< HGCDoublet > &allDoublets, HGCntuplet &tmpNtuplet, int seedIndex, const bool outInDFS, const unsigned int outInHops, const unsigned int maxOutInHops, std::vector< std::pair< unsigned int, unsigned int > > &outInToVisit)
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
bool checkCompatibilityAndTag(std::vector< HGCDoublet > &allDoublets, const std::vector< int > &innerDoublets, const GlobalVector &refDir, float minCosTheta, float minCosPointing=1., bool debug=false)
Global3DVector GlobalVector