ATLAS Offline Software
Loading...
Searching...
No Matches
BchCleanup Namespace Reference

Functions

 usage ()
 showAdcProblems (mgr, ros, mod)
 formatIOV (iov)
 writeMergedIOV (ros, mod, since, until)

Variables

str letters = "ht:f:o:i"
list keywords = ["help","tag=","folder=","outtag=","instance="]
 opts
 extraparams
str instance = 'OFLP200'
str folderPath = "/TILE/OFL02/STATUS/ADC"
str tag = "OFLCOND-MC16-SDR-28"
str outtag = "test"
 a = a.strip()
 log = getLogger("BchCleanup")
str ischema = 'sqlite://;schema=bch-input-sqlite.db;dbname='+instance
str oschema = 'sqlite://;schema=bch-output-sqlite.db;dbname='+instance
 idb = TileCalibTools.openDbConn(ischema,'READONLY')
 folderTag = TileCalibTools.getFolderTag(idb if 'CONDBR2' in ischema else ischema, folderPath, tag)
 blobReader = TileCalibTools.TileBlobReader(idb,folderPath, folderTag)
str outtagFull = 'TileOfl02StatusAdc-'+outtag
str msg = 'AtlCoolCopy \"%s\" \"%s\" -folder /TILE/OFL02/STATUS/ADC -tag %s -outtag %s -ch1 0 -ch2 19 -create' % (ischema,oschema,folderTag,outtagFull)
 === Dump the current isBad definition isBadDef = mgr.getAdcProblems(0,1,0,0) log.info( "isBad Definition: " ) for prbCode in sorted(isBadDef.keys()): prbDesc = isBadDef[prbCode] msg = "- %2i (%s)" % (prbCode,prbDesc) log.info( msg ) log.info( "\n" )
int rosinput = int(sys.argv[1]) if len(sys.argv)>1 else 0
int rosmin = 1
int rosmax = 5
 modName = TileCalibUtils.getDrawerString(ros,mod)
 dbobjs = blobReader.getDBobjsWithinRange(ros, mod)
 mergedSince = None
int iovCounter = 0
 objPrev = None
 blobPrev = None
 calibDrawerPrev = None
int runPrev = -1
int lumPrev = -1
 obj = dbobjs.currentRef()
 objsince = obj.since()
 objuntil = obj.until()
 mergedUntil = objuntil
int run = objsince >> 32
int lum = objsince & 0xFFFFFFFF
 blob = obj.payload()[0]
 calibDrawer = None
str tempRunLum = "Starting new IOV at: [%d,%d]" % (mergedSince>>32, mergedSince&0xffffffff)
 bchDecoder = TileBchDecoder(calibDrawer.getBitPatternVersion())
 mgr = TileBchTools.TileBchMgr()
bool identical = True
int sizelo = calibDrawerPrev.getObjSizeByte()//4
int sizehi = calibDrawer.getObjSizeByte()//4
 typelo = calibDrawerPrev.getObjType()
 typehi = calibDrawer.getObjType()
 adcBits = calibDrawer.getData(chn, adc, ind)
 chnBits = calibDrawer.getData(chn, 2, ind)
 status = TileBchStatus( bchDecoder.decode(chnBits,adcBits) )
 statusPrev = TileBchStatus( bchDecoder.decode(chnBits,adcBits) )
 adclo = calibDrawerPrev.getData(chn, adc, ind)
 adchi = calibDrawer.getData(chn, adc, ind)
 chnlo = calibDrawerPrev.getData(chn, 2, ind)
 chnhi = calibDrawer.getData(chn, 2, ind)
 diff = adclo - adchi + chnlo - chnhi

Function Documentation

◆ formatIOV()

BchCleanup.formatIOV ( iov)

Definition at line 50 of file BchCleanup.py.

50def formatIOV(iov):
51 return (int(iov >> 32), int(iov & 0xFFFFFFFF))
52
53#def writeMergedIOV(fdout,outtag,ros,mod,bchDrawer,since,until):

◆ showAdcProblems()

BchCleanup.showAdcProblems ( mgr,
ros,
mod )

Definition at line 29 of file BchCleanup.py.

29def showAdcProblems(mgr,ros,mod):
30 modName = TileCalibUtils.getDrawerString(ros,mod)
31 for chn in range(TileCalibUtils.max_chan()):
32 for adc in range(TileCalibUtils.max_gain()):
33
34 stat = mgr.getAdcStatus(ros,mod,chn,adc)
35 prbs = mgr.getAdcProblems(ros,mod,chn,adc)
36 if len(prbs):
37 msg = "%s %2i %1i " % (modName,chn,adc)
38 for prbCode in sorted(prbs.keys()):
39 prbDesc = prbs[prbCode]
40 msg += " %5i (%s)" % (prbCode,prbDesc)
41 if stat.isBad():
42 msg += " => BAD"
43 elif stat.isAffected():
44 msg += " => Affected"
45 elif stat.isGood():
46 msg += " => good"
47 log.debug(msg)
48
49
static unsigned int max_gain()
Python compatibility function.
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
static unsigned int max_chan()
Python compatibility function.

◆ usage()

BchCleanup.usage ( )

Definition at line 17 of file BchCleanup.py.

17def usage():
18 print ("Usage: ",sys.argv[0]," [OPTION] ... ")
19 print ("""Uses bch-input-sqlite.db file as input, joins adjacent IOVs with same contents, keeping the
20 comments from the earliest one. Results written to bch-output-sqlite.db""")
21 print ("")
22 print ("-h, --help shows this help")
23 print ("-f, --folder= specify status folder to use ONL01, OFL01 or OFL02 ")
24 print ("-t, --tag= specify tag to use, f.i. UPD1 or UPD4")
25 print ("-o, --outtag= specify output tag to be used for cleaned up result, f.i. UPD4-99")
26 print ("-i, --instance= specify DB instance (CONDBR2 or COMP200 or OFLP200)")
27 print ("")
28
StatusCode usage()

◆ writeMergedIOV()

BchCleanup.writeMergedIOV ( ros,
mod,
since,
until )
Writes out blob into folder fdout, at channel related to
   ros,mod and with validity range given by since,until

Definition at line 54 of file BchCleanup.py.

54def writeMergedIOV(ros,mod,since,until):
55 """ Writes out blob into folder fdout, at channel related to
56 ros,mod and with validity range given by since,until
57 """
58 log.info("Writing merged IOV: [%i,%i]-[%i,%i)", (since>>32),(since&0xffffffff),(until>>32),(until&0xffffffff))
59
60 chanNum = TileCalibUtils.getDrawerIdx(ros,mod)
61 #iov1 = TileCalibTools.getCoolValidityKey(since,False)
62 #iov2 = TileCalibTools.getCoolValidityKey(until,False)
63
64 #chid=obj.channelId()
65
66
75
76 #fdout.storeObject(since, until, blob, chanNum, outtag, True)
77
78 runSince = since>>32
79 lumSince = since&0xffffffff
80 runUntil = until>>32
81 lumUntil = until&0xffffffff
82
83 #.. fix IOVs [r1,l1]-[r2,MAXLBK] --> [r1,l1]-[r2+1,0]
84 if lumUntil == 4294967295 and runUntil != 2147483647:
85 runUntil += 1
86 lumUntil = 0
87
88 msg = 'AtlCoolCopy \"%s\" \"%s\" -folder /TILE/OFL02/STATUS/ADC -tag %s -rls %i %i -rlu %i %i -alliov -outtag %s -ch %i -nrls %i %i -nrlu %i %i' % (ischema,oschema,folderTag,runSince,lumSince,runSince,lumSince+1,outtagFull,chanNum,runSince,lumSince,runUntil,lumUntil)
89 print(msg)
90
91
void print(char *figname, TCanvas *c1)
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.

Variable Documentation

◆ a

BchCleanup.a = a.strip()

