13 from __future__
import print_function
14 from builtins
import range
15 from builtins
import object
18 from PyCool
import cool
19 from CoolConvUtilities.AtlCoolLib
import indirectOpen
39 print(
"createLookup called")
42 for bcid
in range(3564):
45 for offset
in range(1,bcidRange+1):
46 checkBcid = bcid + offset
50 bcidListAfter.append(1)
52 bcidListAfter.append(0)
55 for offset
in range(1,bcidRange+1):
56 checkBcid = bcid - offset
60 bcidListBefore.append(1)
62 bcidListBefore.append(0)
66 print(
"Bg run data, Run",self.
run,
"LB",lb)
67 for bcid
in range(3564):
105 except Exception
as e:
133 print(
'loadBounchgroups called, run',run)
136 itr = bgFolder.browseObjects(run << 32,(run+1) << 32,cool.ChannelSelection.all())
137 while itr.goToNext() :
139 lb=(obj.since() & 0xffff)
140 self.
runObjects[run].physicsBunchgroupBcids[lb] = []
141 bgcont = obj.payload()[
'BunchCode']
142 for bcid
in range(3564):
151 print(
'getTrainPosition called')
153 return (len(before)+1)
158 print(
'getNeighbourBcids called')
163 for bcidOffset
in range(len(before)):
164 checkBcid = bcid - (bcidOffset+1)
165 if checkBcid < 0: checkBcid += 3564
166 if before[bcidOffset]:
168 print(
"BCID",checkBcid,
"is filled")
171 for bcidOffset
in range(len(after)):
172 checkBcid = bcid + (bcidOffset+1)
173 if checkBcid > 3563: checkBcid -= 3564
174 if after[bcidOffset]:
176 print(
"BCID",checkBcid,
"is filled")
184 print(
'getNeighbourPattern called')
197 for testLb
in sorted(lbList):
198 if latestLb < 0: latestLb = testLb
199 if lb > testLb: latestLb = testLb
201 print(
"LB",lb,
"latest LB",latestLb)
204 return (self.
runObjects[run].bcidLookupBefore[latestLb][bcid], self.
runObjects[run].bcidLookupAfter[latestLb][bcid])
206 if __name__ ==
'__main__':
211 print(
"%s" % sys.argv[0])
212 print(
" --help this printout")
213 print(
" --run <runNo> run number")
214 print(
" --bcid <bcid> BCID")
215 print(
" --lb <lb> LB")
218 longopts=[
'run=',
'bcid=',
'lb=',
'help']
219 opts,args=getopt.getopt(sys.argv[1:],
'',longopts)
220 except getopt.GetoptError:
229 if o
in (
'-h',
'--help'):
239 if (run == -1
or bcid == -1
or lb == -1) :
247 l1, l2 = bg.getNeighbourBcids(run,lb,bcid)
248 print(
"Run",run,
"neighbouring filled BCIDs for BCID",bcid,
":",
sorted(l1),
sorted(l2))