ATLAS Offline Software
Loading...
Searching...
No Matches
TrigITkAccelerationTool Class Reference

#include <TrigITkAccelerationTool.h>

Inheritance diagram for TrigITkAccelerationTool:
Collaboration diagram for TrigITkAccelerationTool:

Public Member Functions

 TrigITkAccelerationTool (const std::string &, const std::string &, const IInterface *)
virtual StatusCode initialize () override
virtual size_t exportSeedMakingJob (const TrigCombinatorialSettings &, const IRoiDescriptor *, const std::vector< TrigSiSpacePointBase > &, TrigAccel::DATA_EXPORT_BUFFER &) const override
virtual int extractTripletsFromOutput (std::shared_ptr< TrigAccel::OffloadBuffer >, const std::vector< TrigSiSpacePointBase > &, std::vector< TrigInDetTriplet > &) const override

Private Member Functions

float getCovR (bool isBarrel) const
float getCovZ (bool isBarrel) const

Private Attributes

ServiceHandle< ITrigInDetAccelerationSvcm_accelSvc

Detailed Description

Definition at line 16 of file TrigITkAccelerationTool.h.

Constructor & Destructor Documentation

◆ TrigITkAccelerationTool()

TrigITkAccelerationTool::TrigITkAccelerationTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 11 of file TrigITkAccelerationTool.cxx.

13 : base_class(t,n,p),
14 m_accelSvc("TrigInDetAccelerationSvc",this->name()) {
15
16 declareInterface< ITrigInDetAccelerationTool >( this );
17}
ServiceHandle< ITrigInDetAccelerationSvc > m_accelSvc

Member Function Documentation

◆ exportSeedMakingJob()

size_t TrigITkAccelerationTool::exportSeedMakingJob ( const TrigCombinatorialSettings & tcs,
const IRoiDescriptor * roi,
const std::vector< TrigSiSpacePointBase > & vsp,
TrigAccel::DATA_EXPORT_BUFFER & output ) const
overridevirtual

Definition at line 25 of file TrigITkAccelerationTool.cxx.

25 {
26
27 typedef struct SpIndexPair {
28 public:
29
30 struct compareZ {
31 public:
32 bool operator()(const std::pair<int, const TrigSiSpacePointBase*>& p1, const std::pair<int, const TrigSiSpacePointBase*>& p2) {
33 return p1.second->z() < p2.second->z();
34 }
35 };
36
37 struct compareR {
38 public:
39 bool operator()(const std::pair<int, const TrigSiSpacePointBase*>& p1, const std::pair<int, const TrigSiSpacePointBase*>& p2) {
40 return p1.second->r() < p2.second->r();
41 }
42 };
43
44 } SP_INDEX_PAIR;
45
46
47 //0. get InDet geometry information
48
49 const std::vector<short>& pixelLayers = m_accelSvc->getLayerInformation(1);
50 const std::vector<short>& layerTypes = m_accelSvc->getLayerInformation(0);
51
52
53 //1. check buffer size
54
55 size_t dataTypeSize = sizeof(TrigAccel::ITk::SEED_MAKING_JOB);
56 const size_t bufferOffset = 256;
57 size_t totalSize = bufferOffset+dataTypeSize;//make room for the header
58 if(!output.fit(totalSize)) output.reallocate(totalSize);
59
60 TrigAccel::ITk::SEED_MAKING_JOB* pJ = reinterpret_cast<TrigAccel::ITk::SEED_MAKING_JOB*>(output.m_buffer+bufferOffset);
61
62 // cppcheck-suppress memsetClassFloat; deliberate
63 memset(pJ,0,dataTypeSize);
64
66
71 sfs.m_maxEta = roi->etaPlus();
74
75 sfs.m_magFieldZ = tcs.m_magFieldZ;
76
80 sfs.m_tripletDoPSS = tcs.m_tripletDoPSS ? 1 : 0;
81 sfs.m_tripletDoPPS = tcs.m_tripletDoPPS ? 1 : 0;
82 sfs.m_doubletFilterRZ = tcs.m_doubletFilterRZ ? 1 : 0;
85 sfs.m_isFullScan = 1;
86
87 // roi->isFullscan() check cannot be currently used for standalone ITk ROI configuration
88 bool isRoiFullscan = ((roi->etaPlus() >= 4) && (roi->etaMinus() <= -4));
89 if(!(isRoiFullscan || roi->composite() )){
90 //roi suitable for gpu
91 //composite rois are not supported at this point
92 sfs.m_isFullScan = 0;
93
94 sfs.m_phiMinus = roi->phiMinus();
95 sfs.m_phiPlus = roi->phiPlus();
96 }
97
98 sfs.m_zedMinus = roi->zedMinus();
99 sfs.m_zedPlus = roi->zedPlus();
100
102
103 unsigned int nSP = vsp.size();
106 ATH_MSG_WARNING("MAX_NUMBER_SPACEPOINTS exceeded, exported data truncated ...");
107 }
108
109 //2. arrange spacepoints into phi/Layer bins
110
111 double phiSliceWidth = 2*M_PI/tcs.m_nMaxPhiSlice;
112 int nLayers = static_cast<int>(layerTypes.size());
113 int nSlices = static_cast<int>(tcs.m_nMaxPhiSlice);
114
115 std::vector<std::vector<std::pair<int, const TrigSiSpacePointBase*> > > phiLArray;
116 phiLArray.resize(nLayers*nSlices);
117
118 for(unsigned int i=0;i<nSP;i++) {
119 const TrigSiSpacePointBase& sp = vsp[i];
120 const std::pair<IdentifierHash, IdentifierHash>& els = sp.offlineSpacePoint()->elementIdList();
121
122 IdentifierHash hashId = els.first;
123 short layerId = pixelLayers[hashId];
124
125 int phiIdx = (sp.phi()+M_PI)/phiSliceWidth;
126 if (phiIdx >= tcs.m_nMaxPhiSlice) {
127 phiIdx %= tcs.m_nMaxPhiSlice;
128 }
129 else if (phiIdx < 0) {
130 phiIdx += tcs.m_nMaxPhiSlice;
131 phiIdx %= tcs.m_nMaxPhiSlice;
132 }
133
134 std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layerId + phiIdx*nLayers];
135 v.push_back(std::pair<int, const TrigSiSpacePointBase*>(i,&sp));//storing the original index of spacepoint
136 }
137
138 //sorting spacepoints in accordance with non-ref coordinate
139 int layerIdx=0;
140 for(std::vector<short>::const_iterator it = layerTypes.begin();it!=layerTypes.end();++it, layerIdx++) {
141 short barrel_ec = (*it);//0-barrel, !=0 - endcap
142 for(int slice = 0;slice<nSlices;slice++) {
143 std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layerIdx + slice*nLayers];
144 if(barrel_ec==0) std::sort(v.begin(), v.end(), SP_INDEX_PAIR::compareZ());
145 else std::sort(v.begin(), v.end(), SP_INDEX_PAIR::compareR());
146 }
147 }
148
149 sps.m_nSpacepoints = nSP;
150 sps.m_nPhiSlices = nSlices;
151 sps.m_nLayers = nLayers;
152 sps.m_nMiddleLayers = m_accelSvc->getMiddleLayersSize();
153
154 int spIdx=0;
155 for(int slice = 0;slice<nSlices;slice++) {
156 for(int layer = 0;layer<nLayers;layer++) {
157 int layerStart = spIdx;
158 bool isBarrel = (layerTypes[layer] == 0); // barrel = 0, ec != 0
159 std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layer + slice*nLayers];
160 for(std::vector<std::pair<int, const TrigSiSpacePointBase*> >::iterator it = v.begin();it!=v.end();++it) {
161 const TrigSiSpacePointBase* sp = (*it).second;
162 const Trk::SpacePoint* osp = sp->offlineSpacePoint();
163 const InDet::PixelCluster* pCL = dynamic_cast<const InDet::PixelCluster*>(osp->clusterList().first);
164 float clusterWidth = pCL->width().widthPhiRZ().y();
165 if (!isBarrel && clusterWidth > 0.2) continue;
166
167 sps.m_index[spIdx] = (*it).first;
168 sps.m_type[spIdx] = layerTypes[layer]; // store layer number
169 sps.m_x[spIdx] = sp->x();
170 sps.m_y[spIdx] = sp->y();
171 sps.m_z[spIdx] = sp->z();
172 sps.m_r[spIdx] = sp->r();
173 sps.m_phi[spIdx] = sp->phi();
174 sps.m_covR[spIdx] = getCovR(isBarrel);
175 sps.m_covZ[spIdx] = getCovZ(isBarrel);
176 sps.m_clusterWidth[spIdx] = clusterWidth;
177 spIdx++;
178 }
179 int layerEnd = spIdx;
180 sps.m_phiSlices[slice].m_layerBegin[layer] = layerStart;
181 sps.m_phiSlices[slice].m_layerEnd[layer] = layerEnd;
182 }
183 }
184
185 return totalSize;
186
187}
#define M_PI
#define ATH_MSG_WARNING(x)
static Double_t sp
static unsigned int totalSize(const MultiDimArray< T, N > &ht)
virtual double phiPlus() const =0
extreme phi values
virtual double zedPlus() const =0
the zed and eta values at the most forward and most rear ends of the RoI
virtual double phiMinus() const =0
virtual double zedMinus() const =0
virtual double etaMinus() const =0
virtual double etaPlus() const =0
virtual bool composite() const =0
Super RoI access methods.
const InDet::SiWidth & width() const
return width class reference
const Amg::Vector2D & widthPhiRZ() const
Definition SiWidth.h:121
float getCovR(bool isBarrel) const
float getCovZ(bool isBarrel) const
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
@ layer
Definition HitInfo.h:79
struct TrigAccel::ITk::SeedMakingJob SEED_MAKING_JOB
struct TrigAccel::ITk::SeedFinderSettings SEED_FINDER_SETTINGS
struct TrigAccel::ITk::SpacePointStorage SPACEPOINT_STORAGE
static constexpr unsigned int MAX_NUMBER_SPACEPOINTS
output
Definition merge.py:16
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
SEED_FINDER_SETTINGS m_settings
int m_layerBegin[MAX_SILICON_LAYERS]
int m_type[MAX_NUMBER_SPACEPOINTS]
float m_clusterWidth[MAX_NUMBER_SPACEPOINTS]
float m_z[MAX_NUMBER_SPACEPOINTS]
SPACEPOINT_LAYER_RANGE m_phiSlices[MAX_PHI_SLICES]
int m_index[MAX_NUMBER_SPACEPOINTS]
float m_phi[MAX_NUMBER_SPACEPOINTS]
float m_x[MAX_NUMBER_SPACEPOINTS]
float m_covZ[MAX_NUMBER_SPACEPOINTS]
float m_covR[MAX_NUMBER_SPACEPOINTS]
float m_y[MAX_NUMBER_SPACEPOINTS]
float m_r[MAX_NUMBER_SPACEPOINTS]

◆ extractTripletsFromOutput()

int TrigITkAccelerationTool::extractTripletsFromOutput ( std::shared_ptr< TrigAccel::OffloadBuffer > gpu_buffer,
const std::vector< TrigSiSpacePointBase > & vsp,
std::vector< TrigInDetTriplet > & output ) const
overridevirtual

Definition at line 189 of file TrigITkAccelerationTool.cxx.

189 {
191
192 int nTriplets = pOutput->m_nSeeds;
193
194 //copy seeds into the output buffer
195
196 output.clear();
197
198 for(int k=0;k<nTriplets;k++) {
199 // Check if a valid triplet was returned
200 if (pOutput->m_innerIndex[k] == pOutput->m_outerIndex[k]) continue;
201
202 const TrigSiSpacePointBase& SPi = vsp[pOutput->m_innerIndex[k]];
203 const TrigSiSpacePointBase& SPm = vsp[pOutput->m_middleIndex[k]];
204 const TrigSiSpacePointBase& SPo = vsp[pOutput->m_outerIndex[k]];
205 output.emplace_back(SPi, SPm, SPo, pOutput->m_Q[k]);
206 }
207
208 return nTriplets;
209}
unsigned char * m_rawBuffer
struct TrigAccel::ITk::OutputSeedStorage OUTPUT_SEED_STORAGE
int m_middleIndex[MAX_NUMBER_OUTPUT_SEEDS]
int m_innerIndex[MAX_NUMBER_OUTPUT_SEEDS]
int m_outerIndex[MAX_NUMBER_OUTPUT_SEEDS]
float m_Q[MAX_NUMBER_OUTPUT_SEEDS]

◆ getCovR()

float TrigITkAccelerationTool::getCovR ( bool isBarrel) const
private

Definition at line 211 of file TrigITkAccelerationTool.cxx.

211 {
212 if (isBarrel) return 0.01*0.01;
213 else return 0.02*0.02;
214}

◆ getCovZ()

float TrigITkAccelerationTool::getCovZ ( bool isBarrel) const
private

Definition at line 216 of file TrigITkAccelerationTool.cxx.

216 {
217 if (isBarrel) return 0.02*0.02;
218 else return 0.01*0.01;
219}

◆ initialize()

StatusCode TrigITkAccelerationTool::initialize ( )
overridevirtual

Definition at line 19 of file TrigITkAccelerationTool.cxx.

19 {
20
21 ATH_CHECK(m_accelSvc.retrieve());
22 return StatusCode::SUCCESS;
23}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_accelSvc

ServiceHandle<ITrigInDetAccelerationSvc> TrigITkAccelerationTool::m_accelSvc
private

Definition at line 31 of file TrigITkAccelerationTool.h.


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