1 #ifndef RecoPixelVertexing_PixelTriplets_src_CACell_h
2 #define RecoPixelVertexing_PixelTriplets_src_CACell_h
70 allStatus[
me].hasSameStateNeighbors = 0;
71 auto mystate = allStatus[
me].theCAState;
74 if (allStatus[oc].getCAState() == mystate) {
75 allStatus[
me].hasSameStateNeighbors = 1;
85 const float region_origin_x,
86 const float region_origin_y,
87 const float region_origin_radius,
90 const float hardPtCut,
91 std::vector<CACell::CAntuplet>* foundTriplets) {
92 int ncells = innerCells.size();
93 int constexpr VSIZE = 16;
97 float thetaCut[VSIZE];
101 unsigned int cellId =
this - &allCells.front();
102 auto loop = [&](
int i,
int vs) {
103 for (
int j = 0;
j < vs; ++
j) {
104 auto koc = innerCells[
i +
j];
105 auto& oc = allCells[koc];
106 r1[
j] = oc.getInnerR();
107 z1[
j] = oc.getInnerZ();
108 thetaCut[
j] = thetaCutByInnerLayer.
at(oc.getInnerLayer());
109 phiCut[
j] = phiCutByInnerLayer.
at(oc.getInnerLayer());
112 for (
int j = 0;
j < vs; ++
j)
114 for (
int j = 0;
j < vs; ++
j) {
115 auto koc = innerCells[
i +
j];
116 auto& oc = allCells[koc];
118 oc,
ptmin, region_origin_x, region_origin_y, region_origin_radius, phiCut[
j], hardPtCut)) {
122 oc.tagAsOuterNeighbor(cellId);
127 auto lim = VSIZE * (ncells / VSIZE);
128 for (
int i = 0;
i < lim;
i += VSIZE)
130 loop(lim, ncells - lim);
136 const float region_origin_x,
137 const float region_origin_y,
138 const float region_origin_radius,
141 const float hardPtCut) {
147 region_origin_radius,
148 thetaCutByInnerLayer,
155 std::vector<CACell::CAntuplet>& foundTriplets,
157 const float region_origin_x,
158 const float region_origin_y,
159 const float region_origin_radius,
162 const float hardPtCut) {
168 region_origin_radius,
169 thetaCutByInnerLayer,
177 float distance_13_squared = radius_diff * radius_diff + (z1 - zo) * (z1 - zo);
181 float tan_12_13_half_mul_distance_13_squared =
183 return tan_12_13_half_mul_distance_13_squared *
pMin <= thetaCut * distance_13_squared * radius_diff;
190 const float region_origin_x,
191 const float region_origin_y,
192 const float region_origin_radius,
194 const float hardPtCut)
const {
204 float distance_13_squared = (
x1 - x3) * (
x1 - x3) + (
y1 - y3) * (
y1 - y3);
205 float tan_12_13_half_mul_distance_13_squared =
std::abs(
y1 * (
x2 - x3) +
y2 * (x3 -
x1) + y3 * (
x1 -
x2));
207 if (tan_12_13_half_mul_distance_13_squared *
ptmin <= 1.0
e-4
f * distance_13_squared) {
208 float distance_3_beamspot_squared =
209 (x3 - region_origin_x) * (x3 - region_origin_x) + (y3 - region_origin_y) * (y3 - region_origin_y);
211 float dot_bs3_13 = ((
x1 - x3) * (region_origin_x - x3) + (
y1 - y3) * (region_origin_y - y3));
212 float proj_bs3_on_13_squared = dot_bs3_13 * dot_bs3_13 / distance_13_squared;
214 float distance_13_beamspot_squared = distance_3_beamspot_squared - proj_bs3_on_13_squared;
216 return distance_13_beamspot_squared < (region_origin_radius + phiCut) * (region_origin_radius + phiCut);
222 float minRadius = hardPtCut * 87.f;
224 auto det = (
x1 -
x2) * (
y2 - y3) - (
x2 - x3) * (
y1 -
y2);
230 auto cd = (
offset - x3 * x3 - y3 * y3) * 0.5
f;
232 auto idet = 1.f / det;
234 auto x_center = (bc * (
y2 - y3) -
cd * (
y1 -
y2)) * idet;
235 auto y_center = (
cd * (
x1 -
x2) - bc * (
x2 - x3)) * idet;
242 auto centers_distance_squared = (x_center - region_origin_x) * (x_center - region_origin_x) +
243 (y_center - region_origin_y) * (y_center - region_origin_y);
244 auto region_origin_radius_plus_tolerance = region_origin_radius + phiCut;
245 auto minimumOfIntersectionRange =
246 (
radius - region_origin_radius_plus_tolerance) * (
radius - region_origin_radius_plus_tolerance);
248 if (centers_distance_squared >= minimumOfIntersectionRange) {
249 auto maximumOfIntersectionRange =
250 (
radius + region_origin_radius_plus_tolerance) * (
radius + region_origin_radius_plus_tolerance);
251 return centers_distance_squared <= maximumOfIntersectionRange;
261 std::vector<CAntuplet>& foundNtuplets,
263 const unsigned int minHitsPerNtuplet)
const {
269 if (tmpNtuplet.size() == minHitsPerNtuplet - 1) {
270 foundNtuplets.push_back(tmpNtuplet);
273 for (
unsigned int i = 0;
i < numberOfOuterNeighbors; ++
i) {
275 allCells[
theOuterNeighbors[
i]].findNtuplets(allCells, foundNtuplets, tmpNtuplet, minHitsPerNtuplet);
276 tmpNtuplet.pop_back();
291 #endif // RecoPixelVertexing_PixelTriplets_src_CACell_h