ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::SiDetElementsLayer_xk Class Reference

#include <SiDetElementsLayer_xk.h>

Collaboration diagram for InDet::SiDetElementsLayer_xk:

Public Member Functions

 SiDetElementsLayer_xk ()
 SiDetElementsLayer_xk (double, double, double, double, double)
 SiDetElementsLayer_xk (const SiDetElementsLayer_xk &)=default
 SiDetElementsLayer_xk (SiDetElementsLayer_xk &&)=default
 ~SiDetElementsLayer_xk ()=default
SiDetElementsLayer_xkoperator= (const SiDetElementsLayer_xk &)=default
SiDetElementsLayer_xkoperator= (SiDetElementsLayer_xk &&)=default
const float & r () const
const float & dr () const
const float & z () const
const float & dz () const
const float & dfe () const
std::vector< SiDetElementLink_xk > & elements ()
const std::vector< SiDetElementLink_xk > & elements () const
void set (double, double, double, double, double)
void add (const SiDetElementLink_xk &)
int nElements () const
void getBarrelDetElements (const std::array< float, 6 > &startingPoint, const std::array< float, 3 > &searchDirection, std::vector< InDet::SiDetElementLink_xk::ElementWay > &lDE, std::vector< bool > &used) const
 Get barrel detector elements Input parameters: startPoint[0] - X searchDirection[0] - Ax startPoint[1] - Y searchDirection[1] - Ay startPoint[2] - Z searchDirection[2] - Az startPoint[3] - R startPoint[4] - width startPoint[5] - step Will populate 'lDE' and update 'used' with the detector elements compatible with a crossing by a straight trajectory starting at 'startPoint' and moving in direction 'searchDirection'.
void getITkBarrelDetElements (const std::array< float, 6 > &startingPoint, const std::array< float, 3 > &searchDirection, std::vector< InDet::SiDetElementLink_xk::ElementWay > &lDE, std::vector< bool > &used) const
void getEndcapDetElements (const std::array< float, 6 > &startingPoint, const std::array< float, 3 > &searchDirection, std::vector< InDet::SiDetElementLink_xk::ElementWay > &lDE, std::vector< bool > &used) const
void getITkEndcapDetElements (const std::array< float, 6 > &startingPoint, const std::array< float, 3 > &searchDirection, std::vector< InDet::SiDetElementLink_xk::ElementWay > &lDE, std::vector< bool > &used) const
void sortDetectorElements ()

Protected Member Functions

void getDetElements (const std::array< float, 6 > &startingPoint, const std::array< float, 3 > &searchDirection, float phiCrossing, float reducedRoadWidth, std::vector< InDet::SiDetElementLink_xk::ElementWay > &lDE, std::vector< bool > &used) const
 internal helper which resolves the phi-multiplicity of elements within a layer.

Protected Attributes

float m_z
float m_dz
float m_r
float m_dr
float m_dfe
std::vector< SiDetElementLink_xkm_elements

Detailed Description

Definition at line 27 of file SiDetElementsLayer_xk.h.

Constructor & Destructor Documentation

◆ SiDetElementsLayer_xk() [1/4]

InDet::SiDetElementsLayer_xk::SiDetElementsLayer_xk ( )
inline

◆ SiDetElementsLayer_xk() [2/4]

InDet::SiDetElementsLayer_xk::SiDetElementsLayer_xk ( double r,
double dr,
double z,
double dz,
double df )
inline

Definition at line 146 of file SiDetElementsLayer_xk.h.

148 {
149 m_r = float(r );
150 m_dr = float(dr);
151 m_z = float(z );
152 m_dz = float(dz);
153 m_dfe= float(df);
154 }

◆ SiDetElementsLayer_xk() [3/4]

InDet::SiDetElementsLayer_xk::SiDetElementsLayer_xk ( const SiDetElementsLayer_xk & )
default

◆ SiDetElementsLayer_xk() [4/4]

InDet::SiDetElementsLayer_xk::SiDetElementsLayer_xk ( SiDetElementsLayer_xk && )
default

◆ ~SiDetElementsLayer_xk()

InDet::SiDetElementsLayer_xk::~SiDetElementsLayer_xk ( )
default

Member Function Documentation

◆ add()

