1 #ifndef RecoPixelVertexing_PixelTriplets_src_CACell_h 2 #define RecoPixelVertexing_PixelTriplets_src_CACell_h 25 bool isRootCell(
const unsigned int minimumCAState)
const {
45 theDoublets(doublets), theDoubletId(doubletId)
103 allStatus[me].hasSameStateNeighbors = 0;
104 auto mystate = allStatus[me].theCAState;
106 for (
auto oc : theOuterNeighbors ) {
110 allStatus[me].hasSameStateNeighbors = 1;
120 const float region_origin_y,
const float region_origin_radius,
const float thetaCut,
121 const float phiCut,
const float hardPtCut, std::vector<CACell::CAntuplet> * foundTriplets) {
122 int ncells = innerCells.size();
127 auto ro = getOuterR();
128 auto zo = getOuterZ();
129 unsigned int cellId =
this - &allCells.front();
130 auto loop = [&](
int i,
int vs) {
131 for (
int j=0;j<vs; ++j) {
132 auto koc = innerCells[i+j];
133 auto & oc = allCells[koc];
134 r1[j] = oc.getInnerR();
135 z1[j] = oc.getInnerZ();
138 for (
int j=0;j<vs; ++j) ok[j] = areAlignedRZ(r1[j], z1[j], ro, zo, ptmin, thetaCut);
139 for (
int j=0;j<vs; ++j) {
140 auto koc = innerCells[i+j];
141 auto & oc = allCells[koc];
142 if (ok[j]&&haveSimilarCurvature(oc,ptmin, region_origin_x, region_origin_y,
143 region_origin_radius, phiCut, hardPtCut)) {
146 oc.tagAsOuterNeighbor(cellId);
151 auto lim = VSIZE*(ncells/VSIZE);
152 for (
int i=0; i<lim; i+=VSIZE)
loop(i, VSIZE);
153 loop(lim, ncells-lim);
158 const float region_origin_y,
const float region_origin_radius,
const float thetaCut,
159 const float phiCut,
const float hardPtCut) {
160 checkAlignmentAndAct(allCells, innerCells, ptmin, region_origin_x, region_origin_y, region_origin_radius, thetaCut,
161 phiCut, hardPtCut,
nullptr);
165 const float ptmin,
const float region_origin_x,
const float region_origin_y,
166 const float region_origin_radius,
const float thetaCut,
const float phiCut,
167 const float hardPtCut) {
168 checkAlignmentAndAct(allCells, innerCells, ptmin, region_origin_x, region_origin_y, region_origin_radius, thetaCut,
169 phiCut, hardPtCut, &foundTriplets);
175 float radius_diff =
std::abs(r1 - ro);
176 float distance_13_squared = radius_diff*radius_diff + (z1 - zo)*(z1 - zo);
180 float tan_12_13_half_mul_distance_13_squared = fabs(z1 * (getInnerR() - ro) + getInnerZ() * (ro - r1) + zo * (r1 - getInnerR())) ;
181 return tan_12_13_half_mul_distance_13_squared * pMin <= thetaCut * distance_13_squared * radius_diff;
187 theOuterNeighbors.push_back(otherCell);
192 const float region_origin_x,
const float region_origin_y,
const float region_origin_radius,
const float phiCut,
const float hardPtCut)
const 199 auto x2 = getInnerX();
200 auto y2 = getInnerY();
202 auto x3 = getOuterX();
203 auto y3 = getOuterY();
205 float distance_13_squared = (
x1 - x3)*(
x1 - x3) + (y1 - y3)*(y1 - y3);
206 float tan_12_13_half_mul_distance_13_squared =
std::abs(y1 * (
x2 - x3) + y2 * (x3 -
x1) + y3 * (
x1 -
x2)) ;
208 if(tan_12_13_half_mul_distance_13_squared * ptmin <= 1.0
e-4
f*distance_13_squared)
211 float distance_3_beamspot_squared = (x3-region_origin_x) * (x3-region_origin_x) + (y3-region_origin_y) * (y3-region_origin_y);
213 float dot_bs3_13 = ((
x1 - x3)*( region_origin_x - x3) + (y1 - y3) * (region_origin_y-y3));
214 float proj_bs3_on_13_squared = dot_bs3_13*dot_bs3_13/distance_13_squared;
216 float distance_13_beamspot_squared = distance_3_beamspot_squared - proj_bs3_on_13_squared;
218 return distance_13_beamspot_squared < (region_origin_radius+phiCut)*(region_origin_radius+phiCut);
224 float minRadius = hardPtCut*87.f;
226 auto det = (
x1 -
x2) * (y2 - y3) - (
x2 - x3) * (y1 - y2);
233 auto cd = (
offset - x3 * x3 - y3 * y3)*0.5
f;
237 auto idet = 1.f / det;
239 auto x_center = (bc * (y2 - y3) - cd * (y1 - y2)) * idet;
240 auto y_center = (cd * (
x1 -
x2) - bc * (
x2 - x3)) * idet;
242 auto radius =
std::sqrt((
x2 - x_center)*(
x2 - x_center) + (y2 - y_center)*(y2 - y_center));
244 if(
radius < minRadius)
return false;
246 auto centers_distance_squared = (x_center - region_origin_x)*(x_center - region_origin_x) + (y_center - region_origin_y)*(y_center - region_origin_y);
247 auto region_origin_radius_plus_tolerance = region_origin_radius + phiCut;
248 auto minimumOfIntersectionRange = (
radius - region_origin_radius_plus_tolerance)*(
radius - region_origin_radius_plus_tolerance);
250 if (centers_distance_squared >= minimumOfIntersectionRange) {
251 auto maximumOfIntersectionRange = (
radius + region_origin_radius_plus_tolerance)*(
radius + region_origin_radius_plus_tolerance);
252 return centers_distance_squared <= maximumOfIntersectionRange;
270 if (tmpNtuplet.size() == minHitsPerNtuplet - 1)
272 foundNtuplets.push_back(tmpNtuplet);
276 unsigned int numberOfOuterNeighbors = theOuterNeighbors.size();
277 for (
unsigned int i = 0;
i < numberOfOuterNeighbors; ++
i) {
278 tmpNtuplet.push_back((theOuterNeighbors[
i]));
279 allCells[theOuterNeighbors[
i]].findNtuplets(allCells,foundNtuplets, tmpNtuplet, minHitsPerNtuplet);
280 tmpNtuplet.pop_back();
300 #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)