Exemplo n.º 1
0
 def printMenu(self, run):
     if not self.opt.menu: return
     if self.opt.l1:
         TriggerCoolUtil.printL1Menu(self.dbconn, run, self.opt.verbosity)
     if self.opt.l2 or self.opt.ef:
         TriggerCoolUtil.printHLTMenu(self.dbconn,
                                      run,
                                      self.opt.verbosity,
                                      printL2=self.opt.l2,
                                      printEF=self.opt.ef)
Exemplo n.º 2
0
def _getBunchGroupKey(run,lb):
    runlist = [[run,run]]
    dbconn  = TriggerCoolUtil.GetConnection("COMP",0)

    bGroupkeys = TriggerCoolUtil.getBunchGroupKey(dbconn, runlist)
    print bGroupkeys[run]['BGKey']
    
    for k,b,e in bGroupkeys[run]['BGKey']:
        if b>lb: break
        bGroup=k

    return bGroup
Exemplo n.º 3
0
    def update(self):
        # SOR
        if self.sor == None:
            db = CoolDB.get("COOLONL_TDAQ/COMP200")
            f = db.getFolder("/TDAQ/RunCtrl/SOR_Params")
            o = f.findObject(cool.ValidityKey(self.runno << 32), 0)
            self.sor = toSec(o.get().payload()['SORTime'])

        # SMK
        if self.smk == None:
            keys = TriggerCoolUtil.getHLTConfigKeys(
                CoolDB.get('COOLONL_TRIGGER/COMP200'),
                [[self.runno, self.runno]])

            if not self.runno in keys:
                raise RuntimeError, ("Cannot find SMK for run %d" % self.runno)
            self.smk = int(keys[self.runno]['SMK'])

        # GlobalTag
        if self.globalTag == None:
            res = getPropertyFromDB('TRIGGERDB', self.smk, 'IOVDbSvc',
                                    'GlobalTag')
            if len(res) == 0:
                raise RuntimeError, ('Cannot find GlobalTag for SMK %d' %
                                     self.smk)

            self.globalTag = res[0][3]
Exemplo n.º 4
0
def get_trigconf_keys(run_number):
    """Read HLT keys from COOL"""

    from TrigConfStorage.TriggerCoolUtil import TriggerCoolUtil

    cdb = CondDB(run_number)
    db = TriggerCoolUtil.GetConnection(cdb.db_instance())
    run_range = [[run_number, run_number]]
    d = {}
    d['SMK'] = TriggerCoolUtil.getHLTConfigKeys(db,
                                                run_range)[run_number]['SMK']
    # First HLT/L1 prescale key used in the run
    d['HLTPSK'] = TriggerCoolUtil.getHLTPrescaleKeys(
        db, run_range)[run_number]['HLTPSK2'][0][0]
    d['LVL1PSK'] = TriggerCoolUtil.getL1ConfigKeys(
        db, run_range)[run_number]['LVL1PSK'][0][0]

    return d
Exemplo n.º 5
0
def _getKeys(run,lb):
    runlist = [[run,run]]
    dbconn  = TriggerCoolUtil.GetConnection("COMP",0)

    config  = TriggerCoolUtil.getHLTConfigKeys(dbconn, runlist)
    l1keys  = TriggerCoolUtil.getL1ConfigKeys(dbconn, runlist)
    hltkeys = TriggerCoolUtil.getHLTPrescaleKeys(dbconn, runlist)
    
    smk=config[run]['SMK']
    
    for k,b,e in l1keys[run]['LVL1PSK']:
        if b>lb: break
        l1psk=k

    for k,b,e in hltkeys[run]['HLTPSK2']:
        if b>lb: break
        hltpsk=k

    return (smk,l1psk,hltpsk)
Exemplo n.º 6
0
    def getConfigKeys(self):
        hltkeys   = TriggerCoolUtil.getHLTConfigKeys(self.dbconn, self.runlist)
        hltpskeys = TriggerCoolUtil.getHLTPrescaleKeys(self.dbconn, self.runlist)
        l1keys    = TriggerCoolUtil.getL1ConfigKeys(self.dbconn, self.runlist)

        runs = list(Set(hltkeys.keys()+hltpskeys.keys()+l1keys.keys()))
        runs.sort()
        runStartTimes = None
        if self.opt.time:
            runStartTimes = TriggerCoolUtil.getRunStartTime(self.dbconn, self.runlist, runs)

        allkeys = dict([(r,{}) for r in runs])
        for r in runs:
            if r in hltkeys:   allkeys[r].update(hltkeys[r])
            if r in hltpskeys: allkeys[r].update(hltpskeys[r])
            if r in l1keys:    allkeys[r].update(l1keys[r])
            if runStartTimes and r in runStartTimes: allkeys[r].update(runStartTimes[r])

        return (runs, allkeys)
