20 int increment = chanLast >= chanFirst ? 1 : -1;
22 if ( (
chan - chanFirst)*(
chan - chanLast) <= 0 ) {
27 counter += increment*(chanLast - chanFirst) + 1;
38 const auto&
ranges = s_stgc_channel_map.at(
pid);
44 int increment = chanLast >= chanFirst ? 1 : -1;
45 counter += increment*(chanLast - chanFirst) + 1;
60 const auto&
ranges = s_stgc_channel_map.at(
pid);
66 int increment = chanLast >= chanFirst ? 1 : -1;
67 int nchan = increment*(chanLast - chanFirst) + 1;
70 int chan = chanFirst + increment*(AB_channel -
counter);
85 if(mod_radius>0) {elink = 0;
return true;}
87 if(!vmm_info (
channel_type, sector_type, mod_radius,
layer, channel_number, vmm, vmm_chan))
return false;
89 if(geoVmmToRocVmm(vmm) < 4){
97 if(geoVmmToRocVmm(vmm)==2){
113 constexpr
uint16_t vmmRemap[8] = { 2, 3, 0, 1, 5, 4, 6, 7 };
114 return vmmRemap[VMM];
123 if (channel_number == 0)
return channel_number;
129 bool isPivot = (sector_type == 0)^(
layer < 4);
130 if (isPivot) channel_number = nchannels(
channel_type, sector_type, feb_radius,
layer) - channel_number + 1;
137 std::pair<uint16_t, uint16_t> pad_grid = s_stgc_pad_grid.at(
pid);
139 uint16_t padRow_AB = (channel_number - 1)/pad_grid.second + 1;
140 uint16_t padCol_AB = (channel_number - 1)%pad_grid.second + 1;
141 uint16_t padRow_ATH = pad_grid.first - padRow_AB + 1;
142 uint16_t padCol_ATH = (
layer%2==0) ? pad_grid.second - padCol_AB + 1 : padCol_AB;
145 channel_number = (padCol_ATH - 1)*18 + padRow_ATH;
148 return channel_number;
158 if (channel_number == 0)
return channel_number;
164 bool isPivot = (sector_type == 0)^(
layer < 4);
165 if (isPivot) channel_number = nchannels(
channel_type, sector_type, feb_radius,
layer) - channel_number + 1;
172 std::pair<uint16_t, uint16_t> pad_grid = s_stgc_pad_grid.at(
pid);
175 uint16_t padRow_ATH = (channel_number - 1)%18 + 1;
176 uint16_t padCol_ATH = (channel_number - 1)/18 + 1;
177 uint16_t padRow_AB = pad_grid.first - padRow_ATH + 1;
178 uint16_t padCol_AB = (
layer%2==0) ? pad_grid.second - padCol_ATH + 1 : padCol_ATH;
180 channel_number = (padRow_AB - 1)*pad_grid.second + padCol_AB;
183 return channel_number;
193 if (channel_number == 0)
return channel_number;
200 if (!
sideA) channel_number = nchannels(
channel_type, sector_type, feb_radius,
layer) - channel_number + 1;
207 std::pair<uint16_t, uint16_t> pad_grid = s_stgc_pad_grid.at(
pid);
209 uint16_t padRow = (channel_number - 1)/pad_grid.second + 1;
210 uint16_t padCol_NSW = (channel_number - 1)%pad_grid.second + 1;
211 uint16_t padCol_ATH = (
sideA) ? pad_grid.second - padCol_NSW + 1 : padCol_NSW;
214 channel_number = (padCol_ATH - 1)*18 + padRow;
217 return channel_number;
227 if (channel_number == 0)
return channel_number;
234 if (!
sideA) channel_number = nchannels(
channel_type, sector_type, feb_radius,
layer) - channel_number + 1;
241 std::pair<uint16_t, uint16_t> pad_grid = s_stgc_pad_grid.at(
pid);
244 uint16_t padRow = (channel_number - 1)%18 + 1;
245 uint16_t padCol_ATH = (channel_number - 1)/18 + 1;
246 uint16_t padCol_NSW = (
sideA) ? pad_grid.second - padCol_ATH + 1 : padCol_ATH;
247 channel_number = (padRow - 1)*pad_grid.second + padCol_NSW;
250 return channel_number;