ATLAS Offline Software
Loading...
Searching...
No Matches
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
18
21
23
24#include<vector>
25#include<map>
26#include<cstring>
27#include<mutex>
28
30
31class TrigInDetAccelerationSvc : public extends<AthService, ITrigInDetAccelerationSvc, IIncidentListener> {
32
33 public:
34
35 TrigInDetAccelerationSvc( const std::string&, ISvcLocator*);
36
37 virtual ~TrigInDetAccelerationSvc() override {};
38
39 virtual StatusCode initialize() override;
40 virtual StatusCode finalize() override;
41 virtual void handle(const Incident&) override;
42
43 virtual bool isReady() const override {
45 }
46
47 virtual TrigAccel::Work* createWork(unsigned int, std::shared_ptr<TrigAccel::OffloadBuffer>) const override;
48 virtual const std::vector<short>& getLayerInformation(int) const override;
49 virtual size_t getMiddleLayersSize() const override {return m_middleSpacePointLayers.size();};
50
51 private:
52 StatusCode initializeWorkFactory();
53
54 struct PhiEtaHash {
55
56 struct compare {
57 public:
58 bool operator()(const struct PhiEtaHash& p1, const struct PhiEtaHash& p2) {
59 if(p1.m_phiIndex == p2.m_phiIndex) {
60 return p1.m_etaIndex < p2.m_etaIndex;
61 }
62 else {
63 return p1.m_phiIndex < p2.m_phiIndex;
64 }
65 }
66 };
67
68 public:
69 PhiEtaHash(short phi, short eta, int hash) : m_phiIndex(phi), m_etaIndex(eta), m_hash(hash) {};
71 int m_hash;
72 };
73
74 int m_nDCs;
75 std::string m_moduleName;
77 std::vector<int> m_middleSpacePointLayers;
78 void* m_libHandle; //for OffloadFactory
84
86
87 bool exportGeometryInformation(const std::map<std::tuple<short,short,short>, std::vector<PhiEtaHash> >&) const;
88 bool extractGeometryInformation(std::map<std::tuple<short,short,short>, std::vector<PhiEtaHash> >&);
89
90 bool extractITkGeometryInformation(std::map<std::tuple<short, short, int, int>, std::vector<PhiEtaHash> >&);
91 bool exportITkGeometryInformation(const std::map<std::tuple<short,short, int, int>,std::vector<PhiEtaHash> >& hashMap) const;
92
93 // Index 0 stores mapping from a position (barrel_ec, subdetid, new_vol, new_lay) index to it's position in barrel/endcap
94 // Index 1 and 2 stores mapping from subdetector's PhiEtaHash to the position index
95 std::vector<short> m_layerInfo[3];
96
97 mutable std::mutex m_workMutex;
98
99};
100
101
102
103#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
virtual void handle(const Incident &) override
OnBeginRun data gathering and export.
ServiceHandle< StoreGateSvc > m_evtStore
virtual const std::vector< short > & getLayerInformation(int) const override
virtual ~TrigInDetAccelerationSvc() override
ServiceHandle< StoreGateSvc > m_detStore
virtual StatusCode initialize() override
Initialize.
bool exportITkGeometryInformation(const std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > &hashMap) const
bool exportGeometryInformation(const std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > &) const
std::vector< short > m_layerInfo[3]
virtual bool isReady() const override
virtual StatusCode finalize() override
Finalize.
virtual TrigAccel::Work * createWork(unsigned int, std::shared_ptr< TrigAccel::OffloadBuffer >) const override
bool extractITkGeometryInformation(std::map< std::tuple< short, short, int, int >, std::vector< PhiEtaHash > > &)
TrigInDetAccelerationSvc(const std::string &, ISvcLocator *)
Constructor.
std::vector< int > m_middleSpacePointLayers
virtual size_t getMiddleLayersSize() const override
TrigAccel::WorkFactory * m_pWF
bool extractGeometryInformation(std::map< std::tuple< short, short, short >, std::vector< PhiEtaHash > > &)
ServiceHandle< AthCUDA::IGPUSystemInfoSvc > m_cudaCheckSvc
bool operator()(const struct PhiEtaHash &p1, const struct PhiEtaHash &p2)
PhiEtaHash(short phi, short eta, int hash)