ATLAS Offline Software
TrigInDetAccelerationSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGINDETACCELERATIONSERVICE_TRIGINDETACCELERATIONSVC_H
6 #define TRIGINDETACCELERATIONSERVICE_TRIGINDETACCELERATIONSVC_H
7 
8 #include "GaudiKernel/IIncidentListener.h"
9 #include "GaudiKernel/IIncidentSvc.h"
10 
12 
14 
15 #include "GaudiKernel/ServiceHandle.h"
16 
17 #include "StoreGate/StoreGateSvc.h"
18 
20 #include "TrigAccelEvent/Module.h"
21 
22 #include<vector>
23 #include<map>
24 #include<cstring>
25 #include<mutex>
26 
28 
29 class TrigInDetAccelerationSvc : public extends<AthService, ITrigInDetAccelerationSvc, IIncidentListener> {
30 
31  public:
32 
33  TrigInDetAccelerationSvc( const std::string&, ISvcLocator*);
34 
35  virtual ~TrigInDetAccelerationSvc() override {};
36 
37  virtual StatusCode initialize() override;
38  virtual StatusCode finalize() override;
39  virtual void handle(const Incident&) override;
40 
41  virtual bool isReady() const override {
42  return m_factoryConfigured;
43  }
44 
45  virtual TrigAccel::Work* createWork(unsigned int, std::shared_ptr<TrigAccel::OffloadBuffer>) const override;
46  virtual const std::vector<short>& getLayerInformation(int) const override;
47  virtual size_t getMiddleLayersSize() const override {return m_middleSpacePointLayers.size();};
48 
49  private:
50 
51  struct PhiEtaHash {
52 
53  struct compare {
54  public:
55  bool operator()(const struct PhiEtaHash& p1, const struct PhiEtaHash& p2) {
56  if(p1.m_phiIndex == p2.m_phiIndex) {
57  return p1.m_etaIndex < p2.m_etaIndex;
58  }
59  else {
60  return p1.m_phiIndex < p2.m_phiIndex;
61  }
62  }
63  };
64 
65  public:
66  PhiEtaHash(short phi, short eta, int hash) : m_phiIndex(phi), m_etaIndex(eta), m_hash(hash) {};
68  int m_hash;
69  };
70 
71  int m_nDCs;
72  std::string m_moduleName;
74  std::vector<int> m_middleSpacePointLayers;
75  void* m_libHandle; //for OffloadFactory
80 
82 
83  bool exportGeometryInformation(const std::map<std::tuple<short,short,short>, std::vector<PhiEtaHash> >&) const;
84  bool extractGeometryInformation(std::map<std::tuple<short,short,short>, std::vector<PhiEtaHash> >&);
85 
86  bool extractITkGeometryInformation(std::map<std::tuple<short, short, int, int>, std::vector<PhiEtaHash> >&);
87  bool exportITkGeometryInformation(const std::map<std::tuple<short,short, int, int>,std::vector<PhiEtaHash> >& hashMap) const;
88 
89  // Index 0 stores mapping from a position (barrel_ec, subdetid, new_vol, new_lay) index to it's position in barrel/endcap
90  // Index 1 and 2 stores mapping from subdetector's PhiEtaHash to the position index
91  std::vector<short> m_layerInfo[3];
92 
94 };
95 
96 
97 
98 #endif
TrigInDetAccelerationSvc::m_factoryConfigured
bool m_factoryConfigured
Definition: TrigInDetAccelerationSvc.h:81
ITrigInDetAccelerationSvc.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
TrigInDetAccelerationSvc::~TrigInDetAccelerationSvc
virtual ~TrigInDetAccelerationSvc() override
Definition: TrigInDetAccelerationSvc.h:35
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
TrigInDetAccelerationSvc::extractITkGeometryInformation
bool extractITkGeometryInformation(std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > &)
Definition: TrigInDetAccelerationSvc.cxx:323
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
TrigInDetAccelerationSvc
Service for creating GPU-accelerated Work items for HLT ID algorithms.
Definition: TrigInDetAccelerationSvc.h:29
TrigInDetAccelerationSvc::exportITkGeometryInformation
bool exportITkGeometryInformation(const std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > &hashMap) const
Definition: TrigInDetAccelerationSvc.cxx:195
TrigInDetAccelerationSvc::PhiEtaHash::compare
Definition: TrigInDetAccelerationSvc.h:53
TrigInDetAccelerationSvc::m_pWF
TrigAccel::WorkFactory * m_pWF
Definition: TrigInDetAccelerationSvc.h:76
TrigInDetAccelerationSvc::TrigInDetAccelerationSvc
TrigInDetAccelerationSvc(const std::string &, ISvcLocator *)
Constructor
Definition: TrigInDetAccelerationSvc.cxx:27
TrigInDetAccelerationSvc::m_module
TrigAccel::Module * m_module
Definition: TrigInDetAccelerationSvc.h:77
Module.h
TrigInDetAccelerationSvc::handle
virtual void handle(const Incident &) override
OnBeginRun data gathering and export.
Definition: TrigInDetAccelerationSvc.cxx:143
TrigInDetAccelerationSvc::createWork
virtual TrigAccel::Work * createWork(unsigned int, std::shared_ptr< TrigAccel::OffloadBuffer >) const override
Definition: TrigInDetAccelerationSvc.cxx:177
TrigAccel::Module
Definition: Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/Module.h:16
WorkFactory.h
TrigInDetAccelerationSvc::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: TrigInDetAccelerationSvc.h:78
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
TrigInDetAccelerationSvc::PhiEtaHash::m_hash
int m_hash
Definition: TrigInDetAccelerationSvc.h:68
TrigInDetAccelerationSvc::m_nDCs
int m_nDCs
Definition: TrigInDetAccelerationSvc.h:71
TrigInDetAccelerationSvc::PhiEtaHash::m_phiIndex
short m_phiIndex
Definition: TrigInDetAccelerationSvc.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigInDetAccelerationSvc::isReady
virtual bool isReady() const override
Definition: TrigInDetAccelerationSvc.h:41
TrigInDetAccelerationSvc::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
Definition: TrigInDetAccelerationSvc.h:79
TrigInDetAccelerationSvc::getLayerInformation
virtual const std::vector< short > & getLayerInformation(int) const override
Definition: TrigInDetAccelerationSvc.cxx:190
TrigInDetAccelerationSvc::m_workMutex
std::mutex m_workMutex
Definition: TrigInDetAccelerationSvc.h:93
TrigInDetAccelerationSvc::PhiEtaHash
Definition: TrigInDetAccelerationSvc.h:51
TrigInDetAccelerationSvc::m_middleSpacePointLayers
std::vector< int > m_middleSpacePointLayers
Definition: TrigInDetAccelerationSvc.h:74
TrigInDetAccelerationSvc::PhiEtaHash::PhiEtaHash
PhiEtaHash(short phi, short eta, int hash)
Definition: TrigInDetAccelerationSvc.h:66
TrigAccel::Work
Definition: Work.h:14
TrigInDetAccelerationSvc::m_moduleName
std::string m_moduleName
Definition: TrigInDetAccelerationSvc.h:72
TrigInDetAccelerationSvc::m_libHandle
void * m_libHandle
Definition: TrigInDetAccelerationSvc.h:75
TrigInDetAccelerationSvc::PhiEtaHash::compare::operator()
bool operator()(const struct PhiEtaHash &p1, const struct PhiEtaHash &p2)
Definition: TrigInDetAccelerationSvc.h:55
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
TrigInDetAccelerationSvc::m_useITkGeometry
bool m_useITkGeometry
Definition: TrigInDetAccelerationSvc.h:73
AthService.h
TrigAccel::WorkFactory
Definition: WorkFactory.h:16
TrigInDetAccelerationSvc::initialize
virtual StatusCode initialize() override
Initialize
Definition: TrigInDetAccelerationSvc.cxx:50
TrigInDetAccelerationSvc::finalize
virtual StatusCode finalize() override
Finalize
Definition: TrigInDetAccelerationSvc.cxx:129
StoreGateSvc.h
TrigInDetAccelerationSvc::PhiEtaHash::m_etaIndex
short m_etaIndex
Definition: TrigInDetAccelerationSvc.h:67
TrigInDetAccelerationSvc::m_layerInfo
std::vector< short > m_layerInfo[3]
Definition: TrigInDetAccelerationSvc.h:91
TrigInDetAccelerationSvc::getMiddleLayersSize
virtual size_t getMiddleLayersSize() const override
Definition: TrigInDetAccelerationSvc.h:47
TrigInDetAccelerationSvc::extractGeometryInformation
bool extractGeometryInformation(std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > &)
Definition: TrigInDetAccelerationSvc.cxx:531
ServiceHandle< StoreGateSvc >
TrigInDetAccelerationSvc::exportGeometryInformation
bool exportGeometryInformation(const std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > &) const
Definition: TrigInDetAccelerationSvc.cxx:404