ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TrigInDetAccelerationTool Class Reference

#include <TrigInDetAccelerationTool.h>

Inheritance diagram for TrigInDetAccelerationTool:
Collaboration diagram for TrigInDetAccelerationTool:

Public Member Functions

 TrigInDetAccelerationTool (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 Attributes

ServiceHandle< ITrigInDetAccelerationSvcm_accelSvc
 

Detailed Description

Definition at line 16 of file TrigInDetAccelerationTool.h.

Constructor & Destructor Documentation

◆ TrigInDetAccelerationTool()

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

Definition at line 10 of file TrigInDetAccelerationTool.cxx.

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

Member Function Documentation

◆ exportSeedMakingJob()

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

Definition at line 24 of file TrigInDetAccelerationTool.cxx.

24  {
25 
26  typedef struct SpIndexPair {
27  public:
28 
29  struct compareZ {
30  public:
31  bool operator()(const std::pair<int, const TrigSiSpacePointBase*>& p1, const std::pair<int, const TrigSiSpacePointBase*>& p2) {
32  return p1.second->z() < p2.second->z();
33  }
34  };
35 
36  struct compareR {
37  public:
38  bool operator()(const std::pair<int, const TrigSiSpacePointBase*>& p1, const std::pair<int, const TrigSiSpacePointBase*>& p2) {
39  return p1.second->r() < p2.second->r();
40  }
41  };
42 
43  } SP_INDEX_PAIR;
44 
45 
46  //0. get InDet geometry information
47 
48  const std::vector<short>& pixelLayers = m_accelSvc->getLayerInformation(1);
49  const std::vector<short>& sctLayers = m_accelSvc->getLayerInformation(2);
50  const std::vector<short>& layerTypes = m_accelSvc->getLayerInformation(0);
51 
52 
53  //1. check buffer size
54 
55  size_t dataTypeSize = sizeof(TrigAccel::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::SEED_MAKING_JOB* pJ = reinterpret_cast<TrigAccel::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  sfs.m_zedMinus = roi->zedMinus();
88  sfs.m_zedPlus = roi->zedPlus();
89 
90  if(!(roi->isFullscan() || roi->composite() )){
91  //roi suitable for gpu
92  //composite rois are not supported at this point
93  sfs.m_isFullScan = 0;
94 
95  sfs.m_phiMinus = roi->phiMinus();
96  sfs.m_phiPlus = roi->phiPlus();
97  }
98 
100 
101  unsigned int nSP = vsp.size();
102  if(nSP >= TrigAccel::MAX_NUMBER_SPACEPOINTS) {
103  nSP = TrigAccel::MAX_NUMBER_SPACEPOINTS-1;
104  ATH_MSG_WARNING("MAX_NUMBER_SPACEPOINTS exceeded, exported data truncated ...");
105  }
106 
107  //2. arrange spacepoints into phi/Layer bins
108 
109  double phiSliceWidth = 2*M_PI/tcs.m_nMaxPhiSlice;
110  int nLayers = static_cast<int>(layerTypes.size());
111  int nSlices = static_cast<int>(tcs.m_nMaxPhiSlice);
112 
113  std::vector<std::vector<std::pair<int, const TrigSiSpacePointBase*> > > phiLArray;
114  phiLArray.resize(nLayers*nSlices);
115 
116  for(unsigned int i=0;i<nSP;i++) {
117  const TrigSiSpacePointBase& sp = vsp[i];
118  const std::pair<IdentifierHash, IdentifierHash>& els = sp.offlineSpacePoint()->elementIdList();
119 
120  IdentifierHash hashId = els.first;
121  short layerId = -1;
122  if(sp.isPixel()) {
123  layerId = pixelLayers[hashId];
124  } else if (sfs.m_maxEta < 3) { // Run 3 geometry
125  layerId = sctLayers[hashId];
126  } else {
127  // Ignore SPs from Strips for ITk Track Seeding
128  continue;
129  }
130 
131  int phiIdx = (sp.phi()+M_PI)/phiSliceWidth;
132  if (phiIdx >= tcs.m_nMaxPhiSlice) {
133  phiIdx %= tcs.m_nMaxPhiSlice;
134  }
135  else if (phiIdx < 0) {
136  phiIdx += tcs.m_nMaxPhiSlice;
137  phiIdx %= tcs.m_nMaxPhiSlice;
138  }
139 
140  std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layerId + phiIdx*nLayers];
141  v.push_back(std::pair<int, const TrigSiSpacePointBase*>(i,&sp));//storing the original index of spacepoint
142  }
143 
144  //sorting spacepoints in accordance with non-ref coordinate
145  int layerIdx=0;
146  for(std::vector<short>::const_iterator it = layerTypes.begin();it!=layerTypes.end();++it, layerIdx++) {
147  short barrel_ec = (*it);//0-barrel, !=0 - endcap
148  for(int slice = 0;slice<nSlices;slice++) {
149  std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layerIdx + slice*nLayers];
150  if(barrel_ec==0) std::sort(v.begin(), v.end(), SP_INDEX_PAIR::compareZ());
151  else std::sort(v.begin(), v.end(), SP_INDEX_PAIR::compareR());
152  }
153  }
154 
155  sps.m_nSpacepoints = nSP;
156  sps.m_nPhiSlices = nSlices;
157  sps.m_nLayers = nLayers;
158 
159  int spIdx=0;
160  for(int slice = 0;slice<nSlices;slice++) {
161  for(int layer = 0;layer<nLayers;layer++) {
162  int layerStart = spIdx;
163  std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layer + slice*nLayers];
164  for(std::vector<std::pair<int, const TrigSiSpacePointBase*> >::iterator it = v.begin();it!=v.end();++it) {
165  const TrigSiSpacePointBase* sp = (*it).second;
166  sps.m_index[spIdx] = (*it).first;
167  sps.m_type[spIdx] = sp->isPixel() ? 1 : 2;
168  sps.m_x[spIdx] = sp->x();
169  sps.m_y[spIdx] = sp->y();
170  sps.m_z[spIdx] = sp->z();
171  sps.m_r[spIdx] = sp->r();
172  sps.m_phi[spIdx] = sp->phi();
173  sps.m_covR[spIdx] = sp->dr()*sp->dr();
174  sps.m_covZ[spIdx] = sp->dz()*sp->dz();
175  spIdx++;
176  }
177  int layerEnd = spIdx;
178  sps.m_phiSlices[slice].m_layerBegin[layer] = layerStart;
179  sps.m_phiSlices[slice].m_layerEnd[layer] = layerEnd;
180  }
181  }
182 
183  return totalSize;
184 
185 }

◆ extractTripletsFromOutput()

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

Definition at line 187 of file TrigInDetAccelerationTool.cxx.

187  {
188  TrigAccel::OUTPUT_SEED_STORAGE* pOutput = reinterpret_cast<TrigAccel::OUTPUT_SEED_STORAGE *>(gpu_buffer->m_rawBuffer);
189 
190  int nTriplets = pOutput->m_nSeeds;
191 
192  //copy seeds into the output buffer
193 
194  output.clear();
195 
196  for(int k=0;k<nTriplets;k++) {
197  const TrigSiSpacePointBase& SPi = vsp[pOutput->m_innerIndex[k]];
198  const TrigSiSpacePointBase& SPm = vsp[pOutput->m_middleIndex[k]];
199  const TrigSiSpacePointBase& SPo = vsp[pOutput->m_outerIndex[k]];
200  output.emplace_back(SPi, SPm, SPo, pOutput->m_Q[k]);
201  }
202 
203  return nTriplets;
204 }

◆ initialize()

StatusCode TrigInDetAccelerationTool::initialize ( )
overridevirtual

Definition at line 18 of file TrigInDetAccelerationTool.cxx.

18  {
19 
20  ATH_CHECK(m_accelSvc.retrieve());
21  return StatusCode::SUCCESS;
22 }

Member Data Documentation

◆ m_accelSvc

ServiceHandle<ITrigInDetAccelerationSvc> TrigInDetAccelerationTool::m_accelSvc
private

Definition at line 27 of file TrigInDetAccelerationTool.h.


The documentation for this class was generated from the following files:
TrigCombinatorialSettings::m_nMaxPhiSlice
int m_nMaxPhiSlice
Definition: TrigCombinatorialSettings.h:68
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TrigSiSpacePointBase::phi
void phi(const double phi)
Definition: TrigSiSpacePointBase.h:52
TrigAccel::SeedFinderSettings::m_maxSiliconLayer
unsigned int m_maxSiliconLayer
Definition: TrigInDetAccelEDM.h:68
TrigAccel::SpacePointLayerRange::m_layerEnd
int m_layerEnd[MAX_SILICON_LAYERS]
Definition: TrigInDetAccelEDM.h:46
TrigAccel::SEED_MAKING_JOB
struct TrigAccel::SeedMakingJob SEED_MAKING_JOB
TrigAccel::SeedFinderSettings::m_maxEta
float m_maxEta
Definition: TrigInDetAccelEDM.h:78
TrigCombinatorialSettings::m_tripletD0_PPS_Max
float m_tripletD0_PPS_Max
Definition: TrigCombinatorialSettings.h:59
TrigSiSpacePointBase::isPixel
bool isPixel() const
Definition: TrigSiSpacePointBase.h:70
TrigAccel::OutputSeedStorage::m_middleIndex
int m_middleIndex[MAX_NUMBER_OUTPUT_SEEDS]
Definition: TrigInDetAccelEDM.h:97
TrigCombinatorialSettings::m_maxSiliconLayer
int m_maxSiliconLayer
Definition: TrigCombinatorialSettings.h:52
TrigAccel::SeedMakingJob
Definition: TrigInDetAccelEDM.h:83
TrigAccel::SpacePointStorage::m_phiSlices
SPACEPOINT_LAYER_RANGE m_phiSlices[MAX_PHI_SLICES]
Definition: TrigInDetAccelEDM.h:63
TrigAccel::SeedFinderSettings::m_phiMinus
float m_phiMinus
Definition: TrigInDetAccelEDM.h:79
TrigAccel::SpacePointStorage
Definition: TrigInDetAccelEDM.h:49
TrigAccel::SpacePointLayerRange::m_layerBegin
int m_layerBegin[MAX_SILICON_LAYERS]
Definition: TrigInDetAccelEDM.h:45
TrigAccel::SpacePointStorage::m_y
float m_y[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:57
TrigAccel::OutputSeedStorage
Definition: TrigInDetAccelEDM.h:89
TrigAccel::OutputSeedStorage::m_innerIndex
int m_innerIndex[MAX_NUMBER_OUTPUT_SEEDS]
Definition: TrigInDetAccelEDM.h:96
TrigAccel::SpacePointStorage::m_phi
float m_phi[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:60
TrigAccel::SeedFinderSettings::m_maxTripletBufferLength
unsigned int m_maxTripletBufferLength
Definition: TrigInDetAccelEDM.h:75
TrigCombinatorialSettings::m_maxBarrelPix
int m_maxBarrelPix
Definition: TrigCombinatorialSettings.h:52
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TrigAccel::OutputSeedStorage::m_nSeeds
int m_nSeeds
Definition: TrigInDetAccelEDM.h:91
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TrigAccel::SpacePointStorage::m_covR
float m_covR[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:61
TrigAccel::SeedFinderSettings::m_magFieldZ
float m_magFieldZ
Definition: TrigInDetAccelEDM.h:69
TrigAccel::OutputSeedStorage::m_Q
float m_Q[MAX_NUMBER_OUTPUT_SEEDS]
Definition: TrigInDetAccelEDM.h:99
TrigCombinatorialSettings::m_tripletPtMin
float m_tripletPtMin
Definition: TrigCombinatorialSettings.h:60
TrigSiSpacePointBase::x
void x(const double x)
Definition: TrigSiSpacePointBase.h:54
TrigAccel::SpacePointStorage::m_x
float m_x[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
IRoiDescriptor::etaPlus
virtual double etaPlus() const =0
TrigAccel::SeedFinderSettings::m_maxEndcapPix
unsigned int m_maxEndcapPix
Definition: TrigInDetAccelEDM.h:68
TrigSiSpacePointBase::offlineSpacePoint
const Trk::SpacePoint * offlineSpacePoint() const
Definition: TrigSiSpacePointBase.h:81
TrigAccel::OutputSeedStorage::m_outerIndex
int m_outerIndex[MAX_NUMBER_OUTPUT_SEEDS]
Definition: TrigInDetAccelEDM.h:98
TrigAccel::SpacePointStorage::m_index
int m_index[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:54
TrigAccel::SpacePointStorage::m_nLayers
int m_nLayers
Definition: TrigInDetAccelEDM.h:53
TrigSiSpacePointBase::z
void z(const double z)
Definition: TrigSiSpacePointBase.h:53
TrigAccel::SeedFinderSettings::m_isFullScan
int m_isFullScan
Definition: TrigInDetAccelEDM.h:76
TrigSiSpacePointBase::r
void r(const double r)
Definition: TrigSiSpacePointBase.h:51
TrigSiSpacePointBase::dr
void dr(const double dr)
Definition: TrigSiSpacePointBase.h:56
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
TrigAccel::SeedFinderSettings::m_minEndcapPix
unsigned int m_minEndcapPix
Definition: TrigInDetAccelEDM.h:68
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrigCombinatorialSettings::m_doublet_dR_Max
float m_doublet_dR_Max
Definition: TrigCombinatorialSettings.h:55
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
lumiFormat.i
int i
Definition: lumiFormat.py:85
TrigCombinatorialSettings::m_seedRadBinWidth
float m_seedRadBinWidth
Definition: TrigCombinatorialSettings.h:61
beamspotman.n
n
Definition: beamspotman.py:731
TrigAccel::SpacePointStorage::m_nSpacepoints
int m_nSpacepoints
Definition: TrigInDetAccelEDM.h:51
TrigCombinatorialSettings::m_tripletDoPPS
bool m_tripletDoPPS
Definition: TrigCombinatorialSettings.h:63
TrigAccel::SeedFinderSettings::m_tripletDoPSS
int m_tripletDoPSS
Definition: TrigInDetAccelEDM.h:73
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
TrigSiSpacePointBase::y
void y(const double y)
Definition: TrigSiSpacePointBase.h:55
TrigAccel::SeedFinderSettings
Definition: TrigInDetAccelEDM.h:66
TrigAccel::SpacePointStorage::m_r
float m_r[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:59
TrigAccel::SpacePointStorage::m_nPhiSlices
int m_nPhiSlices
Definition: TrigInDetAccelEDM.h:52
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IRoiDescriptor::phiMinus
virtual double phiMinus() const =0
TrigAccel::SeedFinderSettings::m_tripletPtMin
float m_tripletPtMin
Definition: TrigInDetAccelEDM.h:72
TrigCombinatorialSettings::m_maxTripletBufferLength
unsigned int m_maxTripletBufferLength
Definition: TrigCombinatorialSettings.h:69
TrigAccel::SeedMakingJob::m_data
SPACEPOINT_STORAGE m_data
Definition: TrigInDetAccelEDM.h:86
TrigCombinatorialSettings::m_tripletDoPSS
bool m_tripletDoPSS
Definition: TrigCombinatorialSettings.h:62
IRoiDescriptor::phiPlus
virtual double phiPlus() const =0
extreme phi values
merge.output
output
Definition: merge.py:17
TrigAccel::SpacePointStorage::m_z
float m_z[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:58
TrigAccel::SeedFinderSettings::m_doubletFilterRZ
int m_doubletFilterRZ
Definition: TrigInDetAccelEDM.h:73
TrigAccel::SeedFinderSettings::m_tripletD0Max
float m_tripletD0Max
Definition: TrigInDetAccelEDM.h:70
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigAccel::SeedFinderSettings::m_tripletDoPPS
int m_tripletDoPPS
Definition: TrigInDetAccelEDM.h:73
Trk::SpacePoint::elementIdList
const std::pair< IdentifierHash, IdentifierHash > & elementIdList() const
return the pair of Ids of the element by reference
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:122
TrigAccel::SeedMakingJob::m_settings
SEED_FINDER_SETTINGS m_settings
Definition: TrigInDetAccelEDM.h:85
TrigSiSpacePointBase::dz
void dz(const double dz)
Definition: TrigSiSpacePointBase.h:57
TrigCombinatorialSettings::m_magFieldZ
float m_magFieldZ
Definition: TrigCombinatorialSettings.h:57
TrigAccel::SeedFinderSettings::m_tripletD0_PPS_Max
float m_tripletD0_PPS_Max
Definition: TrigInDetAccelEDM.h:71
TrigAccel::SeedFinderSettings::m_phiPlus
float m_phiPlus
Definition: TrigInDetAccelEDM.h:79
TrigCombinatorialSettings::m_minEndcapPix
int m_minEndcapPix
Definition: TrigCombinatorialSettings.h:52
python.PyAthena.v
v
Definition: PyAthena.py:154
TrigCombinatorialSettings::m_doubletFilterRZ
bool m_doubletFilterRZ
Definition: TrigCombinatorialSettings.h:66
TrigCombinatorialSettings::m_maxEndcapPix
int m_maxEndcapPix
Definition: TrigCombinatorialSettings.h:52
TrigAccel::OffloadBuffer::m_rawBuffer
unsigned char * m_rawBuffer
Definition: OffloadBuffer.h:39
IRoiDescriptor::zedPlus
virtual double zedPlus() const =0
the zed and eta values at the most forward and most rear ends of the RoI
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TrigAccel::SpacePointStorage::m_type
int m_type[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:55
IRoiDescriptor::isFullscan
virtual bool isFullscan() const =0
is this a full detector RoI?
TrigAccel::SeedFinderSettings::m_maxBarrelPix
unsigned int m_maxBarrelPix
Definition: TrigInDetAccelEDM.h:68
IRoiDescriptor::zedMinus
virtual double zedMinus() const =0
TrigCombinatorialSettings::m_tripletD0Max
float m_tripletD0Max
Definition: TrigCombinatorialSettings.h:58
TrigAccel::SpacePointStorage::m_covZ
float m_covZ[MAX_NUMBER_SPACEPOINTS]
Definition: TrigInDetAccelEDM.h:62
python.copyTCTOutput.totalSize
totalSize
Definition: copyTCTOutput.py:93
TrigSiSpacePointBase
Definition: TrigSiSpacePointBase.h:23
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
TrigAccel::SeedFinderSettings::m_minDoubletLength
float m_minDoubletLength
Definition: TrigInDetAccelEDM.h:78
TrigAccel::SeedFinderSettings::m_zedPlus
float m_zedPlus
Definition: TrigInDetAccelEDM.h:77
TrigInDetAccelerationTool::m_accelSvc
ServiceHandle< ITrigInDetAccelerationSvc > m_accelSvc
Definition: TrigInDetAccelerationTool.h:27
TrigAccel::SeedFinderSettings::m_maxDoubletLength
float m_maxDoubletLength
Definition: TrigInDetAccelEDM.h:78
IRoiDescriptor::composite
virtual bool composite() const =0
Super RoI access methods.
fitman.k
k
Definition: fitman.py:528
TrigAccel::SeedFinderSettings::m_zedMinus
float m_zedMinus
Definition: TrigInDetAccelEDM.h:77
TrigAccel::SeedFinderSettings::m_nMaxPhiSlice
int m_nMaxPhiSlice
Definition: TrigInDetAccelEDM.h:74