Definition at line 113 of file BchCleanup.py.

◆ adcBits

BchCleanup.adcBits = calibDrawer.getData(chn, adc, ind)

Definition at line 338 of file BchCleanup.py.

◆ adchi

BchCleanup.adchi = calibDrawer.getData(chn, adc, ind)

Definition at line 347 of file BchCleanup.py.

◆ adclo

BchCleanup.adclo = calibDrawerPrev.getData(chn, adc, ind)

Definition at line 346 of file BchCleanup.py.

◆ bchDecoder

BchCleanup.bchDecoder = TileBchDecoder(calibDrawer.getBitPatternVersion())

Definition at line 291 of file BchCleanup.py.

◆ blob

BchCleanup.blob = obj.payload()[0]

Definition at line 241 of file BchCleanup.py.

◆ blobPrev

BchCleanup.blobPrev = None

Definition at line 216 of file BchCleanup.py.

◆ blobReader

BchCleanup.blobReader = TileCalibTools.TileBlobReader(idb,folderPath, folderTag)

Definition at line 159 of file BchCleanup.py.

◆ calibDrawer

BchCleanup.calibDrawer = None

Definition at line 243 of file BchCleanup.py.

◆ calibDrawerPrev

BchCleanup.calibDrawerPrev = None

Definition at line 217 of file BchCleanup.py.

◆ chnBits

BchCleanup.chnBits = calibDrawer.getData(chn, 2, ind)

Definition at line 339 of file BchCleanup.py.

◆ chnhi

BchCleanup.chnhi = calibDrawer.getData(chn, 2, ind)

Definition at line 349 of file BchCleanup.py.

◆ chnlo

BchCleanup.chnlo = calibDrawerPrev.getData(chn, 2, ind)

Definition at line 348 of file BchCleanup.py.

◆ dbobjs

BchCleanup.dbobjs = blobReader.getDBobjsWithinRange(ros, mod)

Definition at line 204 of file BchCleanup.py.

◆ diff

BchCleanup.diff = adclo - adchi + chnlo - chnhi

Definition at line 350 of file BchCleanup.py.

◆ extraparams

BchCleanup.extraparams

Definition at line 99 of file BchCleanup.py.

◆ folderPath

str BchCleanup.folderPath = "/TILE/OFL02/STATUS/ADC"

Definition at line 107 of file BchCleanup.py.

◆ folderTag

BchCleanup.folderTag = TileCalibTools.getFolderTag(idb if 'CONDBR2' in ischema else ischema, folderPath, tag)

Definition at line 156 of file BchCleanup.py.

◆ idb

BchCleanup.idb = TileCalibTools.openDbConn(ischema,'READONLY')

Definition at line 152 of file BchCleanup.py.

◆ identical

bool BchCleanup.identical = True

Definition at line 304 of file BchCleanup.py.

◆ instance

BchCleanup.instance = 'OFLP200'

Definition at line 106 of file BchCleanup.py.

◆ iovCounter

int BchCleanup.iovCounter = 0

Definition at line 214 of file BchCleanup.py.

◆ ischema

str BchCleanup.ischema = 'sqlite://;schema=bch-input-sqlite.db;dbname='+instance

Definition at line 140 of file BchCleanup.py.

◆ keywords

list BchCleanup.keywords = ["help","tag=","folder=","outtag=","instance="]

Definition at line 97 of file BchCleanup.py.

◆ letters

str BchCleanup.letters = "ht:f:o:i"

Definition at line 96 of file BchCleanup.py.

◆ log

BchCleanup.log = getLogger("BchCleanup")

Definition at line 136 of file BchCleanup.py.

◆ lum

int BchCleanup.lum = objsince & 0xFFFFFFFF

Definition at line 240 of file BchCleanup.py.

◆ lumPrev

BchCleanup.lumPrev = -1

Definition at line 219 of file BchCleanup.py.

◆ mergedSince

BchCleanup.mergedSince = None

Definition at line 212 of file BchCleanup.py.

