|
ATLAS Offline Software
|
Service for creating GPU-accelerated Work items for HLT ID algorithms.
More...
#include <TrigInDetAccelerationSvc.h>
|
bool | exportGeometryInformation (const std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > &) const |
|
bool | extractGeometryInformation (std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > &) |
|
bool | extractITkGeometryInformation (std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > &) |
|
bool | exportITkGeometryInformation (const std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > &hashMap) const |
|
Service for creating GPU-accelerated Work items for HLT ID algorithms.
Definition at line 29 of file TrigInDetAccelerationSvc.h.
◆ TrigInDetAccelerationSvc()
TrigInDetAccelerationSvc::TrigInDetAccelerationSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
Constructor
Definition at line 27 of file TrigInDetAccelerationSvc.cxx.
28 base_class(
name, pSvcLocator ),
38 declareProperty(
"NumberOfDCs",
m_nDCs = 8 );
39 declareProperty(
"ModuleName",
m_moduleName =
"libTrigInDetCUDA.so");
41 declareProperty(
"MiddleSpacePointLayers",
m_middleSpacePointLayers = std::vector<int>(),
"Global IDs of layers that can contain middle spacepoints of track seeds" );
◆ ~TrigInDetAccelerationSvc()
virtual TrigInDetAccelerationSvc::~TrigInDetAccelerationSvc |
( |
| ) |
|
|
inlineoverridevirtual |
◆ createWork()
◆ exportGeometryInformation()
bool TrigInDetAccelerationSvc::exportGeometryInformation |
( |
const std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > & |
hashMap | ) |
const |
|
private |
Definition at line 403 of file TrigInDetAccelerationSvc.cxx.
408 if (
m_detStore->retrieve(sct_mgr,
"SCT").isFailure()) {
413 if (
m_detStore->retrieve(pix_mgr,
"Pixel").isFailure()) {
421 const size_t bufferOffset = 256;
422 size_t totalSize = bufferOffset + dataTypeSize;
431 memset(pArray,0,dataTypeSize);
433 int nLayers = (
int)hashMap.size();
439 for(std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::const_iterator
it = hashMap.begin();
it!=hashMap.end();++
it, layerIdx++) {
440 short subdetid = std::get<0>((*it).first);
441 short barrel_ec = std::get<1>((*it).first);
447 std::vector<std::vector<PhiEtaHash>::const_iterator> vStops;
448 vStops.push_back((*it).second.begin());
449 std::vector<PhiEtaHash>::const_iterator firstIt = (*it).second.begin();
450 std::vector<PhiEtaHash>::const_iterator nextIt = (*it).second.begin();
455 for(; nextIt!=(*it).second.end();++nextIt, ++firstIt) {
456 if((*nextIt).m_phiIndex!=(*firstIt).m_phiIndex) {
457 vStops.push_back(nextIt);
464 vStops.push_back((*it).second.end());
467 float minBound = 100000.0;
468 float maxBound =-100000.0;
474 for(
unsigned int iStops = 1; iStops<vStops.size();iStops++) {
480 for(std::vector<PhiEtaHash>::const_iterator hIt = vStops[iStops-1];hIt!=vStops[iStops];++hIt, nPhiModules++) {
494 rc += sqrt(
C(0)*
C(0)+
C(1)*
C(1));
495 if(
p->zMin() < minBound) minBound =
p->zMin();
496 if(
p->zMax() > maxBound) maxBound =
p->zMax();
502 if(
p->rMin() < minBound) minBound =
p->rMin();
503 if(
p->rMax() > maxBound) maxBound =
p->rMax();
517 std::shared_ptr<TrigAccel::OffloadBuffer> pDMBuff = std::make_shared<TrigAccel::OffloadBuffer>(pBG);
◆ exportITkGeometryInformation()
bool TrigInDetAccelerationSvc::exportITkGeometryInformation |
( |
const std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > & |
hashMap | ) |
const |
|
private |
Definition at line 194 of file TrigInDetAccelerationSvc.cxx.
198 if (
m_detStore->retrieve(pix_mgr,
"ITkPixel").isFailure()) {
206 const size_t bufferOffset = 256;
207 size_t totalSize = bufferOffset + dataTypeSize;
216 memset(pArray,0,dataTypeSize);
218 int nLayers = (
int)hashMap.size();
223 int middleLayerIdx=0;
225 for(std::map<std::tuple<short,short, int, int>,std::vector<PhiEtaHash> >::const_iterator
it = hashMap.begin();
it!=hashMap.end();++
it, layerIdx++) {
227 short barrel_ec = std::get<0>((*it).first);
228 int vol_id = std::get<2>((*it).first);
229 int lay_id = std::get<3>((*it).first);
230 if(barrel_ec == -100) barrel_ec = 0;
231 int globalLayerId = vol_id*1000 + lay_id;
243 std::vector<std::vector<PhiEtaHash>::const_iterator> vStops;
244 vStops.push_back((*it).second.begin());
245 std::vector<PhiEtaHash>::const_iterator firstIt = (*it).second.begin();
246 std::vector<PhiEtaHash>::const_iterator nextIt = (*it).second.begin();
251 for(; nextIt!=(*it).second.end();++nextIt, ++firstIt) {
252 if((*nextIt).m_phiIndex!=(*firstIt).m_phiIndex) {
253 vStops.push_back(nextIt);
260 vStops.push_back((*it).second.end());
263 float minBound = 100000.0;
264 float maxBound =-100000.0;
270 for(
unsigned int iStops = 1; iStops<vStops.size();iStops++) {
274 for(std::vector<PhiEtaHash>::const_iterator hIt = vStops[iStops-1];hIt!=vStops[iStops];++hIt, nPhiModules++) {
286 if (barrel_ec == 0) {
287 rc += sqrt(
C(0)*
C(0)+
C(1)*
C(1));
288 if(
p->zMin() < minBound) minBound =
p->zMin();
289 if(
p->zMax() > maxBound) maxBound =
p->zMax();
294 if(
p->rMin() < minBound) minBound =
p->rMin();
295 if(
p->rMax() > maxBound) maxBound =
p->rMax();
309 std::shared_ptr<TrigAccel::OffloadBuffer> pDMBuff = std::make_shared<TrigAccel::OffloadBuffer>(pBG);
◆ extractGeometryInformation()
bool TrigInDetAccelerationSvc::extractGeometryInformation |
( |
std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > & |
hashMap | ) |
|
|
private |
Definition at line 530 of file TrigInDetAccelerationSvc.cxx.
532 const PixelID* pixelId =
nullptr;
533 const SCT_ID* sctId =
nullptr;
535 if (
m_detStore->retrieve(pixelId,
"PixelID").isFailure()) {
540 if (
m_detStore->retrieve(sctId,
"SCT_ID").isFailure()) {
551 if(offlineId==0)
continue;
553 short barrel_ec = pixelId->
barrel_ec(offlineId);
554 if(abs(barrel_ec)>2)
continue;
555 short layer_disk = pixelId->
layer_disk(offlineId);
556 short phi_index = pixelId->
phi_module(offlineId);
558 auto t = std::make_tuple(subdetid, barrel_ec, layer_disk);
559 std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >
::iterator it = hashMap.find(
t);
560 if(
it==hashMap.end())
561 hashMap.insert(std::pair<std::tuple<short,short,short>,std::vector<PhiEtaHash> >(
t,std::vector<PhiEtaHash>(1,
PhiEtaHash(phi_index,
eta_index,
hash) )));
569 if(offlineId==0)
continue;
571 short barrel_ec = sctId->
barrel_ec(offlineId);
572 short layer_disk = sctId->
layer_disk(offlineId);
573 short phi_index = sctId->
phi_module(offlineId);
576 auto t = std::make_tuple(subdetid, barrel_ec, layer_disk);
577 std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >
::iterator it = hashMap.find(
t);
578 if(
it==hashMap.end())
579 hashMap.insert(std::pair<std::tuple<short,short,short>,std::vector<PhiEtaHash> >(
t,std::vector<PhiEtaHash>(1,
PhiEtaHash(phi_index,
eta_index,
hash))));
588 for(std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::
iterator it = hashMap.begin();
it!=hashMap.end();++
it, layerId++) {
590 short subdetId = std::get<0>((*it).first);
591 short barrel_ec = std::get<1>((*it).first);
608 for(std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::
iterator it = hashMap.begin();
it!=hashMap.end();++
it) {
◆ extractITkGeometryInformation()
bool TrigInDetAccelerationSvc::extractITkGeometryInformation |
( |
std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > & |
hashMap | ) |
|
|
private |
Definition at line 322 of file TrigInDetAccelerationSvc.cxx.
324 const PixelID* pixelId =
nullptr;
326 if (
m_detStore->retrieve(pixelId,
"PixelID").isFailure()) {
337 if(offlineId==0)
continue;
339 short barrel_ec = pixelId->
barrel_ec(offlineId);
340 if(abs(barrel_ec)>2)
continue;
342 short phi_index = pixelId->
phi_module(offlineId);
344 short layer_disk = pixelId->
layer_disk(offlineId);
348 if (barrel_ec== 0) vol_id = 8;
349 if (barrel_ec==-2) vol_id = 7;
350 if (barrel_ec== 2) vol_id = 9;
352 int new_vol=0, new_lay=0;
354 if (vol_id == 7 || vol_id == 9) {
355 new_vol = 10*vol_id + layer_disk;
357 }
else if (vol_id == 8) {
359 new_vol = 10*vol_id + layer_disk;
362 auto t = std::make_tuple(barrel_ec==0 ? -100 : barrel_ec, subdetid, new_vol, new_lay);
363 std::map<std::tuple<short,short,int,int>,std::vector<PhiEtaHash> >
::iterator it = hashMap.find(
t);
364 if(
it==hashMap.end())
365 hashMap.insert(std::pair<std::tuple<short,short,int,int>,std::vector<PhiEtaHash> >(
t,std::vector<PhiEtaHash>(1,
PhiEtaHash(phi_index,
eta_index,
hash) )));
377 for(std::map<std::tuple<short,short,int,int>,std::vector<PhiEtaHash> >::
iterator it = hashMap.begin();
it!=hashMap.end();++
it, layerId++) {
379 short barrel_ec = std::get<0>((*it).first);
380 short subdetId = std::get<1>((*it).first);
381 if(barrel_ec == -100) barrel_ec = 0;
392 for(std::map<std::tuple<short,short,int,int>,std::vector<PhiEtaHash> >::
iterator it = hashMap.begin();
it!=hashMap.end();++
it) {
◆ finalize()
StatusCode TrigInDetAccelerationSvc::finalize |
( |
| ) |
|
|
overridevirtual |
◆ getLayerInformation()
const std::vector< short > & TrigInDetAccelerationSvc::getLayerInformation |
( |
int |
i | ) |
const |
|
overridevirtual |
◆ getMiddleLayersSize()
virtual size_t TrigInDetAccelerationSvc::getMiddleLayersSize |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ handle()
void TrigInDetAccelerationSvc::handle |
( |
const Incident & |
| ) |
|
|
overridevirtual |
OnBeginRun data gathering and export.
Definition at line 142 of file TrigInDetAccelerationSvc.cxx.
148 std::map<std::tuple<short,short, int, int>,std::vector<PhiEtaHash> > hashMap;
160 std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> > hashMap;
◆ initialize()
StatusCode TrigInDetAccelerationSvc::initialize |
( |
| ) |
|
|
overridevirtual |
Initialize
Definition at line 49 of file TrigInDetAccelerationSvc.cxx.
61 ATH_MSG_INFO(
"TrigInDetAccelerationSvc: cannot load the factory library, error:"<<dlerror());
62 return StatusCode::SUCCESS;
74 int factory_id_to_load = 0;
85 ATH_MSG_INFO(
"OffloadFactory with id "<<std::hex<<factory_id_to_load<<
" not available from the module");
87 return StatusCode::SUCCESS;
95 return StatusCode::SUCCESS;
110 SmartIF<IIncidentSvc> incsvc{service(
"IncidentSvc")};
113 const bool is_multiprocess = (Gaudi::Concurrency::ConcurrencyFlags::numProcs() > 0);
114 if (is_multiprocess) {
118 incsvc->addListener(
this,
"BeginRun",
priority);
122 return StatusCode::SUCCESS;
◆ isReady()
virtual bool TrigInDetAccelerationSvc::isReady |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ m_detStore
◆ m_evtStore
◆ m_factoryConfigured
bool TrigInDetAccelerationSvc::m_factoryConfigured |
|
private |
◆ m_layerInfo
std::vector<short> TrigInDetAccelerationSvc::m_layerInfo[3] |
|
private |
◆ m_libHandle
void* TrigInDetAccelerationSvc::m_libHandle |
|
private |
◆ m_middleSpacePointLayers
std::vector<int> TrigInDetAccelerationSvc::m_middleSpacePointLayers |
|
private |
◆ m_module
◆ m_moduleName
std::string TrigInDetAccelerationSvc::m_moduleName |
|
private |
◆ m_nDCs
int TrigInDetAccelerationSvc::m_nDCs |
|
private |
◆ m_pWF
◆ m_useITkGeometry
bool TrigInDetAccelerationSvc::m_useITkGeometry |
|
private |
◆ m_workMutex
std::mutex TrigInDetAccelerationSvc::m_workMutex |
|
mutableprivate |
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
struct TrigAccel::DataExportBuffer DATA_EXPORT_BUFFER
std::string find(const std::string &s)
return a remapped string
void reallocate(size_t s)
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
bool extractITkGeometryInformation(std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > &)
virtual Work * createWork(int, std::shared_ptr< OffloadBuffer > data)=0
virtual int getFactoryId()=0
constexpr unsigned int TrigITkModuleID_CUDA
SILICON_LAYER m_layers[MAX_SILICON_LAYERS]
bool exportITkGeometryInformation(const std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > &hashMap) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int phi_module(const Identifier &id) const
TrigAccel::WorkFactory * m_pWF
bool getModule(std::istream &s, RegSelModule &m)
virtual SiDetectorElement * getDetectorElement(const Identifier &id) const override
access to individual elements via Identifier
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
TrigAccel::Module * m_module
virtual TrigAccel::Work * createWork(unsigned int, std::shared_ptr< TrigAccel::OffloadBuffer >) const override
float m_maxRZ[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]
ServiceHandle< StoreGateSvc > m_detStore
constexpr unsigned int TrigInDetModuleID_CUDA
SILICON_LAYER m_layers[MAX_SILICON_LAYERS]
float m_maxRZ[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]
virtual bool configure()=0
ServiceHandle< StoreGateSvc > m_evtStore
int m_hashArray[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]
float m_minRZ[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]
float m_minRZ[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]
int m_middleSpacePointLayers[MAX_SILICON_LAYERS]
int m_hashArray[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]
int layer_disk(const Identifier &id) const
int eta_module(const Identifier &id) const
size_type wafer_hash_max(void) const
std::vector< int > m_middleSpacePointLayers
int layer_disk(const Identifier &id) const
struct TrigAccel::DetectorModel DETECTOR_MODEL
size_type wafer_hash_max(void) const
Eigen::Matrix< double, 3, 1 > Vector3D
static const std::string & type()
Incident type.
struct TrigAccel::ITk::DetectorModel DETECTOR_MODEL
virtual WorkFactory * getFactoryById(int id)=0
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.
#define ATH_MSG_WARNING(x)
int eta_module(const Identifier &id) const
#define ATLAS_THREAD_SAFE
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
int phi_module(const Identifier &id) const
std::vector< short > m_layerInfo[3]
bool extractGeometryInformation(std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > &)
virtual SiDetectorElement * getDetectorElement(const Identifier &id) const override
access to individual elements : via Identifier
bool exportGeometryInformation(const std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > &) const