ATLAS Offline Software
Loading...
Searching...
No Matches
TileCablingService.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 TILECONDITIONS_TILECABLINGSERVICE_H
6#define TILECONDITIONS_TILECABLINGSERVICE_H
7
8// This class provides conversion between logical and hardware ID
9// Implemented as a singleton
10
11#include "Identifier/Identifier.h"
18
20
21#include <vector>
22
24 friend class TileInfoLoader;
25 friend class TileDetectorTool;
26 friend class TileDetectorFactory;
27 friend class TileTBFactory;
28 friend class TileCablingSvc;
29 friend class TileCablingSvcMock;
30 friend class TileROD_Decoder;
31
32public:
33
35 static const TileCablingService* getInstance();
36
37 // Conversion between TileID and Trigger Tower ID
38
39 Identifier cell2tt_id ( const Identifier & id ) const;
40 Identifier pmt2tt_id ( const Identifier & id ) const;
41 Identifier cell2mt_id ( const Identifier & id ) const;
42 Identifier pmt2mt_id ( const Identifier & id ) const;
43
44 Identifier drawer2MBTS_id ( const HWIdentifier & id ) const;
45
46 // Conversion between TileID and TileHWID
47
48// Identifier h2s_section_id ( const HWIdentifier & id );
49// Identifier h2s_region_id ( const HWIdentifier & id );
50// Identifier h2s_module_id ( const HWIdentifier & id );
51// Identifier h2s_tower_id ( const HWIdentifier & id );
52 Identifier h2s_cell_id_index ( const HWIdentifier & id, int & index, int & pmt ) const;
53 Identifier h2s_cell_id_index ( int ros, int drawer, int channel, int & index, int & pmt ) const;
54 Identifier h2s_cell_id ( const HWIdentifier & id ) const;
55 Identifier h2s_pmt_id ( const HWIdentifier & id ) const;
56 Identifier h2s_adc_id ( const HWIdentifier & id ) const;
57
58// HWIdentifier s2h_ros_id ( const Identifier & id );
59 HWIdentifier s2h_drawer_id ( const Identifier & id ) const;
60 HWIdentifier s2h_channel_id ( const Identifier & id ) const;
61 HWIdentifier s2h_adc_id ( const Identifier & id ) const;
62
63 int frag ( const HWIdentifier & id ) const;
64 int frag ( const Identifier & id ) const;
65
66 int frag2channels ( const HWIdentifier & id, std::vector<HWIdentifier> & ids) const;
67 int frag2channels ( int frag, std::vector<HWIdentifier> & ids) const;
68
69 // hole (pmt number in HV system, range 1-48, negative means not connected)
70 int barrel_chan2hole ( int channel ) const { return channel2hole(0,channel); }
71 int extbar_chan2hole ( int channel ) const { return channel2hole(2,channel); }
72 static int channel2hole ( int ros, int channel );
73 // cell index is the number from 0 to 23 (to count all cells in one drawer
74 // index = -1 for non-connected channels
75 static int channel2cellindex ( int ros, int channel );
76
77 bool TileGap_connected ( const Identifier & id) const;
78 static bool C10_connected ( int module );
79
80 unsigned int getNChanPerCell (const Identifier& cell_id) const;
81
82 void fillH2SIdCache (void);
83
85 OldSim = 0,
96
97 bool is_MBTS_merged_run2plus(int module) const;
98 int E1_merged_with_run2plus(int ros, int module) const;
99
100 int getMaxChannels(void) const { return m_maxChannels; };
101 int getMaxGains(void) const { return m_maxGains; };
102
103 bool isDisconnected(int ros, int drawer, int channel) const;
104
106 virtual ~TileCablingService() ;
107
108
109private:
110
112 static TileCablingService* getInstance_nc ATLAS_NOT_THREAD_SAFE ();
113
114 static int hwid2section ( int ros, int channel );
115 int hwid2side ( int ros, int channel ) const;
116 static int hwid2module ( int drawer );
117 int hwid2tower ( int ros, int channel ) const;
118
119 static int hwid2sample ( int ros, int channel );
120 int hwid2pmt ( int ros, int channel ) const;
121
122 int swid2ros ( int section, int side ) const;
123 static int swid2drawer ( int module );
124 int swid2channel ( int section, int side,
125 int tower, int sample,
126 int pmt ) const;
127
128 int hwid2tower_upgradeABC ( int ros, int channel ) const;
129 int hwid2sample_upgradeABC ( int ros, int channel ) const;
130 int hwid2pmt_upgradeABC ( int ros, int channel ) const;
131
132 int swid2channel_upgradeABC ( int section, int side,
133 int tower, int sample,
134 int pmt ) const;
135
136 static int hwid2tbtype ( int drawer );
137 static int hwid2tbmodule ( int drawer, int channel );
138 static int hwid2tbchannel ( int drawer, int channel );
139
140 static int tbid2drawer ( int tbtype, int tbmodule );
141 static int tbid2channel ( int drawer, int tbchannel );
142
143 bool hwid2MBTSconnected ( int ros, int drawer, int channel) const;
144 int hwid2MBTSphi ( int drawer, int channel) const;
145 int hwid2MBTSeta ( int drawer, int channel) const;
146 int MBTS2drawer ( int phi, int eta) const;
147
148 bool hwid2MBTSconnected_real ( int ros, int drawer, int channel) const;
149 int hwid2MBTSphi_real ( int ros, int drawer, int channel) const;
150 int hwid2MBTSeta_real ( int ros, int drawer, int channel) const;
151 int MBTS2drawer_real ( int side, int phi, int eta) const;
152
153 bool hwid2MBTSconnected_run2plus (int ros, int drawer, int channel) const;
154 bool hwid2MBTSconnected_run2plus (int ros, int drawer) const;
155 int hwid2MBTSphi_run2plus (int ros, int drawer) const;
156 int hwid2MBTSeta_run2plus (int ros, int drawer) const;
157 int MBTS2drawer_run2plus (int side, int phi, int eta) const;
158 int MBTS2channel_run2plus (int eta) const;
159
160 bool hwid2E4prconnected_run2 (int ros, int drawer, int channel) const;
161 bool hwid2E4prconnected_run2 (int ros, int drawer) const;
162 int hwid2E4prphi_run2 (int drawer) const;
163 int hwid2E4preta_run2 (int drawer) const;
164
165 int swid2drawer_gapscin ( int side, int module, int tower) const;
166 int swid2channel_gapscin ( int side, int module, int tower) const;
167 int hwid2module_gapscin ( int ros, int drawer, int channel) const;
168 int hwid2tower_gapscin ( int ros, int drawer, int channel) const;
169
170 int swid2drawer_gapscin_run2plus( int side, int module, int tower) const;
171
172 inline bool isTileITCGapCrack (int channel) const {return (channel < 6 || channel == 12 || channel == 13);}
173 inline bool isTileGapCrack (int channel) const {return (channel < 2 || channel == 12 || channel == 13);}
174 inline bool D4 (int channel) const { return ( (channel == 2) || (channel == 3) );}
175
178
183
184 void setCaloLVL1 (const CaloLVL1_ID* tt_ID) {m_TT_ID = tt_ID;}
185 void setTileID (const TileID* tileID) {m_tileID = tileID;}
186 void setTileHWID (const TileHWID* tileHWID) {m_tileHWID = tileHWID;}
187 void setTileTBID (const TileTBID* tileTBID) {m_tileTBID = tileTBID;}
188
190 void setTestBeam (bool testBeam);
191
192 bool m_connected[5][64];
193 void setConnected(int section, int side, int modMin, int modMax);
194 void setConnected(int ros, int draMin, int draMax);
195 void setRun2Merged();
196 void setRun2aMerged();
197 void setRun3Merged();
198
200 LBA = 1,
201 LBC = 2,
202 EBA = 3,
203 EBC = 4 };
204
214 inline bool EB_special(int ros, int drawer) const {
215 return ( (ros == EBA && drawer == m_EBAspec ) || (ros == EBC && drawer == m_EBCspec ) );
216 }
217 inline void EB_special_move_channel(int ros, int drawer, int &channel) const {
218 if (EB_special(ros,drawer)) {
219 // swap special and normal E3,E4 channels
220 // this will help to use the same arrays of connected channels everywhere
221 if (channel == m_E3special) channel = m_E3chan;
222 else if (channel == m_E4special) channel = m_E4chan;
223 else if (channel == m_E3chan) channel = m_E3special;
224 else if (channel == m_E4chan) channel = m_E4special;
225 }
226 }
227
230
235
237
239 std::vector<Identifier> m_ch2cell;
240 std::vector<int> m_ch2pmt;
241 std::vector<int> m_ch2index;
242
243 Identifier h2s_cell_id_index_find ( int ros, int drawer, int channel, int & index, int & pmt ) const;
244 Identifier h2s_cell_id_index_from_cache (int ros, int drawer, int channel, int & index, int & pmt ) const;
245
246 // returns index used for caching (for ros != TileHWID::BEAM_ROS) and calculated as
247 // channel * 64(max number of drawers) * 4(max number of ros) + drawer * 4(max number of ros) + (ros - 1)
248 inline int cacheIndex(int ros, int drawer, int channel) const {return ((channel << 8) + (drawer << 2) + (ros - 1));};
249
250 void setConnected (int ros, int drawer, bool yes) { m_connected[ros][drawer] = yes; }
251
252 bool isChannelFromOppositeSide(int channel) const {return channel == m_maxChannels;};
253
254 std::vector<bool> m_MBTSmergedRun2Plus;
255 std::vector<int> m_E1mergedRun2Plus;
256
257 std::vector<int> m_ch2pmtUpgradeABC;
258 std::vector<int> m_ch2sampleUpgradeABC;
259 std::vector<int> m_ch2towerUpgradeABC;
260
261 bool m_run2;
263 bool m_run3;
264
267
268public:
269
270 inline const TileID* getTileID() const { return m_tileID; }
271 inline const TileHWID* getTileHWID() const { return m_tileHWID; }
272 inline const TileTBID* getTileTBID() const { return m_tileTBID; }
273 inline const CaloLVL1_ID* getCaloLVL1_ID() const { return m_TT_ID; }
274 inline bool getTestBeam() const { return m_testBeam; }
275 inline bool connected (int ros, int drawer) const { return m_connected[ros][drawer]; }
276 inline int getCablingType() const { return m_cablingType; }
277 inline bool isRun2Cabling() const { return m_run2; }
278 inline bool isRun2PlusCabling() const { return m_run2plus; }
279 inline bool isRun3Cabling() const { return m_run3; }
280 inline int runPeriod() const { return (2 * int(m_run2) + 3 * int(m_run3)); }
281};
282
283#endif // TILECONDITIONS_TILECABLINGSERVICE_H
284
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
void section(const std::string &sec)
Define macros for attributes used to control the static checker.
Helper class for offline TT identifiers.
Definition CaloLVL1_ID.h:66
static int hwid2module(int drawer)
int hwid2module_gapscin(int ros, int drawer, int channel) const
int hwid2MBTSeta(int drawer, int channel) const
static int hwid2tbtype(int drawer)
bool D4(int channel) const
void EB_special_move_channel(int ros, int drawer, int &channel) const
int frag2channels(const HWIdentifier &id, std::vector< HWIdentifier > &ids) const
static int hwid2tbmodule(int drawer, int channel)
TileCablingType m_cablingType
int MBTS2drawer_run2plus(int side, int phi, int eta) const
int getMaxGains(void) const
Identifier cell2mt_id(const Identifier &id) const
const TileHWID * getTileHWID() const
int hwid2MBTSeta_real(int ros, int drawer, int channel) const
int frag(const HWIdentifier &id) const
friend class TileCablingSvc
unsigned int getNChanPerCell(const Identifier &cell_id) const
bool isRun2PlusCabling() const
const TileTBID * m_tileTBID
std::vector< int > m_ch2index
static int hwid2section(int ros, int channel)
static bool C10_connected(int module)
int hwid2tower_gapscin(int ros, int drawer, int channel) const
Identifier h2s_cell_id_index_from_cache(int ros, int drawer, int channel, int &index, int &pmt) const
bool EB_special(int ros, int drawer) const
static const TileCablingService * getInstance()
get pointer to service instance
bool hwid2MBTSconnected_real(int ros, int drawer, int channel) const
Identifier h2s_cell_id_index_find(int ros, int drawer, int channel, int &index, int &pmt) const
const TileTBID * getTileTBID() const
int MBTS2channel_run2plus(int eta) const
friend class TileDetectorTool
int swid2channel_gapscin(int side, int module, int tower) const
static int hwid2tbchannel(int drawer, int channel)
std::vector< int > m_ch2sampleUpgradeABC
int MBTS2drawer_real(int side, int phi, int eta) const
static int tbid2drawer(int tbtype, int tbmodule)
const CaloLVL1_ID * m_TT_ID
HWIdentifier s2h_adc_id(const Identifier &id) const
int hwid2side(int ros, int channel) const
Identifier cell2tt_id(const Identifier &id) const
Identifier pmt2mt_id(const Identifier &id) const
bool is_MBTS_merged_run2plus(int module) const
Identifier drawer2MBTS_id(const HWIdentifier &id) const
const CaloLVL1_ID * getCaloLVL1_ID() const
int hwid2MBTSphi(int drawer, int channel) const
friend class TileInfoLoader
void setConnected(int section, int side, int modMin, int modMax)
friend class TileROD_Decoder
friend class TileCablingSvcMock
friend class TileDetectorFactory
bool isChannelFromOppositeSide(int channel) const
int swid2drawer_gapscin_run2plus(int side, int module, int tower) const
int barrel_chan2hole(int channel) const
void setTileHWID(const TileHWID *tileHWID)
Identifier h2s_adc_id(const HWIdentifier &id) const
void setTileTBID(const TileTBID *tileTBID)
std::vector< Identifier > m_ch2cell
int MBTS2drawer(int phi, int eta) const
int E1_merged_with_run2plus(int ros, int module) const
bool connected(int ros, int drawer) const
static int swid2drawer(int module)
std::vector< int > m_ch2pmtUpgradeABC
int hwid2MBTSphi_real(int ros, int drawer, int channel) const
int hwid2tower_upgradeABC(int ros, int channel) const
Identifier h2s_pmt_id(const HWIdentifier &id) const
int hwid2MBTSphi_run2plus(int ros, int drawer) const
int hwid2pmt(int ros, int channel) const
bool isDisconnected(int ros, int drawer, int channel) const
int hwid2tower(int ros, int channel) const
std::vector< int > m_E1mergedRun2Plus
int hwid2sample_upgradeABC(int ros, int channel) const
int extbar_chan2hole(int channel) const
int hwid2pmt_upgradeABC(int ros, int channel) const
int swid2channel_upgradeABC(int section, int side, int tower, int sample, int pmt) const
static int hwid2sample(int ros, int channel)
bool hwid2E4prconnected_run2(int ros, int drawer, int channel) const
int hwid2E4preta_run2(int drawer) const
bool isTileGapCrack(int channel) const
HWIdentifier s2h_drawer_id(const Identifier &id) const
void setConnected(int ros, int drawer, bool yes)
Identifier h2s_cell_id(const HWIdentifier &id) const
int swid2ros(int section, int side) const
void setCaloLVL1(const CaloLVL1_ID *tt_ID)
Identifier pmt2tt_id(const Identifier &id) const
int hwid2E4prphi_run2(int drawer) const
std::vector< int > m_ch2pmt
std::vector< int > m_ch2towerUpgradeABC
static TileCablingService *getInstance_nc ATLAS_NOT_THREAD_SAFE()
get (non-const) pointer to service instance
static int channel2cellindex(int ros, int channel)
std::vector< bool > m_MBTSmergedRun2Plus
const TileID * getTileID() const
int getMaxChannels(void) const
bool hwid2MBTSconnected(int ros, int drawer, int channel) const
bool hwid2MBTSconnected_run2plus(int ros, int drawer, int channel) const
int swid2channel(int section, int side, int tower, int sample, int pmt) const
Identifier h2s_cell_id_index(const HWIdentifier &id, int &index, int &pmt) const
int hwid2MBTSeta_run2plus(int ros, int drawer) const
bool TileGap_connected(const Identifier &id) const
static int tbid2channel(int drawer, int tbchannel)
int cacheIndex(int ros, int drawer, int channel) const
void setTileID(const TileID *tileID)
HWIdentifier s2h_channel_id(const Identifier &id) const
void setTestBeam(bool testBeam)
const TileHWID * m_tileHWID
int swid2drawer_gapscin(int side, int module, int tower) const
bool isTileITCGapCrack(int channel) const
bool setCablingType(TileCablingType type)
static int channel2hole(int ros, int channel)
Helper class for TileCal online (hardware) identifiers.
Definition TileHWID.h:49
Helper class for TileCal offline identifiers.
Definition TileID.h:67
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
Definition index.py:1