Exemplo n.º 7
0
 def diffMenu(self, keys1, keys2):
     if not self.opt.diff: return
     from TrigConfStorage.TriggerCoolUtil import TriggerCoolUtil
     xml1 = TriggerCoolUtil.writeXMLFiles(keys1,self.opt.verbosity)
     xml2 = TriggerCoolUtil.writeXMLFiles(keys2,self.opt.verbosity)
     if self.opt.l1:
         TriggerCoolUtil.diffL1Menu(xml1[0],xml2[0],verbose=self.opt.verbosity>0)
     if self.opt.l2 or self.opt.ef:
         TriggerCoolUtil.diffHLTMenu(xml1[1],xml2[1],verbose=self.opt.verbosity>0)
Exemplo n.º 8
0
def HLTNames(Run_No):

  ## Getting infor from COOL on Chain ID <--> Chain Name
  ## for a specific run (SMK)
  
  dbconn = TriggerCoolUtil.GetConnection("COMP")
  limmin = Run_No<<32
  limmax = (Run_No+1)<<32

  HLTConn = dbconn.getFolder("/TRIGGER/HLT/Menu" )
  HLTChansel = cool.ChannelSelection.all()
  HLTObjs = HLTConn.browseObjects(limmin,limmax,HLTChansel)

  chainNames = {}
  Chain_Info = []
  ChainCount = 0
  while HLTObjs.goToNext():
    HLTObj = HLTObjs.currentRef()
    HLTPayload = HLTObj.payload()
    HLTLevel   = HLTPayload['TriggerLevel']
    HLTName    = HLTPayload['ChainName']
    HLTCounter = HLTPayload['ChainCounter']
    chainNames[(HLTLevel,HLTCounter)] = HLTName
    if (HLTCounter>ChainCount): ChainCount = HLTCounter

  for i in range(ChainCount+1):
    Chain_Info.insert(i,0)


  for c in chainNames:
    name = chainNames[c]
    if (c[0]=='L2'):
      Chain_Info.pop(int(c[1]))
      Chain_Info.insert(int(c[1]),name.strip("L2_"))

  return Chain_Info
Exemplo n.º 9
0
def TriggerDBInfo(run):
    #Get the connection to CONDBR2  
    dbconn  = TriggerCoolUtil.GetConnection("CONDBR2")
    #dbconn  = TriggerCoolUtil.GetConnection("COMP")
    l1Info = []
    
    limmin=run<<32
    limmax=(run+1)<<32

    ## Get L1 Info from DB
    l1Conn= dbconn.getFolder( "/TRIGGER/LVL1/Menu" )
    l1Chansel=cool.ChannelSelection.all()
    l1Objs = l1Conn.browseObjects( limmin,limmax,l1Chansel)
    itemName = {}
    l1Counts = 0
    while l1Objs.goToNext():
        l1Obj=l1Objs.currentRef()
        l1Channel = l1Obj.channelId()
        l1Payload = l1Obj.payload()
        itemname = l1Payload['ItemName']
        itemName[l1Channel] = itemname
        if (l1Channel>l1Counts): l1Counts = l1Channel

    for i in range(l1Counts+1):
        l1Info.insert(i,0)

    for c in itemName:
        name = itemName[c]
        l1Info.pop(c)
        l1Info.insert(c,name)

    # L1 Info from DB failed, now try from XML file 
    if len(l1Info) == 1 and l1Info[0] == 0  :
        msg.info('Failed to get L1Info from DB now trying using xml file hack')
        l1Info = getL1InfoXML()



    ## Get HLT Info
    f = dbconn.getFolder( "/TRIGGER/HLT/Menu" )
    chansel=cool.ChannelSelection.all()
    objs = f.browseObjects( limmin,limmax,chansel)
    hltInfo = []
    chainCount = 0
    chainNamesHLT = {}

    while objs.goToNext():
        hltObj=objs.currentRef()
        hltPayload=hltObj.payload()
        hltName     = hltPayload['ChainName']
        hltCounter  = hltPayload['ChainCounter']
        chainNamesHLT[int(hltCounter)] = hltName
        hltInfo = (max(chainNamesHLT.keys())+1) * [0]

    for channel in chainNamesHLT:
        hltInfo.pop(channel)
        hltInfo.insert(channel,chainNamesHLT[channel])

    # Get HLT Release number
    f = dbconn.getFolder( "/TRIGGER/HLT/HltConfigKeys" )
    chansel=cool.ChannelSelection.all()
    objs = f.browseObjects( limmin,limmax,chansel)
    relInfo = 'unknown'
        
    while objs.goToNext():
        relObj=objs.currentRef()
        relPayload=relObj.payload()
        confsrc     = relPayload['ConfigSource'].split(',')
        if len(confsrc)>1: relInfo = confsrc[1]
        msg.info("release: %s", relInfo)

    return (l1Info, hltInfo, relInfo) 
Exemplo n.º 10
0
 def init(self):
     self.runlist = TriggerCoolUtil.GetRunRanges(self.opt.runlist)
     self.dbconn = TriggerCoolUtil.GetConnection(self.opt.db,
                                                 self.opt.verbosity)
Exemplo n.º 11
0
 def printStreams(self, run):
     if not self.opt.streams: return
     TriggerCoolUtil.printStreams(self.dbconn, run, self.opt.verbosity)
Exemplo n.º 12
0
 def writeXML(self, keys):
     if not self.opt.xml: return
     TriggerCoolUtil.writeXMLFiles(keys, self.opt.verbosity)