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
155 int channelInSLB = -1;
158 if (block == 0 || block == 2) {
163 if (channel < lengthOfD) {
166
168 if (channelInSLB < adjacentOfD ||
169 channelInSLB >= lengthOfD - adjacentOfD) {
171 }
172 } else {
175
176 channelInSLB =
channel - lengthOfD;
177 if (channelInSLB < adjacentOfC ||
178 channelInSLB >= lengthOfC - adjacentOfC) {
180 }
181 }
182 }
183 if (block == 1 || block == 3) {
188 if (channel < lengthOfB) {
191
193 if (channelInSLB < adjacentOfB ||
194 channelInSLB >= lengthOfB - adjacentOfB) {
196 }
197 } else {
200
201 channelInSLB =
channel - lengthOfB;
202 if (channelInSLB < adjacentOfA ||
203 channelInSLB >= lengthOfA - adjacentOfA) {
205 }
206 }
207 }
208
211
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)