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 float thetaCut, const float phiCut, 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 float thetaCut, const float phiCut, 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 float thetaCut, const float phiCut, 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
 
float getInnerPhi () const
 
float getInnerR () const
 
float getInnerX () const
 
float getInnerY () const
 
float getInnerZ () const
 
Hit const & getOuterHit () 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 26 of file CACell.h.

Member Typedef Documentation

◆ CAColl

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

Definition at line 31 of file CACell.h.

◆ CAntuple

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

Definition at line 29 of file CACell.h.

◆ CAntuplet

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

Definition at line 30 of file CACell.h.

◆ CAStatusColl

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

Definition at line 32 of file CACell.h.

◆ Hit

Definition at line 28 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 34 of file CACell.h.

36  theDoubletId(doubletId),
37  theInnerR(doublets->rv(doubletId, HitDoublets::inner)),
38  theInnerZ(doublets->z(doubletId, HitDoublets::inner)) {}

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 166 of file CACell.h.

166  {
167  float radius_diff = std::abs(r1 - ro);
168  float distance_13_squared = radius_diff * radius_diff + (z1 - zo) * (z1 - zo);
169 
170  float pMin = ptmin * std::sqrt(distance_13_squared); //this needs to be divided by radius_diff later
171 
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;
175  }

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

Referenced by checkAlignmentAndAct().

◆ 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 float  thetaCut,
const float  phiCut,
const float  hardPtCut,
std::vector< CACell::CAntuplet > *  foundTriplets 
)
inline

Definition at line 77 of file CACell.h.

86  {
87  int ncells = innerCells.size();
88  int constexpr VSIZE = 16;
89  int ok[VSIZE];
90  float r1[VSIZE];
91  float z1[VSIZE];
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();
101  }
102  // this vectorize!
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)) {
110  if (foundTriplets)
111  foundTriplets->emplace_back(CACell::CAntuplet{koc, cellId});
112  else {
113  oc.tagAsOuterNeighbor(cellId);
114  }
115  }
116  }
117  };
118  auto lim = VSIZE * (ncells / VSIZE);
119  for (int i = 0; i < lim; i += VSIZE)
120  loop(i, VSIZE);
121  loop(lim, ncells - lim);
122  }

References areAlignedRZ(), getOuterR(), getOuterZ(), haveSimilarCurvature(), mps_fire::i, dqmiolumiharvest::j, heppy_loop::loop, convertSQLiteXML::ok, ptmin, and diffTwoXMLs::r1.

Referenced by checkAlignmentAndPushTriplet(), and checkAlignmentAndTag().

◆ 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 float  thetaCut,
const float  phiCut,
const float  hardPtCut 
)
inline

Definition at line 144 of file CACell.h.

153  {
154  checkAlignmentAndAct(allCells,
155  innerCells,
156  ptmin,
157  region_origin_x,
158  region_origin_y,
159  region_origin_radius,
160  thetaCut,
161  phiCut,
162  hardPtCut,
163  &foundTriplets);
164  }

References checkAlignmentAndAct(), and ptmin.

◆ 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 float  thetaCut,
const float  phiCut,
const float  hardPtCut 
)
inline

Definition at line 124 of file CACell.h.

132  {
133  checkAlignmentAndAct(allCells,
134  innerCells,
135  ptmin,
136  region_origin_x,
137  region_origin_y,
138  region_origin_radius,
139  thetaCut,
140  phiCut,
141  hardPtCut,
142  nullptr);
143  }

References checkAlignmentAndAct(), and ptmin.

◆ evolve()

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

Definition at line 64 of file CACell.h.

64  {
65  allStatus[me].hasSameStateNeighbors = 0;
66  auto mystate = allStatus[me].theCAState;
67 
68  for (auto oc : theOuterNeighbors) {
69  if (allStatus[oc].getCAState() == mystate) {
70  allStatus[me].hasSameStateNeighbors = 1;
71 
72  break;
73  }
74  }
75  }

References hlt_dqm_clientPB-live_cfg::me, and theOuterNeighbors.

◆ findNtuplets()

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

Definition at line 251 of file CACell.h.

