ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcCablingService.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ZDCCABLINGSERVICE_H
6#define ZDCCABLINGSERVICE_H
7
8// This class provides conversion between logical and hardware ID
9// Implemented as a singleton
10
11#include "Identifier/Identifier.h"
14#include "ZdcIdentifier/ZdcID.h"
16#include <vector>
17
19{
20public:
21
23 static const ZdcCablingService * getInstance() ;
24
26 static void deleteInstance() ;
27
28 // Conversion between ZdcID and ZdcHWID
29
30 /*
31 Identifier h2s_side_id ( const HWIdentifier & id ) const throw (ZdcID_Exception);
32 Identifier h2s_module_id ( const HWIdentifier & id ) const throw (ZdcID_Exception);
33 Identifier h2s_type_id ( const HWIdentifier & id ) const throw (ZdcID_Exception);
34 Identifier h2s_gain_id ( const HWIdentifier & id ) const throw (ZdcID_Exception);
35 Identifier h2s_delay_id ( const HWIdentifier & id ) const throw (ZdcID_Exception);
36 */
37
38 //Identifier h2s_channel_id ( const HWIdentifier & id ) const throw (ZdcID_Exception);
39 Identifier h2s_channel_id ( int crate, int channel ) const;
40
41 //HWIdentifier s2h_ppm_hwid ( const Identifier & id ) const;
42 //HWIdentifier s2h_channel_hwid ( const Identifier & id ) const;// throw (ZdcID_Exception);
43
44 int hwid2side ( int crate, int channel ) const;
45 int hwid2module ( int crate, int channel ) const;
46 int hwid2type ( int crate, int channel ) const;
47 int hwid2channel ( int crate, int channel ) const;
48 int hwid2gain ( int crate, int channel ) const;
49 int hwid2delay ( int crate, int channel ) const;
50 int hwid2hv ( int crate, int channel ) const;
51
52 //int swid2ppm ( int side, int module, int type ) const;
53 //int swid2channel ( int side, int module, int type, int channel, int gain, int delay) const;
54
55
56 protected:
57
59 ZdcCablingService(const ZdcID* zdcID);// const ZdcHardwareID* zdcHWID) ;
60
62 virtual ~ZdcCablingService() ;
63
64
65 private:
66
68 int m_side_db[4][64]{};
69 int m_module_db[4][64]{};
70 int m_type_db[4][64]{};
71 int m_gain_db[4][64]{};
72 int m_delay_db[4][64]{};
73 int m_channel_db[4][64]{};
74 int m_hv_db[4][64]{};
75 int m_ppm_db[16]{};
76 int m_crate_index[4]{};
77 int m_ncrate{};
78 //int m_crate_lookup[2][3][2];
79 //int m_channel_lookup[2][3][2][16][2][2];
80 //int crate_index_lookup(int crate);
81
82
83 const ZdcID* m_zdcID;
84 //const ZdcHardwareID* m_zdcHWID;
85
86
87 int m_connected[16][16]{};
88 void setConnected(int ppm, int channel);
90 void fillDB();
91
92 inline int crate_index_lookup(int& crate) const
93 {
94 int ic=0;
95 while (1)
96 {
97 if (m_crate_index[ic]==crate) return ic;
98 ic++;
99 if (ic==m_ncrate) return -1;
100 }
101 return -1;
102 }
103
104};
105
106#endif //ZDCCABLINGSERVICE_H
107
int hwid2type(int crate, int channel) const
void setConnected(int ppm, int channel)
int hwid2side(int crate, int channel) const
static void deleteInstance()
delete service instance
int crate_index_lookup(int &crate) const
int hwid2hv(int crate, int channel) const
ZdcCablingService(const ZdcID *zdcID)
Default constructor protected.
int hwid2gain(int crate, int channel) const
int hwid2channel(int crate, int channel) const
static const ZdcCablingService * getInstance()
get pointer to service instance
const ZdcID * m_zdcID
virtual ~ZdcCablingService()
Destructor protected.
int hwid2delay(int crate, int channel) const
int hwid2module(int crate, int channel) const
Identifier h2s_channel_id(int crate, int channel) const
Definition ZdcID.h:25