CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
CACell Class Reference

#include <CACell.h>

Public Types

using CAColl = std::vector< CACell >
 
using CAntuple = std::vector< unsigned int >
 
using CAntuplet = std::vector< unsigned int >
 
using CAStatusColl = std::vector< CACellStatus >
 
using Hit = RecHitsSortedInPhi::Hit
 

Public Member Functions

int areAlignedRZ (float r1, float z1, float ro, float zo, const float ptmin, const float thetaCut) const
 
 CACell (const HitDoublets *doublets, int doubletId, const int innerHitId, const int outerHitId)
 
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 CACut::CAValuesByInnerLayerIds &thetaCutByInnerLayer, const CACut::CAValuesByInnerLayerIds &phiCutByInnerLayer, const float hardPtCut, std::vector< CACell::CAntuplet > *foundTriplets)
 
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 CACut::CAValuesByInnerLayerIds &thetaCutByInnerLayer, const CACut::CAValuesByInnerLayerIds &phiCutByInnerLayer, const float hardPtCut)
 
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 CACut::CAValuesByInnerLayerIds &thetaCutByInnerLayer, const CACut::CAValuesByInnerLayerIds &phiCutByInnerLayer, const float hardPtCut)
 
void evolve (unsigned int me, CAStatusColl &allStatus)
 
void findNtuplets (CAColl &allCells, std::vector< CAntuplet > &foundNtuplets, CAntuplet &tmpNtuplet, const unsigned int minHitsPerNtuplet) const
 
Hit const & getInnerHit () const
 
int getInnerLayer () const
 
float getInnerPhi () const
 
float getInnerR () const
 
float getInnerX () const
 
float getInnerY () const
 
float getInnerZ () const
 
Hit const & getOuterHit () const
 
int getOuterLayer () const
 
float getOuterPhi () const
 
float getOuterR () const
 
float getOuterX () const
 
float getOuterY () const
 
float getOuterZ () const
 
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
 
void tagAsOuterNeighbor (unsigned int otherCell)
 

Private Attributes

const int theDoubletId
 
const HitDoubletstheDoublets
 
const float theInnerR
 
const float theInnerZ
 
CAntuple theOuterNeighbors
 

Detailed Description

Definition at line 27 of file CACell.h.

Member Typedef Documentation

◆ CAColl

using CACell::CAColl = std::vector<CACell>

Definition at line 32 of file CACell.h.

◆ CAntuple

using CACell::CAntuple = std::vector<unsigned int>

Definition at line 30 of file CACell.h.

◆ CAntuplet

using CACell::CAntuplet = std::vector<unsigned int>

Definition at line 31 of file CACell.h.

◆ CAStatusColl

using CACell::CAStatusColl = std::vector<CACellStatus>

Definition at line 33 of file CACell.h.

◆ Hit

Definition at line 29 of file CACell.h.

Constructor & Destructor Documentation

◆ CACell()

CACell::CACell ( const HitDoublets doublets,
int  doubletId,
const int  innerHitId,
const int  outerHitId 
)
inline

Definition at line 35 of file CACell.h.

37  theDoubletId(doubletId),
38  theInnerR(doublets->rv(doubletId, HitDoublets::inner)),
39  theInnerZ(doublets->z(doubletId, HitDoublets::inner)) {}
const float theInnerZ
Definition: CACell.h:288
const HitDoublets * theDoublets
Definition: CACell.h:284
const int theDoubletId
Definition: CACell.h:285
const float theInnerR
Definition: CACell.h:287

Member Function Documentation

◆ areAlignedRZ()

int CACell::areAlignedRZ ( float  r1,
float  z1,
float  ro,
float  zo,
const float  ptmin,
const float  thetaCut 
) const
inline

Definition at line 175 of file CACell.h.

References funct::abs(), getInnerR(), getInnerZ(), ALCARECOTkAlMinBias_cff::pMin, ptmin, diffTwoXMLs::r1, and mathSSE::sqrt().

Referenced by checkAlignmentAndAct().

