Esempio n. 1
0
def getMissingFebs(run, tag=None):

    if tag is None:
        sys.path.append('/afs/cern.ch/user/a/atlcond/utils/python/')
        from AtlCoolBKLib import resolveAlias
        resolver = resolveAlias()
        tag = resolver.getCurrent().replace("*", "ST")

    retval = []

    dbName = "COOLOFL_LAR/CONDBR2"
    fName = "/LAR/BadChannelsOfl/MissingFEBs"

    dbSvc = cool.DatabaseSvcFactory.databaseService()
    try:
        db = dbSvc.openDatabase(dbName)
    except Exception, e:
        print "Problems connecting to database:", e
        return None
Esempio n. 2
0
def getCurrentFolderTag(dbname,folderName):
    current=None
    next=None

    #1. Get current and next global tags using resolver class in ~atlcond
    resolver=resolveAlias()
    currentGlobal=resolver.getCurrent().replace("*","ST")
    nextGlobal=resolver.getNext().replace("*","ST")

    print('currentGlobal: ',currentGlobal)
    #2. Open the DB to resolve this gobal tag for the given folder
    dbSvc = cool.DatabaseSvcFactory.databaseService() 
    db = dbSvc.openDatabase(dbname)
    f=db.getFolder(folderName)
    try:
        current=f.resolveTag(currentGlobal)
    except:
        print('Warning: could not resolve ',currentGlobal,' in db: ',dbname)
        if "DBR2" in dbname:
           print('resolving for the global CONDBR2-BLKPA-2014-00')
           tmpGlobal='CONDBR2-BLKPA-2014-00'
        else:      
           print('resolving for the global COMCOND-BLKPA-RUN1-06')
           tmpGlobal='COMCOND-BLKPA-RUN1-06'

        try:
           current=f.resolveTag('CONDBR2-BLKPA-2014-00')
        except:
           print('Also not working, giving up')
           pass
        pass
    if len(nextGlobal)>2:
        # NEXT exists, try to resolve it
        try:
            next=f.resolveTag(nextGlobal)
        except:
            pass
        pass
    
    db.closeDatabase()
    return (current,next)
Esempio n. 3
0
def getMissingFebs(run, tag=None):

    if tag is None:
        sys.path.append('/afs/cern.ch/user/a/atlcond/utils/python/')
        from AtlCoolBKLib import resolveAlias
        resolver = resolveAlias()
        tag = resolver.getCurrent().replace("*", "ST")

    retval = []

    dbName = "COOLOFL_LAR/CONDBR2"
    fName = "/LAR/BadChannelsOfl/MissingFEBs"

    dbSvc = cool.DatabaseSvcFactory.databaseService()
    try:
        db = dbSvc.openDatabase(dbName)
    except Exception as e:
        print("Problems connecting to database:", e)
        return None

    print("getMissingFEBs: Checking tag", tag, "for run", run)

    if not db.existsFolder(fName):
        print("ERROR: Folder", fName, "not found in ", dbName)
        return None

    f = db.getFolder(fName)
    if not f.existsUserTag(tag):
        try:
            t = f.resolveTag(tag)
        except Exception as e:
            print("ERROR: Tag", tag, "not defined in folder", fName)
            print(e)
            return None
    else:
        t = tag

    cl_LArBadChannelDBTools = ROOT.LArBadChannelDBTools
    cl_AthenaAttributeList = ROOT.AthenaAttributeList
    ms = cl_LArBadChannelDBTools.getDefaultMsgStream()

    ts1 = cool.ValidityKey(1 + (run << 32))
    ts2 = cool.ValidityKey(((run + 1) << 32) - 1)
    itr = f.browseObjects(ts1, ts2, cool.ChannelSelection(0), t)
    while itr.goToNext():
        obj = itr.currentRef()
        pl = obj.payload()
        #print (obj.since(), obj.until(), pl)

        al = cl_AthenaAttributeList(pl.attributeList())
        vect_BadFebEntry = cl_LArBadChannelDBTools.readBadFeb(al, ms)

        feblist = set()
        for (id, mf) in vect_BadFebEntry:
            if not mf.good():
                feblist.add(id.get_identifier32().get_compact())

        retval.append((obj.since(), obj.until(), feblist))

    db.closeDatabase()
    return retval
Esempio n. 4
0
include("LArConditionsCommon/LArIdMap_comm_jobOptions.py")
include("LArIdCnv/LArIdCnv_joboptions.py")

# Event selector
import AthenaPoolCnvSvc.ReadAthenaPool

###############################################################

from LArConditionsCommon.LArCondFlags import larCondFlags
include("LArConditionsCommon/LArConditionsCommon_comm_jobOptions.py")

if not hasattr(runArgs, "conditionsTag") or runArgs.conditionsTag == "CURRENT":
    printfunc("Resolving 'CURRENT' express conditions tag ...")
    sys.path.append('/afs/cern.ch/user/a/atlcond/utils/python/')
    from AtlCoolBKLib import resolveAlias
    resolver = resolveAlias()
    currentGlobalES = resolver.getCurrentES().replace("*", "ST")
    printfunc("Found ", currentGlobalES)
    svcMgr.IOVDbSvc.GlobalTag = currentGlobalES
else:
    svcMgr.IOVDbSvc.GlobalTag = runArgs.conditionsTag
#"COMCOND-BLKP-005-05"

if hasattr(runArgs, "skipEvents"):
    svcMgr.EventSelector.SkipEvents = runArgs.skipEvents

if hasattr(runArgs, "maxEvents"):
    theApp.EvtMax = runArgs.maxEvents

#
#####################