ATLAS Offline Software
Functions
ReadCoolUPD4 Namespace Reference

Functions

def formDbString (technology, server, schema, dbname)
 
def openDatabase (dbstring)
 
def formIov (runNumber)
 
def formIovFromTo (runNumberStart, runNumber)
 
def getRunNumberStart (runNumber, k)
 this modification checks which was the k-last run before the processed one More...
 
def GetRunList (dbstring, folder, tag, runNumber, k)
 
def GetNumNoisyMods (dbstring, folder, tag, runNumber)
 
def GetNumNoisyStrips (dbstring, folder, tag, runNumber)
 

Function Documentation

◆ formDbString()

def ReadCoolUPD4.formDbString (   technology,
  server,
  schema,
  dbname 
)

Definition at line 16 of file ReadCoolUPD4.py.

16 def formDbString(technology,server,schema,dbname):
17  theString=technology+'://'+server+';schema='+schema+';dbname='+dbname
18  return theString
19 

◆ formIov()

def ReadCoolUPD4.formIov (   runNumber)

Definition at line 36 of file ReadCoolUPD4.py.

36 def formIov(runNumber):
37  s,u=((runNumber) << 32), ((runNumber + 1) << 32) - 1
38  print ("formIOV: ", s, u)
39  return s,u
40 

◆ formIovFromTo()

def ReadCoolUPD4.formIovFromTo (   runNumberStart,
  runNumber 
)

Definition at line 42 of file ReadCoolUPD4.py.

42 def formIovFromTo(runNumberStart, runNumber):
43  s,u=((runNumberStart ) << 32), ((runNumber + 1) << 32) - 1
44  print ("formIOV: ", s, u)
45  return s,u
46 

◆ GetNumNoisyMods()

def ReadCoolUPD4.GetNumNoisyMods (   dbstring,
  folder,
  tag,
  runNumber 
)

Definition at line 110 of file ReadCoolUPD4.py.

110 def GetNumNoisyMods(dbstring, folder, tag, runNumber):
111  db=openDatabase(dbstring)
112 
113  myfolder=db.getFolder(folder)
114  iovSince, iovUntil = formIov(runNumber)
115 
116  NumNoisyMods=0
117  objs=myfolder.browseObjects(iovSince,iovUntil,cool.ChannelSelection.all(),tag)
118  for obj in objs:
119  mypayload=obj.payload()
120  dfl=mypayload['DefectList']
121  if not dfl:
122  continue
123  NumNoisyMods=NumNoisyMods+1
124  objs.close()
125  db.closeDatabase()
126 
127  return NumNoisyMods
128 

◆ GetNumNoisyStrips()

def ReadCoolUPD4.GetNumNoisyStrips (   dbstring,
  folder,
  tag,
  runNumber 
)

Definition at line 130 of file ReadCoolUPD4.py.

130 def GetNumNoisyStrips(dbstring, folder, tag, runNumber):
131  db=openDatabase(dbstring)
132  myfolder=db.getFolder(folder)
133  iovSince, iovUntil = formIov(runNumber)
134 
135  #Array_numNoisyStrips, numNoisyStrips = [], 0
136  numNoisyStrips = 0
137  objs=myfolder.browseObjects(iovSince,iovUntil,cool.ChannelSelection.all(),tag)
138  for obj in objs:
139  mypayload=obj.payload()
140  dfl=mypayload['DefectList']
141  if not dfl:
142  continue
143  # line = str(obj.since()>>32)+" "+str(dfl)
144  line = str(dfl)
145  words = line.split()
146  numNoisyStripsAdds=0
147  for j in range(len(words)):
148  jk=words[j]
149  if jk.find("-")>=0:
150  sep=jk.replace ( '-', ' ' )
151  sep1=sep.split()
152  numNoisyStripsAdds=numNoisyStripsAdds+int(sep1[1])-int(sep1[0])
153  numNoisyStrips=numNoisyStrips+len(words)+numNoisyStripsAdds
154  objs.close()
155  db.closeDatabase()
156 
157  return numNoisyStrips

◆ GetRunList()

def ReadCoolUPD4.GetRunList (   dbstring,
  folder,
  tag,
  runNumber,
  k 
)

Definition at line 63 of file ReadCoolUPD4.py.