void InDet::SiDetElementsLayer_xk::add ( const SiDetElementLink_xk & link)
inline

Definition at line 166 of file SiDetElementsLayer_xk.h.

167 {
168 m_elements.push_back(link);
169 }
std::vector< SiDetElementLink_xk > m_elements

◆ dfe()

const float & InDet::SiDetElementsLayer_xk::dfe ( ) const
inline

Definition at line 56 of file SiDetElementsLayer_xk.h.

56{return m_dfe ;}

◆ dr()

const float & InDet::SiDetElementsLayer_xk::dr ( ) const
inline

Definition at line 53 of file SiDetElementsLayer_xk.h.

53{return m_dr ;}

◆ dz()

const float & InDet::SiDetElementsLayer_xk::dz ( ) const
inline

Definition at line 55 of file SiDetElementsLayer_xk.h.

55{return m_dz ;}

◆ elements() [1/2]

std::vector< SiDetElementLink_xk > & InDet::SiDetElementsLayer_xk::elements ( )
inline

Definition at line 57 of file SiDetElementsLayer_xk.h.

57{return m_elements;}

◆ elements() [2/2]

const std::vector< SiDetElementLink_xk > & InDet::SiDetElementsLayer_xk::elements ( ) const
inline

Definition at line 58 of file SiDetElementsLayer_xk.h.

58{return m_elements;}

◆ getBarrelDetElements()

void InDet::SiDetElementsLayer_xk::getBarrelDetElements ( const std::array< float, 6 > & startingPoint,
const std::array< float, 3 > & searchDirection,
std::vector< InDet::SiDetElementLink_xk::ElementWay > & lDE,
std::vector< bool > & used ) const

Get barrel detector elements Input parameters: startPoint[0] - X searchDirection[0] - Ax startPoint[1] - Y searchDirection[1] - Ay startPoint[2] - Z searchDirection[2] - Az startPoint[3] - R startPoint[4] - width startPoint[5] - step Will populate 'lDE' and update 'used' with the detector elements compatible with a crossing by a straight trajectory starting at 'startPoint' and moving in direction 'searchDirection'.

The two additional elements of startPoint are the road width used as tolerance in the crossing test (in mm) and the step (distance to travel to the module).

In the following, identify where we cross the layer in r by solving the quadratic equation ( startingPoint_xy + s * searchDirection_xy )² = r_layer²

solutions of our equation

pick one: if both solution occur for the same direction, we pick the crossing that occurs first

otherwise, pick the one in the positive direction

Z-coordinate of the layer crossing

radial component of the search direction

Check if we miss the layer completely: If the distance of our crossing point to the layer centre along z exceeds the half width in z of the layer by more than a tolerance obtained as the z movement expected when traversing along the layer radial half-width (dr_half / tan(theta_searchDirection)) plus the road width divided by sin(theta)

Phi coordinate of the crossing

road width divided by the radius of the layer

Definition at line 31 of file SiDetElementsLayer_xk.cxx.

36{
37 // Tell clang to optimize assuming that FP exceptions can trap.
38 // Otherwise, it can vectorize the division, which can lead to
39 // spurious division-by-zero traps from unused vector lanes.
41
45 float minusB =2*( searchDirection[0]*startingPoint[0]
46 +searchDirection[1]*startingPoint[1]);
47 float C = (m_r-startingPoint[0]-startingPoint[1])
48 *(m_r+startingPoint[0]+startingPoint[1])
49 +2.*startingPoint[0]*startingPoint[1];
50 float twoA = 2.*( searchDirection[0]*searchDirection[0]
51 +searchDirection[1]*searchDirection[1]);
52 if(twoA == 0.) return;
53 float sq = minusB*minusB+2.*C*twoA;
54 if (sq > 0){
55 sq=std::sqrt(sq);
56 }
57 else {
58 sq=0.;
59 }
61 float s1 =-(minusB+sq)/twoA;
62 float s2 =-(minusB-sq)/twoA;
63 float s;
67 if((s1*s2) > 0.) {
68 s = (std::abs(s1) < std::abs(s2) ? s1 : s2);
69 }
71 else{
72 s = (s1 > 0. ? s1 : s2);
73 }
75 float zc = startingPoint[2]+searchDirection[2]*s;
77 float At = std::sqrt(1.-searchDirection[2]*searchDirection[2]);
78
84 if(At != 0. && std::abs(zc-m_z) > (m_dz+(m_dr*std::abs(searchDirection[2])+startingPoint[4])/At)) return;
86 float phiCrossing = std::atan2(startingPoint[1]+searchDirection[1]*s,startingPoint[0]+searchDirection[0]*s);
88 float reducedRoadWidth = startingPoint[4]/m_r;
89 getDetElements(startingPoint,searchDirection,phiCrossing,reducedRoadWidth,lDE,used);
90
91}
#define sq(x)
void getDetElements(const std::array< float, 6 > &startingPoint, const std::array< float, 3 > &searchDirection, float phiCrossing, float reducedRoadWidth, std::vector< InDet::SiDetElementLink_xk::ElementWay > &lDE, std::vector< bool > &used) const
internal helper which resolves the phi-multiplicity of elements within a layer.
struct color C
#define CXXUTILS_TRAPPING_FP
Definition trapping_fp.h:24

