1 #ifndef RecoPixelVertexing_PixelTriplets_src_CACell_h 2 #define RecoPixelVertexing_PixelTriplets_src_CACell_h 35 : theDoublets(doublets),
36 theDoubletId(doubletId),
65 allStatus[
me].hasSameStateNeighbors = 0;
66 auto mystate = allStatus[
me].theCAState;
68 for (
auto oc : theOuterNeighbors) {
70 allStatus[
me].hasSameStateNeighbors = 1;
80 const float region_origin_x,
81 const float region_origin_y,
82 const float region_origin_radius,
85 const float hardPtCut,
86 std::vector<CACell::CAntuplet>* foundTriplets) {
87 int ncells = innerCells.size();
92 auto ro = getOuterR();
93 auto zo = getOuterZ();
94 unsigned int cellId =
this - &allCells.front();
95 auto loop = [&](
int i,
int vs) {
96 for (
int j = 0;
j < vs; ++
j) {
97 auto koc = innerCells[i +
j];
98 auto& oc = allCells[koc];
99 r1[
j] = oc.getInnerR();
100 z1[
j] = oc.getInnerZ();
103 for (
int j = 0;
j < vs; ++
j)
104 ok[
j] = areAlignedRZ(r1[
j], z1[j], ro, zo, ptmin, thetaCut);
105 for (
int j = 0; j < vs; ++
j) {
106 auto koc = innerCells[i +
j];
107 auto& oc = allCells[koc];
108 if (ok[j] && haveSimilarCurvature(
109 oc, ptmin, region_origin_x, region_origin_y, region_origin_radius, phiCut, hardPtCut)) {
113 oc.tagAsOuterNeighbor(cellId);
118 auto lim = VSIZE * (ncells / VSIZE);
119 for (
int i = 0; i < lim; i += VSIZE)
121 loop(lim, ncells - lim);
127 const float region_origin_x,
128 const float region_origin_y,
129 const float region_origin_radius,
130 const float thetaCut,
132 const float hardPtCut) {
133 checkAlignmentAndAct(allCells,
138 region_origin_radius,
146 std::vector<CACell::CAntuplet>& foundTriplets,
148 const float region_origin_x,
149 const float region_origin_y,
150 const float region_origin_radius,
151 const float thetaCut,
153 const float hardPtCut) {
154 checkAlignmentAndAct(allCells,
159 region_origin_radius,
167 float radius_diff =
std::abs(r1 - ro);
168 float distance_13_squared = radius_diff * radius_diff + (z1 - zo) * (z1 - zo);
172 float tan_12_13_half_mul_distance_13_squared =
173 fabs(z1 * (getInnerR() - ro) + getInnerZ() * (ro - r1) + zo * (r1 - getInnerR()));
174 return tan_12_13_half_mul_distance_13_squared * pMin <= thetaCut * distance_13_squared * radius_diff;
181 const float region_origin_x,
182 const float region_origin_y,
183 const float region_origin_radius,
185 const float hardPtCut)
const {
189 auto x2 = getInnerX();
190 auto y2 = getInnerY();
192 auto x3 = getOuterX();
193 auto y3 = getOuterY();
195 float distance_13_squared = (
x1 - x3) * (
x1 - x3) + (
y1 - y3) * (
y1 - y3);
196 float tan_12_13_half_mul_distance_13_squared =
std::abs(
y1 * (
x2 - x3) +
y2 * (x3 -
x1) + y3 * (
x1 -
x2));
198 if (tan_12_13_half_mul_distance_13_squared * ptmin <= 1.0
e-4
f * distance_13_squared) {
199 float distance_3_beamspot_squared =
200 (x3 - region_origin_x) * (x3 - region_origin_x) + (y3 - region_origin_y) * (y3 - region_origin_y);
202 float dot_bs3_13 = ((
x1 - x3) * (region_origin_x - x3) + (
y1 - y3) * (region_origin_y - y3));
203 float proj_bs3_on_13_squared = dot_bs3_13 * dot_bs3_13 / distance_13_squared;
205 float distance_13_beamspot_squared = distance_3_beamspot_squared - proj_bs3_on_13_squared;
207 return distance_13_beamspot_squared < (region_origin_radius + phiCut) * (region_origin_radius + phiCut);
213 float minRadius = hardPtCut * 87.f;
215 auto det = (
x1 -
x2) * (
y2 - y3) - (
x2 - x3) * (
y1 -
y2);
221 auto cd = (
offset - x3 * x3 - y3 * y3) * 0.5
f;
223 auto idet = 1.f / det;
225 auto x_center = (bc * (y2 - y3) -
cd * (
y1 - y2)) * idet;
226 auto y_center = (
cd * (
x1 -
x2) - bc * (
x2 - x3)) * idet;
228 auto radius =
std::sqrt((
x2 - x_center) * (
x2 - x_center) + (y2 - y_center) * (y2 - y_center));
233 auto centers_distance_squared = (x_center - region_origin_x) * (x_center - region_origin_x) +
234 (y_center - region_origin_y) * (y_center - region_origin_y);
235 auto region_origin_radius_plus_tolerance = region_origin_radius + phiCut;
236 auto minimumOfIntersectionRange =
237 (
radius - region_origin_radius_plus_tolerance) * (
radius - region_origin_radius_plus_tolerance);
239 if (centers_distance_squared >= minimumOfIntersectionRange) {
240 auto maximumOfIntersectionRange =
241 (
radius + region_origin_radius_plus_tolerance) * (
radius + region_origin_radius_plus_tolerance);
242 return centers_distance_squared <= maximumOfIntersectionRange;
252 std::vector<CAntuplet>& foundNtuplets,
254 const unsigned int minHitsPerNtuplet)
const {
260 if (tmpNtuplet.size() == minHitsPerNtuplet - 1) {
261 foundNtuplets.push_back(tmpNtuplet);
263 unsigned int numberOfOuterNeighbors = theOuterNeighbors.size();
264 for (
unsigned int i = 0;
i < numberOfOuterNeighbors; ++
i) {
265 tmpNtuplet.push_back((theOuterNeighbors[
i]));
266 allCells[theOuterNeighbors[
i]].findNtuplets(allCells, foundNtuplets, tmpNtuplet, minHitsPerNtuplet);
267 tmpNtuplet.pop_back();
282 #endif // RecoPixelVertexing_PixelTriplets_src_CACell_h
const HitDoublets * theDoublets
bool haveSimilarCurvature(const CACell &otherCell, const float ptmin, const float region_origin_x, const float region_origin_y, const float region_origin_radius, const float phiCut, const float hardPtCut) const
std::vector< CACellStatus > CAStatusColl
int areAlignedRZ(float r1, float z1, float ro, float zo, const float ptmin, const float thetaCut) const
float getOuterPhi() const
unsigned char getCAState() const
Hit const & getInnerHit() const
std::vector< unsigned int > CAntuple
bool isRootCell(const unsigned int minimumCAState) const
void tagAsOuterNeighbor(unsigned int otherCell)
void evolve(unsigned int me, CAStatusColl &allStatus)
Abs< T >::type abs(const T &t)
std::vector< CACell > CAColl
void checkAlignmentAndAct(CAColl &allCells, CAntuple &innerCells, const float ptmin, const float region_origin_x, const float region_origin_y, const float region_origin_radius, const float thetaCut, const float phiCut, const float hardPtCut, std::vector< CACell::CAntuplet > *foundTriplets)
float getInnerPhi() const
Hit const & getOuterHit() const
BaseTrackerRecHit const * Hit
void checkAlignmentAndPushTriplet(CAColl &allCells, CAntuple &innerCells, std::vector< CACell::CAntuplet > &foundTriplets, const float ptmin, const float region_origin_x, const float region_origin_y, const float region_origin_radius, const float thetaCut, const float phiCut, const float hardPtCut)
std::vector< unsigned int > CAntuplet
CACell(const HitDoublets *doublets, int doubletId, const int innerHitId, const int outerHitId)
CAntuple theOuterNeighbors
void findNtuplets(CAColl &allCells, std::vector< CAntuplet > &foundNtuplets, CAntuplet &tmpNtuplet, const unsigned int minHitsPerNtuplet) const
unsigned char hasSameStateNeighbors
void checkAlignmentAndTag(CAColl &allCells, CAntuple &innerCells, const float ptmin, const float region_origin_x, const float region_origin_y, const float region_origin_radius, const float thetaCut, const float phiCut, const float hardPtCut)