◆ mergedUntil

BchCleanup.mergedUntil = objuntil

Definition at line 237 of file BchCleanup.py.

◆ mgr

BchCleanup.mgr = TileBchTools.TileBchMgr()

Definition at line 294 of file BchCleanup.py.

◆ modName

BchCleanup.modName = TileCalibUtils.getDrawerString(ros,mod)

Definition at line 201 of file BchCleanup.py.

◆ msg

str BchCleanup.msg = 'AtlCoolCopy \"%s\" \"%s\" -folder /TILE/OFL02/STATUS/ADC -tag %s -outtag %s -ch1 0 -ch2 19 -create' % (ischema,oschema,folderTag,outtagFull)

=== Dump the current isBad definition isBadDef = mgr.getAdcProblems(0,1,0,0) log.info( "isBad Definition: " ) for prbCode in sorted(isBadDef.keys()): prbDesc = isBadDef[prbCode] msg = "- %2i (%s)" % (prbCode,prbDesc) log.info( msg ) log.info( "\n" )

Definition at line 177 of file BchCleanup.py.

◆ obj

BchCleanup.obj = dbobjs.currentRef()

Definition at line 230 of file BchCleanup.py.

◆ objPrev

BchCleanup.objPrev = None

Definition at line 215 of file BchCleanup.py.

◆ objsince

BchCleanup.objsince = obj.since()

Definition at line 231 of file BchCleanup.py.

◆ objuntil

BchCleanup.objuntil = obj.until()

Definition at line 232 of file BchCleanup.py.

◆ opts

BchCleanup.opts

Definition at line 99 of file BchCleanup.py.

◆ oschema

str BchCleanup.oschema = 'sqlite://;schema=bch-output-sqlite.db;dbname='+instance

Definition at line 141 of file BchCleanup.py.

◆ outtag

BchCleanup.outtag = "test"

Definition at line 109 of file BchCleanup.py.

◆ outtagFull

str BchCleanup.outtagFull = 'TileOfl02StatusAdc-'+outtag

Definition at line 163 of file BchCleanup.py.

◆ rosinput

int BchCleanup.rosinput = int(sys.argv[1]) if len(sys.argv)>1 else 0

Definition at line 189 of file BchCleanup.py.

◆ rosmax

int BchCleanup.rosmax = 5

Definition at line 193 of file BchCleanup.py.

◆ rosmin

int BchCleanup.rosmin = 1

Definition at line 192 of file BchCleanup.py.

◆ run

int BchCleanup.run = objsince >> 32

Definition at line 239 of file BchCleanup.py.

◆ runPrev

BchCleanup.runPrev = -1

Definition at line 218 of file BchCleanup.py.

◆ sizehi

int BchCleanup.sizehi = calibDrawer.getObjSizeByte()//4

Definition at line 311 of file BchCleanup.py.

◆ sizelo

int BchCleanup.sizelo = calibDrawerPrev.getObjSizeByte()//4

Definition at line 310 of file BchCleanup.py.

◆ status

BchCleanup.status = TileBchStatus( bchDecoder.decode(chnBits,adcBits) )

Definition at line 340 of file BchCleanup.py.

◆ statusPrev

BchCleanup.statusPrev = TileBchStatus( bchDecoder.decode(chnBits,adcBits) )

Definition at line 344 of file BchCleanup.py.

◆ tag

BchCleanup.tag = "OFLCOND-MC16-SDR-28"

Definition at line 108 of file BchCleanup.py.

◆ tempRunLum

str BchCleanup.tempRunLum = "Starting new IOV at: [%d,%d]" % (mergedSince>>32, mergedSince&0xffffffff)

Definition at line 280 of file BchCleanup.py.

◆ typehi

BchCleanup.typehi = calibDrawer.getObjType()

Definition at line 316 of file BchCleanup.py.

◆ typelo

BchCleanup.typelo = calibDrawerPrev.getObjType()

Definition at line 315 of file BchCleanup.py.