175  {
176  float radius_diff = std::abs(r1 - ro);
177  float distance_13_squared = radius_diff * radius_diff + (z1 - zo) * (z1 - zo);
178 
179  float pMin = ptmin * std::sqrt(distance_13_squared); //this needs to be divided by radius_diff later
180 
181  float tan_12_13_half_mul_distance_13_squared =
182  fabs(z1 * (getInnerR() - ro) + getInnerZ() * (ro - r1) + zo * (r1 - getInnerR()));
183  return tan_12_13_half_mul_distance_13_squared * pMin <= thetaCut * distance_13_squared * radius_diff;
184  }
float getInnerR() const
Definition: CACell.h:61
float getInnerZ() const
Definition: CACell.h:57
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double ptmin
Definition: HydjetWrapper.h:86

◆ checkAlignmentAndAct()

void CACell::checkAlignmentAndAct ( CAColl allCells,
CAntuple innerCells,
const float  ptmin,
const float  region_origin_x,
const float  region_origin_y,
const float  region_origin_radius,
const CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer,
const CACut::CAValuesByInnerLayerIds phiCutByInnerLayer,
const float  hardPtCut,
std::vector< CACell::CAntuplet > *  foundTriplets 
)
inline

Definition at line 82 of file CACell.h.

References areAlignedRZ(), CACut::CAValuesByInnerLayerIds::at(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), getOuterR(), getOuterZ(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::hardPtCut, haveSimilarCurvature(), mps_fire::i, dqmiolumiharvest::j, heppy_loop::loop, convertSQLiteXML::ok, ptmin, and diffTwoXMLs::r1.

Referenced by checkAlignmentAndPushTriplet(), and checkAlignmentAndTag().

91  {
92  int ncells = innerCells.size();
93  int constexpr VSIZE = 16;
94  int ok[VSIZE];
95  float r1[VSIZE];
96  float z1[VSIZE];
97  float thetaCut[VSIZE];
98  float phiCut[VSIZE];
99  auto ro = getOuterR();
100  auto zo = getOuterZ();
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());
110  }
111  // this vectorize!
112  for (int j = 0; j < vs; ++j)
113  ok[j] = areAlignedRZ(r1[j], z1[j], ro, zo, ptmin, thetaCut[j]);
114  for (int j = 0; j < vs; ++j) {
115  auto koc = innerCells[i + j];
116  auto& oc = allCells[koc];
117  if (ok[j] && haveSimilarCurvature(
118  oc, ptmin, region_origin_x, region_origin_y, region_origin_radius, phiCut[j], hardPtCut)) {
119  if (foundTriplets)
120  foundTriplets->emplace_back(CACell::CAntuplet{koc, cellId});
121  else {
122  oc.tagAsOuterNeighbor(cellId);
123  }
124  }
125  }
126  };
127  auto lim = VSIZE * (ncells / VSIZE);
128  for (int i = 0; i < lim; i += VSIZE)
129  loop(i, VSIZE);
130  loop(lim, ncells - lim);
131  }
int areAlignedRZ(float r1, float z1, float ro, float zo, const float ptmin, const float thetaCut) const
Definition: CACell.h:175
float getOuterR() const
Definition: CACell.h:63
std::vector< unsigned int > CAntuplet
Definition: CACell.h:31
double ptmin
Definition: HydjetWrapper.h:86
float getOuterZ() const
Definition: CACell.h:59
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
Definition: CACell.h:188
float at(int layerId) const
Definition: CACut.h:122

◆ checkAlignmentAndPushTriplet()

void CACell::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 CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer,
const CACut::CAValuesByInnerLayerIds phiCutByInnerLayer,
const float  hardPtCut 
)
inline

Definition at line 153 of file CACell.h.

References checkAlignmentAndAct(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::hardPtCut, and ptmin.

162  {
163  checkAlignmentAndAct(allCells,
164  innerCells,
165  ptmin,
166  region_origin_x,
167  region_origin_y,
168  region_origin_radius,
169  thetaCutByInnerLayer,
170  phiCutByInnerLayer,
171  hardPtCut,
172  &foundTriplets);
173  }
double ptmin
Definition: HydjetWrapper.h:86
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 CACut::CAValuesByInnerLayerIds &thetaCutByInnerLayer, const CACut::CAValuesByInnerLayerIds &phiCutByInnerLayer, const float hardPtCut, std::vector< CACell::CAntuplet > *foundTriplets)
Definition: CACell.h:82