254  {
255  // the building process for a track ends if:
256  // it has no outer neighbor
257  // it has no compatible neighbor
258  // the ntuplets is then saved if the number of hits it contains is greater than a threshold
259 
260  if (tmpNtuplet.size() == minHitsPerNtuplet - 1) {
261  foundNtuplets.push_back(tmpNtuplet);
262  } else {
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();
268  }
269  }
270  }

References mps_fire::i, and theOuterNeighbors.

◆ getInnerHit()

Hit const& CACell::getInnerHit ( ) const
inline

Definition at line 40 of file CACell.h.

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

◆ getInnerPhi()

float CACell::getInnerPhi ( ) const
inline

Definition at line 60 of file CACell.h.

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

◆ getInnerR()

float CACell::getInnerR ( ) const
inline

Definition at line 56 of file CACell.h.

56 { return theInnerR; }

References theInnerR.

Referenced by areAlignedRZ().

◆ getInnerX()

float CACell::getInnerX ( ) const
inline

Definition at line 44 of file CACell.h.

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

Referenced by haveSimilarCurvature().

◆ getInnerY()

float CACell::getInnerY ( ) const
inline

Definition at line 48 of file CACell.h.

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

Referenced by haveSimilarCurvature().

◆ getInnerZ()

float CACell::getInnerZ ( ) const
inline

Definition at line 52 of file CACell.h.

52 { return theInnerZ; }

References theInnerZ.

Referenced by areAlignedRZ().

◆ getOuterHit()

Hit const& CACell::getOuterHit ( ) const
inline

Definition at line 42 of file CACell.h.

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

◆ getOuterPhi()

float CACell::getOuterPhi ( ) const
inline

Definition at line 62 of file CACell.h.

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

◆ getOuterR()

float CACell::getOuterR ( ) const
inline

Definition at line 58 of file CACell.h.

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

Referenced by checkAlignmentAndAct().

◆ getOuterX()

float CACell::getOuterX ( ) const
inline

Definition at line 46 of file CACell.h.

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

Referenced by haveSimilarCurvature().

◆ getOuterY()

float CACell::getOuterY ( ) const
inline

Definition at line 50 of file CACell.h.

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

Referenced by haveSimilarCurvature().

◆ getOuterZ()

float CACell::getOuterZ ( ) const
inline

Definition at line 54 of file CACell.h.

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

Referenced by checkAlignmentAndAct().

◆ 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 179 of file CACell.h.

185  {
186  auto x1 = otherCell.getInnerX();
187  auto y1 = otherCell.getInnerY();
188 
189  auto x2 = getInnerX();
190  auto y2 = getInnerY();
191 
192  auto x3 = getOuterX();
193  auto y3 = getOuterY();
194 
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));
197  // high pt : just straight
198  if (tan_12_13_half_mul_distance_13_squared * ptmin <= 1.0e-4f * 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);
201 
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;
204 
205  float distance_13_beamspot_squared = distance_3_beamspot_squared - proj_bs3_on_13_squared;
206 
207  return distance_13_beamspot_squared < (region_origin_radius + phiCut) * (region_origin_radius + phiCut);
208  }
209 
210  //87 cm/GeV = 1/(3.8T * 0.3)
211 
212  //take less than radius given by the hardPtCut and reject everything below
213  float minRadius = hardPtCut * 87.f; // FIXME move out and use real MagField
214 
215  auto det = (x1 - x2) * (y2 - y3) - (x2 - x3) * (y1 - y2);
216 
217  auto offset = x2 * x2 + y2 * y2;
218 
219  auto bc = (x1 * x1 + y1 * y1 - offset) * 0.5f;
220 
221  auto cd = (offset - x3 * x3 - y3 * y3) * 0.5f;
222 
223  auto idet = 1.f / det;
224 
225  auto x_center = (bc * (y2 - y3) - cd * (y1 - y2)) * idet;
226  auto y_center = (cd * (x1 - x2) - bc * (x2 - x3)) * idet;
227 
228  auto radius = std::sqrt((x2 - x_center) * (x2 - x_center) + (y2 - y_center) * (y2 - y_center));
229 
230  if (radius < minRadius)
231  return false; // hard cut on pt
232 
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);
238 
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;
243  }
244 
245  return false;
246  }

References funct::abs(), hippyaddtobaddatafiles::cd(), MillePedeFileConverter_cfg::e, f, getInnerX(), getInnerY(), getOuterX(), getOuterY(), 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().

◆ tagAsOuterNeighbor()

void CACell::tagAsOuterNeighbor ( unsigned int  otherCell)
inline

Definition at line 177 of file CACell.h.

177 { theOuterNeighbors.push_back(otherCell); }

References theOuterNeighbors.

Member Data Documentation

◆ theDoubletId

const int CACell::theDoubletId
private

◆ theDoublets

const HitDoublets* CACell::theDoublets
private

◆ theInnerR

const float CACell::theInnerR
private

Definition at line 278 of file CACell.h.

Referenced by getInnerR().

◆ theInnerZ

const float CACell::theInnerZ
private

Definition at line 279 of file CACell.h.

Referenced by getInnerZ().

◆ theOuterNeighbors

CAntuple CACell::theOuterNeighbors
private

Definition at line 273 of file CACell.h.

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

mps_fire.i
i
Definition: mps_fire.py:355
HitDoublets::y
float y(int i, layer l) const
Definition: RecHitsSortedInPhi.h:160
CACell::getInnerX
float getInnerX() const
Definition: CACell.h:44
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HitDoublets::outer
Definition: RecHitsSortedInPhi.h:126
HitDoublets::x
float x(int i, layer l) const
Definition: RecHitsSortedInPhi.h:159
CACell::checkAlignmentAndAct
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)
Definition: CACell.h:77
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
HitDoublets::hit
Hit const & hit(int i, layer l) const
Definition: RecHitsSortedInPhi.h:150
CACell::theInnerR
const float theInnerR
Definition: CACell.h:278
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
CACell::theOuterNeighbors
CAntuple theOuterNeighbors
Definition: CACell.h:273
CACell::haveSimilarCurvature
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:179
CACell::getOuterY
float getOuterY() const
Definition: CACell.h:50
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
HLT_2018_cff.doublets
doublets
Definition: HLT_2018_cff.py:8544
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HitDoublets::rv
float rv(int i, layer l) const
Definition: RecHitsSortedInPhi.h:152
CACell::getInnerZ
float getInnerZ() const
Definition: CACell.h:52
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
CACell::theInnerZ
const float theInnerZ
Definition: CACell.h:279
CACell::getInnerY
float getInnerY() const
Definition: CACell.h:48
CACell::theDoublets
const HitDoublets * theDoublets
Definition: CACell.h:275
ALCARECOTkAlMinBias_cff.pMin
pMin
GeV.
Definition: ALCARECOTkAlMinBias_cff.py:35
heppy_loop.loop
loop
Definition: heppy_loop.py:28
CACell::getOuterZ
float getOuterZ() const
Definition: CACell.h:54
HitDoublets::z
float z(int i, layer l) const
Definition: RecHitsSortedInPhi.h:158
HitDoublets::phi
float phi(int i, layer l) const
Definition: RecHitsSortedInPhi.h:151
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
CACell::theDoubletId
const int theDoubletId
Definition: CACell.h:276
HitDoublets::inner
Definition: RecHitsSortedInPhi.h:126
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
ptmin
double ptmin
Definition: HydjetWrapper.h:84
hippyaddtobaddatafiles.cd
def cd(newdir)
Definition: hippyaddtobaddatafiles.py:40
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:56
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:78
CACell::areAlignedRZ
int areAlignedRZ(float r1, float z1, float ro, float zo, const float ptmin, const float thetaCut) const
Definition: CACell.h:166
CACell::getOuterR
float getOuterR() const
Definition: CACell.h:58
CACell::getOuterX
float getOuterX() const
Definition: CACell.h:46
CACell::CAntuplet
std::vector< unsigned int > CAntuplet
Definition: CACell.h:30
CACell::getInnerR
float getInnerR() const
Definition: CACell.h:56
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37