ATLAS Offline Software
ITkSiSpacePointForSeed.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <cmath>
6 
7 
8 
10 
14 #include "TrkSurfaces/Surface.h"
15 
16 namespace ITk
17 {
18 
20  (const Trk::SpacePoint*const& sp,const float* r)
21  {
22  set(sp,r); m_param = 0.;
23  }
24 
26  (const Trk::SpacePoint*const& sp,const float* r,const float* sc)
27  {
28  set(sp,r,sc); m_param = 0.;
29  }
30 
32  // Set
34 
36  (const Trk::SpacePoint*const& sp,const float* r)
37  {
38  spacepoint = sp ;
39  m_x = r[0];
40  m_y = r[1];
41  m_z = r[2];
42  m_r =std::sqrt(m_x*m_x+m_y*m_y);
43  m_q = 100000.;
44 
45  const InDet::SiCluster* c = static_cast<const InDet::SiCluster*>(sp->clusterList().first);
46  const InDetDD::SiDetectorElement* de = c ->detectorElement();
47 
48  if( de->isPixel() ) {
49 
50  const Amg::MatrixX& v = c->localCovariance();
51  float f22 = float(v(1,1) );
52  float wid = float(c->width().z());
53  float cov = wid*wid*.08333; if(cov < f22) cov = f22;
54  m_sn = nullptr;
55  cov*=6.;
56  m_covz = cov*(r[3]*r[3]+r[4]*r[4]);
57  m_covr = cov*(r[5]*r[5]);
58  }
59  else {
60 
61  const Amg::MatrixX& v = sp->localCovariance();
62  float f22 = float(v(1,1));
63  if(de->isBarrel()) {m_covz = 8.*f22; m_covr = .1;}
64  else {m_covr = 8.*f22; m_covz = .1;}
65  m_sn = &sp->clusterList().second->detectorElement()->surface();
66 
67  for(int i=0; i!=3; ++i) {
68  m_b0[i]=r[3 +i]; m_b1[i]=r[6 +i]; m_dr[i]=r[9 +i]; m_r0[i]=r[12+i];
69  }
70  }
71  m_su = &sp->clusterList().first->detectorElement()->surface();
72  }
73 
74 
75  void SiSpacePointForSeed::setDR(const float& dr)
76  {
77  m_dR = dr;
78  }
79 
80  void SiSpacePointForSeed::setEta(const float& eta)
81  {
82  m_eta = eta;
83  }
84 
85  void SiSpacePointForSeed::setDZDR(const float& dzdr)
86  {
87  m_dzdr = dzdr;
88  }
89 
90  void SiSpacePointForSeed::setPt(const float& pt)
91  {
92  m_pt = pt;
93  }
94 
96  {
98  }
99 
100 
102  // Set with error correction
103  // sc[0] - barrel pixels error correction
104  // sc[1] - endcap pixels
105  // sc[2] - barrel sct
106  // sc[3] - endcap sct
108 
110  (const Trk::SpacePoint*const& sp,const float* r,const float* sc)
111  {
112  m_sn = nullptr;
113  spacepoint = sp ;
114  m_x = r[0];
115  m_y = r[1];
116  m_z = r[2];
117  m_r =std::sqrt(m_x*m_x+m_y*m_y);
118  m_q = 100000.;
119 
120  const InDet::SiCluster* c = static_cast<const InDet::SiCluster*>(sp->clusterList().first);
121  const InDetDD::SiDetectorElement* de = c ->detectorElement();
122 
123  if( de->isPixel() ) {
124  const Amg::MatrixX& v = c->localCovariance();
125  float f22 = float(v(1,1));
126  float wid = float(c->width().z());
127  float cov = wid*wid*.08333; if(cov < f22) cov = f22;
128  cov*=6.;
129  m_covz = cov*(r[3]*r[3]+r[4]*r[4]);
130  m_covr = cov*(r[5]*r[5]);
131  } else {
132  const Amg::MatrixX& v = sp->localCovariance();
133  float f22 = float(v(1,1));
134  if(de->isBarrel()) {m_covz = 8.*f22*sc[2]; m_covr = .1;}
135  else {m_covr = 8.*f22*sc[3]; m_covz = .1;}
136  for(int i=0; i!=3; ++i) {m_b0[i]=r[3 +i]; m_b1[i]=r[6 +i]; m_dr[i]=r[9 +i]; m_r0[i]=r[12+i];}
137  }
138  m_su = &sp->clusterList().first->detectorElement()->surface();
139  }
140 
141  void SiSpacePointForSeed::setParam(const float& p)
142  {
143  m_param = p;
144  }
146  {
147  if(q <= m_q) m_q = q;
148  }
149 
151  // Coordinate of cross points two SCT strip calculation for given direction
152  // d - input direction
153  // r - output coordinates
154  // true if cross point is inside detector elements
156 
157  bool SiSpacePointForSeed::coordinates(const float* d,float* r)
158  {
159  float d1[3] = {m_b0[1]*d[2]-m_b0[2]*d[1],m_b0[2]*d[0]-m_b0[0]*d[2],m_b0[0]*d[1]-m_b0[1]*d[0]};
160  float bd = m_b1[0]*d1[0]+m_b1[1]*d1[1]+m_b1[2]*d1[2];
161 
162  if(std::abs(m_dr[0]*d1[0]+m_dr[1]*d1[1]+m_dr[2]*d1[2]) > std::abs(bd)*1.1) return false;
163 
164  float s0 = m_dr[0]*(m_b1[1]*d[2]-m_b1[2]*d[1])+
165  m_dr[1]*(m_b1[2]*d[0]-m_b1[0]*d[2])+
166  m_dr[2]*(m_b1[0]*d[1]-m_b1[1]*d[0]);
167  if(std::abs(s0) > std::abs(bd)*1.1) return false;
168 
169  s0/=bd;
170  r[0] = m_r0[0]+m_b0[0]*s0;
171  r[1] = m_r0[1]+m_b0[1]*s0;
172  r[2] = m_r0[2]+m_b0[2]*s0;
173  return true;
174  }
175 
176 } // end of name space ITk
Trk::SpacePoint::clusterList
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:127
Trk::SpacePoint
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:35
beamspotman.r
def r
Definition: beamspotman.py:676
ITk::SiSpacePointForSeed::m_dzdr
float m_dzdr
Definition: ITkSiSpacePointForSeed.h:99
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
ITk::SiSpacePointForSeed::SiSpacePointForSeed
SiSpacePointForSeed()=default
ITk::SiSpacePointForSeed::m_scorePenalty
float m_scorePenalty
Definition: ITkSiSpacePointForSeed.h:95
Surface.h
ITk::SiSpacePointForSeed::pt
const float & pt() const
Definition: ITkSiSpacePointForSeed.h:73
hist_file_dump.d
d
Definition: hist_file_dump.py:137
ITkSiSpacePointForSeed.h
ITk::SiSpacePointForSeed::m_r0
float m_r0[3]
Definition: ITkSiSpacePointForSeed.h:105
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
test_pyathena.pt
pt
Definition: test_pyathena.py:11
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
ITk::SiSpacePointForSeed::setEta
void setEta(const float &)
Definition: ITkSiSpacePointForSeed.cxx:80
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
ITk::SiSpacePointForSeed::m_dr
float m_dr[3]
Definition: ITkSiSpacePointForSeed.h:104
ITk::SiSpacePointForSeed::m_y
float m_y
Definition: ITkSiSpacePointForSeed.h:88
ITk::SiSpacePointForSeed::m_sn
const Trk::Surface * m_sn
Definition: ITkSiSpacePointForSeed.h:108
ITk::SiSpacePointForSeed::coordinates
bool coordinates(const float *, float *)
Definition: ITkSiSpacePointForSeed.cxx:157
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ITk::SiSpacePointForSeed::setPt
void setPt(const float &)
Definition: ITkSiSpacePointForSeed.cxx:90
PyPoolBrowser.bd
bd
Definition: PyPoolBrowser.py:125
ITk::SiSpacePointForSeed::m_pt
float m_pt
Definition: ITkSiSpacePointForSeed.h:98
ITk::SiSpacePointForSeed::m_su
const Trk::Surface * m_su
Definition: ITkSiSpacePointForSeed.h:107
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ITk::SiSpacePointForSeed::spacepoint
const Trk::SpacePoint * spacepoint
Definition: ITkSiSpacePointForSeed.h:61
lumiFormat.i
int i
Definition: lumiFormat.py:85
ITk::SiSpacePointForSeed::dr
const float * dr() const
Definition: ITkSiSpacePointForSeed.h:80
SpacePoint.h
ITk::SiSpacePointForSeed::m_z
float m_z
Definition: ITkSiSpacePointForSeed.h:89
ITk::SiSpacePointForSeed::m_q
float m_q
Definition: ITkSiSpacePointForSeed.h:94
ITk::SiSpacePointForSeed::eta
const float & eta() const
Definition: ITkSiSpacePointForSeed.h:72
ITk::SiSpacePointForSeed::set
void set(const Trk::SpacePoint *const &, const float *)
Definition: ITkSiSpacePointForSeed.cxx:36
ITk::SiSpacePointForSeed::m_x
float m_x
Definition: ITkSiSpacePointForSeed.h:87
ITk::SiSpacePointForSeed::m_param
float m_param
Definition: ITkSiSpacePointForSeed.h:93
Trk::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
InDetDD::SiDetectorElement::isPixel
bool isPixel() const
ITk
Definition: ITkPixelOfflineCalibCondAlg.cxx:14
ITk::SiSpacePointForSeed::setDZDR
void setDZDR(const float &)
Definition: ITkSiSpacePointForSeed.cxx:85
SiCluster.h
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
InDetDD::SiDetectorElement::isBarrel
bool isBarrel() const
ITk::SiSpacePointForSeed::m_dR
float m_dR
penalty term in the seed score
Definition: ITkSiSpacePointForSeed.h:96
ITk::SiSpacePointForSeed::m_eta
float m_eta
Definition: ITkSiSpacePointForSeed.h:97
SiDetectorElement.h
ITk::SiSpacePointForSeed::m_covz
float m_covz
Definition: ITkSiSpacePointForSeed.h:92
xAOD::score
@ score
Definition: TrackingPrimitives.h:513
python.PyAthena.v
v
Definition: PyAthena.py:154
ITk::SiSpacePointForSeed::m_covr
float m_covr
Definition: ITkSiSpacePointForSeed.h:91
ITk::SiSpacePointForSeed::setQuality
void setQuality(float)
Definition: ITkSiSpacePointForSeed.cxx:145
extractSporadic.q
list q
Definition: extractSporadic.py:98
ITk::SiSpacePointForSeed::dzdr
const float & dzdr() const
Definition: ITkSiSpacePointForSeed.h:71
ITk::SiSpacePointForSeed::m_b1
float m_b1[3]
Definition: ITkSiSpacePointForSeed.h:103
ITk::SiSpacePointForSeed::m_b0
float m_b0[3]
Definition: ITkSiSpacePointForSeed.h:102
ITk::SiSpacePointForSeed::setParam
void setParam(const float &)
Definition: ITkSiSpacePointForSeed.cxx:141
python.compressB64.c
def c
Definition: compressB64.py:93
readCCLHist.float
float
Definition: readCCLHist.py:83
InDet::SiCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiCluster.h:40
ITk::SiSpacePointForSeed::setDR
void setDR(const float &)
Definition: ITkSiSpacePointForSeed.cxx:75
ITk::SiSpacePointForSeed::setScorePenalty
void setScorePenalty(const float &)
Definition: ITkSiSpacePointForSeed.cxx:95
ITk::SiSpacePointForSeed::m_r
float m_r
Definition: ITkSiSpacePointForSeed.h:90