◆ checkAlignmentAndTag()

void CACell::checkAlignmentAndTag ( CAColl allCells,
CAntuple innerCells,
const float  ptmin,
const float  region_origin_x,
const float  region_origin_y,
const float  region_origin_radius,
const CACut::CAValuesByInnerLayerIds thetaCutByInnerLayer,
const CACut::CAValuesByInnerLayerIds phiCutByInnerLayer,
const float  hardPtCut 
)
inline

Definition at line 133 of file CACell.h.

References checkAlignmentAndAct(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::hardPtCut, and ptmin.

141  {
142  checkAlignmentAndAct(allCells,
143  innerCells,
144  ptmin,
145  region_origin_x,
146  region_origin_y,
147  region_origin_radius,
148  thetaCutByInnerLayer,
149  phiCutByInnerLayer,
150  hardPtCut,
151  nullptr);
152  }
double ptmin
Definition: HydjetWrapper.h:86
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 CACut::CAValuesByInnerLayerIds &thetaCutByInnerLayer, const CACut::CAValuesByInnerLayerIds &phiCutByInnerLayer, const float hardPtCut, std::vector< CACell::CAntuplet > *foundTriplets)
Definition: CACell.h:82

◆ evolve()

void CACell::evolve ( unsigned int  me,
CAStatusColl allStatus 
)
inline

Definition at line 69 of file CACell.h.

References hlt_dqm_clientPB-live_cfg::me, and theOuterNeighbors.

69  {
70  allStatus[me].hasSameStateNeighbors = 0;
71  auto mystate = allStatus[me].theCAState;
72 
73  for (auto oc : theOuterNeighbors) {
74  if (allStatus[oc].getCAState() == mystate) {
75  allStatus[me].hasSameStateNeighbors = 1;
76 
77  break;
78  }
79  }
80  }
CAntuple theOuterNeighbors
Definition: CACell.h:282

◆ findNtuplets()

void CACell::findNtuplets ( CAColl allCells,
std::vector< CAntuplet > &  foundNtuplets,
CAntuplet tmpNtuplet,
const unsigned int  minHitsPerNtuplet 
) const
inline

Definition at line 260 of file CACell.h.

References caHitNtupletGeneratorKernels::foundNtuplets, mps_fire::i, HLT_2024v11_cff::minHitsPerNtuplet, and theOuterNeighbors.

263  {
264  // the building process for a track ends if:
265  // it has no outer neighbor
266  // it has no compatible neighbor
267  // the ntuplets is then saved if the number of hits it contains is greater than a threshold
268 
269  if (tmpNtuplet.size() == minHitsPerNtuplet - 1) {
270  foundNtuplets.push_back(tmpNtuplet);
271  } else {
272  unsigned int numberOfOuterNeighbors = theOuterNeighbors.size();
273  for (unsigned int i = 0; i < numberOfOuterNeighbors; ++i) {
274  tmpNtuplet.push_back((theOuterNeighbors[i]));
275  allCells[theOuterNeighbors[i]].findNtuplets(allCells, foundNtuplets, tmpNtuplet, minHitsPerNtuplet);
276  tmpNtuplet.pop_back();
277  }
278  }
279  }
CAntuple theOuterNeighbors
Definition: CACell.h:282

◆ getInnerHit()

Hit const& CACell::getInnerHit ( ) const
inline

Definition at line 41 of file CACell.h.

References HitDoublets::hit(), HitDoublets::inner, theDoubletId, and theDoublets.

const HitDoublets * theDoublets
Definition: CACell.h:284
Hit const & hit(int i, layer l) const
const int theDoubletId
Definition: CACell.h:285

◆ getInnerLayer()

int CACell::getInnerLayer ( ) const
inline

Definition at line 45 of file CACell.h.

References HitDoublets::detLayer(), HitDoublets::inner, DetLayer::seqNum(), and theDoublets.

const HitDoublets * theDoublets
Definition: CACell.h:284
int seqNum() const
Definition: DetLayer.h:35
DetLayer const * detLayer(layer l) const