◆ getDetElements()

void InDet::SiDetElementsLayer_xk::getDetElements ( const std::array< float, 6 > & startingPoint,
const std::array< float, 3 > & searchDirection,
float phiCrossing,
float reducedRoadWidth,
std::vector< InDet::SiDetElementLink_xk::ElementWay > & lDE,
std::vector< bool > & used ) const
protected

internal helper which resolves the phi-multiplicity of elements within a layer.

Same logic as above. Extra args: 'phiCrossing' is the phi coordinate of the layer crossing and 'reducedRoadWidth' is a phi tolerance obtained by dividing the search road width by the radius of the layer

iteratively search for the index of the crossing by splitting the remaining search region in half

first, rotate in the positive phi direction

if detector element i on this layer is not already used for this road

project delta phi into -pi..pi

dPhi must be compatible with the phi half-width within a tolerance specified by the road width divided by the radius

intersect our projection with the detector element. Output: intersectionOutcome[0] - close distance in azimuthal direction intersectionOutcome[1] - close distance in r or z direction intersectionOutcome[2] - step to detector element

closest distance in both directions has to be compatible within the road width

we found a compatible detector element - add to our list

loop around if we have to

stop when we have tried all detector elements

we get here by triggering the 'break' clause in the positive-direction loop above

now rotate in the negative phi direction

loop around at zero

stop at full circle

Definition at line 311 of file SiDetElementsLayer_xk.cxx.

318{
319 constexpr float pi = M_PI;
320 constexpr float pi2 = 2.*pi;
321 int im = int(m_elements.size())-1;
322 if(im<0) return;
323 int i0 = 0;
324 int i1 = im;
325
327 if (phiCrossing> m_elements[i0].phi() && phiCrossing< m_elements[i1].phi()) {
328 while((i1-i0)>1) {
329 int i = (i0+i1)/2;
330 if (m_elements[i].phi() > phiCrossing){
331 i1=i;
332 }
333 else{
334 i0=i;
335 }
336 }
337 i0 = i1;
338 }
339 //
340 std::array<float,3> intersectionOutcome{};
341 int i = i0;
343 while(1) {
344 assert( static_cast<unsigned int>(i)<m_elements.size() );
346 if(!used[i]) {
348 float dPhi =std::abs(m_elements[i].phi()-phiCrossing);
349 if(dPhi>pi) dPhi=std::abs(dPhi-pi2);
350
353 if((dPhi-reducedRoadWidth)>m_dfe) break;
354
359 m_elements[i].intersect(&(startingPoint[0]),&(searchDirection[0]),&(intersectionOutcome[0]));
360
362 if ( intersectionOutcome[0]<=startingPoint[4]
363 && (intersectionOutcome[1]<=startingPoint[4])
364 ) {
366 lDE.emplace_back(&m_elements[i],startingPoint[5]+intersectionOutcome[2],std::max(intersectionOutcome[0],intersectionOutcome[1]));
367 used[i]=true;
368 }
369 }
370 ++i;
371 if(i>im) i=0;
372 if(i==i0) return;
373 }
375 i1 = i; i = i0;
376 while(1) {
378 --i;
380 if(i<0) i=im;
382 if(i==i1) return;
383 assert( static_cast<unsigned int>(i)<m_elements.size() );
384 if(!used[i]) {
385 float dPhi =std::abs(m_elements[i].phi()-phiCrossing);
386 if(dPhi>pi) dPhi=std::abs(dPhi-pi2);
387 if((dPhi-reducedRoadWidth)>m_dfe) return;
388 m_elements[i].intersect(&(startingPoint[0]),&(searchDirection[0]),&(intersectionOutcome[0]));
389
390 if((intersectionOutcome[0]-startingPoint[4])<=0 && (intersectionOutcome[1]-startingPoint[4])<=0.) {
391 lDE.emplace_back(&m_elements[i],startingPoint[5]+intersectionOutcome[2],std::max(intersectionOutcome[0],intersectionOutcome[1]));
392 used[i]=true;
393 }
394 }
395 }
396}
#define M_PI
Scalar phi() const
phi method
#define pi
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)

