13 using std::ostringstream;
27 static std::vector<Index> apas = {3, 5, 2, 6, 1, 4};
29 return itps < apas.size() ? apas[itps] : 0;
36 return (chanOn%2560)/128 + 1;
43 return (chanOn%128)/16 + 1;
56 const string myname =
"ProtoduneChannelHelper::get: ";
57 static bool init =
false;
58 static Index nwirPlane[4] = {800, 800, 480, 480};
59 static Index nwirFemb[4] = {40, 40, 48, 48};
64 if ( dbg ) cout << myname <<
"Initializing FEMB channel map." <<
endl;
205 if ( val != 128 ) abort();
207 if ( chanOff >= 15360 ) {
208 if ( dbg ) cout << myname <<
"Invalid offline channel: " << chanOff <<
endl;
212 Index itps = chanOff/2560;
214 Index ichApa = chanOff%2560;
217 Index ichPla = ichApa;
218 while ( ichPla >= nwirPlane[ipla] ) {
219 ichPla -= nwirPlane[ipla];
223 Index ifmbApa = ichPla/nwirFemb[ipla];
225 ifmbApa = (ifmbApa + 10) % 20;
226 }
else if ( ipla == 1 ) {
227 ifmbApa = 19 - ifmbApa;
228 }
else if ( ipla == 2 ) {
229 ifmbApa = 19 - ifmbApa;
232 Index ifmbDet = 20*itps + ifmbApa;
234 Index iwchFemb = ichPla % nwirFemb[ipla];
235 if ( iwchFemb > nwirFemb[ipla] ) {
236 if ( dbg > 1 ) cout << myname <<
"ERROR: Invalid FEMB channel: " << chanOff
237 <<
" --> " << iwchFemb <<
endl;
243 if ( ipla == 0 || ipla == 3 ) iwchFemb = nwirFemb[ipla] - 1 - iwchFemb;
245 Index ichFemb = ipla == 0 ? uch[iwchFemb] :
246 ipla == 1 ? vch[iwchFemb] :
249 Index ichOn = 128*ifmbDet + ichFemb;
266 ssout << iapa << (ifmb < 10 ?
"0" :
"") << ifmb
267 <<
"-" << iasc << (iach<10 ?
"0" :
"") << iach;
static Index onlineChannel(Index chanOff, Index dbg=0)
Name asicChannelName(Index icha) const
ChannelGroupService::Name Name
ProtoduneChannelHelper(bool isOff)
static Index femb(Index chan, bool isOff)
static Index asicChannel(Index chan, bool isOff)
static Index apa(Index chan, bool isOff)
static Index asic(Index chan, bool isOff)
static Index tpcSet(Index chan, bool isOff)
QTextStream & endl(QTextStream &s)