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
22#include<vector>
23#include<map>
24#include<cstring>
25#include<mutex>
26
28
29class 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 {
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
93 mutable std::mutex m_workMutex;
94};
95
96
97
98#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 > > &)
bool operator()(const struct PhiEtaHash &p1, const struct PhiEtaHash &p2)
PhiEtaHash(short phi, short eta, int hash)