ATLAS Offline Software
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 {
20 public:
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 
67  bool m_dbFilled;
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);
89  void fillConnectionTables();
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 
ZdcCablingService::getInstance
static const ZdcCablingService * getInstance()
get pointer to service instance
Definition: ZdcCablingService.cxx:14
ZdcCablingService::m_ppm_db
int m_ppm_db[16]
Definition: ZdcCablingService.h:75
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
ZdcCablingService::hwid2channel
int hwid2channel(int crate, int channel) const
Definition: ZdcCablingService.cxx:397
ZdcCablingService::hwid2side
int hwid2side(int crate, int channel) const
Definition: ZdcCablingService.cxx:369
ZdcCablingService::m_connected
int m_connected[16][16]
Definition: ZdcCablingService.h:87
ZdcCablingService::m_zdcID
const ZdcID * m_zdcID
Definition: ZdcCablingService.h:83
ZdcCablingService::m_delay_db
int m_delay_db[4][64]
Definition: ZdcCablingService.h:72
ZdcCablingService::deleteInstance
static void deleteInstance()
delete service instance
Definition: ZdcCablingService.cxx:21
ZdcCablingService::m_crate_index
int m_crate_index[4]
Definition: ZdcCablingService.h:76
ZdcCablingService::~ZdcCablingService
virtual ~ZdcCablingService()
Destructor protected.
Definition: ZdcCablingService.cxx:250
ZdcCablingService::h2s_channel_id
Identifier h2s_channel_id(int crate, int channel) const
Definition: ZdcCablingService.cxx:326
ZdcCablingService::m_gain_db
int m_gain_db[4][64]
Definition: ZdcCablingService.h:71
ZdcCablingService::hwid2hv
int hwid2hv(int crate, int channel) const
Definition: ZdcCablingService.cxx:428
ZdcCablingService::setConnected
void setConnected(int ppm, int channel)
Definition: ZdcCablingService.cxx:255
ZdcCablingService::hwid2type
int hwid2type(int crate, int channel) const
Definition: ZdcCablingService.cxx:387
ZdcCablingService::crate_index_lookup
int crate_index_lookup(int &crate) const
Definition: ZdcCablingService.h:92
ZdcCablingService::hwid2delay
int hwid2delay(int crate, int channel) const
Definition: ZdcCablingService.cxx:417
ZdcID_Exception.h
ZdcCablingService::ZdcCablingService
ZdcCablingService(const ZdcID *zdcID)
Default constructor protected.
Definition: ZdcCablingService.cxx:28
ZdcCablingService::m_module_db
int m_module_db[4][64]
Definition: ZdcCablingService.h:69
ZdcCablingService::m_type_db
int m_type_db[4][64]
Definition: ZdcCablingService.h:70
ZdcCablingService::m_side_db
int m_side_db[4][64]
Definition: ZdcCablingService.h:68
grepfile.ic
int ic
Definition: grepfile.py:33
ZdcCablingService::m_dbFilled
bool m_dbFilled
Definition: ZdcCablingService.h:67
ZdcHardwareID.h
HWIdentifier.h
ZdcCablingService::m_channel_db
int m_channel_db[4][64]
Definition: ZdcCablingService.h:73
ZdcCablingService::hwid2module
int hwid2module(int crate, int channel) const
Definition: ZdcCablingService.cxx:378
ZdcCablingService
Definition: ZdcCablingService.h:19
ZdcCablingService::hwid2gain
int hwid2gain(int crate, int channel) const
Definition: ZdcCablingService.cxx:407
ZdcID.h
ZdcCablingService::fillDB
void fillDB()
Definition: ZdcCablingService.cxx:44
ZdcCablingService::m_ncrate
int m_ncrate
Definition: ZdcCablingService.h:77
ZdcID
Definition: ZdcID.h:25
ZdcCablingService::m_hv_db
int m_hv_db[4][64]
Definition: ZdcCablingService.h:74
ZdcCablingService::fillConnectionTables
void fillConnectionTables()
Definition: ZdcCablingService.cxx:439
Identifier
Definition: IdentifierFieldParser.cxx:14