13 from builtins
import object
16 from PyCool
import cool
17 from CoolConvUtilities.AtlCoolLib
import indirectOpen
37 print(
"createLookup called")
40 for bcid
in range(3564):
43 for offset
in range(1,bcidRange+1):
44 checkBcid = bcid + offset
48 bcidListAfter.append(1)
50 bcidListAfter.append(0)
53 for offset
in range(1,bcidRange+1):
54 checkBcid = bcid - offset
58 bcidListBefore.append(1)
60 bcidListBefore.append(0)
64 print(
"Bg run data, Run",self.
run,
"LB",lb)
65 for bcid
in range(3564):
103 except Exception
as e:
131 print(
'loadBounchgroups called, run',run)
134 itr = bgFolder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
135 while itr.goToNext() :
137 lb=(obj.since() & 0xffff)
138 self.
runObjects[run].physicsBunchgroupBcids[lb] = []
139 bgcont = obj.payload()[
'BunchCode']
140 for bcid
in range(3564):
149 print(
'getTrainPosition called')
151 return (len(before)+1)
156 print(
'getNeighbourBcids called')
161 for bcidOffset
in range(len(before)):
162 checkBcid = bcid - (bcidOffset+1)
163 if checkBcid < 0: checkBcid += 3564
164 if before[bcidOffset]:
166 print(
"BCID",checkBcid,
"is filled")
169 for bcidOffset
in range(len(after)):
170 checkBcid = bcid + (bcidOffset+1)
171 if checkBcid > 3563: checkBcid -= 3564
172 if after[bcidOffset]:
174 print(
"BCID",checkBcid,
"is filled")
182 print(
'getNeighbourPattern called')
195 for testLb
in sorted(lbList):
196 if latestLb < 0: latestLb = testLb
197 if lb > testLb: latestLb = testLb
199 print(
"LB",lb,
"latest LB",latestLb)
202 return (self.
runObjects[run].bcidLookupBefore[latestLb][bcid], self.
runObjects[run].bcidLookupAfter[latestLb][bcid])
204 if __name__ ==
'__main__':
209 print(
"%s" % sys.argv[0])
210 print(
" --help this printout")
211 print(
" --run <runNo> run number")
212 print(
" --bcid <bcid> BCID")
213 print(
" --lb <lb> LB")
216 longopts=[
'run=',
'bcid=',
'lb=',
'help']
217 opts,args=getopt.getopt(sys.argv[1:],
'',longopts)
218 except getopt.GetoptError:
227 if o
in (
'-h',
'--help'):
237 if (run == -1
or bcid == -1
or lb == -1) :
245 l1, l2 = bg.getNeighbourBcids(run,lb,bcid)
246 print(
"Run",run,
"neighbouring filled BCIDs for BCID",bcid,
":",
sorted(l1),
sorted(l2))