◆ getInnerPhi()

float CACell::getInnerPhi ( ) const
inline

Definition at line 65 of file CACell.h.

References HitDoublets::inner, HitDoublets::phi(), theDoubletId, and theDoublets.

const HitDoublets * theDoublets
Definition: CACell.h:284
const int theDoubletId
Definition: CACell.h:285
float phi(int i, layer l) const

◆ getInnerR()

float CACell::getInnerR ( ) const
inline

Definition at line 61 of file CACell.h.

References theInnerR.

Referenced by areAlignedRZ().

61 { return theInnerR; }
const float theInnerR
Definition: CACell.h:287

◆ getInnerX()

float CACell::getInnerX ( ) const
inline

Definition at line 49 of file CACell.h.

References HitDoublets::inner, theDoubletId, theDoublets, and HitDoublets::x().

Referenced by haveSimilarCurvature().

const HitDoublets * theDoublets
Definition: CACell.h:284
float x(int i, layer l) const
const int theDoubletId
Definition: CACell.h:285

◆ getInnerY()

float CACell::getInnerY ( ) const
inline

Definition at line 53 of file CACell.h.

References HitDoublets::inner, theDoubletId, theDoublets, and HitDoublets::y().

Referenced by haveSimilarCurvature().

const HitDoublets * theDoublets
Definition: CACell.h:284
const int theDoubletId
Definition: CACell.h:285
float y(int i, layer l) const

◆ getInnerZ()

float CACell::getInnerZ ( ) const
inline

Definition at line 57 of file CACell.h.

References theInnerZ.

Referenced by areAlignedRZ().

57 { return theInnerZ; }
const float theInnerZ
Definition: CACell.h:288

◆ getOuterHit()

Hit const& CACell::getOuterHit ( ) const
inline

Definition at line 43 of file CACell.h.

References HitDoublets::hit(), HitDoublets::outer, theDoubletId, and theDoublets.

const HitDoublets * theDoublets
Definition: CACell.h:284
Hit const & hit(int i, layer l) const
const int theDoubletId
Definition: CACell.h:285

◆ getOuterLayer()

int CACell::getOuterLayer ( ) const
inline

Definition at line 47 of file CACell.h.

References HitDoublets::detLayer(), HitDoublets::outer, DetLayer::seqNum(), and theDoublets.

const HitDoublets * theDoublets
Definition: CACell.h:284
int seqNum() const
Definition: DetLayer.h:35
DetLayer const * detLayer(layer l) const

◆ getOuterPhi()

float CACell::getOuterPhi ( ) const
inline

Definition at line 67 of file CACell.h.

References HitDoublets::outer, HitDoublets::phi(), theDoubletId, and theDoublets.

const HitDoublets * theDoublets
Definition: CACell.h:284
const int theDoubletId
Definition: CACell.h:285
float phi(int i, layer l) const

◆ getOuterR()

float CACell::getOuterR ( ) const
inline

Definition at line 63 of file CACell.h.

References HitDoublets::outer, HitDoublets::rv(), theDoubletId, and theDoublets.

Referenced by checkAlignmentAndAct().

const HitDoublets * theDoublets
Definition: CACell.h:284
const int theDoubletId
Definition: CACell.h:285
float rv(int i, layer l) const

◆ getOuterX()

float CACell::getOuterX ( ) const
inline

Definition at line 51 of file CACell.h.

References HitDoublets::outer, theDoubletId, theDoublets, and HitDoublets::x().

Referenced by haveSimilarCurvature().

const HitDoublets * theDoublets
Definition: CACell.h:284
float x(int i, layer l) const
const int theDoubletId
Definition: CACell.h:285

◆ getOuterY()

float CACell::getOuterY ( ) const
inline

Definition at line 55 of file CACell.h.

References HitDoublets::outer, theDoubletId, theDoublets, and HitDoublets::y().

Referenced by haveSimilarCurvature().

const HitDoublets * theDoublets
Definition: CACell.h:284
const int theDoubletId
Definition: CACell.h:285
float y(int i, layer l) const

◆ getOuterZ()

float CACell::getOuterZ ( ) const
inline

Definition at line 59 of file CACell.h.

