4 const std::vector<int> &innerDoublets,
9 int nDoublets = innerDoublets.size();
10 int constexpr VSIZE = 4;
16 bool siblingsClusters[VSIZE];
22 auto loop = [&](
int i,
int vs) {
23 for (
int j = 0;
j < vs; ++
j) {
24 auto otherDoubletId = innerDoublets[
i +
j];
25 auto &otherDoublet = allDoublets[otherDoubletId];
26 xi[
j] = otherDoublet.innerX();
27 yi[
j] = otherDoublet.innerY();
28 zi[
j] = otherDoublet.innerZ();
29 seedi[
j] = otherDoublet.seedIndex();
30 siblingsClusters[
j] = otherDoublet.areSiblingClusters();
32 LogDebug(
"HGCDoublet") <<
i +
j <<
" is doublet " << otherDoubletId << std::endl;
35 for (
int j = 0;
j < vs; ++
j) {
46 LogDebug(
"HGCDoublet") <<
"Are aligned for InnerDoubletId: " <<
i +
j <<
" is " <<
ok[
j] << std::endl;
49 for (
int j = 0;
j < vs; ++
j) {
50 auto otherDoubletId = innerDoublets[
i +
j];
51 auto &otherDoublet = allDoublets[otherDoubletId];
53 otherDoublet.tagAsOuterNeighbor(doubletId);
54 allDoublets[doubletId].tagAsInnerNeighbor(otherDoubletId);
58 auto lim = VSIZE * (nDoublets / VSIZE);
59 for (
int i = 0;
i < lim;
i += VSIZE)
61 loop(lim, nDoublets - lim);
65 <<
" considered" << std::endl;
89 auto dot = dx1 * dx2 + dy1 * dy2 + dz1 * dz2;
92 auto mag1sq = dx1 * dx1 + dy1 * dy1 + dz1 * dz1;
93 auto mag2sq = dx2 * dx2 + dy2 * dy2 + dz2 * dz2;
95 auto minCosTheta_sq = minCosTheta * minCosTheta;
96 bool isWithinLimits = (dotsq > minCosTheta_sq * mag1sq * mag2sq);
99 LogDebug(
"HGCDoublet") <<
"-- Are Aligned -- dotsq: " << dotsq <<
" mag1sq: " << mag1sq <<
" mag2sq: " << mag2sq
100 <<
"minCosTheta_sq:" << minCosTheta_sq <<
" isWithinLimits: " << isWithinLimits << std::endl;
113 auto dot_pointing = pointingDir.
dot(firstDoublet);
114 auto dot_pointing_sq = dot_pointing * dot_pointing;
115 auto mag_pointing_sq = pointingDir.
mag2();
116 auto minCosPointing_sq = minCosPointing * minCosPointing;
117 bool isWithinLimitsPointing = (dot_pointing_sq > minCosPointing_sq * mag_pointing_sq * mag2sq);
119 LogDebug(
"HGCDoublet") <<
"Pointing direction: " << pointingDir << std::endl;
120 LogDebug(
"HGCDoublet") <<
"-- Are Aligned -- dot_pointing_sq: " << dot_pointing_sq
121 <<
" mag_pointing_sq: " << mag_pointing_sq <<
" mag2sq: " << mag2sq
122 <<
" isWithinLimitsPointing: " << isWithinLimitsPointing << std::endl;
126 return isWithinLimits && isWithinLimitsPointing;
133 const unsigned int outInHops,
134 const unsigned int maxOutInHops,
135 std::vector<std::pair<unsigned int, unsigned int> > &outInToVisit) {
140 for (
unsigned int i = 0;
i < numberOfOuterNeighbors; ++
i) {
142 allDoublets, tmpNtuplet,
seedIndex, outInDFS, outInHops, maxOutInHops, outInToVisit);
144 if (outInDFS && outInHops < maxOutInHops) {
146 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
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
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)
bool checkCompatibilityAndTag(std::vector< HGCDoublet > &allDoublets, const std::vector< int > &innerDoublets, const GlobalVector &refDir, float minCosTheta, float minCosPointing=1., bool debug=false)
Global3DVector GlobalVector