1 #ifndef RECOPIXELVERTEXING_PIXELTRIPLETS_CACELL_h 2 #define RECOPIXELVERTEXING_PIXELTRIPLETS_CACELL_h 26 bool isRootCell(
const unsigned int minimumCAState)
const {
46 theDoublets(doublets), theDoubletId(doubletId)
104 allStatus[me].hasSameStateNeighbors = 0;
105 auto mystate = allStatus[me].theCAState;
107 for (
auto oc : theOuterNeighbors ) {
111 allStatus[me].hasSameStateNeighbors = 1;
121 const float region_origin_y,
const float region_origin_radius,
const float thetaCut,
122 const float phiCut,
const float hardPtCut, std::vector<CACell::CAntuplet> * foundTriplets) {
123 int ncells = innerCells.size();
128 auto ro = getOuterR();
129 auto zo = getOuterZ();
130 unsigned int cellId =
this - &allCells.front();
131 auto loop = [&](
int i,
int vs) {
132 for (
int j=0;j<vs; ++j) {
133 auto koc = innerCells[i+j];
134 auto & oc = allCells[koc];
135 r1[j] = oc.getInnerR();
136 z1[j] = oc.getInnerZ();
139 for (
int j=0;j<vs; ++j) ok[j] = areAlignedRZ(r1[j], z1[j], ro, zo, ptmin, thetaCut);
140 for (
int j=0;j<vs; ++j) {
141 auto koc = innerCells[i+j];
142 auto & oc = allCells[koc];
143 if (ok[j]&&haveSimilarCurvature(oc,ptmin, region_origin_x, region_origin_y,
144 region_origin_radius, phiCut, hardPtCut)) {
147 oc.tagAsOuterNeighbor(cellId);
152 auto lim = VSIZE*(ncells/VSIZE);
153 for (
int i=0; i<lim; i+=VSIZE)
loop(i, VSIZE);
154 loop(lim, ncells-lim);
159 const float region_origin_y,
const float region_origin_radius,
const float thetaCut,
160 const float phiCut,
const float hardPtCut) {
161 checkAlignmentAndAct(allCells, innerCells, ptmin, region_origin_x, region_origin_y, region_origin_radius, thetaCut,
162 phiCut, hardPtCut,
nullptr);
166 const float ptmin,
const float region_origin_x,
const float region_origin_y,
167 const float region_origin_radius,
const float thetaCut,
const float phiCut,
168 const float hardPtCut) {
169 checkAlignmentAndAct(allCells, innerCells, ptmin, region_origin_x, region_origin_y, region_origin_radius, thetaCut,
170 phiCut, hardPtCut, &foundTriplets);
176 float radius_diff =
std::abs(r1 - ro);
177 float distance_13_squared = radius_diff*radius_diff + (z1 - zo)*(z1 - zo);
181 float tan_12_13_half_mul_distance_13_squared = fabs(z1 * (getInnerR() - ro) + getInnerZ() * (ro - r1) + zo * (r1 - getInnerR())) ;
182 return tan_12_13_half_mul_distance_13_squared * pMin <= thetaCut * distance_13_squared * radius_diff;
188 theOuterNeighbors.push_back(otherCell);
193 const float region_origin_x,
const float region_origin_y,
const float region_origin_radius,
const float phiCut,
const float hardPtCut)
const 200 auto x2 = getInnerX();
201 auto y2 = getInnerY();
203 auto x3 = getOuterX();
204 auto y3 = getOuterY();
206 float distance_13_squared = (x1 - x3)*(x1 - x3) + (y1 - y3)*(y1 - y3);
207 float tan_12_13_half_mul_distance_13_squared =
std::abs(y1 * (x2 - x3) + y2 * (x3 - x1) + y3 * (x1 - x2)) ;
209 if(tan_12_13_half_mul_distance_13_squared * ptmin <= 1.0
e-4
f*distance_13_squared)
212 float distance_3_beamspot_squared = (x3-region_origin_x) * (x3-region_origin_x) + (y3-region_origin_y) * (y3-region_origin_y);
214 float dot_bs3_13 = ((x1 - x3)*( region_origin_x - x3) + (y1 - y3) * (region_origin_y-y3));
215 float proj_bs3_on_13_squared = dot_bs3_13*dot_bs3_13/distance_13_squared;
217 float distance_13_beamspot_squared = distance_3_beamspot_squared - proj_bs3_on_13_squared;
219 return distance_13_beamspot_squared < (region_origin_radius+phiCut)*(region_origin_radius+phiCut);
225 float minRadius = hardPtCut*87.f;
227 auto det = (x1 - x2) * (y2 - y3) - (x2 - x3) * (y1 - y2);
230 auto offset = x2 * x2 + y2*y2;
232 auto bc = (x1 * x1 + y1 * y1 -
offset)*0.5
f;
234 auto cd = (
offset - x3 * x3 - y3 * y3)*0.5
f;
238 auto idet = 1.f / det;
240 auto x_center = (bc * (y2 - y3) - cd * (y1 - y2)) * idet;
241 auto y_center = (cd * (x1 - x2) - bc * (x2 - x3)) * idet;
243 auto radius =
std::sqrt((x2 - x_center)*(x2 - x_center) + (y2 - y_center)*(y2 - y_center));
245 if(
radius < minRadius)
return false;
247 auto centers_distance_squared = (x_center - region_origin_x)*(x_center - region_origin_x) + (y_center - region_origin_y)*(y_center - region_origin_y);
248 auto region_origin_radius_plus_tolerance = region_origin_radius + phiCut;
249 auto minimumOfIntersectionRange = (
radius - region_origin_radius_plus_tolerance)*(
radius - region_origin_radius_plus_tolerance);
251 if (centers_distance_squared >= minimumOfIntersectionRange) {
252 auto maximumOfIntersectionRange = (
radius + region_origin_radius_plus_tolerance)*(
radius + region_origin_radius_plus_tolerance);
253 return centers_distance_squared <= maximumOfIntersectionRange;
271 if (tmpNtuplet.size() == minHitsPerNtuplet - 1)
273 foundNtuplets.push_back(tmpNtuplet);
277 unsigned int numberOfOuterNeighbors = theOuterNeighbors.size();
278 for (
unsigned int i = 0;
i < numberOfOuterNeighbors; ++
i) {
279 tmpNtuplet.push_back((theOuterNeighbors[
i]));
280 allCells[theOuterNeighbors[
i]].findNtuplets(allCells,foundNtuplets, tmpNtuplet, minHitsPerNtuplet);
281 tmpNtuplet.pop_back();
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)