References HitDoublets::outer, theDoubletId, theDoublets, and HitDoublets::z().

Referenced by checkAlignmentAndAct().

const HitDoublets * theDoublets
Definition: CACell.h:284
const int theDoubletId
Definition: CACell.h:285
float z(int i, layer l) const

◆ haveSimilarCurvature()

bool CACell::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
inline

Definition at line 188 of file CACell.h.

References funct::abs(), hippyaddtobaddatafiles::cd(), MillePedeFileConverter_cfg::e, f, getInnerX(), getInnerY(), getOuterX(), getOuterY(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::hardPtCut, DisplacedRegionalStep_cff::minRadius, hltrates_dqm_sourceclient-live_cfg::offset, ptmin, CosmicsPD_Skims::radius, mathSSE::sqrt(), testProducerWithPsetDescEmpty_cfi::x1, testProducerWithPsetDescEmpty_cfi::x2, testProducerWithPsetDescEmpty_cfi::y1, and testProducerWithPsetDescEmpty_cfi::y2.

Referenced by checkAlignmentAndAct().

194  {
195  auto x1 = otherCell.getInnerX();
196  auto y1 = otherCell.getInnerY();
197 
198  auto x2 = getInnerX();
199  auto y2 = getInnerY();
200 
201  auto x3 = getOuterX();
202  auto y3 = getOuterY();
203 
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));
206  // high pt : just straight
207  if (tan_12_13_half_mul_distance_13_squared * ptmin <= 1.0e-4f * 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);
210 
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;
213 
214  float distance_13_beamspot_squared = distance_3_beamspot_squared - proj_bs3_on_13_squared;
215 
216  return distance_13_beamspot_squared < (region_origin_radius + phiCut) * (region_origin_radius + phiCut);
217  }
218 
219  //87 cm/GeV = 1/(3.8T * 0.3)
220 
221  //take less than radius given by the hardPtCut and reject everything below
222  float minRadius = hardPtCut * 87.f; // FIXME move out and use real MagField
223 
224  auto det = (x1 - x2) * (y2 - y3) - (x2 - x3) * (y1 - y2);
225 
226  auto offset = x2 * x2 + y2 * y2;
227 
228  auto bc = (x1 * x1 + y1 * y1 - offset) * 0.5f;
229 
230  auto cd = (offset - x3 * x3 - y3 * y3) * 0.5f;
231 
232  auto idet = 1.f / det;
233 
234  auto x_center = (bc * (y2 - y3) - cd * (y1 - y2)) * idet;
235  auto y_center = (cd * (x1 - x2) - bc * (x2 - x3)) * idet;
236 
237  auto radius = std::sqrt((x2 - x_center) * (x2 - x_center) + (y2 - y_center) * (y2 - y_center));
238 
239  if (radius < minRadius)
240  return false; // hard cut on pt
241 
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);
247 
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;
252  }
253 
254  return false;
255  }
float getInnerY() const
Definition: CACell.h:53
float getOuterX() const
Definition: CACell.h:51
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
float getInnerX() const
Definition: CACell.h:49
double ptmin
Definition: HydjetWrapper.h:86
float getOuterY() const
Definition: CACell.h:55

◆ tagAsOuterNeighbor()

void CACell::tagAsOuterNeighbor ( unsigned int  otherCell)
inline

Definition at line 186 of file CACell.h.

References theOuterNeighbors.

186 { theOuterNeighbors.push_back(otherCell); }
CAntuple theOuterNeighbors
Definition: CACell.h:282

Member Data Documentation

◆ theDoubletId

const int CACell::theDoubletId
private

◆ theDoublets

const HitDoublets* CACell::theDoublets
private

◆ theInnerR

const float CACell::theInnerR
private

Definition at line 287 of file CACell.h.

Referenced by getInnerR().

◆ theInnerZ

const float CACell::theInnerZ
private

Definition at line 288 of file CACell.h.

Referenced by getInnerZ().

◆ theOuterNeighbors

CAntuple CACell::theOuterNeighbors
private

Definition at line 282 of file CACell.h.

Referenced by evolve(), findNtuplets(), and tagAsOuterNeighbor().