ATLAS Offline Software
Loading...
Searching...
No Matches
MuonTGC_Cabling::TGCCableInASD Class Reference

#include <TGCCableInASD.h>

Inheritance diagram for MuonTGC_Cabling::TGCCableInASD:
Collaboration diagram for MuonTGC_Cabling::TGCCableInASD:

Public Types

enum  CableType {
  NoCableType = -1 , InASD , ASDToPP , InPP ,
  PPToSLB , InSLB , SLBToHPB , HPBToSL ,
  SLBToSSW , SSWToROD , MaxCableType
}

Public Member Functions

 TGCCableInASD (const std::string &filename)
virtual ~TGCCableInASD ()
std::unique_ptr< TGCChannelIdgetChannel (const TGCChannelId &channelId, bool orChannel=false) const
CableType getCableType () const

Private Member Functions

std::unique_ptr< TGCChannelIdgetChannelIn (const TGCChannelId &asdout, bool orChannel=false) const
std::unique_ptr< TGCChannelIdgetChannelOut (const TGCChannelId &asdin, bool orChannel=false) const

Private Attributes

std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxModuleType >, TGCId::MaxRegionTypem_database
CableType m_type {CableType::NoCableType}

Detailed Description

Definition at line 18 of file TGCCableInASD.h.

Member Enumeration Documentation

◆ CableType

Enumerator
NoCableType 
InASD 
ASDToPP 
InPP 
PPToSLB 
InSLB 
SLBToHPB 
HPBToSL 
SLBToSSW 
SSWToROD 
MaxCableType 

Definition at line 16 of file TGCCable.h.

Constructor & Destructor Documentation

◆ TGCCableInASD()

MuonTGC_Cabling::TGCCableInASD::TGCCableInASD ( const std::string & filename)

Definition at line 14 of file TGCCableInASD.cxx.

15 : TGCCable(TGCCable::InASD), m_database{{{nullptr}}} {
17 std::make_unique<TGCDatabaseASDToPP>(filename, "EWD");
19 std::make_unique<TGCDatabaseASDToPP>(filename, "EWT");
21 std::make_unique<TGCDatabaseASDToPP>(filename, "ESD");
23 std::make_unique<TGCDatabaseASDToPP>(filename, "EST");
25 std::make_unique<TGCDatabaseASDToPP>(filename, "EWI");
27 std::make_unique<TGCDatabaseASDToPP>(filename, "ESI");
29 std::make_unique<TGCDatabaseASDToPP>(filename, "FWD");
31 std::make_unique<TGCDatabaseASDToPP>(filename, "FWT");
33 std::make_unique<TGCDatabaseASDToPP>(filename, "FSD");
35 std::make_unique<TGCDatabaseASDToPP>(filename, "FST");
37 std::make_unique<TGCDatabaseASDToPP>(filename, "FWI");
39 std::make_unique<TGCDatabaseASDToPP>(filename, "FSI");
40}
std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxModuleType >, TGCId::MaxRegionType > m_database
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:31

◆ ~TGCCableInASD()

MuonTGC_Cabling::TGCCableInASD::~TGCCableInASD ( )
virtualdefault

Member Function Documentation

◆ getCableType()

CableType MuonTGC_Cabling::TGCCable::getCableType ( ) const
inlineinherited

Definition at line 34 of file TGCCable.h.

34{ return m_type; }

◆ getChannel()

std::unique_ptr< TGCChannelId > MuonTGC_Cabling::TGCCableInASD::getChannel ( const TGCChannelId & channelId,
bool orChannel = false ) const

Definition at line 44 of file TGCCableInASD.cxx.

45 {
46 if (channelId.getChannelIdType() == TGCChannelId::ChannelIdType::ASDIn) {
47 return getChannelOut(channelId, orChannel);
48 }
49 if (channelId.getChannelIdType() == TGCChannelId::ChannelIdType::ASDOut) {
50 return getChannelIn(channelId, orChannel);
51 }
52
53 return nullptr;
54}
std::unique_ptr< TGCChannelId > getChannelOut(const TGCChannelId &asdin, bool orChannel=false) const
std::unique_ptr< TGCChannelId > getChannelIn(const TGCChannelId &asdout, bool orChannel=false) const

◆ getChannelIn()

std::unique_ptr< TGCChannelId > MuonTGC_Cabling::TGCCableInASD::getChannelIn ( const TGCChannelId & asdout,
bool orChannel = false ) const
private

Definition at line 56 of file TGCCableInASD.cxx.

57 {
58 if (orChannel || !asdout.isValid()) {
59 return nullptr;
60 }
61
62 TGCDatabase* databaseP =
63 m_database[asdout.getRegionType()][asdout.getModuleType()].get();
64
65 // sector ASDIn [1..48, 1..24], ASDOut [0..47, 0..23]
66 int sector;
67 if (asdout.isEndcap() && !asdout.isInner()) {
68 sector = asdout.getSector() - 1;
69 if (sector <= 0) {
71 }
72 } else {
73 sector = asdout.getSector();
74 if (sector <= 0) {
76 }
77 }
78
79 // chamber ASDIn [1(F),1,2,3,4,5(E)], ASDOut [0(F),4,3,2,1,0(E)]
80 int chamber;
81 if (asdout.isEndcap() && !asdout.isInner()) {
82 chamber = 5 - asdout.getChamber();
83 } else {
84 chamber = asdout.getChamber() + 1;
85 }
86
87 int channel = -1;
88 // channel ASDIn [1..32(S),1..n(W chamber)], ASDOut [0..31(S),n..0(W
89 // sector)]
90 if (asdout.isWire()) {
91 // Endcap Triplet chamberId start from 1 in ASDOut
92 int dbChamber = asdout.getChamber();
93 if (asdout.isEndcap() && asdout.isTriplet()) {
94 dbChamber = dbChamber - 1;
95 }
96 int indexIn[TGCDatabaseASDToPP::NIndexIn] = {
97 asdout.getLayer(), dbChamber, asdout.getChannel()};
98 int i = databaseP->getIndexDBIn(indexIn);
99 if (i < 0) {
100 return nullptr;
101 }
102 channel = databaseP->getEntry(i, 7) + 1;
103 } else {
104 if ((asdout.isBackward() && asdout.isAside()) ||
105 (!asdout.isBackward() && asdout.isCside())) {
106 channel = 32 - asdout.getChannel();
107 } else {
108 channel = asdout.getChannel() + 1;
109 }
110 }
111 if (channel == -1) {
112 return nullptr;
113 }
114
115 return std::make_unique<TGCChannelASDIn>(
116 asdout.getSideType(), asdout.getSignalType(), asdout.getRegionType(),
117 sector, asdout.getLayer(), chamber, channel);
118}
static constexpr int NUM_ENDCAP_SECTOR
Definition TGCId.h:41
static constexpr int NUM_FORWARD_SECTOR
Definition TGCId.h:42

◆ getChannelOut()

std::unique_ptr< TGCChannelId > MuonTGC_Cabling::TGCCableInASD::getChannelOut ( const TGCChannelId & asdin,
bool orChannel = false ) const
private

Definition at line 120 of file TGCCableInASD.cxx.

121 {
122 if (orChannel || asdin.isValid() == false) {
123 return nullptr;
124 }
125
126 const bool asdinisEndcap = asdin.isEndcap();
127 const bool asdinisTriplet = asdin.isTriplet();
128 const int asdinLayer = asdin.getLayer();
129 const int asdinChannel = asdin.getChannel();
130
131 TGCDatabase* databaseP =
132 m_database[asdin.getRegionType()][asdin.getModuleType()].get();
133
134 if (!databaseP) {
135 return nullptr;
136 }
137 // sector ASDIn [1..48, 1..24], ASDOut [2..47.0.1, 1..23.0]
138 int sector{0};
139 if (asdin.isEndcap()) {
140 if (!asdin.isInner()) {
141 // Endcap
142 sector = (asdin.getSector() + 1) % TGCId::NUM_ENDCAP_SECTOR;
143 } else {
144 // EI
145 sector = (asdin.getSector()) % TGCId::NUM_INNER_SECTOR;
146 }
147 } else {
148 if (!asdin.isInner()) {
149 // Forward
150 sector = (asdin.getSector()) % TGCId::NUM_FORWARD_SECTOR;
151 } else {
152 // FI
153 sector = (asdin.getSector()) % TGCId::NUM_INNER_SECTOR;
154 }
155 }
156
157 // chamber ASDIn [1(F),1,2,3,4,5(E)], ASDOut [0(F),4,3,2,1,0(E)]
158 int chamber{0};
159 if (asdin.isEndcap() && !asdin.isInner()) {
160 chamber = 5 - asdin.getChamber();
161 } else {
162 chamber = asdin.getChamber() - 1;
163 }
164
165 int channel = -1;
166 // channel ASDIn [1..32(S),1..n(W chamber)], ASDOut [0..31(S),n..0(W
167 // sector)]
168 if (asdin.isWire()) {
169 const int MaxEntry = databaseP->getMaxEntry();
170 for (int i = 0; i < MaxEntry; i++) {
171 // Endcap Triplet chamberId start from 1 in ASDOut
172 int dbChamber = chamber;
173 if (asdinisEndcap && asdinisTriplet) {
174 dbChamber = dbChamber - 1;
175 }
176
177 int dbChannel = asdinChannel - 1;
178 if (databaseP->getEntry(i, 7) == dbChannel &&
179 databaseP->getEntry(i, 1) == dbChamber &&
180 databaseP->getEntry(i, 0) == asdinLayer) {
181 channel = databaseP->getEntry(i, 6);
182 break;
183 }
184 }
185 } else {
186 // asdin.isBackward() can not be used because this method rely on
187 // sector number for asdout
188 bool is_Backward = false;
189 if (asdin.isEndcap()) {
190 if (!asdin.isInner()) {
191 if (asdin.isAside()) {
192 is_Backward = (sector % 2 == 1);
193 } else {
194 is_Backward = (sector % 2 == 0);
195 }
196 } else {
197 // EI
198 // Special case of EI11
199 if (sector == 15) {
200 if (asdin.isAside()) {
201 is_Backward = false;
202 } else {
203 is_Backward = true;
204 }
205 } else if (sector == 16) {
206 if (asdin.isAside()) {
207 is_Backward = true;
208 } else {
209 is_Backward = false;
210 }
211 } else {
212 // A-side phi0 F: phi1 F: phi2 B
213 // C-side phi0 B: phi1 B: phi2 F
214 if (asdin.isAside()) {
215 is_Backward = (sector % 3 == 2);
216 } else {
217 is_Backward = (sector % 3 != 2);
218 }
219 }
220 }
221 } else {
222 if (asdin.isAside()) {
223 is_Backward = true; // All Backward for A-side
224 }
225 }
226 if ((is_Backward && asdin.isAside()) ||
227 (!is_Backward && asdin.isCside())) {
228 channel = 32 - asdin.getChannel();
229 } else {
230 channel = asdin.getChannel() - 1;
231 }
232 }
233 if (channel == -1) {
234 return nullptr;
235 }
236
237 return std::make_unique<TGCChannelASDOut>(
238 asdin.getSideType(), asdin.getSignalType(), asdin.getRegionType(),
239 sector, asdin.getLayer(), chamber, channel);
240}
static constexpr int NUM_INNER_SECTOR
Definition TGCId.h:43

Member Data Documentation

◆ m_database

std::array<std::array<std::unique_ptr<TGCDatabase>, TGCId::MaxModuleType>, TGCId::MaxRegionType> MuonTGC_Cabling::TGCCableInASD::m_database
private

Definition at line 33 of file TGCCableInASD.h.

◆ m_type

CableType MuonTGC_Cabling::TGCCable::m_type {CableType::NoCableType}
privateinherited

Definition at line 37 of file TGCCable.h.


The documentation for this class was generated from the following files: