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

#include <TGCCableInPP.h>

Inheritance diagram for MuonTGC_Cabling::TGCCableInPP:
Collaboration diagram for MuonTGC_Cabling::TGCCableInPP:

Public Types

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

Public Member Functions

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

Private Member Functions

 TGCCableInPP ()=delete
std::unique_ptr< TGCChannelIdgetChannelIn (const TGCChannelId &ppout, const bool orChannel=false) const
std::unique_ptr< TGCChannelIdgetChannelOut (const TGCChannelId &ppin, const 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 19 of file TGCCableInPP.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

◆ TGCCableInPP() [1/2]

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

Definition at line 15 of file TGCCableInPP.cxx.

16 : TGCCable(TGCCable::InPP), m_database{{{nullptr}}} {
18 std::make_unique<TGCDatabaseInPP>(filename, "EWD");
20 std::make_unique<TGCDatabaseInPP>(filename, "EWT");
22 std::make_unique<TGCDatabaseInPP>(filename, "ESD");
24 std::make_unique<TGCDatabaseInPP>(filename, "EST");
26 std::make_unique<TGCDatabaseInPP>(filename, "EWI");
28 std::make_unique<TGCDatabaseInPP>(filename, "ESI");
30 std::make_unique<TGCDatabaseInPP>(filename, "FWD");
32 std::make_unique<TGCDatabaseInPP>(filename, "FWT");
34 std::make_unique<TGCDatabaseInPP>(filename, "FSD");
36 std::make_unique<TGCDatabaseInPP>(filename, "FST");
38 std::make_unique<TGCDatabaseInPP>(filename, "FWI");
40 std::make_unique<TGCDatabaseInPP>(filename, "FSI");
41}
std::array< std::array< std::unique_ptr< TGCDatabase >, TGCId::MaxModuleType >, TGCId::MaxRegionType > m_database
TGCCable(CableType type=NoCableType)
Definition TGCCable.h:31

◆ ~TGCCableInPP()

MuonTGC_Cabling::TGCCableInPP::~TGCCableInPP ( )
virtualdefault

◆ TGCCableInPP() [2/2]

MuonTGC_Cabling::TGCCableInPP::TGCCableInPP ( )
privatedelete

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::TGCCableInPP::getChannel ( const TGCChannelId & channelId,
const bool orChannel = false ) const

Definition at line 45 of file TGCCableInPP.cxx.

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

◆ getChannelIn()

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

Definition at line 56 of file TGCCableInPP.cxx.

57 {
58 if (ppout.isValid() == false) {
59 return nullptr;
60 }
61
62 TGCId::ModuleType moduleType = ppout.getModuleType();
63
64 int ndatabaseP = 1;
65 TGCDatabase* databaseP[2];
66 databaseP[0] = m_database[ppout.getRegionType()][moduleType].get();
67 // EI/FI
68 // wire(TGCId::WI) and strip(TGCId::SI) of a chamber
69 // use the same SLB chip
70 // The SLB chip is treated as TGCId::WI in TGCCableSLBToSSW.cxx
71 if (moduleType == TGCId::WI) {
72 databaseP[1] = m_database[ppout.getRegionType()][TGCId::SI].get();
73 ndatabaseP = 2;
74 }
75
76 int id = -1, block = -1, channel = -1;
77 bool found = false;
78
79 for (int idatabaseP = 0; idatabaseP < ndatabaseP; idatabaseP++) {
80 // EI/FI
81 // wire(TGCId::WI) and strip(TGCId::SI) of a chamber
82 // use the same SLB chip
83 // The SLB chip is treated as TGCId::WI in TGCCableSLBToSSW.cxx
84 if (idatabaseP == 1) {
85 moduleType = TGCId::SI;
86 }
87
88 int indexIn[TGCDatabaseInPP::NIndexIn] = {
89 ppout.getId(), ppout.getBlock(), ppout.getChannel()};
90 int i = databaseP[idatabaseP]->getIndexDBIn(indexIn);
91 if (i < 0) {
92 continue;
93 }
94
95 if (orChannel == false) {
96 // first channel
97 id = databaseP[idatabaseP]->getEntry(i, 3);
98 block = databaseP[idatabaseP]->getEntry(i, 4);
99 channel = databaseP[idatabaseP]->getEntry(i, 5);
100 if (id == -1 && block == -1 && channel == -1) {
101 continue;
102 }
103 found = true;
104 break;
105 } else {
106 // ored channel
107 if (databaseP[idatabaseP]->getEntrySize(i) == 9) {
108 id = databaseP[idatabaseP]->getEntry(i, 6);
109 block = databaseP[idatabaseP]->getEntry(i, 7);
110 channel = databaseP[idatabaseP]->getEntry(i, 8);
111 found = true;
112 }
113 }
114 }
115
116 if (!found) {
117 return nullptr;
118 }
119
120 return std::make_unique<TGCChannelPPIn>(
121 ppout.getSideType(), moduleType, ppout.getRegionType(),
122 ppout.getSector(), id, block, channel);
123}

◆ getChannelOut()

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

Definition at line 125 of file TGCCableInPP.cxx.

126 {
127 if (ppin.isValid() == false) {
128 return nullptr;
129 }
130
131 const int ppinChannel = ppin.getChannel();
132 const int ppinBlock = ppin.getBlock();
133 const int ppinId = ppin.getId();
134
135 TGCDatabase* databaseP =
136 m_database[ppin.getRegionType()][ppin.getModuleType()].get();
137
138 const int MaxEntry = databaseP->getMaxEntry();
139 for (int i = 0; i < MaxEntry; i++) {
140 bool cond1 = (databaseP->getEntry(i, 5) == ppinChannel) &&
141 (databaseP->getEntry(i, 4) == ppinBlock) &&
142 (databaseP->getEntry(i, 3) == ppinId);
143
144 bool cond2 = (databaseP->getEntrySize(i) == 9) &&
145 (databaseP->getEntry(i, 8) == ppinChannel) &&
146 (databaseP->getEntry(i, 7) == ppinBlock) &&
147 (databaseP->getEntry(i, 6) == ppinId);
148
149 if (cond1 || cond2) {
150 int id = databaseP->getEntry(i, 0);
151 int block = databaseP->getEntry(i, 1);
152 int channel = databaseP->getEntry(i, 2);
153
154 // TGCChannelSLBIn::CellType cellType = TGCChannelSLBIn::NoCellType;
155 int channelInSLB = -1;
156 bool adjacent = false;
157 TGCId::ModuleType moduleType = ppin.getModuleType();
158 if (block == 0 || block == 2) { // C,D
159 int lengthOfC = TGCChannelSLBIn::getLengthOfSLB(
160 moduleType, TGCChannelSLBIn::CellC);
161 int lengthOfD = TGCChannelSLBIn::getLengthOfSLB(
162 moduleType, TGCChannelSLBIn::CellD);
163 if (channel < lengthOfD) {
164 int adjacentOfD = TGCChannelSLBIn::getAdjacentOfSLB(
165 moduleType, TGCChannelSLBIn::CellD);
166 // cellType = TGCChannelSLBIn::CellD;
167 channelInSLB = channel;
168 if (channelInSLB < adjacentOfD ||
169 channelInSLB >= lengthOfD - adjacentOfD) {
170 adjacent = true;
171 }
172 } else {
173 int adjacentOfC = TGCChannelSLBIn::getAdjacentOfSLB(
174 moduleType, TGCChannelSLBIn::CellC);
175 // cellType = TGCChannelSLBIn::CellC;
176 channelInSLB = channel - lengthOfD;
177 if (channelInSLB < adjacentOfC ||
178 channelInSLB >= lengthOfC - adjacentOfC) {
179 adjacent = true;
180 }
181 }
182 }
183 if (block == 1 || block == 3) { // A,B
184 int lengthOfA = TGCChannelSLBIn::getLengthOfSLB(
185 moduleType, TGCChannelSLBIn::CellA);
186 int lengthOfB = TGCChannelSLBIn::getLengthOfSLB(
187 moduleType, TGCChannelSLBIn::CellB);
188 if (channel < lengthOfB) {
189 int adjacentOfB = TGCChannelSLBIn::getAdjacentOfSLB(
190 moduleType, TGCChannelSLBIn::CellB);
191 // cellType = TGCChannelSLBIn::CellB;
192 channelInSLB = channel;
193 if (channelInSLB < adjacentOfB ||
194 channelInSLB >= lengthOfB - adjacentOfB) {
195 adjacent = true;
196 }
197 } else {
198 int adjacentOfA = TGCChannelSLBIn::getAdjacentOfSLB(
199 moduleType, TGCChannelSLBIn::CellA);
200 // cellType = TGCChannelSLBIn::CellA;
201 channelInSLB = channel - lengthOfB;
202 if (channelInSLB < adjacentOfA ||
203 channelInSLB >= lengthOfA - adjacentOfA) {
204 adjacent = true;
205 }
206 }
207 }
208
209 if ((moduleType == TGCId::SD) &&
210 (ppin.getRegionType() == TGCId::Endcap)) {
211 // Strips of Middle doublets are ORed to the adjacent chamber
212 adjacent = cond2;
213 }
214
215 if (adjacent == orChannel) {
216 return std::make_unique<TGCChannelPPOut>(
217 ppin.getSideType(), ppin.getModuleType(),
218 ppin.getRegionType(), ppin.getSector(), id, block, channel);
219 break;
220 }
221 }
222 }
223
224 return nullptr;
225}
static int getAdjacentOfSLB(TGCId::ModuleType moduleType, CellType cellType)
static int getLengthOfSLB(TGCId::ModuleType moduleType, CellType cellType)
bool adjacent(unsigned int strip1, unsigned int strip2)

Member Data Documentation

◆ m_database

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

Definition at line 36 of file TGCCableInPP.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: