89 if operator.isNumberType(gainList): gains = [gainList]
92 print(
"LArCondContChannels.folderFeedThruGroupChanSel: invalid gain value - must be 0-2 - ", g)
93 return "<channelSelection> </channelSelection>"
95 if feedThruGroup ==
"negBarrel":
102 elif feedThruGroup ==
"posBarrel":
109 elif feedThruGroup ==
"negEndcap":
116 elif feedThruGroup ==
"posEndcap":
124 print(
"LArCondContChannels.folderFeedThruGroupChanSel: feedThru grouping, found", feedThruGroup)
125 print(
"Allowed values: \"negBarrel\", \"posBarrel\", \"negEndcap\", \"posEndcap\"")
126 return "<channelSelection> </channelSelection>"
163 if len(negB_FTList) == 0
and \
164 len(posB_FTList) == 0
and \
165 len(negEC_FTList) == 0
and \
166 len(posEC_FTList) == 0:
168 print(
"LArCondContChannels.folderFeedThruChannelSelection Warning: FeedThru lists are all empty - no channels selected")
170 elif len(gainList) == 0:
171 print(
"LArCondContChannels.folderFeedThruChannelSelection Warning: Gain list is empty - no channels selected")
173 if len(negB_FTList) > 0:
180 if len(posB_FTList) > 0:
187 if len(negEC_FTList) > 0:
194 if len(posEC_FTList) > 0:
202 print(
"chans ",chans)
219 if len(negB_FTList) == 0
and \
220 len(posB_FTList) == 0
and \
221 len(negEC_FTList) == 0
and \
222 len(posEC_FTList) == 0:
224 print(
"LArCondContChannels.folderFeedThruChannelSelection Warning: FeedThru lists are all empty - no channels selected")
226 elif len(gainList) == 0:
227 print(
"LArCondContChannels.folderFeedThruChannelSelection Warning: Gain list is empty - no channels selected")
229 if len(negB_FTList) > 0:
236 if len(posB_FTList) > 0:
243 if len(negEC_FTList) > 0:
250 if len(posEC_FTList) > 0:
258 print(
"chans ",chans)
286 if operator.isNumberType(feedThruList): fts = [feedThruList]
288 if operator.isNumberType(gainList): gains = [gainList]
291 if posNeg != -1
and posNeg != +1:
293 raise RuntimeError (__name__ +
"posNeg must be either +/-1, found: " +
str(posNeg))
316 chans += [ft + offset1]
331 if operator.isNumberType(feedThruList): fts = [feedThruList]
333 if operator.isNumberType(gainList): gains = [gainList]
336 if posNeg != -1
and posNeg != +1:
338 raise RuntimeError (__name__ +
"posNeg must be either +/-1, found: " +
str(posNeg))
366 chans += [ft + offset1]
367 chans += [ft + offset1PS]
370 if (posNeg == -1
and ft==3):
372 if (posNeg == -1
and ft==10):
373 chans+=[230+3+gain*self.ChannelsPerGain]
374 if (posNeg == -1
and ft==16):
375 chans+=[232+3+gain*self.ChannelsPerGain]
376 if (posNeg == -1
and ft==22):
377 chans+=[234+3+gain*self.ChannelsPerGain]
378 if (posNeg == 1
and ft==3):
379 chans+=[229+3+gain*self.ChannelsPerGain]
380 if (posNeg == 1
and ft==10):
381 chans+=[231+3+gain*self.ChannelsPerGain]
382 if (posNeg == 1
and ft==16):
383 chans+=[233+3+gain*self.ChannelsPerGain]
384 if (posNeg == 1
and ft==22):
385 chans+=[235+3+gain*self.ChannelsPerGain]
399 chanSel =
"<channelSelection>"
407 chanSel +=
"</channelSelection>"
416 print(
"invalid gain: range in 0 to",self.nGain-1)
419 if subDetName ==
"Corr":
421 elif subDetName ==
"EMB":
423 elif subDetName ==
"EMEC":
425 elif subDetName ==
"HEC":
427 elif subDetName ==
"FCAL":
452 return (isBarrel, posNeg, feedThru, gain)
475 return (isBarrel, posNeg, feedThru, gain)
487 return (isBarrel, posNeg, feedThru, gain)
508 elif chanNum < self.
nFTAcc:
527 elif chanNum < self.
nFTPS:
532 elif chanNum == 228+3:
536 elif chanNum == 229+3:
540 elif chanNum == 230+3:
544 elif chanNum == 231+3:
548 elif chanNum == 232+3:
552 elif chanNum == 233+3:
556 elif chanNum == 234+3:
560 elif chanNum == 235+3:
569 return (isBarrel, posNeg, feedThru, gain)
593 chanSD = chanSD - gain*self.
nSubDets
603 return (subDet, gain)
615 if __name__ ==
'__main__':
620 print(
"0 - unknown", decoder.isUnknown(0),
"SG", decoder.isSingleGroup(0),
"SDG",decoder.isSubDetectorGrouping(0),
"FT",decoder.isFeedThroughGrouping(0))
621 print(
"1 - unknown", decoder.isUnknown(1),
"SG", decoder.isSingleGroup(1),
"SDG",decoder.isSubDetectorGrouping(1),
"FT",decoder.isFeedThroughGrouping(1))
622 print(
"2 - unknown", decoder.isUnknown(2),
"SG", decoder.isSingleGroup(2),
"SDG",decoder.isSubDetectorGrouping(2),
"FT",decoder.isFeedThroughGrouping(2))
623 print(
"3 - unknown", decoder.isUnknown(3),
"SG", decoder.isSingleGroup(3),
"SDG",decoder.isSubDetectorGrouping(3),
"FT",decoder.isFeedThroughGrouping(3))
628 ftList_bp = [1,19,25,31]
629 ftList_bn = [0,18,24,30]
631 ftList_ecp = [1,19,24]
632 ftList_ecn = [0,18,23]
635 print(
" ====== CHECKS FOR FEEDTHROUGHGROUPING ====== ")
637 for gain
in range(3):
640 chans += decoder.feedThruChannelSelection(ftList_bn, gainList, -1)
641 chans += decoder.feedThruChannelSelection(ftList_bp, gainList, 1)
642 chans += decoder.feedThruChannelSelection(ftList_ecn, gainList, -1,
False)
643 chans += decoder.feedThruChannelSelection(ftList_ecp, gainList, 1,
False)
645 print(
"ft list b neg: ", ftList_bn)
646 print(
"ft list b pos: ", ftList_bp)
647 print(
"ft list ec neg: ", ftList_ecn)
648 print(
"ft list ec pos: ", ftList_ecp)
649 print(
"gain, chans: ", gainList, chans)
651 chanSel = decoder.folderFeedThruChannelSelection(ftList_bn,
659 (isBarrel, posNeg, feedThru, gain) = decoder.decodeFeedThruChannelNumber(chan)
660 print(
"chan, isBarrel, posNeg, feedThru, gain",chan, isBarrel, posNeg, feedThru, gain)
664 for chan
in range(15):
665 (detName, gain) = decoder.decodeSubDetChannelNumber(chan)
666 chan1 = decoder.subDetChannelSelection(detName, gain)
667 print(
"chan, detName, gain, and chan recalc", chan, detName, gain, chan1)
670 print(
" ====== CHECKS FOR EXTENDED FEEDTHROUGHGROUPING ====== ")
671 for gain
in range(3):
674 chans += decoder.extFeedThruChannelSelection(ftList_bn, gainList, -1)
675 chans += decoder.extFeedThruChannelSelection(ftList_bp, gainList, 1)
676 chans += decoder.extFeedThruChannelSelection(ftList_ecn, gainList, -1,
False)
677 chans += decoder.extFeedThruChannelSelection(ftList_ecp, gainList, 1,
False)
679 print(
"ft list b neg: ", ftList_bn)
680 print(
"ft list b pos: ", ftList_bp)
681 print(
"ft list ec neg: ", ftList_ecn)
682 print(
"ft list ec pos: ", ftList_ecp)
683 print(
"gain, chans: ", gainList, chans)
685 chanSel = decoder.folderExtFeedThruChannelSelection(ftList_bn,
693 (isBarrel, posNeg, feedThru, gain) = decoder.decodeExtFeedThruChannelNumber(chan)
694 print(
"chan, isBarrel, posNeg, feedThru, gain",chan, isBarrel, posNeg, feedThru, gain)