◆ getEndcapDetElements()

void InDet::SiDetElementsLayer_xk::getEndcapDetElements ( const std::array< float, 6 > & startingPoint,
const std::array< float, 3 > & searchDirection,
std::vector< InDet::SiDetElementLink_xk::ElementWay > & lDE,
std::vector< bool > & used ) const

solve the linear equation z_layer = z_startingPont + s * z_searchDirection

obtain x,y,r coordinates of the layer crossing in z

search direction z (== cos(theta_search)) * radius of starting point

Kick out cases where we do not expect to cross the layer at all. Do this by checking if the distance of the radial location of the z-crossing from the layer centre in r exceeds the r-half-width by more than the r-movement expected when traversing the half-width in z + the search road width

Definition at line 206 of file SiDetElementsLayer_xk.cxx.

211{
214 float s =(m_z-startingPoint[2])/searchDirection[2];
216 float xc = startingPoint[0]+searchDirection[0]*s;
217 float yc = startingPoint[1]+searchDirection[1]*s;
218 float rc = std::sqrt(xc*xc+yc*yc);
220 float A23 = searchDirection[2]*startingPoint[3];
225 if(A23 != 0. && std::abs(rc-m_r) > m_dr+std::abs(2.*(startingPoint[0]*searchDirection[0]+startingPoint[1]*searchDirection[1])*m_dz/A23)+startingPoint[4]) return;
226 float phiCrossing = std::atan2(yc,xc);
227 float reducedRoadWidth = startingPoint[4]/rc;
228 getDetElements(startingPoint,searchDirection,phiCrossing,reducedRoadWidth,lDE,used);
229
230}
static Double_t rc

◆ getITkBarrelDetElements()

void InDet::SiDetElementsLayer_xk::getITkBarrelDetElements ( const std::array< float, 6 > & startingPoint,
const std::array< float, 3 > & searchDirection,
std::vector< InDet::SiDetElementLink_xk::ElementWay > & lDE,
std::vector< bool > & used ) const

In the following, identify where we cross the layer in r by solving the quadratic equation ( startingPoint_xy + s * searchDirection_xy )² = r_layer²

solutions of our equation

pick one: if both solution occur for the same direction, we pick the crossing that occurs first

otherwise, pick the one in the positive direction

Z-coordinate of the layer crossing

radial component of the search direction

Check if we miss the layer completely: If the distance of our crossing point to the layer centre along z exceeds the half width in z of the layer by more than a tolerance obtained as the z movement expected when traversing along the layer radial half-width (dr_half / tan(theta_searchDirection)) plus the road width divided by sin(theta)

road width divided by the radius of the layer

Phi coordinate of the crossing

Definition at line 94 of file SiDetElementsLayer_xk.cxx.

99{
100 constexpr float pi = M_PI;
101 constexpr float pi2 = 2.*pi;
102
106 float minusB =2*( searchDirection[0]*startingPoint[0]
107 +searchDirection[1]*startingPoint[1]);
108 float C = (m_r-startingPoint[0]-startingPoint[1])
109 *(m_r+startingPoint[0]+startingPoint[1])
110 +2.*startingPoint[0]*startingPoint[1];
111 float twoA = 2.*( searchDirection[0]*searchDirection[0]
112 +searchDirection[1]*searchDirection[1]);
113 if(twoA == 0.) return;
114 float sq = minusB*minusB+2.*C*twoA;
115 if (sq > 0){
116 sq=std::sqrt(sq);
117 }
118 else {
119 sq=0.;
120 }
122 float s1 =-(minusB+sq)/twoA;
123 float s2 =-(minusB-sq)/twoA;
124 float s;
128 if((s1*s2) > 0.) {
129 s = (std::abs(s1) < std::abs(s2) ? s1 : s2);
130 }
132 else{
133 s = (s1 > 0. ? s1 : s2);
134 }
136 float zc = startingPoint[2]+searchDirection[2]*s;
138 float At = std::sqrt(1.-searchDirection[2]*searchDirection[2]);
139 float Sz = (m_dr*std::abs(searchDirection[2])+startingPoint[4])/At;
140
146 if(At != 0. && std::abs(zc-m_z) > (m_dz+Sz)) return;
148 float reducedRoadWidth = startingPoint[4]/m_r + m_dfe;
150 float phiCrossing = std::atan2(startingPoint[1]+searchDirection[1]*s,startingPoint[0]+searchDirection[0]*s) - reducedRoadWidth;
151 if(phiCrossing<-pi) phiCrossing += pi2;
152
153 int ie = m_elements.size();
154 int i1 = ie-1;
155
156 if (phiCrossing <= m_elements[ 0].phi()) i1 = 0 ;
157 else if(phiCrossing > m_elements[i1].phi()) i1 = ie;
158 else {
159 int i0=0;
160 while((i1-i0)>1) {
161 int i = (i0+i1)/2;
162 if (m_elements[i].phi() > phiCrossing) i1=i;
163 else i0=i;
164 }
165 }
166
167 phiCrossing += 2.*reducedRoadWidth;
168
169 for(int i = i1; i!=ie; ++i) {
170
171 if( m_elements[i].phi() > phiCrossing ) return;
172
173 if(std::abs(zc-m_elements[i].z()) < (m_elements[i].dz()+Sz)
174 && m_elements[i].intersectITk(&(startingPoint[0]),&(searchDirection[0]),s)) {
175 lDE.emplace_back(&m_elements[i],s,0); //distance not used for ITk?
176 used[i]=true;
177 }
178 }
179
180 phiCrossing -= pi2;
181
182 for(int i=0; i!=i1; ++i) {
183
184 if( m_elements[i].phi() > phiCrossing) return;
185
186 if(std::abs(zc-m_elements[i].z()) < (m_elements[i].dz()+Sz)
187 && m_elements[i].intersectITk(&(startingPoint[0]),&(searchDirection[0]),s)) {
188 lDE.emplace_back(&m_elements[i],s,0);
189 used[i]=true;
190 }
191 }
192
193}

◆ getITkEndcapDetElements()

void InDet::SiDetElementsLayer_xk::getITkEndcapDetElements ( const std::array< float, 6 > & startingPoint,
const std::array< float, 3 > & searchDirection,
std::vector< InDet::SiDetElementLink_xk::ElementWay > & lDE,
std::vector< bool > & used ) const

solve the linear equation z_layer = z_startingPont + s * z_searchDirection

obtain x,y,r coordinates of the layer crossing in z

search direction z (== cos(theta_search)) * radius of starting point

Kick out cases where we do not expect to cross the layer at all. Do this by checking if the distance of the radial location of the z-crossing from the layer centre in r exceeds the r-half-width by more than the r-movement expected when traversing the half-width in z + the search road width

Definition at line 233 of file SiDetElementsLayer_xk.cxx.

238{
239 constexpr float pi = M_PI;
240 constexpr float pi2 = 2.*pi;
241
244 float s =(m_z-startingPoint[2])/searchDirection[2];
246 float xc = startingPoint[0]+searchDirection[0]*s;
247 float yc = startingPoint[1]+searchDirection[1]*s;
248 float rc = std::sqrt(xc*xc+yc*yc);
250 float A23 = searchDirection[2]*startingPoint[3];
255 if(A23 != 0. && std::abs(rc-m_r) > m_dr+std::abs(2.*(startingPoint[0]*searchDirection[0]+startingPoint[1]*searchDirection[1])*m_dz/A23)+startingPoint[4]) return;
256 float reducedRoadWidth = startingPoint[4]/rc + m_dfe;
257 float phiCrossing = std::atan2(yc,xc)-reducedRoadWidth;
258 if(phiCrossing<-pi) phiCrossing += pi2;
259
260 int ie = m_elements.size();
261 int i1 = ie-1;
262
263 if (phiCrossing <= m_elements[ 0].phi()) i1 = 0 ;
264 else if(phiCrossing > m_elements[i1].phi()) i1 = ie;
265 else {
266 int i0=0;
267 while((i1-i0)>1) {
268 int i = (i0+i1)/2;
269 if (m_elements[i].phi() > phiCrossing) i1=i;
270 else i0=i;
271 }
272 }
273
274 phiCrossing += 2.*reducedRoadWidth;
275
276 for(int i = i1; i!=ie; ++i) {
277
278 if( m_elements[i].phi() > phiCrossing ) return;
279
280 if(m_elements[i].intersectITk(&(startingPoint[0]),&(searchDirection[0]),s)) {
281 lDE.emplace_back(&m_elements[i],s,0); //distance not used for ITk?
282 used[i]=true;
283 }
284 }
285
286 phiCrossing -= pi2;
287
288 for(int i=0; i!=i1; ++i) {
289
290 if( m_elements[i].phi() > phiCrossing) return;
291
292 if(m_elements[i].intersectITk(&(startingPoint[0]),&(searchDirection[0]),s)) {
293 lDE.emplace_back(&m_elements[i],s,0);
294 used[i]=true;
295 }
296 }
297
298}

◆ nElements()

int InDet::SiDetElementsLayer_xk::nElements ( ) const
inline

Definition at line 171 of file SiDetElementsLayer_xk.h.

172 {
173 return m_elements.size();
174 }

◆ operator=() [1/2]

SiDetElementsLayer_xk & InDet::SiDetElementsLayer_xk::operator= ( const SiDetElementsLayer_xk & )
default

◆ operator=() [2/2]

SiDetElementsLayer_xk & InDet::SiDetElementsLayer_xk::operator= ( SiDetElementsLayer_xk && )
default

◆ r()

const float & InDet::SiDetElementsLayer_xk::r ( ) const
inline

Definition at line 52 of file SiDetElementsLayer_xk.h.

52{return m_r ;}

◆ set()

void InDet::SiDetElementsLayer_xk::set ( double r,
double dr,
double z,
double dz,
double df )
inline

Definition at line 156 of file SiDetElementsLayer_xk.h.

158 {
159 m_r = float(r );
160 m_dr = float(dr);
161 m_z = float(z );
162 m_dz = float(dz);
163 m_dfe= float(df);
164 }

◆ sortDetectorElements()

void InDet::SiDetElementsLayer_xk::sortDetectorElements ( )

Definition at line 402 of file SiDetElementsLayer_xk.cxx.

403{
404 std::sort(m_elements.begin(),m_elements.end(),InDet::compDetElements_Azimuthal());
405}
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ z()

const float & InDet::SiDetElementsLayer_xk::z ( ) const
inline

Definition at line 54 of file SiDetElementsLayer_xk.h.

54{return m_z ;}

Member Data Documentation

◆ m_dfe

float InDet::SiDetElementsLayer_xk::m_dfe
protected

Definition at line 117 of file SiDetElementsLayer_xk.h.

◆ m_dr

float InDet::SiDetElementsLayer_xk::m_dr
protected

Definition at line 116 of file SiDetElementsLayer_xk.h.

◆ m_dz

float InDet::SiDetElementsLayer_xk::m_dz
protected

Definition at line 114 of file SiDetElementsLayer_xk.h.

◆ m_elements

std::vector<SiDetElementLink_xk> InDet::SiDetElementsLayer_xk::m_elements
protected

Definition at line 118 of file SiDetElementsLayer_xk.h.

◆ m_r

float InDet::SiDetElementsLayer_xk::m_r
protected

Definition at line 115 of file SiDetElementsLayer_xk.h.

◆ m_z

float InDet::SiDetElementsLayer_xk::m_z
protected

Definition at line 113 of file SiDetElementsLayer_xk.h.


The documentation for this class was generated from the following files: