|
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 ),
39 declareProperty(
"NumberOfDCs",
m_nDCs = 8 );
40 declareProperty(
"ModuleName",
m_moduleName =
"libTrigInDetCUDA.so");
42 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 404 of file TrigInDetAccelerationSvc.cxx.
409 if (
m_detStore->retrieve(sct_mgr,
"SCT").isFailure()) {
414 if (
m_detStore->retrieve(pix_mgr,
"Pixel").isFailure()) {
422 const size_t bufferOffset = 256;
423 size_t totalSize = bufferOffset + dataTypeSize;
432 memset(pArray,0,dataTypeSize);
434 int nLayers = (
int)hashMap.size();
440 for(std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::const_iterator
it = hashMap.begin();
it!=hashMap.end();++
it, layerIdx++) {
441 short subdetid = std::get<0>((*it).first);
442 short barrel_ec = std::get<1>((*it).first);
448 std::vector<std::vector<PhiEtaHash>::const_iterator> vStops;
449 vStops.push_back((*it).second.begin());
450 std::vector<PhiEtaHash>::const_iterator firstIt = (*it).second.begin();
451 std::vector<PhiEtaHash>::const_iterator nextIt = (*it).second.begin();
456 for(; nextIt!=(*it).second.end();++nextIt, ++firstIt) {
457 if((*nextIt).m_phiIndex!=(*firstIt).m_phiIndex) {
458 vStops.push_back(nextIt);
465 vStops.push_back((*it).second.end());
468 float minBound = 100000.0;
469 float maxBound =-100000.0;
475 for(
unsigned int iStops = 1; iStops<vStops.size();iStops++) {
481 for(std::vector<PhiEtaHash>::const_iterator hIt = vStops[iStops-1];hIt!=vStops[iStops];++hIt, nPhiModules++) {
495 rc += sqrt(
C(0)*
C(0)+
C(1)*
C(1));
496 if(
p->zMin() < minBound) minBound =
p->zMin();
497 if(
p->zMax() > maxBound) maxBound =
p->zMax();
503 if(
p->rMin() < minBound) minBound =
p->rMin();
504 if(
p->rMax() > maxBound) maxBound =
p->rMax();
518 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 195 of file TrigInDetAccelerationSvc.cxx.
199 if (
m_detStore->retrieve(pix_mgr,
"ITkPixel").isFailure()) {
207 const size_t bufferOffset = 256;
208 size_t totalSize = bufferOffset + dataTypeSize;
217 memset(pArray,0,dataTypeSize);
219 int nLayers = (
int)hashMap.size();
224 int middleLayerIdx=0;
226 for(std::map<std::tuple<short,short, int, int>,std::vector<PhiEtaHash> >::const_iterator
it = hashMap.begin();
it!=hashMap.end();++
it, layerIdx++) {
228 short barrel_ec = std::get<0>((*it).first);
229 int vol_id = std::get<2>((*it).first);
230 int lay_id = std::get<3>((*it).first);
231 if(barrel_ec == -100) barrel_ec = 0;
232 int globalLayerId = vol_id*1000 + lay_id;
244 std::vector<std::vector<PhiEtaHash>::const_iterator> vStops;
245 vStops.push_back((*it).second.begin());
246 std::vector<PhiEtaHash>::const_iterator firstIt = (*it).second.begin();
247 std::vector<PhiEtaHash>::const_iterator nextIt = (*it).second.begin();
252 for(; nextIt!=(*it).second.end();++nextIt, ++firstIt) {
253 if((*nextIt).m_phiIndex!=(*firstIt).m_phiIndex) {
254 vStops.push_back(nextIt);
261 vStops.push_back((*it).second.end());
264 float minBound = 100000.0;
265 float maxBound =-100000.0;
271 for(
unsigned int iStops = 1; iStops<vStops.size();iStops++) {
275 for(std::vector<PhiEtaHash>::const_iterator hIt = vStops[iStops-1];hIt!=vStops[iStops];++hIt, nPhiModules++) {
287 if (barrel_ec == 0) {
288 rc += sqrt(
C(0)*
C(0)+
C(1)*
C(1));
289 if(
p->zMin() < minBound) minBound =
p->zMin();
290 if(
p->zMax() > maxBound) maxBound =
p->zMax();
295 if(
p->rMin() < minBound) minBound =
p->rMin();
296 if(
p->rMax() > maxBound) maxBound =
p->rMax();
310 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 531 of file TrigInDetAccelerationSvc.cxx.
533 const PixelID* pixelId =
nullptr;
534 const SCT_ID* sctId =
nullptr;
536 if (
m_detStore->retrieve(pixelId,
"PixelID").isFailure()) {
541 if (
m_detStore->retrieve(sctId,
"SCT_ID").isFailure()) {
552 if(offlineId==0)
continue;
554 short barrel_ec = pixelId->
barrel_ec(offlineId);
555 if(abs(barrel_ec)>2)
continue;
556 short layer_disk = pixelId->
layer_disk(offlineId);
557 short phi_index = pixelId->
phi_module(offlineId);
559 auto t = std::make_tuple(subdetid, barrel_ec, layer_disk);
560 std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >
::iterator it = hashMap.find(
t);
561 if(
it==hashMap.end())
562 hashMap.insert(std::pair<std::tuple<short,short,short>,std::vector<PhiEtaHash> >(
t,std::vector<PhiEtaHash>(1,
PhiEtaHash(phi_index,
eta_index,
hash) )));
570 if(offlineId==0)
continue;
572 short barrel_ec = sctId->
barrel_ec(offlineId);
573 short layer_disk = sctId->
layer_disk(offlineId);
574 short phi_index = sctId->
phi_module(offlineId);
577 auto t = std::make_tuple(subdetid, barrel_ec, layer_disk);
578 std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >
::iterator it = hashMap.find(
t);
579 if(
it==hashMap.end())
580 hashMap.insert(std::pair<std::tuple<short,short,short>,std::vector<PhiEtaHash> >(
t,std::vector<PhiEtaHash>(1,
PhiEtaHash(phi_index,
eta_index,
hash))));
589 for(std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::
iterator it = hashMap.begin();
it!=hashMap.end();++
it, layerId++) {
591 short subdetId = std::get<0>((*it).first);
592 short barrel_ec = std::get<1>((*it).first);
609 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 323 of file TrigInDetAccelerationSvc.cxx.
325 const PixelID* pixelId =
nullptr;
327 if (
m_detStore->retrieve(pixelId,
"PixelID").isFailure()) {
338 if(offlineId==0)
continue;
340 short barrel_ec = pixelId->
barrel_ec(offlineId);
341 if(abs(barrel_ec)>2)
continue;
343 short phi_index = pixelId->
phi_module(offlineId);
345 short layer_disk = pixelId->
layer_disk(offlineId);
349 if (barrel_ec== 0) vol_id = 8;
350 if (barrel_ec==-2) vol_id = 7;
351 if (barrel_ec== 2) vol_id = 9;
353 int new_vol=0, new_lay=0;
355 if (vol_id == 7 || vol_id == 9) {
356 new_vol = 10*vol_id + layer_disk;
358 }
else if (vol_id == 8) {
360 new_vol = 10*vol_id + layer_disk;
363 auto t = std::make_tuple(barrel_ec==0 ? -100 : barrel_ec, subdetid, new_vol, new_lay);
364 std::map<std::tuple<short,short,int,int>,std::vector<PhiEtaHash> >
::iterator it = hashMap.find(
t);
365 if(
it==hashMap.end())
366 hashMap.insert(std::pair<std::tuple<short,short,int,int>,std::vector<PhiEtaHash> >(
t,std::vector<PhiEtaHash>(1,
PhiEtaHash(phi_index,
eta_index,
hash) )));
378 for(std::map<std::tuple<short,short,int,int>,std::vector<PhiEtaHash> >::
iterator it = hashMap.begin();
it!=hashMap.end();++
it, layerId++) {
380 short barrel_ec = std::get<0>((*it).first);
381 short subdetId = std::get<1>((*it).first);
382 if(barrel_ec == -100) barrel_ec = 0;
393 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 143 of file TrigInDetAccelerationSvc.cxx.
149 std::map<std::tuple<short,short, int, int>,std::vector<PhiEtaHash> > hashMap;
161 std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> > hashMap;
◆ initialize()
StatusCode TrigInDetAccelerationSvc::initialize |
( |
| ) |
|
|
overridevirtual |
Initialize
Definition at line 50 of file TrigInDetAccelerationSvc.cxx.
62 ATH_MSG_INFO(
"TrigInDetAccelerationSvc: cannot load the factory library, error:"<<dlerror());
63 return StatusCode::SUCCESS;
75 int factory_id_to_load = 0;
86 ATH_MSG_INFO(
"OffloadFactory with id "<<std::hex<<factory_id_to_load<<
" not available from the module");
88 return StatusCode::SUCCESS;
96 return StatusCode::SUCCESS;
111 SmartIF<IIncidentSvc> incsvc{service(
"IncidentSvc")};
114 const bool is_multiprocess = (Gaudi::Concurrency::ConcurrencyFlags::numProcs() > 0);
115 if (is_multiprocess) {
119 incsvc->addListener(
this,
"BeginRun",
priority);
123 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