63 def GetRunList(dbstring, folder, tag, runNumber, k):
64  db=openDatabase(dbstring)
65  print('TAG ',tag,' TAG')
66  folderlist=db.listAllNodes()
67  print(' folderlist=db.listAllNodes()')
68 
69  for i in folderlist: print(i)
70 
71  myfolder=db.getFolder(folder)
72  taglist=myfolder.listTags()
73  print(' taglist=myfolder.listTags()')
74  for i in taglist: print(i)
75 
76  runNumberStart = getRunNumberStart(runNumber, k)
77 
78  iovSince, iovUntil = formIovFromTo(runNumberStart,runNumber)
79 
80  temp=[]
81  objs=myfolder.browseObjects(iovSince,iovUntil,cool.ChannelSelection.all(),tag)
82  for obj in objs:
83  #mypayload=obj.payload()
84  #dfl=mypayload['DefectList']
85  temp.append(obj.since()>>32)
86  objs.close()
87  db.closeDatabase()
88 
89  Temp=sorted(temp)
90  #print('GetRunList: array is', Temp)
91  ls=[]
92  runtmp = -999
93  if ( Temp[0] != runNumber ):
94  ls.append(Temp[0])
95  runtmp = Temp[0]
96  for i in range(len(Temp)-1):
97  if (Temp[i] != runtmp):
98  if ( Temp[i] != runNumber ):
99  ls.append(Temp[i])
100  runtmp = Temp[i]
101 
102  print(ls)
103 
104  mylist=[]
105  for i in range(k): mylist.append( ls[len(ls)-i-1] )
106 
107  return mylist
108 

◆ getRunNumberStart()

def ReadCoolUPD4.getRunNumberStart (   runNumber,
  k 
)

this modification checks which was the k-last run before the processed one

Definition at line 49 of file ReadCoolUPD4.py.

49 def getRunNumberStart(runNumber, k):
50  runlistfile = open("/afs/cern.ch/work/s/sctcalib/lastRuns.txt", mode = 'r')
51  content = runlistfile.read()
52  runlistfile.close()
53  content_list = content.split("\n")
54  content_list = [line for line in content_list if line.strip()]
55  integer_int_list = list(map(int, content_list))
56  if (runNumber >= integer_int_list[-1]):
57  RNS = integer_int_list[len(integer_int_list)-(k+5)]
58  else:
59  RNS = integer_int_list[integer_int_list.index(runNumber)-(k+5)]
60  return RNS
61 

◆ openDatabase()

def ReadCoolUPD4.openDatabase (   dbstring)

Definition at line 21 of file ReadCoolUPD4.py.

21 def openDatabase(dbstring):
22  dbSvc=cool.DatabaseSvcFactory.databaseService()
23  technology='oracle'
24  server='ATLAS_COOLPROD'
25  [schema,dbname]=dbstring.split('/')
26  myDbString=formDbString(technology, server, schema, dbname)
27  try:
28  db=dbSvc.openDatabase(myDbString)
29  except Exception as e:
30  print('Problem opening %s in GetRunList'%myDbString)
31  print(e)
32  sys.exit(-1)
33  return db
34 
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
ReadCoolUPD4.formIov
def formIov(runNumber)
Definition: ReadCoolUPD4.py:36
ReadCoolUPD4.formDbString
def formDbString(technology, server, schema, dbname)
Definition: ReadCoolUPD4.py:16
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
ReadCoolUPD4.openDatabase
def openDatabase(dbstring)
Definition: ReadCoolUPD4.py:21
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
ReadCoolUPD4.formIovFromTo
def formIovFromTo(runNumberStart, runNumber)
Definition: ReadCoolUPD4.py:42
ReadCoolUPD4.getRunNumberStart
def getRunNumberStart(runNumber, k)
this modification checks which was the k-last run before the processed one
Definition: ReadCoolUPD4.py:49
ReadCoolUPD4.GetRunList
def GetRunList(dbstring, folder, tag, runNumber, k)
Definition: ReadCoolUPD4.py:63
ReadCoolUPD4.GetNumNoisyMods
def GetNumNoisyMods(dbstring, folder, tag, runNumber)
Definition: ReadCoolUPD4.py:110
Trk::open
@ open
Definition: BinningType.h:40
ReadCoolUPD4.GetNumNoisyStrips
def GetNumNoisyStrips(dbstring, folder, tag, runNumber)
Definition: ReadCoolUPD4.py:130
str
Definition: BTagTrackIpAccessor.cxx:11